on master help sign in
Fix pretty printing for tuples as discoered by @JoeyEremondi and/or @jmite in PR #446

This fix uses some existing functions for reliably figuring out if something is a tuple.

commit6febb89fcd3dd72892e18d91fe49ceaf93d34c85 authorEvan Czaplicki <info@elm-lang.org> dateTue 14 Jan 2014, 16:13 (13 years ago) parent1191c8a
1 file changed+3−1
compiler/SourceSyntax/Expression.hs+3−1
compiler/SourceSyntax/Expression.hs+3−1
@@ -128,7 +128,9 @@ instance Pretty def => Pretty (Expr' def) where
128128 pretty' (p,b) = pretty p <+> P.text "->" <+> pretty b
129129 Data "::" [hd,tl] -> pretty hd <+> P.text "::" <+> pretty tl
130130 Data "[]" [] -> P.text "[]"
131− Data name es -> P.hang (P.text name) 2 (P.sep (map prettyParens es))
131+ Data name es
132+ | Help.isTuple name -> P.parens (commaCat (map pretty es))
133+ | otherwise -> P.hang (P.text name) 2 (P.sep (map prettyParens es))
132134 Access e x -> prettyParens e <> P.text "." <> variable x
133135 Remove e x -> P.braces (pretty e <+> P.text "-" <+> variable x)
134136 Insert (Location.L _ (Remove e y)) x v ->