Mon, 5 Jun 2000 20:26:05 +0100, Nick Williams <[EMAIL PROTECTED]> pisze:

> data Cost = Val Integer | Infinity deriving Show

deriving (Eq, Ord, Show) makes right instances in your case.

> instance Ord Cost where
>   Val x < Val y = x<y
>   Infinity < Val _ = False
>   Val _ < Infinity = True
>   Infinity < Infinity = False

Default implementation of (<=) uses compare and vice versa. If you
define neither of them, both will loop forever. It's enough to provide
either compare or (<=) in the Ord class, but not (<).

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to