-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvar.mli
81 lines (60 loc) · 2 KB
/
var.mli
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
(** Abstract variables, free and bound. *)
module type CONFIG = sig
val fbase: string
val bbase: string
end
module type S = sig
(** type of free variables *)
type free
(** type of bound variables *)
type bound
(** equality test *)
val equal: free -> free -> bool
(** comparison *)
val compare: free -> free -> int
(** creation of a free variable from a base name *)
val make: string -> free
(** for pretty printing purposes only, gets the base name *)
val to_string: free -> string
(** creation of free variables from a base name, from a free variable,
or from nothing *)
val sfresh: string -> free
val ffresh: free -> free
val bfresh: bound -> free
val fresh: unit -> free
(** unsafe functions *)
val bzero: free -> bound
val bone: free -> bound
val bzerob: bound -> bound
val boneb: bound -> bound
val bzero_default: bound
val bone_default: bound
val bsucc: bound -> bound
val bequal: bound -> bound -> bool
val bequal_bzero: bound -> bool
(** comparison *)
val bcompare: bound -> bound -> int
(** [bmax] computes the maximem of two bound variables.
The string representation of the result is the one of
the first argument. *)
val bmax: bound -> bound -> bound
val bto_string: bound -> string
module BSet: Set.S with type elt = bound
module BMap: Map.S with type key = bound
module Set : Set.S with type elt = free
module Map : Map.S with type key = free
(** Helper module that helps finding the "best" free name for a
given bound name. This is useful for pretty printing. *)
module Best : sig
(** The type of datastructure that remember the best names. *)
type t
(** The structure in which nothing is recorded. *)
val empty: t
(** Get the best name. *)
val get: t -> bound -> free
(** Get the best name and registers it. Typically, you should call
that function when traversing a binder. *)
val remember_get: t -> bound -> t * free
end
end
module Make (Default: CONFIG) : S