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

Safe Haskell | None
Language | Haskell2010

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

makeFold :: Derivation Source #