MonadDefer

public protocol MonadDefer : MonadError

MonadDefer is a Monad that provides the ability to delay the evaluation of a computation.

  • Provides a computation that evaluates the provided function on every run.

    Declaration

    Swift

    static func `defer`<A>(_ fa: @escaping () -> Kind<Self, A>) -> Kind<Self, A>

    Parameters

    fa

    Function returning a computation to be deferred.

    Return Value

    A computation that defers the execution of the provided function.

  • later(_:) Extension method

    Provides a computation that evaluates the provided function on every run.

    Declaration

    Swift

    static func later<A>(_ f: @escaping () throws -> A) -> Kind<Self, A>

    Parameters

    f

    Function returning a value.

    Return Value

    A computation that defers the execution of the provided function.

  • later(_:) Extension method

    Provides a computation that evaluates the provided computation on every run.

    Declaration

    Swift

    static func later<A>(_ fa: Kind<Self, A>) -> Kind<Self, A>

    Parameters

    fa

    A value describing a computation to be deferred.

    Return Value

    A computation that defers the execution of the provided value.

  • lazy() Extension method

    Provides a lazy computation that returns void.

    Declaration

    Swift

    static func lazy() -> Kind<Self, ()>

    Return Value

    A deferred computation of the void value.

  • laterOrRaise(_:) Extension method

    Provides a computation that evaluates the provided function on every run.

    Declaration

    Swift

    static func laterOrRaise<A>(_ f: @escaping () -> Either<E, A>) -> Kind<Self, A>

    Parameters

    f

    A function that provides a value or an error.

    Return Value

    A computation that defers the execution of the provided value.