Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for mapOrAccumulate functions which when run inside an
IorRaise
scope accumulate errors into aBoth
case with the combined errors and any successfully mapped items.This change adds the basic
mapOrAccumulate
functions, it doesn't provide any additional convenience functions like those which take anIterable<T>
receiver such as those found inIterable.kt
. As I see it, in order to provide those functions we'd either need to wait for context parameters, or move each of those existing functions into theRaise
interface and define the new ones in theIorRaise
class.I also haven't included the
zipOrAccumulate
functions in this change. I intend to do those as it feels like a use case which makes sense (carry out N operations, collect the errors, but if some succeeded then treat it as a success overall).