
Am Samstag, 12. Februar 2005 01:42 schrieb karczma@info.unicaen.fr:
Iavor Diatchki writes in response to Thomas Jäger
Literal patterns need equality: f 2 = e is like: f x | x == 2 = e
These do not force the 'Num' class to be a superclass of 'Ord' or 'Eq'. If 'Num' was not a superclass of 'Eq', whenver you used a literal pattern there would be an extra constraint that there should be equality on the corresponding type.
You mean of course that Eq is a superclass of Num, not the reverse.
Anyway, I always hated this, especially working with functional objects for which I had some arithmetic defined...
Jerzy Karczmarczuk
I feel somewhat similarly. I think it would be nice to have numerical classes where the arithmetic operations are provided, so you can naturally add functions &c, and then have Num a subclass where fromInteger and instances of Eq and Show are added. Daniel