Can anyone point me to some documentation or examp...
# arrow
c
Can anyone point me to some documentation or examples of how to obtain a
Both
so that I might accumulate non-fatal errors along with results?
I read all the documentation I could find, but there were no examples of using
ior { … }
or generating a
Both
😕
Is there a way to generate something like
Both<List<Throwable>, SomeResult>
?
d
I think someone previously asked this kind of question on this channel...
😂 1
😅 1
s
There's not really any nice DSL APIs for this at the moment AFAIK, I can't remember if it's just super clunky but doable or not even possible with the currently exposed APIs. Without context parameters, the current structure of extension functions within the Raise/IorRaise scopes can't really be extended outside the library. I put this PR up a while ago which starts to make the APIs a little more usable: https://github.com/arrow-kt/arrow/pull/3409 but I don't believe there's been a release since it was merged. There's also this PR which adds a bit more high level support for mapping over a list, accumulating any errors that occur during the mapping of each item (i.e.
mapOrAccumulate
behaves differently depending on whether it's used in an
either
scope or an
ior
scope): https://github.com/arrow-kt/arrow/pull/3472 But this similar PR from Alejandro looks more promising and more explicit than my approach: https://github.com/arrow-kt/arrow/pull/3436
c
Thanks for the thorough responses; I really appreciate it. I thought maybe it was a failure of due diligence on my part, but I guess ior is just in a weird place right now.