carbaj0
01/10/2021, 10:28 AMfun interface NullableEffect<A> : Effect<A?> {
...
suspend operator fun <E, B> Either<E, B>.invoke(): B =
fold({ control().shift(null) }, ::identity)
}
val r1: Either<String, Int> = Right(1)
val r2: Either<String, Int> = Left("fail")
val r3: Either<String, Int> = Right(1)
val r4: Int? = 1
val composition2 = nullable {
val a = r1()
val b = r2()
val c = r3()
val d = r4()
a + b + c + d
} // null