getCombinableEither
import { getCombinableEither } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";Create a Combinable instance for Either given Combinable instances for both Left and Right types. The combine operation combines Left values or Right values depending on which side the Either values are on.
@example
import * as E from "./either.ts";
import * as S from "./string.ts";
import * as N from "./number.ts";
import { pipe } from "./fn.ts";
const combinableEither = E.getCombinableEither(S.CombinableString, N.CombinableNumberSum);
const result1 = pipe(
E.right("hello"),
combinableEither.combine(E.right("world"))
);
// Right("helloworld")
const result2 = pipe(
E.left(2),
combinableEither.combine(E.left(1))
);
// Left(3) (assuming number combination is addition)