1 import Base 2 import ./trace_facts.bend as TraceFacts 3 import world.bend as W 4 import column.bend as Col 5 import component.bend as Cmp 6 import transaction.bend as T 7 import provider.bend as Pv 8 import commands.bend as Cmd 9 10 # Main membership is required; these modes apply to the independent aux family. 11 # Bounded explicit two-family composition is not a general query planner. 12 # Auxiliary-family membership in this bounded two-family query. Main 13 # membership is always required. Use ordinary/Compose declarations for general 14 # heterogeneous query shapes; this helper is not the full query planner. 15 type Selection is Data: 16 Required{} 17 Present{} 18 Absent{} 19 Optional{} 20 21 def main_found(~V: Data,value: Cmp.Access) -> Bool: 22 match value: 23 case Cmp.Found{_}: True{} 24 case _: False{} 25 26 def selection_aux(~V: Data,mode: Selection,value: Cmp.Access) -> Bool: 27 match mode value: 28 case Required{} Cmp.Found{_}: True{} 29 case Present{} Cmp.Found{_}: True{} 30 case Absent{} Cmp.ComponentAbsent{}: True{} 31 case Optional{} Cmp.Found{_}: True{} 32 case Optional{} Cmp.ComponentAbsent{}: True{} 33 case _ _: False{} 34 35 def selected_aux(~S: Data,~Store: Type,~R: Type,~E: Data,~V: Data,mode: Selection,main: Bool,observed: T.Tx,E> & Cmp.Access) -> T.Tx,E> & Bool: 36 (tx,value) = observed 37 (tx,main && selection_aux(~V,mode,value)) 38 39 def selected_main(~S: Data,~Store: Type,~R: Type,~E: Data,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,mode: Selection,auxFamily: Cmp.Family,+handle: W.Handle,observed: T.Tx,E> & Bool) -> T.Tx,E> & Bool: 40 match observed: 41 case (tx,False{}): (tx,False{}) 42 case (tx,True{}): selected_aux(~S,~Store,~R,~E,~AuxV,mode,True{},Cmp.tx_get(~S,~Store,~R,~E,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,auxFamily,tx,handle)) 43 44 def main_join(~S: Data,~Store: Type,~R: Type,~E: Data,~V: Data,observed: T.Tx,E> & Cmp.Access) -> T.Tx,E> & Bool: 45 (tx,value) = observed 46 (tx,main_found(~V,value)) 47 48 def selected(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,tx: T.Tx,E>,+handle: W.Handle) -> T.Tx,E> & Bool: 49 selected_main(~S,~Store,~R,~E,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,mode,auxFamily,handle,main_join(~S,~Store,~R,~E,~V,Cmp.tx_get(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,mainFamily,tx,handle))) 50 51 # Name helpers only carry diagnostic metadata, not capability authority. 52 def main_name(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,family: Cmp.Family) -> String: 53 match family: 54 case Cmp.Family{name}: name 55 def aux_name(~S: Data,~Store: Type,~R: Type,~E: Data,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,family: Cmp.Family) -> String: 56 match family: 57 case Cmp.Family{name}: name 58 59 def after_run(~S: Data,~Store: Type,~R: Type,~E: Data,~U: Data,next: T.Tx,E> -> T.Tx,E> & T.Outcome>,observed: T.Tx,E> & T.Outcome>) -> T.Tx,E> & T.Outcome>: 60 match observed: 61 case (tx,T.Success{}): next(tx) 62 case (tx,T.Failure{error}): (tx,T.Failure{error}) 63 64 def run_selected(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~U: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-set: (H -> C -> H) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> @-resource_set: (H -> R -> H) -> @-emit: (H -> E -> H) -> @-despawn: (H -> H) -> @-spawn: (H -> Payload -> H & W.Reservation) -> A -> W.Handle -> H -> H & T.Outcome,+mainName: String,+auxName: String,+handle: W.Handle,args: A,next: T.Tx,E> -> T.Tx,E> & T.Outcome>,observed: T.Tx,E> & Bool) -> T.Tx,E> & T.Outcome>: 65 match observed: 66 case (tx,False{}): next(tx) 67 case (tx,True{}): after_run(~S,~Store,~R,~E,~U,next,Pv.run(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~body,mainName,auxName,tx,handle,args)) 68 69 def run_handles(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~U: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-set: (H -> C -> H) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> @-resource_set: (H -> R -> H) -> @-emit: (H -> E -> H) -> @-despawn: (H -> H) -> @-spawn: (H -> Payload -> H & W.Reservation) -> A -> W.Handle -> H -> H & T.Outcome,handles: List<&2,W.Handle>,+mainFamily: Cmp.Family,+auxFamily: Cmp.Family,+mode: Selection,+args: A,tx: T.Tx,E>) -> T.Tx,E> & T.Outcome>: 70 match handles: 71 case []: (tx,T.Success{}) 72 case +handle <> rest: 73 run_selected(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~body,main_name(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,mainFamily),aux_name(~S,~Store,~R,~E,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,auxFamily),handle,args,(tx => run_handles(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~body,rest,mainFamily,auxFamily,mode,args,tx)),selected(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,mainFamily,auxFamily,mode,tx,handle)) 74 75 def finished(~S: Data,~Store: Type,~R: Type,~E: Data,~U: Data,observed: T.Tx,E> & T.Outcome>) -> T.Returned,Pv.Error>: 76 (tx,result) = observed 77 Cmd.tx_finish(~S,~Store,~R,~E,~Pv.Error,tx,result) 78 79 def each_reserved(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~U: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-set: (H -> C -> H) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> @-resource_set: (H -> R -> H) -> @-emit: (H -> E -> H) -> @-despawn: (H -> H) -> @-spawn: (H -> Payload -> H & W.Reservation) -> A -> W.Handle -> H -> H & T.Outcome,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,args: A,observed: W.World & List<&2,W.Handle>) -> T.Returned,Pv.Error>: 80 (world,handles) = observed 81 finished(~S,~Store,~R,~E,~U,run_handles(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~body,handles,mainFamily,auxFamily,mode,args,T.begin(~W.World,~E,world))) 82 83 # Traverse a snapshot of live handles with required main and selected aux 84 # membership, invoking the declared provider body within one transaction. 85 # Failure rolls back that traversal's recorded writes/publications; commands 86 # remain deferred until an explicit barrier. Families/lenses are trusted setup. 87 # Prefer ordinary declarations for application-derived registration/access. 88 def each_rw_read(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~U: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-set: (H -> C -> H) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> @-resource_set: (H -> R -> H) -> @-emit: (H -> E -> H) -> @-despawn: (H -> H) -> @-spawn: (H -> Payload -> H & W.Reservation) -> A -> W.Handle -> H -> H & T.Outcome,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,world: W.World,args: A) -> T.Returned,Pv.Error>: 89 each_reserved(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~body,mainFamily,auxFamily,mode,args,W.handles(~S,~Store,~R,~E,world)) 90 91 # Read-only gameplay receives no component/resource setter, event writer or command. 92 def read_prepend(~S: Data,~Store: Type,~R: Type,~E: Data,~Out: Data,value: Out,observed: T.Tx,E> & List<&2,Out>) -> T.Tx,E> & List<&2,Out>: 93 (tx,values) = observed 94 (tx,value <> values) 95 96 def read_added(~S: Data,~Store: Type,~R: Type,~E: Data,~Out: Data,next: T.Tx,E> -> T.Tx,E> & List<&2,Out>,observed: T.Tx,E> & Out) -> T.Tx,E> & List<&2,Out>: 97 (tx,value) = observed 98 read_prepend(~S,~Store,~R,~E,~Out,value,next(tx)) 99 def read_selected(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~Out: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> A -> W.Handle -> H -> H & Out,+mainName: String,+auxName: String,+handle: W.Handle,args: A,next: T.Tx,E> -> T.Tx,E> & List<&2,Out>,observed: T.Tx,E> & Bool) -> T.Tx,E> & List<&2,Out>: 100 match observed: 101 case (tx,False{}): next(tx) 102 case (tx,True{}): read_added(~S,~Store,~R,~E,~Out,next,Pv.read(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~Out,~body,mainName,auxName,tx,handle,args)) 103 104 def read_handles(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~Out: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> A -> W.Handle -> H -> H & Out,handles: List<&2,W.Handle>,+mainFamily: Cmp.Family,+auxFamily: Cmp.Family,+mode: Selection,+args: A,tx: T.Tx,E>) -> T.Tx,E> & List<&2,Out>: 105 match handles: 106 case []: (tx,[]) 107 case +handle <> rest: 108 read_selected(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~Out,~body,main_name(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,mainFamily),aux_name(~S,~Store,~R,~E,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,auxFamily),handle,args,(tx => read_handles(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~Out,~body,rest,mainFamily,auxFamily,mode,args,tx)),selected(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,mainFamily,auxFamily,mode,tx,handle)) 109 110 def read_world(~S: Data,~Store: Type,~R: Type,~E: Data,~Out: Data,observed: T.Tx,E> & List<&2,Out>) -> W.World & List<&2,Out>: 111 match observed: 112 case (T.Tx{world,_,_,_,_},values): (world,values) 113 114 def read_reserved(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~Out: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> A -> W.Handle -> H -> H & Out,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,args: A,observed: W.World & List<&2,W.Handle>) -> W.World & List<&2,Out>: 115 (world,handles) = observed 116 read_world(~S,~Store,~R,~E,~Out,read_handles(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~Out,~body,handles,mainFamily,auxFamily,mode,args,T.begin(~W.World,~E,world))) 117 118 # Read-only bounded two-family traversal returning World and ordered Data 119 # row outputs. Body receives no setter, publisher or structural command grant. 120 # Main is required; mode controls auxiliary membership. Canonical projections 121 # preserve affine payloads while exposing Data views; callbacks remain trusted. 122 def each_read(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~Out: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> A -> W.Handle -> H -> H & Out,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,world: W.World,args: A) -> W.World & List<&2,Out>: 123 read_reserved(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~Out,~body,mainFamily,auxFamily,mode,args,W.handles(~S,~Store,~R,~E,world)) 124 125 # Main RW + aux Read + resource Read, with no other user capability grant. 126 # Bounded query granting main component read/write, aux component read and 127 # resource read, without other gameplay operations. Uses the same transaction 128 # and deferred-visibility rules as each_rw_read; raw setup stays trusted. 129 def each_rw_read_resource(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~U: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-set: (H -> C -> H) -> @-aux: (H -> H & Cmp.Access) -> @-resource_get: (H -> H & RV) -> A -> W.Handle -> H -> H & T.Outcome,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,world: W.World,args: A) -> T.Returned,Pv.Error>: 130 each_rw_read(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~Pv.component_body(~S,~C,~V,~AuxV,~RV,~R,~E,~Payload,~A,~U,~body),mainFamily,auxFamily,mode,world,args) 131 132 # Resource capabilities and spawn are absent from this callback contract. 133 # Bounded query granting component operations, declared event publication and 134 # deferred despawn, without resource or spawn capabilities. Failure suppresses its 135 # staged publications; no deferred command barrier is implied. 136 # Broader compositions use ordinary-query-declaration/observable or Compose. 137 def each_rw_read_events(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column,~put: Rest -> Col.Column -> Store,~project: C -> C & V,~AuxRest: Type,~AuxC: Type,~AuxV: Data,~AuxToken: Data,~aux_take: Store -> AuxRest & Col.Column,~aux_put: AuxRest -> Col.Column -> Store,~aux_project: AuxC -> AuxC & AuxV,~RV: Data,~resource_project: R -> R & RV,~Payload: Type,~populate: W.World -> W.Handle -> Payload -> W.World,~clear: Store -> W.Handle -> Store,~A: Data,~U: Data,~body: @-H: Type -> @-get: (H -> H & Cmp.Access) -> @-set: (H -> C -> H) -> @-aux: (H -> H & Cmp.Access) -> @-emit: (H -> E -> H) -> @-despawn: (H -> H) -> A -> W.Handle -> H -> H & T.Outcome,mainFamily: Cmp.Family,auxFamily: Cmp.Family,mode: Selection,world: W.World,args: A) -> T.Returned,Pv.Error>: 138 each_rw_read(~S,~Store,~R,~E,~Rest,~C,~V,~Token,~take,~put,~project,~AuxRest,~AuxC,~AuxV,~AuxToken,~aux_take,~aux_put,~aux_project,~RV,~resource_project,~Payload,~populate,~clear,~A,~U,~Pv.event_body(~S,~C,~V,~AuxV,~RV,~R,~E,~Payload,~A,~U,~body),mainFamily,auxFamily,mode,world,args)