typer.mli 1.9 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

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

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

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

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

50

51 52
(* Operators *)

53
type type_fun = Types.t -> bool -> Types.t
54

55
val register_op: string -> int -> (type_fun list -> type_fun) -> unit
56
val flatten: type_fun -> type_fun
57

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

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


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