Async
public protocol Async : MonadDefer
Async models how a data type runs an asynchronous computation that may fail, described by the Proc
signature.
-
Suspends side effects in the provided registration function. The parameter function is injected with a side-effectful callback for signaling the result of an asynchronous process.
Parameters
procf
Asynchronous operation.
Return Value
A computation describing the asynchronous operation.
-
async(_:)
Extension methodSuspends side effects in the provided registration function. The parameter function is injected with a side-effectful callback for signaling the result of an asynchronous process.
Parameters
proc
Asynchronous operation.
Return Value
A computation describing the asynchronous operation.
-
defer(_:_:)
Extension methodProvides a computation that evaluates the provided function on every run.
Declaration
Parameters
queue
Dispatch queue which the computation must be sent to.
f
Function returning a value.
Return Value
A computation that defers the execution of the provided function.
-
later(_:_:)
Extension methodProvides a computation that evaluates the provided function on every run.
Declaration
Swift
static func later<A>( _ queue: DispatchQueue, _ f: @escaping () throws -> A) -> Kind<Self, A>
Parameters
queue
Dispatch queue which the computation must be sent to.
f
Function returning a value.
Return Value
A computation that defers the execution of the provided function.
-
delayOrRaise(_:_:)
Extension methodProvides a computation that evaluates the provided function on every run.
Declaration
Parameters
queue
Dispatch queue which the computation must be sent to.
f
A function that provides a value or an error.
Return Value
A computation that defers the execution of the provided value.
-
never()
Extension methodProvides an asynchronous computation that never finishes.
Declaration
Swift
static func never<A>() -> Kind<Self, A>
Return Value
An asynchronous computation that never finishes.