| Portability | rank 2 types, MPTCs, TFs, flexible | 
|---|---|
| Stability | provisional | 
| Maintainer | Edward Kmett <ekmett@gmail.com> | 
| Safe Haskell | Safe-Infered | 
Control.Lens.IndexedFold
Description
- type IndexedFold i a c = forall k f. (Indexed i k, Applicative f, Gettable f) => k (c -> f c) (a -> f a)
- ifoldMapOf :: IndexedGetting i m a c -> (i -> c -> m) -> a -> m
- ifoldrOf :: IndexedGetting i (Endo e) a c -> (i -> c -> e -> e) -> e -> a -> e
- ifoldlOf :: IndexedGetting i (Dual (Endo e)) a c -> (i -> e -> c -> e) -> e -> a -> e
- ianyOf :: IndexedGetting i Any a c -> (i -> c -> Bool) -> a -> Bool
- iallOf :: IndexedGetting i All a c -> (i -> c -> Bool) -> a -> Bool
- itraverseOf_ :: Functor f => IndexedGetting i (Traversed f) a c -> (i -> c -> f e) -> a -> f ()
- iforOf_ :: Functor f => IndexedGetting i (Traversed f) a c -> a -> (i -> c -> f e) -> f ()
- imapMOf_ :: Monad m => IndexedGetting i (Sequenced m) a c -> (i -> c -> m e) -> a -> m ()
- iforMOf_ :: Monad m => IndexedGetting i (Sequenced m) a c -> a -> (i -> c -> m e) -> m ()
- iconcatMapOf :: IndexedGetting i [e] a c -> (i -> c -> [e]) -> a -> [e]
- ifindOf :: IndexedGetting i (First (i, c)) a c -> (i -> c -> Bool) -> a -> Maybe (i, c)
- ifoldrOf' :: IndexedGetting i (Dual (Endo (e -> e))) a c -> (i -> c -> e -> e) -> e -> a -> e
- ifoldlOf' :: IndexedGetting i (Endo (e -> e)) a c -> (i -> e -> c -> e) -> e -> a -> e
- ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (e -> m e))) a c -> (i -> c -> e -> m e) -> e -> a -> m e
- ifoldlMOf :: Monad m => IndexedGetting i (Endo (e -> m e)) a c -> (i -> e -> c -> m e) -> e -> a -> m e
- itoListOf :: IndexedGetting i [(i, c)] a c -> a -> [(i, c)]
- ifiltered :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> Index i (c -> f c) (a -> f a) -> k (c -> f c) (a -> f a)
- itakingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> IndexedGetting i (Endo (f a)) a c -> k (c -> f c) (a -> f a)
- idroppingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> IndexedGetting i (Endo (f a)) a c -> k (c -> f c) (a -> f a)
Indexed Folds
type IndexedFold i a c = forall k f. (Indexed i k, Applicative f, Gettable f) => k (c -> f c) (a -> f a)Source
Every IndexedFold is a valid Fold.
Consuming Indexed Folds
ifoldMapOf :: IndexedGetting i m a c -> (i -> c -> m) -> a -> mSource
Fold an IndexedFold or IndexedTraversal by mapping indices and values to an arbitrary Monoid with access
 to the index i.
When you don't need access to the index then foldMapOf is more flexible in what it accepts.
foldMapOfl =ifoldMapOfl .const
ifoldMapOf ::IndexedGetteri a c -> (i -> c -> m) -> a -> m ifoldMapOf ::Monoidm =>IndexedFoldi a c -> (i -> c -> m) -> a -> m ifoldMapOf ::SimpleIndexedLensi a c -> (i -> c -> m) -> a -> m ifoldMapOf ::Monoidm =>SimpleIndexedTraversali a c -> (i -> c -> m) -> a -> m
ifoldrOf :: IndexedGetting i (Endo e) a c -> (i -> c -> e -> e) -> e -> a -> eSource
Right-associative fold of parts of a structure that are viewed through an IndexedFold or IndexedTraversal with
 access to the index i.
