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

karczma at info.unicaen.fr karczma at info.unicaen.fr
Fri Feb 11 19:42:26 EST 2005

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 

More information about the Haskell-Cafe mailing list