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

x/fun/tree.ts

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

This file contains a collection of utilities and algebraic structure implementations for Tree.

Functions

The apply function for Applicable.

Converts a Forest into a tree representation.

Converts a Tree into a tree representation.

The flatmap function for Flatmappable.

The fold function for Foldable.

Create an instance of Comparable<Tree> from an instance of Comparable.

Get an instance of Showable<Tree> from an instance of Showable.

The map function for Mappable.

The match function is a recursive fold that collapses a Tree into a single value I. It does this from the head of the Tree first.

The traverse function for Traversable.

This is a constructor function, taking a single value A and optionally an array of Tree and returning a Tree.

The unwrap function for Unwrappable

The wrap function for Wrappable.

Interfaces

KindTree is the Kind implementation for a Tree.

Type Aliases

AnyTree is useful as an extends constraint on a generic type.

A Forest is an array of Trees.

A Tree is a node with a single value and a Forest of children.

TypeOf is a type extractor that returns the inner type A of a Tree.