Proposal: Remove Show and Eq superclasses of Num

Ian Lynagh igloo at earth.li
Fri Sep 16 00:58:21 CEST 2011


Hi all,

I would like to propose that we remove the Show and Eq superclasses from
Num, i.e. change
    class  (Eq a, Show a) => Num a  where
        [...]
to
    class  Num a  where
        [...]


The first 2 attached patches (for base and ghc respectively) remove the
Show constraint. I'm not aware of any justification for why this
superclass makes sense.


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'.


The fifth patch (for base) is what prompted me to get around to sending
this proposal. It lets us de-orphan the Show Integer instance.


Any opinions?


Suggested discussion deadline: 12th October


Thanks
Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Remove-the-Show-superclass-of-Num.patch
Type: text/x-diff
Size: 3505 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110915/27cd3154/attachment-0005.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Follow-the-removal-of-the-Show-superclass-of-Num.patch
Type: text/x-diff
Size: 1451 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110915/27cd3154/attachment-0006.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Remove-the-Eq-superclass-of-Num.patch
Type: text/x-diff
Size: 6945 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110915/27cd3154/attachment-0007.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Follow-the-removal-of-the-Eq-superclass-of-Num.patch
Type: text/x-diff
Size: 1109 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110915/27cd3154/attachment-0008.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-De-orphan-the-Show-Integer-instance.patch
Type: text/x-diff
Size: 10827 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110915/27cd3154/attachment-0009.patch>


More information about the Libraries mailing list