Note [Evaluation cardinalities]

GHC/Types/Demand.hs:385 compiler

The demand analyser uses an (abstraction of) /evaluation cardinality/ of type
Card, to specify how many times a term is evaluated. A Card C_lu
represents an /interval/ of possible cardinalities [l..u], meaning

* Evaluated /at least/ 'l' times (strictness).
  Hence 'l' is either 0 (lazy)
                   or 1 (strict)

* Evaluated /at most/ 'u' times (usage).
  Hence 'u' is either 0 (not used at all),
                   or 1 (used at most once)
                   or n (no information)

Intervals describe sets, so the underlying lattice is the powerset lattice.

Usually l<=u, but we also have C_10, the interval [1,0], the empty interval,
denoting the empty set.   This is the bottom element of the lattice.

See Note [Demand notation] for the notation we use for each of the constructors.

References 1

Referenced by 1