plusAssign
Append an element to the TQueue. Alias for STM.write.
import arrow.fx.stm.TQueue
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tq = TQueue.new<Int>()
atomically {
tq += 2
}
//sampleEnd
println("Items in queue ${atomically { tq.flush() }}")
}
Content copied to clipboard
This function never retries.
Add a key value pair to the map
import arrow.fx.stm.TMap
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tmap = TMap.new<Int, String>()
atomically {
tmap += (1 to "Hello")
}
//sampleEnd
}
Content copied to clipboard
Adds an element to the set. Alias of STM.insert.
import arrow.fx.stm.TSet
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tset = TSet.new<String>()
atomically {
tset += "Hello"
}
//sampleEnd
}
Content copied to clipboard