- rec_str = case is_rec of
- Recursive -> SLIT("{- rec -}")
- NonRecursive -> SLIT("{- nonrec -}")
-\end{code}
-
-%************************************************************************
-%* *
-\subsection{Bindings: @MonoBinds@}
-%* *
-%************************************************************************
-
-Global bindings (where clauses)
-
-\begin{code}
-data MonoBinds flexi id pat
- = EmptyMonoBinds
-
- | AndMonoBinds (MonoBinds flexi id pat)
- (MonoBinds flexi id pat)
-
- | PatMonoBind pat
- (GRHSsAndBinds flexi id pat)
- SrcLoc
-
- | FunMonoBind id
- Bool -- True => infix declaration
- [Match flexi id pat] -- must have at least one Match
- SrcLoc
-
- | VarMonoBind id -- TRANSLATION
- (HsExpr flexi id pat)
-
- | CoreMonoBind id -- TRANSLATION
- CoreExpr -- No zonking; this is a final CoreExpr with Ids and Types!
-
- | AbsBinds -- Binds abstraction; TRANSLATION
- [GenTyVar flexi] -- Type variables
- [id] -- Dicts
- [([GenTyVar flexi], id, id)] -- (type variables, polymorphic, momonmorphic) triples
- (MonoBinds flexi id pat) -- The "business end"
+ ppr_isrec = getPprStyle $ \ sty ->
+ if userStyle sty then empty else
+ case is_rec of
+ Recursive -> ptext SLIT("{- rec -}")
+ NonRecursive -> ptext SLIT("{- nonrec -}")
+
+ ppr (HsIPBinds ipbinds)
+ = vcat (map ppr ipbinds)
+
+-- -----------------------------------------------------------------------------
+-- Implicit parameter bindings
+
+type LIPBind id = Located (IPBind id)
+
+-- | Implicit parameter bindings.
+data IPBind id
+ = IPBind
+ (IPName id)
+ (LHsExpr id)
+
+instance (OutputableBndr id) => Outputable (IPBind id) where
+ ppr (IPBind id rhs) = pprBndr LetBind id <+> equals <+> pprExpr (unLoc rhs)
+
+-- -----------------------------------------------------------------------------
+
+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
+ -- and variables f = \x -> e
+ -- Reason: the Match stuff lets us have an optional
+ -- result type sig f :: a->a = ...mentions a...
+ --
+ -- This also means that instance decls can only have
+ -- FunBinds, so if you change this, you'll need to
+ -- change e.g. rnMethodBinds
+ Bool -- True => infix declaration
+ [LMatch id]
+
+ | PatBind (LPat id) -- The pattern is never a simple variable;
+ -- That case is done by FunBind
+ (GRHSs id)
+
+ | VarBind id (Located (HsExpr id)) -- Dictionary binding and suchlike;
+ -- located only for consistency
+
+ | AbsBinds -- Binds abstraction; TRANSLATION
+ [TyVar] -- Type variables
+ [id] -- Dicts
+ [([TyVar], id, id)] -- (type variables, polymorphic, momonmorphic) triples
+ NameSet -- Set of *polymorphic* variables that have an INLINE pragma
+ (LHsBinds id) -- The "business end"