
Andrew Coppin wrote:
But on the other hand, that would seem to imply that every monad is trivially applicative, yet studying the libraries this is not the case. Indeed several of the libraries seem to go out of their way to implement duplicate functionallity for monad and applicative. (Hence the sea of identical and nearly identical type sigantures for functions with totally different names that had me confused for so long.) Actually, it is the case. It is technically possible to write:
instance Monad m => Applicative m where pure = return (<*>) = ap We don't include the above definition because it elimimates all possibility of specialization. The reason for the separation of the two for many functions is so that types which are instances of only one of the two can still take advantage of the functionality.
Foldable seems simplish, except that it refers to some odd "monoid" class that looks suspiciously like "MonadPlus" but isn't... wuh? A Monoid is simply anything that has an identity element (mempty) and an associative binary operation (mappend). It is not necessary for a complete instance of Foldable.
- Jake