Proposal: Control.Concurrent.Async
Simon Marlow
marlowsd at gmail.com
Fri Jun 15 15:38:19 CEST 2012
On 15/06/2012 13:52, Twan van Laarhoven wrote:
> On 08/06/12 10:37, Simon Marlow wrote:
>> I'd like to add a higher-level concurrency API to the base package.
>
> How does this async package differ from monad-par, from a user's
> perspective? It seems that the latter is intended for pure computations
> and the implementation is more heavy weight. But it can be used for IO
> as well.
monad-par is for pure deterministic parallelism only, since it is based
around
runPar :: Par a -> a
So I'm slightly confused by your comment that it can be used for IO as
well - what do you mean exactly?
I'd say monad-par is much more lightweight than async. Perhaps not in
terms of the amount of code in the library, but the overhead of 'fork'
in monad-par is much less than the overhead of 'async'.
Incidentally, the IVar in monad-par is what I would call a "future" (in
reference to the other suggestion that we use "Future" instead of "Async").
> The difference in API is essentially only that async lives in the IO
> monad, whereas monad-par has its own Par monad.
Not being in IO is a pretty big difference :)
> Could and/or should one be implemented in terms of the other?
We could implement monad-par in terms of Async, but I doubt it would
make a lot of difference. The reverse is obviously not possible.
Cheers,
Simon
More information about the Libraries
mailing list