From 1796a476986f14cca2f7628d2f7cf6d530853495 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 11 Mar 2004 14:31:56 +0000 Subject: [PATCH] [project @ 2004-03-11 14:31:56 by simonpj] Better printing for LHsBinds --- ghc/compiler/hsSyn/HsBinds.lhs | 7 +++++-- ghc/compiler/hsSyn/HsDecls.lhs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs index 0db816c..458a713 100644 --- a/ghc/compiler/hsSyn/HsBinds.lhs +++ b/ghc/compiler/hsSyn/HsBinds.lhs @@ -50,7 +50,7 @@ instance OutputableBndr id => Outputable (HsBindGroup id) where ppr (HsBindGroup binds sigs is_rec) = vcat [ppr_isrec, vcat (map ppr sigs), - vcat (map ppr (bagToList binds)) + pprLHsBinds binds ] where ppr_isrec = getPprStyle $ \ sty -> @@ -81,6 +81,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 +164,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} %************************************************************************ diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs index 24f6b99..474131a 100644 --- a/ghc/compiler/hsSyn/HsDecls.lhs +++ b/ghc/compiler/hsSyn/HsDecls.lhs @@ -32,7 +32,7 @@ import {-# SOURCE #-} HsExpr( HsExpr, pprExpr ) -- Because Expr imports Decls via HsBracket import HsBinds ( HsBindGroup, HsBind, LHsBinds, - Sig(..), LSig, LFixitySig ) + Sig(..), LSig, LFixitySig, pprLHsBinds ) import HsPat ( HsConDetails(..), hsConArgs ) import HsImpExp ( pprHsVar ) import HsTypes @@ -541,7 +541,7 @@ instance (OutputableBndr name) => Outputable (InstDecl name) where ppr (InstDecl inst_ty binds uprags) = vcat [hsep [ptext SLIT("instance"), ppr inst_ty, ptext SLIT("where")], nest 4 (ppr uprags), - nest 4 (ppr binds) ] + nest 4 (pprLHsBinds binds) ] \end{code} %************************************************************************ -- 1.7.10.4