Skip to main content
Module

x/fun/fn_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/fn_either.ts";

Turn an Either into a FnEither.

Examples

Example 1

import * as FE from "./fn_either.ts";
import * as E from "./either.ts";

const left = E.left(1);
const right = E.right(1);

const fnLeft = FE.fromEither(left);
const fnRight = FE.fromEither(right);

const result1 = fnLeft(null); // Left(1);
const result2 = fnRight(null); // Right(1);

Type Parameters

A
B
optional
D = unknown