bind

suspend override fun <B> <ERROR CLASS><B>.bind(): B

Runs the Effect to finish, returning B or shift in case of R.

import arrow.core.Either
import arrow.core.continuations.Effect
import arrow.core.continuations.effect
import arrow.core.identity
import io.kotest.matchers.shouldBe

suspend fun <E, A> Either<E, A>.toEffect(): Effect<E, A> = effect {
fold({ e -> shift(e) }, ::identity)
}

suspend fun main() {
val either = Either.Left("failed")
effect<String, Int> {
val x: Int = either.toEffect().bind()
x
}.toEither() shouldBe either
}