stm

inline fun <A> stm(noinline f: STM.() -> A): STM.() -> A(source)

Helper to create stm blocks that can be run with STM.orElse

import arrow.fx.stm.atomically
import arrow.fx.stm.stm

suspend fun main() {
//sampleStart
val i = 4
val result = atomically {
stm {
if (i == 4) retry()
"Not 4"
} orElse { "4" }
}
//sampleEnd
println("Result $result")
}

Equal to suspend just with an STM receiver.