[Haskell-cafe] FW: Why does this Ord-class instance crash?
R J
rj248842 at hotmail.com
Fri May 21 13:06:51 EDT 2010
Why does the following, trivial code snippet below hang GHCi when I type"Scalene > Failure", and what's the fix?
data Triangle = Failure | Equilateral | Isosceles | Scalene deriving (Eq, Show)
instance Ord Triangle where Failure < Failure = False Failure < _ = True
Equilateral < Failure = False Equilateral < Equilateral = False Equilateral < _ = True
Isosceles < Scalene = True Isosceles < _ = False
Scalene < _ = False
(I tried submitting this to beginners at haskell.org, but even though I've signed up for that mailing list, I got a bounce-back saying that I needed admin approval to submit anything to that list, and I haven't heard from an admin, so I'm posting it here.)
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100521/9b561dc4/attachment.html
More information about the Haskell-Cafe
mailing list