Note [deferAfterPreciseException]
The big picture is in Note [Precise exceptions and strictness analysis] The idea is that we want to treat case <I/O operation> of (# s', r #) -> rhs as if it was case <I/O operation> of Just (# s', r #) -> rhs Nothing -> error That is, the I/O operation might throw an exception, so that 'rhs' never gets reached. For example, we don't want to be strict in the strict free variables of 'rhs'. So we have the simple definition deferAfterPreciseException = lubDmdType (DmdType emptyDmdEnv [] exnDiv) Historically, when we had `lubBoxity = _unboxedWins` (see Note [unboxedWins]), we had a more complicated definition for deferAfterPreciseException to make sure it preserved boxity in its argument. That was needed for code like case <I/O operation> of (# s', r) -> f x which uses `x` *boxed*. If we `lub`bed it with `(DmdType emptyDmdEnv [] exnDiv)` we'd get an *unboxed* demand on `x` (because we let Unboxed win), which led to #20746. Nowadays with `lubBoxity = boxedWins` we don't need the complicated definition.
References 2
- Precise exceptions and strictness analysis GHC.Types.Demand
- unboxedWins GHC.Types.Demand
Referenced by 1
- unboxedWins GHC.Types.Demand