Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/fn_either.ts>recover

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

Chain the left result of one FnEither into another FnEither.

Examples

Example 1

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

const result = pipe(
  FE.id<string, number>(),
  FE.flatmap(s => FE.left(s.length)),
  FE.recover(n => FE.right(String(n))),
)("Hello"); // Right("5")

Type Parameters

B
optional
D = unknown
optional
I = never
optional
J = never

Parameters

fbtj: (b: B) => FnEither<D, J, I>

Returns

<A = never>(ua: FnEither<D, B, A>) => FnEither<D, J, A | I>