This file is indexed.

/usr/share/doc/libghc-lens-doc/html/Control-Lens-Indexed.html is in libghc-lens-doc 4.13-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Control.Lens.Indexed</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Control-Lens-Indexed.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Lens-Indexed.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">lens-4.13: Lenses, Folds and Traversals</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>(C) 2012-15 Edward Kmett</td></tr><tr><th>License</th><td>BSD-style (see the file LICENSE)</td></tr><tr><th>Maintainer</th><td>Edward Kmett &lt;ekmett@gmail.com&gt;</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>Rank2Types</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Control.Lens.Indexed</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Indexing</a></li><li><a href="#g:2">Indexed Functors</a></li><li><a href="#g:3">Indexed Foldables</a><ul><li><a href="#g:4">Indexed Foldable Combinators</a></li></ul></li><li><a href="#g:5">Converting to Folds</a></li><li><a href="#g:6">Restricting by Index</a></li><li><a href="#g:7">Indexed Traversables</a></li><li><a href="#g:8">Indexed Traversable Combinators</a></li><li><a href="#g:9">Indexed Folds with Reified Monoid</a></li><li><a href="#g:10">Indexed Traversals with Reified Applicative</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>(The classes in here need to be defined together for <code>DefaultSignatures</code> to work.)</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">class</span> <a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> p =&gt; <a href="#t:Indexable">Indexable</a> i p <span class="keyword">where</span><ul class="subs"><li><a href="#v:indexed">indexed</a> :: p a b -&gt; i -&gt; a -&gt; b</li></ul></li><li class="src short"><span class="keyword">class</span> (<a href="Control-Lens-Prism.html#t:Choice">Choice</a> p, <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corepresentable">Corepresentable</a> p, <a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad.html#t:Comonad">Comonad</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corep">Corep</a> p), <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corep">Corep</a> p), <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Strong">Strong</a> p, <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Representable">Representable</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> p), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> p), <a href="file:///usr/share/doc/libghc-distributive-doc/html/Data-Distributive.html#t:Distributive">Distributive</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> p), <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Costrong">Costrong</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> p) =&gt; <a href="#t:Conjoined">Conjoined</a> p <span class="keyword">where</span><ul class="subs"><li><a href="#v:distrib">distrib</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f =&gt; p a b -&gt; p (f a) (f b)</li><li><a href="#v:conjoined">conjoined</a> :: ((p ~ (-&gt;)) =&gt; q (a -&gt; b) r) -&gt; q (p a b) r -&gt; q (p a b) r</li></ul></li><li class="src short"><span class="keyword">newtype</span> <a href="#t:Indexed">Indexed</a> i a b = <a href="#v:Indexed">Indexed</a> {<ul class="subs"><li><a href="#v:runIndexed">runIndexed</a> :: i -&gt; a -&gt; b</li></ul>}</li><li class="src short"><a href="#v:-60-.">(&lt;.)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p =&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -&gt; r) -&gt; ((a -&gt; b) -&gt; s -&gt; t) -&gt; p a b -&gt; r</li><li class="src short"><a href="#v:-60-.-62-">(&lt;.&gt;)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> (i, j) p =&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -&gt; r) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -&gt; s -&gt; t) -&gt; p a b -&gt; r</li><li class="src short"><a href="#v:.-62-">(.&gt;)</a> :: (st -&gt; r) -&gt; (kab -&gt; st) -&gt; kab -&gt; r</li><li class="src short"><a href="#v:selfIndex">selfIndex</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> a p =&gt; p a fb -&gt; a -&gt; fb</li><li class="src short"><a href="#v:reindexed">reindexed</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> j p =&gt; (i -&gt; j) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a b -&gt; r) -&gt; p a b -&gt; r</li><li class="src short"><a href="#v:icompose">icompose</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> p c =&gt; (i -&gt; j -&gt; p) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -&gt; r) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -&gt; s -&gt; t) -&gt; c a b -&gt; r</li><li class="src short"><a href="#v:indexing">indexing</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> p =&gt; ((a -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f b) -&gt; s -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f t) -&gt; p a (f b) -&gt; s -&gt; f t</li><li class="src short"><a href="#v:indexing64">indexing64</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> p =&gt; ((a -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f b) -&gt; s -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f t) -&gt; p a (f b) -&gt; s -&gt; f t</li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f =&gt; <a href="#t:FunctorWithIndex">FunctorWithIndex</a> i f | f -&gt; i <span class="keyword">where</span><ul class="subs"><li><a href="#v:imap">imap</a> :: (i -&gt; a -&gt; b) -&gt; f a -&gt; f b</li><li><a href="#v:imapped">imapped</a> :: <a href="Control-Lens-Type.html#t:IndexedSetter">IndexedSetter</a> i (f a) (f b) a b</li></ul></li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#t:Foldable">Foldable</a> f =&gt; <a href="#t:FoldableWithIndex">FoldableWithIndex</a> i f | f -&gt; i <span class="keyword">where</span><ul class="subs"><li><a href="#v:ifoldMap">ifoldMap</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> m =&gt; (i -&gt; a -&gt; m) -&gt; f a -&gt; m</li><li><a href="#v:ifolded">ifolded</a> :: <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i (f a) a</li><li><a href="#v:ifoldr">ifoldr</a> :: (i -&gt; a -&gt; b -&gt; b) -&gt; b -&gt; f a -&gt; b</li><li><a href="#v:ifoldl">ifoldl</a> :: (i -&gt; b -&gt; a -&gt; b) -&gt; b -&gt; f a -&gt; b</li><li><a href="#v:ifoldr-39-">ifoldr'</a> :: (i -&gt; a -&gt; b -&gt; b) -&gt; b -&gt; f a -&gt; b</li><li><a href="#v:ifoldl-39-">ifoldl'</a> :: (i -&gt; b -&gt; a -&gt; b) -&gt; b -&gt; f a -&gt; b</li></ul></li><li class="src short"><a href="#v:iany">iany</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:iall">iall</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:inone">inone</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:none">none</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#t:Foldable">Foldable</a> f =&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:itraverse_">itraverse_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; (i -&gt; a -&gt; f b) -&gt; t a -&gt; f ()</li><li class="src short"><a href="#v:ifor_">ifor_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; t a -&gt; (i -&gt; a -&gt; f b) -&gt; f ()</li><li class="src short"><a href="#v:imapM_">imapM_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; a -&gt; m b) -&gt; t a -&gt; m ()</li><li class="src short"><a href="#v:iforM_">iforM_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; t a -&gt; (i -&gt; a -&gt; m b) -&gt; m ()</li><li class="src short"><a href="#v:iconcatMap">iconcatMap</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; [b]) -&gt; f a -&gt; [b]</li><li class="src short"><a href="#v:ifind">ifind</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (i, a)</li><li class="src short"><a href="#v:ifoldrM">ifoldrM</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; a -&gt; b -&gt; m b) -&gt; b -&gt; f a -&gt; m b</li><li class="src short"><a href="#v:ifoldlM">ifoldlM</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; b -&gt; a -&gt; m b) -&gt; b -&gt; f a -&gt; m b</li><li class="src short"><a href="#v:itoList">itoList</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; f a -&gt; [(i, a)]</li><li class="src short"><a href="#v:withIndex">withIndex</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f) =&gt; p (i, s) (f (j, t)) -&gt; <a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s (f t)</li><li class="src short"><a href="#v:asIndex">asIndex</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="Control-Lens-Getter.html#t:Contravariant">Contravariant</a> f, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f) =&gt; p i (f i) -&gt; <a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s (f s)</li><li class="src short"><a href="#v:indices">indices</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; (i -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Control-Lens-Type.html#t:Optical-39-">Optical'</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f a a</li><li class="src short"><a href="#v:index">index</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> i, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; i -&gt; <a href="Control-Lens-Type.html#t:Optical-39-">Optical'</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f a a</li><li class="src short"><span class="keyword">class</span> (<a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i t, <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> t) =&gt; <a href="#t:TraversableWithIndex">TraversableWithIndex</a> i t | t -&gt; i <span class="keyword">where</span><ul class="subs"><li><a href="#v:itraverse">itraverse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f =&gt; (i -&gt; a -&gt; f b) -&gt; t a -&gt; f (t b)</li><li><a href="#v:itraversed">itraversed</a> :: <a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a> i (t a) (t b) a b</li></ul></li><li class="src short"><a href="#v:ifor">ifor</a> :: (<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; t a -&gt; (i -&gt; a -&gt; f b) -&gt; f (t b)</li><li class="src short"><a href="#v:imapM">imapM</a> :: (<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; a -&gt; m b) -&gt; t a -&gt; m (t b)</li><li class="src short"><a href="#v:iforM">iforM</a> :: (<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; t a -&gt; (i -&gt; a -&gt; m b) -&gt; m (t b)</li><li class="src short"><a href="#v:imapAccumR">imapAccumR</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t =&gt; (i -&gt; s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)</li><li class="src short"><a href="#v:imapAccumL">imapAccumL</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t =&gt; (i -&gt; s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)</li><li class="src short"><a href="#v:ifoldMapBy">ifoldMapBy</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t =&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (i -&gt; a -&gt; r) -&gt; t a -&gt; r</li><li class="src short"><a href="#v:ifoldMapByOf">ifoldMapByOf</a> :: <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i t a -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (i -&gt; a -&gt; r) -&gt; t -&gt; r</li><li class="src short"><a href="#v:itraverseBy">itraverseBy</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t =&gt; (<span class="keyword">forall</span> x. x -&gt; f x) -&gt; (<span class="keyword">forall</span> x y. f (x -&gt; y) -&gt; f x -&gt; f y) -&gt; (i -&gt; a -&gt; f b) -&gt; t a -&gt; f (t b)</li><li class="src short"><a href="#v:itraverseByOf">itraverseByOf</a> :: <a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a> i s t a b -&gt; (<span class="keyword">forall</span> x. x -&gt; f x) -&gt; (<span class="keyword">forall</span> x y. f (x -&gt; y) -&gt; f x -&gt; f y) -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t</li></ul></div><div id="interface"><h1 id="g:1">Indexing</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> p =&gt; <a name="t:Indexable" class="def">Indexable</a> i p <span class="keyword">where</span> <a href="src/Control-Lens-Internal-Indexed.html#Indexable" class="link">Source</a></p><div class="doc"><p>This class permits overloading of function application for things that
 also admit a notion of a key or index.</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:indexed" class="def">indexed</a> :: p a b -&gt; i -&gt; a -&gt; b <a href="src/Control-Lens-Internal-Indexed.html#indexed" class="link">Source</a></p><div class="doc"><p>Build a function from an <code><a href="Control-Lens-Indexed.html#v:indexed">indexed</a></code> function.</p></div></div><div class="subs instances"><p id="control.i:Indexable" class="caption collapser" onclick="toggleSection('i:Indexable')">Instances</p><div id="section.i:Indexable" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i (-&gt;)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-111" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(~) * i j =&gt; <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-238" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Control-Lens-Prism.html#t:Choice">Choice</a> p, <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corepresentable">Corepresentable</a> p, <a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad.html#t:Comonad">Comonad</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corep">Corep</a> p), <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corep">Corep</a> p), <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Strong">Strong</a> p, <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Representable">Representable</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> p), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> p), <a href="file:///usr/share/doc/libghc-distributive-doc/html/Data-Distributive.html#t:Distributive">Distributive</a> (<a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> p), <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Costrong">Costrong</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> p) =&gt; <a name="t:Conjoined" class="def">Conjoined</a> p <span class="keyword">where</span> <a href="src/Control-Lens-Internal-Indexed.html#Conjoined" class="link">Source</a></p><div class="doc"><p>This is a <code><a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a></code> that is both <code><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corepresentable">Corepresentable</a></code> by <code>f</code> and <code><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Representable">Representable</a></code> by <code>g</code> such
 that <code>f</code> is left adjoint to <code>g</code>. From this you can derive a lot of structure due
 to the preservation of limits and colimits.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src">Nothing</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:distrib" class="def">distrib</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f =&gt; p a b -&gt; p (f a) (f b) <a href="src/Control-Lens-Internal-Indexed.html#distrib" class="link">Source</a></p><div class="doc"><p><code><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a></code> is strong enough to let us distribute every <code><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a></code>
 <code><a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a></code> over every Haskell <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a></code>. This is effectively a
 generalization of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#v:fmap">fmap</a></code>.</p></div><p class="src"><a name="v:conjoined" class="def">conjoined</a> :: ((p ~ (-&gt;)) =&gt; q (a -&gt; b) r) -&gt; q (p a b) r -&gt; q (p a b) r <a href="src/Control-Lens-Internal-Indexed.html#conjoined" class="link">Source</a></p><div class="doc"><p>This permits us to make a decision at an outermost point about whether or not we use an index.</p><p>Ideally any use of this function should be done in such a way so that you compute the same answer,
 but this cannot be enforced at the type level.</p></div></div><div class="subs instances"><p id="control.i:Conjoined" class="caption collapser" onclick="toggleSection('i:Conjoined')">Instances</p><div id="section.i:Conjoined" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> (-&gt;)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-95" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> <a href="Control-Lens-Reified.html#t:ReifiedGetter">ReifiedGetter</a></span> <a href="src/Control-Lens-Internal-Indexed.html#line-189" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-234" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">newtype</span> <a name="t:Indexed" class="def">Indexed</a> i a b <a href="src/Control-Lens-Internal-Indexed.html#Indexed" class="link">Source</a></p><div class="doc"><p>A function with access to a index. This constructor may be useful when you need to store
 an <code><a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a></code> in a container to avoid <code>ImpredicativeTypes</code>.</p><pre>index :: Indexed i a b -&gt; i -&gt; a -&gt; b</pre></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Indexed" class="def">Indexed</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:runIndexed" class="def">runIndexed</a> :: i -&gt; a -&gt; b</dt><dd class="doc empty">&nbsp;</dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:Indexed" class="caption collapser" onclick="toggleSection('i:Indexed')">Instances</p><div id="section.i:Indexed" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Category.html#t:Category">Category</a> * (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-198" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(~) * i j =&gt; <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-238" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:Arrow">Arrow</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-204" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-216" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-226" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-230" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Representable">Representable</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-176" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corepresentable">Corepresentable</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-185" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Strong">Strong</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-194" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-190" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor.html#t:Costrong">Costrong</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-167" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-153" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-234" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Internal-Bazaar.html#t:Bizarre">Bizarre</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a>) <a href="Control-Lens-Internal-Magma.html#t:Mafic">Mafic</a></span> <a href="src/Control-Lens-Internal-Bazaar.html#line-197" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Sieve.html#t:Sieve">Sieve</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) ((-&gt;) i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-172" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Sieve.html#t:Cosieve">Cosieve</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.4.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> i)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-181" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Internal-Context.html#t:Sellable">Sellable</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) (<a href="Control-Lens-Internal-Magma.html#t:Molten">Molten</a> i)</span> <a href="src/Control-Lens-Internal-Context.html#line-128" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Internal-Bazaar.html#t:Bizarre">Bizarre</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) (<a href="Control-Lens-Internal-Magma.html#t:Molten">Molten</a> i)</span> <a href="src/Control-Lens-Internal-Bazaar.html#line-132" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-143" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-125" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-149" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-133" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Apply.html#t:Apply">Apply</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-129" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-semigroupoids-doc/html/Data-Functor-Bind.html#t:Bind">Bind</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</span> <a href="src/Control-Lens-Internal-Indexed.html#line-139" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Rep">Rep</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) = (-&gt;) i</span> <a href="src/Control-Lens-Internal-Indexed.html#line-177" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><span class="keyword">type</span> <a href="file:///usr/share/doc/libghc-profunctors-doc/html/Data-Profunctor-Rep.html#t:Corep">Corep</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) = <a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.4.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> i</span> <a href="src/Control-Lens-Internal-Indexed.html#line-186" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:-60-." class="def">(&lt;.)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p =&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -&gt; r) -&gt; ((a -&gt; b) -&gt; s -&gt; t) -&gt; p a b -&gt; r <span class="fixity">infixr 9</span><span class="rightedge"></span> <a href="src/Control-Lens-Indexed.html#%3C." class="link">Source</a></p><div class="doc"><p>Compose an <code><a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a></code> function with a non-indexed function.</p><p>Mnemonically, the <code>&lt;</code> points to the indexing we want to preserve.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, &quot;one,ten&quot;), (20, &quot;one,twenty&quot;)]), (2, [(30, &quot;two,thirty&quot;), (40,&quot;two,forty&quot;)])]
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>nestedMap^..(itraversed&lt;.itraversed).withIndex
</code></strong>[(1,&quot;one,ten&quot;),(1,&quot;one,twenty&quot;),(2,&quot;two,thirty&quot;),(2,&quot;two,forty&quot;)]
</pre></div></div><div class="top"><p class="src"><a name="v:-60-.-62-" class="def">(&lt;.&gt;)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> (i, j) p =&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -&gt; r) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -&gt; s -&gt; t) -&gt; p a b -&gt; r <span class="fixity">infixr 9</span><span class="rightedge"></span> <a href="src/Control-Lens-Indexed.html#%3C.%3E" class="link">Source</a></p><div class="doc"><p>Composition of <code><a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a></code> functions.</p><p>Mnemonically, the <code>&lt;</code> and <code>&gt;</code> points to the fact that we want to preserve the indices.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, &quot;one,ten&quot;), (20, &quot;one,twenty&quot;)]), (2, [(30, &quot;two,thirty&quot;), (40,&quot;two,forty&quot;)])]
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>nestedMap^..(itraversed&lt;.&gt;itraversed).withIndex
</code></strong>[((1,10),&quot;one,ten&quot;),((1,20),&quot;one,twenty&quot;),((2,30),&quot;two,thirty&quot;),((2,40),&quot;two,forty&quot;)]
</pre></div></div><div class="top"><p class="src"><a name="v:.-62-" class="def">(.&gt;)</a> :: (st -&gt; r) -&gt; (kab -&gt; st) -&gt; kab -&gt; r <span class="fixity">infixr 9</span><span class="rightedge"></span> <a href="src/Control-Lens-Indexed.html#.%3E" class="link">Source</a></p><div class="doc"><p>Compose a non-indexed function with an <code><a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a></code> function.</p><p>Mnemonically, the <code>&gt;</code> points to the indexing we want to preserve.</p><p>This is the same as <code>(<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code>)</code>.</p><p><code>f <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> g</code> (and <code>f <code><a href="Control-Lens-Indexed.html#v:.-62-">.&gt;</a></code> g</code>) gives you the index of <code>g</code> unless <code>g</code> is index-preserving, like a
 <code><a href="Control-Lens-Type.html#t:Prism">Prism</a></code>, <code><a href="Control-Lens-Type.html#t:Iso">Iso</a></code> or <code><a href="Control-Lens-Type.html#t:Equality">Equality</a></code>, in which case it'll pass through the index of <code>f</code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, &quot;one,ten&quot;), (20, &quot;one,twenty&quot;)]), (2, [(30, &quot;two,thirty&quot;), (40,&quot;two,forty&quot;)])]
