
18 Aug
2010
18 Aug
'10
11:12 a.m.
I think the point that was being made is that:
liftM2 (flip f) /= flip (liftM2 f)
This is because the former (well: liftM2 (flip f) a b) effectively does:
do {x <- a; y <- b; return (f y x)}
Whereas the latter (flip (liftM2 f) a b) effectively does:
do {y <- b; x <- a; return (f y x)}
That is, the order of the arguments to liftM2 matters because they are executed in that order. So lifting the flipped function has a different effect to flipping the lifted function.
Thanks,
Neil.
Thanks, I can see how that could lead to confusion.