- = NoUnfolding -- ^ We have no information about the unfolding
-
- | OtherCon [AltCon] -- ^ It ain't one of these constructors.
- -- @OtherCon xs@ also indicates that something has been evaluated
- -- and hence there's no point in re-evaluating it.
- -- @OtherCon []@ is used even for non-data-type values
- -- to indicated evaluated-ness. Notably:
- --
- -- > data C = C !(Int -> Int)
- -- > case x of { C f -> ... }
- --
- -- Here, @f@ gets an @OtherCon []@ unfolding.
-
- | CompulsoryUnfolding { -- There is /no original definition/, so you'd better unfold.
- uf_tmpl :: CoreExpr -- The unfolding is guaranteed to have no free variables
- } -- so no need to think about it during dependency analysis
-
- | InlineRule { -- The function has an INLINE pragma, with the specified (original) RHS
- -- (The inline phase, if any, is in the InlinePragInfo for this Id.)
- -- Inline when (a) applied to at least this number of args
- -- (b) if there is something interesting about args or context
- uf_tmpl :: CoreExpr, -- The *original* RHS; occurrence info is correct
- -- (The actual RHS of the function may be different by now,
- -- but what we inline is still the original RHS (kept in the InlineRule).)
- uf_is_top :: Bool,
-
- uf_arity :: Arity, -- Don't inline unless applied to this number of *value* args
- uf_is_value :: Bool, -- True <=> exprIsHNF is true; save to discard a `seq`
- uf_worker :: Maybe Id -- Just wrk_id <=> this unfolding is a the wrapper in a worker/wrapper
- -- split from the strictness analyser
- -- Used to abbreviate the uf_tmpl in interface files
- -- In the Just case, interface files don't actually
- -- need to contain the RHS; it can be derived from
- -- the strictness info
- -- Also used in CoreUnfold to guide inlining decisions
- }
+ = NoUnfolding -- ^ We have no information about the unfolding
+
+ | OtherCon [AltCon] -- ^ It ain't one of these constructors.
+ -- @OtherCon xs@ also indicates that something has been evaluated
+ -- and hence there's no point in re-evaluating it.
+ -- @OtherCon []@ is used even for non-data-type values
+ -- to indicated evaluated-ness. Notably:
+ --
+ -- > data C = C !(Int -> Int)
+ -- > case x of { C f -> ... }
+ --
+ -- Here, @f@ gets an @OtherCon []@ unfolding.
+
+ | DFunUnfolding DataCon [CoreExpr]
+ -- The Unfolding of a DFunId
+ -- df = /\a1..am. \d1..dn. MkD (op1 a1..am d1..dn)
+ -- (op2 a1..am d1..dn)
+ -- where Arity = n, the number of dict args to the dfun
+ -- The [CoreExpr] are the superclasses and methods [op1,op2],
+ -- in positional order.
+ -- They are usually variables, but can be trivial expressions
+ -- instead (e.g. a type application).