def bounded
bendvy-ecs-core@0.1.0.4 · recoverable_array_owner.bend:33
import bendvy-ecs-core@0.1.0.4/recoverable_array_owner.bend as RecoverableArrayOwner
import Base
import bendvy-ecs-core@0.1.0.4/owner_product.bend as Product
import bendvy-ecs-core@0.1.0.4/recoverable_array.bend as A
import bendvy-ecs-core@0.1.0.4/recovery_journal.bend as Journal
33def bounded(~State:Type,~P:Type,~Rest:Type,~lens:Product.Lens<State,Array<P>,Rest>,~Recovery:Type,~ReleasedRest:Type,~release:Product.Lens<Recovery,List<A.Record<P>>,ReleasedRest>,valid:Bool,rest:Rest,array:Array<P>,journal:List<Journal.Action(~State,~Recovery)>,+index:U32,replacement:P) -> Attempt<State,Recovery,P>:
34 match valid:
35 case False{}:Refused{Product.put_field(~State,~Array<P>,~Rest,lens)(rest,array),journal,replacement}
36 case True{}:applied(~State,~Recovery,~P,swapped(~State,~P,~Rest,~lens,~Recovery,~ReleasedRest,~release,rest,index,journal,Array.swap(P,array,index,replacement)))