Exception Annotations: Lay of the Land
Haskell Community [Unofficial]
May 9, 2026
Great overview, thanks!
About the issue of whether, in the Exception instance for SomeException, the definition of toException should clear the context.
If it clears the context (as it does currently) this code
catchAndThrow :: IO a -> IO a
catchAndThrow = handle $ \(e :: SomeException) -> throwIO e
will lose the existing anotations in e, instead adding backtrace information (say, an IPE backtrace) corresponding to the throwIO, correct?
If we modify SomeException’s toException to keep the context, wouldn’t that same code result in two unrelated backtraces, one for the original exception, another for the throwIO call site?
Discussion in the ATmosphere