Source file indexTable.ml
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
42
43
44
45
46
47
open Fix.Indexing
module type S =
sig
type 'n index
type ('n, !'a) t
val create: int -> ('n, 'a) t
val clear : ('n, 'a) t -> unit
val reset : ('n, 'a) t -> unit
val copy: ('n, 'a) t -> ('n, 'a) t
val add: ('n, 'a) t -> 'n index -> 'a -> unit
val remove: ('n, 'a) t -> 'n index -> unit
val find: ('n, 'a) t -> 'n index -> 'a
val find_opt: ('n, 'a) t -> 'n index -> 'a option
val find_all: ('n, 'a) t -> 'n index -> 'a list
val replace : ('n, 'a) t -> 'n index -> 'a -> unit
val mem : ('n, 'a) t -> 'n index -> bool
val iter: ('n index -> 'a -> unit) -> ('n, 'a) t -> unit
val filter_map_inplace: ('n index -> 'a -> 'a option) -> ('n, 'a) t -> unit
val fold: ('n index -> 'a -> 'b -> 'b) -> ('n, 'a) t -> 'b -> 'b
val length: ('n, 'a) t -> int
val stats: ('n, 'a) t -> Hashtbl.statistics
val to_seq : ('n, 'a) t -> ('n index * 'a) Seq.t
val to_seq_keys : _ t -> 'n index Seq.t
val to_seq_values : ('n, 'a) t -> 'a Seq.t
val add_seq : ('n, 'a) t -> ('n index * 'a) Seq.t -> unit
val replace_seq : ('n, 'a) t -> ('n index * 'a) Seq.t -> unit
val of_seq : ('n index * 'a) Seq.t -> ('n, 'a) t
end
module F(X : Index.Unsafe.T) = struct
module type S = S with type 'a index = 'a X.t
end
module RawIntTable = Hashtbl.Make(struct
type t = int
let hash x = x
let equal = Int.equal
end)
module IntTable : S with type 'n index = int = struct
type 'n index = int
include RawIntTable
type nonrec ('n, 'a) t = 'a RawIntTable.t
end
include Index.Unsafe.Coerce(F)(IntTable)