{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiad66fayeoen6ps7ktquwr2bg5nnqyymp5wnhqxgwlghxrtxbzoby",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mlg4kl4zqlb2"
},
"path": "/t/exception-annotations-lay-of-the-land/14056#post_2",
"publishedAt": "2026-05-09T09:22:16.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"issue"
],
"textContent": "Great overview, thanks!\n\nAbout the issue of whether, in the `Exception` instance for `SomeException`, the definition of `toException` should clear the context.\n\nIf it clears the context (as it does currently) this code\n\n\n catchAndThrow :: IO a -> IO a\n catchAndThrow = handle $ \\(e :: SomeException) -> throwIO e\n\n\nwill lose the existing anotations in `e`, instead adding backtrace information (say, an `IPE` backtrace) corresponding to the `throwIO`, correct?\n\nIf 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?",
"title": "Exception Annotations: Lay of the Land"
}