Skip to main content
Module

x/fun/combinable.ts>first

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

Get an Combinable over A that always returns the first parameter supplied to combine (confusingly this is actually the last parameter since combine is in curried form).

Examples

Example 1

import { first, getCombineAll } from "./combinable.ts";
import { pipe } from "./fn.ts";

type Person = { name: string, age: number };
const FirstPerson = first<Person>();
const getFirstPerson = getCombineAll(FirstPerson);

const octavia: Person = { name: "Octavia", age: 42 };
const kimbra: Person = { name: "Kimbra", age: 32 };
const brandon: Person = { name: "Brandon", age: 37 };

const result = getFirstPerson(octavia, kimbra, brandon); // octavia