-
Notifications
You must be signed in to change notification settings - Fork 451
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
Stop storing transformed element when error is encountered in mapOrAccumulate
#3374
Conversation
Kover Report
|
arrow-libs/core/arrow-core/src/commonMain/kotlin/arrow/core/raise/RaiseAccumulate.kt
Outdated
Show resolved
Hide resolved
Although I'm not fond of the particular implementation, this seems like an interesting idea. Would it be possible instead to split the work of In addition, @nomisRev do you remember why we make all of these functions |
I think you're thinking of
We normally make things Making things |
Closed in favour of #3376 |
Seemed like an easy win :) If an error is encountered early-on, there's no reason why we should keep storing transformed elements (we just waste memory). Micro-benchmarking maybe is needed to figure out if this actually helps with anything. I think knowing inside
forEachAccumulating
whether there has been an error or not is likely useful outside of this anyway. Do note that 1.22 is getting finalised, so perhaps the ship has sailed for this change (it does change the API of the currently-unreleasedforEachAccumulating
)