<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Prelude Control.Monad> liftM2 (\a b -> a : b : []) "abc" "123"<br>["a1","a2","a3","b1","b2","b3","c1","c2","c3"]<br>Prelude Control.Monad> <br><br>Got it!<br><br>Thanks to all.<br><br>Michael<br><br>--- On <b>Sat, 7/24/10, aditya siram <i><aditya.siram@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: aditya siram <aditya.siram@gmail.com><br>Subject: Re: [Haskell-cafe] Heavy lift-ing<br>To: "Max Rabkin" <max.rabkin@gmail.com><br>Cc: "haskell-cafe@haskell.org" <haskell-cafe@haskell.org>, "Lennart Augustsson" <lennart.augustsson@gmail.com><br>Date: Saturday, July 24, 2010, 10:35 AM<br><br><div class="plainMail">Perhaps I'm being unclear again. All I was trying to say was that:<br>liftM2 (-) [0,1] [2,3] /= liftM2 (-) [2,3]
[0,1]<br><br>-deech<br><br>On Sat, Jul 24, 2010 at 9:30 AM, Max Rabkin <<a ymailto="mailto:max.rabkin@gmail.com" href="/mc/compose?to=max.rabkin@gmail.com">max.rabkin@gmail.com</a>> wrote:<br>> On Sat, Jul 24, 2010 at 4:08 PM, aditya siram <<a ymailto="mailto:aditya.siram@gmail.com" href="/mc/compose?to=aditya.siram@gmail.com">aditya.siram@gmail.com</a>> wrote:<br>>> I wouldn't-it was a bad example. My only point was that because of the<br>>> way (>>=) is implemented for lists the order of the arguments 'a' and<br>>> 'b' in 'liftM2 f a b' matters.<br>>><br>>> -deech<br>><br>> No, it's not. The type of liftM2 makes this clear:<br>><br>> liftM2 :: (Monad m) => (a -> b -> r) -> m a -> m b -> m r<br>><br>> The arguments to the function *must* come in the right order, because<br>> there is no way to match (a) with (m b) or (b) with (m a). Since<br>> liftM2 is
parametrically polymorphic in (a) and (b), it can't behave<br>> differently in the case where (a = b).<br>><br>> --Max<br>><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></blockquote></td></tr></table><br>