Functions
The following functions are available globally.
-
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>(value: ResourceOf<F, A>) -> Resource<F, A> where F : BracketParameters
valueValue 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 : AsyncParameters
queueQueue 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
fa1st computation.
fb2nd 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
fa1st computation.
fb2nd computation.
fc3rd computation.
Return Value
A computation that describes the parallel execution.
-
Runs 4 computations in parallel and tuples their results.
Declaration
Parameters
fa1st computation.
fb2nd computation.
fc3rd computation.
fd4th computation.
Return Value
A computation that describes the parallel execution.
-
Runs 5 computations in parallel and tuples their results.
Declaration
Parameters
fa1st computation.
fb2nd computation.
fc3rd computation.
fd4th computation.
fe5th computation.
Return Value
A computation that describes the parallel execution.
-
Runs 6 computations in parallel and tuples their results.
Declaration
Parameters
fa1st computation.
fb2nd computation.
fc3rd computation.
fd4th computation.
fe5th computation.
fg6th computation.
Return Value
A computation that describes the parallel execution.
-
Runs 7 computations in parallel and tuples their results.
Declaration
Parameters
fa1st computation.
fb2nd computation.
fc3rd computation.
fd4th computation.
fe5th computation.
fg6th computation.
fh7th computation.
Return Value
A computation that describes the parallel execution.
-
Runs 8 computations in parallel and tuples their results.
Declaration
Parameters
fa1st computation.
fb2nd computation.
fc3rd computation.
fd4th computation.
fe5th computation.
fg6th computation.
fh7th computation.
fi8th computation.
Return Value
A computation that describes the parallel execution.
-
Runs 9 computations in parallel and tuples their results.
Declaration
Parameters
fa1st computation.
fb2nd computation.
fc3rd computation.
fd4th computation.
fe5th computation.
fg6th computation.
fh7th computation.
fi8th computation.
fj9th computation.
Return Value
A computation that describes the parallel execution.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <A>(value: ObservableKOf<A>) -> ObservableK<A>Parameters
valueValue in higher-kind form.
Return Value
Value cast to ObservableK.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <F, A, B>(value: CokleisliOf<F, A, B>) -> Cokleisli<F, A, B>Parameters
valueValue in higher-kind form.
Return Value
Value cast to Cokleisli.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <A>(fa: Function0Of<A>) -> Function0<A>Parameters
faValue 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
faValue in the higher-kind form.
Return Value
Value cast to
Function1.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <I, O>(fa: LazyFunction1Of<I, O>) -> LazyFunction1<I, O>Parameters
faValue in the higher-kind form.
Return Value
Value cast to
LazyFunction1.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <F, A>(fa: CoyonedaOf<F, A>) -> Coyoneda<F, A>Parameters
faValue in higher-kind form.
Return Value
Value cast to Coyoneda.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <K, A>(fa: DictionaryKOf<K, A>) -> DictionaryK<K, A> where K : HashableParameters
faValue in higher-kind form.
Return Value
Value cast to DictionaryK.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <A>(fa: NonEmptyArrayOf<A>) -> NonEmptyArray<A>Parameters
faValue in higher-kind form.
Return Value
Value cast to NonEmptyArray.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <A>(fa: TrampolineOf<A>) -> Trampoline<A>Parameters
faValue in higher-kind form.
Return Value
Value cast to Trampoline.
-
Safe downcast.
Declaration
Swift
public postfix func ^ <E, A>(fa: ValidatedOf<E, A>) -> Validated<E, A>Parameters
faValue in higher-kind form.
Return Value
Value cast to Validated.
-
Negates a boolean value.
Declaration
Swift
public func not(_ a: Bool) -> BoolParameters
aValue to be negated.
Return Value
trueif the input wasfalse;false, otherwise. -
Conjunction of two boolean values.
Declaration
Swift
public func and(_ a: Bool, _ b: Bool) -> BoolParameters
aLeft-hand side value.
bRight-hand side value.
Return Value
trueif both inputs aretrue, orfalseotherwise. -
Disjunction of two boolean values.
Declaration
Swift
public func or(_ a: Bool, _ b: Bool) -> BoolParameters
aLeft-hand side value.
bRight-hand side value.
Return Value
falseif both inputs arefalse, ortrueotherwise. -
Exclusive or of two boolean values.
Declaration
Swift
public func xor(_ a: Bool, _ b: Bool) -> BoolParameters
aLeft-hand side value.
bRight-hand side value.
Return Value
trueif both inputs have different truth value, orfalseif 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) -> () -> BoolParameters
ffFunction 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) -> BoolParameters
ffFunction to be complemented.
a1st 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th argument of
ff.e5th 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th argument of
ff.e5th argument of
ff.f6th 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th argument of
ff.e5th argument of
ff.f6th argument of
ff.g7th 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th argument of
ff.e5th argument of
ff.f6th argument of
ff.g7th argument of
ff.h8th 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th argument of
ff.e5th argument of
ff.f6th argument of
ff.g7th argument of
ff.h8th argument of
ff.i9th 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) -> BoolParameters
ffFunction to be complemented.
a1st argument of
ff.b2nd argument of
ff.c3rd argument of
ff.d4th argument of
ff.e5th argument of
ff.f6th argument of
ff.g7th argument of
ff.h8th argument of
ff.i9th argument of
ff.j10th 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) -> CParameters
funFunction to be curried.
Return Value
funin curried form. -
Uncurries a 2-ary function.
Declaration
Swift
public func uncurry<A, B, C>(_ fun: @escaping (A) -> (B) -> C) -> (A, B) -> CParameters
funFunction to be uncurried.
Return Value
funin 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) -> DParameters
funFunction to be curried.
Return Value
funin 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) -> DParameters
funFunction to be uncurried.
Return Value
funin 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) -> EParameters
funFunction to be curried.
Return Value
funin 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) -> EParameters
funFunction to be uncurried.
Return Value
funin 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) -> FParameters
funFunction to be curried.
Return Value
funin 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) -> FParameters
funFunction to be uncurried.
Return Value
funin 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) -> GParameters
funFunction to be curried.
Return Value
funin 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) -> GParameters
funFunction to be uncurried.
Return Value
funin 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) -> HParameters
funFunction to be curried.
Return Value
funin 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) -> HParameters
funFunction to be uncurried.
Return Value
funin 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
Hashablein 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: HashableParameters
fFunction to be memoized. This function must be pure and deterministic in order to have consistent results.
aFunction input.
Return Value
A function that behaves like
fbut 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: HashableParameters
fFunction to be memoized.
stepA closure describing a recursive step of the function.
aInput to the recursive step.
inputCurrent value for the recursion.
Return Value
A function that behaves like
fbut saves already computed results.
-
Applies an argument to a 1-ary function.
Declaration
Swift
public func |> <A, B>(a: A, fun: (A) -> B) -> BParameters
aArgument to apply.
funFunction 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) -> CParameters
aInput to the first argument of the function
funFunction 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) -> DParameters
aInput to the first argument of the function
funFunction 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) -> EParameters
aInput to the first argument of the function
funFunction 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) -> FParameters
aInput to the first argument of the function
funFunction 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) -> GParameters
aInput to the first argument of the function
funFunction 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) -> HParameters
aInput to the first argument of the function
funFunction 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) -> IParameters
aInput to the first argument of the function
funFunction 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) -> AParameters
aA 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) -> () -> AParameters
aConstant 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) -> AParameters
aConstant 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) -> AParameters
aConstant 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) -> AParameters
aConstant 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) -> AParameters
aConstant 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
gto the output off.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
gto the output off.Declaration
Swift
public func compose<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () -> A) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func compose<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () throws -> A) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func compose<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () throws -> A) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func compose<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) -> B) -> (A) -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func compose<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) -> B) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func compose<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func compose<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B>(_ f: @escaping () -> A, _ g: @escaping (A) -> B) -> () -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) -> B) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B>(_ f: @escaping () -> A, _ g: @escaping (A) throws -> B) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) throws -> B) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) -> C) -> (A) -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) -> C) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func andThen<A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B>(_ f: @escaping () -> A, _ g: @escaping (A) -> B) -> () -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) -> B) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B>(_ f: @escaping () -> A, _ g: @escaping (A) throws -> B) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B>(_ f: @escaping () throws -> A, _ g: @escaping (A) throws -> B) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) -> C) -> (A) -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) -> C) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B, C>(_ f: @escaping (A) -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func >>><A, B, C>(_ f: @escaping (A) throws -> B, _ g: @escaping (B) throws -> C) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () -> A) -> () -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () -> A) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B>(_ g: @escaping (A) -> B, _ f: @escaping () throws -> A) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 0-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B>(_ g: @escaping (A) throws -> B, _ f: @escaping () throws -> A) -> () throws -> BParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) -> B) -> (A) -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) -> B) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B, C>(_ g: @escaping (B) -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Composes a 1-ary function with a 1-ary function.
Returns a function that is the result of applying
gto the output off.Declaration
Swift
public func <<<<A, B, C>(_ g: @escaping (B) throws -> C, _ f: @escaping (A) throws -> B) -> (A) throws -> CParameters
gLeft-hand side of the function composition.
fRight-hand side of the function composition.
Return Value
A function that applies
gto the output off. -
Flips the arguments of a binary function.
Declaration
Swift
public func flip<A, B, C>(_ f: @escaping (A, B) -> C) -> (B, A) -> CParameters
fFunction 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut 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) -> RParameters
fFunction whose inputs should be reversed.
Return Value
A function with the same behaviour as
fbut with reversed input parameters.
-
Creates a binding expression.
Declaration
Swift
public func <-<F: Monad, A>( _ bound: BoundVar<F, A>, _ fa: @autoclosure @escaping () -> Kind<F, A>) -> BindingExpression<F>Parameters
boundVariable to be bound in the expression.
faMonadic 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
boundsA 2-ary tuple of variables to be bound to the values produced by the effect.
faMonadic effect.
Return Value
A binding expresssion.
-
Creates a binding expression.
Declaration
Parameters
boundsA 3-ary tuple of variables to be bound to the values produced by the effect.
faMonadic effect.
Return Value
A binding expresssion.
-
Creates a binding expression.
Declaration
Parameters
boundsA 4-ary tuple of variables to be bound to the values produced by the effect.
faMonadic effect.
Return Value
A binding expresssion.
-
Creates a binding expression.
Declaration
Parameters
boundsA 5-ary tuple of variables to be bound to the values produced by the effect.
faMonadic effect.
Return Value
A binding expresssion.
-
Creates a binding expression.
Declaration
Parameters
boundsA 6-ary tuple of variables to be bound to the values produced by the effect.
faMonadic effect.
Return Value
A binding expresssion.
-
Creates a binding expression.
Declaration
Parameters
boundsA 7-ary tuple of variables to be bound to the values produced by the effect.
faMonadic effect.
Return Value
A binding expresssion.
-
Creates a binding expression.
Declaration
Parameters
boundsA 8-ary tuple of variables to be bound to the values produced by the effect.
faMonadic 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
boundsA 9-ary tuple of variables to be bound to the values produced by the effect.
faMonadic 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
boundsA 10-ary tuple of variables to be bound to the values produced by the effect.
faMonadic 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
faMonadic effect.
Return Value
A binding expression.
-
Monad comprehension.
Chains multiple binding expressions in imperative-style syntax by using the
flatMapoperation of the contextualMonad, 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
instructionsA variable number of binding expressions.
valueValue 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
flatMapoperation of the contextualMonad, 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
instructionsA variable number of binding expressions.
valueValue 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.askin a monad comprehension.Declaration
Swift
public func ask<F>() -> Kind<F, F.D> where F : MonadReaderReturn Value
Result of
MonadReader.ask.
-
Utility function for
MonadState.getin monad comprehensions.Declaration
Swift
public func getState<F>() -> Kind<F, F.S> where F : MonadStateReturn Value
Result from
MonadState.get. -
Utility function for
MonadState.setin monad comprehensions.Declaration
Swift
public func setState<F>(_ state: F.S) -> BindingExpression<F> where F : MonadStateParameters
stateState to be set in
MonadState.set.Return Value
A binding expression.
-
Utility function for
MonadState.modifyin monad comprehensions.Declaration
Swift
public func modifyState<F: MonadState>(_ f: @escaping (F.S) -> F.S) -> BindingExpression<F>Parameters
fFunction for
MonadState.modify.Return Value
A binding expression.
-
Utility function for
MonadState.inspectin monad comprehensions.Declaration
Swift
public func inspectState<F: MonadState, A>(_ f: @escaping (F.S) -> A) -> Kind<F, A>Parameters
fFunction for
MonadState.inspect.Return Value
Result from
MonadState.inspect.
-
Utility function for
MonadWriter.tellin monad comprehensions.Declaration
Swift
public func tell<F>(_ w: F.W) -> BindingExpression<F> where F : MonadWriterParameters
wValue for
MonadWriter.tell.Return Value
A binding expression.
Install in Dash
Functions Reference