unexpected arithmetic sequence and deriving Enum behaviour

Stefan Holdermans stefan at cs.uu.nl
Fri Jun 30 15:21:31 EDT 2006


Simon,

Laszlo presented some code:

>> Consider the following code fragment:
>> data Colour = Red | Black | Blue deriving (Show, Bounded)
>> instance Enum Colour where

...

and then remarked:

>> Notice that there is no deriving Enum (which would be an error  
>> according to the Report)

You asked:

> Why do you say that?  Can you give a pointer to the relevant text  
> in the report?  I can't see anything wrong here.

I think he was referring to the fact that it is illegal to both  
*derive* and *define* an instance of a particular class for a type.

Regards,

   Stefan



More information about the Glasgow-haskell-bugs mailing list