flatmapFirst
import { flatmapFirst } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/async_either.ts";Chain AsyncEither computations together, but keep the original value if the chain fails.
@example
import * as AE from "./async_either.ts";
import { pipe } from "./fn.ts";
const result = pipe(
AE.right(5),
AE.flatmapFirst(n => AE.left("Failed"))
);
const value = await result(); // Left("Failed")
function flatmapFirst<A, I, J>(fati: (a: A) => AsyncEither<J, I>): <B>(ta: AsyncEither<B, A>) => AsyncEither<B | J, A>;
§
flatmapFirst<A, I, J>(fati: (a: A) => AsyncEither<J, I>): <B>(ta: AsyncEither<B, A>) => AsyncEither<B | J, A>
[src]§Parameters
§
fati: (a: A) => AsyncEither<J, I>
[src]§Return Type
§
<B>(ta: AsyncEither<B, A>) => AsyncEither<B | J, A>
[src]