Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fun/examples/natural.ts>NatEitherOption

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

Now lets define some Natural Transformations. The rule we have to follow is:

NaturalTransform<V, U> . Functor === Functor . NaturalTransform<V, U>

This is like saying (U = Either, V = Option):

pipe( right("Hello World"), Either.map(str => str.length), NaturalTransformation<Either, Option>.transform, )

Must equal:

pipe( right("Hello World"), NaturalTransform<Either, Option>.transform, Option.map(str => str.length), )

type

Nat<E.KindEither, O.KindOption>