Skip to main content
Module

x/fun/fn_either.ts>mapLeft

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 mapLeft
import { mapLeft } from "https://deno.land/x/fun@v2.0.0-alpha.6/fn_either.ts";

Map over the left return value of a FnEither.

Examples

Example 1

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

const result1 = pipe(
  FE.id<number>(),
  FE.mapLeft((n: number) => n + 1),
)(0); // Right(0)

const result2 = pipe(
  FE.idLeft<number>(),
  FE.mapLeft(n => n + 1),
)(0); // Left(1)

Parameters

fbj: (b: B) => J

Returns

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