map -package:base -is:exact -is:exact -package:unordered-containers -package:case-insensitive -package:aeson -package:ghc -package:vector -package:regex-tdfa -package:text package:rio
O(n) map f xs is the ByteString obtained by
applying
f to each element of
xs.
Transform this map by applying a function to every value.
Transform this set by applying a function to every value.
The resulting set may be smaller than the source.
>>> HashSet.map show (HashSet.fromList [1,2,3])
HashSet.fromList ["1","2","3"]
map f xs is the list obtained by
applying
f to each element of
xs, i.e.,
map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
map f [x1, x2, ...] == [f x1, f x2, ...]
>>> map (+1) [1, 2, 3]
O(n). Map a function over all values in the map.
map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]
O(n*log n).
map f s is the set obtained by
applying
f to each element of
s.
It's worth noting that the size of the result may be smaller if, for
some
(x,y),
x /= y && f x == f y
O(n) map f t is the
Text
obtained by applying
f to each element of
t.
Example:
>>> let message = pack "I am not angry. Not at all."
>>> T.map (\c -> if c == '.' then '!' else c) message
"I am not angry! Not at all!"
Subject to fusion. Performs replacement on invalid scalar values.
O(n) map f t is the
Text
obtained by applying
f to each element of
t. Subject
to fusion. Performs replacement on invalid scalar values.
O(n) Map a function over a vector
O(n) Map a function over a vector
O(n) Map a function over a vector
O(n) Map a function over a vector
Strict
Map. Import as:
import qualified RIO.Map as Map
This module does not export any partial or unchecked functions. For
those, see
RIO.Map.Partial and
RIO.Map.Unchecked
A Map from keys
k to values
a.
The
Semigroup operation for
Map is
union, which
prefers values from the left operand. If
m1 maps a key
k to a value
a1, and
m2 maps the same key
to a different value
a2, then their union
m1 <>
m2 maps
k to
a1.
Lift one RIO env to another.
The
mapAccumL function behaves like a combination of
map
and
foldl; it applies a function to each element of a
ByteString, passing an accumulating parameter from left to right, and
returning a final value of this accumulator together with the new
list.
The
mapAccumR function behaves like a combination of
map
and
foldr; it applies a function to each element of a
ByteString, passing an accumulating parameter from right to left, and
returning a final value of this accumulator together with the new
ByteString.
The
mapAccumL function behaves like a combination of
map
and
foldl; it applies a function to each element of a
ByteString, passing an accumulating parameter from left to right, and
returning a final value of this accumulator together with the new
ByteString.
Transform this map by applying a function to every value
and retaining only some of them.
Transform this map by applying a function to every value
and retaining only some of them.
Transform this map by applying a function to every value.
The
mapAccumL function behaves like a combination of
fmap and
foldl; it applies a function to each element of
a structure, passing an accumulating parameter from left to right, and
returning a final value of this accumulator together with the new
structure.
The
mapAccumR function behaves like a combination of
fmap and
foldr; it applies a function to each element of
a structure, passing an accumulating parameter from right to left, and
returning a final value of this accumulator together with the new
structure.
O(n). The function
mapAccum threads an accumulating
argument through the map in ascending order of keys.
let f a b = (a ++ b, b ++ "X")
mapAccum f "Everything: " (fromList [(5,"a"), (3,"b")]) == ("Everything: ba", fromList [(3, "bX"), (5, "aX")])