I know that Functorthey Applicativeshould be superclasses Monad, but not for historical reasons. However, why is it impossible to declare an Monadinstance Functor? This will have approximately the same effect, but without modifying the existing code. If you are trying to do this, the GHC complains:
Functor
Applicative
Monad
instance Functor Monad where fmap = liftM Class `Monad' used as a type In the instance declaration for `Functor Monad'
Why? There is probably a good reason for this.
Your syntax is incorrect. Monadis a type, not a data type. You can write
instance Monad a => Functor a where fmap = liftM
FlexibleInstances ( , T a1 a2 ... an, a1, a2, ... an , ) UndecidableInstances ( [ , ]).
FlexibleInstances
T a1 a2 ... an
a1, a2, ... an
UndecidableInstances
, Monad , . . - . Haskell.