[ I didn't see a CC: in Marcin's reply, so I'll quote the full
  mail again... ]

Marcin 'Qrczak' Kowalczyk wrote:
> 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 (<).

But -fwarn-missing-methods (which is on by default) should yield a
warning in that case. Perhaps it doesn't handle circular default
methods correctly? Don't know...

Cheers,
   Sven
-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.informatik.uni-muenchen.de/~Sven.Panne

Reply via email to