mapM -package:streamly

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_.

Examples

mapM is literally a traverse with a type signature restricted to Monad. Its implementation may be more efficient due to additional power of Monad.
mapM f is equivalent to sequence . map f.
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
Apply a monadic action to each element of the stream, producing a monadic stream of results
Map a monadic function over a Bundle
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
Apply a monadic transformation to all values in a stream. If you do not need the transformed values, and instead just want the monadic side-effects of running the action, see mapM_. Subject to fusion
Apply a monadic transformation to all values in a stream. If you do not need the transformed values, and instead just want the monadic side-effects of running the action, see mapM_. Subject to fusion Since 0.3.0
Apply a monadic operation to each element of a Stream, lazily
Apply a monadic function to all values flowing downstream
mapM return = cat

mapM (f >=> g) = mapM f >-> mapM g
Maps an impure function over an InputStream. mapM f s passes all output from s through the IO action f. Satisfies the following laws:
Streams.mapM (f >=> g) === Streams.mapM f >=> Streams.mapM g
Streams.mapM return === Streams.makeInputStream . Streams.read
Replace each element of a stream with the result of a monadic action
>>> S.print $ S.mapM readIORef $ S.chain (\ior -> modifyIORef ior (*100)) $ S.mapM newIORef $ each [1..6]
100
200
300
400
500
600
See also chain for a variant of this which ignores the return value of the function and just uses the side effects.
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_.
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results
O(n) Apply the monadic action to all elements of the vector, yielding a vector of results
A map in monad space. Same as sequence . map See also rigidMapM
Like mapM, but applying the function to the individual list items in parallel.
A mapM equivalent.