[Haskell-cafe] deriving

John Dorsey haskell at colquitt.org
Mon Apr 7 13:05:20 EDT 2008


Paul,

> Hi
> data Bool = False | True
>   deriving (Eq, Or, Show, Read)
> 
> Bool is an instance of Eq, Ord, Show and Read. It is derived form 
> these classes.

No.  "deriving ..." here does not mean that Bool is derived from those
classes; it's not a statement about inheritance or anything similar.

"deriving ..." means that the class instances for Bool, for those four
type classes, are automatically derived from the definition of Bool.

Does this make more sense?

John



More information about the Haskell-Cafe mailing list