In opposition of Functor as super-class of Monad

Tony Morris tmorris at
Tue Jan 4 14:38:33 CET 2011

I think you'll find a problem using do-notation with your Monad.

Tony Morris

On 04/01/2011 11:33 PM, "Alexey Khudyakov" <alexey.skladnoy at>

On 04.01.2011 13:24, oleg at wrote:
> I'd like to argue in opposition of making Functor a...
I think I understood your point. But it looks like that it's possible to use
subclass's function in superclass instance. At very least GHC is able to do

Following example works just fine without any language extensions in

import Prelude hiding (Monad(..), Functor(..))

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

class Functor m => Monad m where
 return :: a -> m a
 (>>=) :: m a -> (a -> m b) -> m b
instance Functor Maybe where

 fmap f m = m >>= (return . f)
instance Monad Maybe where
 return = Just
 Nothing >>= _ = Nothing
 Just x  >>= f = f x

Haskell-prime mailing list
Haskell-prime at haskell.o...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Haskell-prime mailing list