[Haskell-cafe] Ord type on lists

Claus Reinke claus.reinke at talk21.com
Sat Apr 2 18:35:10 EST 2005

> Hi everyone, I defined my own list datatype and then tried to declare
> it as an instance of type class Ord. However when I test it with
> Nil > Cons 1(Nil)
> I get an "ERROR - Control stack overflow"
> I am under the impression that the ord class defines default
> implementations of (<=), (>),(>=) so that I only have to supply the
> implementation of (<) shown below. Can some one tell me why this does
> not work the way I expect it to?

Now, whereever did that interpretation come from?-) 

The library docs are pretty clear about what constitutes a minimal definition:


Have a closer look at Ord and its default definitions to see what happens in 
your case:



More information about the Haskell-Cafe mailing list