Proposal: Remove Show and Eq superclasses of Num

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Sun Sep 18 10:54:52 CEST 2011


Malcolm Wallace <malcolm.wallace at me.com> writes:

>> 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.
>
> I'm strongly in favour of removing the Show constraint.
>
>> 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,
>
> I am undecided whether removing the Eq constraint is a good
> thing or not. In principle, yes, it makes perfect sense. But
> in practice, the example you give of pattern-matching a
> literal now requiring an Eq context, smells slightly wrong to
> me.

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?

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk





More information about the Libraries mailing list