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.

  1. (%@~) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t

    lens 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
    

  2. (%~) :: ASetter s t a b -> (a -> b) -> s -> t

    lens 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
    

  3. (%~) :: ASetter s t a b -> (a -> b) -> s -> t

    microlens 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"]
    

  4. (%?) :: forall (is :: IxList) (js :: IxList) (ks :: IxList) k k' l m s t u v a b . (AppendIndices is js ks, JoinKinds k A_Prism k', JoinKinds k' l m) => Optic k is s t (Maybe u) (Maybe v) -> Optic l js u v a b -> Optic m ks s t a b

    optics-core Data.Maybe.Optics

    Shortcut for % _Just %. Useful for composing lenses of Maybe type.

  5. (%>) :: forall k l m s t u v (is :: IxList) (js :: IxList) a b . (JoinKinds k l m, IxOptic k s t u v, NonEmptyIndices is) => Optic k is s t u v -> Optic l js u v a b -> Optic m js s t a b

    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')]
    

  6. (%%) :: forall k (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a b . AppendIndices is js ks => Optic k is s t u v -> Optic k js u v a b -> Optic k ks s t a b

    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.

  7. (%&) :: forall k (is :: IxList) s t a b l (js :: IxList) s' t' a' b' . Optic k is s t a b -> (Optic k is s t a b -> Optic l js s' t' a' b') -> Optic l js s' t' a' b'

    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"]
    

  8. (%!~) :: forall k (is :: IxList) s t a b . Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t

    optics-core Optics.Operators

    Infix version of over'.

  9. (%~) :: forall k (is :: IxList) s t a b . Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t

    optics-core Optics.Operators

    Infix version of over.

  10. (%%) :: forall k (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a b . AppendIndices is js ks => Optic k is s t u v -> Optic k js u v a b -> Optic k ks s t a b

    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.

Page 6 of many | Previous | Next