:wave: anyone has type inference issues when using...
# arrow
l
đź‘‹ anyone has type inference issues when using
Either.left && Either.right
within a
RxJava
. For example request.map { Either.right(it) }.onErrorReturn { Either.left(it) }` doesn’t compile
p
the compiler cannot decide what the type of the other side is without a hint. Normally you do this in a local variable, or on the function return. In your case with a raw lambda it cannot decide
so you have to
hint
it explicitly
Either.left<String>(1)
l
That doesn’t compile
Type provided needs to be the type passed in the argument
data class Left<out A> @PublishedApi internal constructor(val a: A) : Either<A, Nothing>()