typer.mli 1.73 KB
Newer Older
1 2
open Ident

3
exception NonExhaustive of Types.descr
4
exception Constraint of Types.descr * Types.descr
5
exception ShouldHave of Types.descr * string
6
exception WrongLabel of Types.descr * label
7
exception UnboundId of id
8
exception ShouldHave2 of Types.descr * string * Types.descr
9 10 11
exception Error of string
val warning: Location.loc -> string -> unit
val error: Location.loc -> string -> 'a
12

13
val register_global_types : (U.t * Ast.ppat) list -> unit
14
val dump_global_types: Format.formatter -> unit
15

16 17
val register_ns_prefix : U.t -> Atoms.Ns.t -> unit

18 19 20 21
val typ : Ast.ppat -> Typed.ttyp
val pat : Ast.ppat -> Typed.tpat
val expr: Ast.pexpr -> fv * Typed.texpr
val let_decl : Ast.ppat -> Ast.pexpr -> Typed.let_decl
22

23 24
type env = Types.descr Env.t

25
val type_check: 
26
  env -> Typed.texpr -> Types.descr -> bool -> Types.descr
27
  (* [type_check env e t precise] checks that expression [e] 
28 29 30
     has type [t] under typing environment [env]; if [precise=true], 
     also returns a possible more precise type for [e].
  *)
31
val type_let_decl: env -> Typed.let_decl -> (id * Types.descr) list
32
     
33
val type_rec_funs: env -> Typed.texpr list -> (id * Types.descr) list
34
  (* Assume that all the expressions are Abstractions *)
35 36 37

val report_unused_branches : unit -> unit
  (* Issue warnings for unused branches *)
38 39 40

val flatten: Location.loc -> 
  (Types.descr -> bool -> Types.descr) -> (Types.descr -> bool -> Types.descr)
41

42 43 44 45 46 47 48
  (** {2 Schema stuff} *)

  (** register a schema *)
val register_schema: string -> Schema_types.schema -> unit

  (** @return the validator for a Schema global element *)
val get_schema_validator: string * string -> Schema_validator.validator
49

50
  (** DEBUG ONLY *)
51

52 53
  (* return the type of a global schema element *)
val get_schema_type: string * string -> Types.descr