derive-2.6.5: A program and library to derive instances for data types

Safe HaskellNone
LanguageHaskell2010

Data.Derive.Fold

Description

A pseudo derivation. Derive a (non-recursive) fold function for the type which takes one function per alternative constructor. Each function takes the same arguments as the constructor and returns a value. When applied to a value the fold function applies the function for the matching constructor to the constructor fields. This provides a first-class alternative to pattern matching to deconstruct the data type.

Documentation