typer.mli 1.33 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
type env = Types.descr Env.t
14

15
val register_global_types : (string * Ast.ppat) list -> unit
16
val dump_global_types: Format.formatter -> unit
17

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

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


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