I'd like to make "Day" an instance of class "Enum," but the definition of 
toEnum below seems to be completely wrong, because integers seem not permit 
pattern matching.  How is toEnum defined?  Thanks.
data Day                   =  Sunday                           |  Monday        
                   |  Tuesday                           |  Wednesday            
               |  Thursday                           |  Friday                  
         |  Saturday                           deriving (Eq, Ord, Show)
instance Enum Day where    fromEnum Sunday        =  0    fromEnum Monday       
 =  1    fromEnum Tuesday       =  2    fromEnum Wednesday     =  3    fromEnum 
Thursday      =  4    fromEnum Friday        =  5    fromEnum Saturday      =  
6        toEnum 0               =  Sunday    toEnum 1               =  Monday   
 toEnum 2               =  Tuesday    toEnum 3               =  Wednesday    
toEnum 4               =  Thursday    toEnum 5               =  Friday    
toEnum 6               =  Saturday                                          
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your 
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to