git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Pretty print array literals without newlines

Array literals should be pretty printed without using newlines. The problem is a construct like `App something (ArrayLiteral ...)` will not be pretty-printed properly, since the pretty-printing of `App` resets the indentation back to zero when printing the array literal, so that the lines of the array literal will not be indented properly. Rather than thread the current indentation level, just pretty print an array literal without newlines similar to how objects are pretty-printed.

commit3eb51d0da3b3e56b969db442d7d53c0310983dfb authorJohn Lenz <lenz@math.uic.edu> dateThu 9 Jul 2015, 19:37 (11 years ago) parentb197ac5
1 file changed+1−5
src/Language/PureScript/Pretty/Values.hs+1−5
src/Language/PureScript/Pretty/Values.hs+1−5
@@ -40,11 +40,7 @@ literals = mkPattern' match
4040 match (CharLiteral c) = return $ show c
4141 match (BooleanLiteral True) = return "true"
4242 match (BooleanLiteral False) = return "false"
43− match (ArrayLiteral xs) = concat <$> sequence
44− [ return "[ "
45− , withIndent $ prettyPrintMany prettyPrintValue' xs
46− , return " ]"
47− ]
43+ match (ArrayLiteral xs) = return $ "[" ++ intercalate ", " (map prettyPrintValue xs) ++ "]"
4844 match (ObjectLiteral ps) = prettyPrintObject' $ second Just `map` ps
4945 match (ObjectConstructor ps) = prettyPrintObject' ps
5046 match (ObjectGetter prop) = return $ "(." ++ prop ++ ")"