typer.mli 1.11 KB
Newer Older
1 2
open Ident

3 4
exception NonExhaustive of Types.descr
exception Constraint of Types.descr * Types.descr * string
5
exception ShouldHave of Types.descr * string
6
exception WrongLabel of Types.descr * label
7
exception UnboundId of string
8

9
module Env : Map.S with type key = id
10
type env = Types.descr Env.t
11

12
val register_global_types : (string * Ast.ppat) list -> unit
13
val dump_global_types: Format.formatter -> unit
14 15 16 17
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
18

19

20
val type_check: 
21
  env -> Typed.texpr -> Types.descr -> bool -> Types.descr
22 23 24 25
  (* [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].
  *)
26
val type_let_decl: env -> Typed.let_decl -> (id * Types.descr) list
27
     
28
val type_rec_funs: env -> Typed.let_decl list -> (id * Types.descr) list
29
  (* Assume that all the expressions are Absstractions *)
30 31 32

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