Kind
open class Kind<F, A>
Simulates a HigherKinded Type in Swift with 1 type argument.
This class simulates HigherKinded Type support in Swift. Kind<F, A>
is an alias for F<A>
, which is not syntactically valid in Swift.
Classes that want to have HKT support must extend this class. Type parameter F
is reserved for a witness to prevent circular references in the inheritance relationship. By convention, witnesses are named like the class they represent, with the prefix For
. As an example:
class ForOption {}
class Option<A>: Kind<ForOption, A> {}

Default initializer
Declaration
Swift
public init()

Undocumented
Declaration
Swift
static func ana<B>(_ a: B, _ coalgebra: @escaping Coalgebra<A, B>) > Kind<F, A>

Undocumented
Declaration
Swift
func projectT() > Kind<A, Kind<F, A>>

Undocumented
Declaration
Swift
static func project() > Coalgebra<A, Kind<F, A>>

Undocumented
Declaration
Swift
static func runAsync(_ fa: @escaping Proc<F.E, A>) > Kind<F, A>

Undocumented
Declaration
Swift
func runAsyncCancellable(_ callback: @escaping (Either<F.E, A>) > Kind<F, ()>) > Kind<F, Disposable>

Undocumented
Declaration
Swift
func runAsync(_ callback: @escaping (Either<F.E, A>) > Kind<F, ()>) > Kind<F, ()>

Undocumented
Declaration
Swift
static func suspend(_ fa: @escaping () > Kind<F, A>) > Kind<F, A>

Undocumented
Declaration
Swift
static func delay(_ f: @escaping () throws > A) > Kind<F, A>

Undocumented
Declaration
Swift
static func lazy() > Kind<F, ()>

Undocumented
Declaration
Swift
static func delayEither(_ f: @escaping () > Either<F.E, A>) > Kind<F, A>

Lifts a value to the context type implementing this instance of
Applicative
.This is a convenience method to call
Applicative.pure
as a static method of this type.Declaration
Swift
static func pure(_ a: A) > Kind<F, A>
Parameters
a
Value to be lifted.
Return Value
Provided value in the context type implementing this instance.

Sequential application.
This is a convenience method to call
Applicative.ap
as an instance method of this type.Declaration
Swift
func ap<AA, B>(_ fa: Kind<F, AA>) > Kind<F, B> where A == (AA) > B
Parameters
fa
A value in the context implementing this instance.
Return Value
A value in the context implementing this instance, resulting of the transformation of the contained original value with the contained function.

Creates a tuple in the context implementing this instance from two values in the same context.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B>(_ fa: Kind<F, A>, _ fb: Kind<F, B>) > Kind<F, (A, B)>
Parameters
fa
1st value for the tuple.
fb
2nd value for the tuple.
Return Value
A tuple of the provided values in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, Z>(_ fa: Kind<F, (A, B)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, Z)>
Parameters
fa
A tuple of two elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, C, Z>(_ fa: Kind<F, (A, B, C)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, C, Z)>
Parameters
fa
A tuple of three elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, C, D, Z>(_ fa: Kind<F, (A, B, C, D)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, C, D, Z)>
Parameters
fa
A tuple of four elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, C, D, E, Z>(_ fa: Kind<F, (A, B, C, D, E)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, C, D, E, Z)>
Parameters
fa
A tuple of five elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, C, D, E, G, Z>(_ fa: Kind<F, (A, B, C, D, E, G)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, C, D, E, G, Z)>
Parameters
fa
A tuple of six elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, C, D, E, G, H, Z>(_ fa: Kind<F, (A, B, C, D, E, G, H)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, C, D, E, G, H, Z)>
Parameters
fa
A tuple of seven elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Adds an element to the right of a tuple in the context implementing this instance.
This is a convenience method to call
Applicative.product
as a static method of this type.Declaration
Swift
static func product<A, B, C, D, E, G, H, I, Z>(_ fa: Kind<F, (A, B, C, D, E, G, H, I)>, _ fz: Kind<F, Z>) > Kind<F, (A, B, C, D, E, G, H, I, Z)>
Parameters
fa
A tuple of eight elements in the context implementing this instance.
fz
A value in the context implementing this instance.
Return Value
A tuple with the value of the second argument added to the right of the tuple, in the context implementing this instance.

