pub fn try_apply_edit(prog: &Program, edit: &Edit) -> Result<Program, String>
Apply a structural edit with bounds and target-kind validation. Returns Err if the target index is out of range or has an incompatible item kind.
Err