typer.mli 1004 Bytes
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 = Ident.id
10
type env = Types.descr Env.t
11

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

18

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