How arbitrary is the “ap” implementation for monads?
I am currently studying the bonds between monad and applicative functors. I see two implementation for ap: ap m1 m2 = do { f <- m1 ; x <- m2 ; return (f x) } and ap m1 m2 = do { x <- m2 ; f <- m1 ; return (f x) } The second one is different, yet, would it be a good implementation for <*> ? I got lost in the proof of pure (.) <*> u <*> v <*> w = u <*> (v <*> w) I try to get an intuition of "what part of the monad is the applicative functor"... There are at least three relevant aspects to this question. Given a Monad m instance, what is the specification of its necessary Applicative m superclass