-
Notifications
You must be signed in to change notification settings - Fork 272
/
Control-Lens-IndexedFold.html
475 lines (475 loc) · 85.6 KB
/
Control-Lens-IndexedFold.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<!-- Generated by HsColour, http://code.haskell.org/~malcolm/hscolour/ -->
<title>src/Control/Lens/IndexedFold.hs</title>
<link type='text/css' rel='stylesheet' href='hscolour.css' />
</head>
<body>
<pre><a name="line-1"></a><span class='hs-comment'>{-# LANGUAGE MagicHash #-}</span>
<a name="line-2"></a><span class='hs-comment'>{-# LANGUAGE Rank2Types #-}</span>
<a name="line-3"></a><span class='hs-comment'>{-# LANGUAGE MultiParamTypeClasses #-}</span>
<a name="line-4"></a><span class='hs-comment'>{-# LANGUAGE FlexibleInstances #-}</span>
<a name="line-5"></a><span class='hs-comment'>{-# LANGUAGE TypeFamilies #-}</span>
<a name="line-6"></a><span class='hs-comment'>{-# LANGUAGE FlexibleContexts #-}</span>
<a name="line-7"></a><span class='hs-comment'>-----------------------------------------------------------------------------</span>
<a name="line-8"></a><span class='hs-comment'>-- |</span>
<a name="line-9"></a><span class='hs-comment'>-- Module : Control.Lens.IndexedFold</span>
<a name="line-10"></a><span class='hs-comment'>-- Copyright : (C) 2012 Edward Kmett</span>
<a name="line-11"></a><span class='hs-comment'>-- License : BSD-style (see the file LICENSE)</span>
<a name="line-12"></a><span class='hs-comment'>-- Maintainer : Edward Kmett <ekmett@gmail.com></span>
<a name="line-13"></a><span class='hs-comment'>-- Stability : provisional</span>
<a name="line-14"></a><span class='hs-comment'>-- Portability : rank 2 types, MPTCs, TFs, flexible</span>
<a name="line-15"></a><span class='hs-comment'>--</span>
<a name="line-16"></a><span class='hs-comment'>----------------------------------------------------------------------------</span>
<a name="line-17"></a><span class='hs-keyword'>module</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>IndexedFold</span>
<a name="line-18"></a> <span class='hs-layout'>(</span>
<a name="line-19"></a> <span class='hs-comment'>-- * Indexed Folds</span>
<a name="line-20"></a> <span class='hs-conid'>IndexedFold</span>
<a name="line-21"></a>
<a name="line-22"></a> <span class='hs-comment'>-- * Consuming Indexed Folds</span>
<a name="line-23"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldMapOf</span>
<a name="line-24"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldrOf</span>
<a name="line-25"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldlOf</span>
<a name="line-26"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ianyOf</span>
<a name="line-27"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>iallOf</span>
<a name="line-28"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>itraverseOf_</span>
<a name="line-29"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>iforOf_</span>
<a name="line-30"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>imapMOf_</span>
<a name="line-31"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>iforMOf_</span>
<a name="line-32"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>iconcatMapOf</span>
<a name="line-33"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifindOf</span>
<a name="line-34"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldrOf'</span>
<a name="line-35"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldlOf'</span>
<a name="line-36"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldrMOf</span>
<a name="line-37"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifoldlMOf</span>
<a name="line-38"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>itoListOf</span>
<a name="line-39"></a>
<a name="line-40"></a> <span class='hs-comment'>-- * Converting to Folds</span>
<a name="line-41"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>withIndicesOf</span>
<a name="line-42"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>indicesOf</span>
<a name="line-43"></a>
<a name="line-44"></a> <span class='hs-comment'>-- * Building Indexed Folds</span>
<a name="line-45"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ifiltering</span>
<a name="line-46"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>ibackwards</span>
<a name="line-47"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>itakingWhile</span>
<a name="line-48"></a> <span class='hs-layout'>,</span> <span class='hs-varid'>idroppingWhile</span>
<a name="line-49"></a>
<a name="line-50"></a> <span class='hs-comment'>-- * Storing Indexed Folds</span>
<a name="line-51"></a> <span class='hs-layout'>,</span> <span class='hs-conid'>ReifiedIndexedFold</span><span class='hs-layout'>(</span><span class='hs-keyglyph'>..</span><span class='hs-layout'>)</span>
<a name="line-52"></a> <span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-53"></a>
<a name="line-54"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Applicative</span>
<a name="line-55"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Applicative</span><span class='hs-varop'>.</span><span class='hs-conid'>Backwards</span>
<a name="line-56"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Classes</span>
<a name="line-57"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Indexed</span>
<a name="line-58"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>IndexedGetter</span>
<a name="line-59"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span>
<a name="line-60"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Internal</span><span class='hs-varop'>.</span><span class='hs-conid'>Combinators</span>
<a name="line-61"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Lens</span><span class='hs-varop'>.</span><span class='hs-conid'>Type</span>
<a name="line-62"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Control</span><span class='hs-varop'>.</span><span class='hs-conid'>Monad</span>
<a name="line-63"></a><span class='hs-keyword'>import</span> <span class='hs-conid'>Data</span><span class='hs-varop'>.</span><span class='hs-conid'>Monoid</span>
<a name="line-64"></a>
<a name="line-65"></a><span class='hs-comment'>------------------------------------------------------------------------------</span>
<a name="line-66"></a><span class='hs-comment'>-- Indexed Folds</span>
<a name="line-67"></a><span class='hs-comment'>------------------------------------------------------------------------------</span>
<a name="line-68"></a>
<a name="line-69"></a><a name="IndexedFold"></a><span class='hs-comment'>-- | Every 'IndexedFold' is a valid 'Control.Lens.Fold.Fold'.</span>
<a name="line-70"></a><a name="IndexedFold"></a><span class='hs-keyword'>type</span> <span class='hs-conid'>IndexedFold</span> <span class='hs-varid'>i</span> <span class='hs-varid'>s</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-keyword'>forall</span> <span class='hs-varid'>k</span> <span class='hs-varid'>f</span><span class='hs-varop'>.</span>
<a name="line-71"></a> <span class='hs-layout'>(</span><span class='hs-conid'>Indexable</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span><span class='hs-layout'>,</span> <span class='hs-conid'>Applicative</span> <span class='hs-varid'>f</span><span class='hs-layout'>,</span> <span class='hs-conid'>Gettable</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span>
<a name="line-72"></a>
<a name="line-73"></a><a name="ifoldMapOf"></a><span class='hs-comment'>-- |</span>
<a name="line-74"></a><span class='hs-comment'>-- Fold an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' by mapping indices and values to an arbitrary 'Monoid' with access</span>
<a name="line-75"></a><span class='hs-comment'>-- to the @i@.</span>
<a name="line-76"></a><span class='hs-comment'>--</span>
<a name="line-77"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldMapOf' is more flexible in what it accepts.</span>
<a name="line-78"></a><span class='hs-comment'>--</span>
<a name="line-79"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldMapOf' l ≡ 'ifoldMapOf' l '.' 'const'@</span>
<a name="line-80"></a><span class='hs-comment'>--</span>
<a name="line-81"></a><span class='hs-comment'>-- @</span>
<a name="line-82"></a><span class='hs-comment'>-- 'ifoldMapOf' :: 'IndexedGetter' i a s -> (i -> s -> m) -> a -> m</span>
<a name="line-83"></a><span class='hs-comment'>-- 'ifoldMapOf' :: 'Monoid' m => 'IndexedFold' i a s -> (i -> s -> m) -> a -> m</span>
<a name="line-84"></a><span class='hs-comment'>-- 'ifoldMapOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i a s -> (i -> s -> m) -> a -> m</span>
<a name="line-85"></a><span class='hs-comment'>-- 'ifoldMapOf' :: 'Monoid' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i a s -> (i -> s -> m) -> a -> m</span>
<a name="line-86"></a><span class='hs-comment'>-- @</span>
<a name="line-87"></a><span class='hs-definition'>ifoldMapOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-varid'>m</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span>
<a name="line-88"></a><span class='hs-definition'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>runAccessor</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>withIndex</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>accessor</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-89"></a><span class='hs-comment'>{-# INLINE ifoldMapOf #-}</span>
<a name="line-90"></a>
<a name="line-91"></a><a name="ifoldrOf"></a><span class='hs-comment'>-- |</span>
<a name="line-92"></a><span class='hs-comment'>-- Right-associative fold of parts of a structure that are viewed through an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with</span>
<a name="line-93"></a><span class='hs-comment'>-- access to the @i@.</span>
<a name="line-94"></a><span class='hs-comment'>--</span>
<a name="line-95"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldrOf' is more flexible in what it accepts.</span>
<a name="line-96"></a><span class='hs-comment'>--</span>
<a name="line-97"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldrOf' l ≡ 'ifoldrOf' l '.' 'const'@</span>
<a name="line-98"></a><span class='hs-comment'>--</span>
<a name="line-99"></a><span class='hs-comment'>-- @</span>
<a name="line-100"></a><span class='hs-comment'>-- 'ifoldrOf' :: 'IndexedGetter' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-101"></a><span class='hs-comment'>-- 'ifoldrOf' :: 'IndexedFold' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-102"></a><span class='hs-comment'>-- 'ifoldrOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-103"></a><span class='hs-comment'>-- 'ifoldrOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-104"></a><span class='hs-comment'>-- @</span>
<a name="line-105"></a><span class='hs-definition'>ifoldrOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span>
<a name="line-106"></a><span class='hs-definition'>ifoldrOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-varid'>z</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>appEndo</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>endo</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span> <span class='hs-varid'>z</span>
<a name="line-107"></a><span class='hs-comment'>{-# INLINE ifoldrOf #-}</span>
<a name="line-108"></a>
<a name="line-109"></a><a name="ifoldlOf"></a><span class='hs-comment'>-- |</span>
<a name="line-110"></a><span class='hs-comment'>-- Left-associative fold of the parts of a structure that are viewed through an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with</span>
<a name="line-111"></a><span class='hs-comment'>-- access to the @i@.</span>
<a name="line-112"></a><span class='hs-comment'>--</span>
<a name="line-113"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldlOf' is more flexible in what it accepts.</span>
<a name="line-114"></a><span class='hs-comment'>--</span>
<a name="line-115"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldlOf' l ≡ 'ifoldlOf' l '.' 'const'@</span>
<a name="line-116"></a><span class='hs-comment'>--</span>
<a name="line-117"></a><span class='hs-comment'>-- @</span>
<a name="line-118"></a><span class='hs-comment'>-- 'ifoldlOf' :: 'IndexedGetter' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-119"></a><span class='hs-comment'>-- 'ifoldlOf' :: 'IndexedFold' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-120"></a><span class='hs-comment'>-- 'ifoldlOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-121"></a><span class='hs-comment'>-- 'ifoldlOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-122"></a><span class='hs-comment'>-- @</span>
<a name="line-123"></a><span class='hs-definition'>ifoldlOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Dual</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span>
<a name="line-124"></a><span class='hs-definition'>ifoldlOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-varid'>z</span> <span class='hs-varid'>t</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>appEndo</span> <span class='hs-layout'>(</span><span class='hs-varid'>getDual</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>dual</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>endo</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>flip</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>z</span>
<a name="line-125"></a><span class='hs-comment'>{-# INLINE ifoldlOf #-}</span>
<a name="line-126"></a>
<a name="line-127"></a><a name="ianyOf"></a><span class='hs-comment'>-- |</span>
<a name="line-128"></a><span class='hs-comment'>-- Return whether or not any element viewed through an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal'</span>
<a name="line-129"></a><span class='hs-comment'>-- satisfy a predicate, with access to the @i@.</span>
<a name="line-130"></a><span class='hs-comment'>--</span>
<a name="line-131"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.anyOf' is more flexible in what it accepts.</span>
<a name="line-132"></a><span class='hs-comment'>--</span>
<a name="line-133"></a><span class='hs-comment'>-- @'Control.Lens.Fold.anyOf' l ≡ 'ianyOf' l '.' 'const'@</span>
<a name="line-134"></a><span class='hs-comment'>--</span>
<a name="line-135"></a><span class='hs-comment'>-- @</span>
<a name="line-136"></a><span class='hs-comment'>-- 'ianyOf' :: 'IndexedGetter' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-137"></a><span class='hs-comment'>-- 'ianyOf' :: 'IndexedFold' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-138"></a><span class='hs-comment'>-- 'ianyOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-139"></a><span class='hs-comment'>-- 'ianyOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-140"></a><span class='hs-comment'>-- @</span>
<a name="line-141"></a><span class='hs-definition'>ianyOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-conid'>Any</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span>
<a name="line-142"></a><span class='hs-definition'>ianyOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getAny</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>any</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-143"></a><span class='hs-comment'>{-# INLINE ianyOf #-}</span>
<a name="line-144"></a>
<a name="line-145"></a><a name="iallOf"></a><span class='hs-comment'>-- |</span>
<a name="line-146"></a><span class='hs-comment'>-- Return whether or not all elements viewed through an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal'</span>
<a name="line-147"></a><span class='hs-comment'>-- satisfy a predicate, with access to the @i@.</span>
<a name="line-148"></a><span class='hs-comment'>--</span>
<a name="line-149"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.allOf' is more flexible in what it accepts.</span>
<a name="line-150"></a><span class='hs-comment'>--</span>
<a name="line-151"></a><span class='hs-comment'>-- @'Control.Lens.Fold.allOf' l ≡ 'iallOf' l '.' 'const'@</span>
<a name="line-152"></a><span class='hs-comment'>--</span>
<a name="line-153"></a><span class='hs-comment'>-- @</span>
<a name="line-154"></a><span class='hs-comment'>-- 'iallOf' :: 'IndexedGetter' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-155"></a><span class='hs-comment'>-- 'iallOf' :: 'IndexedFold' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-156"></a><span class='hs-comment'>-- 'iallOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-157"></a><span class='hs-comment'>-- 'iallOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> 'Bool') -> s -> 'Bool'</span>
<a name="line-158"></a><span class='hs-comment'>-- @</span>
<a name="line-159"></a><span class='hs-definition'>iallOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-conid'>All</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span>
<a name="line-160"></a><span class='hs-definition'>iallOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getAll</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>all</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-161"></a><span class='hs-comment'>{-# INLINE iallOf #-}</span>
<a name="line-162"></a>
<a name="line-163"></a><a name="itraverseOf_"></a><span class='hs-comment'>-- |</span>
<a name="line-164"></a><span class='hs-comment'>-- Traverse the targets of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with access to the @i@, discarding the results.</span>
<a name="line-165"></a><span class='hs-comment'>--</span>
<a name="line-166"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.traverseOf_' is more flexible in what it accepts.</span>
<a name="line-167"></a><span class='hs-comment'>--</span>
<a name="line-168"></a><span class='hs-comment'>-- @'Control.Lens.Fold.traverseOf_' l ≡ 'itraverseOf' l '.' 'const'@</span>
<a name="line-169"></a><span class='hs-comment'>--</span>
<a name="line-170"></a><span class='hs-comment'>-- @</span>
<a name="line-171"></a><span class='hs-comment'>-- 'itraverseOf_' :: 'Functor' f => 'IndexedGetter' i s a -> (i -> a -> f r) -> s -> f ()</span>
<a name="line-172"></a><span class='hs-comment'>-- 'itraverseOf_' :: 'Applicative' f => 'IndexedFold' i s a -> (i -> a -> f r) -> s -> f ()</span>
<a name="line-173"></a><span class='hs-comment'>-- 'itraverseOf_' :: 'Functor' f => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> f r) -> s -> f ()</span>
<a name="line-174"></a><span class='hs-comment'>-- 'itraverseOf_' :: 'Applicative' f => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> f r) -> s -> f ()</span>
<a name="line-175"></a><span class='hs-comment'>-- @</span>
<a name="line-176"></a><span class='hs-definition'>itraverseOf_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Functor</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Traversed</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-conid'>()</span>
<a name="line-177"></a><span class='hs-definition'>itraverseOf_</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getTraversed</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>traversed</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>void</span> <span class='hs-varop'>.</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-178"></a><span class='hs-comment'>{-# INLINE itraverseOf_ #-}</span>
<a name="line-179"></a>
<a name="line-180"></a><a name="iforOf_"></a><span class='hs-comment'>-- |</span>
<a name="line-181"></a><span class='hs-comment'>-- Traverse the targets of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with access to the index, discarding the results</span>
<a name="line-182"></a><span class='hs-comment'>-- (with the arguments flipped).</span>
<a name="line-183"></a><span class='hs-comment'>--</span>
<a name="line-184"></a><span class='hs-comment'>-- @'iforOf_' ≡ 'flip' '.' 'itraverseOf_'@</span>
<a name="line-185"></a><span class='hs-comment'>--</span>
<a name="line-186"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.forOf_' is more flexible in what it accepts.</span>
<a name="line-187"></a><span class='hs-comment'>--</span>
<a name="line-188"></a><span class='hs-comment'>-- @'Control.Lens.Fold.forOf_' l a ≡ 'iforOf_' l a '.' 'const'@</span>
<a name="line-189"></a><span class='hs-comment'>--</span>
<a name="line-190"></a><span class='hs-comment'>-- @</span>
<a name="line-191"></a><span class='hs-comment'>-- 'iforOf_' :: 'Functor' f => 'IndexedGetter' i s a -> s -> (i -> a -> f r) -> f ()</span>
<a name="line-192"></a><span class='hs-comment'>-- 'iforOf_' :: 'Applicative' f => 'IndexedFold' i s a -> s -> (i -> a -> f r) -> f ()</span>
<a name="line-193"></a><span class='hs-comment'>-- 'iforOf_' :: 'Functor' f => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> s -> (i -> a -> f r) -> f ()</span>
<a name="line-194"></a><span class='hs-comment'>-- 'iforOf_' :: 'Applicative' f => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> s -> (i -> a -> f r) -> f ()</span>
<a name="line-195"></a><span class='hs-comment'>-- @</span>
<a name="line-196"></a><span class='hs-definition'>iforOf_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Functor</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Traversed</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-conid'>()</span>
<a name="line-197"></a><span class='hs-definition'>iforOf_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>flip</span> <span class='hs-varop'>.</span> <span class='hs-varid'>itraverseOf_</span>
<a name="line-198"></a><span class='hs-comment'>{-# INLINE iforOf_ #-}</span>
<a name="line-199"></a>
<a name="line-200"></a><a name="imapMOf_"></a><span class='hs-comment'>-- |</span>
<a name="line-201"></a><span class='hs-comment'>-- Run monadic actions for each target of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with access to the index,</span>
<a name="line-202"></a><span class='hs-comment'>-- discarding the results.</span>
<a name="line-203"></a><span class='hs-comment'>--</span>
<a name="line-204"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.mapMOf_' is more flexible in what it accepts.</span>
<a name="line-205"></a><span class='hs-comment'>--</span>
<a name="line-206"></a><span class='hs-comment'>-- @'Control.Lens.Fold.mapMOf_' l ≡ 'imapMOf' l '.' 'const'@</span>
<a name="line-207"></a><span class='hs-comment'>--</span>
<a name="line-208"></a><span class='hs-comment'>-- @</span>
<a name="line-209"></a><span class='hs-comment'>-- 'imapMOf_' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> a -> m r) -> s -> m ()</span>
<a name="line-210"></a><span class='hs-comment'>-- 'imapMOf_' :: 'Monad' m => 'IndexedFold' i s a -> (i -> a -> m r) -> s -> m ()</span>
<a name="line-211"></a><span class='hs-comment'>-- 'imapMOf_' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> m r) -> s -> m ()</span>
<a name="line-212"></a><span class='hs-comment'>-- 'imapMOf_' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> m r) -> s -> m ()</span>
<a name="line-213"></a><span class='hs-comment'>-- @</span>
<a name="line-214"></a><span class='hs-definition'>imapMOf_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Sequenced</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-conid'>()</span>
<a name="line-215"></a><span class='hs-definition'>imapMOf_</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getSequenced</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>sequenced</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>liftM</span> <span class='hs-varid'>skip</span> <span class='hs-varop'>.</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-216"></a><span class='hs-comment'>{-# INLINE imapMOf_ #-}</span>
<a name="line-217"></a>
<a name="line-218"></a><a name="skip"></a><span class='hs-definition'>skip</span> <span class='hs-keyglyph'>::</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>()</span>
<a name="line-219"></a><span class='hs-definition'>skip</span> <span class='hs-keyword'>_</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>()</span>
<a name="line-220"></a><span class='hs-comment'>{-# INLINE skip #-}</span>
<a name="line-221"></a>
<a name="line-222"></a><a name="iforMOf_"></a><span class='hs-comment'>-- |</span>
<a name="line-223"></a><span class='hs-comment'>-- Run monadic actions for each target of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal' with access to the index,</span>
<a name="line-224"></a><span class='hs-comment'>-- discarding the results (with the arguments flipped).</span>
<a name="line-225"></a><span class='hs-comment'>--</span>
<a name="line-226"></a><span class='hs-comment'>-- @'iforMOf_' ≡ 'flip' '.' 'imapMOf_'@</span>
<a name="line-227"></a><span class='hs-comment'>--</span>
<a name="line-228"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.forMOf_' is more flexible in what it accepts.</span>
<a name="line-229"></a><span class='hs-comment'>--</span>
<a name="line-230"></a><span class='hs-comment'>-- @'Control.Lens.Fold.forMOf_' l a ≡ 'iforMOf' l a '.' 'const'@</span>
<a name="line-231"></a><span class='hs-comment'>--</span>
<a name="line-232"></a><span class='hs-comment'>-- @</span>
<a name="line-233"></a><span class='hs-comment'>-- 'iforMOf_' :: 'Monad' m => 'IndexedGetter' i s a -> s -> (i -> a -> m r) -> m ()</span>
<a name="line-234"></a><span class='hs-comment'>-- 'iforMOf_' :: 'Monad' m => 'IndexedFold' i s a -> s -> (i -> a -> m r) -> m ()</span>
<a name="line-235"></a><span class='hs-comment'>-- 'iforMOf_' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> s -> (i -> a -> m r) -> m ()</span>
<a name="line-236"></a><span class='hs-comment'>-- 'iforMOf_' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> s -> (i -> a -> m r) -> m ()</span>
<a name="line-237"></a><span class='hs-comment'>-- @</span>
<a name="line-238"></a><span class='hs-definition'>iforMOf_</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Sequenced</span> <span class='hs-varid'>m</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-conid'>()</span>
<a name="line-239"></a><span class='hs-definition'>iforMOf_</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>flip</span> <span class='hs-varop'>.</span> <span class='hs-varid'>imapMOf_</span>
<a name="line-240"></a><span class='hs-comment'>{-# INLINE iforMOf_ #-}</span>
<a name="line-241"></a>
<a name="line-242"></a><a name="iconcatMapOf"></a><span class='hs-comment'>-- |</span>
<a name="line-243"></a><span class='hs-comment'>-- Concatenate the results of a function of the elements of an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal'</span>
<a name="line-244"></a><span class='hs-comment'>-- with access to the index.</span>
<a name="line-245"></a><span class='hs-comment'>--</span>
<a name="line-246"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.concatMapOf' is more flexible in what it accepts.</span>
<a name="line-247"></a><span class='hs-comment'>--</span>
<a name="line-248"></a><span class='hs-comment'>-- @</span>
<a name="line-249"></a><span class='hs-comment'>-- 'Control.Lens.Fold.concatMapOf' l ≡ 'iconcatMapOf' l '.' 'const'</span>
<a name="line-250"></a><span class='hs-comment'>-- 'iconcatMapOf' ≡ 'ifoldMapOf'</span>
<a name="line-251"></a><span class='hs-comment'>-- @</span>
<a name="line-252"></a><span class='hs-comment'>--</span>
<a name="line-253"></a><span class='hs-comment'>-- @</span>
<a name="line-254"></a><span class='hs-comment'>-- 'iconcatMapOf' :: 'IndexedGetter' i s a -> (i -> a -> [r]) -> s -> [r]</span>
<a name="line-255"></a><span class='hs-comment'>-- 'iconcatMapOf' :: 'IndexedFold' i s a -> (i -> a -> [r]) -> s -> [r]</span>
<a name="line-256"></a><span class='hs-comment'>-- 'iconcatMapOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> [r]) -> s -> [r]</span>
<a name="line-257"></a><span class='hs-comment'>-- 'iconcatMapOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> [r]) -> s -> [r]</span>
<a name="line-258"></a><span class='hs-comment'>-- @</span>
<a name="line-259"></a><span class='hs-definition'>iconcatMapOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>r</span><span class='hs-keyglyph'>]</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>r</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>r</span><span class='hs-keyglyph'>]</span>
<a name="line-260"></a><span class='hs-definition'>iconcatMapOf</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ifoldMapOf</span>
<a name="line-261"></a><span class='hs-comment'>{-# INLINE iconcatMapOf #-}</span>
<a name="line-262"></a>
<a name="line-263"></a><a name="ifindOf"></a><span class='hs-comment'>-- | The 'findOf' function takes an 'IndexedFold' or 'Control.Lens.IndexedTraversal.IndexedTraversal', a predicate that is also</span>
<a name="line-264"></a><span class='hs-comment'>-- supplied the index, a structure and returns the left-most element of the structure</span>
<a name="line-265"></a><span class='hs-comment'>-- matching the predicate, or 'Nothing' if there is no such element.</span>
<a name="line-266"></a><span class='hs-comment'>--</span>
<a name="line-267"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.findOf' is more flexible in what it accepts.</span>
<a name="line-268"></a><span class='hs-comment'>--</span>
<a name="line-269"></a><span class='hs-comment'>-- @'Control.Lens.Fold.findOf' l ≡ 'ifindOf' l '.' 'const'@</span>
<a name="line-270"></a><span class='hs-comment'>--</span>
<a name="line-271"></a><span class='hs-comment'>-- @</span>
<a name="line-272"></a><span class='hs-comment'>-- 'ifindOf' :: 'IndexedGetter' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)</span>
<a name="line-273"></a><span class='hs-comment'>-- 'ifindOf' :: 'IndexedFold' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)</span>
<a name="line-274"></a><span class='hs-comment'>-- 'ifindOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)</span>
<a name="line-275"></a><span class='hs-comment'>-- 'ifindOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' s a -> (i -> a -> 'Bool') -> s -> 'Maybe' (i, a)</span>
<a name="line-276"></a><span class='hs-comment'>-- @</span>
<a name="line-277"></a><span class='hs-definition'>ifindOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>First</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Maybe</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-278"></a><span class='hs-definition'>ifindOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>p</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>getFirst</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>ifoldMapOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>step</span><span class='hs-layout'>)</span> <span class='hs-keyword'>where</span>
<a name="line-279"></a> <span class='hs-varid'>step</span> <span class='hs-varid'>i</span> <span class='hs-varid'>a</span>
<a name="line-280"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>p</span> <span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>First</span> <span class='hs-varop'>$</span> <span class='hs-conid'>Just</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span>
<a name="line-281"></a> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>otherwise</span> <span class='hs-keyglyph'>=</span> <span class='hs-conid'>First</span> <span class='hs-conid'>Nothing</span>
<a name="line-282"></a><span class='hs-comment'>{-# INLINE ifindOf #-}</span>
<a name="line-283"></a>
<a name="line-284"></a><a name="ifoldrOf'"></a><span class='hs-comment'>-- | /Strictly/ fold right over the elements of a structure with an index.</span>
<a name="line-285"></a><span class='hs-comment'>--</span>
<a name="line-286"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldrOf'' is more flexible in what it accepts.</span>
<a name="line-287"></a><span class='hs-comment'>--</span>
<a name="line-288"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldrOf'' l ≡ 'ifoldrOf'' l '.' 'const'@</span>
<a name="line-289"></a><span class='hs-comment'>--</span>
<a name="line-290"></a><span class='hs-comment'>-- @</span>
<a name="line-291"></a><span class='hs-comment'>-- 'ifoldrOf'' :: 'IndexedGetter' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-292"></a><span class='hs-comment'>-- 'ifoldrOf'' :: 'IndexedFold' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-293"></a><span class='hs-comment'>-- 'ifoldrOf'' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-294"></a><span class='hs-comment'>-- 'ifoldrOf'' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> r -> r) -> r -> s -> r</span>
<a name="line-295"></a><span class='hs-comment'>-- @</span>
<a name="line-296"></a><span class='hs-definition'>ifoldrOf'</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Dual</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-layout'>(</span><span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span>
<a name="line-297"></a><span class='hs-definition'>ifoldrOf'</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-varid'>z0</span> <span class='hs-varid'>xs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ifoldlOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>id</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>z0</span>
<a name="line-298"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span> <span class='hs-varid'>x</span> <span class='hs-varid'>z</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>k</span> <span class='hs-varop'>$!</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>x</span> <span class='hs-varid'>z</span>
<a name="line-299"></a><span class='hs-comment'>{-# INLINE ifoldrOf' #-}</span>
<a name="line-300"></a>
<a name="line-301"></a><a name="ifoldlOf'"></a><span class='hs-comment'>-- | Fold over the elements of a structure with an index, associating to the left, but /strictly/.</span>
<a name="line-302"></a><span class='hs-comment'>--</span>
<a name="line-303"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldlOf'' is more flexible in what it accepts.</span>
<a name="line-304"></a><span class='hs-comment'>--</span>
<a name="line-305"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldlOf'' l ≡ 'ifoldlOf'' l '.' 'const'@</span>
<a name="line-306"></a><span class='hs-comment'>--</span>
<a name="line-307"></a><span class='hs-comment'>-- @</span>
<a name="line-308"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'IndexedGetter' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-309"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'IndexedFold' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-310"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-311"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> r -> a -> r) -> r -> s -> r</span>
<a name="line-312"></a><span class='hs-comment'>-- @</span>
<a name="line-313"></a><span class='hs-definition'>ifoldlOf'</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-layout'>(</span><span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span>
<a name="line-314"></a><span class='hs-definition'>ifoldlOf'</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-varid'>z0</span> <span class='hs-varid'>xs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ifoldrOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>id</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>z0</span>
<a name="line-315"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>i</span> <span class='hs-varid'>x</span> <span class='hs-varid'>k</span> <span class='hs-varid'>z</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>k</span> <span class='hs-varop'>$!</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>z</span> <span class='hs-varid'>x</span>
<a name="line-316"></a><span class='hs-comment'>{-# INLINE ifoldlOf' #-}</span>
<a name="line-317"></a>
<a name="line-318"></a><a name="ifoldrMOf"></a><span class='hs-comment'>-- | Monadic fold right over the elements of a structure with an index.</span>
<a name="line-319"></a><span class='hs-comment'>--</span>
<a name="line-320"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldrMOf' is more flexible in what it accepts.</span>
<a name="line-321"></a><span class='hs-comment'>--</span>
<a name="line-322"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldrMOf' l ≡ 'ifoldrMOf' l '.' 'const'@</span>
<a name="line-323"></a><span class='hs-comment'>--</span>
<a name="line-324"></a><span class='hs-comment'>-- @</span>
<a name="line-325"></a><span class='hs-comment'>-- 'ifoldrMOf' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> a -> r -> m r) -> r -> s -> r</span>
<a name="line-326"></a><span class='hs-comment'>-- 'ifoldrMOf' :: 'Monad' m => 'IndexedFold' i s a -> (i -> a -> r -> m r) -> r -> s -> r</span>
<a name="line-327"></a><span class='hs-comment'>-- 'ifoldrMOf' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> a -> r -> m r) -> r -> s -> r</span>
<a name="line-328"></a><span class='hs-comment'>-- 'ifoldrMOf' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> a -> r -> m r) -> r -> s -> r</span>
<a name="line-329"></a><span class='hs-comment'>-- @</span>
<a name="line-330"></a><span class='hs-definition'>ifoldrMOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Dual</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-layout'>(</span><span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span>
<a name="line-331"></a><span class='hs-definition'>ifoldrMOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-varid'>z0</span> <span class='hs-varid'>xs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ifoldlOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>return</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>z0</span>
<a name="line-332"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span> <span class='hs-varid'>x</span> <span class='hs-varid'>z</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>x</span> <span class='hs-varid'>z</span> <span class='hs-varop'>>>=</span> <span class='hs-varid'>k</span>
<a name="line-333"></a><span class='hs-comment'>{-# INLINE ifoldrMOf #-}</span>
<a name="line-334"></a>
<a name="line-335"></a><a name="ifoldlMOf"></a><span class='hs-comment'>-- | Monadic fold over the elements of a structure with an index, associating to the left.</span>
<a name="line-336"></a><span class='hs-comment'>--</span>
<a name="line-337"></a><span class='hs-comment'>-- When you don't need access to the index then 'Control.Lens.Fold.foldlMOf' is more flexible in what it accepts.</span>
<a name="line-338"></a><span class='hs-comment'>--</span>
<a name="line-339"></a><span class='hs-comment'>-- @'Control.Lens.Fold.foldlMOf' l ≡ 'ifoldlMOf' l '.' 'const'@</span>
<a name="line-340"></a><span class='hs-comment'>--</span>
<a name="line-341"></a><span class='hs-comment'>-- @</span>
<a name="line-342"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'Monad' m => 'IndexedGetter' i s a -> (i -> r -> a -> m r) -> r -> s -> r</span>
<a name="line-343"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'Monad' m => 'IndexedFold' i s a -> (i -> r -> a -> m r) -> r -> s -> r</span>
<a name="line-344"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'Monad' m => 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> (i -> r -> a -> m r) -> r -> s -> r</span>
<a name="line-345"></a><span class='hs-comment'>-- 'ifoldlOf'' :: 'Monad' m => 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> (i -> r -> a -> m r) -> r -> s -> r</span>
<a name="line-346"></a><span class='hs-comment'>-- @</span>
<a name="line-347"></a><span class='hs-definition'>ifoldlMOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Monad</span> <span class='hs-varid'>m</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-layout'>(</span><span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>m</span> <span class='hs-varid'>r</span>
<a name="line-348"></a><span class='hs-definition'>ifoldlMOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-varid'>z0</span> <span class='hs-varid'>xs</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ifoldrOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>return</span> <span class='hs-varid'>xs</span> <span class='hs-varid'>z0</span>
<a name="line-349"></a> <span class='hs-keyword'>where</span> <span class='hs-varid'>f'</span> <span class='hs-varid'>i</span> <span class='hs-varid'>x</span> <span class='hs-varid'>k</span> <span class='hs-varid'>z</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>z</span> <span class='hs-varid'>x</span> <span class='hs-varop'>>>=</span> <span class='hs-varid'>k</span>
<a name="line-350"></a><span class='hs-comment'>{-# INLINE ifoldlMOf #-}</span>
<a name="line-351"></a>
<a name="line-352"></a><a name="itoListOf"></a><span class='hs-comment'>-- | Extract the key-value pairs from a structure.</span>
<a name="line-353"></a><span class='hs-comment'>--</span>
<a name="line-354"></a><span class='hs-comment'>-- When you don't need access to the indices in the result, then 'Control.Lens.Fold.toListOf' is more flexible in what it accepts.</span>
<a name="line-355"></a><span class='hs-comment'>--</span>
<a name="line-356"></a><span class='hs-comment'>-- @'Control.Lens.Fold.toListOf' l ≡ 'map' 'fst' '.' 'itoListOf' l@</span>
<a name="line-357"></a><span class='hs-comment'>--</span>
<a name="line-358"></a><span class='hs-comment'>-- @</span>
<a name="line-359"></a><span class='hs-comment'>-- 'itoListOf' :: 'IndexedGetter' i s a -> s -> [(i,a)]</span>
<a name="line-360"></a><span class='hs-comment'>-- 'itoListOf' :: 'IndexedFold' i s a -> s -> [(i,a)]</span>
<a name="line-361"></a><span class='hs-comment'>-- 'itoListOf' :: 'Control.Lens.IndexedLens.SimpleIndexedLens' i s a -> s -> [(i,a)]</span>
<a name="line-362"></a><span class='hs-comment'>-- 'itoListOf' :: 'Control.Lens.IndexedTraversal.SimpleIndexedTraversal' i s a -> s -> [(i,a)]</span>
<a name="line-363"></a><span class='hs-comment'>-- @</span>
<a name="line-364"></a><span class='hs-definition'>itoListOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span><span class='hs-varid'>a</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyglyph'>[</span><span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span><span class='hs-varid'>a</span><span class='hs-layout'>)</span><span class='hs-keyglyph'>]</span>
<a name="line-365"></a><span class='hs-definition'>itoListOf</span> <span class='hs-varid'>l</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>ifoldrOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span><span class='hs-varid'>a</span><span class='hs-layout'>)</span><span class='hs-conop'>:</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-conid'>[]</span>
<a name="line-366"></a><span class='hs-comment'>{-# INLINE itoListOf #-}</span>
<a name="line-367"></a>
<a name="line-368"></a><span class='hs-comment'>-------------------------------------------------------------------------------</span>
<a name="line-369"></a><span class='hs-comment'>-- Converting to Folds</span>
<a name="line-370"></a><span class='hs-comment'>-------------------------------------------------------------------------------</span>
<a name="line-371"></a>
<a name="line-372"></a><a name="withIndicesOf"></a><span class='hs-comment'>-- | Transform an indexed fold into a fold of both the indices and the values.</span>
<a name="line-373"></a><span class='hs-comment'>--</span>
<a name="line-374"></a><span class='hs-comment'>-- @</span>
<a name="line-375"></a><span class='hs-comment'>-- 'withIndicesOf' :: 'IndexedFold' i s a -> 'Fold' s (i, a)</span>
<a name="line-376"></a><span class='hs-comment'>-- 'withIndicesOf' :: 'SimpleIndexedLens' i s a -> 'Getter' s (i, a)</span>
<a name="line-377"></a><span class='hs-comment'>-- 'withIndicesOf' :: 'SimpleIndexedTraversal' i s a -> 'Fold' s (i, a)</span>
<a name="line-378"></a><span class='hs-comment'>-- @</span>
<a name="line-379"></a><span class='hs-comment'>--</span>
<a name="line-380"></a><span class='hs-comment'>-- All 'Fold' operations are safe, and comply with the laws. However:</span>
<a name="line-381"></a><span class='hs-comment'>--</span>
<a name="line-382"></a><span class='hs-comment'>-- Passing this an 'IndexedTraversal' will still allow many</span>
<a name="line-383"></a><span class='hs-comment'>-- 'Traversal' combinators to type check on the result, but the result</span>
<a name="line-384"></a><span class='hs-comment'>-- can only be legally traversed by operations that do not edit the indices.</span>
<a name="line-385"></a><span class='hs-comment'>--</span>
<a name="line-386"></a><span class='hs-comment'>-- @</span>
<a name="line-387"></a><span class='hs-comment'>-- 'withIndicesOf' :: 'IndexedTraversal' i s t a b -> 'Traversal' s t (i, a) (j, b)</span>
<a name="line-388"></a><span class='hs-comment'>-- @</span>
<a name="line-389"></a><span class='hs-comment'>--</span>
<a name="line-390"></a><span class='hs-comment'>-- Change made to the indices will be discarded.</span>
<a name="line-391"></a><span class='hs-definition'>withIndicesOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Functor</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Overloaded</span> <span class='hs-layout'>(</span><span class='hs-conid'>Indexed</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>b</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>LensLike</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>j</span><span class='hs-layout'>,</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span>
<a name="line-392"></a><span class='hs-definition'>withIndicesOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withIndex</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>snd</span> <span class='hs-varop'><$></span> <span class='hs-varid'>f</span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span><span class='hs-layout'>,</span><span class='hs-varid'>c</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-393"></a><span class='hs-comment'>{-# INLINE withIndicesOf #-}</span>
<a name="line-394"></a>
<a name="line-395"></a><a name="indicesOf"></a><span class='hs-comment'>-- | Transform an indexed fold into a fold of the indices.</span>
<a name="line-396"></a><span class='hs-comment'>--</span>
<a name="line-397"></a><span class='hs-comment'>-- @</span>
<a name="line-398"></a><span class='hs-comment'>-- 'indicesOf' :: 'IndexedFold' i s a -> 'Fold' s i</span>
<a name="line-399"></a><span class='hs-comment'>-- 'indicesOf' :: 'SimpleIndexedLens' i s a -> 'Getter' s i</span>
<a name="line-400"></a><span class='hs-comment'>-- 'indicesOf' :: 'SimpleIndexedTraversal' i s a -> 'Fold' s i</span>
<a name="line-401"></a><span class='hs-comment'>-- @</span>
<a name="line-402"></a><span class='hs-definition'>indicesOf</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Gettable</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Overloaded</span> <span class='hs-layout'>(</span><span class='hs-conid'>Indexed</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>LensLike</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span> <span class='hs-varid'>t</span> <span class='hs-varid'>i</span> <span class='hs-varid'>j</span>
<a name="line-403"></a><span class='hs-definition'>indicesOf</span> <span class='hs-varid'>l</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>withIndex</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-varid'>const</span> <span class='hs-varop'>.</span> <span class='hs-varid'>coerce</span> <span class='hs-varop'>.</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span>
<a name="line-404"></a><span class='hs-comment'>{-# INLINE indicesOf #-}</span>
<a name="line-405"></a>
<a name="line-406"></a><span class='hs-comment'>-------------------------------------------------------------------------------</span>
<a name="line-407"></a><span class='hs-comment'>-- Converting to Folds</span>
<a name="line-408"></a><span class='hs-comment'>-------------------------------------------------------------------------------</span>
<a name="line-409"></a>
<a name="line-410"></a><a name="ifiltering"></a><span class='hs-comment'>-- | Obtain an 'IndexedFold' by filtering an 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter', or 'IndexedFold'.</span>
<a name="line-411"></a><span class='hs-comment'>--</span>
<a name="line-412"></a><span class='hs-comment'>-- When passed an 'Control.Lens.IndexedTraversal.IndexedTraversal', sadly the result is /not/ a legal 'Control.Lens.IndexedTraversal.IndexedTraversal'.</span>
<a name="line-413"></a><span class='hs-comment'>--</span>
<a name="line-414"></a><span class='hs-comment'>-- See 'filtered' for a related counter-example.</span>
<a name="line-415"></a><span class='hs-definition'>ifiltering</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Applicative</span> <span class='hs-varid'>f</span><span class='hs-layout'>,</span> <span class='hs-conid'>Indexable</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-416"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span>
<a name="line-417"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Indexed</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
<a name="line-418"></a> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
<a name="line-419"></a><span class='hs-definition'>ifiltering</span> <span class='hs-varid'>p</span> <span class='hs-varid'>l</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>indexed</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>-></span>
<a name="line-420"></a> <span class='hs-varid'>withIndex</span> <span class='hs-varid'>l</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span> <span class='hs-varid'>i</span> <span class='hs-varid'>c</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>if</span> <span class='hs-varid'>p</span> <span class='hs-varid'>i</span> <span class='hs-varid'>c</span> <span class='hs-keyword'>then</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>c</span> <span class='hs-keyword'>else</span> <span class='hs-varid'>pure</span> <span class='hs-varid'>c</span>
<a name="line-421"></a><span class='hs-comment'>{-# INLINE ifiltering #-}</span>
<a name="line-422"></a>
<a name="line-423"></a><a name="ibackwards"></a><span class='hs-comment'>-- | Reverse the order of the elements of an 'IndexedFold' or</span>
<a name="line-424"></a><span class='hs-comment'>-- 'Control.Lens.IndexedTraversal.IndexedTraversal'.</span>
<a name="line-425"></a><span class='hs-comment'>-- This has no effect on an 'Control.Lens.IndexedLens.IndexedLens',</span>
<a name="line-426"></a><span class='hs-comment'>-- 'IndexedGetter', or 'Control.Lens.IndexedSetter.IndexedSetter'.</span>
<a name="line-427"></a><span class='hs-definition'>ibackwards</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>Indexable</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span>
<a name="line-428"></a> <span class='hs-keyglyph'>=></span> <span class='hs-conid'>Indexed</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-conid'>Backwards</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-layout'>(</span><span class='hs-conid'>Backwards</span> <span class='hs-varid'>f</span><span class='hs-layout'>)</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
<a name="line-429"></a> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>b</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>t</span><span class='hs-layout'>)</span>
<a name="line-430"></a><span class='hs-definition'>ibackwards</span> <span class='hs-varid'>l</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>indexed</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>-></span>
<a name="line-431"></a> <span class='hs-varid'>fmap</span> <span class='hs-varid'>forwards</span> <span class='hs-varop'>.</span> <span class='hs-varid'>withIndex</span> <span class='hs-varid'>l</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span> <span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>backwards</span><span class='hs-cpp'>#</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>i</span><span class='hs-layout'>)</span>
<a name="line-432"></a><span class='hs-comment'>{-# INLINE ibackwards #-}</span>
<a name="line-433"></a>
<a name="line-434"></a><a name="itakingWhile"></a><span class='hs-comment'>-- | Obtain an 'IndexedFold' by taking elements from another</span>
<a name="line-435"></a><span class='hs-comment'>-- 'IndexedFold', 'Control.Lens.IndexedLens.IndexedLens',</span>
<a name="line-436"></a><span class='hs-comment'>-- 'IndexedGetter' or 'Control.Lens.IndexedTraversal.IndexedTraversal'</span>
<a name="line-437"></a><span class='hs-comment'>-- while a predicate holds.</span>
<a name="line-438"></a><span class='hs-definition'>itakingWhile</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Gettable</span> <span class='hs-varid'>f</span><span class='hs-layout'>,</span> <span class='hs-conid'>Applicative</span> <span class='hs-varid'>f</span><span class='hs-layout'>,</span> <span class='hs-conid'>Indexable</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-439"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span>
<a name="line-440"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>s</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span>
<a name="line-441"></a> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span>
<a name="line-442"></a><span class='hs-definition'>itakingWhile</span> <span class='hs-varid'>p</span> <span class='hs-varid'>l</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>indexed</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>-></span>
<a name="line-443"></a> <span class='hs-varid'>ifoldrOf</span> <span class='hs-varid'>l</span> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>if</span> <span class='hs-varid'>p</span> <span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>then</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-varop'>*></span> <span class='hs-varid'>r</span> <span class='hs-keyword'>else</span> <span class='hs-varid'>noEffect</span><span class='hs-layout'>)</span> <span class='hs-varid'>noEffect</span>
<a name="line-444"></a><span class='hs-comment'>{-# INLINE itakingWhile #-}</span>
<a name="line-445"></a>
<a name="line-446"></a>
<a name="line-447"></a><a name="idroppingWhile"></a><span class='hs-comment'>-- | Obtain an 'IndexedFold' by dropping elements from another 'IndexedFold', 'Control.Lens.IndexedLens.IndexedLens', 'IndexedGetter' or 'Control.Lens.IndexedTraversal.IndexedTraversal' while a predicate holds.</span>
<a name="line-448"></a><span class='hs-definition'>idroppingWhile</span> <span class='hs-keyglyph'>::</span> <span class='hs-layout'>(</span><span class='hs-conid'>Gettable</span> <span class='hs-varid'>f</span><span class='hs-layout'>,</span> <span class='hs-conid'>Applicative</span> <span class='hs-varid'>f</span><span class='hs-layout'>,</span> <span class='hs-conid'>Indexable</span> <span class='hs-varid'>i</span> <span class='hs-varid'>k</span><span class='hs-layout'>)</span>
<a name="line-449"></a> <span class='hs-keyglyph'>=></span> <span class='hs-layout'>(</span><span class='hs-varid'>i</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>Bool</span><span class='hs-layout'>)</span>
<a name="line-450"></a> <span class='hs-keyglyph'>-></span> <span class='hs-conid'>IndexedGetting</span> <span class='hs-varid'>i</span> <span class='hs-layout'>(</span><span class='hs-conid'>Endo</span> <span class='hs-layout'>(</span><span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span> <span class='hs-varid'>s</span> <span class='hs-varid'>s</span> <span class='hs-varid'>a</span> <span class='hs-varid'>a</span>
<a name="line-451"></a> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>k</span> <span class='hs-layout'>(</span><span class='hs-varid'>a</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>a</span><span class='hs-layout'>)</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span> <span class='hs-keyglyph'>-></span> <span class='hs-varid'>f</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span>
<a name="line-452"></a><span class='hs-definition'>idroppingWhile</span> <span class='hs-varid'>p</span> <span class='hs-varid'>l</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>indexed</span> <span class='hs-varop'>$</span> <span class='hs-keyglyph'>\</span> <span class='hs-varid'>f</span> <span class='hs-keyglyph'>-></span>
<a name="line-453"></a> <span class='hs-varid'>fst</span> <span class='hs-varop'>.</span> <span class='hs-varid'>ifoldrOf</span> <span class='hs-varid'>l</span>
<a name="line-454"></a> <span class='hs-layout'>(</span><span class='hs-keyglyph'>\</span><span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-varid'>r</span> <span class='hs-keyglyph'>-></span> <span class='hs-keyword'>let</span> <span class='hs-varid'>s</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>f</span> <span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-varop'>*></span> <span class='hs-varid'>snd</span> <span class='hs-varid'>r</span> <span class='hs-keyword'>in</span> <span class='hs-keyword'>if</span> <span class='hs-varid'>p</span> <span class='hs-varid'>i</span> <span class='hs-varid'>a</span> <span class='hs-keyword'>then</span> <span class='hs-layout'>(</span><span class='hs-varid'>fst</span> <span class='hs-varid'>r</span><span class='hs-layout'>,</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span> <span class='hs-keyword'>else</span> <span class='hs-layout'>(</span><span class='hs-varid'>s</span><span class='hs-layout'>,</span> <span class='hs-varid'>s</span><span class='hs-layout'>)</span><span class='hs-layout'>)</span>
<a name="line-455"></a> <span class='hs-layout'>(</span><span class='hs-varid'>noEffect</span><span class='hs-layout'>,</span> <span class='hs-varid'>noEffect</span><span class='hs-layout'>)</span>
<a name="line-456"></a><span class='hs-comment'>{-# INLINE idroppingWhile #-}</span>
<a name="line-457"></a>
<a name="line-458"></a><span class='hs-comment'>------------------------------------------------------------------------------</span>
<a name="line-459"></a><span class='hs-comment'>-- Reifying Indexed Folds</span>
<a name="line-460"></a><span class='hs-comment'>------------------------------------------------------------------------------</span>
<a name="line-461"></a>
<a name="line-462"></a><a name="ReifiedIndexedFold"></a><span class='hs-comment'>-- | Useful for storage.</span>
<a name="line-463"></a><a name="ReifiedIndexedFold"></a><span class='hs-keyword'>newtype</span> <span class='hs-conid'>ReifiedIndexedFold</span> <span class='hs-varid'>i</span> <span class='hs-varid'>s</span> <span class='hs-varid'>a</span> <span class='hs-keyglyph'>=</span>
<a name="line-464"></a> <span class='hs-conid'>ReifyIndexedFold</span> <span class='hs-layout'>{</span> <span class='hs-varid'>reflectIndexedFold</span> <span class='hs-keyglyph'>::</span> <span class='hs-conid'>IndexedFold</span> <span class='hs-varid'>i</span> <span class='hs-varid'>s</span> <span class='hs-varid'>a</span> <span class='hs-layout'>}</span>
</pre></body>
</html>