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

    Function branchF

    Create a branch from its value and a non-empty list of children. This is exactly like TreeF except the return type is the branch type and you cannot call it with no leaves.

    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 Branch = TreeF.BranchF<number, number>

    const leaves: Array.NonEmptyArray<number> = [1, 2, 3]

    const branch: Branch = TreeF.branchF(42, leaves)
    const curried: Branch = TreeF.branchF(leaves)(42)
    const flipped: Branch = TreeF.branchF.flipped(leaves, 42)
    const flippedC: Branch = TreeF.branchF.flipped(42)(leaves)
    const tupled: Branch = TreeF.branchF.tupled([42, leaves])

    expect(branch, 'branch').toEqual({node: 42, forest: leaves})
    expect(curried, 'curried').toEqual(branch)
    expect(flipped, 'flipped').toEqual(branch)
    expect(flippedC, 'flippedC').toEqual(branch)
    expect(tupled, 'tupled').toEqual(branch)

    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, C], value: A): BranchF<A, C>;
        <A>(value: A): <C>(forest: readonly [C, C]) => BranchF<A, C>;
    }
    tupled: <A, C>(__namedParameters: [A, [C, ...C[]]]) => BranchF<A, C>