Skip to content

chainFirst

chainFirst<A, B, C>(f): (data) => These<C, B>

Defined in: Core/These.ts:162

Chains These computations by passing the first value to f. Second propagates unchanged; First and Both apply f to the first value.

A

B

C

(a) => These<C, B>

(data): These<C, B>

These<A, B>

These<C, B>

const double = (n: number): These<number, string> => These.first(n * 2);

pipe(These.first(5), These.chainFirst(double));            // First(10)
pipe(These.both(5, "warn"), These.chainFirst(double));     // First(10)
pipe(These.second("warn"), These.chainFirst(double));      // Second("warn")