</code></strong><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>nestedMap^..(itraversed.&gt;itraversed).withIndex
</code></strong>[(10,&quot;one,ten&quot;),(20,&quot;one,twenty&quot;),(30,&quot;two,thirty&quot;),(40,&quot;two,forty&quot;)]
</pre></div></div><div class="top"><p class="src"><a name="v:selfIndex" class="def">selfIndex</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> a p =&gt; p a fb -&gt; a -&gt; fb <a href="src/Control-Lens-Indexed.html#selfIndex" class="link">Source</a></p><div class="doc"><p>Use a value itself as its own index. This is essentially an indexed version of <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:id">id</a></code>.</p><p>Note: When used to modify the value, this can break the index requirements assumed by <code><a href="Control-Lens-Indexed.html#v:indices">indices</a></code> and similar,
 so this is only properly an <code><a href="Control-Lens-Type.html#t:IndexedGetter">IndexedGetter</a></code>, but it can be used as more.</p><pre><code><a href="Control-Lens-Indexed.html#v:selfIndex">selfIndex</a></code> ::&#160;<code><a href="Control-Lens-Type.html#t:IndexedGetter">IndexedGetter</a></code> a a b
</pre></div></div><div class="top"><p class="src"><a name="v:reindexed" class="def">reindexed</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> j p =&gt; (i -&gt; j) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a b -&gt; r) -&gt; p a b -&gt; r <a href="src/Control-Lens-Indexed.html#reindexed" class="link">Source</a></p><div class="doc"><p>Remap the index.</p></div></div><div class="top"><p class="src"><a name="v:icompose" class="def">icompose</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> p c =&gt; (i -&gt; j -&gt; p) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -&gt; r) -&gt; (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -&gt; s -&gt; t) -&gt; c a b -&gt; r <a href="src/Control-Lens-Indexed.html#icompose" class="link">Source</a></p><div class="doc"><p>Composition of <code><a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a></code> functions with a user supplied function for combining indices.</p></div></div><div class="top"><p class="src"><a name="v:indexing" class="def">indexing</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> p =&gt; ((a -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f b) -&gt; s -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f t) -&gt; p a (f b) -&gt; s -&gt; f t <a href="src/Control-Lens-Internal-Indexed.html#indexing" class="link">Source</a></p><div class="doc"><p>Transform a <code><a href="Control-Lens-Traversal.html#v:Traversal">Traversal</a></code> into an <code><a href="Control-Lens-Traversal.html#v:IndexedTraversal">IndexedTraversal</a></code> or
 a <code><a href="Control-Lens-Fold.html#v:Fold">Fold</a></code> into an <code><a href="Control-Lens-Fold.html#v:IndexedFold">IndexedFold</a></code>, etc.</p><pre><code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Type.html#v:Traversal">Traversal</a></code> s t a b -&gt; <code><a href="Control-Lens-Type.html#v:IndexedTraversal">IndexedTraversal</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Type.html#v:Prism">Prism</a></code> s t a b     -&gt; <code><a href="Control-Lens-Type.html#v:IndexedTraversal">IndexedTraversal</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Type.html#v:Lens">Lens</a></code> s t a b      -&gt; <code><a href="Control-Lens-Type.html#v:IndexedLens">IndexedLens</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code>  s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Type.html#v:Iso">Iso</a></code> s t a b       -&gt; <code><a href="Control-Lens-Type.html#v:IndexedLens">IndexedLens</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Type.html#v:Fold">Fold</a></code> s a          -&gt; <code><a href="Control-Lens-Type.html#v:IndexedFold">IndexedFold</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> s a
