From: simonpj@microsoft.com Date: Thu, 29 Oct 2009 12:16:01 +0000 (+0000) Subject: Tidy up pretty-printing (use ppUnless) X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=c7517d84fe15a202029d5a77dfaf51c87e7e7234;p=ghc-hetmet.git Tidy up pretty-printing (use ppUnless) --- diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs index c3f38ca..6530ad6 100644 --- a/compiler/hsSyn/HsExpr.lhs +++ b/compiler/hsSyn/HsExpr.lhs @@ -777,8 +777,8 @@ pprGRHSs :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> GRHSs idR -> SDoc pprGRHSs ctxt (GRHSs grhss binds) = vcat (map (pprGRHS ctxt . unLoc) grhss) - $$ if isEmptyLocalBinds binds then empty - else text "where" $$ nest 4 (pprBinds binds) + $$ ppUnless (isEmptyLocalBinds binds) + (text "where" $$ nest 4 (pprBinds binds)) pprGRHS :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> GRHS idR -> SDoc diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs index c886766..af921de 100644 --- a/compiler/hsSyn/HsPat.lhs +++ b/compiler/hsSyn/HsPat.lhs @@ -310,7 +310,7 @@ instance (OutputableBndr id, Outputable arg) => Outputable (HsRecField id arg) where ppr (HsRecField { hsRecFieldId = f, hsRecFieldArg = arg, hsRecPun = pun }) - = ppr f <+> (if pun then empty else equals <+> ppr arg) + = ppr f <+> (ppUnless pun $ equals <+> ppr arg) -- add parallel array brackets around a document --