def restore_swap

bendvy-ecs-core@0.1.0.3 · component.bend:178

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

178# Inverse closures own their old component, not a copied payload. Replaying
179# drops the replaced current owner exactly once and restores the journal owner.
180def 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:
181  match result:
182    case Col.Accepted{column,_}: (put(rest,column),Unit{})
183    case Col.Rejected{column,_}: (put(rest,column),Unit{})

Uses (5)

Used by (1)