git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Small improvements to the pretty printer
0cabf01John Lenz
src/Language/PureScript/Pretty/Values.hs+5−3
@@ -71,7 +71,7 @@ literals = mkPattern' match
71 ]
71 ]
72 match (Var ident) = return $ show ident
72 match (Var ident) = return $ show ident
73 match (Do els) = concat <$> sequence
73 match (Do els) = concat <$> sequence
74− [ return "do "
74+ [ return "do\n"
75 , withIndent $ prettyPrintMany prettyPrintDoNotationElement els
75 , withIndent $ prettyPrintMany prettyPrintDoNotationElement els
76 , currentIndent
76 , currentIndent
77 ]
77 ]
@@ -99,7 +99,10 @@ prettyPrintCaseAlternative (CaseAlternative binders result) =
99 , prettyPrintResult result
99 , prettyPrintResult result
100 ]
100 ]
101 where
101 where
102− prettyPrintResult (Left gs) = concat <$> mapM prettyPrintGuardedValue gs
102+ prettyPrintResult (Left gs) = concat <$> sequence
103+ [ return "\n"
104+ , withIndent $ prettyPrintMany prettyPrintGuardedValue gs
105+ ]
103 prettyPrintResult (Right v) = (" -> " ++) <$> prettyPrintValue' v
106 prettyPrintResult (Right v) = (" -> " ++) <$> prettyPrintValue' v
104
107
105 prettyPrintGuardedValue (grd, val) =
108 prettyPrintGuardedValue (grd, val) =
@@ -108,7 +111,6 @@ prettyPrintCaseAlternative (CaseAlternative binders result) =
108 , prettyPrintValue' grd
111 , prettyPrintValue' grd
109 , return " -> "
112 , return " -> "
110 , prettyPrintValue' val
113 , prettyPrintValue' val
111− , return "\n"
112 ]
114 ]
113
115
114prettyPrintDoNotationElement :: DoNotationElement -> StateT PrinterState Maybe String
116prettyPrintDoNotationElement :: DoNotationElement -> StateT PrinterState Maybe String