[Haskell-beginners] How does the type of "ap = liftM2 id" work?
Quergle Quergle
quergle at googlemail.com
Fri Aug 22 13:07:50 EDT 2008
Hello,
I'm a bit perplexed by what it means to do something like "ap = liftM2 id"
liftM2 :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
id :: a -> a
liftM2 id :: (Monad m) => m (a2 -> r) -> m a2 -> m r
My intuitive understanding is that liftM2 is expecting a two-argument
function as its first argument, so it seems a little unexpected to
pass it "id", a one-argument function. And I can't really see how the
type signature of "liftM2 id" is derived from "liftM2" and "id". Any
help much appreciated!
-- Matt
More information about the Beginners
mailing list