import { semigroup } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { last } = semigroup;
Get an Semigroup over A that always returns the last parameter supplied to concat (confusingly this is actually the first parameter since concat is in curried form).
Examples
Example 1
Example 1
import { last } from "./semigroup.ts";
import { pipe } from "./fn.ts";
type Person = { name: string, age: number };
const SemigroupPerson = last<Person>();
const octavia: Person = { name: "Octavia", age: 42 };
const kimbra: Person = { name: "Kimbra", age: 32 };
const brandon: Person = { name: "Brandon", age: 37 };
const lastPerson = pipe(
octavia,
SemigroupPerson.concat(kimbra),
SemigroupPerson.concat(brandon),
); // lastPerson === brandon