recover
import { recover } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/async_either.ts";Chain AsyncEither based failures, Left sides, useful for recovering from error conditions.
@example
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import * as TE from "./async_either.ts";
import * as E from "./either.ts";
import { pipe } from "./fn.ts";
const ta = pipe(
TE.fail(1),
TE.recover(n => TE.wrap(n*2)),
TE.flatmap(n => TE.wrap(n**2))
)
assertEquals(await ta(), E.right(4))
function recover<B, J, I>(fbtj: (b: B) => AsyncEither<J, I>): <A>(ta: AsyncEither<B, A>) => AsyncEither<J, A | I>;
§
recover<B, J, I>(fbtj: (b: B) => AsyncEither<J, I>): <A>(ta: AsyncEither<B, A>) => AsyncEither<J, A | I>
[src]§Parameters
§
fbtj: (b: B) => AsyncEither<J, I>
[src]§Return Type
§
<A>(ta: AsyncEither<B, A>) => AsyncEither<J, A | I>
[src]