Creates a tuple out of two values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B>(_ a: Kind<F, A>, _ b : Kind<F, B>) > Kind<F, (A, B)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of three values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>) > Kind<F, (A, B, C)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of four values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C, D>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>) > Kind<F, (A, B, C, D)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
d
4th value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of five values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C, D, E>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>) > Kind<F, (A, B, C, D, E)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
d
4th value of the tuple.
e
5th value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of six values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C, D, E, G>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>) > Kind<F, (A, B, C, D, E, G)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
d
4th value of the tuple.
e
5th value of the tuple.
g
6th value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of seven values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C, D, E, G, H>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ h: Kind<F, H>) > Kind<F, (A, B, C, D, E, G, H)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
d
4th value of the tuple.
e
5th value of the tuple.
g
6th value of the tuple.
h
7th value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of eight values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C, D, E, G, H, I>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ h: Kind<F, H>, _ i: Kind<F, I>) > Kind<F, (A, B, C, D, E, G, H, I)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
d
4th value of the tuple.
e
5th value of the tuple.
g
6th value of the tuple.
h
7th value of the tuple.
i
8th value of the tuple.
Return Value
A tuple in the context implementing this instance.

Creates a tuple out of nine values in the context implementing this instance.
This is a convenience method to call
Applicative.tupled
as a static method of this type.Declaration
Swift
static func tupled<A, B, C, D, E, G, H, I, J>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ h: Kind<F, H>, _ i: Kind<F, I>, _ j: Kind<F, J>) > Kind<F, (A, B, C, D, E, G, H, I, J)>
Parameters
a
1st value of the tuple.
b
2nd value of the tuple.
c
3rd value of the tuple.
d
4th value of the tuple.
e
5th value of the tuple.
g
6th value of the tuple.
h
7th value of the tuple.
i
8th value of the tuple.
j
9th value of the tuple.
Return Value
A tuple in the context implementing this instance.

Combines the result of two computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ f: @escaping (A, B) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of three computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ f: @escaping (A, B, C) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of four computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, D, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ f: @escaping (A, B, C, D) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
d
4th computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of five computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, D, E, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ f: @escaping (A, B, C, D, E) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
d
4th computation.
e
5th computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of six computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, D, E, G, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ f: @escaping (A, B, C, D, E, G) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
d
4th computation.
e
5th computation.
g
6th computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of seven computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, D, E, G, H, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ h: Kind<F, H>, _ f: @escaping (A, B, C, D, E, G, H) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
d
4th computation.
e
5th computation.
g
6th computation.
h
7th computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of eight computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, D, E, G, H, I, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ h: Kind<F, H>, _ i: Kind<F, I>, _ f: @escaping (A, B, C, D, E, G, H, I) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
d
4th computation.
e
5th computation.
g
6th computation.
h
7th computation.
i
8th computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Combines the result of nine computations in the context implementing this instance, using the provided function.
This is a convenience method to call
Applicative.map
as a static method of this type.Declaration
Swift
static func map<A, B, C, D, E, G, H, I, J, Z>(_ a: Kind<F, A>, _ b: Kind<F, B>, _ c: Kind<F, C>, _ d: Kind<F, D>, _ e: Kind<F, E>, _ g: Kind<F, G>, _ h: Kind<F, H>, _ i: Kind<F, I>, _ j: Kind<F, J>, _ f: @escaping (A, B, C, D, E, G, H, I, J) > Z) > Kind<F, Z>
Parameters
a
1st computation.
b
2nd computation.
c
3rd computation.
d
4th computation.
e
5th computation.
g
6th computation.
h
7th computation.
i
8th computation.
j
9th computation.
f
Combination function.
Return Value
Result of combining the provided computations, in the context implementing this instance.

Lifts an error to the context implementing this instance.
This is a convenience method to call
ApplicativeError.raiseError
as a static method of this type.Declaration
Swift
static func raiseError(_ e: F.E) > Kind<F, A>
Parameters
e
A value of the error type.
Return Value
A value representing the error in the context implementing this instance.

Handles an error, potentially recovering from it by mapping it to a value in the context implementing this instance.
This is a convenience method to call
ApplicativeError.handleErrorWith
as an instance method of this type.Declaration
Swift
func handleErrorWith(_ f: @escaping (F.E) > Kind<F, A>) > Kind<F, A>
Parameters
f
A recovery function.
Return Value
A value where the possible errors have been recovered using the provided function.

Handles an error, potentially recovering from it by mapping it to a value.
This is a convenience method to call
ApplicativeError.handleError
as an instance method of this type.Declaration
Swift
func handleError(_ f: @escaping (F.E) > A) > Kind<F, A>
Parameters
f
A recovery function.
Return Value
A value where the possible errors have been recovered using the provided function.

Handles errors by converting them into
Either
values in the context implementing this instance.This is a convenience method to call
ApplicativeError.attempt
as an instance method of this type.Declaration
Swift
func attempt() > Kind<F, Either<F.E, A>>
Return Value
An either wrapped in the context implementing this instance.

Converts an
Either
value into a value in the context implementing this instance.This is a convenience method to call
ApplicativeError.fromEither
as a static method of this type.Declaration
Swift
static func fromEither(_ fea: Either<F.E, A>) > Kind<F, A>
Parameters
fea
An
Either
value.Return Value
A value in the context implementing this instance.

