FunctorFilter
public protocol FunctorFilter : Functor
A FunctorFilter provides the same capabilities as a Functor
, while filtering out elements simultaneously.
-
Maps the value/s in the context implementing this instance, filtering out the ones resulting in
Option.none
.Declaration
Parameters
fa
A value in the context implementing this instance.
f
A function to map objects and filter them out.
Return Value
Transformed and filtered values, in the context implementing this instance.
-
flattenOption(_:)
Extension methodRemoves the
Option.none
value/s in this context and extracts theOption.some
ones.Parameters
fa
Optional values in the context implementing this instance.
Return Value
Plain values in the context implementing this instance.
-
filter(_:_:)
Extension methodFilters out the value/s in the context implementing this instance that do not match the given predicate.
Declaration
Parameters
fa
Value in the context implementing this instance.
f
Filtering predicate.
Return Value
Filtered value in the context implementing this instance.