[Haskell-beginners] Ord

Brandon Allbery allbery.b at gmail.com
Fri Dec 30 12:58:42 CET 2011


2011/12/30 Stanisław Findeisen <stf-list at eisenbits.com>

> Could anyone please explain to me what is going on here?
>

You must, when declaring an instance of Ord, provide *either* a definition
of (compare) or a definition of (<=).  Both have default implementations
defined, but in terms of each other; so if you don't provide either one in
your instance declaration, you get an infinite loop when you try to use Ord
methods (because (compare) invokes (<=), which invokes (compare) ...).

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20111230/a2fa0b64/attachment.htm>


More information about the Beginners mailing list