on master help sign in
Stop `parens` from escaping the Ast module.
commit368b63c4f5ac0f6e17a313bb079d061c22794ffe authorevancz <info@elm-lang.org> dateSun 10 Jun 2012, 02:09 (14 years ago) parent001d620
1 file changed+3−3
elm/src/Ast.hs+3−3
elm/src/Ast.hs+3−3
@@ -41,16 +41,16 @@ pnil = PData "Nil" []
4141plist = foldr pcons pnil
4242ptuple es = PData ("Tuple" ++ show (length es)) es
4343
44−parens s = "(" ++ s ++ ")"
45−
4644instance Show Pattern where
4745 show (PVar x) = x
4846 show PAnything = "_"
4947 show (PData "Cons" [hd@(PData "Cons" _),tl]) =
5048 parens (show hd) ++ " : " ++ show tl
49+ where parens s = "(" ++ s ++ ")"
5150 show (PData "Cons" [hd,tl]) = show hd ++ " : " ++ show tl
5251 show (PData "Nil" []) = "[]"
5352 show (PData name ps) =
5453 if take 5 name == "Tuple" && all isDigit (drop 5 name) then
5554 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 ++ ")"