git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #2497 from purescript/2039

Fix some issues with the pretty printer

commit39a1b433a5613fb3d40f6f53492b1d2dddad9db9 authorPhil Freeman <paf31@cantab.net> dateFri 23 Dec 2016, 10:15 (10 years ago) parent820e96fd214e2e
1 file changed+4−4
src/Language/PureScript/Pretty/Values.hs+4−4
src/Language/PureScript/Pretty/Values.hs+4−4
@@ -54,15 +54,15 @@ prettyPrintValue d (IfThenElse cond th el) =
5454 // moveRight 2 (vcat left [ text "then " <> prettyPrintValueAtom (d - 1) th
5555 , text "else " <> prettyPrintValueAtom (d - 1) el
5656 ])
57−prettyPrintValue d (Accessor prop val) = prettyPrintValueAtom (d - 1) val <> textT ("." Monoid.<> prettyPrintObjectKey prop)
58−prettyPrintValue d (ObjectUpdate o ps) = prettyPrintValueAtom (d - 1) o <> text " " <> list '{' '}' (\(key, val) -> textT (key Monoid.<> " = ") <> prettyPrintValue (d - 1) val) ps
57+prettyPrintValue d (Accessor prop val) = prettyPrintValueAtom (d - 1) val `before` textT ("." Monoid.<> prettyPrintObjectKey prop)
58+prettyPrintValue d (ObjectUpdate o ps) = prettyPrintValueAtom (d - 1) o `beforeWithSpace` list '{' '}' (\(key, val) -> textT (key Monoid.<> " = ") <> prettyPrintValue (d - 1) val) ps
5959prettyPrintValue d (App val arg) = prettyPrintValueAtom (d - 1) val `beforeWithSpace` prettyPrintValueAtom (d - 1) arg
6060prettyPrintValue d (Abs (Left arg) val) = text ('\\' : T.unpack (showIdent arg) ++ " -> ") // moveRight 2 (prettyPrintValue (d - 1) val)
6161prettyPrintValue d (Abs (Right arg) val) = text ('\\' : T.unpack (prettyPrintBinder arg) ++ " -> ") // moveRight 2 (prettyPrintValue (d - 1) val)
6262prettyPrintValue d (TypeClassDictionaryConstructorApp className ps) =
6363 text (T.unpack (runProperName (disqualify className)) ++ " ") <> prettyPrintValueAtom (d - 1) ps
6464prettyPrintValue d (Case values binders) =
65− (text "case " <> foldl1 beforeWithSpace (map (prettyPrintValueAtom (d - 1)) values) <> text " of") //
65+ (text "case " <> foldr beforeWithSpace (text "of") (map (prettyPrintValueAtom (d - 1)) values)) //
6666 moveRight 2 (vcat left (map (prettyPrintCaseAlternative (d - 1)) binders))
6767prettyPrintValue d (Let ds val) =
6868 text "let" //
@@ -96,7 +96,7 @@ prettyPrintValueAtom d (BinaryNoParens op lhs rhs) =
9696 prettyPrintValue (d - 1) lhs `beforeWithSpace` printOp op `beforeWithSpace` prettyPrintValue (d - 1) rhs
9797 where
9898 printOp (Op (Qualified _ name)) = text $ T.unpack $ runOpName name
99− printOp expr = text "`" <> prettyPrintValue (d - 1) expr <> text "`"
99+ printOp expr = text "`" <> prettyPrintValue (d - 1) expr `before` text "`"
100100prettyPrintValueAtom d (TypedValue _ val _) = prettyPrintValueAtom d val
101101prettyPrintValueAtom d (PositionedValue _ _ val) = prettyPrintValueAtom d val
102102prettyPrintValueAtom d (Parens expr) = (text "(" <> prettyPrintValue d expr) `before` text ")"