fold
import { fold } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/sync_either.ts";Fold over a SyncEither to produce a single value.
@example
import { fold, right, left } from "./sync_either.ts";
const matcher = fold(
(acc: number, value: number) => acc + value,
0
);
const result1 = matcher(right(5)); // 5
const result2 = matcher(left("error")); // 0