Skip to main content
Module

x/fun/mod.ts>fn_either.premap

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

Map over the input value of a FnEither.

Examples

Example 1

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

// This has type FnEither<[Date], never, number>
const computation = pipe(
  FE.id<number>(),
  FE.premap((d: Date) => d.valueOf()),
);

const result = computation(new Date(0)); // Right(0)

Parameters

fld: (l: L) => D

Returns

<A, B>(ua: FnEither<D, B, A>) => FnEither<L, B, A>