Proposal: Remove Show and Eq superclasses of Num

John Meacham john at repetae.net
Sat Sep 17 05:41:36 CEST 2011


The good thing about the incremental step of removing the superclasses
as an intermediate step is that it lets you write forwards and
backwards compatible code. just include Eq a,Num a in your type
signatures, the haskell 98 compiler won't complain and you can still
be compatibile with the new classes.

   John

On Fri, Sep 16, 2011 at 4:37 PM, Paterson, Ross <R.Paterson at city.ac.uk> wrote:
> Ian Lynagh writes:
>> It doesn't solve everything, but I hope we can agree it is an
>> incremental step in the right direction. I don't think a revolutionary
>> change fixing all the issues is feasible. This particular blemish was
>> already being described as "largely historical" more than a decade ago:
>>     http://www.haskell.org/pipermail/haskell/2000-October/006147.html
>
> All these blemishes have been described as historical for a long time.
> But I'm suggesting that we address them by going in a different direction.
>
> Under this proposal the 7 numeric classes lose the Show superclass,
> and Num, Fractional and Floating lose the Eq superclass.  That breaks
> compatibility with Haskell 98, and will break functions that have
> numeric classes in their signatures and use equality or show in their
> implementations (e.g. the patches need to change the signatures of
> 27 functions in ghc and the core libs).  If we're considering that,
> we ought also to consider alternative trade-offs between interface
> improvement and breakage.
>
> The alternative approach is to refactor the numeric classes internally
> (as in the yap package).  That will break packages too, probably more,
> but that will leave us with much more sensible and useful classes.
> And the breakage falls on different users:
> - If we remove superclasses of Num, it falls on (some) people who put
>  numeric classes in their type signatures.
> - If we refactor the numeric classes internally, it falls on those who
>  define instances of numeric classes.  (I would argue that many of those
>  instances are kludged today because of the flawed classes.) Those
>  who merely use the numeric classes in type signatures or call their
>  methods should be unaffected.
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>



More information about the Libraries mailing list