From c7517d84fe15a202029d5a77dfaf51c87e7e7234 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Thu, 29 Oct 2009 12:16:01 +0000 Subject: [PATCH] Tidy up pretty-printing (use ppUnless) --- compiler/hsSyn/HsExpr.lhs | 4 ++-- compiler/hsSyn/HsPat.lhs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 -- -- 1.7.10.4