cats
cats copied to clipboard
Optimize or remove reduceMapM?
We currently have foldMapA and foldMapM methods with identical semantics (apart from the constraint), because the monadic implementation using tailRecM can be much faster than the implementation that can only use Applicative.
We've recently added a reduceMapA with a similarly loosened constraint (see #3141, #3150, and #3199). Right now reduceMapM and reduceMapA have identical implementations. It's probably the case that reduceMapM could be implemented more efficiently using tailRecM, and we should either do this or deprecate it, because otherwise there's no reason for it to exist and it's just confusing.