-data MonoBinds id pat
- = EmptyMonoBinds
-
- | AndMonoBinds (MonoBinds id pat)
- (MonoBinds id pat)
-
- | PatMonoBind pat
- (GRHSs id pat)
- SrcLoc
-
- | FunMonoBind id
- Bool -- True => infix declaration
- [Match id pat]
- SrcLoc
-
- | VarMonoBind id -- TRANSLATION
- (HsExpr id pat)
-
- | CoreMonoBind id -- TRANSLATION
- CoreExpr -- No zonking; this is a final CoreExpr with Ids and Types!
-
- | 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
- (MonoBinds id pat) -- The "business end"
-
- -- Creates bindings for *new* (polymorphic, overloaded) locals
- -- in terms of *old* (monomorphic, non-overloaded) ones.
+data HsLocalBinds id -- Bindings in a 'let' expression
+ -- or a 'where' clause
+ = HsValBinds (HsValBinds id)
+ | HsIPBinds (HsIPBinds id)
+ | EmptyLocalBinds
+
+data HsValBinds id -- Value bindings (not implicit parameters)
+ = ValBindsIn -- Before typechecking
+ (LHsBinds id) [LSig id] -- Not dependency analysed
+ -- Recursive by default
+
+ | ValBindsOut -- After typechecking
+ [(RecFlag, LHsBinds id)] -- Dependency analysed
+
+
+type LHsBinds id = Bag (LHsBind id)
+type DictBinds id = LHsBinds id -- Used for dictionary or method bindings
+type LHsBind id = Located (HsBind id)
+
+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
+ (MatchGroup id)
+ NameSet -- After the renamer, this contains a superset of the
+ -- Names of the other binders in this binding group that
+ -- are free in the RHS of the defn
+ -- Before renaming, and after typechecking,
+ -- the field is unused; it's just an error thunk
+
+ | PatBind (LPat id) -- The pattern is never a simple variable;
+ -- That case is done by FunBind
+ (GRHSs id)
+ PostTcType -- Type of the GRHSs
+ NameSet -- Same as for FunBind
+
+ | VarBind id (Located (HsExpr id)) -- Dictionary binding and suchlike
+ -- All VarBinds are introduced by the type checker
+ -- Located only for consistency
+
+ | AbsBinds -- Binds abstraction; TRANSLATION
+ [TyVar] -- Type variables
+ [DictId] -- Dicts
+ [([TyVar], id, id, [Prag])] -- (tvs, poly_id, mono_id, prags)
+ (LHsBinds id) -- The dictionary bindings and typechecked user bindings
+ -- mixed up together; you can tell the dict bindings because
+ -- they are all VarBinds
+
+ -- Consider (AbsBinds tvs ds [(ftvs, poly_f, mono_f) binds]
+ --
+ -- Creates bindings for (polymorphic, overloaded) poly_f
+ -- in terms of monomorphic, non-overloaded mono_f
+ --
+ -- Invariants:
+ -- 1. 'binds' binds mono_f
+ -- 2. ftvs is a subset of tvs
+ -- 3. ftvs includes all tyvars free in ds