open suspend fun ensure(condition: Boolean, shift: () -> R)

ensure that condition is true, if it's false it will shift with the provided value R. Monadic version of kotlin.require.

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

suspend fun main() {
val condition = true
val failure = "failed"
val int = 4
effect<String, Int> {
ensure(condition) { failure }
}.toEither() shouldBe if(condition) Either.Right(int) else Either.Left(failure)