You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I wrote PRs #104 and #105, I described withAsync as equally safe as race. That is wrong.
withAsync silently swallows exceptions in the first argument, e.g.
withAsync (error"TODO") $\_ ->do-- more code
Here, the error will not bubble up.
(I haven't actually tried it with error yet, but with a worker thread doing a forever, and was surprised that it just didn't work, when in fact a No such file or directory was silently swallowed.)
race doesn't have this issue, in particular not the common pattern bResult <- fmap (either absurd id) $ race a b.
This should be made clearer in the docs in various places.
The text was updated successfully, but these errors were encountered:
The documentation does say that "If the operation throws an exception, then that exception is re-thrown by wait. This ensures property (1): No exception is swallowed."
If you want the exception thrown as an async, then you have to use link -
withAsync (error"TODO") $\a ->do
link a
-- more code
will cause the exception in a to be asynchronously passed to the parent thread.
When I wrote PRs #104 and #105, I described
withAsync
as equally safe asrace
. That is wrong.withAsync
silently swallows exceptions in the first argument, e.g.Here, the
error
will not bubble up.(I haven't actually tried it with
error
yet, but with a worker thread doing aforever
, and was surprised that it just didn't work, when in fact aNo such file or directory
was silently swallowed.)race
doesn't have this issue, in particular not the common patternbResult <- fmap (either absurd id) $ race a b
.This should be made clearer in the docs in various places.
The text was updated successfully, but these errors were encountered: