Proposal: Remove Show and Eq superclasses of Num

Ganesh Sittampalam ganesh at
Sat Sep 17 14:39:48 CEST 2011

On 15/09/2011 23:58, Ian Lynagh wrote:
> The next 2 patches (for base and unix respectively) remove the Eq
> constraint. Here's there's some justification in the superclass, as it
> makes
>     f 5 = ...
> work for any Num type, rather than also needing an Eq constraint, but
> personally I would be in favour of removing this superclass too.
> Noteworthy is that Bits now needs an Eq superclass for the default
> methods for 'testBit' and 'popCount'.

I have a vague recollection that there are some generic implementations
of sqrt that rely on equality tests with 0. I can't spot any in the
Haskell library source, though.

Otherwise +1; one significant benefit of this change would be for EDSLs
which currently have to have broken Eq instances to implement Num.



More information about the Libraries mailing list