Frame.write_read: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/storage/frame.bend as Frame Lines 7-24 of bendtorch-core@0.1.0.0/src/storage/frame.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/storage/frame.bend&start_line=7&end_line=24 import Base import bendtorch-core@0.1.0.0/src/storage/model.bend as Model import bendtorch-core@0.1.0.0/src/storage/array.bend as ArrayCore def write_read(-T: Data, +d: Nat, array: Array, +path: Model.Path(d), value: T, valid: Model.Balanced(T, d, array)) -> {Model.observe(T, d, ArrayCore.write_path(T, d, array, path, value), path) == Some{value} : Maybe<&2, T>}: match d array: case 0n ALeaf{old}: {==} case 0n ANode{xs, ys}: match valid: case 1n+p ALeaf{old}: match valid: case 1n++p ANode{xs, ys}: Model.Step{bit, rest} = path match bit: case False{}: (ex, ey) = valid write_read(T, p, xs, rest, value, ex) case True{}: (ex, ey) = valid write_read(T, p, ys, rest, value, ey) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/array.bend&name=write_path https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/model.bend&name=Balanced https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/model.bend&name=Path https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/model.bend&name=Step https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/model.bend&name=observe