
28 Jul
2008
28 Jul
'08
1:32 a.m.
On Mon, Jul 28, 2008 at 2:49 AM, Mario Blažević
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