<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>&gt; Iavor Diatchki wrote:</p>
<p>&gt; &gt;Just to avoid confusion I think the suggestions were:</p>
<p>&gt; &gt;class Functor f =&gt; Monad f where ...</p>
<p>&gt; &gt;class Functor f =&gt; FunctorM f where ...</p>
<p>&gt; &gt;</p>
<p>&gt; &gt;I know the first one differs from the Haskell report, but perhaps</p>
<p>&gt; &gt; this is a flaw in the library design that should be fixed.</p>
<p>&gt;</p>
<p>&gt; Yes, I think this should be fixed, and perhaps it could be done in a</p>
<p>&gt; backward compatible way? If classes were allowed to declare default</p>
<p>&gt; methods for superclasses, then you could have</p>
<p>&gt;</p>
<p>&gt;     class Functor f where fmap :: ...</p>
<p>&gt;     class Functor m =&gt; Monad m where</p>
<p>&gt;        ...the usual stuff...</p>
<p>&gt;        fmap = liftM</p>
<p>&gt;</p>
<p>&gt; Then declaring</p>
<p>&gt;</p>
<p>&gt;     instance Monad T where ...</p>
<p>&gt;</p>
<p>&gt; for some T, would implicitly introduce an instance Functor T, if it</p>
<p>&gt; is not defined explicitly...</p>
<p></p>
<p>Robert Will has written a fully specified proposal for this. He calls it &quot;delayed method definition&quot;, 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>