Sam Pengilly
07/27/2023, 10:54 PMSam Pengilly
07/27/2023, 10:55 PMgetOrAccumulate
function would help. I think there's a handful of functions that will need to be added, not just oneSam Pengilly
07/27/2023, 10:58 PMensureNoErrors
is a custom DSL function that raises if the error list is not null and not empty. We'd like to change this to a construct that accumulates errors rather than short-circuiting. It doesn't seem like there is a way within IorRaise
to simply append/combine an error (since combine
is internal).
We also filter out any list items that fail to parse with mapNotNull { it.getOrNull() }
, it would be good to filter them out but also accumulate the errors.Sam Pengilly
07/27/2023, 11:01 PMEither<Error, A>.getOrAccumulate()
inside IorRaise
will be enough.
There's currently an Either<A, B>.toIor()
function that will never produce an Ior.Both
case. I wonder if an alternative like Either<A, B>.recoverToIor(recover: (A) -> B)
function might help there?Sam Pengilly
07/27/2023, 11:03 PM.mapNotNull { it.recoverToIor { null }.bind() }
Sam Pengilly
07/27/2023, 11:03 PMSam Pengilly
07/27/2023, 11:06 PMcombine()
in IorRaise
to be called inside the ior {}
builder?