typer.mli 892 Bytes
Newer Older
1
2
3
exception Pattern of string
exception NonExhaustive of Types.descr
exception Constraint of Types.descr * Types.descr * string
4
exception ShouldHave of Types.descr * string
5
exception WrongLabel of Types.descr * Types.label
6
7
8

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

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

12
13
14
val typ : Ast.ppat -> Typed.ttyp
val pat : Ast.ppat -> Typed.tpat

15
16
17
18
19
module Fv : Set.S with type elt = string
module Env : Map.S with type key = string

val expr: Ast.pexpr -> Fv.t * Typed.texpr

20
21
22
23
24
25
26
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].
  *)