Module Chatml_typechecker

type poly_row_bound =
  1. | Exact
  2. | AtLeast
  3. | AtMost
type record_bound =
  1. | RB_open
  2. | RB_closed
type row =
  1. | REmpty
  2. | RExtend of string * ttype * row
  3. | RVar of int
and poly_row = {
  1. bound : poly_row_bound;
  2. tags : (string * ttype list) list;
  3. leftover : int option;
}
and ttype =
  1. | TInt
  2. | TBool
  3. | TFloat
  4. | TString
  5. | TUnit
  6. | TVar of int
  7. | TFun of ttype list * ttype
  8. | TArray of ttype
  9. | TPolyVariant of poly_row
  10. | TRecord of row * record_bound
  11. | TModule of (string * scheme) list
  12. | TDynamic
and scheme =
  1. | Scheme of int list * ttype
module TypeUF : sig ... end
module RowUF : sig ... end
module PolyVarUF : sig ... end
val next_tvar_id : int Core.ref
val fresh_tvar : unit -> ttype
val next_rvar_id : int Core.ref
val fresh_rvar : unit -> int
val next_pvvar_id : int Core.ref
val fresh_pvvar : unit -> int
exception Type_error of string
val expand : ttype -> ttype
val expand_row : row -> row
val expand_poly_row_with : Core.Int.Hash_set.t -> poly_row -> poly_row
val expand_poly_row : poly_row -> poly_row
val unify_poly_bounds : poly_row_bound -> poly_row_bound -> poly_row_bound
val unify_poly_tags : poly_row_bound -> poly_row_bound -> (Core.String.Map.Key.t * ttype list) list -> (Core.String.Map.Key.t * ttype list) list -> (Core.String.Set.Elt.t * ttype list) list
val unify : ttype -> ttype -> unit
val unify_poly_variant_rows : poly_row -> poly_row -> unit
val unify_rows : row -> record_bound -> row -> record_bound -> row * record_bound

unify_rows: Given (rowA, boundA) and (rowB, boundB), produce a unified row shape that is consistent with both.

val row_of_map : ttype Core.String.Map.t -> Base.Int.t option -> row
val show_type : ttype -> string
val show_row : row -> string
val show_poly_variant : poly_row -> string
val free_tvars : ttype -> Core.Int.Set.t
val free_row_tvars : row -> Core.Int.Set.t
val free_tvars_env : (string, scheme) Core.Hashtbl.t -> Core.Int.Set.t
val generalize : (string, scheme) Core.Hashtbl.t -> ttype -> scheme
val instantiate : scheme -> ttype
val lookup_env : (string, scheme) Core.Hashtbl.t -> string -> ttype
val add_to_env : (string, scheme) Core.Hashtbl.t -> string -> ttype -> unit
val close_row : row -> row
val infer_expr : (string, scheme) Core.Hashtbl.t -> Chatml.Chatml_lang.expr -> ttype
val infer_pattern : (string, scheme) Core.Hashtbl.t -> Chatml.Chatml_lang.pattern -> ttype
val infer_stmt : (string, scheme) Core.Hashtbl.t -> Chatml.Chatml_lang.stmt -> unit
val add_builtins : (string, scheme) Core.Hashtbl.t -> unit
val infer_program : Chatml.Chatml_lang.program -> unit