Hoogle Search
Within LTS Haskell 24.58 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
(
^. ) :: s -> Getting a s a -> ario RIO (^.) applies a getter to a value; in other words, it gets a value out of a structure using a getter (which can be a lens, traversal, fold, etc.). Getting 1st field of a tuple:
(^. _1) :: (a, b) -> a (^. _1) = fst
When (^.) is used with a traversal, it combines all results using the Monoid instance for the resulting type. For instance, for lists it would be simple concatenation:>>> ("str","ing") ^. each "string"The reason for this is that traversals use Applicative, and the Applicative instance for Const uses monoid concatenation to combine “effects” of Const. A non-operator version of (^.) is called view, and it's a bit more general than (^.) (it works in MonadReader). If you need the general version, you can get it from microlens-mtl; otherwise there's view available in Lens.Micro.Extras.(
^.. ) :: s -> Getting (Endo [a]) s a -> [a]rio RIO s ^.. t returns the list of all values that t gets from s. A Maybe contains either 0 or 1 values:
>>> Just 3 ^.. _Just [3]
Gathering all values in a list of tuples:>>> [(1,2),(3,4)] ^.. each.each [1,2,3,4]
(
-<.> ) :: FilePath -> String -> FilePathrio RIO.FilePath Remove the current extension and add another, equivalent to replaceExtension.
"/directory/path.txt" -<.> "ext" == "/directory/path.ext" "/directory/path.txt" -<.> ".ext" == "/directory/path.ext" "foo.o" -<.> "c" == "foo.c"
(
<.> ) :: FilePath -> String -> FilePathrio RIO.FilePath Add an extension, even if there is already one there, equivalent to addExtension.
"/directory/path" <.> "ext" == "/directory/path.ext" "/directory/path" <.> ".ext" == "/directory/path.ext"
(
*. ) :: forall (v :: Type -> Type) n . (Functor v, Num n) => n -> Point v n -> Point v ndiagrams-lib Diagrams.Points Scale a point by a scalar. Specialized version of (*^).
(
<. ) :: Indexable i p => (Indexed i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> rdiagrams-lib Diagrams.Prelude 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")]
(
<.= ) :: MonadState s m => ASetter s s a b -> b -> m bdiagrams-lib Diagrams.Prelude 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
(
<.~ ) :: ASetter s t a b -> b -> s -> (b, t)diagrams-lib Diagrams.Prelude 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)
(
<<.= ) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m adiagrams-lib Diagrams.Prelude 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
(
<<.~ ) :: LensLike ((,) a) s t a b -> b -> s -> (a, t)diagrams-lib Diagrams.Prelude 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)