[Haskell-beginners] Ord
Stanisław Findeisen
stf-list at eisenbits.com
Fri Dec 30 13:28:42 CET 2011
On 2011-12-30 12:58, Brandon Allbery wrote:
> 2011/12/30 Stanisław Findeisen <stf-list at eisenbits.com
> <mailto: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) ...).
If you don't provide either one, then you get an infinite loop, but this
is a runtime problem, i.e. the code will compile. Right?
How to declare an instance of Ord?
--
This e-mail address is invalid, see:
http://people.eisenbits.com/~stf/public-email-note.html .
OpenPGP: E3D9 C030 88F5 D254 434C 6683 17DD 22A0 8A3B 5CC0
More information about the Beginners
mailing list