[project @ 2004-03-11 14:31:56 by simonpj]
[ghc-hetmet.git] / ghc / compiler / hsSyn / HsBinds.lhs
index 494ac60..458a713 100644 (file)
@@ -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 -> 
@@ -62,9 +62,6 @@ instance OutputableBndr id => Outputable (HsBindGroup id) where
   ppr (HsIPBinds ipbinds)
      = vcat (map ppr ipbinds)
 
-mkHsBindGroup :: RecFlag -> Bag (LHsBind id) -> HsBindGroup id
-mkHsBindGroup is_rec mbinds = HsBindGroup mbinds [] is_rec
-
 -- -----------------------------------------------------------------------------
 -- Implicit parameter bindings
 
@@ -84,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
@@ -164,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}
 
 %************************************************************************
@@ -265,10 +265,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)]