When you don't need access to the index then foldrOf is more flexible in what it accepts.
foldrOfl =ifoldrOfl .const
ifoldrOf ::IndexedGetteri a c -> (i -> c -> e -> e) -> e -> a -> e ifoldrOf ::IndexedFoldi a c -> (i -> c -> e -> e) -> e -> a -> e ifoldrOf ::SimpleIndexedLensi a c -> (i -> c -> e -> e) -> e -> a -> e ifoldrOf ::SimpleIndexedTraversali a c -> (i -> c -> e -> e) -> e -> a -> e
ifoldlOf :: IndexedGetting i (Dual (Endo e)) a c -> (i -> e -> c -> e) -> e -> a -> eSource
Left-associative fold of the parts of a structure that are viewed through an IndexedFold or IndexedTraversal with
 access to the index i.
When you don't need access to the index then foldlOf is more flexible in what it accepts.
foldlOfl =ifoldlOfl .const
ifoldlOf ::IndexedGetteri a c -> (i -> e -> c -> e) -> e -> a -> e ifoldlOf ::IndexedFoldi a c -> (i -> e -> c -> e) -> e -> a -> e ifoldlOf ::SimpleIndexedLensi a c -> (i -> e -> c -> e) -> e -> a -> e ifoldlOf ::SimpleIndexedTraversali a c -> (i -> e -> c -> e) -> e -> a -> e
ianyOf :: IndexedGetting i Any a c -> (i -> c -> Bool) -> a -> BoolSource
Return whether or not any element viewed through an IndexedFold or IndexedTraversal 
 satisfy a predicate, with access to the index i.
When you don't need access to the index then anyOf is more flexible in what it accepts.
anyOfl =ianyOfl .const
ianyOf ::IndexedGetteri a c -> (i -> c ->Bool) -> a ->BoolianyOf ::IndexedFoldi a c -> (i -> c ->Bool) -> a ->BoolianyOf ::SimpleIndexedLensi a c -> (i -> c ->Bool) -> a ->BoolianyOf ::SimpleIndexedTraversali a c -> (i -> c ->Bool) -> a ->Bool
iallOf :: IndexedGetting i All a c -> (i -> c -> Bool) -> a -> BoolSource
Return whether or not all elements viewed through an IndexedFold or IndexedTraversal 
 satisfy a predicate, with access to the index i.
When you don't need access to the index then allOf is more flexible in what it accepts.
allOfl =iallOfl .const
iallOf ::IndexedGetteri a c -> (i -> c ->Bool) -> a ->BooliallOf ::IndexedFoldi a c -> (i -> c ->Bool) -> a ->BooliallOf ::SimpleIndexedLensi a c -> (i -> c ->Bool) -> a ->BooliallOf ::SimpleIndexedTraversali a c -> (i -> c ->Bool) -> a ->Bool
itraverseOf_ :: Functor f => IndexedGetting i (Traversed f) a c -> (i -> c -> f e) -> a -> f ()Source
Traverse the targets of an IndexedFold or IndexedTraversal with access to the index i, discarding the results.
When you don't need access to the index then traverseOf_ is more flexible in what it accepts.
traverseOf_l =itraverseOfl .const
itraverseOf_ ::Functorf =>IndexedGetteri a c -> (i -> c -> f e) -> a -> f () itraverseOf_ ::Applicativef =>IndexedFoldi a c -> (i -> c -> f e) -> a -> f () itraverseOf_ ::Functorf =>SimpleIndexedLensi a c -> (i -> c -> f e) -> a -> f () itraverseOf_ ::Applicativef =>SimpleIndexedTraversali a c -> (i -> c -> f e) -> a -> f ()
iforOf_ :: Functor f => IndexedGetting i (Traversed f) a c -> a -> (i -> c -> f e) -> f ()Source
Traverse the targets of an IndexedFold or IndexedTraversal with access to the index, discarding the results
 (with the arguments flipped).
