:: (Applicative m, Foldable f, Monoid b) => (a -> m b) -> f a -> m b

Generalized version of traverse_ :: Applicative m => (a -> m ()) -> [a] -> m () Executes effects and collects results in left-to-right order. Works best with left-associative monoids. Note that there is an alternative
mapM' f t = foldr mappend mempty $ mapM f t
that collects results in right-to-left order (effects still left-to-right). It might be preferable for right associative monoids.
Map each element of a structure to an action, evaluate these actions from left to right, and concat the monoid results.
Polymorphic version of the concatMapM function.
>>> foldMapM @[Int] (Just . replicate 3) [1..3]
Just [1,1,1,2,2,2,3,3,3]
Extend foldMap to allow side effects. Internally, this is implemented using a strict left fold. This is used for performance reasons. It also necessitates that this function has a Monad constraint and not just an Applicative constraint. For more information, see https://github.com/commercialhaskell/rio/pull/99#issuecomment-394179757.
Lifting bind into a monad. Generalized version of concatMap that works with a monadic predicate. Old and simpler specialized to list version had next type:
concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b]
Side note: previously it had type
concatMapM :: (Applicative q, Monad m, Traversable m)
=> (a -> q (m b)) -> m a -> q (m b)
Such signature didn't allow to use this function when traversed container type and type of returned by function-argument differed. Now you can use it like e.g.
concatMapM readFile files >>= putTextLn
Polymorphic version of the concatMapA function.
>>> foldMapA @[Int] (Just . replicate 3) [1..3]
Just [1,1,1,2,2,2,3,3,3]
Generalized version of for_ :: Applicative m => [a] -> (a -> m ()) -> m ()
Like concatMapM, but has its arguments flipped, so can be used instead of the common fmap concat $ forM pattern.