what's the most efficient path from `Either<Eit...
# arrow
t
what's the most efficient path from
Either<Either<L, R>, R>
to
Either<L, R>
?
a
the most efficient would definitelye be some sort of
when
Copy code
when {
  x is Either.Right -> x
  x is Either.Left -> x.value
}
you could also do
x.recover { it.bind() }
☝️ 2
ł
x.flatten()
but I can see that flatten is not the inline method, so probably it is not as efficient as recover
s
flatten
, is only for right side so
Either<L, Either<L, R>>
but there could of course also be
flattenLeft()
but it's a very uncommon operator afaik.
ł
Now I see
t
thanks, very helpful! 🙏