Note [Default demand on free variables and arguments]
Free variables not mentioned in the environment of a 'DmdType'
are demanded according to the demand type's Divergence:
* In a Diverges (botDiv) context, that demand is botDmd
(strict and absent).
* In all other contexts, the demand is absDmd (lazy and absent).
This is recorded in 'defaultFvDmd'.
Similarly, we can eta-expand demand types to get demands on excess arguments
not accounted for in the type, by consulting 'defaultArgDmd':
* In a Diverges (botDiv) context, that demand is again botDmd.
* In a ExnOrDiv (exnDiv) context, that demand is absDmd: We surely diverge
before evaluating the excess argument, but don't want to eagerly evaluate
it (cf. Note [Precise exceptions and strictness analysis]).
* In a Dunno context (topDiv), the demand is topDmd, because
it's perfectly possible to enter the additional lambda and evaluate it
in unforeseen ways (so, not absent). References 1
- Precise exceptions and strictness analysis GHC.Types.Demand
Referenced by 5
- GHC.Types.Demand call site ×4
- Precise exceptions and strictness analysis GHC.Types.Demand