[project @ 2004-08-13 13:04:50 by simonmar]
[ghc-hetmet.git] / ghc / compiler / hsSyn / HsBinds.lhs
index efedcd6..c473fd3 100644 (file)
@@ -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)]