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

x/fun/mod.ts>flatmappable.createBind

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

Create a bind function for a structure with instances of Mappable and Flatmappable. A bind function allows one to flatmap into named fields in a struct, collecting values from the result of the flatmap in the order that they are completed.

Type Parameters

U extends Kind

Returns

<N extends string, A, I, J = never, K = never, L = unknown, M = unknown>(name: Exclude<N, keyof A>, faui: (a: A) => $<U, [I, J, K], [L], [M]>) => <B = never, C = never, D extends L = L>(ua: $<U, [A, B, C], [D], [M]>) => $<U, [readonly [K in keyof A | N]: K extends keyof A ? A[K] : I, B | J, C | K], [D & L], [M]>