X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FhsSyn%2FHsBinds.lhs;h=c473fd3c6ecaa427062496be1609118839368695;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=efedcd6086d9c9e561ef06be008a597c70138d7a;hpb=c7b389309e5cdc86db9845573900b560c7a2fa05;p=ghc-hetmet.git diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs index efedcd6..c473fd3 100644 --- a/ghc/compiler/hsSyn/HsBinds.lhs +++ b/ghc/compiler/hsSyn/HsBinds.lhs @@ -51,6 +51,9 @@ instance OutputableBndr id => Outputable (HsBindGroup id) where = vcat [ppr_isrec, vcat (map ppr sigs), vcat (map ppr (bagToList binds)) + -- *not* pprLHsBinds because we don't want braces; 'let' and + -- 'where' include a list of HsBindGroups and we don't want + -- several groups of bindings each with braces around. ] where ppr_isrec = getPprStyle $ \ sty -> @@ -81,6 +84,9 @@ instance (OutputableBndr id) => Outputable (IPBind id) where type LHsBinds id = Bag (LHsBind id) type LHsBind id = Located (HsBind id) +pprLHsBinds :: OutputableBndr id => LHsBinds id -> SDoc +pprLHsBinds binds = lbrace <+> vcat (map ppr (bagToList binds)) <+> rbrace + data HsBind id = FunBind (Located id) -- Used for both functions f x = e @@ -161,7 +167,7 @@ ppr_monobind (AbsBinds tyvars dictvars exports inlines val_binds) nest 4 ( vcat [pprBndr LetBind x | (_,x,_) <- exports] -- Print type signatures $$ - ppr val_binds ) + pprLHsBinds val_binds ) \end{code} %************************************************************************ @@ -262,10 +268,10 @@ eqHsSig _other1 _other2 = False \end{code} \begin{code} -instance (Outputable name) => Outputable (Sig name) where +instance (OutputableBndr name) => Outputable (Sig name) where ppr sig = ppr_sig sig -ppr_sig :: Outputable name => Sig name -> SDoc +ppr_sig :: OutputableBndr name => Sig name -> SDoc ppr_sig (Sig var ty) = sep [ppr var <+> dcolon, nest 4 (ppr ty)]