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

alt

import { alt } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/async_either.ts";

Provide an alternative for a failed computation. Useful for implementing defaults.

@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.alt(TE.wrap(2)),
)

assertEquals(await ta(), E.right(2))
function alt<I, J>(ti: AsyncEither<J, I>): <A, B>(ta: AsyncEither<B, A>) => AsyncEither<B | J, A | I>;
§
alt<I, J>(ti: AsyncEither<J, I>): <A, B>(ta: AsyncEither<B, A>) => AsyncEither<B | J, A | I>
[src]

§Type Parameters

§Parameters

§Return Type

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