async icon indicating copy to clipboard operation
async copied to clipboard

Generalise 'waitAny' & co to use Foldable

Open sheaf opened this issue 2 years ago • 2 comments

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.

sheaf avatar Dec 24 '22 17:12 sheaf

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

simonmar avatar Sep 03 '23 18:09 simonmar

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.

phadej avatar Oct 03 '23 20:10 phadej