map -package:Cabal -package:base -package:text -package:pipes -package:containers -package:regex-tdfa -package:bytestring -package:vector -package:unordered-containers -package:case-insensitive -package:filepath -package:rio package:numeric-prelude
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]
Apply a function on a specific element if it exists, and another
function to the rest of the map.
Map each element of a structure to a monadic action, evaluate these
actions from left to right, and collect the results. For a version
that ignores the results see
mapM_.
Map each element of a structure to a monadic action, evaluate these
actions from left to right, and ignore the results. For a version that
doesn't ignore the results see
mapM.
As of base 4.8.0.0,
mapM_ is just
traverse_, specialized
to
Monad.
DiscreteMap was originally intended as a type class that unifies Map
and Array. One should be able to simply choose between - Map for
sparse arrays - Array for full arrays.
However, the Edison package provides the class AssocX which already
exists for that purpose.
Currently I use this module for some numeric instances of Data.Map.
Map a function over all the elements of a container and concatenate
the resulting lists.
Using
ApplicativeDo: '
fmap f as' can be
understood as the
do expression
do a <- as
pure (f a)
with an inferred
Functor constraint.