Proposal: Add concatMapM function (#2042)

Ross Paterson ross at
Mon Jan 14 17:53:29 EST 2008

On Mon, Jan 14, 2008 at 11:00:15PM +0200, Yitzchak Gale wrote:
> One point to consider - perhaps nowadays the type ought to be:
> concatMapM :: (Monad m, Traversable t) => (a -> m (t b)) -> t a -> m (t b)

Perhaps (using mapM from Data.Traversable):

foldMapM :: (Monad m, Traversable f, Monoid v) => (a -> m v) -> f a -> m v
foldMapM f = liftM fold . mapM f

(with an Applicative conterpart too)

But is this too small, and too orthogonal a combination, for the library?

More information about the Libraries mailing list