effect

fun <R, A> effect(f: suspend EffectScope<R>.() -> A): Effect<R, A>

Deprecated

Use the arrow.core.raise.effect DSL instead, which is more general and can be used to and can be used to raise typed errors or _logical failures_ The Raise<R> type is source compatible, a simple find & replace of arrow.core.continuations.* to arrow.core.raise.* will do the trick.

Replace with

import arrow.core.raise.effect
effect<R, A>(f)

DSL for constructing Effect values

import arrow.core.Either
import arrow.core.None
import arrow.core.Option
import arrow.core.Validated
import arrow.core.continuations.effect
import io.kotest.assertions.fail
import io.kotest.matchers.shouldBe

suspend fun main() {
effect<String, Int> {
val x = Either.Right(1).bind()
val y = Validated.Valid(2).bind()
val z = Option(3).bind { "Option was empty" }
x + y + z
}.fold({ fail("Shift can never be the result") }, { it shouldBe 6 })

effect<String, Int> {
val x = Either.Right(1).bind()
val y = Validated.Valid(2).bind()
val z: Int = None.bind { "Option was empty" }
x + y + z
}.fold({ it shouldBe "Option was empty" }, { fail("Int can never be the result") })
}