[Haskell-cafe] deriving

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Apr 7 14:47:25 EDT 2008

On Apr 7, 2008, at 12:12 , PR Stanley wrote:
> 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. If that is the meaning of the keyword deriving then  
> wouldn't a different keyword such as from or derivative or even  
> derivation be closer to the semantics of the concept?

"deriving" doesn't declare superclasses; it means "please auto- 
generate code for me implementing instances for these classes".  See  
http://haskell.org/onlinereport for the semantics of automatic  
instance deriving.

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list