merge

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


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

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"
}