Version 1 (modified by simonpj, 6 years ago) (diff)


The new Generic Deriving mechanism

GHC includes a new (in 2010) mechanism to let you write generic functions. It is described in A generic deriving mechanism for Haskell, by Magalhães, Dijkstra, Jeuring and Löh. This page sketches the specifics of the implementation; we assume you have read the paper.

Main components

  • TcDeriv.tcDeriving generates an InstInfo for each data type that fill in
  • Say which library modules, in which packages, contain which data types and classes.