UnsafeRun

public protocol UnsafeRun : MonadError

UsafeRun provides capabilities to run a computation unsafely, synchronous or asynchronously.

  • Unsafely runs a computation in a synchronous manner.

    Throws

    Error happened during the execution of the computation, of the error type of the underlying MonadError.

    Declaration

    Swift

    static func runBlocking<A>(
        on queue: DispatchQueue,
        _ fa: @escaping () -> Kind<Self, A>) throws -> A

    Parameters

    queue

    Dispatch queue used to run the computation.

    fa

    Computation to be run.

    Return Value

    Result of running the computation.

  • Unsafely runs a computation in an asynchronous manner.

    Declaration

    Swift

    static func runNonBlocking<A>(
        on queue: DispatchQueue,
        _ fa: @escaping () -> Kind<Self, A>,
        _ callback: @escaping Callback<E, A>)

    Parameters

    queue

    Dispatch queue used to run the computation.

    fa

    Computation to be run.

    callback

    Callback to report the result of the evaluation.