f-algebra-gen-0.1.0.0: Generate a special f-algebra combinator from any data type.

Safe HaskellSafe
LanguageHaskell2010

Data.Combinators.TH

Synopsis

Documentation

makeCombinator :: Name -> Q [Dec] Source #

Build a special combinator given a data type name. e.g.

-- List type
data List a = Nil | List a (List a)

makeCombinator ''List

This example will generate the following code:

makeCombinator ''ListF
 ======>
  listf f_acw7 f_acw8 Nil = f_acw7 ()
  listf f_acw7 f_acw8 (Cons a_acw9 a_acwa) = f_acw8 (a_acw9, a_acwa)