waitAny(Catch): clarify non-empty input list requirement#132
Merged
simonmar merged 2 commits intosimonmar:masterfrom Jun 27, 2022
Merged
waitAny(Catch): clarify non-empty input list requirement#132simonmar merged 2 commits intosimonmar:masterfrom
simonmar merged 2 commits intosimonmar:masterfrom
Conversation
be70a16 to
4ad0551
Compare
4ad0551 to
0970627
Compare
simonmar
reviewed
Apr 23, 2022
Control/Concurrent/Async.hs
Outdated
| -- | ||
| -- @since 2.1.0 | ||
| waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a) | ||
| waitAnyCatchSTM [] = error "waitAnyCatchSTM: invalid argument: input list must be non-empty" |
Owner
There was a problem hiding this comment.
- please throw an exception, don't use
error - keep lines under 80 columns
Contributor
Author
There was a problem hiding this comment.
- please throw an exception, don't use
error
In the associated issue you said using ErrorCall is fine. And calling error is the same as throwing ErrorCall according to https://www.stackage.org/haddock/lts-19.5/base-4.15.1.0/Control-Exception.html#t:ErrorCall. What am I missing?
Owner
There was a problem hiding this comment.
error is not the same as throwIO: https://hackage.haskell.org/package/base-4.16.1.0/docs/Control-Exception.html#v:throwIO
Also: keep columns under 80 chars
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.
I have only documented the "non-empty list"-requirement in the docs for
waitAnyandwaitAnyCatch. I have refrained from adding it to the docs forwaitAnyCancel,waitAnyCatchCancel,waitAnySTM, andwaitAnyCatchSTMsince the docs for these functions refer to eitherwaitAnyorwaitAnyCatch.Closes #130