~/bend-docscommunity

ordinary_app_registration_run.bend source

ordinary_app_registration_run.bend on the hub · documented module

import Baseimport ./trace_facts.bend as TraceFactsimport ./ordinary_app_registration_fields.bend as Recordsimport ./world.bend as Wimport ./system.bend as Sysimport ./ordinary_query_declaration.bend as Query# Representation-only transport of the existing Sys.run discriminants.# No output, rejected argument or affine owner is duplicated or finalized here.type TransportResult<S:Data,World:Type,Args:Type,Error:Data,Out:Type,Token:Type> is Type:  Completed{token:Token,fields:Records.Fields<S>,outcome:Sys.Outcome<World,Error,Out>}  RegistrationRejected{token:Token,fields:Records.Fields<S>,world:World,args:Args}def returned(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,slot:String,clauses:List<&2,Query.Clause<S>>,kind:Records.RegistrationKind,registry:Sys.Registry<S,C,R,E,Args,Error,Out,runner>) -> Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>> & Records.Fields<S>:  match registry:    case Sys.Registry{namespace,id,name,access,cursor}:(Records.Token{},Records.Fields{namespace,id,name,access,cursor,slot,clauses,kind})def completed(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,outcome:Sys.Outcome<W.World<S,C,R,E>,Error,Out>,result:Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>> & Records.Fields<S>) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>>:  match result:    case (token,fields):Completed{token,fields,outcome}def rejected(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,world:W.World<S,C,R,E>,args:Args,result:Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>> & Records.Fields<S>) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>>:  match result:    case (token,fields):RegistrationRejected{token,fields,world,args}def captured(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,slot:String,clauses:List<&2,Query.Clause<S>>,kind:Records.RegistrationKind,result:Sys.RunResult<S,C,R,E,Args,Error,Out,runner>) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>>:  match result:    case Sys.Completed{registry,outcome}:completed(~S,~C,~R,~E,~Args,~Error,~Out,~runner,outcome,returned(~S,~C,~R,~E,~Args,~Error,~Out,~runner,slot,clauses,kind,registry))    case Sys.RegistrationRejected{registry,world,args}:rejected(~S,~C,~R,~E,~Args,~Error,~Out,~runner,world,args,returned(~S,~C,~R,~E,~Args,~Error,~Out,~runner,slot,clauses,kind,registry))def restored(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,fields:Records.Fields<S>,world:W.World<S,C,R,E>,args:Args) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>>:  match fields:    case Records.Fields{namespace,id,name,access,cursor,slot,clauses,kind}:captured(~S,~C,~R,~E,~Args,~Error,~Out,~runner,slot,clauses,kind,Sys.run(~S,~C,~R,~E,~Args,~Error,~Out,~runner,Sys.Registry{namespace,id,name,access,cursor},world,args))def run(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,token:Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>,fields:Records.Fields<S>,world:W.World<S,C,R,E>,args:Args) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>>:  match token:    case Records.Token{}:restored(~S,~C,~R,~E,~Args,~Error,~Out,~runner,fields,world,args)def captured_observed(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,slot:String,clauses:List<&2,Query.Clause<S>>,kind:Records.RegistrationKind,result:Sys.RunResult<S,C,R,E,Args,Error,Out,runner> & TraceFacts.State) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>> & TraceFacts.State:  match result:    case (result,trace):(captured(~S,~C,~R,~E,~Args,~Error,~Out,~runner,slot,clauses,kind,result),trace)def restored_observed(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,~observed:TraceFacts.State -> W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out> & TraceFacts.State,fields:Records.Fields<S>,trace:TraceFacts.State,world:W.World<S,C,R,E>,args:Args) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>> & TraceFacts.State:  match fields:    case Records.Fields{namespace,id,name,access,cursor,slot,clauses,kind}:captured_observed(~S,~C,~R,~E,~Args,~Error,~Out,~runner,slot,clauses,kind,Sys.run_observed(~S,~C,~R,~E,~Args,~Error,~Out,~runner,~observed,Sys.Registry{namespace,id,name,access,cursor},trace,world,args))def run_observed(~S:Data,~C:Type,~R:Type,~E:Data,~Args:Type,~Error:Data,~Out:Type,~runner:W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out>,~observed:TraceFacts.State -> W.World<S,C,R,E> -> Args -> Sys.Outcome<W.World<S,C,R,E>,Error,Out> & TraceFacts.State,token:Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>,fields:Records.Fields<S>,trace:TraceFacts.State,world:W.World<S,C,R,E>,args:Args) -> TransportResult<S,W.World<S,C,R,E>,Args,Error,Out,Records.Token<Sys.Registry<S,C,R,E,Args,Error,Out,runner>>> & TraceFacts.State:  match token:    case Records.Token{}:restored_observed(~S,~C,~R,~E,~Args,~Error,~Out,~runner,~observed,fields,trace,world,args)