Restore FlatMap.map2Eval laziness#4859
Conversation
|
I guess the motivation was that inside the The change makes us always evaluate the The motivation of the Maybe to mitigate this we want to make sure any shortcircuiting Monads in cats override map2Eval so we don't regress on cases like Try, Future, Either. Maybe others. A middle ground could be to override StackSafeMonad to use the |
Yes, good call. I think that would a correct direction to go. We don't know and can't guess whether current |
|
It would be nice to have a way to easily audit the code for calls to It's a bit challenging to formulate the rules of exactly when it is and isn't safe, but something that could be called in a recursive context is definitely not safe, and |
|
@johnynek , what do you think about these two functions that seem to be designed so that |
|
since those have But if you were to recursively use these I think they could blow the stack as well. That said, since they don't return In this case though, I'd say that just using Definitely overriding these for the usual short-circuiting monads seems like a good idea (List/Option/Either/Try/Future). |
Resolves #4858.