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/either.ts";

Provide an alternative Either value if the first one is Left. If the first is Right, it's returned unchanged.

@example
import * as E from "./either.ts";

const result1 = E.alt(E.right("fallback"))(E.left("error"));
// Right("fallback")

const result2 = E.alt(E.right("fallback"))(E.right("original"));
// Right("original")
function alt<A, J>(tb: Either<J, A>): <B>(ta: Either<B, A>) => Either<B | J, A>;
§
alt<A, J>(tb: Either<J, A>): <B>(ta: Either<B, A>) => Either<B | J, A>
[src]

§Type Parameters

§Parameters

§
tb: Either<J, A>
[src]

§Return Type

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