m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-13 21:09:14 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2018-05-13 21:09:14 +0200
commit3939b1fa57007fabb350dc91eb13b66f9480c244 (patch)
tree7d3ba2268e0cbe27b5df3e0b2bbc36e8ad7b7822
parentbdc72de514f63440a634d011faedfbeef770ed1f (diff)
Improve printing
-rw-r--r--Abs.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Abs.hs b/Abs.hs
index cfdd854..2380fa1 100644
--- a/Abs.hs
+++ b/Abs.hs
@@ -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