def decided

cswap-bend-cli@0.1.0.0 · profswitch.bend:69

import cswap-bend-cli@0.1.0.0/profswitch.bend as Profswitch
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/act.bend as Act
import cswap-bend-cli@0.1.0.0/store/base.bend as SBase
import cswap-bend-cli@0.1.0.0/swlive.bend as L
import cswap-bend-cli@0.1.0.0/switch.bend as Sw
import cswap-bend-cli@0.1.0.0/profile.bend as P
import cswap-bend-cli@0.1.0.0/policy/types.bend as T

69def decided(+p: P.Prof, +ctx: SBase.Ctx, +opts: L.Opts, +cur: Json.Json, +d: T.Decision) -> Act.of(Json.Json):
70  match d:
71    case T.Switch{to, trig, why, h, mode, rec, bar}:
72      do ActM<Json.Json>:
73        r : Json.Json <- Sw.switch_to(ctx, Nat.show(to), False{}, opts)
74        return tag(p, r)
75    case T.NoSwitch{reason, detail}:
76      Act.pure(Json.Json, noop(p, T.reason.name(reason), nothing_msg(reason, detail), cur))

Uses (17)

Used by (1)