Proposal: Control.Concurrent.Async

Gábor Lehel illissius at gmail.com
Wed Jul 4 13:13:22 CEST 2012


On Wed, Jul 4, 2012 at 12:44 PM, Simon Marlow <marlowsd at gmail.com> wrote:
> Hackage has the docs now:
>
> http://hackage.haskell.org/packages/archive/async/2.0.1.0/doc/html/Control-Concurrent-Async.html
>
> Cheers,
>         Simon

Perhaps it might make sense to reduce the duplication among the
asyncOn/WithUnmask/etc. variants using an ADT?

e.g.

type Unmask a = (forall b. IO b -> IO b) -> IO a

data Fork a = ForkIO (IO a)
            | ForkOS (IO a)
            | ForkOn Int (IO a)
            | ForkIOWithUnmask (Unmask a)
            | ForkOnWithUnmask Int (Unmask a)

async :: IO a -> IO (Async a)
asyncUsingFork :: Fork a -> IO (Async a)
withAsync :: IO a -> (Async a -> IO b) -> IO b
withAsyncUsingFork :: Fork a -> (Async a -> IO b) -> IO b

(Didn't put much thought into names.)


-- 
Your ship was caught in a monadic eruption. Game over.



More information about the Libraries mailing list