Skip to main content
Module

x/fun/async_either.ts>fromEither

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function fromEither
import { fromEither } from "https://deno.land/x/fun@v2.0.0/async_either.ts";

Lifts an Either<B,A> into a AsyncEither<B, A>.

Examples

Example 1

import * as AE from "./async_either.ts";
import * as E from "./either.ts";

const value1 = AE.fromEither(E.right(1));
const value2 = AE.fromEither(E.left("Error!"));

const result1 = await value1(); // Right(1)
const result2 = await value2(); // Left("Error!")