Note [deferAfterPreciseException]

GHC/Types/Demand.hs:1930 compiler 1 ticket

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

Referenced by 1