Hoogle Search

Within LTS Haskell 24.20 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. (^@..) :: s -> IndexedGetting i (Endo [(i, a)]) s a -> [(i, a)]

    lens Control.Lens.Fold

    An infix version of itoListOf.

  2. (^.) :: s -> Getting a s a -> a

    lens Control.Lens.Getter

    View the value pointed to by a Getter or Lens or the result of folding over all the results of a Fold or Traversal that points at a monoidal values. This is the same operation as view with the arguments flipped. The fixity and semantics are such that subsequent field accesses can be performed with (.).

    >>> (a,b)^._2
    b
    
    >>> ("hello","world")^._2
    "world"
    
    >>> import Data.Complex
    
    >>> ((0, 1 :+ 2), 3)^._1._2.to magnitude
    2.23606797749979
    
    (^.) ::             s -> Getter s a     -> a
    (^.) :: Monoid m => s -> Fold s m       -> m
    (^.) ::             s -> Iso' s a       -> a
    (^.) ::             s -> Lens' s a      -> a
    (^.) :: Monoid m => s -> Traversal' s m -> m
    

  3. (^@.) :: s -> IndexedGetting i (i, a) s a -> (i, a)

    lens Control.Lens.Getter

    View the index and value of an IndexedGetter or IndexedLens. This is the same operation as iview with the arguments flipped. The fixity and semantics are such that subsequent field accesses can be performed with (.).

    (^@.) :: s -> IndexedGetter i s a -> (i, a)
    (^@.) :: s -> IndexedLens' i s a  -> (i, a)
    
    The result probably doesn't have much meaning when applied to an IndexedFold.

  4. (<.) :: Indexable i p => (Indexed i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r

    lens Control.Lens.Indexed

    Compose an Indexed function with a non-indexed function. Mnemonically, the < points to the indexing we want to preserve.

    >>> let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
    
    >>> nestedMap^..(itraversed<.itraversed).withIndex
    [(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")]
    

  5. (<.>) :: Indexable (i, j) p => (Indexed i s t -> r) -> (Indexed j a b -> s -> t) -> p a b -> r

    lens Control.Lens.Indexed

    Composition of Indexed functions. Mnemonically, the < and > points to the fact that we want to preserve the indices.

    >>> let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
    
    >>> nestedMap^..(itraversed<.>itraversed).withIndex
    [((1,10),"one,ten"),((1,20),"one,twenty"),((2,30),"two,thirty"),((2,40),"two,forty")]
    

  6. (<<.=) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m a

    lens Control.Lens.Lens

    Replace the target of a Lens into your Monad's state with a user supplied value and return the old value that was replaced. When applied to a Traversal, this will return a monoidal summary of all of the old values present. When you do not need the result of the operation, (.=) is more flexible.

    (<<.=) :: MonadState s m             => Lens' s a      -> a -> m a
    (<<.=) :: MonadState s m             => Iso' s a       -> a -> m a
    (<<.=) :: (MonadState s m, Monoid a) => Traversal' s a -> a -> m a
    

  7. (<<.~) :: LensLike ((,) a) s t a b -> b -> s -> (a, t)

    lens Control.Lens.Lens

    Replace the target of a Lens, but return the old value. When you do not need the old value, (.~) is more flexible.

    (<<.~) ::             Lens s t a b      -> b -> s -> (a, t)
    (<<.~) ::             Iso s t a b       -> b -> s -> (a, t)
    (<<.~) :: Monoid a => Traversal s t a b -> b -> s -> (a, t)
    

  8. (<.) :: Indexable i p => (Indexed i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r

    lens Control.Lens.Operators

    Compose an Indexed function with a non-indexed function. Mnemonically, the < points to the indexing we want to preserve.

    >>> let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
    
    >>> nestedMap^..(itraversed<.itraversed).withIndex
    [(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")]
    

  9. (<.=) :: MonadState s m => ASetter s s a b -> b -> m b

    lens Control.Lens.Operators

    Set with pass-through This is useful for chaining assignment without round-tripping through your Monad stack.

    do x <- _2 <.= ninety_nine_bottles_of_beer_on_the_wall
    
    If you do not need a copy of the intermediate result, then using l .= d will avoid unused binding warnings.
    (<.=) :: MonadState s m => Setter s s a b    -> b -> m b
    (<.=) :: MonadState s m => Iso s s a b       -> b -> m b
    (<.=) :: MonadState s m => Lens s s a b      -> b -> m b
    (<.=) :: MonadState s m => Traversal s s a b -> b -> m b
    

  10. (<.>) :: Indexable (i, j) p => (Indexed i s t -> r) -> (Indexed j a b -> s -> t) -> p a b -> r

    lens Control.Lens.Operators

    Composition of Indexed functions. Mnemonically, the < and > points to the fact that we want to preserve the indices.

    >>> let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
    
    >>> nestedMap^..(itraversed<.>itraversed).withIndex
    [((1,10),"one,ten"),((1,20),"one,twenty"),((2,30),"two,thirty"),((2,40),"two,forty")]
    

Page 98 of many | Previous | Next