typer.mli 2.06 KB
Newer Older
1
2
open Ident

3
4
5
6
type t
val serialize: t Serialize.Put.f
val deserialize: t Serialize.Get.f

7
exception NonExhaustive of Types.descr
8
exception Constraint of Types.descr * Types.descr
9
exception ShouldHave of Types.descr * string
10
exception WrongLabel of Types.descr * label
11
exception UnboundId of id * bool
12
exception UnboundExtId of Types.CompUnit.t * id
13
exception ShouldHave2 of Types.descr * string * Types.descr
14
exception Error of string
15
16
exception Warning of string * Types.t

17
val empty_env: t
18

19
val register_types : Types.CompUnit.t -> t -> unit
20
  (* Register types of the environment for the pretty-printer *)
21

22
val enter_cu : U.t -> Types.CompUnit.t -> t -> t 
23
val find_cu  : U.t -> t -> Types.CompUnit.t
24

25
26
val find_value: id -> t -> Types.t
val enter_type: id -> Types.t -> t -> t
27
val iter_values: t -> (id -> Types.t -> unit) -> unit
28

29
30
val typ: t -> Ast.ppat -> Types.Node.t
val pat: t -> Ast.ppat -> Patterns.node
31

32
33
34
35
val dump_types: Format.formatter -> t -> unit
val dump_ns: Format.formatter -> t -> unit
val set_ns_table_for_printer: t -> unit

36
37
38
39
40

val type_schema: t -> U.t -> string -> t

val type_ns : t -> U.t -> Ns.t -> t

41
42
val type_keep_ns : t -> bool -> t

43
44
45
val type_expr: t -> Ast.pexpr -> Typed.texpr * Types.descr

val type_defs: t -> (Location.loc * U.t * Ast.ppat) list -> t
46
47
48
49
50
51

val type_let_decl: t -> Ast.ppat -> Ast.pexpr -> 
  t * Typed.let_decl * (id * Types.t) list

val type_let_funs: t -> Ast.pexpr list -> 
  t * Typed.texpr list * (id * Types.t) list
52
  (* Assume that all the expressions are Abstractions *)
53

54

55
val get_schema_validator: string -> Ns.qname -> Value.t -> Value.t
56
val get_schema_names: t -> U.t list  (** registered schema names *)
57

58
59
(* Operators *)

60
type type_fun = Types.t -> bool -> Types.t
61

62
val register_op: string -> int -> (type_fun list -> type_fun) -> unit
63
val flatten: type_fun -> type_fun
64

65
(* Forward definitions *)
66
67
68
69
70
71
val from_comp_unit: (Types.CompUnit.t -> t) ref
val has_comp_unit: (U.t -> bool) ref
val has_ocaml_unit: (U.t -> bool) ref
val has_static_external: (string -> bool) ref
val load_schema: 
  (U.t -> string -> (Types.t * (Value.t -> Value.t)) Ident.Env.t) ref