All Monads are Functors

Bulat Ziganshin bulat.ziganshin at
Wed Aug 16 01:40:51 EDT 2006

Hello Taral,

Wednesday, August 16, 2006, 1:25:03 AM, you wrote:
>> in this case we lose "class Functor a => Monad a" base class
>> declaration. so what will be the meaning of this:

> I don't see why that is the case.

> class Functor m => Monad m where
>     return :: a -> m a
>     (>>=) :: m a -> (a -> m b) -> m b
>     instance Functor m where
>         fmap f = (>>= return . f)

> What's wrong with this? All Monads are Functors. If you don't provide
> a Functor, it gets defined for you. The problem is working out whether
> to use the default Functor or an external Functor.

you deleted context of my note, where you wrote something opposite to
"All Monads are Functors":

> Not necessarily. If A doesn't have any Functor declarations, it could
> be considered just a Monad without a Functor.

is it possible to declare Monad Foo without Functor Foo with the above
class definition? i think no. Functor instance will be either
defaulted or explicitly defined. so both modules, A and B, actually
defines _both_ instances, although A defines Functor Foo implicitly
while B does it explicitly. importing both modules will mean importing
two different declaration of both instances, Functor Foo and Monad Foo

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Haskell-prime mailing list