Something went wrong. Try again.
A local Git merge queue with content-bound gate verdicts
Something went wrong. Try again.
1.8 kB · 64 lines
OCaml
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465type error = | Unexpected of { machine : string; state : string; event : string } | Not_implemented of { machine : string; what : string }
let pp_error ppf = function | Unexpected { machine; state; event } -> Fmt.pf ppf "the %s machine cannot take %s in state %s" machine event state | Not_implemented { machine; what } -> Fmt.pf ppf "not implemented yet: %s (the %s machine)" what machine
let unexpected machine ~state ~event = Error (Unexpected { machine; state; event })
let not_implemented machine what = Error (Not_implemented { machine; what })
module Task = struct type id = string list
let v name = [ name ] let within prefix id = prefix :: id let equal = List.equal String.equal let compare = List.compare String.compare let pp ppf id = Fmt.(list ~sep:(any "/") string) ppf id
type t = Now | Record | Start of id | Cancel of id | Stop of id * string
exception Stopped of string
let under prefix = function | Now -> Now | Record -> Record | Start id -> Start (within prefix id) | Cancel id -> Cancel (within prefix id) | Stop (id, why) -> Stop (within prefix id, why)end
type unanswered = Cancelled | Failed of string
let pp_unanswered ppf = function | Cancelled -> Fmt.string ppf "cancelled" | Failed why -> Fmt.string ppf why
module type S = sig type t type event type action type ending
val incoming : t -> now:Ptime.t -> event -> (t * action list, error) result val timer : t -> now:Ptime.t -> (t * action list, error) result val next_timeout : t -> Ptime.t option val ending : t -> ending option val task : action -> Task.t val unanswered : action -> unanswered -> event val pp : t Fmt.t val pp_event : event Fmt.t val pp_action : action Fmt.tend
module type TOP = sig include S
val signal : Signal.t -> eventend