[Haskell-cafe] deriving

PR Stanley prstanley at ntlworld.com
Mon Apr 7 14:27:38 EDT 2008

> > 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?

         No, sorry. I'm not sure how this differs from my definition. 
Could you elaborate please?

More information about the Haskell-Cafe mailing list