1 import Base 2 import ./execution_lifecycle_notices.bend as Notice 3 import ./execution_composer_layout.bend as Layout 4 import ./execution_state.bend as State 5 import ./execution_declaration.bend as D 6 7 type Next<-S:Data,-H:Type,-origin:Layout.Layout,-selector:Notice.Selector> is Type: 8 Next{next:H -> Notice.Reader -> H & Notice.Reading} 9 def Ops(~S:Data,~origin:Layout.Layout,~selector:Notice.Selector,H:Type) -> Type: 10 Next 11 def next(~S:Data,~H:Type,~origin:Layout.Layout,~selector:Notice.Selector,cap:Next,owner:H,reader:Notice.Reader) -> H & Notice.Reading: 12 match cap: 13 case Next{invoke}:invoke(owner,reader) 14 def read(~S:Data,~C:Type,~R:Type,~origin:Layout.Layout,~selector:Notice.Selector,scope:State.Scope,reader:Notice.Reader) -> State.Scope & Notice.Reading: 15 match scope: 16 case State.Scope{store,resource,handles,tick,prior,+view}:(State.Scope{store,resource,handles,tick,prior,view},Notice.read(~S,~origin,~selector,view,reader)) 17 def removed(~S:Data,~WC:Type,~C:Type,~R:Type,~layout:Layout.Layout,~route:Layout.Route,~same:{WC == Layout.columns(~S,layout) : Type},~valid:{Layout.grant_valid(~layout,~route) == True{} : Bool}) -> D.Declaration: 18 D.Declaration{Next{read(~S,~C,~R,~(Layout.origin(layout,route)),~(Notice.Removed{Layout.key(layout,route)}))},[D.Access{"removed/" ++ Layout.key(layout,route),D.LifecycleAccess{},D.SharedView{},D.ReadOnly{}}]} 19 def despawned(~S:Data,~C:Type,~R:Type) -> D.Declaration: 20 D.Declaration{Next{read(~S,~C,~R,~(Layout.EmptyLayout{}),~(Notice.Despawned{}))},[D.Access{"despawn",D.LifecycleAccess{},D.SharedView{},D.ReadOnly{}}]}