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



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.