Hoogle Search
Within LTS Haskell 24.4 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
(
%@~ ) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> tlens Control.Lens.Setter Adjust every target of an IndexedSetter, IndexedLens or IndexedTraversal with access to the index.
(%@~) ≡ iover
When you do not need access to the index then (%~) is more liberal in what it can accept.l %~ f ≡ l %@~ const f
(%@~) :: IndexedSetter i s t a b -> (i -> a -> b) -> s -> t (%@~) :: IndexedLens i s t a b -> (i -> a -> b) -> s -> t (%@~) :: IndexedTraversal i s t a b -> (i -> a -> b) -> s -> t
(
%~ ) :: ASetter s t a b -> (a -> b) -> s -> tlens Control.Lens.Setter Modifies the target of a Lens or all of the targets of a Setter or Traversal with a user supplied function. This is an infix version of over.
fmap f ≡ mapped %~ f fmapDefault f ≡ traverse %~ f
>>> (a,b,c) & _3 %~ f (a,b,f c)
>>> (a,b) & both %~ f (f a,f b)
>>> _2 %~ length $ (1,"hello") (1,5)
>>> traverse %~ f $ [a,b,c] [f a,f b,f c]
>>> traverse %~ even $ [1,2,3] [False,True,False]
>>> traverse.traverse %~ length $ [["hello","world"],["!!!"]] [[5,5],[3]]
(%~) :: Setter s t a b -> (a -> b) -> s -> t (%~) :: Iso s t a b -> (a -> b) -> s -> t (%~) :: Lens s t a b -> (a -> b) -> s -> t (%~) :: Traversal s t a b -> (a -> b) -> s -> t
(
%~ ) :: ASetter s t a b -> (a -> b) -> s -> tmicrolens Lens.Micro (%~) applies a function to the target; an alternative explanation is that it is an inverse of sets, which turns a setter into an ordinary function. mapped %~ reverse is the same thing as fmap reverse. See over if you want a non-operator synonym. Negating the 1st element of a pair:
>>> (1,2) & _1 %~ negate (-1,2)
Turning all Lefts in a list to upper case:>>> (mapped._Left.mapped %~ toUpper) [Left "foo", Right "bar"] [Left "FOO",Right "bar"]
-
optics-core Data.Maybe.Optics Shortcut for % _Just %. Useful for composing lenses of Maybe type.
-
optics-core Optics.Indexed.Core Compose two indexed optics and drop indices of the left one. (If you want to compose a non-indexed and an indexed optic, you can just use (%).)
>>> itoListOf (ifolded %> ifolded) ["foo", "bar"] [(0,'f'),(1,'o'),(2,'o'),(0,'b'),(1,'a'),(2,'r')]
-
optics-core Optics.Internal.Optic Compose two optics of the same flavour. Normally you can simply use (%) instead, but this may be useful to help type inference if the type of one of the optics is otherwise under-constrained.
-
optics-core Optics.Internal.Optic Flipped function application, specialised to optics and binding tightly. Useful for post-composing optics transformations:
>>> toListOf (ifolded %& ifiltered (\i s -> length s <= i)) ["", "a","abc"] ["","a"]
(
%!~ ) :: forall k (is :: IxList) s t a b . Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> toptics-core Optics.Operators Infix version of over'.
(
%~ ) :: forall k (is :: IxList) s t a b . Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> toptics-core Optics.Operators Infix version of over.
-
optics-core Optics.Optic Compose two optics of the same flavour. Normally you can simply use (%) instead, but this may be useful to help type inference if the type of one of the optics is otherwise under-constrained.