Evaluates a throwing function, catching and mapping errors.
This is a convenience method to call
ApplicativeError.catchError
as a static method of this type.Declaration
Swift
static func catchError(_ f: () throws > A, _ recover: (Error) > F.E) > Kind<F, A>
Parameters
f
A throwing function.
recover
A function that maps from
Error
to the type that this instance is able to handle.Return Value
A value in the context implementing this instance.

Evaluates a throwing function, catching errors.
This is a convenience method to call
ApplicativeError.catchError
as a static method of this type.Declaration
Swift
static func catchError(_ f: () throws > A) > Kind<F, A>
Parameters
f
A throwing function.
Return Value
A value in the context implementing this instance.

Applies this value to a function that takes a value in this context, and returns a normal value.
This function is the dual of
Monad.flatMap
.This is a convenience function to call
Comonad.coflatMap
as an instance method.Declaration
Swift
func coflatMap<B>(_ f: @escaping (Kind<F, A>) > B) > Kind<F, B>
Parameters
f
Extracting function.
Return Value
The result of extracting and transforming the value, in the context implementing this instance.

Extracts the value contained in this context.
This function is the dual of
Monad.pure
(viaApplicative
).This is a convenience function to call
Comonad.extract
as an instance method.Declaration
Swift
func extract() > A
Return Value
A normal value.

Wraps this in another layer of this context.
Declaration
Swift
func duplicate() > Kind<F, Kind<F, A>>
Return Value
This value wrapped in another context layer.

Creates a new value transforming the type using the provided function, preserving the structure of the original type.
Declaration
Swift
func contramap<B>(_ f : @escaping (B) > A) > Kind<F, B>
Parameters
f
Transforming function.
Return Value
The result of transforming the value type using the provided function, maintaining the structure of the original value.

Given a function, provides a new function lifted to the context type implementing this instance of
Contravariant
, but reversing the direction of the arrow.Declaration
Swift
static func contralift<B>(_ f : @escaping (A) > B) > (Kind<F, B>) > Kind<F, A>
Parameters
f
Function to be lifted.
Return Value
Function in the context implementing this instance.

Checks if two kinds are equal, given that the enclosed value type conforms to
Equatable
.This is a convenience method to call
EquatableK.eq
as an instance method of this type.Declaration
Swift
func eq(_ rhs: Kind<F, A>) > Bool
Parameters
lhs
Left hand side of the equality check.
rhs
Right hand side of the equality check.
Return Value
A boolean value indicating if the two values are equal or not.

Declaration
Swift
public static func == (lhs: Kind<F, A>, rhs: Kind<F, A>) > Bool

Eagerly folds this value to a summary value from left to right.
Declaration
Swift
func foldLeft<B>(_ b: B, _ f: @escaping (B, A) > B) > B
Parameters
b
Initial value for the folding process.
f
Folding function.
Return Value
Summary value resulting from the folding process.

Reduces the elements of this structure down to a single value by applying the provided transformation and aggregation funtions in a leftassociative manner.
Declaration
Swift
func reduceLeftToOption<B>(_ f: @escaping (A) > B, _ g: @escaping (B, A) > B) > Option<B>
Parameters
f
Transforming function.
g
Folding function.
Return Value
Optional summary value resulting from the folding process. It will be an
Option.none
if the structure is empty, or a value if not. 
Reduces the elements of this structure down to a single value by applying the provided transformation and aggregation functions in a rightassociative manner.
Declaration
Parameters
f
Transforming function.
g
Folding function.
Return Value
Optional summary value resulting from the folding process. It will be an
Option.none
if the structure is empty, or a value if not. 
Reduces the elements of this structure down to a single value by applying the provided aggregation function in a leftassociative manner.
Declaration
Swift
func reduceLeftOption(_ f: @escaping (A, A) > A) > Option<A>
Parameters
f
Folding function.
Return Value
Optional summary value resulting from the folding process.

Reduces the elements of this structure down to a single value by applying the provided aggregation function in a rightassociative manner.
Parameters
f
Folding function.
Return Value
Optional summary value resulting from the folding process.

Transforms the elements of this structure to a type with a
Monoid
instance and folds them using the empty and combine methods of suchMonoid
instance.Declaration
Swift
func foldMap<B: Monoid>(_ f: @escaping (A) > B) > B
Parameters
fa
Value to be transformed and folded.
f
Transforming function.
Return Value
Summary value resulting from the transformation and folding process.

Traverses this structure of values, transforming them with a provided function and discarding the result of its effect.
Declaration
Swift
func traverse_<G: Applicative, B>(_ f: @escaping (A) > Kind<G, B>) > Kind<G, Unit>
Parameters
f
Transforming function.
Return Value
Unit in the context of the effect of the result of the transforming function.

