/
Control-Lens-TH.html
77 lines (77 loc) · 23.1 KB
/
Control-Lens-TH.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Control.Lens.TH</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Control-Lens-TH.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Lens-TH.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">lens-3.5.1: Lenses, Folds and Traversals</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>TemplateHaskell</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>Edward Kmett <ekmett@gmail.com></td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Control.Lens.TH</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Constructing Lenses Automatically
</a></li><li><a href="#g:2">Configuring Lenses
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc empty"> </div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:makeLenses">makeLenses</a> :: Name -> Q [Dec]</li><li class="src short"><a href="#v:makeLensesFor">makeLensesFor</a> :: [(String, String)] -> Name -> Q [Dec]</li><li class="src short"><a href="#v:makeClassy">makeClassy</a> :: Name -> Q [Dec]</li><li class="src short"><a href="#v:makeClassyFor">makeClassyFor</a> :: String -> String -> [(String, String)] -> Name -> Q [Dec]</li><li class="src short"><a href="#v:makeIso">makeIso</a> :: Name -> Q [Dec]</li><li class="src short"><a href="#v:makeLensesWith">makeLensesWith</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> -> Name -> Q [Dec]</li><li class="src short"><a href="#v:defaultRules">defaultRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a></li><li class="src short"><span class="keyword">data</span> <a href="#t:LensRules">LensRules</a> = <a href="#v:LensRules">LensRules</a> (String -> Maybe String) (String -> Maybe String) (String -> Maybe (String, String)) (Set <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a>)</li><li class="src short"><a href="#v:lensRules">lensRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a></li><li class="src short"><a href="#v:classyRules">classyRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a></li><li class="src short"><a href="#v:isoRules">isoRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a></li><li class="src short"><a href="#v:lensIso">lensIso</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (String -> Maybe String)</li><li class="src short"><a href="#v:lensField">lensField</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (String -> Maybe String)</li><li class="src short"><a href="#v:lensClass">lensClass</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (String -> Maybe (String, String))</li><li class="src short"><a href="#v:lensFlags">lensFlags</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (Set <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a>)</li><li class="src short"><span class="keyword">data</span> <a href="#t:LensFlag">LensFlag</a> <ul class="subs"><li>= <a href="#v:SimpleLenses">SimpleLenses</a> </li><li>| <a href="#v:PartialLenses">PartialLenses</a> </li><li>| <a href="#v:BuildTraversals">BuildTraversals</a> </li><li>| <a href="#v:SingletonAndField">SingletonAndField</a> </li><li>| <a href="#v:SingletonIso">SingletonIso</a> </li><li>| <a href="#v:HandleSingletons">HandleSingletons</a> </li><li>| <a href="#v:SingletonRequired">SingletonRequired</a> </li><li>| <a href="#v:CreateClass">CreateClass</a> </li><li>| <a href="#v:CreateInstance">CreateInstance</a> </li><li>| <a href="#v:ClassRequired">ClassRequired</a> </li><li>| <a href="#v:GenerateSignatures">GenerateSignatures</a> </li></ul></li><li class="src short"><a href="#v:simpleLenses">simpleLenses</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:partialLenses">partialLenses</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:buildTraversals">buildTraversals</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:handleSingletons">handleSingletons</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:singletonIso">singletonIso</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:singletonRequired">singletonRequired</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:createClass">createClass</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:createInstance">createInstance</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:classRequired">classRequired</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:singletonAndField">singletonAndField</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li><li class="src short"><a href="#v:generateSignatures">generateSignatures</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool</li></ul></div><div id="interface"><h1 id="g:1">Constructing Lenses Automatically
</h1><div class="top"><p class="src"><a name="v:makeLenses" class="def">makeLenses</a> :: Name -> Q [Dec]<a href="src/Control-Lens-TH.html#makeLenses" class="link">Source</a></p><div class="doc"><p>Build lenses (and traversals) with a sensible default configuration.
</p><pre> makeLenses = makeLensesWith lensRules
</pre></div></div><div class="top"><p class="src"><a name="v:makeLensesFor" class="def">makeLensesFor</a> :: [(String, String)] -> Name -> Q [Dec]<a href="src/Control-Lens-TH.html#makeLensesFor" class="link">Source</a></p><div class="doc"><p>Derive lenses and traversals, specifying explicit pairings of <code>(fieldName, lensName)</code>.
</p><p>If you map multiple names to the same label, and it is present in the same constructor then this will generate a <code><a href="Control-Lens-Traversal.html#t:Traversal">Traversal</a></code>.
</p><p><em>e.g.</em>
</p><pre> makeLensesFor [("_foo", "fooLens"), ("baz", "lbaz")] ''Foo
makeLensesFor [("_barX", "bar"), ("_barY", "bar)] ''Bar
</pre></div></div><div class="top"><p class="src"><a name="v:makeClassy" class="def">makeClassy</a> :: Name -> Q [Dec]<a href="src/Control-Lens-TH.html#makeClassy" class="link">Source</a></p><div class="doc"><p>Make lenses and traversals for a type, and create a class when the type has no arguments.
</p><p><em>e.g.</em>
</p><pre>
data Foo = Foo { _fooX, _fooY :: <code>Int</code> }
<code><a href="Control-Lens-TH.html#v:makeClassy">makeClassy</a></code> ''Foo
</pre><p>will create
</p><pre>
class HasFoo t where
foo :: <code><a href="Control-Lens-Type.html#t:Simple">Simple</a></code> <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code> t Foo
instance HasFoo Foo where foo = <code>id</code>
fooX, fooY :: HasFoo t => <code><a href="Control-Lens-Type.html#t:Simple">Simple</a></code> <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code> t <code>Int</code>
</pre><pre> makeClassy = makeLensesWith classyRules
</pre></div></div><div class="top"><p class="src"><a name="v:makeClassyFor" class="def">makeClassyFor</a> :: String -> String -> [(String, String)] -> Name -> Q [Dec]<a href="src/Control-Lens-TH.html#makeClassyFor" class="link">Source</a></p><div class="doc"><p>Derive lenses and traversals, using a named wrapper class, and specifying
explicit pairings of <code>(fieldName, traversalName)</code>.
</p><p>Example usage:
</p><pre> makeClassyFor "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo
</pre></div></div><div class="top"><p class="src"><a name="v:makeIso" class="def">makeIso</a> :: Name -> Q [Dec]<a href="src/Control-Lens-TH.html#makeIso" class="link">Source</a></p><div class="doc"><p>Make a top level isomorphism injecting <em>into</em> the type.
</p><p>The supplied name is required to be for a type with a single constructor that has a single argument
</p><p><em>e.g.</em>
</p><pre>
newtype List a = List [a]
makeIso ''List
</pre><p>will create
</p><pre>
list :: Iso [a] [b] (<code>List</code> a) (<code>List</code> b)
</pre><pre> makeIso = makeLensesWith isoRules
</pre></div></div><h1 id="g:2">Configuring Lenses
</h1><div class="top"><p class="src"><a name="v:makeLensesWith" class="def">makeLensesWith</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> -> Name -> Q [Dec]<a href="src/Control-Lens-TH.html#makeLensesWith" class="link">Source</a></p><div class="doc"><p>Build lenses with a custom configuration.
</p></div></div><div class="top"><p class="src"><a name="v:defaultRules" class="def">defaultRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a><a href="src/Control-Lens-TH.html#defaultRules" class="link">Source</a></p><div class="doc"><p>Default lens rules
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:LensRules" class="def">LensRules</a> <a href="src/Control-Lens-TH.html#LensRules" class="link">Source</a></p><div class="doc"><p>This configuration describes the options we'll be using to make isomorphisms or lenses.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:LensRules" class="def">LensRules</a> (String -> Maybe String) (String -> Maybe String) (String -> Maybe (String, String)) (Set <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a>)</td><td class="doc empty"> </td></tr></table></div></div><div class="top"><p class="src"><a name="v:lensRules" class="def">lensRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a><a href="src/Control-Lens-TH.html#lensRules" class="link">Source</a></p><div class="doc"><p>Rules for making fairly simple partial lenses, ignoring the special cases
for isomorphisms and traversals, and not making any classes.
</p></div></div><div class="top"><p class="src"><a name="v:classyRules" class="def">classyRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a><a href="src/Control-Lens-TH.html#classyRules" class="link">Source</a></p><div class="doc"><p>Rules for making lenses and traversals that precompose another lens.
</p></div></div><div class="top"><p class="src"><a name="v:isoRules" class="def">isoRules</a> :: <a href="Control-Lens-TH.html#t:LensRules">LensRules</a><a href="src/Control-Lens-TH.html#isoRules" class="link">Source</a></p><div class="doc"><p>Rules for making an isomorphism from a data type
</p></div></div><div class="top"><p class="src"><a name="v:lensIso" class="def">lensIso</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (String -> Maybe String)<a href="src/Control-Lens-TH.html#lensIso" class="link">Source</a></p><div class="doc"><p>Lens to access the convention for naming top level isomorphisms in our lens rules.
</p><p>Defaults to lowercasing the first letter of the constructor.
</p></div></div><div class="top"><p class="src"><a name="v:lensField" class="def">lensField</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (String -> Maybe String)<a href="src/Control-Lens-TH.html#lensField" class="link">Source</a></p><div class="doc"><p>Lens to access the convention for naming fields in our lens rules.
</p><p>Defaults to stripping the _ off of the field name, lowercasing the name, and
rejecting the field if it doesn't start with an '_'.
</p></div></div><div class="top"><p class="src"><a name="v:lensClass" class="def">lensClass</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (String -> Maybe (String, String))<a href="src/Control-Lens-TH.html#lensClass" class="link">Source</a></p><div class="doc"><p>Retrieve options such as the name of the class and method to put in it to
build a class around monomorphic data types.
</p></div></div><div class="top"><p class="src"><a name="v:lensFlags" class="def">lensFlags</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> (Set <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a>)<a href="src/Control-Lens-TH.html#lensFlags" class="link">Source</a></p><div class="doc"><p>Retrieve options such as the name of the class and method to put in it to
build a class around monomorphic data types.
</p></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:LensFlag" class="def">LensFlag</a> <a href="src/Control-Lens-TH.html#LensFlag" class="link">Source</a></p><div class="doc"><p>Flags for lens construction
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:SimpleLenses" class="def">SimpleLenses</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:PartialLenses" class="def">PartialLenses</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:BuildTraversals" class="def">BuildTraversals</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:SingletonAndField" class="def">SingletonAndField</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:SingletonIso" class="def">SingletonIso</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:HandleSingletons" class="def">HandleSingletons</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:SingletonRequired" class="def">SingletonRequired</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:CreateClass" class="def">CreateClass</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:CreateInstance" class="def">CreateInstance</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:ClassRequired" class="def">ClassRequired</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a name="v:GenerateSignatures" class="def">GenerateSignatures</a></td><td class="doc empty"> </td></tr></table></div><div class="subs instances"><p id="control.i:LensFlag" class="caption collapser" onclick="toggleSection('i:LensFlag')">Instances</p><div id="section.i:LensFlag" class="show"><table><tr><td class="src">Eq <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a></td><td class="doc empty"> </td></tr><tr><td class="src">Ord <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a></td><td class="doc empty"> </td></tr><tr><td class="src">Read <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a></td><td class="doc empty"> </td></tr><tr><td class="src">Show <a href="Control-Lens-TH.html#t:LensFlag">LensFlag</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:simpleLenses" class="def">simpleLenses</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#simpleLenses" class="link">Source</a></p><div class="doc"><p>Only Generate valid <code><a href="Control-Lens-Type.html#t:Simple">Simple</a></code> <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code> lenses.
</p></div></div><div class="top"><p class="src"><a name="v:partialLenses" class="def">partialLenses</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#partialLenses" class="link">Source</a></p><div class="doc"><p>Enables the generation of partial lenses, generating runtime errors for
every constructor that does not have a valid definition for the lens. This
occurs when the constructor lacks the field, or has multiple fields mapped
to the same lens.
</p></div></div><div class="top"><p class="src"><a name="v:buildTraversals" class="def">buildTraversals</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#buildTraversals" class="link">Source</a></p><div class="doc"><p>In the situations that a lens would be partial, when <code><a href="Control-Lens-TH.html#v:partialLenses">partialLenses</a></code> is
used, this flag instead causes traversals to be generated. Only one can be
used, and if neither are, then compile-time errors are generated.
</p></div></div><div class="top"><p class="src"><a name="v:handleSingletons" class="def">handleSingletons</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#handleSingletons" class="link">Source</a></p><div class="doc"><p>Handle singleton constructors specially.
</p></div></div><div class="top"><p class="src"><a name="v:singletonIso" class="def">singletonIso</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#singletonIso" class="link">Source</a></p><div class="doc"><p>Use <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> for singleton constructors.
</p></div></div><div class="top"><p class="src"><a name="v:singletonRequired" class="def">singletonRequired</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#singletonRequired" class="link">Source</a></p><div class="doc"><p>Expect a single constructor, single field newtype or data type.
</p></div></div><div class="top"><p class="src"><a name="v:createClass" class="def">createClass</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#createClass" class="link">Source</a></p><div class="doc"><p>Create the class if the constructor is simple and the <code><a href="Control-Lens-TH.html#v:lensClass">lensClass</a></code> rule matches.
</p></div></div><div class="top"><p class="src"><a name="v:createInstance" class="def">createInstance</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#createInstance" class="link">Source</a></p><div class="doc"><p>Create the instance if the constructor is simple and the <code><a href="Control-Lens-TH.html#v:lensClass">lensClass</a></code> rule matches.
</p></div></div><div class="top"><p class="src"><a name="v:classRequired" class="def">classRequired</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#classRequired" class="link">Source</a></p><div class="doc"><p>Die if the <code><a href="Control-Lens-TH.html#v:lensClass">lensClass</a></code> fails to match.
</p></div></div><div class="top"><p class="src"><a name="v:singletonAndField" class="def">singletonAndField</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#singletonAndField" class="link">Source</a></p><div class="doc"><p>When building a singleton <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> (or <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code>) for a record constructor, build both
the <code><a href="Control-Lens-Iso.html#t:Iso">Iso</a></code> (or <code><a href="Control-Lens-Type.html#t:Lens">Lens</a></code>) for the record and the one for the field.
</p></div></div><div class="top"><p class="src"><a name="v:generateSignatures" class="def">generateSignatures</a> :: <a href="Control-Lens-Type.html#t:Simple">Simple</a> <a href="Control-Lens-Type.html#t:Lens">Lens</a> <a href="Control-Lens-TH.html#t:LensRules">LensRules</a> Bool<a href="src/Control-Lens-TH.html#generateSignatures" class="link">Source</a></p><div class="doc"><p>Indicate whether or not to supply the signatures for the generated lenses.
</p><p>Disabling this can be useful if you want to provide a more restricted type signature
or if you want to supply hand-written haddocks.
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.1</p></div></body></html>