lens-4.15.3: Lenses, Folds and Traversals

Copyright | (C) 2014-2016 Edward Kmett (C) 2014 Eric Mertens
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable
Safe Haskell | Trustworthy
Language | Haskell98

Control.Lens.Internal.FieldTH

Description

Synopsis

- data LensRules = LensRules {
  - _simpleLenses :: Bool
  - _generateSigs :: Bool
  - _generateClasses :: Bool
  - _allowIsos :: Bool
  - _allowUpdates :: Bool
  - _lazyPatterns :: Bool
  - _fieldToDef :: Name -> [Name] -> Name -> [DefName]
  - _classyLenses :: Name -> Maybe (Name, Name)
  }
- data DefName
  - = TopName Name
  - | MethodName Name Name
- makeFieldOptics :: LensRules -> Name -> DecsQ
- makeFieldOpticsForDec :: LensRules -> Dec -> DecsQ

# Documentation

data LensRules #

Rules to construct lenses for data fields.

Constructors

LensRules |
Fields _simpleLenses :: Bool _generateSigs :: Bool _generateClasses :: Bool _allowIsos :: Bool _allowUpdates :: Bool Allow LensTraversal (otherwise GetterFold) _lazyPatterns :: Bool _fieldToDef :: Name -> [Name] -> Name -> [DefName] Type Name -> Field Names -> Target Field Name -> Definition Names _classyLenses :: Name -> Maybe (Name, Name)

data DefName #

Name to give to generated field optics.

Constructors

TopName Name | Simple top-level definiton name
MethodName Name Name | makeFields-style class name and method name

Instances

Eq DefName # |
Methods (==) :: DefName -> DefName -> Bool # (/=) :: DefName -> DefName -> Bool #
Ord DefName # |
Methods compare :: DefName -> DefName -> Ordering # (<) :: DefName -> DefName -> Bool # (<=) :: DefName -> DefName -> Bool # (>) :: DefName -> DefName -> Bool # (>=) :: DefName -> DefName -> Bool # max :: DefName -> DefName -> DefName # min :: DefName -> DefName -> DefName #
Show DefName # |
Methods showsPrec :: Int -> DefName -> ShowS # show :: DefName -> String # showList :: [DefName] -> ShowS #

makeFieldOptics :: LensRules -> Name -> DecsQ #

Compute the field optics for the type identified by the given type name. Lenses will be computed when possible, Traversals otherwise.

makeFieldOpticsForDec :: LensRules -> Dec -> DecsQ #