-
Notifications
You must be signed in to change notification settings - Fork 462
Deprecate latestError and hasAccumulatedErrors #3818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Also fix faulty forEachAccumulatingImpl, parMap, parZip
Kover Report
|
|
To be honest, I'm not super-happy with this change. It's true that you don't expose things like
|
|
That behaviour change is intentional, but I should've done it in a separate PR. |
|
w.r.t. constraining it to |
# Conflicts: # arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt
Yes, please. I think that aligning |
|
@serras Thanks for steering me away from implementation changes! The PR is much simpler now. It's just marking things as |
I realized this is a bad API to have.
Accumulateis meant to be an effect. Already, it's important to keep effect interfaces minimal.The crucial fault here is that
latestErrorreveals too much aboutAccumulate: it lets you check whether a failure has happened, and short-circuit early if so.This means that introducing
accumulate { }changes that behaviour easily. We want an Accumulate-using expressioneto be equivalent toaccumulate(::either) { e }.bindNelOrAccumulate(), but this wasn"t the case withlatestErrorexposed. Now this equivalence is true.The only "legitimate" use for it was in
accumulate, which heavily implies that it was an implementation detail;accumulatewants to know, after the block runs, whether any errors happened. It now gets access to that implementation detail by picking the exact implementation ofAccumulateit wants (namelyListAccumulate).