Portability | TemplateHaskell |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Trustworthy |
Constructing Lenses Automatically
makeLenses :: Name -> Q [Dec]Source
Derive lenses for the record selectors in a single-constructor data declaration, or for the record selector in a newtype declaration. Lenses will only be generated for record fields which are prefixed with an underscore.
Example usage:
makeLenses ''Foo
Derive lenses with the provided name transformation
and filtering function. Produce Just lensName
to generate a lens
of the resultant name, or Nothing
to not generate a lens
for the input record name.
Example usage:
makeLensesBy (\n -> Just (n ++ "L")) ''Foo