<code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Type.html#v:Getter">Getter</a></code> s a        -&gt; <code><a href="Control-Lens-Type.html#v:IndexedGetter">IndexedGetter</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> s a
</pre><pre><code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> :: <code><a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a></code> p =&gt; <code><a href="Control-Lens-Type.html#v:LensLike">LensLike</a></code> (<code><a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a></code> f) s t a b -&gt; <code><a href="Control-Lens-Type.html#v:Over">Over</a></code> p f s t a b</pre></div></div><div class="top"><p class="src"><a name="v:indexing64" class="def">indexing64</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a> p =&gt; ((a -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f b) -&gt; s -&gt; <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f t) -&gt; p a (f b) -&gt; s -&gt; f t <a href="src/Control-Lens-Internal-Indexed.html#indexing64" class="link">Source</a></p><div class="doc"><p>Transform a <code><a href="Control-Lens-Traversal.html#v:Traversal">Traversal</a></code> into an <code><a href="Control-Lens-Traversal.html#v:IndexedTraversal">IndexedTraversal</a></code> or
 a <code><a href="Control-Lens-Fold.html#v:Fold">Fold</a></code> into an <code><a href="Control-Lens-Fold.html#v:IndexedFold">IndexedFold</a></code>, etc.</p><p>This combinator is like <code><a href="Control-Lens-Indexed.html#v:indexing">indexing</a></code> except that it handles large traversals and folds gracefully.</p><pre><code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Type.html#v:Traversal">Traversal</a></code> s t a b -&gt; <code><a href="Control-Lens-Type.html#v:IndexedTraversal">IndexedTraversal</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Type.html#v:Prism">Prism</a></code> s t a b     -&gt; <code><a href="Control-Lens-Type.html#v:IndexedTraversal">IndexedTraversal</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Type.html#v:Lens">Lens</a></code> s t a b      -&gt; <code><a href="Control-Lens-Type.html#v:IndexedLens">IndexedLens</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Type.html#v:Iso">Iso</a></code> s t a b       -&gt; <code><a href="Control-Lens-Type.html#v:IndexedLens">IndexedLens</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> s t a b
