How and why is ap defined as liftM2 id in Haskell
Whilst trying to better understand Applicative, I looked at the definition of <*>, which tends to be defined as ap, which in turn is defined as: ap :: (Monad m) => m (a -> b) -> m a -> m b ap = liftM2 id Looking at the type signatures for liftM2 and id, namely: liftM2 :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r id :: a -> a I fail to understand how just by passing in id, the relevant part of the type signature seems to transform from (a1 -> a2 -> r) -> m a1 to m (a -> b) . What am I missing here? The type variable a from id can be instantiated at any type, and in this case that type