{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibs5n57bs3wkk7oyo6rfjxtwkt7hp2brcojkkjh7ie4flupc2dx7a",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mmbd2evmfah2"
},
"path": "/t/exception-annotations-lay-of-the-land/14056#post_6",
"publishedAt": "2026-05-20T06:53:09.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"patch against async",
"waitSTM"
],
"textContent": "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).\n\nBut–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.",
"title": "Exception Annotations: Lay of the Land"
}