open fun <A> TMVar<A>.tryPut(a: A): Boolean(source)

Same as TMVar.put except that it returns true or false if was successful or it retried.

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

suspend fun main() {
val tmvar =
val result = atomically {
println("Result $result")
println("New value ${atomically { tmvar.tryTake() } }")

This function never retries.

See also

for a function that retries if the TMVar is not empty.