Satyam Agarwal
04/13/2021, 3:51 PMList<A>
to Either<List<B>, List<C>>
just like we do for validated
We only have parTraverse and parTraverseEither.
So I can either get List<Either<B, C>>
or Either<B, List<C>>
raulraja
04/13/2021, 4:00 PMtraverse
is available for a few data types and it no longer requires the applicative instance because it always ends in List<F<A>>
Satyam Agarwal
04/13/2021, 4:01 PMSatyam Agarwal
04/13/2021, 5:15 PMmapN/tupledN
, so I was doing something like this :
val re: Either<NonEmptyList<Int>, Tuple3<Int, Nothing, Nothing>> = Validated
.applicative(NonEmptyList.semigroup<Int>())
.mapN(1.valid(), 2.invalidNel(), 3.invalidNel()) { (a, b, c) -> Tuple3(a, b, c)}
.fix()
.toEither()
But I am looking something like this for parTraverse as I have a list to traverse over.raulraja
04/13/2021, 6:38 PMzip
and the ones for ValidatedNel
already imply you are using the Nel semigroup so you no longer ni to add it as argumentraulraja
04/13/2021, 6:40 PMSatyam Agarwal
04/14/2021, 9:00 PMparTraverseValidated
and then convert to either. Thank you 🙂