Hoogle Search
Within LTS Haskell 22.22 (ghc-9.6.5)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)haskell-gi-base Data.GI.Base.ShortPrelude 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 :: (a -> IO b) -> InputStream a -> IO (InputStream b)io-streams System.IO.Streams.Combinators 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
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)rio RIO.Prelude 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 :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> v a -> m (v b)rio RIO.Vector O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
mapM :: Monad m => (a -> m b) -> Vector a -> m (Vector b)rio RIO.Vector.Boxed O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
mapM :: (Monad m, Storable a, Storable b) => (a -> m b) -> Vector a -> m (Vector b)rio RIO.Vector.Storable O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
mapM :: (Monad m, Unbox a, Unbox b) => (a -> m b) -> Vector a -> m (Vector b)rio RIO.Vector.Unboxed O(n) Apply the monadic action to all elements of the vector, yielding a vector of results.
mapM :: Monad m => (a -> m b) -> Exceptional e a -> m (Exceptional e b)explicit-exception Control.Monad.Exception.Asynchronous.Lazy No documentation available.
mapM :: Monad m => (a -> m b) -> Exceptional e a -> m (Exceptional e b)explicit-exception Control.Monad.Exception.Asynchronous.Strict No documentation available.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)base-compat-batteries Control.Monad.Compat 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.