Traverses this structure of effects, performing them and discarding their result.
Declaration
Swift
func sequence_<G, AA>() > Kind<G, Unit> where A == Kind<G, AA>, G : Applicative
Return Value
Unit in the context of the effects contained in the structure.

Looks for an element that matches a given predicate.
Declaration
Swift
func find(_ f: @escaping (A) > Bool) > Option<A>
Parameters
f
Predicate.
Return Value
A value if there is any that matches the predicate, or
Option.none
. 
Checks if any element in this structure matches a given predicate.
Declaration
Swift
func exists(_ predicate: @escaping (A) > Bool) > Bool
Parameters
predicate
Predicate.
Return Value
A boolean value indicating if any elements in the structure match the predicate.

Checks if all elements in this structure match a given predicate.
Declaration
Swift
func forall(_ predicate: @escaping (A) > Bool) > Bool
Parameters
predicate
Predicate.
Return Value
A boolean value indicating if all elements in the structure match the predicate.

Checks if this structure of values is empty.
Declaration
Swift
var isEmpty: Bool { get }
Return Value
false
if the structure contains any value,true
otherwise. 
Checks if this structure of values is not empty.
Declaration
Swift
var nonEmpty: Bool { get }
Return Value
true
if the structure contains any value,false
otherwise. 
Performs a monadic left fold from the source context to the target monad.
Declaration
Swift
func foldM<G: Monad, B>(_ b: B, _ f: @escaping (B, A) > Kind<G, B>) > Kind<G, B>
Parameters
b
Initial value for the fold.
f
Folding function.
Return Value
Summary value resulting from the folding process in the context of the target monad.

Performs a monadic left fold by mapping the values in this structure to ones in the target monad context and using the
Monoid
instance to combine them.Declaration
Parameters
f
Trasnforming function.
Return Value
Summary value resulting from the transformation and folding process in the context of the target monad.

Obtains a specific element of a structure of elements given its indexed position.
Declaration
Swift
func get(_ index: Int64) > Option<A>
Parameters
index
Indexed position of the element to retrieve.
Return Value
A value if there is any at the given position, or
Option.none
otherwise. 
Counts how many elements this structure contains.
Declaration
Swift
var count: Int64 { get }
Return Value
An integer value with the count of how many elements are contained in the structure.

Folds this structure of values provided that its type has an instance of
Monoid
.It uses the monoid empty value as initial value and the combination method for the fold.
Declaration
Swift
func fold() > A
Return Value
Summary value resulting from the folding process.

Folds this structure of values provided that its type has an instance of
Monoid
.It uses the monoid empty value as initial value and the combination method for the fold.
Declaration
Swift
func combineAll() > A
Return Value
Summary value resulting from the folding process.

Creates a new value transforming the type using the provided function, preserving the structure of the original type.
This is a convenience method to call
Functor.map
as an instance method in this type.Declaration
Swift
func map<B>(_ f: @escaping (A) > B) > Kind<F, B>
Parameters
f
A transforming function.
Return Value
The result of transforming the value type using the provided function, maintaining the structure of the original value.

Given a function, provides a new function lifted to the context type implementing this instance of
Functor
.This is a convenience method to call
Functor.lift
as a static method in this type.Declaration
Swift
static func lift<A, B>(_ f: @escaping (A) > B) > (Kind<F, A>) > Kind<F, B>
Parameters
f
Function to be lifted.
Return Value
Function in the context implementing this instance of
Functor
. 
Replaces the value type by the
Void
type.This is a convenience method to call
Functor.void
as an instance method of this type.Declaration
Swift
func void() > Kind<F, ()>
Return Value
New value in the context implementing this instance of
Functor
, withVoid
as value type. 
Transforms the value type and pairs it with its original value.
This is a conveninence method to call
Functor.fproduct
as an instance method of is type.Declaration
Swift
func fproduct<B>(_ f: @escaping (A) > B) > Kind<F, (A, B)>
Parameters
f
Transforming function.
Return Value
A pair with the original value and its transformation, in the context of the original value.

Transforms the value type with a constant value.
This is a convenience method to call
Functor.as
as an instance method of this type.Declaration
Swift
func `as`<B>(_ b: B) > Kind<F, B>
Parameters
b
Constant value to replace the value type.
Return Value
A new value with the structure of the original value, with its value type transformed.

Transforms the value type by making a tuple with a new constant value to the left of the original value type.
This is a conveninence method to call
Functor.tupleLeft
as an instance method of this type.Declaration
Swift
func tupleLeft<B>(_ b: B) > Kind<F, (B, A)>
Parameters
b
Constant value for the tuple.
Return Value
A new value with the structure of the original value, with a tuple in its value type.

