Functions

The following functions are available globally.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(value: FixOf<A>) -> Fix<A>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Fix.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F>(value: MuOf<F>) -> Mu<F>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Mu.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F>(value: NuOf<F>) -> Nu<F>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Nu.

  • Undocumented

    Declaration

    Swift

    public func hListOf<A>(_ a: A) -> HList1<A>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B>(_ a: A, _ b: B) -> HList2<A, B>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C>(_ a: A, _ b: B, _ c: C) -> HList3<A, B, C>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D>(_ a: A, _ b: B, _ c: C, _ d: D) -> HList4<A, B, C, D>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D, E>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E) -> HList5<A, B, C, D, E>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D, E, F>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> HList6<A, B, C, D, E, F>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D, E, F, G>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> HList7<A, B, C, D, E, F, G>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D, E, F, G, H>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> HList8<A, B, C, D, E, F, G, H>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D, E, F, G, H, I>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I) -> HList9<A, B, C, D, E, F, G, H, I>
  • Undocumented

    Declaration

    Swift

    public func hListOf<A, B, C, D, E, F, G, H, I, J>(_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I, _ j: J) -> HList10<A, B, C, D, E, F, G, H, I, J>
  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A>(fa: CofreeOf<F, A>) -> Cofree<F, A> where F : Functor

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Cofree.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <S, A>(fa: FreeOf<S, A>) -> Free<S, A> where S : Functor

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Free.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A>(fa: ProgramOf<F, A>) -> Program<F, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Program.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <E, A>(fa: IOOf<E, A>) -> IO<E, A> where E : Error

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to IO.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A>(value: ResourceOf<F, A>) -> Resource<F, A> where F : Bracket

    Parameters

    value

    Value in higher kinded form.

    Return Value

    Value casted to Resource.

  • Shiftes the execution to a given queue.

    Declaration

    Swift

    public func continueOn<F>(_ queue: DispatchQueue) -> BindingExpression<F> where F : Async

    Parameters

    queue

    Queue where to run the effects from that point on.

    Return Value

    A binding expression to be used in a Monad comprehension.

  • Runs 2 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>) -> Kind<F, (A, B)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 3 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>) -> Kind<F, (A, B, C)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 4 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C, D>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>,
        _ fd: Kind<F, D>) -> Kind<F, (A, B, C, D)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    fd

    4th computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 5 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C, D, E>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>,
        _ fd: Kind<F, D>,
        _ fe: Kind<F, E>) -> Kind<F, (A, B, C, D, E)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    fd

    4th computation.

    fe

    5th computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 6 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C, D, E, G>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>,
        _ fd: Kind<F, D>,
        _ fe: Kind<F, E>,
        _ fg: Kind<F, G>) -> Kind<F, (A, B, C, D, E, G)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    fd

    4th computation.

    fe

    5th computation.

    fg

    6th computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 7 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C, D, E, G, H>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>,
        _ fd: Kind<F, D>,
        _ fe: Kind<F, E>,
        _ fg: Kind<F, G>,
        _ fh: Kind<F, H>) -> Kind<F, (A, B, C, D, E, G, H)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    fd

    4th computation.

    fe

    5th computation.

    fg

    6th computation.

    fh

    7th computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 8 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C, D, E, G, H, I>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>,
        _ fd: Kind<F, D>,
        _ fe: Kind<F, E>,
        _ fg: Kind<F, G>,
        _ fh: Kind<F, H>,
        _ fi: Kind<F, I>) -> Kind<F, (A, B, C, D, E, G, H, I)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    fd

    4th computation.

    fe

    5th computation.

    fg

    6th computation.

    fh

    7th computation.

    fi

    8th computation.

    Return Value

    A computation that describes the parallel execution.

  • Runs 9 computations in parallel and tuples their results.

    Declaration

    Swift

    public func parallel<F: Concurrent, A, B, C, D, E, G, H, I, J>(
        _ fa: Kind<F, A>,
        _ fb: Kind<F, B>,
        _ fc: Kind<F, C>,
        _ fd: Kind<F, D>,
        _ fe: Kind<F, E>,
        _ fg: Kind<F, G>,
        _ fh: Kind<F, H>,
        _ fi: Kind<F, I>,
        _ fj: Kind<F, J>) -> Kind<F, (A, B, C, D, E, G, H, I, J)>

    Parameters

    fa

    1st computation.

    fb

    2nd computation.

    fc

    3rd computation.

    fd

    4th computation.

    fe

    5th computation.

    fg

    6th computation.

    fh

    7th computation.

    fi

    8th computation.

    fj

    9th computation.

    Return Value

    A computation that describes the parallel execution.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(value: MaybeKOf<A>) -> MaybeK<A>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to MaybeK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(value: ObservableKOf<A>) -> ObservableK<A>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to ObservableK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(value: SingleKOf<A>) -> SingleK<A>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to SingleK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A, B>(value: CokleisliOf<F, A, B>) -> Cokleisli<F, A, B>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Cokleisli.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: Function0Of<A>) -> Function0<A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Function0.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <I, O>(fa: Function1Of<I, O>) -> Function1<I, O>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Function1.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, D, A>(fa: KleisliOf<F, D, A>) -> Kleisli<F, D, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Kleisli.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: ArrayKOf<A>) -> ArrayK<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to ArrayK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <W, M, A>(value: CoTOf<W, M, A>) -> CoT<W, M, A> where W : Comonad

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to CoT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A, T>(fa: ConstOf<A, T>) -> Const<A, T>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Const.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A>(fa: CoyonedaOf<F, A>) -> Coyoneda<F, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Coyoneda.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, G, A>(value: DayOf<F, G, A>) -> Day<F, G, A> where F : Comonad, G : Comonad

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Day.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <K, A>(fa: DictionaryKOf<K, A>) -> DictionaryK<K, A> where K : Hashable

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to DictionaryK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A, B>(fa: EitherOf<A, B>) -> Either<A, B>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Either.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, G, A>(fa: EitherKOf<F, G, A>) -> EitherK<F, G, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to EitherK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: EndoOf<A>) -> Endo<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Endo.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: EvalOf<A>) -> Eval<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Eval.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: IdOf<A>) -> Id<A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to Id.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A, B>(fa: IorOf<A, B>) -> Ior<A, B>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Ior.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <E, V>(value: MooreOf<E, V>) -> Moore<E, V>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Moore.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: NonEmptyArrayOf<A>) -> NonEmptyArray<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to NonEmptyArray.

  • Safe downcasting.

    Declaration

    Swift

    public postfix func ^ <A>(fa: OptionOf<A>) -> Option<A>

    Parameters

    fa

    Option in higher-kind form.

    Return Value

    Value cast to Option.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, G, A>(fa: PairKOf<F, G, A>) -> PairK<F, G, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to PairK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, G>(value: PairingOf<F, G>) -> Pairing<F, G> where F : Functor, G : Functor

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Pairing.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: SetKOf<A>) -> SetK<A> where A : Hashable

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to SetK.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, G, V>(value: SumOf<F, G, V>) -> Sum<F, G, V>

    Parameters

    value

    Value in higher-kind form.

    Return Value

    Value cast to Sum.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: TrampolineOf<A>) -> Trampoline<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Trampoline.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: TreeOf<A>) -> Tree<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Tree.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(fa: TryOf<A>) -> Try<A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Try.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <E, A>(fa: ValidatedOf<E, A>) -> Validated<E, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Validated.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A>(fa: YonedaOf<F, A>) -> Yoneda<F, A> where F : Functor

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to Yoneda.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <A>(value: ZipperOf<A>) -> Zipper<A>

    Parameters

    value

    Value in the higher-kind form.

    Return Value

    Value cast to Zipper.

  • Negates a boolean value.

    Declaration

    Swift

    public func not(_ a: Bool) -> Bool

    Parameters

    a

    Value to be negated.

    Return Value

    true if the input was false; false, otherwise.

  • Conjunction of two boolean values.

    Declaration

    Swift

    public func and(_ a: Bool, _ b: Bool) -> Bool

    Parameters

    a

    Left-hand side value.

    b

    Right-hand side value.

    Return Value

    true if both inputs are true, or false otherwise.

  • Disjunction of two boolean values.

    Declaration

    Swift

    public func or(_ a: Bool, _ b: Bool) -> Bool

    Parameters

    a

    Left-hand side value.

    b

    Right-hand side value.

    Return Value

    false if both inputs are false, or true otherwise.

  • Exclusive or of two boolean values.

    Declaration

    Swift

    public func xor(_ a: Bool, _ b: Bool) -> Bool

    Parameters

    a

    Left-hand side value.

    b

    Right-hand side value.

    Return Value

    true if both inputs have different truth value, or false if they are equal.

  • Given a 0-ary function, provides a 0-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement(_ ff: @escaping () -> Bool) -> () -> Bool

    Parameters

    ff

    Function to be complemented.

    Return Value

    Function that returns the negated result of ff.

  • Given a 1-ary function, provides a 1-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A>(_ ff: @escaping (_ a: A) -> Bool) -> (A) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 2-ary function, provides a 2-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B>(_ ff: @escaping (_ a: A, _ b: B) -> Bool) -> (A, B) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 3-ary function, provides a 3-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C>(_ ff: @escaping (_ a: A, _ b: B, _ c: C) -> Bool) -> (A, B, C) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 4-ary function, provides a 4-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D) -> Bool) -> (A, B, C, D) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 5-ary function, provides a 5-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D, E>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D, _ e: E) -> Bool) -> (A, B, C, D, E) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    e

    5th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 6-ary function, provides a 6-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D, E, F>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F) -> Bool) -> (A, B, C, D, E, F) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    e

    5th argument of ff.

    f

    6th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 7-ary function, provides a 7-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D, E, F, G>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G) -> Bool) -> (A, B, C, D, E, F, G) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    e

    5th argument of ff.

    f

    6th argument of ff.

    g

    7th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 8-ary function, provides a 8-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D, E, F, G, H>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H) -> Bool) -> (A, B, C, D, E, F, G, H) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    e

    5th argument of ff.

    f

    6th argument of ff.

    g

    7th argument of ff.

    h

    8th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 9-ary function, provides a 9-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D, E, F, G, H, I>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I) -> Bool) -> (A, B, C, D, E, F, G, H, I) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    e

    5th argument of ff.

    f

    6th argument of ff.

    g

    7th argument of ff.

    h

    8th argument of ff.

    i

    9th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Given a 10-ary function, provides a 10-ary function that returns the complement boolean value.

    Declaration

    Swift

    public func complement<A, B, C, D, E, F, G, H, I, J>(_ ff: @escaping (_ a: A, _ b: B, _ c: C, _ d: D, _ e: E, _ f: F, _ g: G, _ h: H, _ i: I, _ j: J) -> Bool) -> (A, B, C, D, E, F, G, H, I, J) -> Bool

    Parameters

    ff

    Function to be complemented.

    a

    1st argument of ff.

    b

    2nd argument of ff.

    c

    3rd argument of ff.

    d

    4th argument of ff.

    e

    5th argument of ff.

    f

    6th argument of ff.

    g

    7th argument of ff.

    h

    8th argument of ff.

    i

    9th argument of ff.

    j

    10th argument of ff.

    Return Value

    Function that returns the negated result of ff.

  • Curries a 2-ary function.

    Declaration

    Swift

    public func curry<A, B, C>(_ fun: @escaping (A, B) -> C) -> (A) -> (B) -> C

    Parameters

    fun

    Function to be curried.

    Return Value

    fun in curried form.

  • Uncurries a 2-ary function.

    Declaration

    Swift

    public func uncurry<A, B, C>(_ fun: @escaping (A) -> (B) -> C) -> (A, B) -> C

    Parameters

    fun

    Function to be uncurried.

    Return Value

    fun in uncurried form.

  • Curries a 3-ary function.

    Declaration

    Swift

    public func curry<A, B, C, D>(_ fun: @escaping (A, B, C) -> D) -> (A) -> (B) -> (C) -> D

    Parameters

    fun

    Function to be curried.

    Return Value

    fun in curried form.

  • Uncurries a 3-ary function.

    Declaration

    Swift

    public func uncurry<A, B, C, D>(_ fun: @escaping (A) -> (B) -> (C) -> D) -> (A, B, C) -> D

    Parameters

    fun

    Function to be uncurried.

    Return Value

    fun in uncurried form.

  • Curries a 4-ary function.

    Declaration

    Swift

    public func curry<A, B, C, D, E>(_ fun: @escaping (A, B, C, D) -> E) -> (A) -> (B) -> (C) -> (D) -> E

    Parameters

    fun

    Function to be curried.

    Return Value

    fun in curried form.

  • Uncurries a 4-ary function.

    Declaration

    Swift

    public func uncurry<A, B, C, D, E>(_ fun: @escaping (A) -> (B) -> (C) -> (D) -> E) -> (A, B, C, D) -> E

    Parameters

    fun

    Function to be uncurried.

    Return Value

    fun in uncurried form.

  • Curries a 5-ary function.

    Declaration

    Swift

    public func curry<A, B, C, D, E, F>(_ fun: @escaping (A, B, C, D, E) -> F) -> (A) -> (B) -> (C) -> (D) -> (E) -> F

    Parameters

    fun

    Function to be curried.

    Return Value

    fun in curried form.

  • Uncurries a 5-ary function.

    Declaration

    Swift

    public func uncurry<A, B, C, D, E, F>(_ fun: @escaping (A) -> (B) -> (C) -> (D) -> (E) -> F) -> (A, B, C, D, E) -> F

    Parameters

    fun

    Function to be uncurried.

    Return Value

    fun in uncurried form.

  • Curries a 6-ary function.

    Declaration

    Swift

    public func curry<A, B, C, D, E, F, G>(_ fun: @escaping (A, B, C, D, E, F) -> G) -> (A) -> (B) -> (C) -> (D) -> (E) -> (F) -> G

    Parameters

    fun

    Function to be curried.

    Return Value

    fun in curried form.

  • Uncurries a 6-ary function.

    Declaration

    Swift

    public func uncurry<A, B, C, D, E, F, G>(_ fun: @escaping (A) -> (B) -> (C) -> (D) -> (E) -> (F) -> G) -> (A, B, C, D, E, F) -> G

    Parameters

    fun

    Function to be uncurried.

    Return Value

    fun in uncurried form.

  • Curries a 7-ary function.

    Declaration

    Swift

    public func curry<A, B, C, D, E, F, G, H>(_ fun: @escaping (A, B, C, D, E, F, G) -> H) -> (A) -> (B) -> (C) -> (D) -> (E) -> (F) -> (G) -> H

    Parameters

    fun

    Function to be curried.

    Return Value

    fun in curried form.

  • Uncurries a 7-ary function.

    Declaration

    Swift

    public func uncurry<A, B, C, D, E, F, G, H>(_ fun: @escaping (A) -> (B) -> (C) -> (D) -> (E) -> (F) -> (G) -> H) -> (A, B, C, D, E, F, G) -> H

    Parameters

    fun

    Function to be uncurried.

    Return Value

    fun in uncurried form.

  • Memoizes a 1-ary function.

    Memoization is a useful technique to cache already computed values, specially in functions with a high computational cost. It requires the input parameter to the function to be Hashable in order to be able to save the computed result. This function returns a memoized function that behaves the same as the original one. Given an input, first invokation of the memoized function will compute the result and store it. Subsequent invokations with the same input will not be computed; the stored result will be returned instead.

    Declaration

    Swift

    public func memoize<A, B>(_ f: @escaping (_ a: A) -> B) -> (A) -> B where A: Hashable

    Parameters

    f

    Function to be memoized. This function must be pure and deterministic in order to have consistent results.

    a

    Function input.

    Return Value

    A function that behaves like f but saves already computed results.

  • Memoizes a recursive 1-ary function.

    In order to memoize a recursive function, the recursive step must be memoized as well. In order to do so, callers of this function must pass a function that will receive the memoized function and the current input, and use both to provide the output. Input parameters must conform to Hashable. As an example, consider this implementation of a memoized factorial:

    let memoizedFactorial: (Int) -> Int = memoize { factorial, x in
        x == 0 ? 1 : x * factorial(x - 1)
    }
    

    Declaration

    Swift

    public func memoize<A, B>(_ f: @escaping (_ step: (_ a: A) -> B, _ input: A) -> B) -> (A) -> B where A: Hashable

    Parameters

    f

    Function to be memoized.

    step

    A closure describing a recursive step of the function.

    a

    Input to the recursive step.

    input

    Current value for the recursion.

    Return Value

    A function that behaves like f but saves already computed results.

  • Applies an argument to a 1-ary function.

    Declaration

    Swift

    public func |> <A, B>(a: A, fun: (A) -> B) -> B

    Parameters

    a

    Argument to apply.

    fun

    Function receiving the argument.

    Return Value

    Result of running the function with the argument as input.

  • Applies the first argument to a 2-ary function, returning a 1-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C>(_ a: A, _ fun: @escaping (A, B) -> C) -> (B) -> C

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Applies the first argument to a 3-ary function, returning a 2-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C, D>(_ a: A, _ fun: @escaping (A, B, C) -> D) -> (B, C) -> D

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Applies the first argument to a 4-ary function, returning a 3-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C, D, E>(_ a: A, _ fun: @escaping (A, B, C, D) -> E) -> (B, C, D) -> E

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Applies the first argument to a 5-ary function, returning a 4-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C, D, E, F>(_ a: A, _ fun: @escaping (A, B, C, D, E) -> F) -> (B, C, D, E) -> F

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Applies the first argument to a 6-ary function, returning a 5-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C, D, E, F, G>(_ a: A, _ fun: @escaping (A, B, C, D, E, F) -> G) -> (B, C, D, E, F) -> G

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Applies the first argument to a 7-ary function, returning a 6-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C, D, E, F, G, H>(_ a: A, _ fun: @escaping (A, B, C, D, E, F, G) -> H) -> (B, C, D, E, F, G) -> H

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Applies the first argument to a 8-ary function, returning a 7-ary function with the rest of the arguments of the original function.

    Declaration

    Swift

    public func |><A, B, C, D, E, F, G, H, I>(_ a: A, _ fun: @escaping (A, B, C, D, E, F, G, H) -> I) -> (B, C, D, E, F, G, H) -> I

    Parameters

    a

    Input to the first argument of the function

    fun

    Function to be applied.

    Return Value

    A function with the same behavior of the input function where the first argument is fixed to the value of the provided argument.

  • Identity function.

    Returns the input without changing it.

    Declaration

    Swift

    public func id<A>(_ a: A) -> A

    Parameters

    a

    A value.

    Return Value

    The value received as input, with no modifications.

  • Provides a constant function.

    Declaration

    Swift

    public func constant<A>(_ a: @autoclosure @escaping () -> A) -> () -> A

    Parameters

    a

    Constant value to return.

    Return Value

    A 0-ary function that constantly return the value provided as argument.

  • Provides a constant function.

    Declaration

    Swift

    public func constant<A, B>(_ a: @autoclosure @escaping () -> A) -> (B) -> A

    Parameters

    a

    Constant value to return.

    Return Value

    A 1-ary function that constantly return the value provided as argument, regardless of its input parameter.

  • Provides a constant function.

    Declaration

    Swift

    public func constant<A, B, C>(_ a: @autoclosure @escaping () -> A) -> (B, C) -> A

    Parameters

    a

    Constant value to return.

    Return Value

    A 2-ary function that constantly return the value provided as argument, regardless of its input parameters.

  • Provides a constant function.

    Declaration

    Swift

    public func constant<A, B, C, D>(_ a: @autoclosure @escaping () -> A) -> (B, C, D) -> A

    Parameters

    a

    Constant value to return.

    Return Value

    A 3-ary function that constantly return the value provided as argument, regardless of its input parameters.

  • Provides a constant function.

    Declaration

    Swift

    public func constant<A, B, C, D, E>(_ a: @autoclosure @escaping () -> A) -> (B, C, D, E) -> A

    Parameters

    a

    Constant value to return.

    Return Value

    A 4-ary function that constantly return the value provided as argument, regardless of its input parameters.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () -> A) -> () -> B
  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () -> A) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () throws -> A) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () throws -> A) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) -> B) -> (A) -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) -> B) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func compose<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B>(_ f: @escaping () -> A, _ g: @escaping (A) -> B) -> () -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) -> B) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B>(_ f: @escaping () -> A, _ g: @escaping (A) throws -> B) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) throws -> B) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) -> C) -> (A) -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) -> C) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func andThen<A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B>(_ f: @escaping () -> A, _ g: @escaping (A) -> B) -> () -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) -> B) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B>(_ f: @escaping () -> A, _ g: @escaping (A) throws -> B) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) throws -> B) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) -> C) -> (A) -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) -> C) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func >>><A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () -> A) -> () -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () -> A) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () throws -> A) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 0-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () throws -> A) -> () throws -> B

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) -> B) -> (A) -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) -> B) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Composes a 1-ary function with a 1-ary function.

    Returns a function that is the result of applying g to the output of f.

    Declaration

    Swift

    public func <<<<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> C

    Parameters

    g

    Left-hand side of the function composition.

    f

    Right-hand side of the function composition.

    Return Value

    A function that applies g to the output of f.

  • Flips the arguments of a binary function.

    Declaration

    Swift

    public func flip<A, B, C>(_ f: @escaping (A, B) -> C) -> (B, A) -> C

    Parameters

    f

    Function whose arguments must be flipped.

    Return Value

    A function with the same behavior as the input, but with arguments flipped.

  • Reverses the inputs of a 2-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, R>(_ f: @escaping (P1, P2) -> R) -> (P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 3-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, R>(_ f: @escaping (P1, P2, P3) -> R) -> (P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 4-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, R>(_ f: @escaping (P1, P2, P3, P4) -> R) -> (P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 5-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, P5, R>(_ f: @escaping (P1, P2, P3, P4, P5) -> R) -> (P5, P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 6-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, P5, P6, R>(_ f: @escaping (P1, P2, P3, P4, P5, P6) -> R) -> (P6, P5, P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 7-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, P5, P6, P7, R>(_ f: @escaping (P1, P2, P3, P4, P5, P6, P7) -> R) -> (P7, P6, P5, P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 8-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, P5, P6, P7, P8, R>(_ f: @escaping (P1, P2, P3, P4, P5, P6, P7, P8) -> R) -> (P8, P7, P6, P5, P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 9-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, P5, P6, P7, P8, P9, R>(_ f: @escaping (P1, P2, P3, P4, P5, P6, P7, P8, P9) -> R) -> (P9, P8, P7, P6, P5, P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Reverses the inputs of a 10-ary function.

    Declaration

    Swift

    public func reverse<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, R>(_ f: @escaping (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> R) -> (P10, P9, P8, P7, P6, P5, P4, P3, P2, P1) -> R

    Parameters

    f

    Function whose inputs should be reversed.

    Return Value

    A function with the same behaviour as f but with reversed input parameters.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A, B>(fa: EitherTOf<F, A, B>) -> EitherT<F, A, B>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to EitherT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <E, W, A>(value: EnvTOf<E, W, A>) -> EnvT<E, W, A>

    Parameters

    value

    Value in the higher-kind form.

    Return Value

    Value cast to EnvT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, A>(fa: OptionTOf<F, A>) -> OptionT<F, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to OptionT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, S, A>(fa: StateTOf<F, S, A>) -> StateT<F, S, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to StateT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <S, W, A>(value: StoreTOf<S, W, A>) -> StoreT<S, W, A>

    Parameters

    value

    Value in the higher-kind form.

    Return Value

    Value cast to StoreT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <M, W, A>(value: TracedTOf<M, W, A>) -> TracedT<M, W, A>

    Parameters

    fa

    Value in the higher-kind form.

    Return Value

    Value cast to TracedT.

  • Safe downcast.

    Declaration

    Swift

    public postfix func ^ <F, W, A>(fa: WriterTOf<F, W, A>) -> WriterT<F, W, A>

    Parameters

    fa

    Value in higher-kind form.

    Return Value

    Value cast to WriterT.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A>(
        _ bound: BoundVar<F, A>,
        _ fa: @autoclosure @escaping () -> Kind<F, A>) -> BindingExpression<F>

    Parameters

    bound

    Variable to be bound in the expression.

    fa

    Monadic effect.

    Return Value

    A binding expression.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B)>) -> BindingExpression<F>

    Parameters

    bounds

    A 2-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C)>) -> BindingExpression<F>

    Parameters

    bounds

    A 3-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D)>) -> BindingExpression<F>

    Parameters

    bounds

    A 4-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D, E>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>, BoundVar<F, E>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D, E)>) -> BindingExpression<F>

    Parameters

    bounds

    A 5-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D, E, G>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>, BoundVar<F, E>, BoundVar<F, G>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D, E, G)>) -> BindingExpression<F>

    Parameters

    bounds

    A 6-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D, E, G, H>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>, BoundVar<F, E>, BoundVar<F, G>, BoundVar<F, H>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D, E, G, H)>) -> BindingExpression<F>

    Parameters

    bounds

    A 7-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D, E, G, H, I>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>, BoundVar<F, E>, BoundVar<F, G>, BoundVar<F, H>, BoundVar<F, I>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D, E, G, H, I)>) -> BindingExpression<F>

    Parameters

    bounds

    A 8-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D, E, G, H, I, J>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>, BoundVar<F, E>, BoundVar<F, G>, BoundVar<F, H>, BoundVar<F, I>, BoundVar<F, J>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D, E, G, H, I, J)>) -> BindingExpression<F>

    Parameters

    bounds

    A 9-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression.

    Declaration

    Swift

    public func <-<F: Monad, A, B, C, D, E, G, H, I, J, K>(
        _ bounds: (BoundVar<F, A>, BoundVar<F, B>, BoundVar<F, C>, BoundVar<F, D>, BoundVar<F, E>, BoundVar<F, G>, BoundVar<F, H>, BoundVar<F, I>, BoundVar<F, J>, BoundVar<F, K>),
        _ fa: @autoclosure @escaping () -> Kind<F, (A, B, C, D, E, G, H, I, J, K)>) -> BindingExpression<F>

    Parameters

    bounds

    A 10-ary tuple of variables to be bound to the values produced by the effect.

    fa

    Monadic effect.

    Return Value

    A binding expresssion.

  • Creates a binding expression that discards the produced value.

    Declaration

    Swift

    public prefix func |<-<F: Monad, A>(_ fa: @autoclosure @escaping () -> Kind<F, A>) -> BindingExpression<F>

    Parameters

    fa

    Monadic effect.

    Return Value

    A binding expression.

  • Monad comprehension.

    Chains multiple binding expressions in imperative-style syntax by using the flatMap operation of the contextual Monad, and yields a final result.

    Declaration

    Swift

    public func binding<F: Monad, A>(
        _ instructions: BindingExpression<F>...,
        yield value: @autoclosure @escaping () -> A) -> Kind<F, A>

    Parameters

    instructions

    A variable number of binding expressions.

    value

    Value to be yield by the monad comprehension.

    Return Value

    An effect resulting from the chaining of all the effects included in this monad comprehension.

  • Monad comprehension.

    Chains multiple binding expressions in imperative-style syntax by using the flatMap operation of the contextual Monad, and yields a final result.

    Declaration

    Swift

    public func binding<F: Monad, A>(
        @BindingsBuilder _ instructions: () -> [BindingExpression<F>],
        yield value: @escaping () -> A) -> Kind<F, A>

    Parameters

    instructions

    A variable number of binding expressions.

    value

    Value to be yield by the monad comprehension.

    Return Value

    An effect resulting from the chaining of all the effects included in this monad comprehension.

  • Utility alias for MonadReader.ask in a monad comprehension.

    Declaration

    Swift

    public func ask<F>() -> Kind<F, F.D> where F : MonadReader

    Return Value

    Result of MonadReader.ask.

  • Utility function for MonadState.get in monad comprehensions.

    Declaration

    Swift

    public func getState<F>() -> Kind<F, F.S> where F : MonadState

    Return Value

    Result from MonadState.get.

  • Utility function for MonadState.set in monad comprehensions.

    Declaration

    Swift

    public func setState<F>(_ state: F.S) -> BindingExpression<F> where F : MonadState

    Parameters

    state

    State to be set in MonadState.set.

    Return Value

    A binding expression.

  • Utility function for MonadState.modify in monad comprehensions.

    Declaration

    Swift

    public func modifyState<F: MonadState>(_ f: @escaping (F.S) -> F.S) -> BindingExpression<F>

    Parameters

    f

    Function for MonadState.modify.

    Return Value

    A binding expression.

  • Utility function for MonadState.inspect in monad comprehensions.

    Declaration

    Swift

    public func inspectState<F: MonadState, A>(_ f: @escaping (F.S) -> A) -> Kind<F, A>

    Parameters

    f

    Function for MonadState.inspect.

    Return Value

    Result from MonadState.inspect.

  • Utility function for MonadWriter.tell in monad comprehensions.

    Declaration

    Swift

    public func tell<F>(_ w: F.W) -> BindingExpression<F> where F : MonadWriter

    Parameters

    w

    Value for MonadWriter.tell.

    Return Value

    A binding expression.