Proposal: Remove Show and Eq superclasses of Num
igloo at earth.li
Sat Oct 15 00:01:48 CEST 2011
On Thu, Sep 15, 2011 at 11:58:21PM +0100, Ian Lynagh wrote:
> 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
> class Num a where
10+ people indicated support for the proposal, while I think only 1
advocated an alternative course of action instead, so I have gone ahead
and made the change. Thanks to all for your input.
A few significant points made in the discussion:
John Meacham pointed out you can write code in such a way that
it works both before and after this change.
Regarding the Eq constraint (for which there is perhaps some
justification for the constraint) Jón Fairbairn and Ganesh Sittampalam
pointed out that if we remove it, people wouldn't have to create useless
Eq instances for types for which it is not possible to define a proper
A couple of people suggested putting an Eq constraint on the Integral
class instead, as the toInteger method means it is always possible to
define a sensible Eq instance. I haven't made this change, and I'm not
sure what the motivation for it is, but if anyone thinks it would be
worth doing then I suggest making a new proposal for it.
Removing the Num superclass of Bits was also mentioned, but that would
need its own proposal.
More information about the Libraries