def join.lock

ezx@1.11.0.0 · src/relock/relock.bend:52

import ezx@1.11.0.0/src/relock/relock.bend as Relock
import Base
import ezx@1.11.0.0/src/lock/plan.bend as P

52# the edit and the lock as one plan, once the edit is known to succeed: the
53# edit's effects, the notes, and the lock's effects, or, when the lock
54# refuses, a refusal with no effect, its reason followed by `tail`
55def join.lock(lock: P.Plan, +edit: P.Plan, notes: List<&2, P.Effect>, +tail: String) -> P.Plan:
56  P.Plan{es, outcome} = lock
57  match outcome:
58    case P.Success{}:
59      P.Plan{List.append(&2, P.Effect, P.effects(edit), List.append(&2, P.Effect, notes, es)),
60        P.Success{}}
61    case P.Refused{why}:
62      P.Plan{[], P.Refused{why ++ tail}}

Uses (8)

Used by (1)