async
async copied to clipboard
Generalise 'waitAny' & co to use Foldable
The following functions used to expect a list of Async computations as input, but have been generalised to work with a Foldable constraint:
- waitAny, waitAnySTM, waitAnyCancel,
- waitAnyCatch, waitAnyCatchSTM, waitAnyCatchCancel.
This extra generality is useful when dealing with a Set of Async computations.
I think we should also SPECIALIZE
waitAnySTM and waitAnyCatchSTM to lists to avoid any performance regressions from the extra overloading.
This is a breaking change.
E.g.
{-# LANGUAGE OverloadedLists #-}
...
res <- waitAnyCatch [x, y]
or any other polymorphic argument (forced now by waitAnyCatch
to be lists) will fail.