ibcoleman
03/01/2021, 7:38 PMEither<A, Either<A, B>> into an Either<A, B> (Sorry for the basic question)Satyam Agarwal
03/01/2021, 7:55 PMval x: Either<Nothing, Either<Nothing, Int>> = 1.right().right()
val y: Either<Nothing, Int> = x.flatten()Satyam Agarwal
03/01/2021, 7:56 PM0.11.0ibcoleman
03/01/2021, 8:03 PMflatten()! Outstanding, thanks Satyam!raulraja
03/02/2021, 10:25 AMmap that should had been a flatMap at the point you are nesting. Beside flatten which is the same as flatMap(identity()) you can always use an either computation expressions to compose and extract the values in them:
either {
val nested = x.bind()
val y = nested.bind()
y // Int
}