-
Notifications
You must be signed in to change notification settings - Fork 268
/
Control-Lens-Indexed.html
145 lines (145 loc) · 93.3 KB
/
Control-Lens-Indexed.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!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-3.8: Lenses, Folds and Traversals</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>Rank2Types</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>Edward Kmett <ekmett@gmail.com></td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Control.Lens.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></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 => <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 -> i -> a -> b</li></ul></li><li class="src short"><span class="keyword">class</span> (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Prism.html#t:Choice">Choice</a> p, Strong p, Corepresentable p, Comonad (Corep p), <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> (Corep p), Representable p, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> (Rep p), <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (Rep p), <a href="/Users/ekmett/Library/Haskell/ghc-7.4.1/lib/distributive-0.3/doc/html/Data-Distributive.html#t:Distributive">Distributive</a> (Rep p), <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> p, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> p, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> p) => <a href="#t:Conjoined">Conjoined</a> p <span class="keyword">where</span><ul class="subs"><li><a href="#v:distrib">distrib</a> :: <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f => p a b -> p (f a) (f b)</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 -> a -> b</li></ul>}</li><li class="src short"><a href="#v:-60-.">(<.)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p => (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r</li><li class="src short"><a href="#v:-60-.-62-">(<.>)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> (i, j) p => (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -> r) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -> s -> t) -> p a b -> r</li><li class="src short"><a href="#v:.-62-">(.>)</a> :: (st -> r) -> (kab -> st) -> kab -> r</li><li class="src short"><a href="#v:reindexed">reindexed</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> j p => (i -> j) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a b -> r) -> p a b -> r</li><li class="src short"><a href="#v:icompose">icompose</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> p c => (i -> j -> p) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -> r) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -> s -> t) -> c a b -> r</li><li class="src short"><a href="#v:indexing">indexing</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> p => ((a -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f b) -> s -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f t) -> p a (f b) -> s -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> p => ((a -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f b) -> s -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f t) -> p a (f b) -> s -> f t</li><li class="src short"><span class="keyword">class</span> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f => <a href="#t:FunctorWithIndex">FunctorWithIndex</a> i f | f -> i <span class="keyword">where</span><ul class="subs"><li><a href="#v:imap">imap</a> :: (i -> a -> b) -> f a -> f b</li></ul></li><li class="src short"><a href="#v:imapped">imapped</a> :: <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f => <a href="Control-Lens-Type.html#t:IndexedSetter">IndexedSetter</a> i (f a) (f b) a b</li><li class="src short"><span class="keyword">class</span> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#t:Foldable">Foldable</a> f => <a href="#t:FoldableWithIndex">FoldableWithIndex</a> i f | f -> i <span class="keyword">where</span><ul class="subs"><li><a href="#v:ifoldMap">ifoldMap</a> :: <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> m => (i -> a -> m) -> f a -> m</li><li><a href="#v:ifoldr">ifoldr</a> :: (i -> a -> b -> b) -> b -> f a -> b</li><li><a href="#v:ifoldl">ifoldl</a> :: (i -> b -> a -> b) -> b -> f a -> b</li><li><a href="#v:ifoldr-39-">ifoldr'</a> :: (i -> a -> b -> b) -> b -> f a -> b</li><li><a href="#v:ifoldl-39-">ifoldl'</a> :: (i -> b -> a -> b) -> b -> f a -> b</li></ul></li><li class="src short"><a href="#v:ifolded">ifolded</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i (f a) a</li><li class="src short"><a href="#v:ifolding">ifolding</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => (s -> f a) -> <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i s a</li><li class="src short"><a href="#v:iany">iany</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => (i -> a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> f a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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 => (i -> a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> f a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => (i -> a -> f b) -> t a -> f <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => t a -> (i -> a -> f b) -> f <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> a -> m b) -> t a -> m <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => t a -> (i -> a -> m b) -> m <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:iconcatMap">iconcatMap</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => (i -> a -> [b]) -> f a -> [b]</li><li class="src short"><a href="#v:ifind">ifind</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => (i -> a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> f a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> a -> b -> m b) -> b -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> b -> a -> m b) -> b -> f a -> 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 => f a -> [(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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f) => <a href="Control-Lens-Type.html#t:Overloading">Overloading</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f s t (i, s) (j, 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f, <a href="Control-Lens-Internal-Getter.html#t:Gettable">Gettable</a> f) => <a href="Control-Lens-Type.html#t:Overloading-39-">Overloading'</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f s i</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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => (i -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Control-Lens-Type.html#t:Overloading-39-">Overloading'</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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> i, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => i -> <a href="Control-Lens-Type.html#t:Overloading-39-">Overloading'</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) => <a href="#t:TraversableWithIndex">TraversableWithIndex</a> i t | t -> i <span class="keyword">where</span><ul class="subs"><li><a href="#v:itraverse">itraverse</a> :: <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f => (i -> a -> f b) -> t a -> f (t b)</li></ul></li><li class="src short"><a href="#v:itraversed">itraversed</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f => <a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a> i (f a) (f b) a b</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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => t a -> (i -> a -> f b) -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> a -> m b) -> t a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => t a -> (i -> a -> m b) -> 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 => (i -> s -> a -> (s, b)) -> s -> t a -> (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 => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)</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 => <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 -> i -> a -> 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"><a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i (->)</td><td class="doc empty"> </td></tr><tr><td class="src">~ * i j => <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> p, <a href="Control-Lens-Prism.html#t:Choice">Choice</a> p, Strong p, Corepresentable p, Comonad (Corep p), <a href="Control-Lens-Traversal.html#t:Traversable">Traversable</a> (Corep p), Representable p, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> (Rep p), <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (Rep p), <a href="/Users/ekmett/Library/Haskell/ghc-7.4.1/lib/distributive-0.3/doc/html/Data-Distributive.html#t:Distributive">Distributive</a> (Rep p), <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> p, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> p, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> p) => <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="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:distrib" class="def">distrib</a> :: <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f => p a b -> p (f a) (f b)<a href="src/Control-Lens-Internal-Indexed.html#distrib" class="link">Source</a></p></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"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> (->)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </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 -> i -> a -> 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"> </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 -> a -> b</dt><dd class="doc empty"> </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">~ * i j => <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Category.html#t:Category">Category</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Iso.html#t:Profunctor">Profunctor</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src">Strong (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Prism.html#t:Choice">Choice</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src">Representable (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src">Corepresentable (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:Conjoined">Conjoined</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Internal-Bazaar.html#t:Bizarre">Bizarre</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a>) <a href="Control-Lens-Internal-Magma.html#t:Mafic">Mafic</a></td><td class="doc empty"> </td></tr><tr><td class="src"><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)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-Fix.html#t:MonadFix">MonadFix</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:-60-." class="def">(<.)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> i p => (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r<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><</code> points to the indexing we want to preserve.
</p></div></div><div class="top"><p class="src"><a name="v:-60-.-62-" class="def">(<.>)</a> :: <a href="Control-Lens-Indexed.html#t:Indexable">Indexable</a> (i, j) p => (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -> r) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -> s -> t) -> p a b -> r<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><</code> and <code>></code> points to the fact that we want to preserve the indices.
</p></div></div><div class="top"><p class="src"><a name="v:.-62-" class="def">(.>)</a> :: (st -> r) -> (kab -> st) -> kab -> r<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>></code> points to the indexing we want to preserve.
</p><p>This is the same as <code>(<code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code>)</code>. <code>f <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> g</code> gives you the index of <code>g</code>.
</p></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 => (i -> j) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i a b -> r) -> p a b -> 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 => (i -> j -> p) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i s t -> r) -> (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> j a b -> s -> t) -> c a b -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> p => ((a -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f b) -> s -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a> f t) -> p a (f b) -> s -> 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#t:Traversal">Traversal</a></code> into an <code><a href="Control-Lens-Traversal.html#t:IndexedTraversal">IndexedTraversal</a></code> or
a <code><a href="Control-Lens-Fold.html#t:Fold">Fold</a></code> into an <code><a href="Control-Lens-Fold.html#t: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#t:Traversal">Traversal</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Prism">Prism</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Lens">Lens</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedLens">IndexedLens</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Iso">Iso</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedLens">IndexedLens</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Fold">Fold</a></code> s a -> <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Getter">Getter</a></code> s a -> <code><a href="Control-Lens-Type.html#t:IndexedGetter">IndexedGetter</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a></code> p => <code><a href="Control-Lens-Type.html#t:LensLike">LensLike</a></code> (<code><a href="Control-Lens-Internal-Indexed.html#t:Indexing">Indexing</a></code> f) s t a b -> <code><a href="Control-Lens-Type.html#t:Overloading">Overloading</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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a> p => ((a -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f b) -> s -> <a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a> f t) -> p a (f b) -> s -> 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#t:Traversal">Traversal</a></code> into an <code><a href="Control-Lens-Traversal.html#t:IndexedTraversal">IndexedTraversal</a></code> or
a <code><a href="Control-Lens-Fold.html#t:Fold">Fold</a></code> into an <code><a href="Control-Lens-Fold.html#t: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#t:Traversal">Traversal</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Prism">Prism</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Lens">Lens</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedLens">IndexedLens</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Iso">Iso</a></code> s t a b -> <code><a href="Control-Lens-Type.html#t:IndexedLens">IndexedLens</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Fold">Fold</a></code> s a -> <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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#t:Getter">Getter</a></code> s a -> <code><a href="Control-Lens-Type.html#t:IndexedGetter">IndexedGetter</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int64">Int64</a></code> p => <code><a href="Control-Lens-Type.html#t:LensLike">LensLike</a></code> (<code><a href="Control-Lens-Internal-Indexed.html#t:Indexing64">Indexing64</a></code> f) s t a b -> <code><a href="Control-Lens-Type.html#t:Overloading">Overloading</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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f => <a name="t:FunctorWithIndex" class="def">FunctorWithIndex</a> i f | f -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a></code> with an additional index.
</p><p>Instances must satisfy a modified form of the <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> g ≡ <code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> (\i -> f i <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> g i)
<code><a href="Control-Lens-Indexed.html#v:imap">imap</a></code> (\_ a -> a) ≡ <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:id">id</a></code>
</pre></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:imap" class="def">imap</a> :: (i -> a -> b) -> f a -> 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></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"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> []</td><td class="doc"><p>The position in the list is available as the index.
</p></td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Sequence.html#t:Seq">Seq</a></td><td class="doc"><p>The position in the <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Sequence.html#t:Seq">Seq</a></code> is available as the index.
</p></td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-IntMap.html#t:IntMap">IntMap</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> Vector</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="Control-Lens-Internal-Deque.html#t:Deque">Deque</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> () <a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="Control-Lens-Internal-Level.html#t:Level">Level</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> r ((->) r)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> k, Hashable k) => <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> k (HashMap k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> k (<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Map.html#t:Map">Map</a> k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> k (<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f => <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Reverse.html#t:Reverse">Reverse</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f => <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Control-Applicative-Backwards.html#t:Backwards">Backwards</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i (<a href="Control-Lens-Internal-Zipper.html#t:Jacket">Jacket</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><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)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:imapped" class="def">imapped</a> :: <a href="Control-Lens-Indexed.html#t:FunctorWithIndex">FunctorWithIndex</a> i f => <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><h1 id="g:3">Indexed Foldables
</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#t:Foldable">Foldable</a> f => <a name="t:FoldableWithIndex" class="def">FoldableWithIndex</a> i f | f -> 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 methods"><p class="caption">Methods</p><p class="src"><a name="v:ifoldMap" class="def">ifoldMap</a> :: <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> m => (i -> a -> m) -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldMap">foldMap</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldMap">foldMap</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifoldMap">ifoldMap</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code></pre></div><p class="src"><a name="v:ifoldr" class="def">ifoldr</a> :: (i -> a -> b -> b) -> b -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldr">foldr</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldr">foldr</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifoldr">ifoldr</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code></pre></div><p class="src"><a name="v:ifoldl" class="def">ifoldl</a> :: (i -> b -> a -> b) -> b -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldl">foldl</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldl">foldl</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifoldl">ifoldl</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code></pre></div><p class="src"><a name="v:ifoldr-39-" class="def">ifoldr'</a> :: (i -> a -> b -> b) -> b -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Map.html#v:foldr-39-">foldr'</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Map.html#v:foldr-39-">foldr'</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifoldr-39-">ifoldr'</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code></pre></div><p class="src"><a name="v:ifoldl-39-" class="def">ifoldl'</a> :: (i -> b -> a -> b) -> b -> f a -> 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 ≡ <code><a href="Control-Lens-Fold.html#v:ifoldlOf-39-">ifoldlOf'</a></code> l <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> []</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Sequence.html#t:Seq">Seq</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-IntMap.html#t:IntMap">IntMap</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> Vector</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="Control-Lens-Internal-Deque.html#t:Deque">Deque</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> () <a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="Control-Lens-Internal-Level.html#t:Level">Level</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> k, Hashable k) => <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> k (HashMap k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> k (<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Map.html#t:Map">Map</a> k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> k (<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Reverse.html#t:Reverse">Reverse</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Control-Applicative-Backwards.html#t:Backwards">Backwards</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i (<a href="Control-Lens-Internal-Zipper.html#t:Jacket">Jacket</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><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)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:ifolded" class="def">ifolded</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => <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></div></div><div class="top"><p class="src"><a name="v:ifolding" class="def">ifolding</a> :: <a href="Control-Lens-Indexed.html#t:FoldableWithIndex">FoldableWithIndex</a> i f => (s -> f a) -> <a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a> i s a<a href="src/Control-Lens-Indexed.html#ifolding" class="link">Source</a></p><div class="doc"><p>Obtain a <code><a href="Control-Lens-Type.html#t:Fold">Fold</a></code> by lifting an operation that returns a <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#t:Foldable">Foldable</a></code> result.
</p><p>This can be useful to lift operations from <code><code><a href="Data.html#t:List">List</a></code></code> and elsewhere into a <code><a href="Control-Lens-Type.html#t:Fold">Fold</a></code>.
</p></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 => (i -> a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> f a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:any">any</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:any">any</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:iany">iany</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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 => (i -> a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> f a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:all">all</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:all">all</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:iall">iall</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code></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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => (i -> a -> f b) -> t a -> f <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:traverse_">traverse_</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => t a -> (i -> a -> f b) -> f <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><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> ≡ <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:for_">for_</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:for_">for_</a></code> a ≡ <code><a href="Control-Lens-Indexed.html#v:ifor_">ifor_</a></code> a <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> a -> m b) -> t a -> m <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><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#t: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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:mapM_">mapM_</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:imapM">imapM</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => t a -> (i -> a -> m b) -> m <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><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#t: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> ≡ <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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 ≡ <code><a href="Control-Lens-Traversal.html#v:iforMOf">iforMOf</a></code> l a <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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 => (i -> a -> [b]) -> f a -> [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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:concatMap">concatMap</a></code> is more flexible in what it accepts.
</p><pre>
<code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:concatMap">concatMap</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:iconcatMap">iconcatMap</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:iconcatMap">iconcatMap</a></code> ≡ <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 => (i -> a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> f a -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:find">find</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:find">find</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifind">ifind</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> a -> b -> m b) -> b -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldrM">foldrM</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldrM">foldrM</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifoldrM">ifoldrM</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> b -> a -> m b) -> b -> f a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldlM">foldlM</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:foldlM">foldlM</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:ifoldlM">ifoldlM</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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 => f a -> [(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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:toList">toList</a></code> is more flexible in what it accepts.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Foldable.html#v:toList">toList</a></code> ≡ <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-List.html#v:map">map</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Tuple.html#v:fst">fst</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f) => <a href="Control-Lens-Type.html#t:Overloading">Overloading</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f s t (i, s) (j, t)<a href="src/Control-Lens-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><a href="Control-Lens-Type.html#t:Traversal">Traversal</a></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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> f, <a href="Control-Lens-Internal-Getter.html#t:Gettable">Gettable</a> f) => <a href="Control-Lens-Type.html#t:Overloading-39-">Overloading'</a> p (<a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a> i) f s i<a href="src/Control-Lens-Indexed.html#asIndex" class="link">Source</a></p><div class="doc"><p>When composed with an <code><a href="Control-Lens-Type.html#t:IndexedFold">IndexedFold</a></code> or <code><a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a></code> this yields an
(<code><a href="Control-Lens-Indexed.html#t:Indexed">Indexed</a></code>) <code><a href="Control-Lens-Type.html#t:Fold">Fold</a></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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => (i -> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Control-Lens-Type.html#t:Overloading-39-">Overloading'</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">>>> </code><strong class="userinput"><code>["hello","the","world","!!!"]^..traversed.indices even
</code></strong>["hello","world"]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>over (traversed.indices (>0)) Prelude.reverse $ ["He","was","stressed","o_O"]
</code></strong>["He","saw","desserts","O_o"]
</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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> i, <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => i -> <a href="Control-Lens-Type.html#t:Overloading-39-">Overloading'</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">>>> </code><strong class="userinput"><code>["hello","the","world","!!!"]^?traversed.index 2
</code></strong>Just "world"
</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) => <a name="t:TraversableWithIndex" class="def">TraversableWithIndex</a> i t | t -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code> <code><a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></code>) ≡ <code><a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></code>
<code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fmap">fmap</a></code> (<code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> f) <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> g ≡ <code><a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Compose.html#v:getCompose">getCompose</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="Control-Lens-Indexed.html#v:itraverse">itraverse</a></code> (\i -> <code><a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Compose.html#t:Compose">Compose</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#v:fmap">fmap</a></code> (f i) <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> g i)
</pre></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:itraverse" class="def">itraverse</a> :: <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f => (i -> a -> f b) -> t a -> 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></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"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> []</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Sequence.html#t:Seq">Seq</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-IntMap.html#t:IntMap">IntMap</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> Vector</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> <a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Int.html#t:Int">Int</a> <a href="Control-Lens-Internal-Deque.html#t:Deque">Deque</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> () <a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Identity.html#t:Identity">Identity</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="Control-Lens-Internal-Level.html#t:Level">Level</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src">(<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Eq.html#t:Eq">Eq</a> k, Hashable k) => <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> k (HashMap k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> k (<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/containers-0.4.2.1/Data-Map.html#t:Map">Map</a> k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> k (<a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--44--41-">(,)</a> k)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f => <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Data-Functor-Reverse.html#t:Reverse">Reverse</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f => <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="/Library/Haskell/ghc-7.4.1/lib/transformers-0.3.0.0/doc/html/Control-Applicative-Backwards.html#t:Backwards">Backwards</a> f)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i (<a href="Control-Lens-Internal-Zipper.html#t:Jacket">Jacket</a> i)</td><td class="doc empty"> </td></tr><tr><td class="src"><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)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:itraversed" class="def">itraversed</a> :: <a href="Control-Lens-Indexed.html#t:TraversableWithIndex">TraversableWithIndex</a> i f => <a href="Control-Lens-Type.html#t:IndexedTraversal">IndexedTraversal</a> i (f a) (f 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><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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) => t a -> (i -> a -> f b) -> 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><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Traversable.html#v:for">for</a></code> a ≡ <code><a href="Control-Lens-Indexed.html#v:ifor">ifor</a></code> a <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:ifor">ifor</a></code> ≡ <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => (i -> a -> m b) -> t a -> 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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Traversable.html#v:mapM">mapM</a></code> is more liberal in what it can accept.
</p><pre><code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Traversable.html#v:mapM">mapM</a></code> ≡ <code><a href="Control-Lens-Indexed.html#v:imapM">imapM</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Monad">Monad</a> m) => t a -> (i -> a -> m b) -> 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><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Traversable.html#v:forM">forM</a></code> a ≡ <code><a href="Control-Lens-Indexed.html#v:iforM">iforM</a></code> a <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code>
<code><a href="Control-Lens-Indexed.html#v:iforM">iforM</a></code> ≡ <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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 => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)<a href="src/Control-Lens-Indexed.html#imapAccumR" class="link">Source</a></p><div class="doc"><p>Generalizes <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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> ≡ <code><a href="Control-Lens-Indexed.html#v:imapAccumR">imapAccumR</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.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 => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)<a href="src/Control-Lens-Indexed.html#imapAccumL" class="link">Source</a></p><div class="doc"><p>Generalizes <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.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> ≡ <code><a href="Control-Lens-Indexed.html#v:imapAccumL">imapAccumL</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:.">.</a></code> <code><a href="/Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Prelude.html#v:const">const</a></code></pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>