simonmar / async

Run IO operations asynchronously and wait for their results
BSD 3-Clause "New" or "Revised" License
322 stars 65 forks source link

Generalise 'waitAny' & co to use Foldable #139

Open sheaf opened 1 year ago

sheaf commented 1 year ago

The following functions used to expect a list of Async computations as input, but have been generalised to work with a Foldable constraint:

This extra generality is useful when dealing with a Set of Async computations.

simonmar commented 1 year ago

I think we should also SPECIALIZE waitAnySTM and waitAnyCatchSTM to lists to avoid any performance regressions from the extra overloading.

phadej commented 1 year ago

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.