arrow-fx / arrow.fx / IO / unsafeRunAsyncCancellable


fun unsafeRunAsyncCancellable(onCancel: OnCancel = Silent, cb: (Either<Throwable, A>) -> Unit): Disposable

unsafeRunAsyncCancellable allows you to run any IO and receive the values in a callback cb while being cancelable. It has the ability to run NonBlocking but that depends on the implementation, when the underlying effects/program runs blocking on the callers thread this method will run blocking.

To start this on NonBlocking use NonBlocking.shift().followedBy(io).unsafeRunAsync { }.


cb - the callback that is called with the computations result represented as an Either.

Returns Disposable or cancel reference that cancels the running IO.

See Also



Do you like Arrow?

Arrow Org