-
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
faA structure of values.
fA function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.
-
parTraverse(_:_:)Extension methodMaps each element of a structure to an effect, evaluates in parallel and collects the results.
Declaration
Swift
static func parTraverse<G: Concurrent, A, B>( _ fa: Kind<Self, A>, _ f: @escaping (A) -> Kind<G, B>) -> Kind<G, Kind<Self, B>>Parameters
faA structure of values.
fA function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.
-
parSequence(_:)Extension methodEvaluate each effect in a structure of values in parallel and collects the results.
Declaration
Swift
static func parSequence<G, A>(_ fa: Kind<Self, Kind<G, A>>) -> Kind<G, Kind<Self, A>> where G : ConcurrentParameters
fgaA structure of values.
Return Value
Results collected under the context of the effects.
-
parFlatTraverse(_:_:)Extension methodA parallel traverse followed by flattening the inner result.
Declaration
Parameters
faA structure of values.
fA transforming function yielding nested effects.
Return Value
Results collected and flattened under the context of the effects.
-
sequence(_:)Extension methodEvaluate each effect in a structure of values and collects the results.
Declaration
Swift
static func sequence<G: Applicative, A, B>(_ fga: Kind<Self, B>) -> Kind<G, Kind<Self, A>> where B: Kind<G, A>Parameters
fgaA 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
faA structure of values.
fA transforming function yielding nested effects.
Return Value
Results collected and flattened under the context of the effects.
-
scanLeft(_:_:_:)Extension methodMaps each element of a structure using a stateful function.
Declaration
Parameters
faA structure of values.
initialStateThe state that will be passed to f initially.
fA stateful function.
Return Value
A new structure with the results of the function.
-
scanLeft(_:_:_:)Extension methodMaps each element of a structure using a stateful function.
Declaration
Parameters
faA structure of values.
initialStateThe state that will be passed to f initially.
fA stateful function that returns the new state, which will be included in the returned structure.
Return Value
A new structure with the results of the function.
-
scanLeftM(_:_:_:)Extension methodMaps each element of a structure to an effect using a stateful function.
Declaration
Parameters
faA structure of values.
initialStateThe state that will be passed to f initially.
fA stateful function producing an effect.
Return Value
Results collected under the context of the effect provided by the function.
-
scanLeftM(_:_:_:)Extension methodMaps each element of a structure to an effect using a stateful function.
Declaration
Parameters
faA structure of values.
initialStateThe state that will be passed to f initially.
fA stateful function producing an effect, which will be included in the returned structure.
Return Value
Results collected under the context of the effect provided by the function.
Install in Dash
Traverse Protocol Reference