
23 Jul
2010
23 Jul
'10
2:58 p.m.
On 10-07-23 02:43 PM, michael rice wrote:
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r [...] What does it mean to "promote a function to a monad?"
liftM2 f m1 m2 is canned code for do a1 <- m1 a2 <- m2 return (f a1 a2) for example liftM2 f [s,t] [x,y] is [f s x, f s y, f t x, f t y] liftM2 (++) getLine getLine reads two lines and concatenates them.