insert

open fun <K, V> TMap<K, V>.insert(k: K, v: V)(source)

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.insert(10, "Hello")
}
//sampleEnd
}

open fun <A> TSet<A>.insert(a: A)(source)

Adds an element to the set.

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

suspend fun main() {
//sampleStart
val tset = TSet.new<String>()
atomically {
tset.insert("Hello")
}
//sampleEnd
}