All Monads are Functors

Bulat Ziganshin bulat.ziganshin at
Mon Aug 14 07:38:42 EDT 2006

Hello Taral,

Monday, August 14, 2006, 3:34:29 PM, you wrote:

> On 8/14/06, Jon Fairbairn <jon.fairbairn at> wrote:
>> of course, there's no reason to do that, but what I'm
>> proposing is that we allow default instance declarations in
>> class declarations in much the same way as default methods:

> I just realized that default superclass methods have a small problem:

> module A contains instance Monad []
> module B contains instance Functor []
> module C imports A and B.

> Do we complain about a duplicate instance declarations?

yes. after all, this is just syntax sugar of giving both declarations:

instance Monad [] where
  fmap = map
  return = (:[])

is equivalent to

instance Functor [] where
  fmap = map

instance Monad [] where
  return = (:[])

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Haskell-prime mailing list