import Base import ./clock_state.bend as Clock import ./deferred_command.bend as Deferred import entity_allocator.bend as Alloc import ./world.bend as W import ./owner_product.bend as Product # Canonical owner split, used only behind ordinary declaration providers. type Rest is Type: Rest{namespace:U32,allocator:Alloc.Allocator,store:C,events:List<&2,E>,pending:List>>,registrations:List<&2,W.RegistrationMeta>,nextSystemId:U32,clock:Clock.State} def take(~S:Data,~C:Type,~R:Type,~E:Data,world:W.World) -> Rest & R: match world: case W.World{ns,allocator,store,resource,events,pending,regs,sid,clock}:(Rest{ns,allocator,store,events,pending,regs,sid,clock},resource) def put(~S:Data,~C:Type,~R:Type,~E:Data,rest:Rest,resource:R) -> W.World: match rest: case Rest{ns,allocator,store,events,pending,regs,sid,clock}:W.World{ns,allocator,store,resource,events,pending,regs,sid,clock} def lens(~S:Data,~C:Type,~R:Type,~E:Data) -> Product.Lens,R,Rest>: Product.Lens{take(~S,~C,~R,~E),put(~S,~C,~R,~E)}