merge

suspend fun <A> Effect<A, A>.merge(): A
fun <A> EagerEffect<A, A>.merge(): A


@JvmName(name = "_merge")
inline fun <A> merge(block: Raise<A>.() -> A): A

Execute the Raise context function resulting in A or any logical error of type A. Does not distinguish between normal results and errors, thus you can consider return and raise to be semantically equivalent inside.

fun test() {
merge { if(Random.nextBoolean()) raise("failed") else "failed" } shouldBe "failed"
}