arrow-fx-stm / arrow.fx.stm / STM / orElse
abstract infix fun <A> (
STM
.() -> A).orElse(other:
STM
.() -> A): A
Run the given transaction and fallback to the other one if the first one calls retry.
import arrow.fx.stm.atomically
import arrow.fx.stm.stm
suspend fun main() {
//sampleStart
val result = atomically {
stm { retry() } orElse { "Alternative" }
}
//sampleEnd
println("Result $result")
}
Do you like Arrow?
✖