Note [Demand transformer for data constructors]

GHC/Types/Demand.hs:1372 compiler

Consider the expression (x,y) with sub-demand P(SL,A).  What is the demand on
x,y?  Obviously `x` is used strictly, and `y` not at all. So we want to
decompose a product demand, and feed its components demands into the
arguments.  That is the job of dmdTransformDataConSig.  More precisely,

 * it gets the demand on the data constructor itself;
   in the above example that is C(1,C(1,P(SL,A)))
 * it returns the demands on the arguments;
   in the above example that is [SL, A]

When the data constructor worker has strict fields, an additional seq
will be inserted for each field (see (SFC3) in Note [Strict fields in Core]).
Hence we add an additional `seqDmd` for each strict field to emulate
field eval insertion.

For example, consider `data SP a b = MkSP !a !b` and expression `MkSP x y`,
with the same sub-demand P(SL,A).
The strict fields bump up the strictness; we'd get [SL,1!A] for the field
demands. Note that the first demand was unaffected by the seq, whereas
the second, previously absent demand became `seqDmd` exactly.

References 1

Referenced by 3