typer.mli 1.95 KB
Newer Older
1 2
open Ident

3 4
type t

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

15
val empty_env: t
16

17
val register_types : string -> t -> unit
18
  (* Register types of the environment for the pretty-printer *)
19

20

21 22
val find_value: id -> t -> Types.t
val enter_type: id -> Types.t -> t -> t
23
val iter_values: t -> (id -> Types.t -> unit) -> unit
24

25 26
val typ: t -> Ast.ppat -> Types.Node.t
val pat: t -> Ast.ppat -> Patterns.node
27

28 29 30 31
val dump_types: Format.formatter -> t -> unit
val dump_ns: Format.formatter -> t -> unit
val set_ns_table_for_printer: t -> unit

32

33 34 35
val type_using: t -> Location.loc -> U.t -> U.t -> t
val type_schema: t -> Location.loc -> U.t -> string -> t
val type_ns : t -> Location.loc -> U.t -> Ast.ns_expr -> t
36
val type_open: t -> Location.loc -> U.t list -> t
37

38 39
val type_keep_ns : t -> bool -> t

40 41 42
val type_expr: t -> Ast.pexpr -> Typed.texpr * Types.descr

val type_defs: t -> (Location.loc * U.t * Ast.ppat) list -> t
43 44 45 46 47 48

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
49
  (* Assume that all the expressions are Abstractions *)
50

51

52

53 54
(* Operators *)

55
type type_fun = Types.t -> bool -> Types.t
56

57
val register_op: string -> int -> (type_fun list -> type_fun) -> unit
58
val flatten: type_fun -> type_fun
59

60
(* Forward definitions *)
61 62 63 64 65
val from_comp_unit: (Compunit.t -> t) ref
  (* From Librarian *)
val load_comp_unit: (U.t -> Compunit.t) ref
  (* From Librarian *)

66 67
val has_ocaml_unit: (U.t -> bool) ref
val has_static_external: (string -> bool) ref
68 69


70
val load_schema: 
71
  (string -> string -> Ns.Uri.t * (Types.t * Schema_validator.t) Ident.Env.t) ref