arrow-fx / arrow.fx / Promise / unsafeCancellable

unsafeCancellable

fun <F, A> unsafeCancellable(CF: Concurrent<F>): Promise<F, A>

Creates an empty Promise from on Concurrent instance for F. This method is considered unsafe because it is not referentially transparent – it allocates mutable state.

import arrow.fx.*
import arrow.fx.extensions.io.concurrent.concurrent

fun main(args: Array<String>) {
  //sampleStart
  val unsafePromise: Promise<ForIO, Int> = Promise.unsafeCancellable(IO.concurrent())
  //sampleEnd
}

Do you like Arrow?

Arrow Org
<