Skip to main content
Module

x/fun/fn_either.ts>chainLeft

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 chainLeft
import { chainLeft } from "https://deno.land/x/fun@v.2.0.0-alpha.11/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.chain(s => FE.left(s.length)),
  FE.chainLeft(n => FE.right(String(n))),
)("Hello"); // Right("5")

Type Parameters

B
optional
L = unknown
optional
I = never
optional
J = never

Parameters

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

Returns

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