I know that Functor and Applicative should be superclasses of Monad, but aren’t for historical reasons. However, why isn’t is possible to declare Monad an instance of Functor? This would have roughly the same effect, but without having to modify existing code. If you’re trying to do this, GHC complains:
instance Functor Monad where
fmap = liftM
Class `Monad' used as a type
In the instance declaration for `Functor Monad'
Why is that? There’s probably a good reason for it.
Your syntax is wrong.
Monadis a typeclass, not a data type. What you could write isHowever, this will only work with the extensions
FlexibleInstances(permits instances that are not of the formT a1 a2 ... anwherea1, a2, ... anare type variables and there is no context) andUndecidableInstances(which permits this specific instance [I don’t know why this is needed]).