Why not just have the new definition with a different import path, so that legacy code continues to do:

import Control.Monad

And new code could do:

import Control.Category.Monad (or something)

And we could take this opportunity to incorporate premonads...

class Functor f -- defines fmap
class Functor p => Premonad p -- defines return
class Premonad m = Monad m -- defines bind

   Keean.

Simon Peyton-Jones wrote:

| > Yes, I think this should be fixed, and perhaps it could be done in a
| > backward compatible way? If classes were allowed to declare default
| > methods for superclasses, then you could have
| >
| >     class Functor f where fmap :: ...
| >     class Functor m => Monad m where
| >        ...the usual stuff...
| >        fmap = liftM
| >
| > Then declaring
| >
| >     instance Monad T where ...
| >
| > for some T, would implicitly introduce an instance Functor T, if it
is
| > not defined explicitly...

It seems overkill to have a whole new language feature to deal with one
library issue.  It would take a bit of implementing too, and it's not
clear to me what the specification is.  For example, what if Functor T
*is* defined explicitly, but in a later module?

The idea comes up very occasionally, but I wouldn't say it's been a hot
issue.

Simon

_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell



_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Reply via email to