Decidable

public protocol Decidable : Divisible

Decidable is a typeclass modeling contravariant decision. Decidable is the contravariant version of Alternative.

  • Takes 2 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ f: (Z) -> Either<A, B>) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • choose(_:_:_:_:) Extension method

    Takes 3 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ f: (Z) -> Either<A, Either<B, C>>) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • choose(_:_:_:_:_:) Extension method

    Takes 4 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ f: (Z) -> Either<A, Either<B, Either<C, D>>>) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • choose(_:_:_:_:_:_:) Extension method

    Takes 5 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, E, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ fe: Kind<Self, E>,
        _ f: (Z) -> Either<A, Either<B, Either<C, Either<D, E>>>>
    ) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    fe

    5th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • choose(_:_:_:_:_:_:_:) Extension method

    Takes 6 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, E, FF, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ fe: Kind<Self, E>,
        _ ff: Kind<Self, FF>,
        _ f: (Z) -> Either<A, Either<B, Either<C, Either<D, Either<E, FF>>>>>
    ) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    fe

    5th computation

    ff

    6th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • Takes 7 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, E, FF, G, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ fe: Kind<Self, E>,
        _ ff: Kind<Self, FF>,
        _ fg: Kind<Self, G>,
        _ f: (Z) -> Either<A, Either<B, Either<C, Either<D, Either<E, Either<FF, G>>>>>>
    ) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    fe

    5th computation

    ff

    6th computation

    fg

    7th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • Takes 8 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, E, FF, G, H, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ fe: Kind<Self, E>,
        _ ff: Kind<Self, FF>,
        _ fg: Kind<Self, G>,
        _ fh: Kind<Self, H>,
        _ f: (Z) -> Either<A, Either<B, Either<C, Either<D, Either<E, Either<FF, Either<G, H>>>>>>>
    ) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    fe

    5th computation

    ff

    6th computation

    fg

    7th computation

    fh

    8th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • Takes 9 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, E, FF, G, H, I, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ fe: Kind<Self, E>,
        _ ff: Kind<Self, FF>,
        _ fg: Kind<Self, G>,
        _ fh: Kind<Self, H>,
        _ fi: Kind<Self, I>,
        _ f: (Z) -> Either<A, Either<B, Either<C, Either<D, Either<E, Either<FF, Either<G, Either<H, I>>>>>>>>
    ) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    fe

    5th computation

    ff

    6th computation

    fg

    7th computation

    fh

    8th computation

    fi

    9th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.

  • Takes 10 computations and produces a new one that decides which one will be run, based on a provided function.

    Declaration

    Swift

    static func choose<A, B, C, D, E, FF, G, H, I, J, Z>(
        _ fa: Kind<Self, A>,
        _ fb: Kind<Self, B>,
        _ fc: Kind<Self, C>,
        _ fd: Kind<Self, D>,
        _ fe: Kind<Self, E>,
        _ ff: Kind<Self, FF>,
        _ fg: Kind<Self, G>,
        _ fh: Kind<Self, H>,
        _ fi: Kind<Self, I>,
        _ fj: Kind<Self, J>,
        _ f: (Z) -> Either<A, Either<B, Either<C, Either<D, Either<E, Either<FF, Either<G, Either<H, Either<I, J>>>>>>>>>
    ) -> Kind<Self, Z>

    Parameters

    fa

    1st computation

    fb

    2nd computation

    fc

    3rd computation

    fd

    4th computation

    fe

    5th computation

    ff

    6th computation

    fg

    7th computation

    fh

    8th computation

    fi

    9th computation

    fj

    10th computation

    f

    Deciding function

    Return Value

    A computation that decides which of the provided arguments should run.