Insert the given node as the first child of the given focus.
At the key move you will find a version that moves the focus to the newly inserted node.
move
import {Zipper, from, of} from 'effect-tree'import {pipe} from 'effect'const tree = from(1, of(2))const changed = pipe( tree, Zipper.fromTree, Zipper.prepend(of(1.5)), Zipper.toTree,)expect(changed, 'changed').toEqual(from(1, of(1.5), of(2)))// This time we move to the newly inserted treeconst moved = pipe( tree, Zipper.fromTree, Zipper.prepend.move(of(1.5)),)expect(Zipper.getValue(moved), 'moved').toBe(1.5) Copy
import {Zipper, from, of} from 'effect-tree'import {pipe} from 'effect'const tree = from(1, of(2))const changed = pipe( tree, Zipper.fromTree, Zipper.prepend(of(1.5)), Zipper.toTree,)expect(changed, 'changed').toEqual(from(1, of(1.5), of(2)))// This time we move to the newly inserted treeconst moved = pipe( tree, Zipper.fromTree, Zipper.prepend.move(of(1.5)),)expect(Zipper.getValue(moved), 'moved').toBe(1.5)
The underlying type of the tree.
A function that takes a zipper and returns an updated zipper where the focus node has been replaced.
Insert the given node as the first child of the given focus.
At the key
moveyou will find a version that moves the focus to the newly inserted node.Example
Type Param: A
The underlying type of the tree.
Returns
A function that takes a zipper and returns an updated zipper where the focus node has been replaced.