arrow-fx / arrow.fx / RefFactory
interface ~~RefFactory~~<F>
Deprecated: The IO datatype and it’s related type classes will disappear in Arrow 0.13.0. All useful operations are offered directly over suspend functions by Arrow Fx Coroutines. https://arrow-kt.io/docs/fx/async/
Builds a Ref value for data types F without deciding the type of the Ref’s value.
import arrow.fx.*
import arrow.fx.extensions.io.monadDefer.monadDefer
fun main(args: Array<String>) {
//sampleStart
val refFactory: RefFactory<ForIO> = Ref.factory(IO.monadDefer())
val intVar: IOOf<Ref<ForIO, Int>> = refFactory.just(5)
val stringVar: IOOf<Ref<ForIO, String>> = refFactory.just("Hello")
//sampleEnd
}
just | Builds a MVar with a value of type A.abstract fun <A> just(a: A): Kind<F, Ref <F, A>> |
Do you like Arrow?
✖