member
Check if a key k is in 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] = "Hello"
tmap.remove(1)
}
//sampleEnd
}
Content copied to clipboard
This function never retries.
Check if an element is already in the set
import arrow.fx.stm.TSet
import arrow.fx.stm.atomically
suspend fun main() {
//sampleStart
val tset = TSet.new<String>()
val result = atomically {
tset.insert("Hello")
tset.member("Hello")
}
//sampleEnd
println("Result $result")
}
Content copied to clipboard