add concatMapM to base in control.monad

Evan Laforge qdunkan at gmail.com
Fri Feb 8 17:57:36 UTC 2019


As long as we're playing the permutation game, I also frequently use
mconcatMap, and mconcatMapM.  Actually, my concatMapM is secretly
'(Monad m, Monoid b) => (a -> m b) -> [a] -> m b', but I suppose you
could argue that's inconsistent with the existing naming scheme.

I guess I don't mind it because unlike the generalization of [a] to
Foldable a, I haven't had ambiguity problems with generalizing [a] to
Monoid a.  Just personal experience though.

On Fri, Feb 8, 2019 at 9:04 AM Carter Schonwald
<carter.schonwald at gmail.com> wrote:
>
> friend asked me to raise this
>
> previously https://ghc.haskell.org/trac/ghc/ticket/2042
> seems like it iddn't happen last time because base lived outside of ghc?
>
> -- | The 'concatMapM' function generalizes 'concatMap' to arbitrary monads.
> concatMapM        :: (Monad m) => (a -> m [b]) -> [a] -> m [b]
> concatMapM f xs   =  liftM concat (mapM f xs)
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


More information about the Libraries mailing list