Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

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]

§Type Parameters

§Parameters

§
fati: (a: A) => AsyncEither<J, I>
[src]

§Return Type

§
<B>(ta: AsyncEither<B, A>) => AsyncEither<B | J, A>
[src]