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

    Function replace

    Replace the focus tree node of the zipper with the given tree node.

    import {Zipper, from, of} from 'effect-tree'
    import {pipe} from 'effect'

    const tree = from(1, of(2))

    const changed = pipe(
    tree,
    Zipper.fromTree,
    Zipper.head,
    Zipper.replace(from(3, of(4))),
    Zipper.toTree,
    )

    expect(changed).toEqual(from(1, from(3, of(4))))

    The underlying type of the tree.

    A function that takes a zipper and returns an updated zipper where the focus node has been replaced.