- = 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
+ = FunBind { -- FunBind is used for both functions f x = e
+ -- and variables f = \x -> e
+-- Reason 1: the Match stuff lets us have an optional
+-- result type sig f :: a->a = ...mentions a...
+--
+-- Reason 2: Special case for type inference: see TcBinds.tcMonoBinds
+--
+-- Reason 3: instance decls can only have FunBinds, which is convenient
+-- If you change this, you'll need tochange e.g. rnMethodBinds
+
+ fun_id :: Located id,
+
+ fun_infix :: Bool, -- True => infix declaration
+
+ fun_matches :: MatchGroup id, -- The payload
+
+ fun_co_fn :: ExprCoFn, -- Coercion from the type of the MatchGroup to the type of
+ -- the Id. Example:
+ -- f :: Int -> forall a. a -> a
+ -- f x y = y
+ -- Then the MatchGroup will have type (Int -> a' -> a')
+ -- (with a free type variable a'). The coercion will take
+ -- a CoreExpr of this type and convert it to a CoreExpr of
+ -- type Int -> forall a'. a' -> a'
+ -- Notice that the coercion captures the free a'. That's
+ -- why coercions are (CoreExpr -> CoreExpr), rather than
+ -- just CoreExpr (with a functional type)
+
+ bind_fvs :: NameSet -- After the renamer, this contains a superset of the