import Base import ./change_tick.bend as Tick import check.bend as Check import inspector.bend as I import machine.bend as M import machine_world.bend as MW import world.bend as W import capabilities.bend as Cap # Private public-source projection candidate. Closed schema setup owns the lens. # No requirement validator or foreign-instance policy is selected here. def projected(~S:Data,~K:Data,~V:Data,~Store:Type,~R:Type,~E:Data,cursor:Maybe<&2,Tick.Tick>,observed:W.World & M.Slot) -> I.Frame & M.CurrentView: (world,slot)=observed (I.Frame{world,cursor},M.current_view(~S,~K,~V,slot)) def current(~S:Data,~K:Data,~V:Data,~Store:Type,~R:Type,~E:Data,~take_resource:R -> R & M.Slot,frame:I.Frame) -> I.Frame & M.CurrentView: match frame: case I.Frame{world,cursor}:projected(~S,~K,~V,~Store,~R,~E,cursor,MW.take(~S,~K,~V,~Store,~R,~E,~take_resource,world)) def provide(~S:Data,~K:Data,~V:Data,~Store:Type,~R:Type,~E:Data,~take_resource:R -> R & M.Slot) -> Cap.ValueRead,M.CurrentView>: Cap.ValueRead{current(~S,~K,~V,~Store,~R,~E,~take_resource)} def check_projected(~S:Data,~K:Data,~V:Data,~Store:Type,~R:Type,~E:Data,observed:W.World & M.Slot) -> Check.Frame & M.CurrentView: (world,slot)=observed (Check.Frame{world},M.current_view(~S,~K,~V,slot)) def check_current(~S:Data,~K:Data,~V:Data,~Store:Type,~R:Type,~E:Data,~take_resource:R -> R & M.Slot,ctx:Check.Frame) -> Check.Frame & M.CurrentView: match ctx: case Check.Frame{world}:check_projected(~S,~K,~V,~Store,~R,~E,MW.take(~S,~K,~V,~Store,~R,~E,~take_resource,world)) def check_provide(~S:Data,~K:Data,~V:Data,~Store:Type,~R:Type,~E:Data,~take_resource:R -> R & M.Slot) -> Cap.ValueRead,M.CurrentView>: Cap.ValueRead{check_current(~S,~K,~V,~Store,~R,~E,~take_resource)}