summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo.dinapoli@gmail.com>2019-07-13 18:07:17 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-07-20 07:52:01 -0400
commit7b42ece52049756e046729a7c6f43b544bfd9ea6 (patch)
tree30c2a5afc148d276f2fb88f37e9e5f2d7e873bd7 /compiler
parent08ad7ef4d26d40f94ba01fdbcadc5c50aeba8ad8 (diff)
downloadhaskell-7b42ece52049756e046729a7c6f43b544bfd9ea6.tar.gz
Line wrap when pp long expressions (fixes #16874)
This commit fixes #16874 by using `fsep` rather than `sep` when pretty printing long patterns and expressions.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/hsSyn/HsExpr.hs2
-rw-r--r--compiler/hsSyn/HsPat.hs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs
index 6bfdad1600..69379bc1ad 100644
--- a/compiler/hsSyn/HsExpr.hs
+++ b/compiler/hsSyn/HsExpr.hs
@@ -1077,7 +1077,7 @@ ppr_apps (HsApp _ (L _ fun) arg) args
= ppr_apps fun (Left arg : args)
ppr_apps (HsAppType _ (L _ fun) arg) args
= ppr_apps fun (Right arg : args)
-ppr_apps fun args = hang (ppr_expr fun) 2 (sep (map pp args))
+ppr_apps fun args = hang (ppr_expr fun) 2 (fsep (map pp args))
where
pp (Left arg) = ppr arg
-- pp (Right (LHsWcTypeX (HsWC { hswc_body = L _ arg })))
diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs
index 9f8d2a5ed4..06270e8a89 100644
--- a/compiler/hsSyn/HsPat.hs
+++ b/compiler/hsSyn/HsPat.hs
@@ -584,7 +584,7 @@ pprUserCon c details = pprPrefixOcc c <+> pprConArgs details
pprConArgs :: (OutputableBndrId (GhcPass p))
=> HsConPatDetails (GhcPass p) -> SDoc
-pprConArgs (PrefixCon pats) = sep (map (pprParendLPat appPrec) pats)
+pprConArgs (PrefixCon pats) = fsep (map (pprParendLPat appPrec) pats)
pprConArgs (InfixCon p1 p2) = sep [ pprParendLPat appPrec p1
, pprParendLPat appPrec p2 ]
pprConArgs (RecCon rpats) = ppr rpats