ap
doesn\'t have a documented spec, and reads with a comment pointing out it could be <*>
, but isn\'t for practical reasons:
Every Monad
gives rise to an Applicative
, and for that induced Applicative
, <*> = ap
will hold definitionally. But given two structures - Monad m
and Applicative m
- there is no guarantee that these structures agree without the two laws <*> = ap
and pure = return
. For example, take the 'regular' Monad
instance for lists, and the zip-list Applicative
instance. While there is nothing fundamentally 'wrong' about a Monad
and Applicative
instance disagreeing, it would probably be confusing to most users, and so it's prohibited by the Monad
laws.
tl;dr The laws in question serve to ensure that Monad
and Applicative
agree in an intuitively obvious way.