context demo.agt

type Id = opaque Int where NonNegative

agent Toggle {
  key id: Id

  store active: Cell[Bool]

  on call flip(force: Bool) -> Effect[Bool] {
    if force {
      let cur = active
      active := !cur
      Effect.pure(true)
    } else {
      Effect.pure(false)
    }
  }
}
