flatmapFirst
import { flatmapFirst } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";Chain computations by applying a function that returns an Either to the Right value, but keep the original Right value if the function succeeds. This is useful for validation or side effects.
@example
import * as E from "./either.ts";
const validatePositive = (n: number) =>
n > 0 ? E.right(n) : E.left("Number must be positive");
const result1 = E.flatmapFirst(validatePositive)(E.right(5));
// Right(5)
const result2 = E.flatmapFirst(validatePositive)(E.right(-3));
// Left("Number must be positive")