Skip to main content
Module

x/fun/mod.ts>fn_either.fromEither

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

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

Parameters

ua: Either<B, A>