Proposal: Remove Show and Eq superclasses of Num
Edward Kmett
ekmett at gmail.com
Fri Sep 16 01:27:08 CEST 2011
+1 from me.
The primary concern is of course that this means loss of compatibility with the current Haskell Report.
foo :: Num a => a -> String
foo = show
would cease to type check.
-Edward
Sent from my iPad
On Sep 15, 2011, at 6:58 PM, Ian Lynagh <igloo at earth.li> wrote:
>
> 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
>
> <0003-Remove-the-Show-superclass-of-Num.patch>
> <0001-Follow-the-removal-of-the-Show-superclass-of-Num.patch>
> <0004-Remove-the-Eq-superclass-of-Num.patch>
> <0001-Follow-the-removal-of-the-Eq-superclass-of-Num.patch>
> <0005-De-orphan-the-Show-Integer-instance.patch>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
More information about the Libraries
mailing list