looking to do a transformation of arrow types, but having trouble coming up with a succinct call chain. i have a
List<() -> Validated<E, A>>
which i want to transform into
ValidatedNel<E, A>
by:
1. specifying invalid value if the list is empty
2. calling items until the first valid value is encountered
3. aggregating invalid values until (2)
4. ignoring items after (2)
i can come up with an "ugly" way to do this easily enough, but i'm curious if there's a nice fluent pattern for it. thanks in advance!
s
simon.vergauwen
11/18/2022, 7:27 AM
Hmm, I don't believe there is anything that satisfies
2
.
traverse
will continue running after encountering the first valid value.
t
Tom Davis
11/18/2022, 3:05 PM
thanks @simon.vergauwen, that was my experience as well.
separateValidated()
with a
Sequence
is my closest approximation that allows avoiding traversal past the first valid value.