iforOf_=flip.itraverseOf_
When you don't need access to the index then forOf_ is more flexible in what it accepts.
forOf_l a =iforOfl a .const
iforOf_ ::Functorf =>IndexedGetteri a c -> a -> (i -> c -> f e) -> f () iforOf_ ::Applicativef =>IndexedFoldi a c -> a -> (i -> c -> f e) -> f () iforOf_ ::Functorf =>SimpleIndexedLensi a c -> a -> (i -> c -> f e) -> f () iforOf_ ::Applicativef =>SimpleIndexedTraversali a c -> a -> (i -> c -> f e) -> f ()
imapMOf_ :: Monad m => IndexedGetting i (Sequenced m) a c -> (i -> c -> m e) -> a -> m ()Source
Run monadic actions for each target of an IndexedFold or IndexedTraversal with access to the index,
 discarding the results.
When you don't need access to the index then mapMOf_ is more flexible in what it accepts.
mapMOf_l =imapMOfl .const
imapMOf_ ::Monadm =>IndexedGetteri a c -> (i -> c -> m e) -> a -> m () imapMOf_ ::Monadm =>IndexedFoldi a c -> (i -> c -> m e) -> a -> m () imapMOf_ ::Monadm =>SimpleIndexedLensi a c -> (i -> c -> m e) -> a -> m () imapMOf_ ::Monadm =>SimpleIndexedTraversali a c -> (i -> c -> m e) -> a -> m ()
iforMOf_ :: Monad m => IndexedGetting i (Sequenced m) a c -> a -> (i -> c -> m e) -> m ()Source
Run monadic actions for each target of an IndexedFold or IndexedTraversal with access to the index,
 discarding the results (with the arguments flipped).
iforMOf_=flip.imapMOf_
When you don't need access to the index then forMOf_ is more flexible in what it accepts.
forMOf_l a =iforMOfl a .const
iforMOf_ ::Monadm =>IndexedGetteri a c -> a -> (i -> c -> m e) -> m () iforMOf_ ::Monadm =>IndexedFoldi a c -> a -> (i -> c -> m e) -> m () iforMOf_ ::Monadm =>SimpleIndexedLensi a c -> a -> (i -> c -> m e) -> m () iforMOf_ ::Monadm =>SimpleIndexedTraversali a c -> a -> (i -> c -> m e) -> m ()
iconcatMapOf :: IndexedGetting i [e] a c -> (i -> c -> [e]) -> a -> [e]Source
Concatenate the results of a function of the elements of an IndexedFold or IndexedTraversal
 with access to the index.
When you don't need access to the index then concatMapOf_  is more flexible in what it accepts.
concatMapOf_l =iconcatMapMOfl .const
iconcatMapOf ::IndexedGetteri a c -> (i -> c -> [e]) -> a -> [e] iconcatMapOf ::IndexedFoldi a c -> (i -> c -> [e]) -> a -> [e] iconcatMapOf ::SimpleIndexedLensi a c -> (i -> c -> [e]) -> a -> [e] iconcatMapOf ::SimpleIndexedTraversali a c -> (i -> c -> [e]) -> a -> [e]
ifindOf :: IndexedGetting i (First (i, c)) a c -> (i -> c -> Bool) -> a -> Maybe (i, c)Source
The findOf function takes an IndexedFold or IndexedTraversal, a predicate that is also
 supplied the index, a structure and returns the left-most element of the structure
 matching the predicate, or Nothing if there is no such element.
