From 3939b1fa57007fabb350dc91eb13b66f9480c244 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Sun, 13 May 2018 21:09:14 +0200 Subject: Improve printing --- Abs.hs | 8 ++++++-- 1 file 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 -- cgit v1.2.3