Proposal: Control.Concurrent.Async

Ross Paterson ross at soi.city.ac.uk
Thu Jun 14 17:10:00 CEST 2012


On Fri, Jun 08, 2012 at 09:37:16AM +0100, Simon Marlow wrote:
> I'm opening this up for discussion so that we can tidy up any 
> inconsistent details and add any functions that people feel are missing. 
>   Naming is obviously up for discussion too.

I'd expect the arguments of cancelWith to be the other way round.
Then you could say

  cancel = cancelWith ThreadKilled

An alternative, equivalent interface for waitEither and friends would be

  waitEither :: Async a -> Async a -> IO (Either SomeException a)
  waitEitherThrow :: Async a -> Async a -> IO a

This might be conceptually simpler, leaving it to the user to decide
whether to mark the results with Left/Right, or something else, or not.
Similarly the Async now returned by waitAny and friends could be left
to the user.  That would leave the two sets of functions more in line.



More information about the Libraries mailing list