orElse

abstract infix fun <A> STM.() -> A.orElse(other: STM.() -> A): A(source)

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