1 import Base 2 import ./decode_data.bend as D 3 import ./restore_graph_data.bend as Snapshot 4 import ./restore_graph_raw.bend as Raw 5 import ./restore_raw.bend as Basic 6 7 type Returned is Type: 8 ParseRejected{owner:Owner,runtime:Runtime,original:D.Raw,error:Basic.Error} 9 Delivered{original:D.Raw,output:Output} 10 def parsed(~Owner:Type,~Runtime:Type,~Output:Type,~run:Owner -> Runtime -> Snapshot.Snapshot -> Output,+original:D.Raw,owner:Owner,runtime:Runtime,result:Raw.Parsed) -> Returned: 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)} 14 def run(~Owner:Type,~Runtime:Type,~Output:Type,~restore:Owner -> Runtime -> Snapshot.Snapshot -> Output,owner:Owner,runtime:Runtime,+input:D.Raw) -> Returned: 15 parsed(~Owner,~Runtime,~Output,~restore,input,owner,runtime,Raw.parse(input))