Revamping the numeric classes

Brian Boutel
Thu, 08 Feb 2001 18:37:04 +1300

Dylan Thurston wrote:
> Why doesn't your argument show that all types should by instances of
> Eq and Show?  Why are numeric types special?

Why do you think it does? I certainly don't think so.

The point about Eq was that a objection was raised to Num being a
subclass of Eq because, for some numeric types, equality is undecidable.
I suggested that Haskell equality could be undecidable, so (==) on those
types could reflect the real situation. One would expect that it could
do so in a natural way, producing a value of True or False when
possible, and diverging otherwise. Thus no convincing argument has been
given for removing Eq as a superclass of Num.

In general, if you fine-grain the Class heirarchy too much, the picture
gets very complicated. If you need to define separate subclases of Num
for those types which have both Eq and Show, those that only Have Eq,
those than only have Show and those that have neither, not to mention
those that have Ord as well as Eq and those that don't, and then for all
the other distinctions that will be suggested, my guess is that Haskell
will become the preserve of a few mathematicians and everyone else will
give up in disgust. Then the likely result is that no-one will be
interested in maintaining and developing Haskell and it will die.