Skip to main content
Module

x/fun/fn_either.ts>wrap

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

An alias for right. Creates a FnEither from a value. The created FnEither does not require any arguments, but can widen when used in a flatmap.

Examples

Example 1

import * as FE from "./fn_either.ts";
import { pipe } from "./fn.ts";

const computation = pipe(
  FE.id<number>(), // Ask for a number
  FE.map(n => n + 1), // Add one
  FE.flatmap(_ => FE.wrap("Hello")), // Forget about the number
);

const result = computation(1); // Right("Hello")

Type Parameters

A
optional
D = unknown
optional
B = never