//arrow-fx-stm/arrow.fx.stm/STM/insert

insert

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

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
}

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

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
}

Do you like Arrow?

Arrow Org
<