[Haskell-cafe] Heavy lift-ing

Max Rabkin max.rabkin at gmail.com
Sat Jul 24 10:30:51 EDT 2010

On Sat, Jul 24, 2010 at 4:08 PM, aditya siram <aditya.siram at gmail.com> wrote:
> I wouldn't-it was a bad example. My only point was that because of the
> way (>>=) is implemented for lists the order of the arguments 'a' and
> 'b' in 'liftM2 f a b' matters.
> -deech

No, it's not. The type of liftM2 makes this clear:

liftM2 :: (Monad m) => (a -> b -> r) -> m a -> m b -> m r

The arguments to the function *must* come in the right order, because
there is no way to match (a) with (m b) or (b) with (m a). Since
liftM2 is parametrically polymorphic in (a) and (b), it can't behave
differently in the case where (a = b).


More information about the Haskell-Cafe mailing list