<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:10pt;font-family:Bitstream Vera Sans Mono">
<p>On Thursday 24 March 2005 04:14, Thomas Hallgren wrote:</p>
<p>> Iavor Diatchki wrote:</p>
<p>> >Just to avoid confusion I think the suggestions were:</p>
<p>> >class Functor f => Monad f where ...</p>
<p>> >class Functor f => FunctorM f where ...</p>
<p>> ></p>
<p>> >I know the first one differs from the Haskell report, but perhaps</p>
<p>> > this is a flaw in the library design that should be fixed.</p>
<p>></p>
<p>> Yes, I think this should be fixed, and perhaps it could be done in a</p>
<p>> backward compatible way? If classes were allowed to declare default</p>
<p>> methods for superclasses, then you could have</p>
<p>></p>
<p>> class Functor f where fmap :: ...</p>
<p>> class Functor m => Monad m where</p>
<p>> ...the usual stuff...</p>
<p>> fmap = liftM</p>
<p>></p>
<p>> Then declaring</p>
<p>></p>
<p>> instance Monad T where ...</p>
<p>></p>
<p>> for some T, would implicitly introduce an instance Functor T, if it</p>
<p>> is not defined explicitly...</p>
<p></p>
<p>Robert Will has written a fully specified proposal for this. He calls it "delayed method definition", see http://www.stud.tu-ilmenau.de/~robertw/dessy/fun/, sections 4.3.1 and 4.3.2.</p>
<p></p>
<p>Looks like a really good idea to me.</p>
<p></p>
<p>Ben</p>
</body></html>