Use onException in withAsyncUsing#185
Open
edsko wants to merge 1 commit into
Open
Conversation
This is quite a central function in `async`; the pattern ```hs .. `catch` \e -> .. throwIO e ``` should be avoided in GHC >= 9.12, as it will add unnecessary `WhileHandling` annotations. There are low level functions which can be used when necessary (`catchNoPropagate`, `rethrowIO`), but in this particular case `onException` captures the same pattern, and _it_ has been [modified][1] in recent GHC to use these new primitives. The oldest version of GHC that `async.cabal` lists as supported is 7.0.4, even though it's not tested in CI. I verified that `onException` was already available [back then][2]. [1]: https://hackage.haskell.org/package/ghc-internal-9.1201.0/docs/src/GHC.Internal.Control.Exception.Base.html#onException [2]: https://hackage.haskell.org/package/base-4.3.0.0/docs/src/Control-Exception-Base.html#onException
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is quite a central function in
async; the patternshould be avoided in GHC >= 9.12, as it will add unnecessary
WhileHandlingannotations. There are low level functions which can be used when necessary (catchNoPropagate,rethrowIO), but in this particular caseonExceptioncaptures the same pattern, and it has been modified in recent GHC to use these new primitives. The oldest version of GHC thatasync.caballists as supported is 7.0.4, even though it's not tested in CI. I verified thatonExceptionwas already available back then.