-
Maps each element of a structure to an effect, evaluates them from left to right and collects the results.
Declaration
Swift
static func traverse<G: Applicative, A, B>(_ fa: Kind<Self, A>, _ f: @escaping (A) -> Kind<G, B>) -> Kind<G, Kind<Self, B>>
Parameters
fa
A structure of values.
f
A function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.
-
sequence(_:)
Extension methodEvaluate each effect in a structure of values and collects the results.
Declaration
Swift
static func sequence<G, A>(_ fga: Kind<Self, Kind<G, A>>) -> Kind<G, Kind<Self, A>> where G : Applicative
Parameters
fga
A structure of values.
Return Value
Results collected under the context of the effects.
-
flatTraverse(_:_:)
Extension methodA traverse followed by flattening the inner result.
Declaration
Parameters
fa
A structure of values.
f
A transforming function yielding nested effects.
Return Value
Results collected and flattened under the context of the effects.