10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 21:03:56 +01:00
quantum_package/ocaml/Id.ml

30 lines
353 B
OCaml
Raw Normal View History

2016-10-13 12:32:22 +02:00
module Id = struct
2015-12-03 23:51:10 +01:00
type t = int
2016-10-13 12:32:22 +02:00
2015-12-03 23:51:10 +01:00
let of_int x =
assert (x>0); x
2016-10-13 12:32:22 +02:00
2015-12-03 23:51:10 +01:00
let to_int x = x
2016-10-13 12:32:22 +02:00
2015-12-03 23:51:10 +01:00
let of_string x =
2016-10-13 12:32:22 +02:00
int_of_string x
2015-12-03 23:51:10 +01:00
|> of_int
2016-10-13 12:32:22 +02:00
2015-12-03 23:51:10 +01:00
let to_string x =
2016-10-13 12:32:22 +02:00
string_of_int x
2015-12-03 23:51:10 +01:00
let increment x = x + 1
let decrement x = x - 1
2016-10-13 12:32:22 +02:00
let compare = compare
2015-12-03 23:51:10 +01:00
end
module Task = struct
include Id
end
module Client = struct
include Id
end