Skip to main content Link Search Menu Expand Document (external link)

TreeLeaf overview

Leaf node of a tree: a value of type B with no children. Companion of {@link “./TreeNonLeaf.js” | MTreeNonLeaf}; both are unioned into {@link “./Tree.js” | MTree.Type}.

Quickstart

Example (Create a leaf)

import * as MTreeLeaf from "@parischap/effect-lib/Tree/TreeLeaf"

const leaf = MTreeLeaf.make(42)
console.log(leaf.value) // 42

Table of contents


Constructors

make

Builds a leaf node carrying value.

Example

import * as MTreeLeaf from "@parischap/effect-lib/Tree/TreeLeaf"

console.log(MTreeLeaf.make(42).value) // 42

Signature

export declare const make: <B>(value: B) => Type<B>

Models

Type (class)

Leaf node holding a value of type B. Has no children.

Signature

export declare class Type<B> {
  private constructor({ value }: MTypes.Data<Type<B>>)
}

make (static method)

Static constructor

Signature

static make<B>(params: MTypes.Data<Type<B>>): Type<B>

[MData.idSymbol] (method)

Returns the id of this

Signature

[MData.idSymbol](): string | (() => string)

Module markers

moduleTag

Module tag.

Signature

export declare const moduleTag: "@parischap/effect-lib/Tree/TreeLeaf/"