optional_resource_binding.bend

bendvy-ecs-core@0.1.0.1 · 14 lines · 0 definitions

1import Base
2import bendvy-ecs-core@0.1.0.1/ordinary_schema.bend as Schema
3import bendvy-ecs-core@0.1.0.1/resource_field_binding.bend as Tree
4import bendvy-ecs-core@0.1.0.1/owner_product.bend as Product
5import bendvy-ecs-core@0.1.0.1/ordinary_optional_resource.bend as O
6# Same original descriptor, with a storage index tied to the exact identity.
7type Index<-S:Data,-P:Type,-identity:Schema.Resource<S,P>> is Data:
8  Index{}
9def leaf(~S:Data,~P:Type,+identity:Schema.Resource<S,P>) -> Tree.Built<S,O.Slot<S,P,identity>,Index<S,P,identity>>:
10  Tree.Built{Schema.entries(~S,~Unit,~P,Schema.resource_schema(~S,~P,identity)),Index{}}
11type Binding<-S:Data,-R:Type,-P:Type,-Rest:Type,-identity:Schema.Resource<S,P>,-lens:Product.Lens<R,O.Slot<S,P,identity>,Rest>> is Data:
12  Binding{}
13def bind(~S:Data,~R:Type,~P:Type,~Rest:Type,~identity:Schema.Resource<S,P>,~lens:Product.Lens<R,O.Slot<S,P,identity>,Rest>,~cursor:Tree.Cursor<S,R,O.Slot<S,P,identity>,Rest,Index<S,P,identity>,lens>) -> Binding<S,R,P,Rest,identity,lens>:
14  Binding{}