restore_graph_raw_owner.bend

bendvy-ecs-core@0.1.0.1 · 15 lines · 0 definitions

1import Base
2import bendvy-ecs-core@0.1.0.1/decode_data.bend as D
3import bendvy-ecs-core@0.1.0.1/restore_graph_data.bend as Snapshot
4import bendvy-ecs-core@0.1.0.1/restore_graph_raw.bend as Raw
5import bendvy-ecs-core@0.1.0.1/restore_raw.bend as Basic
6
7type Returned<Owner:Type,Runtime:Type,Output:Type> is Type:
8  ParseRejected{owner:Owner,runtime:Runtime,original:D.Raw,error:Basic.Error}
9  Delivered{original:D.Raw,output:Output}
10def parsed(~Owner:Type,~Runtime:Type,~Output:Type,~run:Owner -> Runtime -> Snapshot.Snapshot -> Output,+original:D.Raw,owner:Owner,runtime:Runtime,result:Raw.Parsed) -> Returned<Owner,Runtime,Output>:
11  match result:
12    case Raw.Rejected{input,error}:ParseRejected{owner,runtime,input,error}
13    case Raw.Accepted{snapshot}:Delivered{original,run(owner,runtime,snapshot)}
14def run(~Owner:Type,~Runtime:Type,~Output:Type,~restore:Owner -> Runtime -> Snapshot.Snapshot -> Output,owner:Owner,runtime:Runtime,+input:D.Raw) -> Returned<Owner,Runtime,Output>:
15  parsed(~Owner,~Runtime,~Output,~restore,input,owner,runtime,Raw.parse(input))