Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 409 lines (334 sloc) 20.09 kB
1ca949a @ekmett oxford ,
authored
1 Lens: Lenses, Folds, and Traversals
5e9c11b @ekmett better title
authored
2 ==================================
c5c8e5f @ekmett repository initialized
authored
3
f43348d @MaxGabriel Use SVG for the Travis badge in the README
MaxGabriel authored
4 [![Build Status](https://secure.travis-ci.org/ekmett/lens.svg)](http://travis-ci.org/ekmett/lens)
c5c8e5f @ekmett repository initialized
authored
5
2f342e4 @ekmett ,
authored
6 This package provides families of [lenses](https://github.com/ekmett/lens/blob/master/src/Control/Lens/Type.hs), [isomorphisms](https://github.com/ekmett/lens/blob/master/src/Control/Lens/Iso.hs), [folds](https://github.com/ekmett/lens/blob/master/src/Control/Lens/Fold.hs), [traversals](https://github.com/ekmett/lens/blob/master/src/Control/Lens/Traversal.hs), [getters](https://github.com/ekmett/lens/blob/master/src/Control/Lens/Getter.hs) and [setters](https://github.com/ekmett/lens/blob/master/src/Control/Lens/Setter.hs).
9af3f66 @ekmett metadata
authored
7
1c6feb0 @ekmett Added info about the video/slides to the README
authored
8 If you are looking for where to get started, [a crash course video](http://youtu.be/cefnmjtAolY?hd=1) on how `lens` was constructed and how to use the basics is available on youtube. It is best watched in high definition to see the slides, but the [slides](http://comonad.com/haskell/Lenses-Folds-and-Traversals-NYC.pdf) are also available if you want to use them to follow along.
9
50fc25b @ekmett Added link to the FAQ to the README
authored
10 The [FAQ](https://github.com/ekmett/lens/wiki/FAQ), which provides links to a large number of different resources for learning about lenses and an overview of the [derivation](https://github.com/ekmett/lens/wiki/Derivation) of these types can be found on the [Lens Wiki](https://github.com/ekmett/lens/wiki) along with a brief [overview](https://github.com/ekmett/lens/wiki/Overview) and some [examples](https://github.com/ekmett/lens/wiki/Examples).
b65890a @ekmett tutorial link
authored
11
50fc25b @ekmett Added link to the FAQ to the README
authored
12 Documentation is available through [github](http://ekmett.github.com/lens/frames.html) (for HEAD) or [hackage](http://hackage.haskell.org/package/lens) for the current and preceding releases.
0c4742e @ekmett added the big uml diagram to the readme
authored
13
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
14 Field Guide
15 -----------
a23571c @ekmett Refactored 'at' and 'contains' into 'Control.Lens.IndexedLens'
authored
16
dfc447c @ekmett get a better link for the README
authored
17 [![Lens Hierarchy](https://raw.githubusercontent.com/wiki/ekmett/lens/images/Hierarchy.png)](https://creately.com/diagram/h5nyo9ne1/QZ9UBOtw4AJWtmAKYK3wT8Mm1HM%3D)
18
a23571c @ekmett Refactored 'at' and 'contains' into 'Control.Lens.IndexedLens'
authored
19
e409f0e @ekmett lots of examples
authored
20 Examples
21 --------
9af3f66 @ekmett metadata
authored
22
4899c60 @ekmett see wiki
authored
23 (See [`wiki/Examples`](https://github.com/ekmett/lens/wiki/Examples))
24
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
25 First, import `Control.Lens`.
26
27 ```haskell
28 ghci> import Control.Lens
29 ```
30
31 Now, you can read from lenses
32
33 ```haskell
34 ghci> ("hello","world")^._2
35 "world"
36 ```
37
38 and you can write to lenses.
39
40 ```haskell
41 ghci> set _2 42 ("hello","world")
42 ("hello",42)
43 ```
44
45 Composing lenses for reading (or writing) goes in the order an imperative programmer would expect, and just uses `(.)` from the `Prelude`.
e409f0e @ekmett lots of examples
authored
46
47 ```haskell
48 ghci> ("hello",("world","!!!"))^._2._1
49 "world"
50 ```
51
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
52 ```haskell
f9901b5 @ekmett fixed set example (copied from @emwap's edit to the wiki)
authored
53 ghci> set (_2._1) 42 ("hello",("world","!!!"))
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
54 ("hello",(42,"!!!"))
55 ```
e409f0e @ekmett lots of examples
authored
56
9578fdd @basdirks Update README.markdown
basdirks authored
57 You can make a `Getter` out of a pure function with `to`.
e409f0e @ekmett lots of examples
authored
58
59 ```haskell
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
60 ghci> "hello"^.to length
e409f0e @ekmett lots of examples
authored
61 5
62 ```
63
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
64 You can easily compose a `Getter` with a `Lens` just using `(.)`. No explicit coercion is necessary.
65
66 ```haskell
67 ghci> ("hello",("world","!!!"))^._2._2.to length
68 3
69 ```
70
71 As we saw above, you can write to lenses and these writes can change the type of the container. `(.~)` is an infix alias for `set`.
e409f0e @ekmett lots of examples
authored
72
73 ```haskell
74 ghci> _1 .~ "hello" $ ((),"world")
c120a4b @pasberth fixed an example for (.~) in README.markdown
pasberth authored
75 ("hello","world")
e409f0e @ekmett lots of examples
authored
76 ```
77
34036bc @ekmett prefix, not infix
authored
78 Conversely `view`, can be used as a prefix alias for `(^.)`.
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
79
80 ```haskell
81 ghci> view _2 (10,20)
82 20
83 ```
84
85 There are a large number of other lens variants provided by the library, in particular a `Traversal` generalizes `traverse` from `Data.Traversable`.
86
819ec49 @ekmett :
authored
87 We'll come back to those later, but continuing with just lenses:
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
88
4255093 @ekmett moar examples
authored
89 You can let the library automatically derive lenses for fields of your data type
90
91 ```haskell
92 data Foo a = Foo { _bar :: Int, _baz :: Int, _quux :: a }
93 makeLenses ''Foo
94 ```
95
96 This will automatically generate the following lenses:
97
98 ```haskell
aad9098 @ekmett Stopped using Simple in the README
authored
99 bar, baz :: Lens' (Foo a) Int
4255093 @ekmett moar examples
authored
100 quux :: Lens (Foo a) (Foo b) a b
101 ```
102
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
103 A `Lens` takes 4 parameters because it can change the types of the whole when you change the type of the part.
104
aad9098 @ekmett Stopped using Simple in the README
authored
105 Often you won't need this flexibility, a `Lens'` takes 2 parameters, and can be used directly as a `Lens`.
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
106
e409f0e @ekmett lots of examples
authored
107 You can also write to setters that target multiple parts of a structure, or their composition with other
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
108 lenses or setters. The canonical example of a setter is 'mapped':
109
110 ```haskell
111 mapped :: Functor f => Setter (f a) (f b) a b
112 ```
113
114 `over` is then analogous to `fmap`, but parameterized on the Setter.
115
116 ```haskell
117 ghci> fmap succ [1,2,3]
118 [2,3,4]
119 ghci> over mapped succ [1,2,3]
120 [2,3,4]
121 ```
122
123 The benefit is that you can use any `Lens` as a `Setter`, and the composition of setters with other setters or lenses using `(.)` yields
124 a `Setter`.
125
126 ```haskell
127 ghci> over (mapped._2) succ [(1,2),(3,4)]
128 [(1,3),(3,5)]
129 ```
130
131 `(%~)` is an infix alias for 'over', and the precedence lets you avoid swimming in parentheses:
e409f0e @ekmett lots of examples
authored
132
133 ```haskell
134 ghci> _1.mapped._2.mapped %~ succ $ ([(42, "hello")],"world")
135 ([(42, "ifmmp")],"world")
136 ```
137
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
138 There are a number of combinators that resemble the `+=`, `*=`, etc. operators from C/C++ for working with the monad transformers.
139
140 There are `+~`, `*~`, etc. analogues to those combinators that work functionally, returning the modified version of the structure.
141
e409f0e @ekmett lots of examples
authored
142 ```haskell
143 ghci> both *~ 2 $ (1,2)
144 (2,4)
145 ```
146
147 There are combinators for manipulating the current state in a state monad as well
148
149 ```haskell
150 fresh :: MonadState Int m => m Int
151 fresh = id <+= 1
152 ```
153
154 Anything you know how to do with a `Foldable` container, you can do with a `Fold`
155
156 ```haskell
157 ghci> :m + Data.Char Data.Text.Lens
158 ghci> allOf (folded.text) isLower ["hello"^.packed, "goodbye"^.packed]
159 True
160 ```
161
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
162 You can also use this for generic programming. Combinators are included that are based on Neil Mitchell's `uniplate`, but which
163 have been generalized to work on or as lenses, folds, and traversals.
e409f0e @ekmett lots of examples
authored
164
165 ```haskell
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
166 ghci> :m + Data.Data.Lens
167 ghci> anyOf biplate (=="world") ("hello",(),[(2::Int,"world")])
e409f0e @ekmett lots of examples
authored
168 True
169 ```
170
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
171 As alluded to above, anything you know how to do with a `Traversable` you can do with a `Traversal`.
e409f0e @ekmett lots of examples
authored
172
173 ```haskell
4ad5dda @ekmett ]
authored
174 ghci> mapMOf (traverse._2) (\xs -> length xs <$ putStrLn xs) [(42,"hello"),(56,"world")]
e409f0e @ekmett lots of examples
authored
175 "hello"
176 "world"
177 [(42,5),(56,5)]
178 ```
179
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
180 Moreover, many of the lenses supplied are actually isomorphisms, that means you can use them directly as a lens or getter:
e409f0e @ekmett lots of examples
authored
181
182 ```haskell
183 ghci> let hello = "hello"^.packed
184 "hello"
185 ghci> :t hello
186 hello :: Text
187 ```
188
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
189 but you can also flip them around and use them as a lens the other way with `from`!
e409f0e @ekmett lots of examples
authored
190
191 ```haskell
192 ghci> hello^.from packed.to length
193 5
194 ```
c5c8e5f @ekmett repository initialized
authored
195
4255093 @ekmett moar examples
authored
196 You can automatically derive isomorphisms for your own newtypes with `makeIso`. e.g.
197
198 ```haskell
199 newtype Neither a b = Neither { _nor :: Either a b } deriving (Show)
200 makeIso ''Neither
201 ```
202
203 will automatically derive
204
205 ```haskell
206 neither :: Iso (Neither a b) (Neither c d) (Either a b) (Either c d)
207 nor :: Iso (Either a b) (Either c d) (Neither a b) (Neither c d)
208 ```
209
210 such that
211
212 ```haskell
213 from neither = nor
214 from nor = neither
215 neither.nor = id
216 nor.neither = id
217 ```
218
08d2801 @ekmett linking madness
authored
219 There is also a fully operational, but simple game of [Pong](https://github.com/ekmett/lens/blob/master/examples/Pong.hs) in the [examples/](https://github.com/ekmett/lens/blob/master/examples/) folder.
220
f752511 @ekmett Gave the README examples a gentler learning curve.
authored
221 There are also a couple of hundred examples distributed throughout the haddock documentation.
68b7e35 @ekmett shuffled docs
authored
222
f149ab8 @ekmett Operators
authored
223 Operators
224 =========
225
4899c60 @ekmett see wiki
authored
226 (See [`wiki/Operators`](https://github.com/ekmett/lens/wiki/Operators))
f7858ae @ekmett maintenance notes
authored
227
f149ab8 @ekmett Operators
authored
228 <table>
229 <thead>
230 <tr>
231 <th>Combinator(s)</th>
232 <th>w/ Result</th>
233 <th>Stateful</th>
234 <th>w/ Result</th>
235 <th>Notes</th>
236 </tr>
237 </thead>
238 <tbody>
239 <tr><th colspan=5><a href="http://ekmett.github.com/lens/Control-Lens.html">Control.Lens</a></th></tr>
240 <tr>
241 <td><a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:view"><code>view</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:views"><code>views</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:-94-."><code>^.</code></a></td>
242 <td/>
243 <td><a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:use"><code>use</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:uses"><code>uses</code></a></td>
244 <td/>
3802a39 @fumieval s/query/view/
fumieval authored
245 <td>View target(s). <a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:view"><code>view</code></a> works like <a href="http://ekmett.github.com/lens/Control-Lens-Getter.html#v:use"><code>use</code></a> over a <code>MonadReader</code></td>
f149ab8 @ekmett Operators
authored
246 </tr>
247 <tr>
248 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:set"><code>set</code></a>, <a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:.-126-"><code>.~</code></a></td>
249 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-60-.-126-"><code>&lt;.~</code></a></td>
250 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:.-61-"><code>.=</code></a></td>
251 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:assign"><code>assign</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-60-.-61-"><code>&lt;.=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
252 <td>Replace target(s). <a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--60-.-126-"><code>&lt;&lt;.~</code></a> and
253 <a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--60-.-61-"><code>&lt;&lt;.=</code></a>
f149ab8 @ekmett Operators
authored
254 return the old value</td>
255 </tr>
256 <tr>
257 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:over"><code>over</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:mapOf"><code>mapOf</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-37--126-"><code>%~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
258 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--37--126-"><code>&lt;%~</code></td>
f149ab8 @ekmett Operators
authored
259 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-37--61-"><code>%=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
260 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--37--61-"><code>&lt;%=</code></td>
261 <td>Update target(s). <a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--60--37--126-"><code>&lt;&lt;%~</code></a> and
262 <a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--60--37--61-"><code>&lt;&lt;%=</code></a>
f149ab8 @ekmett Operators
authored
263 return the old value</td>
264 </tr>
265 <tr>
3032b55 @Taneb Fixed links in README
Taneb authored
266 <td><code>id</code>,<a href="http://ekmett.github.com/lens/Control-Lens-Traversal.html#v:traverseOf"><code>traverseOf</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-37--37--126-"><code>%%~</code></a></td>
f149ab8 @ekmett Operators
authored
267 <td/>
3032b55 @Taneb Fixed links in README
Taneb authored
268 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-37--37--61-"><code>%%=</code></a></td>
f149ab8 @ekmett Operators
authored
269 <td/>
53319ab @ion1 Some further spellchecking
ion1 authored
270 <td>Update target(s) with an <code>Applicative</code> or auxiliary result</td>
f149ab8 @ekmett Operators
authored
271 </tr>
272 <tr>
273 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-43--126-"><code>+~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
274 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--43--126-"><code>&lt;+~</code></td>
f149ab8 @ekmett Operators
authored
275 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-43--61-"><code>+=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
276 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--43--61-"><code>&lt;+=</code></td>
f149ab8 @ekmett Operators
authored
277 <td>Add to target(s)</td>
278 </tr>
279 <tr>
280 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-45--126-"><code>-~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
281 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--45--126-"><code>&lt;-~</code></td>
f149ab8 @ekmett Operators
authored
282 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-45--61-"><code>-=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
283 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--45--61-"><code>&lt;-=</code></td>
f149ab8 @ekmett Operators
authored
284 <td>Subtract from target(s)</td>
285 </tr>
286 <tr>
287 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-42--126-"><code>*~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
288 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--42--126-"><code>&lt;*~</code></td>
f149ab8 @ekmett Operators
authored
289 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-42--61-"><code>*=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
290 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--42--61-"><code>&lt;*=</code></td>
f149ab8 @ekmett Operators
authored
291 <td>Multiply target(s)</td>
292 </tr>
293 <tr>
294 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-47--47--126-"><code>//~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
295 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--47--47--126-"><code>&lt;//~</code></td>
f149ab8 @ekmett Operators
authored
296 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-47--47--61-"><code>//=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
297 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--47--47--61-"><code>&lt;//=</code></td>
f149ab8 @ekmett Operators
authored
298 <td>Divide target(s)</td>
299 </tr>
300 <tr>
301 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-94--126-"><code>^~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
302 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--94--126-"><code>&lt;^~</code></td>
f149ab8 @ekmett Operators
authored
303 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-94--61-"><code>^=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
304 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--94--61-"><code>&lt;^=</code></td>
f149ab8 @ekmett Operators
authored
305 <td>Raise target(s) to a non-negative <code>Integral</code> power</td>
306 </tr>
307 <tr>
308 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-94--94--126-"><code>^^~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
309 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--94--94--126-"><code>&lt;^^~</code></td>
f149ab8 @ekmett Operators
authored
310 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-94--94--61-"><code>^^=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
311 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--94--94--61-"><code>&lt;^^=</code></td>
f149ab8 @ekmett Operators
authored
312 <td>Raise target(s) to an <code>Integral</code> power</td>
313 </tr>
314 <tr>
315 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-42--42--126-"><code>**~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
316 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--42--42--126-"><code>&lt;**~</code></td>
f149ab8 @ekmett Operators
authored
317 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-42--42--61-"><code>**=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
318 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--42--42--61-"><code>&lt;**=</code></td>
f149ab8 @ekmett Operators
authored
319 <td>Raise target(s) to an arbitrary power</td>
320 </tr>
321 <tr>
322 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-124--124--126-"><code>||~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
323 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--124--124--126-"><code>&lt;||~</code></td>
f149ab8 @ekmett Operators
authored
324 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-124--124--61-"><code>||=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
325 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--124--124--61-"><code>&lt;||=</code></td>
f149ab8 @ekmett Operators
authored
326 <td>Logically or target(s)</td>
327 </tr>
328 <tr>
329 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-38--38--126-"><code>&amp;&amp;~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
330 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--38--38--126-"><code>&lt;&amp;&amp;~</code></td>
f149ab8 @ekmett Operators
authored
331 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-38--38--61-"><code>&amp;&amp;=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
332 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--38--38--61-"><code>&lt;&amp;&amp;=</code></td>
f149ab8 @ekmett Operators
authored
333 <td>Logically and target(s)</td>
334 </tr>
335 <tr>
45625db @Taneb Updated Readme
Taneb authored
336 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-60--62--126-"><code>&lt;&gt;~</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
337 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--60--62--126-"><code>&lt;&lt;&gt;~</code></td>
45625db @Taneb Updated Readme
Taneb authored
338 <td><a href="http://ekmett.github.com/lens/Control-Lens-Setter.html#v:-60--62--61-"><code>&lt;&gt;=</code></a></td>
3032b55 @Taneb Fixed links in README
Taneb authored
339 <td><a href="http://ekmett.github.com/lens/Control-Lens-Lens.html#v:-60--60--62--61-"><code>&lt;&lt;&gt;=</code></td>
45625db @Taneb Updated Readme
Taneb authored
340 <td><code>mappend</code> to the target monoidal value(s)</td>
341 </tr>
342 <tr>
f149ab8 @ekmett Operators
authored
343 <td><a href="http://ekmett.github.com/lens/Control-Lens-Fold.html#v:headOf"><code>headOf</code>,<a href="http://ekmett.github.com/lens/Control-Lens-Fold.html#v:-94--63-"><code>^?</code></a></td>
344 <td/><td/><td/>
345 <td>Return <code>Just</code> the first target or <code>Nothing</code></td>
346 </tr>
347 <tr>
348 <td><a href="http://ekmett.github.com/lens/Control-Lens-Fold.html#v:toListOf"><code>toListOf</code>,<a href="http://ekmett.github.com/lens/Control-Lens-Fold.html#v:-94-.."><code>^..</code></a></td>
349 <td/><td/><td/>
350 <td>Return a list of the target(s)</td>
351 </tr>
352 <tr><th colspan=5><a href="http://ekmett.github.com/lens/Control-Lens.html">Control.Lens</a> (Indexed)</th></tr>
353 <tr>
354 <td><a href="http://ekmett.github.com/lens/Control-Lens-IndexedSetter.html#v:iover"><code>iover</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-IndexedSetter.html#v:imapOf"><code>imapOf</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-IndexedSetter.html#v:-37--64--126-"><code>%@~</code></a></td>
355 <td><a href="http://ekmett.github.com/lens/Control-Lens-IndexedLens.html#v:-60--37--64--126-"><code>&lt;%@~</code></td>
356 <td><a href=http://ekmett.github.com/lens/Control-Lens-IndexedSetter.html#v:-37--64--126-"><code>%@=</code></a></td>
357 <td><a href="http://ekmett.github.com/lens/Control-Lens-IndexedLens.html#v:-60--37--64--61-"><code>&lt;%@=</code></td>
358 <td>Update target(s) with access to the index.</td>
359 </tr>
360 <tr>
361 <td><a href="http://ekmett.github.com/lens/Control-Lens-Indexed.html#v:withIndex"><code>withIndex</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-IndexedTraversal.html#v:itraverseOf"><code>itraverseOf</code></a>,<a href="http://ekmett.github.com/lens/Control-Lens-IndexedLens.html#v:-37--37--64--126-"><code>%%@~</code></a></td>
362 <td/>
363 <td><a href="http://ekmett.github.com/lens/Control-Lens-IndexedLens.html#v:-37--37--64--61-"><code>%%@=</code></a></td>
364 <td/>
53319ab @ion1 Some further spellchecking
ion1 authored
365 <td>Update target(s) with an <code>Applicative</code> or auxiliary result with access to the index.</td>
f149ab8 @ekmett Operators
authored
366 </tr>
367 <tr><th colspan=5><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html">Data.Bits.Lens</a></th></tr>
368 <tr>
c13cffd @ekmett operator cleanup
authored
369 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-124--126-"><code>.|.~</code></a></td>
370 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-60--124--126-"><code>&lt;.|.~</code></td>
371 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-124--61-"><code>.|.=</code></a></td>
372 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-60--124--61-"><code>&lt;.|.=</code></td>
f149ab8 @ekmett Operators
authored
373 <td>Bitwise or target(s)</td>
374 </tr>
375 <tr>
c13cffd @ekmett operator cleanup
authored
376 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-38--126-"><code>.&amp;.~</code></a></td>
377 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-60--38--126-"><code>&lt;.&amp;.~</code></td>
378 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-38--61-"><code>.&amp;.=</code></a></td>
379 <td><a href="http://ekmett.github.com/lens/Data-Bits-Lens.html#v:-60--38--61-"><code>&lt;.&amp;.=</code></td>
f149ab8 @ekmett Operators
authored
380 <td>Bitwise and target(s)</td>
381 </tr>
382 <tr><th colspan=5><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html">System.FilePath.Lens</a></th></tr>
383 <tr>
384 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60--47--62--126-"><code>&lt;/&gt;~</code></a></td>
385 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60--60--47--62--126-"><code>&lt;&lt;/&gt;~</code></td>
386 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60--47--62--61-"><code>&lt;/&gt;=</code></a></td>
387 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60--60--47--62--61-"><code>&lt;&lt;/&gt;=</code></td>
388 <td>Append a relative path to a <code>FilePath</code></td>
389 </tr>
390 <tr>
391 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60-.-62--126-"><code>&lt;.&gt;~</code></a></td>
392 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60--60-.-62--126-"><code>&lt;&lt;.&gt;~</code></td>
393 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60-.-62--61-"><code>&lt;.&gt;=</code></a></td>
394 <td><a href="http://ekmett.github.com/lens/System-FilePath-Lens.html#v:-60--60-.-62--61-"><code>&lt;&lt;.&gt;=</code></td>
395 <td>Append a file extension to a <code>FilePath</code></td>
396 </tr>
397 </tbody>
398 </table>
399
45625db @Taneb Updated Readme
Taneb authored
400
c5c8e5f @ekmett repository initialized
authored
401 Contact Information
402 -------------------
403
404 Contributions and bug reports are welcome!
405
406 Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.
407
408 -Edward Kmett
Something went wrong with that request. Please try again.