Skip to main content
Module

x/fun/mod.ts>fn.over

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

A common pattern in optics is to apply an input value to a function at the beginning and the end of a computation. This can (and has) been achieved by the composition of Pair using flow(P.dup, P.map(fn), P.merge). But for performance reasons it's nice to have a straighforward function that achieves the same result.

Parameters

faai: (a: A) => (a: A) => I

Returns

(a: A) => I