Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Why does this Ord-class instance crash? (R J)
   2. Re:  Why does this Ord-class instance crash?
      (Brandon S. Allbery KF8NH)


----------------------------------------------------------------------

Message: 1
Date: Fri, 21 May 2010 12:13:41 +0000
From: R J <[email protected]>
Subject: [Haskell-beginners] Why does this Ord-class instance crash?
To: <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"


I'm trying to declare Triangle as an instance of the Ord class without using 
"deriving (Ord)", so I can better understand the manual instantiation.
As I understand it, all I need merely to define "<".  Yet, when I do so using 
the code snippet below, this code hangs when I type "Scalene > Failure" in 
GHCi.  Why is that, and what's the fix?  Thanks.
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
                                          
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20100521/abab04c9/attachment-0001.html

------------------------------

Message: 2
Date: Sat, 22 May 2010 17:22:21 -0400
From: "Brandon S. Allbery KF8NH" <[email protected]>
Subject: Re: [Haskell-beginners] Why does this Ord-class instance
        crash?
To: R J <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Skipped content of type multipart/alternative-------------- next part 
--------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : 
http://www.haskell.org/pipermail/beginners/attachments/20100522/a7971088/PGP-0001.bin

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 23, Issue 35
*****************************************

Reply via email to