Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fun/alt.ts>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
implements TypeClass<U>, Functor<U>
import { type Alt } from "https://deno.land/x/fun@v2.0.0-alpha.6/alt.ts";

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

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]>