Derive Generic
Although it is technically possible to write your own instances of the Generic
Generic
typeclass, in practice we nearly always let GHC derive it for us. Since the Haskell Report specifies only a fixed handful of classes that are allowed to go into a deriving
clause, this requires a language extension.
Generic can be derived for all but the most exotic datatypes; it does not work with some fancy features like existential quantification or GADTs.
The DeriveGeneric
GHC extension first appeared in GHC version 7.2.1.