Deriving

We have a lot of stuff about deriving for you!

  • DerivingStrategies – The GHC extension that enables multiple deriving clauses that request a specific deriving strategy, why it exists, and what the deriving strategies are.

  • Stock deriving extensions – The classes that can be generated using the stock deriving strategy but require enabling additional GHC extensions, including an example of using DeriveFoldable.

  • DerivingVia (new in GHC 8.6) – This is where it gets exciting: The via deriving strategy lets types steal typeclass instances from other types! We run through a bunch of examples here. You might also find this page helpful if you need a refresher on kinds.

  • Transformers and deriving – An extended example that illustrates the delightful synergy between monad transformers and DerivingVia. We give a beginners’ introduction to ReaderT, no prior knowledge of transformers required.