In opposition of Functor as super-class of Monad

Tony Morris tonymorris at
Wed Jan 5 21:29:05 CET 2011

On 06/01/11 04:58, Isaac Dupree wrote:
> Tony, you're missing the point... Alexey isn't making a complete patch
> to GHC/base libraries, just a hacky-looking demonstration.  Alexey is
> saying that in a class hierarchy (such as if Functor => Monad were a
> hierarchy, or for that matter "XFunctor"=>"XMonad" or Eq => Ord), it
> is still possible to define the superclass functions (fmap) in terms
> of the subclass functions (return and >>=) (such as writing a functor
> instance in which "fmap f m = m >>= (return . f)").  This has always
> been true in Haskell, it just might not have been obvious.
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at
Oh right sorry. I thought a stronger point was being made.

Then perhaps it's also worth pointing out that (<*>) can be written
using (>>=) and return:
f <*> a = f >>= \ff -> a >>= \aa -> return (ff aa)

Tony Morris

More information about the Haskell-prime mailing list