Skip to main content
Module

x/fun/mod.ts>alt.Alt

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
interface alt.Alt
implements TypeClass<U>, Functor<U>
import { type alt } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { Alt } = alt;

An instance of Alt extends Functor and provides a new method called alt. This method takes two matching Kinds, left and right, and returns one of them. A good way to think of this is as a boolean or, where if the left kind is "false" then the right kind is returned.

An instance of alt must obey the following laws:

  1. Associativity: pipe(a, alt(b), alt(c)) === pipe(a, alt(pipe(b, alt(c))))
  2. Distributivity: pipe(a, alt(b), map(f)) === pipe(a, map(f), alt(pipe(b, map(f))))

The original type came from here

Type Parameters

U extends Kind

Properties

readonly
alt: <A, B, C, D, E>(second: $<U, [A, B, C], [D], [E]>) => (first: $<U, [A, B, C], [D], [E]>) => $<U, [A, B, C], [D], [E]>