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. (<.~) :: ASetter s t a b -> b -> s -> (b, t)

    lens Control.Lens.Operators

    Set with pass-through. This is mostly present for consistency, but may be useful for chaining assignments. If you do not need a copy of the intermediate result, then using l .~ t directly is a good idea.

    >>> (a,b) & _1 <.~ c
    (c,(c,b))
    
    >>> ("good","morning","vietnam") & _3 <.~ "world"
    ("world",("good","morning","world"))
    
    >>> (42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"
    (Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))
    
    (<.~) :: Setter s t a b    -> b -> s -> (b, t)
    (<.~) :: Iso s t a b       -> b -> s -> (b, t)
    (<.~) :: Lens s t a b      -> b -> s -> (b, t)
    (<.~) :: Traversal s t a b -> b -> s -> (b, t)
    

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

    lens Control.Lens.Operators

    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
    

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

    lens Control.Lens.Operators

    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)
    

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

    lens Control.Lens.Operators

    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
    

  5. (^..) :: s -> Getting (Endo [a]) s a -> [a]

    lens Control.Lens.Operators

    A convenient infix (flipped) version of toListOf.

    >>> [[1,2],[3]]^..id
    [[[1,2],[3]]]
    
    >>> [[1,2],[3]]^..traverse
    [[1,2],[3]]
    
    >>> [[1,2],[3]]^..traverse.traverse
    [1,2,3]
    
    >>> (1,2)^..both
    [1,2]
    
    toList xs ≡ xs ^.. folded
    (^..) ≡ flip toListOf
    
    (^..) :: s -> Getter s a     -> a :: s -> Fold s a       -> a :: s -> Lens' s a      -> a :: s -> Iso' s a       -> a :: s -> Traversal' s a -> a :: s -> Prism' s a     -> [a]
    

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

    lens Control.Lens.Operators

    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.

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

    lens Control.Lens.Operators

    An infix version of itoListOf.

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

    lens Control.Lens.Setter

    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
    

  9. (<.~) :: ASetter s t a b -> b -> s -> (b, t)

    lens Control.Lens.Setter

    Set with pass-through. This is mostly present for consistency, but may be useful for chaining assignments. If you do not need a copy of the intermediate result, then using l .~ t directly is a good idea.

    >>> (a,b) & _1 <.~ c
    (c,(c,b))
    
    >>> ("good","morning","vietnam") & _3 <.~ "world"
    ("world",("good","morning","world"))
    
    >>> (42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"
    (Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))
    
    (<.~) :: Setter s t a b    -> b -> s -> (b, t)
    (<.~) :: Iso s t a b       -> b -> s -> (b, t)
    (<.~) :: Lens s t a b      -> b -> s -> (b, t)
    (<.~) :: Traversal s t a b -> b -> s -> (b, t)
    

  10. (<.&.=) :: (MonadState s m, Bits a) => LensLike' ((,) a) s a -> a -> m a

    lens Data.Bits.Lens

    Modify the target(s) of a Lens' (or Traversal') by computing its bitwise .&. with another value, returning the result (or a monoidal summary of all of the results traversed).

    >>> runState (_1 <.&.= 15) (31,0)
    (15,(15,0))
    
    (<.&.=) :: (MonadState s m, Bits a)           => Lens' s a      -> a -> m a
    (<.&.=) :: (MonadState s m, Bits a, Monoid a) => Traversal' s a -> a -> m a
    

Page 99 of many | Previous | Next