typer.mli 1.22 KB
Newer Older
1
2
exception Pattern of string
exception NonExhaustive of Types.descr
3
exception MultipleLabel of Types.label
4
exception Constraint of Types.descr * Types.descr * string
5
exception ShouldHave of Types.descr * string
6
exception WrongLabel of Types.descr * Types.label
7
exception UnboundId of string
8
9
10

val compile_regexp : Ast.regexp -> Ast.ppat -> Ast.ppat

11
12
13
val register_global_types : (string * Ast.ppat) list -> unit
  (* the global environment is untouched if the function fails *)

14
15
16
val typ : Ast.ppat -> Typed.ttyp
val pat : Ast.ppat -> Typed.tpat

17
18
module Fv : Set.S with type elt = string
module Env : Map.S with type key = string
19
type env = Types.descr Env.t
20
21

val expr: Ast.pexpr -> Fv.t * Typed.texpr
22
23
val let_decl : Ast.ppat -> Ast.pexpr -> Typed.let_decl

24

25
26
27
28
29
30
val type_check: 
  Types.descr Env.t -> Typed.texpr -> Types.descr -> bool -> Types.descr
  (* [compute_type env e t precise] checks that expression [e] 
     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 -> (string * Types.descr) list
32
     
33
34
val type_rec_funs: env -> Typed.let_decl list -> (string * Types.descr) list
  (* Assume that all the expressions are Absstractions *)