When you don't need access to the index then findOf is more flexible in what it accepts.
findOfl =ifoldOfl .const
ifindOf ::IndexedGettera c -> (i -> c ->Bool) -> a ->Maybe(i, c) ifindOf ::IndexedFolda c -> (i -> c ->Bool) -> a ->Maybe(i, c) ifindOf ::SimpleIndexedLensa c -> (i -> c ->Bool) -> a ->Maybe(i, c) ifindOf ::SimpleIndexedTraversala c -> (i -> c ->Bool) -> a ->Maybe(i, c)
ifoldrOf' :: IndexedGetting i (Dual (Endo (e -> e))) a c -> (i -> c -> e -> e) -> e -> a -> eSource
Strictly fold right over the elements of a structure with an index.
When you don't need access to the index then foldrOf' is more flexible in what it accepts.
foldrOf'l =ifoldrOf'l .const
ifoldrOf' ::IndexedGetteri a c -> (i -> c -> e -> e) -> e -> a -> e ifoldrOf' ::IndexedFoldi a c -> (i -> c -> e -> e) -> e -> a -> e ifoldrOf' ::SimpleIndexedLensi a c -> (i -> c -> e -> e) -> e -> a -> e ifoldrOf' ::SimpleIndexedTraversali a c -> (i -> c -> e -> e) -> e -> a -> e
ifoldlOf' :: IndexedGetting i (Endo (e -> e)) a c -> (i -> e -> c -> e) -> e -> a -> eSource
Fold over the elements of a structure with an index, associating to the left, but strictly.
When you don't need access to the index then foldlOf' is more flexible in what it accepts.
foldlOf'l =ifoldlOf'l .const
ifoldlOf' ::IndexedGetteri a c -> (i -> e -> c -> e) -> e -> a -> e ifoldlOf' ::IndexedFoldi a c -> (i -> e -> c -> e) -> e -> a -> e ifoldlOf' ::SimpleIndexedLensi a c -> (i -> e -> c -> e) -> e -> a -> e ifoldlOf' ::SimpleIndexedTraversali a c -> (i -> e -> c -> e) -> e -> a -> e
ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (e -> m e))) a c -> (i -> c -> e -> m e) -> e -> a -> m eSource
Monadic fold right over the elements of a structure with an index.
When you don't need access to the index then foldrMOf is more flexible in what it accepts.
foldrMOfl =ifoldrMOfl .const
ifoldrMOf ::Monadm =>IndexedGetteri a c -> (i -> c -> e -> m e) -> e -> a -> e ifoldrMOf ::Monadm =>IndexedFoldi a c -> (i -> c -> e -> m e) -> e -> a -> e ifoldrMOf ::Monadm =>SimpleIndexedLensi a c -> (i -> c -> e -> m e) -> e -> a -> e ifoldrMOf ::Monadm =>SimpleIndexedTraversali a c -> (i -> c -> e -> m e) -> e -> a -> e
ifoldlMOf :: Monad m => IndexedGetting i (Endo (e -> m e)) a c -> (i -> e -> c -> m e) -> e -> a -> m eSource
Monadic fold over the elements of a structure with an index, associating to the left.
When you don't need access to the index then foldlMOf is more flexible in what it accepts.
foldlMOfl =ifoldlMOfl .const
ifoldlOf' ::Monadm =>IndexedGetteri a c -> (i -> e -> c -> m e) -> e -> a -> e ifoldlOf' ::Monadm =>IndexedFoldi a c -> (i -> e -> c -> m e) -> e -> a -> e ifoldlOf' ::Monadm =>SimpleIndexedLensi a c -> (i -> e -> c -> m e) -> e -> a -> e ifoldlOf' ::Monadm =>SimpleIndexedTraversali a c -> (i -> e -> c -> m e) -> e -> a -> e
itoListOf :: IndexedGetting i [(i, c)] a c -> a -> [(i, c)]Source
Extract the key-value pairs from a structure.
When you don't need access to the indices in the result, then toListOf is more flexible in what it accepts.
toListOfl =mapfst.itoListOfl
itoListOf ::IndexedGetteri a c -> a -> [(i,c)] itoListOf ::IndexedFoldi a c -> a -> [(i,c)] itoListOf ::SimpleIndexedLensi a c -> a -> [(i,c)] itoListOf ::SimpleIndexedTraversali a c -> a -> [(i,c)]
Building Indexed Folds
ifiltered :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> Index i (c -> f c) (a -> f a) -> k (c -> f c) (a -> f a)Source
Obtain an IndexedFold by filtering a IndexedLens, IndexedGetter, IndexedFold or IndexedTraversal.
itakingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> IndexedGetting i (Endo (f a)) a c -> k (c -> f c) (a -> f a)Source
Obtain an IndexedFold by taking elements from another IndexedFold, IndexedLens, IndexedGetter or IndexedTraversal while a predicate holds.
idroppingWhile :: (Gettable f, Applicative f, Indexed i k) => (i -> c -> Bool) -> IndexedGetting i (Endo (f a)) a c -> k (c -> f c) (a -> f a)Source
Obtain an IndexedFold by dropping elements from another IndexedFold, IndexedLens, IndexedGetter or IndexedTraversal while a predicate holds.