[Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

August Sodora augsod at gmail.com
Mon Jul 25 06:11:57 CEST 2011


Out of (perhaps naive) curiosity, what difficulties does allowing such
overriding introduce? Wouldn't the module system prevent the ambiguity
of which implementation to use?

August Sodora
augsod at gmail.com
(201) 280-8138



On Sun, Jul 24, 2011 at 11:55 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 25 July 2011 13:50, Sebastien Zany <sebastien at chaoticresearch.com> wrote:
>> I was thinking the reverse. We can already give default implementations of class operations that can be overridden by giving them explicitly when we declare instances, so why shouldn't we be able to give default implementations of operations of more general classes, which could be overridden by a separate instance declaration for these?
>>
>> Then I could say something like "a monad is also automatically a functor with fmap by default given by..." and if I wanted to give a more efficient fmap for a particular monad I would just instantiate it as a functor explicitly.
>
> I believe this has been proposed before, but a major problem is that
> you cannot do such overriding.
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list