insertLeft method

ZipperLocation<ZR, ZI, ZS> insertLeft(
  1. ZR r
)

Insert new node to the left

Implementation

ZipperLocation<ZR, ZI, ZS> insertLeft(ZR r) {
  if (path is TopPath) {
    throw Exception("insert of top");
  }
  final p = path as NodePath<ZS, ZR>;
  return update(
    node: node,
    path: NodePath(
      left: List.unmodifiable([r, ...p.left]),
      parentPath: p.parentPath,
      parentNode: p.parentNode,
      right: p.right,
    ),
  );
}