Proposal: Remove Show and Eq superclasses of Num
Edward Kmett
ekmett at gmail.com
Sun Sep 18 11:25:46 CEST 2011
On Sun, Sep 18, 2011 at 5:19 AM, Yitzchak Gale <gale at sefer.org> wrote:
> +1 on removing the Show constraint.
> I abstain on the Eq constraint - either way is fine with me.
>
> Jon Fairbairn wrote:
> > But pattern matching for Double or Float is a Bad Thing, so
> > wouldn’t the solution to this be to put the EQ constraint
> > somewhere else, such as Integral where it would be less
> > improper?
>
> The Badness comes from the Eq instance itself. Once that
> instance exists, using it for pattern matching isn't any worse
> than equating with a Num literal in an expression. If we are
> going to have an Eq constraint at all, it might as well be on
> Num.
>
Well, in the case of Integral values, I know I can convert them to an
Integer and so I have a meaningful notion of equality that comes built
in and Real imparts an Ord instance, both via the current instance and
inherently due to the ability to convert to a Rational so if you require too
much more than Num you'd get Eq. Why burden Num with it where it locks out
useful instances or makes users lie to get them?
-Edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110918/080999fc/attachment-0001.htm>
More information about the Libraries
mailing list