<code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Type.html#v:Fold">Fold</a></code> s a          -&gt; <code><a href="Control-Lens-Type.html#v:IndexedFold">IndexedFold</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> s a
<code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Type.html#v:Getter">Getter</a></code> s a        -&gt; <code><a href="Control-Lens-Type.html#v:IndexedGetter">IndexedGetter</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> s a
</pre><pre><code><a href="Control-Lens-Indexed.html#v:indexing64">indexing64</a></code> :: <code><a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int64">Int64</a></code> p =&gt; <code><a href="Control-Lens-Type.html#v:LensLike">LensLike</a></code> (<code><a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a></code> f) s t a b -&gt; <code><a href="Control-Lens-Type.html#v:Over">Over</a></code> p f s t a b</pre></div></div><h1 id="g:2">Indexed Functors</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f =&gt; <a name="t:FunctorWithIndex" class="def">FunctorWithIndex</a> i f | f -&gt; i <span class="keyword">where</span> <a href="src/Control-Lens-Indexed.html#FunctorWithIndex" class="link">Source</a></p><div class="doc"><p>A <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a></code> with an additional index.</p><p>Instances must satisfy a modified form of the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a></code> laws:</p><pre><code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> f <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> g &#8801; <code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> (\i -&gt; f i <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> g i)
<code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> (\_ a -&gt; a) &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:id">id</a></code>
</pre></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src">Nothing</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:imap" class="def">imap</a> :: (i -&gt; a -&gt; b) -&gt; f a -&gt; f b <a href="src/Control-Lens-Indexed.html#imap" class="link">Source</a></p><div class="doc"><p>Map with access to the index.</p></div><p class="src"><a name="v:imapped" class="def">imapped</a> :: <a href="Control-Lens-Type.html#t:IndexedSetter">IndexedSetter</a> i (f a) (f b) a b <a href="src/Control-Lens-Indexed.html#imapped" class="link">Source</a></p><div class="doc"><p>The <code><a href="Control-Lens-Type.html#t:IndexedSetter">IndexedSetter</a></code> for a <code><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a></code>.</p><p>If you don't need access to the index, then <code><a href="Control-Lens-Setter.html#v:mapped">mapped</a></code> is more flexible in what it accepts.</p></div></div><div class="subs instances"><p id="control.i:FunctorWithIndex" class="caption collapser" onclick="toggleSection('i:FunctorWithIndex')">Instances</p><div id="section.i:FunctorWithIndex" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> []</span> <a href="src/Control-Lens-Indexed.html#line-620" class="link">Source</a></td><td class="doc"><p>The position in the list is available as the index.</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-IntMap-Strict.html#t:IntMap">IntMap</a></span> <a href="src/Control-Lens-Indexed.html#line-665" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Sequence.html#t:Seq">Seq</a></span> <a href="src/Control-Lens-Indexed.html#line-643" class="link">Source</a></td><td class="doc"><p>The position in the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Sequence.html#t:Seq">Seq</a></code> is available as the index.</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></span> <a href="src/Control-Lens-Indexed.html#line-626" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a></span> <a href="src/Control-Lens-Indexed.html#line-649" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="Control-Lens-Internal-Deque.html#t:Deque">Deque</a></span> <a href="src/Control-Lens-Indexed.html#line-103" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> () <a href="Control-Lens-Setter.html#t:Identity">Identity</a></span> <a href="src/Control-Lens-Indexed.html#line-595" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> () <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></span> <a href="src/Control-Lens-Indexed.html#line-632" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i m =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad-Trans-Identity.html#t:IdentityT">IdentityT</a> m)</span> <a href="src/Control-Lens-Indexed.html#line-809" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ix.html#t:Ix">Ix</a> i =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/array-0.5.1.0/Data-Array.html#t:Array">Array</a> i)</span> <a href="src/Control-Lens-Indexed.html#line-773" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="Control-Lens-Internal-Level.html#t:Level">Level</a> i)</span> <a href="src/Control-Lens-Indexed.html#line-716" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> r ((-&gt;) r)</span> <a href="src/Control-Lens-Indexed.html#line-712" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> k, <a href="file:///usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> k (<a href="file:///usr/share/doc/libghc-unordered-containers-doc/html/Data-HashMap-Strict.html#t:HashMap">HashMap</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-699" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> k (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-682" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> k (<a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.4.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-607" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Reverse.html#t:Reverse">Reverse</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-583" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Applicative-Backwards.html#t:Backwards">Backwards</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-571" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="Control-Lens-Internal-Magma.html#t:Magma">Magma</a> i t b)</span> <a href="src/Control-Lens-Indexed.html#line-737" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a>] <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Tree.html#t:Tree">Tree</a></span> <a href="src/Control-Lens-Indexed.html#line-841" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> [i] (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Comonad-Cofree.html#t:Cofree">Cofree</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-785" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> [i] (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Monad-Free.html#t:Free">Free</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-758" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f, <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> j g) =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> i j) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Product.html#t:Product">Product</a> f g)</span> <a href="src/Control-Lens-Indexed.html#line-821" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i w =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> (s, i) (<a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad-Trans-Traced.html#t:TracedT">TracedT</a> s w)</span> <a href="src/Control-Lens-Indexed.html#line-837" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i m =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> (e, i) (<a href="file:///usr/share/doc/libghc-mtl-doc/html/Control-Monad-Reader.html#t:ReaderT">ReaderT</a> e m)</span> <a href="src/Control-Lens-Indexed.html#line-833" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f, <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> j g) =&gt; <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> (i, j) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Compose.html#t:Compose">Compose</a> f g)</span> <a href="src/Control-Lens-Indexed.html#line-797" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:3">Indexed Foldables</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#t:Foldable">Foldable</a> f =&gt; <a name="t:FoldableWithIndex" class="def">FoldableWithIndex</a> i f | f -&gt; i <span class="keyword">where</span> <a href="src/Control-Lens-Indexed.html#FoldableWithIndex" class="link">Source</a></p><div class="doc"><p>A container that supports folding with an additional index.</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src">Nothing</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:ifoldMap" class="def">ifoldMap</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a> m =&gt; (i -&gt; a -&gt; m) -&gt; f a -&gt; m <a href="src/Control-Lens-Indexed.html#ifoldMap" class="link">Source</a></p><div class="doc"><p>Fold a container by mapping value to an arbitrary <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Monoid.html#t:Monoid">Monoid</a></code> with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldMap">foldMap</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldMap">foldMap</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldMap">ifoldMap</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div><p class="src"><a name="v:ifolded" class="def">ifolded</a> :: <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i (f a) a <a href="src/Control-Lens-Indexed.html#ifolded" class="link">Source</a></p><div class="doc"><p>The <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code> of a <code><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a></code> container.</p><p><code><code><a href="Control-Lens-Indexed.html#v:ifolded">ifolded</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:asIndex">asIndex</a></code></code> is a fold over the keys of a <code><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a></code>.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>Data.Map.fromList [(2, &quot;hello&quot;), (1, &quot;world&quot;)]^..ifolded.asIndex
</code></strong>[1,2]
</pre></div><p class="src"><a name="v:ifoldr" class="def">ifoldr</a> :: (i -&gt; a -&gt; b -&gt; b) -&gt; b -&gt; f a -&gt; b <a href="src/Control-Lens-Indexed.html#ifoldr" class="link">Source</a></p><div class="doc"><p>Right-associative fold of an indexed container with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldr">foldr</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldr">foldr</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldr">ifoldr</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div><p class="src"><a name="v:ifoldl" class="def">ifoldl</a> :: (i -&gt; b -&gt; a -&gt; b) -&gt; b -&gt; f a -&gt; b <a href="src/Control-Lens-Indexed.html#ifoldl" class="link">Source</a></p><div class="doc"><p>Left-associative fold of an indexed container with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldl">foldl</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldl">foldl</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldl">ifoldl</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div><p class="src"><a name="v:ifoldr-39-" class="def">ifoldr'</a> :: (i -&gt; a -&gt; b -&gt; b) -&gt; b -&gt; f a -&gt; b <a href="src/Control-Lens-Indexed.html#ifoldr%27" class="link">Source</a></p><div class="doc"><p><em>Strictly</em> fold right over the elements of a structure with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#v:foldr-39-">foldr'</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#v:foldr-39-">foldr'</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldr-39-">ifoldr'</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div><p class="src"><a name="v:ifoldl-39-" class="def">ifoldl'</a> :: (i -&gt; b -&gt; a -&gt; b) -&gt; b -&gt; f a -&gt; b <a href="src/Control-Lens-Indexed.html#ifoldl%27" class="link">Source</a></p><div class="doc"><p>Fold over the elements of a structure with an index, associating to the left, but <em>strictly</em>.</p><p>When you don't need access to the index then <code><a href="Control-Lens-Fold.html#v:foldlOf-39-">foldlOf'</a></code> is more flexible in what it accepts.</p><pre><code><a href="Control-Lens-Fold.html#v:foldlOf-39-">foldlOf'</a></code> l &#8801; <code><a href="Control-Lens-Fold.html#v:ifoldlOf-39-">ifoldlOf'</a></code> l <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="subs instances"><p id="control.i:FoldableWithIndex" class="caption collapser" onclick="toggleSection('i:FoldableWithIndex')">Instances</p><div id="section.i:FoldableWithIndex" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> []</span> <a href="src/Control-Lens-Indexed.html#line-621" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-IntMap-Strict.html#t:IntMap">IntMap</a></span> <a href="src/Control-Lens-Indexed.html#line-666" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Sequence.html#t:Seq">Seq</a></span> <a href="src/Control-Lens-Indexed.html#line-644" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></span> <a href="src/Control-Lens-Indexed.html#line-627" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a></span> <a href="src/Control-Lens-Indexed.html#line-652" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="Control-Lens-Internal-Deque.html#t:Deque">Deque</a></span> <a href="src/Control-Lens-Indexed.html#line-159" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> () <a href="Control-Lens-Setter.html#t:Identity">Identity</a></span> <a href="src/Control-Lens-Indexed.html#line-599" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> () <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></span> <a href="src/Control-Lens-Indexed.html#line-635" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i m =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad-Trans-Identity.html#t:IdentityT">IdentityT</a> m)</span> <a href="src/Control-Lens-Indexed.html#line-813" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ix.html#t:Ix">Ix</a> i =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/array-0.5.1.0/Data-Array.html#t:Array">Array</a> i)</span> <a href="src/Control-Lens-Indexed.html#line-777" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="Control-Lens-Internal-Level.html#t:Level">Level</a> i)</span> <a href="src/Control-Lens-Indexed.html#line-723" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> k, <a href="file:///usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> k (<a href="file:///usr/share/doc/libghc-unordered-containers-doc/html/Data-HashMap-Strict.html#t:HashMap">HashMap</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-700" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> k (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-683" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> k (<a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.4.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-611" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Reverse.html#t:Reverse">Reverse</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-587" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Applicative-Backwards.html#t:Backwards">Backwards</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-575" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="Control-Lens-Internal-Magma.html#t:Magma">Magma</a> i t b)</span> <a href="src/Control-Lens-Indexed.html#line-744" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a>] <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Tree.html#t:Tree">Tree</a></span> <a href="src/Control-Lens-Indexed.html#line-845" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> [i] (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Comonad-Cofree.html#t:Cofree">Cofree</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-789" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> [i] (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Monad-Free.html#t:Free">Free</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-763" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f, <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> j g) =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> i j) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Product.html#t:Product">Product</a> f g)</span> <a href="src/Control-Lens-Indexed.html#line-825" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f, <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> j g) =&gt; <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> (i, j) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Compose.html#t:Compose">Compose</a> f g)</span> <a href="src/Control-Lens-Indexed.html#line-801" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h2 id="g:4">Indexed Foldable Combinators</h2><div class="top"><p class="src"><a name="v:iany" class="def">iany</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Lens-Indexed.html#iany" class="link">Source</a></p><div class="doc"><p>Return whether or not any element in a container satisfies a predicate, with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:any">any</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:any">any</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:iany">iany</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:iall" class="def">iall</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Lens-Indexed.html#iall" class="link">Source</a></p><div class="doc"><p>Return whether or not all elements in a container satisfy a predicate, with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:all">all</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:all">all</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:iall">iall</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:inone" class="def">inone</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Lens-Indexed.html#inone" class="link">Source</a></p><div class="doc"><p>Return whether or not none of the elements in a container satisfy a predicate, with access to the index <code>i</code>.</p><p>When you don't need access to the index then <code><a href="Control-Lens-Indexed.html#v:none">none</a></code> is more flexible in what it accepts.</p><pre><code><a href="Control-Lens-Indexed.html#v:none">none</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:inone">inone</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:inone">inone</a></code> f &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:not">not</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:iany">iany</a></code> f
</pre></div></div><div class="top"><p class="src"><a name="v:none" class="def">none</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#t:Foldable">Foldable</a> f =&gt; (a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Control-Lens-Indexed.html#none" class="link">Source</a></p><div class="doc"><p>Determines whether no elements of the structure satisfy the predicate.</p><pre><code><a href="Control-Lens-Indexed.html#v:none">none</a></code> f &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#v:not">not</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:any">any</a></code> f
</pre></div></div><div class="top"><p class="src"><a name="v:itraverse_" class="def">itraverse_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; (i -&gt; a -&gt; f b) -&gt; t a -&gt; f () <a href="src/Control-Lens-Indexed.html#itraverse_" class="link">Source</a></p><div class="doc"><p>Traverse elements with access to the index <code>i</code>, discarding the results.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:traverse_">traverse_</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:traverse_">traverse_</a></code> l = <code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:ifor_" class="def">ifor_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; t a -&gt; (i -&gt; a -&gt; f b) -&gt; f () <a href="src/Control-Lens-Indexed.html#ifor_" class="link">Source</a></p><div class="doc"><p>Traverse elements with access to the index <code>i</code>, discarding the results (with the arguments flipped).</p><pre><code><a href="Control-Lens-Indexed.html#v:ifor_">ifor_</a></code> &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:flip">flip</a></code> <code><a href="Control-Lens-Indexed.html#v:itraverse_">itraverse_</a></code>
</pre><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:for_">for_</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:for_">for_</a></code> a &#8801; <code><a href="Control-Lens-Indexed.html#v:ifor_">ifor_</a></code> a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:imapM_" class="def">imapM_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; a -&gt; m b) -&gt; t a -&gt; m () <a href="src/Control-Lens-Indexed.html#imapM_" class="link">Source</a></p><div class="doc"><p>Run monadic actions for each target of an <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code> or <code><a href="Control-Lens-IndexedTraversal.html#v:IndexedTraversal">IndexedTraversal</a></code> with access to the index,
 discarding the results.</p><p>When you don't need access to the index then <code><a href="Control-Lens-Fold.html#v:mapMOf_">mapMOf_</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:mapM_">mapM_</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:imapM">imapM</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:iforM_" class="def">iforM_</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; t a -&gt; (i -&gt; a -&gt; m b) -&gt; m () <a href="src/Control-Lens-Indexed.html#iforM_" class="link">Source</a></p><div class="doc"><p>Run monadic actions for each target of an <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code> or <code><a href="Control-Lens-IndexedTraversal.html#v:IndexedTraversal">IndexedTraversal</a></code> with access to the index,
 discarding the results (with the arguments flipped).</p><pre><code><a href="Control-Lens-Indexed.html#v:iforM_">iforM_</a></code> &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:flip">flip</a></code> <code><a href="Control-Lens-Indexed.html#v:imapM_">imapM_</a></code>
