const either1: Either<string, number> = left("Error message");
const either2: Either<string, number> = right(42);
const result1 = fold(
either1,
(errorMessage) => `Error: ${errorMessage}`,
(value) => `Success: ${value}`
); // "Error: Error message"
const result2 = fold(
either2,
(errorMessage) => `Error: ${errorMessage}`,
(value) => `Success: ${value}`
); // "Success: 42"
version 1.3.0
Manuel Santos ney.br.santos@gmail.com
Generated using TypeDoc
Represents a value that can be either of type L (left) or R (right).