Proposal: Make Semigroup as a superclass of Monoid

Henning Thielemann lemming at henning-thielemann.de
Mon Apr 11 19:20:34 UTC 2016


On Mon, 11 Apr 2016, Ben Franksen wrote:

> Petr Pudlák wrote:
>> František Farka [1] worked in detail on a proposal that would make such
>> refactorings painless, see *Maintainable type classes for Haskell* [2]
>
> I am just reading the paper (from 2015) for the first time and have noted at 
> least one factual error. On page 6 it says:
>
> """
> a4 – remove a superclass constraint from an existing class This
> change does not cause any problems. Some instances from be-
> fore the change may be superfluous as these are no longer re-
> quired by superclass constraint.
> """
>
> Even though it does not invalidate the essence of what the author is 
> claiming (it merely weakens the argument slightly), this particular 
> assessment is clearly wrong: If the superclass has methods, removing the 
> superclass breaks all functions that use superclass methods and that have a 
> type signature which mentions only the child class in the constraints. Such 
> client code must be fixed by adding a constraint that mentions the former 
> superclass to its type.
>
> The paper has clearly not been proofread by an expert(*), so I guess its 
> results should be taken with a grain of salt. Which is sad because I do like 
> the ideas expressed in it.

I already wrote to the author regarding this mistake. I gave him the 
practical example of the removal of Show superclass from Num.


More information about the Libraries mailing list