Use demand info to perform more nested CPR
Unboxing a function result field with nested CPR requires evaluating that field eagerly. Today, when deciding whether it is sound to perform nested CPR, we look at:
- ...whether the field is a strict field of the relevant data constructor
- ...whether the expression stored in that field quickly converges to WHNF
But when deciding whether to perform nested CPR, we could also check:
- ...whether the field is used strictly anyway, as determined by the (sub-)demand context.
I think implementing this would mostly be a matter of plumbing the demand context through CPR analysis.