# Functor hierarchy proposal

From HaskellWiki

Currently the standard libraries include a `Functor` class and a `Monad` class, and `Functor` is not a superclass of `Monad`, even though logically every monad is a functor. Various schemes have been proposed to create a richer hierarchy of Functor classes. Here's a typical example:

class Functor f where fmap :: (a -> b) -> f a -> f b

class (Functor f) => Idiom f where ap :: f (a -> b) -> f a -> f b return :: a -> f a

class (Idiom f) => Monad f where (>>=) :: f a -> (a -> f b) -> f b

satisfying the usual Functor and Monad laws, and

fmap = ap . return ap fab fa = fab >>= (\ab -> fmap ab fa)

The downside of this is that every instance declaration of `Monad` would have to be accompanied by instance declarations for the superclasses.