arrow-fx / arrow.fx / RefFactory / just

just

abstract fun <A> just(a: A): Kind<F, Ref<F, A>>

Builds a MVar with a value of type A.

import arrow.fx.*
import arrow.fx.extensions.io.async.async

fun main(args: Array<String>) {
  //sampleStart
  val refFactory: RefFactory<ForIO> = Ref.factory(IO.async())
  val intVar: IOOf<Ref<ForIO, Int>> = refFactory.just(5)
  //sampleEnd
}

Do you like Arrow?

Arrow Org
<