Transforms the value type by making a tuple with a new constant value to the right of the original value type.
This is a convenience method to call
Functor.tupleRight
as an instance method of this type.Declaration
Swift
func tupleRight<B>(_ b: B) > Kind<F, (A, B)>
Parameters
b
Constant value for the tuple.
Return Value
A new value with the structure of the original value, with a tuple in its value type.

Maps the value/s in the context implementing this instance, filtering out the ones resulting in
Option.none
.This is a convenience method to call
FunctorFilter.mapFilter
as an instance method of this type.Declaration
Swift
func mapFilter<B>(_ f: @escaping (A) > OptionOf<B>) > Kind<F, B>
Parameters
f
A function to map objects and filter them out.
Return Value
Transformed and filtered values, in this context.

Removes the
Option.none
value/s in this context and extracts theOption.some
ones.This is a convenience method to call
FunctorFilter.flattenOption
as a static method of this type.Declaration
Swift
static func flattenOption(_ fa: Kind<F, OptionOf<A>>) > Kind<F, A>
Parameters
fa
Optional values in this context.
Return Value
Plain values in this context.

Filters out the value/s in this context that do not match the given predicate.
This is a convenience method to call
FunctorFilter.filter
as a static method of this type.Declaration
Swift
func filter(_ f: @escaping (A) > Bool) > Kind<F, A>
Parameters
f
Filtering predicate.
Return Value
Filtered value in this context.

Transforms the value type using the functions provided.
This is a conveninece method to call
Invariant.imap
as an instance method.Declaration
Swift
func imap<B>(_ f : @escaping (A) > B, _ g : @escaping (B) > A) > Kind<F, B>
Parameters
f
Transforming function.
g
Transforming function.
Return Value
A new value in the same context as the original value, with the value type transformed.

Sequentially compose this computation with another one, passing any value produced by the first as an argument to the second.
This is a convenience method to call
Monad.flatMap
as an instance method of this type.Declaration
Swift
func flatMap<B>(_ f: @escaping (A) > Kind<F, B>) > Kind<F, B>
Parameters
f
A function describing the second computation, which depends on the value of the first.
Return Value
Result of composing the two computations.

Monadic tail recursion.
This is a convenience method to call
Monad.tailRecM
as a static method of this type.Declaration
Swift
static func tailRecM<B>(_ a: A, _ f: @escaping (A) > Kind<F, Either<A, B>>) > Kind<F, B>
Parameters
a
Initial value for the recursion.
f
A function describing a recursive step.
Return Value
Result of evaluating recursively the provided function with the initial value.

Flattens a nested structure of the context implementing this instance into a single layer.
This is a convenience method to call
Monad.flatten
as a static method of this type.Declaration
Swift
static func flatten(_ ffa: Kind<F, Kind<F, A>>) > Kind<F, A>
Parameters
ffa
Value with a nested structure.
Return Value
Value with a single context structure.

Sequentially compose with another computation, discarding the value produced by the this one.
This is a convenience method to call
Monad.followedBy
as an instance method of this type.Declaration
Swift
func followedBy<B>(_ fb: Kind<F, B>) > Kind<F, B>
Parameters
fb
A computation.
Return Value
Result of running the second computation after the first one.

Sequentially compose this computation with a potentially lazy one, discarding the value produced by this one.
This is a convenience method to call
Monad.followedByEval
as an instance method of this type.Declaration
Swift
func followedByEval<B>(_ fb: Eval<Kind<F, B>>) > Kind<F, B>
Parameters
fb
Lazy computation.
Return Value
Result of running the second computation after the first one.

Sequentially compose with another computation, discarding the value produced by the received one.
This is a convenience method to call
Monad.forEffect
as an instance method of this type.Declaration
Swift
func forEffect<B>(_ fb: Kind<F, B>) > Kind<F, A>
Parameters
fb
A computation.
Return Value
Result produced from the first computation after both are computed.

Sequentially compose with a potentially lazy computation, discarding the value produced by the received one.
This is a convenience method to call
Monad.forEffectEval
as an instance method of this type.Declaration
Swift
func forEffectEval<B>(_ fb: Eval<Kind<F, B>>) > Kind<F, A>
Parameters
fb
Lazy computation.
Return Value
Result produced from the first computation after both are computed.

Pair the result of this computation with the result of applying a function to such result.
This is a convenience method to call
Monad.mproduct
as an instance method.Declaration
Swift
func mproduct<B>(_ f: @escaping (A) > Kind<F, B>) > Kind<F, (A, B)>
Parameters
f
A function to be applied to the result of the computation.
Return Value
A tuple of the result of this computation paired with the result of the function, in the context implementing this instance.

