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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to