Proposal: Control.Concurrent.Async
Ross Paterson
ross at soi.city.ac.uk
Tue Jul 3 15:17:46 CEST 2012
On Tue, Jul 03, 2012 at 01:53:16PM +0100, Simon Marlow wrote:
> On 18/06/2012 14:56, Ross Paterson wrote:
> > Perhaps a convenient interface for the multiplexing part would be
> >
> > data AsyncF a = forall r. AsyncF (Async r) (r -> a)
> >
> > instance Functor AsyncF where
> > fmap f (AsyncF a k) = AsyncF a (f . k)
> >
> > waitSTMF :: AsyncF a -> STM (Either SomeException a)
> > waitSTMF (AsyncF a k) = fmap (fmap k) (waitSTM a)
>
> Good idea. In fact, I've added a Functor instance for Async itself - it
> required a bit of refactoring but didn't add much overhead.
So now you can simplify the interfaces of waitEither/waitAny et al?
[BTW, could you generate the new docs with --hyperlink-source?]
More information about the Libraries
mailing list