</pre><p>When you don't need access to the index then <code><a href="Control-Lens-Fold.html#v:forMOf_">forMOf_</a></code> is more flexible in what it accepts.</p><pre><code><a href="Control-Lens-Fold.html#v:forMOf_">forMOf_</a></code> l a &#8801; <code><a href="Control-Lens-Traversal.html#v:iforMOf">iforMOf</a></code> l a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:iconcatMap" class="def">iconcatMap</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; [b]) -&gt; f a -&gt; [b] <a href="src/Control-Lens-Indexed.html#iconcatMap" class="link">Source</a></p><div class="doc"><p>Concatenate the results of a function of the elements of an indexed container with access to the index.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:concatMap">concatMap</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:concatMap">concatMap</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:iconcatMap">iconcatMap</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:iconcatMap">iconcatMap</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldMap">ifoldMap</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:ifind" class="def">ifind</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; (i -&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; f a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> (i, a) <a href="src/Control-Lens-Indexed.html#ifind" class="link">Source</a></p><div class="doc"><p>Searches a container with a predicate that is also supplied the index, returning the left-most element of the structure
 matching the predicate, or <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> if there is no such element.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:find">find</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:find">find</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifind">ifind</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:ifoldrM" class="def">ifoldrM</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; a -&gt; b -&gt; m b) -&gt; b -&gt; f a -&gt; m b <a href="src/Control-Lens-Indexed.html#ifoldrM" class="link">Source</a></p><div class="doc"><p>Monadic fold right over the elements of a structure with an index.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldrM">foldrM</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldrM">foldrM</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldrM">ifoldrM</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:ifoldlM" class="def">ifoldlM</a> :: (<a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; b -&gt; a -&gt; m b) -&gt; b -&gt; f a -&gt; m b <a href="src/Control-Lens-Indexed.html#ifoldlM" class="link">Source</a></p><div class="doc"><p>Monadic fold over the elements of a structure with an index, associating to the left.</p><p>When you don't need access to the index then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldlM">foldlM</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:foldlM">foldlM</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:ifoldlM">ifoldlM</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:itoList" class="def">itoList</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f =&gt; f a -&gt; [(i, a)] <a href="src/Control-Lens-Indexed.html#itoList" class="link">Source</a></p><div class="doc"><p>Extract the key-value pairs from a structure.</p><p>When you don't need access to the indices in the result, then <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:toList">toList</a></code> is more flexible in what it accepts.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Foldable.html#v:toList">toList</a></code> &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-List.html#v:map">map</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Tuple.html#v:snd">snd</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:itoList">itoList</a></code>
