def restore_swap

bendvy-ecs-core@0.1.0.4 · component.bend:180

import bendvy-ecs-core@0.1.0.4/component.bend as Component
import Base
import column.bend as Col

180# Inverse closures own their old component, not a copied payload. Replaying
181# drops the replaced current owner exactly once and restores the journal owner.
182def restore_swap(~S: Data,~Store: Type,~R: Type,~E: Data,~Rest: Type,~C: Type,~V: Data,~Token: Data,~take: Store -> Rest & Col.Column<S,C>,~put: Rest -> Col.Column<S,C> -> Store,~project: C -> C & V,rest: Rest,result: Col.SwapOutcome<S,C>) -> Store & Unit:
183  match result:
184    case Col.Accepted{column,_}: (put(rest,column),Unit{})
185    case Col.Rejected{column,_}: (put(rest,column),Unit{})

Uses (5)

Used by (1)