typer.mli 961 Bytes
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 19 20 21
module Fv : Set.S with type elt = string
module Env : Map.S with type key = string

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

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