Hoogle Search
Within LTS Haskell 24.35 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
imapOf :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> tlens Control.Lens.Setter Deprecated: Use iover
-
lens Control.Lens.Traversal Generalizes mapAccumL to an arbitrary IndexedTraversal with access to the index. imapAccumLOf accumulates state from left to right.
mapAccumLOf l ≡ imapAccumLOf l . const
imapAccumLOf :: IndexedLens i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t) imapAccumLOf :: IndexedTraversal i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
-
lens Control.Lens.Traversal Generalizes mapAccumR to an arbitrary IndexedTraversal with access to the index. imapAccumROf accumulates state from right to left.
mapAccumROf l ≡ imapAccumROf l . const
imapAccumROf :: IndexedLens i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t) imapAccumROf :: IndexedTraversal i s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
imapMOf :: Over (Indexed i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m tlens Control.Lens.Traversal Map each element of a structure targeted by a Lens to a monadic action, evaluate these actions from left to right, and collect the results, with access its position. When you don't need access to the index mapMOf is more liberal in what it can accept.
mapMOf l ≡ imapMOf l . const
imapMOf :: Monad m => IndexedLens i s t a b -> (i -> a -> m b) -> s -> m t imapMOf :: Monad m => IndexedTraversal i s t a b -> (i -> a -> m b) -> s -> m t imapMOf :: Bind m => IndexedTraversal1 i s t a b -> (i -> a -> m b) -> s -> m t
-
lens Data.Array.Lens This Setter can be used to derive a new IArray from an old IArray by applying a function to each of the indices to look it up in the old IArray. This is a contravariant Setter.
ixmap ≡ over . ixmapped ixmapped ≡ setting . ixmap over (ixmapped b) f arr ! i ≡ arr ! f i bounds (over (ixmapped b) f arr) ≡ b
-
lens Data.HashSet.Lens An Iso between a HashSet and a HashMap with unit values. <math>.
setmapped :: (Eq j, Hashable j) => IndexPreservingSetter (HashSet i) (HashSet j) i jlens Data.HashSet.Lens This Setter can be used to change the type of a HashSet by mapping the elements to new values. Sadly, you can't create a valid Traversal for a Set, but you can manipulate it by reading using folded and reindexing it via setmapped.
setmapped :: IndexPreservingSetter' IntSet Intlens Data.IntSet.Lens This Setter can be used to change the contents of an IntSet by mapping the elements to new values. Sadly, you can't create a valid Traversal for an IntSet, because the number of elements might change but you can manipulate it by reading using folded and reindexing it via setmapped.
>>> over setmapped (+1) (IntSet.fromList [1,2,3,4]) fromList [2,3,4,5]
toMapOf :: IndexedGetting i (Map i a) s a -> s -> Map i alens Data.Map.Lens Construct a map from a IndexedGetter, IndexedFold, IndexedTraversal or IndexedLens The construction is left-biased (see union), i.e. the first occurrences of keys in the fold or traversal order are preferred.
>>> toMapOf folded ["hello", "world"] fromList [(0,"hello"),(1,"world")]
>>> toMapOf (folded . ifolded) [('a',"alpha"),('b', "beta")] fromList [('a',"alpha"),('b',"beta")]>>> toMapOf (folded <.> folded) ["foo", "bar"] fromList [((0,0),'f'),((0,1),'o'),((0,2),'o'),((1,0),'b'),((1,1),'a'),((1,2),'r')]
>>> toMapOf ifolded $ Map.fromList [('a', "hello"), ('b', "world")] fromList [('a',"hello"),('b',"world")]toMapOf :: IndexedGetter i s a -> s -> Map i a toMapOf :: Ord i => IndexedFold i s a -> s -> Map i a toMapOf :: IndexedLens' i s a -> s -> Map i a toMapOf :: Ord i => IndexedTraversal' i s a -> s -> Map i a
setmapped :: Ord j => IndexPreservingSetter (Set i) (Set j) i jlens Data.Set.Lens This Setter can be used to change the type of a Set by mapping the elements to new values. Sadly, you can't create a valid Traversal for a Set, but you can manipulate it by reading using folded and reindexing it via setmapped.
>>> over setmapped (+1) (Set.fromList [1,2,3,4]) fromList [2,3,4,5]