talira

generics-sop

Datatype-generic programming in Haskell using true sums of products

open sourceBSD-3-Clausefree

generics-sop is a Haskell library for writing generic functions: it views every datatype uniformly, with the choice of constructor as an n-ary sum and each constructor's fields as an n-ary product. It builds on sop-core, which holds the n-ary sums and products, and is based on Edsko de Vries and Andres Löh's paper "True Sums of Products". Companion packages show it in use for pretty-printing, lenses and JSON conversion. It's made by Well-Typed.

Problems it solves

  • write a generic function over any Haskell record type
  • derive JSON conversion generically in Haskell
  • datatype-generic programming without GHC.Generics boilerplate

Features

  • n-ary sum of products view of datatypes
  • sop-core for n-ary sums and products
  • examples for pretty-printing, lenses and JSON