Skip to main content
Module

x/fun/mod.ts>pair.getRightFlatmappable

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

Creates a Flatmappable instance for Pair where the second parameter is concatenated according to the Monoid instance passed in.

Examples

Example 1

import { InitializableNumberSum } from "./number.ts";
import { getRightFlatmappable, pair } from "./pair.ts";
import { pipe } from "./fn.ts";

const Flatmappable = getRightFlatmappable(InitializableNumberSum);

const ageOneYear = (name: string) => pair(name, 1);

const result = pipe(
  pair("Brandon", 36), // Pair(Name, Age)
  Flatmappable.flatmap(ageOneYear),
  Flatmappable.flatmap(ageOneYear)
); // ["Brandon", 38]

Parameters

I: Initializable<L>

Returns

Flatmappable<KindRightPair<L>>