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
37
38
39
40
41
type (_, _) eq = Equal: ('a, 'a) eq
module Id = struct
type _ id = ..
module type ID = sig
type t
type _ id += Id : t id
end
type !'a t = (module ID with type t = 'a)
let make (type a) () : a t =
(module struct type t = a type _ id += Id : t id end)
let[@inline] uid (type a) ((module A) : a t) =
Obj.Extension_constructor.id (Obj.Extension_constructor.of_val A.Id)
let provably_equal
(type a b) ((module A) : a t) ((module B) : b t) : (a, b) eq option
=
match A.Id with B.Id -> Some Equal | _ -> None
end