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.
-
optics-core Optics.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 (m :: Type -> Type) r a . Monad m => T r a -> (a -> a) -> StateT r m ()data-accessor Data.Accessor Infix variant of modify.
(
%= ) :: forall (m :: Type -> Type) r a . Monad m => T r a -> a -> StateT r m ()data-accessor Data.Accessor Infix variant of set.
(
%: ) :: forall (m :: Type -> Type) r a . Monad m => T r a -> (a -> a) -> StateT r m ()data-accessor Data.Accessor.MonadState Infix variant of modify.
(
%= ) :: forall (m :: Type -> Type) r a . Monad m => T r a -> a -> StateT r m ()data-accessor Data.Accessor.MonadState Infix variant of set.
(
%~ ) :: ASetter s t a b -> (a -> b) -> s -> trio RIO (%~) 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"]
(
%%@= ) :: MonadState s m => Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m rdiagrams-lib Diagrams.Prelude Adjust the target of an IndexedLens returning a supplementary result, or adjust all of the targets of an IndexedTraversal within the current state, and return a monoidal summary of the supplementary results.
l %%@= f ≡ state (l %%@~ f)
(%%@=) :: MonadState s m => IndexedLens i s s a b -> (i -> a -> (r, b)) -> s -> m r (%%@=) :: (MonadState s m, Monoid r) => IndexedTraversal i s s a b -> (i -> a -> (r, b)) -> s -> m r
(
%= ) :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()diagrams-lib Diagrams.Prelude Map over the target of a Lens or all of the targets of a Setter or Traversal in our monadic state.
>>> execState (do _1 %= f;_2 %= g) (a,b) (f a,g b)
>>> execState (do both %= f) (a,b) (f a,f b)
(%=) :: MonadState s m => Iso' s a -> (a -> a) -> m () (%=) :: MonadState s m => Lens' s a -> (a -> a) -> m () (%=) :: MonadState s m => Traversal' s a -> (a -> a) -> m () (%=) :: MonadState s m => Setter' s a -> (a -> a) -> m ()
(%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()
(
%@= ) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m ()diagrams-lib Diagrams.Prelude Adjust every target in the current state of an IndexedSetter, IndexedLens or IndexedTraversal with access to the index. When you do not need access to the index then (%=) is more liberal in what it can accept.
l %= f ≡ l %@= const f
(%@=) :: MonadState s m => IndexedSetter i s s a b -> (i -> a -> b) -> m () (%@=) :: MonadState s m => IndexedLens i s s a b -> (i -> a -> b) -> m () (%@=) :: MonadState s m => IndexedTraversal i s t a b -> (i -> a -> b) -> m ()
(
%@~ ) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> tdiagrams-lib Diagrams.Prelude 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