aboutsummaryrefslogtreecommitdiff
path: root/catalog.mli
blob: e87137835e25ab0c0d5d20534ed2c57b868a900a (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
37
38
module type DATA_SIG = sig

  type 'a typ
  
  type 'a returnType
  
  val compare_typ: 'a typ -> 'b typ -> ('a, 'b) Tools.cmp

  val repr: Format.formatter -> 'a typ -> unit
  
end

module Make(D:DATA_SIG): sig

  type t

  type 'a t_function =
    | Fn1: 'b D.returnType * ('a -> 'b) -> 'a t_function
    | Fn2: 'c D.returnType * ('a -> 'b -> 'c) -> ('a * 'b) t_function
    | Fn3: 'd D.returnType * ('a -> 'b -> 'c -> 'd) -> ('a * 'b * 'c) t_function

  type 'a sig_typ =
    | T1: 'a D.typ -> 'a t_function sig_typ
    | T2: 'a D.typ * 'b D.typ -> ('a * 'b) t_function sig_typ
    | T3: 'a D.typ * 'b D.typ * 'c D.typ -> ('a * 'b * 'c) t_function sig_typ

  (** Empty catalog *)
  val empty: t

  (** Register a new function in the catalog *)
  val register : t -> string -> 'a t_function sig_typ -> 'a t_function -> t

  (** Find a function with the given name and signature *)
  val find_function: t -> string -> 'a t_function sig_typ -> 'a t_function

  val repr: Format.formatter -> t -> unit

end