4.5. Deriving

You might have noticed that I was able to say [Sunday .. Saturday] in my last example, thats because DayOfWeek is a member of the "Enum" typeclass. The "deriving" keyword can make types "automatically" a member of a typeclass. So I can say:

data DayOfWeek = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday
		 deriving (Enum, Show, Eq, Ord)

And this will provide default implementations for equality, ordering, etc.