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 data types; 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.

Type Classes offers courses and projects to get you started and make you an expert in FP with Haskell. For $29/month, you get access to the complete archive and all the latest content.