cats icon indicating copy to clipboard operation
cats copied to clipboard

Optimize or remove reduceMapM?

Open travisbrown opened this issue 5 years ago • 0 comments

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.

travisbrown avatar Dec 10 '19 17:12 travisbrown