Proposal: Remove Show and Eq superclasses of Num

Malcolm Wallace malcolm.wallace at
Sat Sep 17 10:46:55 CEST 2011

> 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.  Pattern-matching on any other kind of constructor does not require an Eq context: it feels like some of the magic of literal numbers (I know they aren't really literals, they just appear that way) is wearing off and the underlying reality (where they are not constructors at all) is becoming visible.


More information about the Libraries mailing list