on master help sign in
Make pretty printing for types prettier
eaa751dEvan Czaplicki
compiler/SourceSyntax/Type.hs+2−1
@@ -38,7 +38,7 @@ instance Pretty Type where
38 Var x -> P.text x
38 Var x -> P.text x
39 Data "_List" [t] -> P.brackets (pretty t)
39 Data "_List" [t] -> P.brackets (pretty t)
40 Data name tipes
40 Data name tipes
41− | Help.isTuple name -> P.parens . P.sep . P.punctuate P.comma $ map prettyParens tipes
41+ | Help.isTuple name -> P.parens . P.sep . P.punctuate P.comma $ map pretty tipes
42 | otherwise -> P.hang (P.text name) 2 (P.sep $ map prettyParens tipes)
42 | otherwise -> P.hang (P.text name) 2 (P.sep $ map prettyParens tipes)
43 EmptyRecord -> P.braces P.empty
43 EmptyRecord -> P.braces P.empty
44 Record fields ext -> error "not done yet"
44 Record fields ext -> error "not done yet"
@@ -54,6 +54,7 @@ prettyParens tipe = parensIf needed (pretty tipe)
54 needed =
54 needed =
55 case tipe of
55 case tipe of
56 Lambda _ _ -> True
56 Lambda _ _ -> True
57+ Data _ [] -> False
57 Data _ _ -> True
58 Data _ _ -> True
58 _ -> False
59 _ -> False
59
60