Add AccumulateContext utilities for error accumulation in Arrow Core Context#3948
Add AccumulateContext utilities for error accumulation in Arrow Core Context#3948nomisRev wants to merge 2 commits into
Conversation
Kover Report
|
53b423e to
b54bf2f
Compare
| @JvmName("accumulateContextMap") | ||
| context(raise: Accumulate<Error>) | ||
| @RaiseDSL | ||
| public inline fun <Error, A, B> Iterable<A>.mapOrAccumulate( |
There was a problem hiding this comment.
Not sure about this one. It has a different return type from the RaiseAccumulate overload.
There's definitely a use for it, just unsure about the name.
Accumulate is basically a delayed Raise (which lets it accumulate errors), so the convention usually is that XOrAccumulate methods return Value. mapOrAccumulate predates that conventino. It's ought to be called mapAccumulating like forEachAccumulating, but that's an annoying name change to go through.
(Maybe the opposite convention could work? and then forEachAccumulating is just the odd one out? All Value-returning functions are still experimental, so we could change them...)
mapOrAccumulate is a good name for this operation, but it means someone using RaiseAccumulate vs just Accumulate gets very different behavior. I suggest we leave it to another PR maybe?
|
Most of the utilities here have identical contextual bridges for |
I would prefer
Let's address in this PR. The different behavior is indeed strange. In terms of naming cc\ @serras thoughts? |
Like not go to Or maybe you meant let's go |
Of course, you're right it's source compatible so just |
This PR adds context parameters support for
Accumulate<A>. Currently I have this in my project:Such that I can write: