TraverseFilter
public protocol TraverseFilter : FunctorFilter, Traverse
TraverseFilter represents array-like structures that can be traversed and filtered as a single combined operation. It provides the same capabilities as Traverse
and FunctorFilter
together.
-
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.Declaration
Parameters
fa
A value in the context implementing this instance.
f
A function to traverse and filter each value.
Return Value
Result of traversing this structure and filter values using the provided function.
-
filterA(_:_:)
Extension methodFilters values in a different context.
Declaration
Swift
static func filterA<A, G: Applicative>( _ fa: Kind<Self, A>, _ f: @escaping (A) -> Kind<G, Bool>) -> Kind<G, Kind<Self, A>>
Parameters
fa
A value in the context implementing this instance.
f
A function to filter each value.
Return Value
Result of traversing this structure and filter values using the provided function.
-
filter(_:_:)
Extension methodFilters values using a predicate.
Declaration
Parameters
fa
A value in the context implementing this instance.
f
A boolean predicate.
Return Value
Result of traversing this structure and filter values using the provided function.