Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

wrap

import { wrap } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/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.

@example
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")
function wrap<A, D = unknown, B = never>(a: A): FnEither<D, B, A>;
§
wrap<A, D = unknown, B = never>(a: A): FnEither<D, B, A>
[src]

§Type Parameters

§
D = unknown
[src]
§
B = never
[src]

§Parameters

§Return Type