Proposal: Move `mapM` and `sequence` out of Traversable

Georgi Lyubenov godzbanebane at
Sat Nov 7 20:29:09 UTC 2020


Regarding the "there can be no instance for which mapM is more efficient
than traverse":
There have been issues with Applicative functions leaking memory where
Monad ones aren't in Polysemy - some of these have been fixed, but it's not
clear that there are none left.
There is also this claim in parser-combinators

> Due to the nature of the Applicative
 and Alternative
 abstractions, they are prone to memory leaks and not as efficient as their
monadic counterparts. Although all the combinators we provide in this
module are perfectly expressible in terms of Applicative
 and Alternative
please prefer Control.Monad.Combinators
 instead when possible.

I have not verified it, but it is a bit worrying.

Personally I would love to know of some kind of reasoning regarding these
things, as I'm not aware of any! (efficiency of Applicative vs Monad based

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list