External Publication
Visit Post

Exception Annotations: Lay of the Land

Haskell Community [Unofficial] May 20, 2026
Source

Personally I think the fact that toException clears the exception context is Very Bad ™. Yes, if you happen to rethrow the exception inside a catch, then the WhileHandling saves you. And I agree, unnecessary WhileHandling annotations are annoying but ultimately harmless, and over time they will become less (indeed, I just submitted a patch against async which removes one example).

But–critically–exceptions are not always rethrown in the context of an exception handler; for example, consider waitSTM; this gets a previously thrown exception out of a TMVar, and rethrows it; since it uses throwSTM, and since it’s SomeException, all annotations on that exception are now irrevocably lost.

Discussion in the ATmosphere

Loading comments...