</pre></div></div><h1 id="g:5">Converting to Folds</h1><div class="top"><p class="src"><a name="v:withIndex" class="def">withIndex</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f) =&gt; p (i, s) (f (j, t)) -&gt; <a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s (f t) <a href="src/Control-Lens-Internal-Indexed.html#withIndex" class="link">Source</a></p><div class="doc"><p>Fold a container with indices returning both the indices and the values.</p><p>The result is only valid to compose in a <code>Traversal</code>, if you don't edit the
 index as edits to the index have no effect.</p></div></div><div class="top"><p class="src"><a name="v:asIndex" class="def">asIndex</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="Control-Lens-Getter.html#t:Contravariant">Contravariant</a> f, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#t:Functor">Functor</a> f) =&gt; p i (f i) -&gt; <a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s (f s) <a href="src/Control-Lens-Internal-Indexed.html#asIndex" class="link">Source</a></p><div class="doc"><p>When composed with an <code>IndexedFold</code> or <code>IndexedTraversal</code> this yields an
 (<code><a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a></code>) <code>Fold</code> of the indices.</p></div></div><h1 id="g:6">Restricting by Index</h1><div class="top"><p class="src"><a name="v:indices" class="def">indices</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; (i -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Control-Lens-Type.html#t:Optical-39-">Optical'</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f a a <a href="src/Control-Lens-Indexed.html#indices" class="link">Source</a></p><div class="doc"><p>This allows you to filter an <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code>, <code><a href="Control-Lens-Type.html#t:IndexedGetter">IndexedGetter</a></code>, <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> or <code><a href="Control-Lens-Type.html#t:IndexedLens">IndexedLens</a></code> based on a predicate
 on the indices.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>[&quot;hello&quot;,&quot;the&quot;,&quot;world&quot;,&quot;!!!&quot;]^..traversed.indices even
</code></strong>[&quot;hello&quot;,&quot;world&quot;]
</pre><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>over (traversed.indices (&gt;0)) Prelude.reverse $ [&quot;He&quot;,&quot;was&quot;,&quot;stressed&quot;,&quot;o_O&quot;]
</code></strong>[&quot;He&quot;,&quot;saw&quot;,&quot;desserts&quot;,&quot;O_o&quot;]
</pre></div></div><div class="top"><p class="src"><a name="v:index" class="def">index</a> :: (<a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> i, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; i -&gt; <a href="Control-Lens-Type.html#t:Optical-39-">Optical'</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f a a <a href="src/Control-Lens-Indexed.html#index" class="link">Source</a></p><div class="doc"><p>This allows you to filter an <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code>, <code><a href="Control-Lens-Type.html#t:IndexedGetter">IndexedGetter</a></code>, <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> or <code><a href="Control-Lens-Type.html#t:IndexedLens">IndexedLens</a></code> based on an index.</p><pre class="screen"><code class="prompt">&gt;&gt;&gt; </code><strong class="userinput"><code>[&quot;hello&quot;,&quot;the&quot;,&quot;world&quot;,&quot;!!!&quot;]^?traversed.index 2
</code></strong>Just &quot;world&quot;
</pre></div></div><h1 id="g:7">Indexed Traversables</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i t, <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t, <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> t) =&gt; <a name="t:TraversableWithIndex" class="def">TraversableWithIndex</a> i t | t -&gt; i <span class="keyword">where</span> <a href="src/Control-Lens-Indexed.html#TraversableWithIndex" class="link">Source</a></p><div class="doc"><p>A <code><a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a></code> with an additional index.</p><p>An instance must satisfy a (modified) form of the <code><a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a></code> laws:</p><pre><code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> (<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code> <code><a href="Control-Lens-Setter.html#t:Identity">Identity</a></code>) &#8801; <code><a href="Control-Lens-Setter.html#t:Identity">Identity</a></code>
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#v:fmap">fmap</a></code> (<code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> f) <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> g &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Compose.html#v:getCompose">getCompose</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> (\i -&gt; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Compose.html#t:Compose">Compose</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Functor.html#v:fmap">fmap</a></code> (f i) <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> g i)
</pre></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src">Nothing</p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:itraverse" class="def">itraverse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f =&gt; (i -&gt; a -&gt; f b) -&gt; t a -&gt; f (t b) <a href="src/Control-Lens-Indexed.html#itraverse" class="link">Source</a></p><div class="doc"><p>Traverse an indexed container.</p><pre><code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> &#8801; <code><a href="Control-Lens-Traversal.html#v:itraverseOf">itraverseOf</a></code> <code><a href="Control-Lens-Indexed.html#v:itraversed">itraversed</a></code>
</pre></div><p class="src"><a name="v:itraversed" class="def">itraversed</a> :: <a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a> i (t a) (t b) a b <a href="src/Control-Lens-Indexed.html#itraversed" class="link">Source</a></p><div class="doc"><p>The <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> of a <code><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a></code> container.</p></div></div><div class="subs instances"><p id="control.i:TraversableWithIndex" class="caption collapser" onclick="toggleSection('i:TraversableWithIndex')">Instances</p><div id="section.i:TraversableWithIndex" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> []</span> <a href="src/Control-Lens-Indexed.html#line-622" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-IntMap-Strict.html#t:IntMap">IntMap</a></span> <a href="src/Control-Lens-Indexed.html#line-667" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Sequence.html#t:Seq">Seq</a></span> <a href="src/Control-Lens-Indexed.html#line-645" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/libghc-semigroups-doc/html/Data-List-NonEmpty.html#t:NonEmpty">NonEmpty</a></span> <a href="src/Control-Lens-Indexed.html#line-628" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a></span> <a href="src/Control-Lens-Indexed.html#line-661" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a> <a href="Control-Lens-Internal-Deque.html#t:Deque">Deque</a></span> <a href="src/Control-Lens-Indexed.html#line-168" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> () <a href="Control-Lens-Setter.html#t:Identity">Identity</a></span> <a href="src/Control-Lens-Indexed.html#line-603" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> () <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a></span> <a href="src/Control-Lens-Indexed.html#line-638" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i m =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="file:///usr/share/doc/libghc-comonad-doc/html/Control-Comonad-Trans-Identity.html#t:IdentityT">IdentityT</a> m)</span> <a href="src/Control-Lens-Indexed.html#line-817" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ix.html#t:Ix">Ix</a> i =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/array-0.5.1.0/Data-Array.html#t:Array">Array</a> i)</span> <a href="src/Control-Lens-Indexed.html#line-781" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="Control-Lens-Internal-Level.html#t:Level">Level</a> i)</span> <a href="src/Control-Lens-Indexed.html#line-730" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> k, <a href="file:///usr/share/doc/libghc-hashable-doc/html/Data-Hashable.html#t:Hashable">Hashable</a> k) =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> k (<a href="file:///usr/share/doc/libghc-unordered-containers-doc/html/Data-HashMap-Strict.html#t:HashMap">HashMap</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-701" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> k (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-684" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> k (<a href="file:///usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.4.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> k)</span> <a href="src/Control-Lens-Indexed.html#line-615" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Reverse.html#t:Reverse">Reverse</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-591" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Applicative-Backwards.html#t:Backwards">Backwards</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-579" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="Control-Lens-Internal-Magma.html#t:Magma">Magma</a> i t b)</span> <a href="src/Control-Lens-Indexed.html#line-751" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> [<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Int.html#t:Int">Int</a>] <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Tree.html#t:Tree">Tree</a></span> <a href="src/Control-Lens-Indexed.html#line-849" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> [i] (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Comonad-Cofree.html#t:Cofree">Cofree</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-793" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> [i] (<a href="file:///usr/share/doc/libghc-free-doc/html/Control-Monad-Free.html#t:Free">Free</a> f)</span> <a href="src/Control-Lens-Indexed.html#line-768" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f, <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> j g) =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> i j) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Product.html#t:Product">Product</a> f g)</span> <a href="src/Control-Lens-Indexed.html#line-829" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f, <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> j g) =&gt; <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> (i, j) (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Data-Functor-Compose.html#t:Compose">Compose</a> f g)</span> <a href="src/Control-Lens-Indexed.html#line-805" class="link">Source</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><h1 id="g:8">Indexed Traversable Combinators</h1><div class="top"><p class="src"><a name="v:ifor" class="def">ifor</a> :: (<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; t a -&gt; (i -&gt; a -&gt; f b) -&gt; f (t b) <a href="src/Control-Lens-Indexed.html#ifor" class="link">Source</a></p><div class="doc"><p>Traverse with an index (and the arguments flipped).</p><pre><code>for</code> a &#8801; <code><a href="Control-Lens-Indexed.html#v:ifor">ifor</a></code> a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:ifor">ifor</a></code> &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:flip">flip</a></code> <code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:imapM" class="def">imapM</a> :: (<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; (i -&gt; a -&gt; m b) -&gt; t a -&gt; m (t b) <a href="src/Control-Lens-Indexed.html#imapM" class="link">Source</a></p><div class="doc"><p>Map each element of a structure to a monadic action,
 evaluate these actions from left to right, and collect the results, with access
 the index.</p><p>When you don't need access to the index <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#v:mapM">mapM</a></code> is more liberal in what it can accept.</p><pre><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#v:mapM">mapM</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:imapM">imapM</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:iforM" class="def">iforM</a> :: (<a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m) =&gt; t a -&gt; (i -&gt; a -&gt; m b) -&gt; m (t b) <a href="src/Control-Lens-Indexed.html#iforM" class="link">Source</a></p><div class="doc"><p>Map each element of a structure to a monadic action,
 evaluate these actions from left to right, and collect the results, with access
 its position (and the arguments flipped).</p><pre><code>forM</code> a &#8801; <code><a href="Control-Lens-Indexed.html#v:iforM">iforM</a></code> a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:iforM">iforM</a></code> &#8801; <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:flip">flip</a></code> <code><a href="Control-Lens-Indexed.html#v:imapM">imapM</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:imapAccumR" class="def">imapAccumR</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t =&gt; (i -&gt; s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b) <a href="src/Control-Lens-Indexed.html#imapAccumR" class="link">Source</a></p><div class="doc"><p>Generalizes <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#v:mapAccumR">mapAccumR</a></code> to add access to the index.</p><p><code><a href="Control-Lens-Traversal.html#v:imapAccumROf">imapAccumROf</a></code> accumulates state from right to left.</p><pre><code><a href="Control-Lens-Traversal.html#v:mapAccumR">mapAccumR</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:imapAccumR">imapAccumR</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><div class="top"><p class="src"><a name="v:imapAccumL" class="def">imapAccumL</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t =&gt; (i -&gt; s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b) <a href="src/Control-Lens-Indexed.html#imapAccumL" class="link">Source</a></p><div class="doc"><p>Generalizes <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Traversable.html#v:mapAccumL">mapAccumL</a></code> to add access to the index.</p><p><code><a href="Control-Lens-Traversal.html#v:imapAccumLOf">imapAccumLOf</a></code> accumulates state from left to right.</p><pre><code><a href="Control-Lens-Traversal.html#v:mapAccumLOf">mapAccumLOf</a></code> &#8801; <code><a href="Control-Lens-Indexed.html#v:imapAccumL">imapAccumL</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:.">.</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Function.html#v:const">const</a></code>
</pre></div></div><h1 id="g:9">Indexed Folds with Reified Monoid</h1><div class="top"><p class="src"><a name="v:ifoldMapBy" class="def">ifoldMapBy</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i t =&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (i -&gt; a -&gt; r) -&gt; t a -&gt; r <a href="src/Control-Lens-Indexed.html#ifoldMapBy" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:ifoldMapByOf" class="def">ifoldMapByOf</a> :: <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i t a -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (i -&gt; a -&gt; r) -&gt; t -&gt; r <a href="src/Control-Lens-Indexed.html#ifoldMapByOf" class="link">Source</a></p></div><h1 id="g:10">Indexed Traversals with Reified Applicative</h1><div class="top"><p class="src"><a name="v:itraverseBy" class="def">itraverseBy</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i t =&gt; (<span class="keyword">forall</span> x. x -&gt; f x) -&gt; (<span class="keyword">forall</span> x y. f (x -&gt; y) -&gt; f x -&gt; f y) -&gt; (i -&gt; a -&gt; f b) -&gt; t a -&gt; f (t b) <a href="src/Control-Lens-Indexed.html#itraverseBy" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:itraverseByOf" class="def">itraverseByOf</a> :: <a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a> i s t a b -&gt; (<span class="keyword">forall</span> x. x -&gt; f x) -&gt; (<span class="keyword">forall</span> x y. f (x -&gt; y) -&gt; f x -&gt; f y) -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t <a href="src/Control-Lens-Indexed.html#itraverseByOf" class="link">Source</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>