Fergus Henderson wrote:
| instance Eq b => Eq (a -> b) where
| f == g = error "can't compute equality of functions"
I hope that you are joking here ...
Why don't we propose this: add the following
default instance for *all* types in Haskell:
instance Eq a where
f == g = error "can't compute equality for <<type>>"
Using overlapping instances, we can override
this (like virtual functions in C++) for the types
that *have* equality.
;-)
This is of course the ultimate non-solution!
So the big question is:
"WHY does the Num class hierarchy look as it looks?"
Is there a good reason for why it has to be so
complicated? Strange superclasses (Eq, Show),
strange subclasses (Integral, etc.). Add to this
the strange default rules and you have *my* most
common source of type errors and frustration in
Haskell.
Almost no other construct in the whole Haskell
language is so commonly used as Numbers, and
certainly no other construct *forces* me to look
at the report, browse preludes etc. so often!
(As soon as I want to do something more complicated
than +, that is.)
Regards,
Koen.
--
Koen Claessen http://www.cs.chalmers.se/~koen
phone:+46-31-772 5424 e-mail:[EMAIL PROTECTED]
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden