
Duncan Coutts
We all know that Functor should have been a superclass of Monad, and indeed we now know that Applicative should be too. Making such a change would break lots of things however so the change does not happen.
However in this case the Monad operations can be used to implement the Functor and Applicative class methods. So it would be nice if we could get them for free if the author did not choose to write the Functor and Applicative instances.
...
Does this proposal have any unintended consequences? I'm not sure. Please discuss :-)
I started a discussion on these lines on the Haskell prime mailing list a while ago. Apart from the objections others have posted, I think just supplying methods a bit unstructured. In http://article.gmane.org/gmane.comp.lang.haskell.prime/1578/match=all+monads... I suggested instead that such defaults should be instance declarations. It gives much the same effect (and with similar problems), but makes it clear to which class the methods being declared belong. If you were to find a middle ground (say using the syntax I suggest there but with the interpretation that it supplies default methods for the superclass, and use Simons suggestion of requiring explicit empty instance declarations when you want to use them, we might get somewhere sensible. -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk