<@U0B8UEMV1> <@U0BRK9HC5> &gt; as for the API, my...
# arrow
s
@pakoito @gildor
as for the API, my suggestion is
Either.applicative().map(1.right(), 2.right(), ::plus)
This doesn't work as you need to provide the type info in applicative function so something like this works
Either.applicative<Either<Int, Int>>().map(Right(1), Right(2)) { (a, b): Tuple2<Int, Int> -> a + b}
But for some reason I can pretty much put any type in there and it works like
Copy code
Either.applicative<Either<*, *>>().map(Right(1), Right(2)) { (a, b): Tuple2<Int, Int> -> a + b} 
        Either.applicative<Either<String, String>>().map(Right(1), Right(2)) { (a, b): Tuple2<Int, Int> -> a + b}
now but if you do something like this
Either.applicative<Either<Int, Int>>().map(Right(1), Left(2)) { (a, b): Tuple2<Int, Int> -> a + b} // output should be Left(2) as per my understanding of eithers
then it does not work. What can I read up to understand this behaviour? I have a situation where I have 2 eithers of types let's say
Either<Error, A>
and
Either<Error, List<B>>
and a function with type
(A, List<B>) -> C
which I want to lift over the 2 eithers so I get
Either<Error, C>
as output but so far I don't understand what type the applicative function wants.