summaryrefslogtreecommitdiff
path: root/ocaml/lib/domain/d02p01.mli
blob: 55665fe01a5eb4954f29aca6ad099aaa7b302fee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module ID : sig
  (** [t] is a ID within a range *)
  type t

  val create : int -> t
  (** [create num] is an ID [t] *)

  val validate : (t -> bool) list -> t -> bool
  (** [validate rules id] is [true] if the [id] passes all rule checks *)

  val incr : t -> t
  (** [incr id] is the next [id] in the sequence *)

  val to_int : t -> int
  (** [to_int id] is an integer representation of [id] *)

  val to_string : t -> string
  (** [to_string id] is an string representation of [id] *)

  val pp : t -> string
  (** [pp id] is a pretty string representing [id] *)
end

module Range : sig
  (** [t] is a range of values *)
  type t

  val create : int * int -> t
  (** [create (s, e)] is a range starting at [s] and ending at [e]. *)

  val collect : t -> ID.t list
  (** [collect r] is a list containing all elements within the range (inclusive). *)

  val pp : t -> string
  (** [pp r] is a pretty string representing [r] *)
end