TreeNonLeaf.ts overview
Internal (branching) node of a tree: a value of type A paired with a forest of child trees. Companion of | MTreeLeaf; both are unioned into `| `MTree.Type.
Quickstart
Example (Build a branch with two leaves)
import * as MTreeLeaf from "@parischap/effect-lib/MTreeLeaf"
import * as MTreeNonLeaf from "@parischap/effect-lib/MTreeNonLeaf"
const branch = MTreeNonLeaf.make({
value: "root",
forest: [MTreeLeaf.make("a"), MTreeLeaf.make("b")]
})
console.log(branch.value) // 'root'
console.log(branch.forest.length) // 2
Exports Grouped by Category
Constructors
make
Builds a non-leaf node from value and forest.
Signature
declare const make: <A, B>(params: MTypes.Data<Type<A, B>>) => Type<A, B>
Models
Type (class)
Internal node holding a value of type A and a forest of children of type MTreeForest.Type<A, B>.
Signature
declare class Type<A, B> {
private constructor({ value, forest }: MTypes.Data<Type<A, B>>)
}
make (static method)
Static constructor
Signature
declare const make: <A, B>(params: MTypes.Data<Type<A, B>>) => Type<A, B>
[MData.idSymbol] (method)
Returns the id of this
Signature
declare const [MData.idSymbol]: () => string | (() => string)
forest (property)
The children of a NonLeaf
Signature
readonly forest: MTreeForest.Type<A, B>
Module markers
moduleTag
Module tag.
Signature
declare const moduleTag: "@parischap/effect-lib/Tree/TreeNonLeaf/"