<div dir="auto"><div>It seems this lazily-accumulating version should be Applicative, and a strict version Monad. Do we also need a right-to-left version of each?<br><div class="gmail_extra"><br><div class="gmail_quote">On Dec 6, 2017 9:29 AM, "Andrew Martin" <<a href="mailto:andrew.thaddeus@gmail.com">andrew.thaddeus@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Several coworkers and myself have independently reinvented this function several times:<div><br></div><div><div> foldMapM :: (Foldable g, Monoid b, Monad m) => (a -> m b) -> g a -> m b</div><div> foldMapM f xs = foldlM (\b a -> mappend b <$> (f a)) mempty xs</div><div><br></div><div>I would like to propose that this be added to Data.Foldable. We have the triplet foldr,foldl,foldMap in the Foldable typeclass itself, and Data.Foldable provides foldrM and foldlM. It would be nice to provide foldMapM for symmetry and because it seems to be useful in a variety of applications.</div><font color="#888888"><div><br></div>-- <br><div class="m_-2248131543975941377gmail_signature">-Andrew Thaddeus Martin</div>
</font></div></div>
<br>______________________________<wbr>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div></div></div>