Simon says:

 |       (a) If Functor is a superclass of Monad, then every instance
 |           of Monad must also be made an instance of Functor, whether
 |        or not one uses "map".  This can be tiresome.

Analogous to this is:

  If Monad is a superclass of MonadZero, then every instance of
  MonadZero must also be made an instance of Monad, whether or not one
  uses "bind" or "return". This can be tiresome.

Haskell doesn't need the fact that every instance of MonadZero is also
a Monad. But theoretically, it is still a superclass. Just as Functor
is theoretically a superclass of Monad. Monad is defined as a superclass
for MonadZero, just as Functor should be a superclass of Monad.

In fact, the connection between Monad and Functor is much stronger than
the connection between MonadZero and Monad; the former relation can be
expressed in terms of a direct default definition.

Simon also says:

 |       (b) On the other hand, it is never *necessary* to make one 
 |        class a superclass of another; it just makes contexts smaller.
 |        In Koen's example, he'd have to say:
 |                class MonadTrans t where
 |                  lift :: (Functor m, Monad m) => m a -> t m a

Suppose this (and it was in my case) was a library given to me by someone
else; I would have to change that library.

Also, to a category theorist, the context (Functor m, Monad m) must seem
rather superfluous.

Regards,
Koen.

--
|  Koen Claessen,                   [EMAIL PROTECTED]  |
|                   http://www.cse.ogi.edu/~kcclaess/  |
|------------------------------------------------------|
|  Visiting student at OGI,    Portland, Oregon, USA.  |



Reply via email to