jean
09/23/2021, 7:51 AMList<Either<Error, Id>> to a Either<Error, List<Id>> ? I want a Either.Left return as soon as possible, not a list of all result eventually containing errors. Either an error immediately when something fails or a list of valid resultsimon.vergauwen
09/23/2021, 7:52 AMsequenceEither() to turn List<Either<Error, Id>> into Either<Error, List,<Id>> whilst returning as soon as a first Either.Left is found.
Alternatively, you can also use traverseEither to apply (A) -> Either<E, B> to List<A> and get back Either<E, List<B>>.simon.vergauwen
09/23/2021, 7:53 AMOption, Validated, and more.
And there are also parallel version of this called parTraverseXXX & parSeauenceXXX inside Arrow Fx Coroutinesjean
09/23/2021, 8:54 AMsimon.vergauwen
09/23/2021, 8:56 AMarrow.core.*simon.vergauwen
09/23/2021, 8:57 AMsimon.vergauwen
09/23/2021, 8:57 AMjean
09/23/2021, 8:58 AMsequenceEither { … }jean
09/23/2021, 8:58 AM