Combinable
Combinable:
object
Defined in: Core/Combinable.ts:14
Type Declaration
Section titled “Type Declaration”all:
Combinable<boolean> =allCombinable
Combines booleans with logical AND. true is the neutral element.
Example
Section titled “Example”any:
Combinable<boolean> =anyCombinable
Combines booleans with logical OR. false is the neutral element.
Example
Section titled “Example”array: <
A>() =>Combinable<readonlyA[]>
Combines arrays by concatenation. Empty array is the neutral element.
Type Parameters
Section titled “Type Parameters”A
Returns
Section titled “Returns”Combinable<readonly A[]>
Example
Section titled “Example”fold: <
A>(c) => (data) =>A
Folds an array into a single value using the Combinable’s empty as the starting point.
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”Combinable<A>
Returns
Section titled “Returns”(data) => A
Example
Section titled “Example”maybe: <
A>(inner) =>Combinable<Maybe<A>>
Lifts a Combinable<A> to Combinable<Maybe<A>>. None is the neutral element —
combining with None on either side returns the other value unchanged.
Two Some values combine their inner values using the inner Combinable.
Type Parameters
Section titled “Type Parameters”A
Parameters
Section titled “Parameters”Combinable<A>
Returns
Section titled “Returns”Combinable<Maybe<A>>
Example
Section titled “Example”product
Section titled “product”product:
Combinable<number> =productCombinable
Combines numbers by multiplication. 1 is the neutral element.
Example
Section titled “Example”string
Section titled “string”string:
Combinable<string> =stringCombinable
Combines strings by concatenation. Empty string is the neutral element.
Example
Section titled “Example”struct
Section titled “struct”struct: <
R>(fields) =>Combinable<R>
Derives a Combinable for a record of fields from field-level Combinable instances.
Type Parameters
Section titled “Type Parameters”R extends Record<string, unknown>
Parameters
Section titled “Parameters”fields
Section titled “fields”{ [K in string | number | symbol]: Combinable<R[K]> }
Returns
Section titled “Returns”Combinable<R>
Example
Section titled “Example”sum:
Combinable<number> =sumCombinable
Combines numbers by addition. 0 is the neutral element.