yoko-2.0: Generic Programming with Disbanded Data Types

Safe HaskellNone

Data.Yoko.TH

Contents

Synopsis

Derivers

yokoTH :: Name -> Q [Dec]Source

Derive fields types and all yoko instances for a given data type.

yokoTH_with :: YokoOptions -> Name -> Q [Dec]Source

Customized derivation.

Options

data YokoOptions Source

The default yoko derivations can be customised.

Constructors

YokoOptions 

Fields

renamer :: (String -> String) -> String -> String

How fields type names are derived from constructor names. Defaults to (++ "_").

mappings :: [(Int, Mapping)] -> [(Int, Mapping)]

How applications of higher-rank data types are represented. Defaults to [(1, Mapping ''T1 'T1 'invmap), (2, Mapping ''T2 'T2 'invmap2)].

invInsts :: Bool -> Bool

Should instances of Invariant also be automatically derived for this type? Defaults to True.

dcInsts :: [Name] -> [Name]

For which constructors should instances of Rep and Generic be automatically derived? Defaults to the set of all constructors.

data Mapping Source

A Mapping identifies the representation type, its constructor, and the associated mapping function. For example, T1 is represented with Mapping ''T1 'T1 'invmap.

yokoDefaults :: YokoOptionsSource

The default options. yokoDefaults = YokoOptions id id id.