lens-family-th-0.1.0.0: Template Haskell to generate lenses for lens-family and lens-family-core

Safe HaskellNone

Lens.Family.TH

Description

Derive lenses for Lens.Family.

Example usage:

 {-# LANGUAGE TemplateHaskell -#}
 
 import Lens.Family
 import Lens.Family.TH
 
 data Foo a = Foo { _bar :: Int, _baz :: a }
            deriving (Show, Read, Eq, ord)
 $(mkLenses ''Foo)

Synopsis

Documentation

mkLenses :: 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.

mkLensesBy :: (String -> String) -> Name -> Q [Dec]Source

Derive lenses with the provided name transformation function.