-
Eagerly reduces a structure of values from left to right, also performing a transformation of values.
Declaration
Swift
static func reduceLeftTo<A, B>( _ fa: Kind<Self, A>, _ f: (A) -> B, _ g: (B, A) -> B) -> B
Parameters
fa
Structure of values.
f
Transforming function.
g
Folding function.
Return Value
Summary value of this reduction.
-
Lazily reduces a structure of values from right to left, also performing a transformation of values.
Declaration
Parameters
fa
Structure of values.
f
Transforming function.
g
Folding function.
Return Value
Potentially lazy summary value of this reduction.
-
reduceLeft(_:_:)
Extension methodEagerly reduces a structure of values from left to right without transforming them.
Declaration
Swift
static func reduceLeft<A>( _ fa: Kind<Self, A>, _ f: (A, A) -> A) -> A
Parameters
fa
Structure of values.
f
Folding function.
Return Value
Summary value of this reduction.
-
reduceRight(_:_:)
Extension methodLazily reduces a structure of values from right to left without transforming them.
Declaration
Parameters
fa
Structure of values.
f
Folding function.
Return Value
Potentially lazy summary value of this reduction.
-
reduceLeftToOption(_:_:_:)
Extension methodReduces the elements of a structure down to a single value by applying the provided transformation and aggregation funtions in a left-associative manner.
Declaration
Parameters
fa
Value to be folded.
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. -
reduceRightToOption(_:_:_:)
Extension methodReduces the elements of a structure down to a single value by applying the provided transformation and aggregation functions in a right-associative manner.
Declaration
Parameters
fa
Value to be folded.
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. -
isEmpty(_:)
Extension methodChecks if a structure of values is empty.
An instance of
Reducible
is never empty.Declaration
Swift
static func isEmpty<A>(_ fa: Kind<Self, A>) -> Bool
Parameters
fa
Structure of values.
Return Value
false
if the structure contains any value,true
otherwise. -
nonEmpty(_:)
Extension methodChecks if a structure of values is not empty.
An instance of
Reducible
is always non-empty.Declaration
Swift
static func nonEmpty<A>(_ fa: Kind<Self, A>) -> Bool
Parameters
fa
Structure of values.
Return Value
true
if the structure contains any value,false
otherwise. -
reduce(_:)
Extension methodReduces a structure of values to a summary value using the combination capabilities of the
Semigroup
instance of the underlying type.Parameters
fa
Structure of values.
Return Value
Summary value of this reduction.
-
reduceMap(_:_:)
Extension methodReduces a structure of values by mapping them to a type with a
Semigroup
instance, and using its combination capabilities.Parameters
fa
Structure of values.
f
Mapping function.
Return Value
Summary value of this reduction.