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

Usage

import * as fun from "https://raw.githubusercontent.com/baetheus/fun/main/initializable.ts";

This file contains the type and utilities for the Initializable algebraic data structure. A type that implements Initializable has a concept of "empty" represented by the init method and a concept to combine represented by the combine method. In other functional libraries and languages Initializable is called Monoid.

§Functions

constant

Create an Initializable fixed to a concrete value A. This operates like init from Combinable in other functional libraries.

dual

Create a dual Initializable from an existing initializable. This effectively switches the order of application of the original Initializable.

getCombineAll

Given an Initializable, create a function that will iterate through an array of values and combine them. This is not much more than Array.fold(combine).

intercalcate

Create a initializable that works like Array.join, inserting middle between every two values that are combineenated. This can have some interesting results.

struct

Create an Initializable fixed to a struct using nested Initializables to create the init values within.

tuple

Create an Initializable fixed to a tuple using nested Initializables to create the init values within.

§Interfaces

Initializable

A Initializable structure has the method init.

§Type Aliases

AnyInitializable

A type for Initializable over any fixed value, useful as an extension target for functions that take any Initializable and do not need to unwrap the type.

TypeOf

A type level unwrapor, used to pull the inner type from a Combinable.