[Haskell-cafe] forkSequence, runPar, parallelize

Antoine Latter aslatter at gmail.com
Wed Dec 9 17:07:19 EST 2009

On Wed, Dec 9, 2009 at 3:44 PM, Mario Blazevic <mblazevic at stilo.com> wrote:
>        I can't test it right now, but wouldn't the following do the job in
> the Identity monad?
> forkExec :: Identity a -> Identity (Identity a)
> forkExec k = let result = runIdentity k
>             in result `par` return (Identity result)

Since Identity is a newtype, would that be equivalent to "result `par`
result"? The forkExec in the IO monad let's other computations keep
going until I need the result from the forked computation.

In a pure computation, I can already get the same result with `par`
and laziness, right?


More information about the Haskell-Cafe mailing list