Aller au contenu principal

fold()

const fold: <E, A, B>(onLeft, onRight) => (ma) => B = match

Alias for match.

Pattern matches on an Either.


Type Parameters

E: E

The error type.

A: A

The success type.

B: B

The return type.


Parameters

onLeft: (e) => B

Handler for Left case.

onRight: (a) => B

Handler for Right case.


Returns

A function that takes an Either and returns B.


Since

2.0.0