effect-tree - v1.0.36
    Preparing search index...

    Function treeF

    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.

    Under the key tupled you will find a tupled version and under flipped a version where the arguments are flipped in order.

    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.

    The child node type, also called the carrier type.

    Index

    Properties

    Properties

    flipped: {
        <A, C>(forest: readonly C[], value: A): TreeF.TreeF<A, C>;
        <A>(value: A): <C>(forest: readonly C[]) => TreeF.TreeF<A, C>;
    }
    tupled: <A, C>(__namedParameters: [A, [C, ...C[]]]) => TreeF.TreeF<A, C>