Create a new TreeF from a node value and a possibly empty list of child nodes. See BranchF for a version of this function specialized for branches.
TreeF
Under the key tupled you will find a tupled version and under flipped a version where the arguments are flipped in order.
tupled
flipped
import {TreeF} from 'effect-tree'import {Array} from 'effect'type Tree = TreeF.TreeF<number, number>const leaves: Array.NonEmptyArray<number> = [1, 2, 3]const tree: Tree = TreeF.treeF(42, leaves)const curried: Tree = TreeF.treeF(leaves)(42)const flipped: Tree = TreeF.treeF.flipped(leaves, 42)const flippedC: Tree = TreeF.treeF.flipped(42)(leaves)const tupled: Tree = TreeF.treeF.tupled([42, leaves])expect(tree, 'tree').toEqual({node: 42, forest: leaves})expect(curried, 'curried').toEqual(tree)expect(flipped, 'flipped').toEqual(tree)expect(flippedC, 'flippedC').toEqual(tree)expect(tupled, 'tupled').toEqual(tree) Copy
import {TreeF} from 'effect-tree'import {Array} from 'effect'type Tree = TreeF.TreeF<number, number>const leaves: Array.NonEmptyArray<number> = [1, 2, 3]const tree: Tree = TreeF.treeF(42, leaves)const curried: Tree = TreeF.treeF(leaves)(42)const flipped: Tree = TreeF.treeF.flipped(leaves, 42)const flippedC: Tree = TreeF.treeF.flipped(42)(leaves)const tupled: Tree = TreeF.treeF.tupled([42, leaves])expect(tree, 'tree').toEqual({node: 42, forest: leaves})expect(curried, 'curried').toEqual(tree)expect(flipped, 'flipped').toEqual(tree)expect(flippedC, 'flippedC').toEqual(tree)expect(tupled, 'tupled').toEqual(tree)
The underlying type of the tree. For example, in a numeric tree it would be number.
number
The child node type, also called the carrier type.
Create a new
TreeFfrom a node value and a possibly empty list of child nodes. See BranchF for a version of this function specialized for branches.Under the key
tupledyou will find a tupled version and underflippeda version where the arguments are flipped in order.Example
Type Param: A
The underlying type of the tree. For example, in a numeric tree it would be
number.Type Param: C
The child node type, also called the carrier type.