Stock deriving extensions
Contents
DeriveFoldable
example- Using the
stock
deriving strategy
The Haskell report specifies that the following classes may appear in a deriving
clause: Eq
, Ord
, Enum,
Ix
, Bounded
, Read
, and Show
. We call these “stock” derivable classes, which means the classes and rules for deriving them are standard; stock
deriving is the standard deriving strategy for standard typeclasses.
The following GHC language extensions make additional classes stock derivable:
Extension | Derivable typeclasses |
---|---|
DeriveFunctor | Functor |
DeriveFoldable | Foldable |
DeriveTraversable | Traversable |
DeriveGeneric | Generic, Generic1 |
DeriveLift | Lift |
DeriveDataTypeable | Data |
DeriveTraversable
implies DeriveFunctor
and DeriveFoldable
.