diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2018-05-13 21:09:14 +0200 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2018-05-13 21:09:14 +0200 |
commit | 3939b1fa57007fabb350dc91eb13b66f9480c244 (patch) | |
tree | 7d3ba2268e0cbe27b5df3e0b2bbc36e8ad7b7822 | |
parent | bdc72de514f63440a634d011faedfbeef770ed1f (diff) |
Improve printing
-rw-r--r-- | Abs.hs | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -21,7 +21,11 @@ instance Show Val where show (VAbs x t _ _) = "#(lambda " ++ (show x) ++ " : " ++ (show t) ++ ")" show (VTr) = "true" show (VFl) = "false" - show (VVrnt l v _) = "<" ++ (show l) ++ " " ++ (show v) ++ ">" - show (VTpl vs) = "{" ++ (show vs) ++ "}" + show (VVrnt (Ident l) v _) = "<" ++ l ++ " " ++ (show v) ++ ">" + show (VTpl vs) = "{" ++ (show' vs) ++ "}" show (VNil t) = "nil" show (VCons v1 v2) = "(cons " ++ (show v1) ++ " " ++ (show v2) ++ ")" + +show' = cleanup . Prelude.foldl (\s v -> s ++ (show v) ++ ", ") "" + where cleanup [] = "" + cleanup l = init $ init l |