import Base import ./decode_data.bend as D import ./restore_graph_data.bend as Snapshot import ./restore_graph_raw.bend as Raw import ./restore_raw.bend as Basic type Returned is Type: ParseRejected{owner:Owner,runtime:Runtime,original:D.Raw,error:Basic.Error} Delivered{original:D.Raw,output:Output} 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: match result: case Raw.Rejected{input,error}:ParseRejected{owner,runtime,input,error} case Raw.Accepted{snapshot}:Delivered{original,run(owner,runtime,snapshot)} def run(~Owner:Type,~Runtime:Type,~Output:Type,~restore:Owner -> Runtime -> Snapshot.Snapshot -> Output,owner:Owner,runtime:Runtime,+input:D.Raw) -> Returned: parsed(~Owner,~Runtime,~Output,~restore,input,owner,runtime,Raw.parse(input))