X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FhsSyn%2FHsBinds.lhs;h=a3d127d6b212d97f0d34e1205968cd3cc3807fbe;hb=e26dd9a959b7b7810c2e2089940422092a95f2e3;hp=8f3d81e7e1ae8bdae21e22984592a1817fdecfa8;hpb=8c1b6bd7ffb9ce97da7a72f9e102998df19b23a2;p=ghc-hetmet.git diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs index 8f3d81e..a3d127d 100644 --- a/ghc/compiler/hsSyn/HsBinds.lhs +++ b/ghc/compiler/hsSyn/HsBinds.lhs @@ -18,14 +18,13 @@ import {-# SOURCE #-} HsExpr ( HsExpr, pprExpr, import HsImpExp ( pprHsVar ) import HsPat ( Pat ) import HsTypes ( HsType ) -import CoreSyn ( CoreExpr ) import PprCore ( {- instance Outputable (Expr a) -} ) --others: import Name ( Name ) import PrelNames ( isUnboundName ) import NameSet ( NameSet, elemNameSet, nameSetToList ) -import BasicTypes ( RecFlag(..), FixitySig(..), Activation(..) ) +import BasicTypes ( RecFlag(..), FixitySig(..), Activation(..), IPName ) import Outputable import SrcLoc ( SrcLoc ) import Var ( TyVar ) @@ -49,13 +48,18 @@ Collections of bindings, created by dependency analysis and translation: \begin{code} data HsBinds id -- binders and bindees = EmptyBinds - - | ThenBinds (HsBinds id) - (HsBinds id) - - | MonoBind (MonoBinds id) - [Sig id] -- Empty on typechecker output, Type Signatures - RecFlag + | ThenBinds (HsBinds id) (HsBinds id) + + | MonoBind -- A mutually recursive group + (MonoBinds id) + [Sig id] -- Empty on typechecker output, Type Signatures + RecFlag + + | IPBinds -- Implcit parameters + -- Not allowed at top level + [(IPName id, HsExpr id)] + Bool -- True <=> this was a 'with' binding + -- (tmp, until 'with' is removed) \end{code} \begin{code} @@ -64,10 +68,11 @@ nullBinds :: HsBinds id -> Bool nullBinds EmptyBinds = True nullBinds (ThenBinds b1 b2) = nullBinds b1 && nullBinds b2 nullBinds (MonoBind b _ _) = nullMonoBinds b +nullBinds (IPBinds b _) = null b -mkMonoBind :: MonoBinds id -> [Sig id] -> RecFlag -> HsBinds id -mkMonoBind EmptyMonoBinds _ _ = EmptyBinds -mkMonoBind mbinds sigs is_rec = MonoBind mbinds sigs is_rec +mkMonoBind :: RecFlag -> MonoBinds id -> HsBinds id +mkMonoBind _ EmptyMonoBinds = EmptyBinds +mkMonoBind is_rec mbinds = MonoBind mbinds [] is_rec \end{code} \begin{code} @@ -77,6 +82,12 @@ instance (OutputableBndr id) => Outputable (HsBinds id) where ppr_binds EmptyBinds = empty ppr_binds (ThenBinds binds1 binds2) = ppr_binds binds1 $$ ppr_binds binds2 + +ppr_binds (IPBinds binds is_with) + = sep (punctuate semi (map pp_item binds)) + where + pp_item (id,rhs) = pprBndr LetBind id <+> equals <+> pprExpr rhs + ppr_binds (MonoBind bind sigs is_rec) = vcat [ppr_isrec, vcat (map ppr sigs),