[Haskell-cafe] Things to avoid (Was: Top 20 ``things'' to know in Haskell)

Daniel Fischer daniel.is.fischer at web.de
Sat Feb 12 06:35:25 EST 2005

Am Samstag, 12. Februar 2005 01:42 schrieb karczma at 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.


More information about the Haskell-Cafe mailing list