I'm defining a data an instance Monad just for utilizing the do
notation. However, by the Applicative-Monad Proposal implemented in GHC 7.10+, I will have to also define the data as an instance of Applicative and Functor. I don't plan to define fmap
, pure
, <*>
, as they are easily derived from liftM
, return
and ap
in terms of Monad.
To make Applicative a superclass of Monad explicitly is good. However, is it the case that AMP also introduces some really unnecessary code on writing those part that are totally useless? Or if Haskell has some short hand ways to cope with this situation? Some like:
class Applicative m => Monad m where
super pure = return
super (<*>) = ap
return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b