Monad comprehensions for two closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>) > Kind<F, C>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for three closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>) > Kind<F, D>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for four closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D, E>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>, _ fd: @escaping (B, C, D) > Kind<F, E>) > Kind<F, E>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
fd
4th closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for five closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D, E, G>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>, _ fd: @escaping (B, C, D) > Kind<F, E>, _ fe: @escaping (B, C, D, E) > Kind<F, G>) > Kind<F, G>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
fd
4th closure providing a computation.
fe
5th closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for six closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D, E, G, H>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>, _ fd: @escaping (B, C, D) > Kind<F, E>, _ fe: @escaping (B, C, D, E) > Kind<F, G>, _ fg: @escaping (B, C, D, E, G) > Kind<F, H>) > Kind<F, H>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
fd
4th closure providing a computation.
fe
5th closure providing a computation.
fg
6th closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for seven closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D, E, G, H, I>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>, _ fd: @escaping (B, C, D) > Kind<F, E>, _ fe: @escaping (B, C, D, E) > Kind<F, G>, _ fg: @escaping (B, C, D, E, G) > Kind<F, H>, _ fh: @escaping (B, C, D, E, G, H) > Kind<F, I>) > Kind<F, I>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
fd
4th closure providing a computation.
fe
5th closure providing a computation.
fg
6th closure providing a computation.
fh
7th closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for eight closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D, E, G, H, I, J>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>, _ fd: @escaping (B, C, D) > Kind<F, E>, _ fe: @escaping (B, C, D, E) > Kind<F, G>, _ fg: @escaping (B, C, D, E, G) > Kind<F, H>, _ fh: @escaping (B, C, D, E, G, H) > Kind<F, I>, _ fi: @escaping (B, C, D, E, G, H, I) > Kind<F, J>) > Kind<F, J>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
fd
4th closure providing a computation.
fe
5th closure providing a computation.
fg
6th closure providing a computation.
fh
7th closure providing a computation.
fi
8th closure providing a computation.
Return Value
Result of evaluating the last computation.

Monad comprehensions for nine closures producing computations.
Each closure is expected to provide a computation whose result may be used in subsequent computations. For this reason, the
ith
closure receives all values generated by the instructions evaluated before it.This is a convenience method to call
Monad.binding
as a static method of this type.Declaration
Swift
static func binding<B, C, D, E, G, H, I, J, K>(_ f: () > Kind<F, B>, _ fb: @escaping (B) > Kind<F, C>, _ fc: @escaping (B, C) > Kind<F, D>, _ fd: @escaping (B, C, D) > Kind<F, E>, _ fe: @escaping (B, C, D, E) > Kind<F, G>, _ fg: @escaping (B, C, D, E, G) > Kind<F, H>, _ fh: @escaping (B, C, D, E, G, H) > Kind<F, I>, _ fi: @escaping (B, C, D, E, G, H, I) > Kind<F, J>, _ fj: @escaping (B, C, D, E, G, H, I, J) > Kind<F, K>) > Kind<F, K>
Parameters
f
1st closure providing a computation.
fb
2nd closure providing a computation.
fc
3rd closure providing a computation.
fd
4th closure providing a computation.
fe
5th closure providing a computation.
fg
6th closure providing a computation.
fh
7th closure providing a computation.
fi
8th closure providing a computation.
fj
9th closure providing a computation.
Return Value
Result of evaluating the last computation.

Conditionally apply a closure based on the boolean result of this computation.
This is a convenience method to call
Monad.ifM
as an instance method.Declaration
Swift
func ifM<B>(_ ifTrue: @escaping () > Kind<F, B>, _ ifFalse: @escaping () > Kind<F, B>) > Kind<F, B>
Parameters
ifTrue
Closure to be applied if the computation evaluates to
true
.ifFalse
Closure to be applied if the computation evaluates to
false
.Return Value
Result of applying the corresponding closure based on the result of the computation.

