@@ -41,8 +41,11 @@ instance Pretty Type where
41 | Help.isTuple name -> P.parens . P.sep . P.punctuate P.comma $ map pretty 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 _ _ -> P.braces $ case ext of
45+ EmptyRecord -> prettyFields
44− Record fields ext -> P.braces $ P.hang (pretty ext <+> P.text "|") 4 prettyFields
46+ _ -> P.hang (pretty ext <+> P.text "|") 4 prettyFields
48+ (fields, ext) = collectRecords tipe
46 prettyField (f,t) = P.text f <+> P.text ":" <+> pretty t
49 prettyField (f,t) = P.text f <+> P.text ":" <+> pretty t
47 prettyFields = commaSep . map prettyField $ fields
50 prettyFields = commaSep . map prettyField $ fields
@@ -52,6 +55,13 @@ collectLambdas tipe =
52 Lambda arg body -> pretty arg : collectLambdas body
55 Lambda arg body -> pretty arg : collectLambdas body
53 _ -> [pretty tipe]
56 _ -> [pretty tipe]
58+collectRecords = go []
62+ Record fs ext -> go (fs ++ fields) ext
55prettyParens tipe = parensIf needed (pretty tipe)
65prettyParens tipe = parensIf needed (pretty tipe)