Hoogle Search
Within LTS Haskell 24.3 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
mapM :: (Factorial a, Semigroup b, Monoid b, Monad m) => (a -> m b) -> a -> m bmonoid-subclasses Data.Semigroup.Factorial A mapM equivalent.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)relude Relude.Foldable.Reexport 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 => (a -> m b) -> Stream (Of a) m r -> Stream (Of b) m rstreaming Streaming.Prelude 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.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.mapM :: Monad m => (time0 -> m time1) -> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)event-list Data.EventList.Absolute.TimeBody No documentation available.
mapM :: Monad m => (time0 -> m time1) -> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)event-list Data.EventList.Absolute.TimeTime No documentation available.
mapM :: Monad m => (time0 -> m time1) -> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)event-list Data.EventList.Relative.BodyBody No documentation available.
mapM :: Monad m => (time0 -> m time1) -> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)event-list Data.EventList.Relative.BodyTime No documentation available.
mapM :: Monad m => (time0 -> m time1) -> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)event-list Data.EventList.Relative.TimeBody No documentation available.
mapM :: Monad m => (time0 -> m time1) -> (body0 -> m body1) -> T time0 body0 -> m (T time1 body1)event-list Data.EventList.Relative.TimeTime No documentation available.