interface ~~Promise~~<F, A>
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/
When made, a Promise is empty. Until it is fulfilled, which can only happen once.
A Promise guarantees (promises) A at some point in the future within the context of F. Note that since F is constrained to Async an error can also occur.
AlreadyFulfilled | object AlreadyFulfilled : Throwable |
complete | Completes, or fulfills, the promise with the specified value A. Results in an Promise.AlreadyFulfilled within F if the promise is already fulfilled.abstract fun complete(a: A): Kind<F, Unit > |
error | Errors the promise with the specified Throwable. Results in an Promise.AlreadyFulfilled within F if the promise is already fulfilled.abstract fun error(throwable: Throwable ): Kind<F, Unit > |
get | Get the promised value. Suspending the Fiber running the action until the result is available.abstract fun get(): Kind<F, A> |
tryComplete | Try to complete, or fulfill, the promise with the specified value A. Returns true if the promise successfully completed, false otherwise.abstract fun tryComplete(a: A): Kind<F, Boolean > |
tryError | Tries to error the promise with the specified Throwable. Returns true if the promise already completed or errored, false otherwise.abstract fun tryError(throwable: Throwable ): Kind<F, Boolean > |
tryGet | Try get the promised value, it returns None if promise is not fulfilled yet. Returns Some of A if promise is fulfilled, None otherwise.abstract fun tryGet(): Kind<F, Option<A>> |
bracket | This allows atomic modification of a Ref, and in its use function it also passes a Promise that defers the triggering of release until completed. This allows for use-cases such as a blocking offer for Queue where the offer is deferred until there is available capacity in the Queue. When there is capacity available, the putter will put the value in the Queue and complete the Promise so that the release function can do the clean-up.fun <F, A, B, C> bracket(ref: Ref <F, A>, use: ( Promise <F, B>, A) -> Tuple2<Kind<F, C>, A>, release: (C, Promise <F, B>) -> Kind<F, Unit >, CF: Concurrent <F>): Kind<F, B> |
invoke | Creates an empty Promise from on Async instance for F.operator fun <F, A> invoke(CF: Concurrent <F>): Kind<F, Promise <F, A>> |
uncancelable | fun <F, A> ~~uncancelable~~(AS: Async <F>): Kind<F, Promise <F, A>> |
uncancellable | Creates an empty Promise from on Async instance for F. Does not support cancellation of get operation.fun <F, A> uncancellable(AS: Async <F>): Kind<F, Promise <F, A>> |
unsafeCancelable | fun <F, A> ~~unsafeCancelable~~(CF: Concurrent <F>): Promise <F, A> |
unsafeCancellable | 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.fun <F, A> unsafeCancellable(CF: Concurrent <F>): Promise <F, A> |
unsafeUncancelable | fun <F, A> ~~unsafeUncancelable~~(AS: Async <F>): Promise <F, A> |
unsafeUncancellable | Creates an empty Promise from on Async instance for F. Does not support cancellation of get operation. This method is considered unsafe because it is not referentially transparent – it allocates mutable state.fun <F, A> unsafeUncancellable(AS: Async <F>): Promise <F, A> |
Do you like Arrow?
✖