Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

FnEither

import type { FnEither } from "https://raw.githubusercontent.com/baetheus/fun/main/fn_either.ts";

A FnEither, also known as ReaderEither, is a type over a variadic javascript function that returns an Either. ie. (a: number, b: string) => Either<Error, string> can be a FnEither. As an algebraic data type, the associated type class instances for Fn are limited to single variable inputs so they will look like (a: number) => Either<Error, string>, with only one argument. The purposes of a FnEither are many and varied, some common purposes are: failable computation, reading values from a shared environment, and sub-computations in a modified environment.

Currently, there is no implementation of Chain recursion or trampolining for FnEIther implemented, but it is likely to be a future feature. Once implemented Fn will gain some much needed stack safety.

type FnEither<D, B, A> = Fn<D, Either<B, A>>;

§Type Parameters

§Type

§
Fn<D, Either<B, A>>
[src]