Fold over the inner structure to combine all of the values with our combine method inherited from `MonoidK.
This is a convenience method to call
MonadCombine.unite
as a static method of this type.Declaration
Swift
static func unite<G>(_ fga: Kind<F, Kind<G, A>>) > Kind<F, A> where G : Foldable
Parameters
fga
Nested contexts value.
Return Value
A value in the context implementing this instance where the inner context has been folded.

Checks if the value of this computation matches a predicate, raising an error if not.
This is a convenience method to call
MonadError.ensure
as an instance method of this type.Declaration
Swift
func ensure(_ error: @escaping () > F.E, _ predicate: @escaping (A) > Bool) > Kind<F, A>
Parameters
error
A function that produces an error of the type this instance is able to handle.
predicate
A boolean predicate to test the value of the computation.
Return Value
A value or an error in the context implementing this instance.

Obtains an empty element in this context.
Declaration
Swift
static var empty: Kind<F, A> { get }
Return Value
Empty element.

Retrieves the shared environment.
This is a convenience method to call
MonadReader.ask
as a static method of this type.Declaration
Swift
static func ask() > Kind<F, F.D>
Return Value
Shared environment.

Executes this computation in a modified environment.
This is a convenience method to call
MonadReader.local
as an instance method of this type.Declaration
Swift
func local(_ f: @escaping (F.D) > F.D) > Kind<F, A>
Parameters
f
Funtion to modify the environment.
Return Value
Computation in the modified environment.

Retrieves a function of the current environment.
This is a convenience method to call
MonadReader.reader
as a static method of this type.Declaration
Swift
static func reader(_ f: @escaping (F.D) > A) > Kind<F, A>
Parameters
f
Selector function to apply to the environment.
Return Value
A value extracted from the environment, in the context implementing this instance.

Retrieves the state from the internals of the monad.
This is a convenience method to call
MonadState.get
as a static method of this type.Declaration
Swift
static func get() > Kind<F, F.S>
Return Value
Maintained state.

Replaces the state inside the monad.
This is a convenience method to call
MonadState.set
as a static method of this type.Declaration
Swift
static func set(_ s: F.S) > Kind<F, ()>
Parameters
s
New state.
Return Value
Unit.

Embeds a state action into the monad.
This is a convenience method to call
MonadState.state
as a static method of this type.Declaration
Swift
static func state(_ f: @escaping (F.S) > (F.S, A)) > Kind<F, A>
Parameters
f
A function that receives the state and computes a value and a new state.
Return Value
A value with the output of the function and the new state.

Modifies the internal state.
This is a convenience method to call
MonadState.modify
as a static method of this type.Declaration
Swift
static func modify(_ f: @escaping (F.S) > F.S) > Kind<F, ()>
Parameters
f
Function that modifies the state.
Return Value
Unit.

Retrieves a specific component of the state.
This is a convenience method to call
MonadState.inspect
as a static method of this type.Declaration
Swift
static func inspect(_ f: @escaping (F.S) > A) > Kind<F, A>
Parameters
f
Projection function to obtain part of the state.
Return Value
A specific part of the state.

Embeds a writer action.
This is a convenience method to call
MonadWriter.writer
as a static method of this type.Declaration
Swift
static func writer(_ aw: (F.W, A)) > Kind<F, A>
Parameters
aw
A tupe of the writer type and a value.
Return Value
The writer action embedded in the context implementing this instance.

Adds the side stream of data to the result of this computation.
This is a convenience method to call
MonadWriter.listen
as an instance method of this type.Declaration
Swift
func listen() > Kind<F, (F.W, A)>
Return Value
The result of the computation paired with the side stream of data.

Performs a computation and transforms the side stream of data.
This is a convenience method to call
MonadWriter.pass
as a static method of this type.Declaration
Swift
static func pass(_ fa: Kind<F, ((F.W) > F.W, A)>) > Kind<F, A>
Parameters
fa
A computation that transform the stream of data.
Return Value
Result of the computation.

Produces a new value of the side stream of data.
This is a convenience method to call
MonadWriter.tell
as a static method of this type.Declaration
Swift
static func tell(_ w: F.W) > Kind<F, ()>
Parameters
w
New value.
Return Value
Unit.

Performs this computation and transforms the side stream of data, pairing it with the result of this computation.
This is a convenience method to call
MonadWriter.listens
as an instance method of this type.Declaration
Swift
func listens<B>(_ f: @escaping (F.W) > B) > Kind<F, (B, A)>
Parameters
f
A function to transform the side stream of data.
Return Value
A tuple of the transformation of the side stream and the result of the computation.

Transforms the side stream of data of this computation.
This is a convenience method to call
MonadWriter.censor
as an instance method of this type.Declaration
Swift
func censor(_ f: @escaping (F.W) > F.W) > Kind<F, A>
Parameters
f
Transforming function.
Return Value
A computation with the same result as the provided one, with the transformed side stream of data.

Empty element.
This element must obey the following laws:
combineK(fa, emptyK()) == combineK(emptyK(), fa) == fa
This is a convenience method to call
MonoidK.emptyK
as a static method of this type.Declaration
Swift
static func emptyK() > Kind<F, A>
Return Value
A value representing the empty element of this MonoidK instance.

Divides this structure of values into a tuple that represents the first value of the structure (first component of the tuple) and the rest of values of the structure (second component of the tuple)
Declaration
Swift
func split() > (A, Kind<F.G, A>)
Return Value
Tuple containing the first and rest of values in the structure.

Undocumented
Declaration
Swift
func reduceLeftTo<B>(_ f: (A) > B, _ g: (B, A) > B) > B

Undocumented
Declaration
Swift
func reduceMap<B>(_ f: (A) > B) > B where B : Semigroup

Undocumented
Declaration
Swift
func reduce() > A

Conditionally applies a computation based on the result of this computation.
Declaration
Swift
func select<AA, B>(_ f: Kind<F, (AA) > B>) > Kind<F, B> where A == Either<AA, B>
Parameters
f
A computation that is executed in case the receiving computation evaluates to a left value.
Return Value
Composition of the two computations.

Evaluates one out of two computations based on the result of this computation.
Declaration
Swift
func branch<AA, B, C>(_ fa: Kind<F, (AA) > C>, _ fb: Kind<F, (B) > C>) > Kind<F, C> where A == Either<AA, B>
Parameters
fa
Computation that will be executed if this computation evaluates to an
Either.left
value.fb
Computation that will be executed if this computation evaluates to an
Either.right
value.Return Value
Composition of the computations.

Declaration
Swift
static func fromOptionS(_ x: Kind<F, A>, _ mx: Kind<F, Option<A>>) > Kind<F, A>
Parameters
x
Default value for the empty case.
mx
A computation resulting in an optional value.
Return Value
Composition of the two computations.

Evaluates the second computation when the first evaluates to
true
.Declaration
Swift
static func whenS(_ cond: Kind<F, Bool>, _ f: Kind<F, ()>) > Kind<F, ()>
Parameters
cond
A computation evaluating to a boolean value.
f
A computation that will be evaluated if the first computation evaluates to
true
.Return Value
Composition of the two computations.

Evaluates one out of two computations based on the result of another computation.
Declaration
Swift
static func ifS<A>(_ x: Kind<F, Bool>, _ t: Kind<F, A>, _ e: Kind<F, A>) > Kind<F, A>
Parameters
x
Computation producing a boolean value to decide which computation is exectured afterwards.
t
Computation that will be executed if the first evaluates to
true
.e
Computation that will be executed if the first evaluates to
false
.Return Value
Composition of the computations.

A lifted version of lazy boolean or.
Declaration
Swift
static func orS(_ x: Kind<F, Bool>, _ y: Kind<F, Bool>) > Kind<F, Bool>
Parameters
x
Computation to be or'ed.
y
Computation to be or'ed.
Return Value
Result of the or operation on the two computations.

A lifted version of lazy boolean and.
Declaration
Swift
static func andS(_ x: Kind<F, Bool>, _ y: Kind<F, Bool>) > Kind<F, Bool>
Parameters
x
Computation to be and'ed.
y
Computation to be and'ed.
Return Value
Result of the and operation on the two computations.

Evaluates a computation as long as it evaluates to
true
.Declaration
Swift
static func whileS(_ x: Kind<F, Bool>) > Eval<Kind<F, ()>>
Parameters
x
A computation.
Return Value
A potentially lazy computation.

Combines this value with another value of the same type.
This is a convenience method to call
SemigroupK.combineK
as an instance method of this type.Declaration
Swift
func combineK(_ y: Kind<F, A>) > Kind<F, A>
Parameters
y
Right value in the combination.
Return Value
Combination of the two values.

Maps each element of this structure to an effect, evaluates them from left to right and collects the results.
Declaration
Swift
func traverse<G: Applicative, B>(_ f: @escaping (A) > Kind<G, B>) > Kind<G, Kind<F, B>>
Parameters
f
A function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.

Evaluate each effect in this structure of values and collects the results.
Declaration
Swift
func sequence<G, AA>() > Kind<G, Kind<F, AA>> where A == Kind<G, AA>, G : Applicative
Return Value
Results collected under the context of the effects.

A traverse followed by flattening the inner result.
Declaration
Swift
func flatTraverse<G: Applicative, B>(_ f: @escaping (A) > Kind<G, Kind<F, B>>) > Kind<G, Kind<F, B>>
Parameters
f
A transforming function yielding nested effects.
Return Value
Results collected and flattened under the context of the effects.

A combined traverse and filter operation. Filtering is handled using
Option
instead of Bool so that the output can be different than the input type.This is a convenience method to call
TraverseFilter.traverseFilter
as an instance method of this type.Declaration
Swift
func traverseFilter<B, G: Applicative>(_ f: @escaping (A) > Kind<G, OptionOf<B>>) > Kind<G, Kind<F, B>>
Parameters
fa
A value in this context.
f
A function to traverse and filter each value.
Return Value
Result of traversing this structure and filter values using the provided function.

Filters values in a different context.
This is a convenience method to call
TraverseFilter.filterA
as an instance method of this type.Declaration
Swift
func filterA<G: Applicative>(_ f: @escaping (A) > Kind<G, Bool>) > Kind<G, Kind<F, A>>
Parameters
fa
A value in this context.
f
A function to filter each value.
Return Value
Result of traversing this structure and filter values using the provided function.