On Mon, Jul 28, 2008 at 2:49 AM, Mario Blažević <[EMAIL PROTECTED]> wrote:
> parallelize :: m a -> m b -> m (a, b)
> parallelize ma mb = let a = ma >>= return
>                        b = mb >>= return
>                    in a `par` (b `pseq` liftM2 (,) a b)

See Sterling's reply for an actual answer to your question, but note
that one of the monad laws is:

   m >>= return = m

(i.e. return is a right identity of bind)

That means your code can be reduced to:

   parallelize ma mb = ma `par` (mb `pseq` liftM2 (,) ma mb)

Which, as Sterling points out, is *not* doing what you think it is.

Luke
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to