@@ -41,16 +41,16 @@ pnil = PData "Nil" []
41plist = foldr pcons pnil
41plist = foldr pcons pnil
42ptuple es = PData ("Tuple" ++ show (length es)) es
42ptuple es = PData ("Tuple" ++ show (length es)) es
44−parens s = "(" ++ s ++ ")"
46instance Show Pattern where
44instance Show Pattern where
47 show (PVar x) = x
45 show (PVar x) = x
48 show PAnything = "_"
46 show PAnything = "_"
49 show (PData "Cons" [hd@(PData "Cons" _),tl]) =
47 show (PData "Cons" [hd@(PData "Cons" _),tl]) =
50 parens (show hd) ++ " : " ++ show tl
48 parens (show hd) ++ " : " ++ show tl
49+ where parens s = "(" ++ s ++ ")"
51 show (PData "Cons" [hd,tl]) = show hd ++ " : " ++ show tl
50 show (PData "Cons" [hd,tl]) = show hd ++ " : " ++ show tl
52 show (PData "Nil" []) = "[]"
51 show (PData "Nil" []) = "[]"
53 show (PData name ps) =
52 show (PData name ps) =
54 if take 5 name == "Tuple" && all isDigit (drop 5 name) then
53 if take 5 name == "Tuple" && all isDigit (drop 5 name) then
55 parens . intercalate ", " $ map show ps
54 parens . intercalate ", " $ map show ps
56− else (if null ps then id else parens) $ unwords (name : map show ps)
55+ else (if null ps then id else parens) $ unwords (name : map show ps)
56+ where parens s = "(" ++ s ++ ")"