print_type.mli 1.41 KB
Newer Older
charguer's avatar
charguer committed
1 2 3 4 5 6 7 8

(** Simple grammar of types *)

type btyp =
    Btyp_alias of btyp * string
  | Btyp_arrow of btyp * btyp
  | Btyp_constr of Path.t * btyp list
  | Btyp_tuple of btyp list
charguer's avatar
charguer committed
9 10
  | Btyp_var of string * Types.type_expr 
      (* - string: name of variable
charguer's avatar
cp  
charguer committed
11
         - type_expr: for internal use to track which variables are used *)
charguer's avatar
charguer committed
12 13 14
  | Btyp_poly of string list * btyp
  | Btyp_val

charguer's avatar
cp  
charguer committed
15 16 17 18 19 20 21 22
(** Mark a variable as used at least once. *)

val typvar_mark_used : Types.type_expr -> unit

(** Test if a variable has been used at least once. *)

val typvar_is_used : Types.type_expr -> bool

charguer's avatar
charguer committed
23 24 25 26 27 28 29 30 31 32
(** Translates a type expression [t] into a [btyp]. *)

val btyp_of_typ_exp : Types.type_expr -> btyp

(** Translates of a type scheme [t] into a [btyp], *)

val btyp_of_typ_sch_simple : Types.type_expr -> btyp

(** Return the name of a type variable *) 

charguer's avatar
charguer committed
33
val name_of_type_var : Types.type_expr -> string
charguer's avatar
charguer committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

(** Function to reset the fresh name generator for type variables *)

val reset_names : unit -> unit

(** Pretty printer for a type *)

val print_out_type : btyp -> string

(** Convert a type into a string *)

val string_of_type_exp : Types.type_expr -> string

(** Convert a type scheme into a string *)

val string_of_type_sch : Types.type_expr list -> Types.type_expr -> string
charguer's avatar
charguer committed
50

charguer's avatar
charguer committed
51 52 53 54

(** Customization of the type renaming function;
    The identity function by default. 
    (Reference set by Characteristic.cfg_file.) *)
charguer's avatar
charguer committed
55 56

val type_rename : (string -> string) ref