Sarek_ppx_lib.Sarek_monotype mono_instance = {mi_name : string;Original function name
*)mi_mangled : string;Mangled name for this instance
*)mi_types : Sarek_types.typ list;Concrete types for type parameters
*)mi_params : Sarek_typed_ast.tparam list;Specialized parameters
*)mi_body : Sarek_typed_ast.texpr;Specialized body
*)}A monomorphic instance of a polymorphic function
type mono_env = {instances : (string * Sarek_types.typ list, string) Stdlib.Hashtbl.t;specialized : mono_instance list Stdlib.ref;counter : int Stdlib.ref;}Collection of all instances found during monomorphization
val has_type_vars : Sarek_types.typ -> boolCheck if a type contains any unresolved type variables
val normalize_type : Sarek_types.typ -> Sarek_types.typNormalize a type by following all links
val types_equal : Sarek_types.typ -> Sarek_types.typ -> boolCompare two types for equality (after normalization)
val mangle_type : Sarek_types.typ -> stringCreate a mangled name for a type
val mangle_name : string -> Sarek_types.typ list -> stringCreate a mangled name for a function with specific type arguments
val create_mono_env : unit -> mono_envCreate a fresh monomorphization environment
val get_or_create_instance :
mono_env ->
string ->
Sarek_types.typ list ->
stringGet or create a specialized instance name
type type_subst = (int * Sarek_types.typ) listSubstitution from type variable IDs to concrete types
val apply_subst : type_subst -> Sarek_types.typ -> Sarek_types.typApply type substitution to a type
val apply_subst_expr :
type_subst ->
Sarek_typed_ast.texpr ->
Sarek_typed_ast.texprApply type substitution to a typed expression
val apply_subst_pat :
type_subst ->
Sarek_typed_ast.tpattern ->
Sarek_typed_ast.tpatternval collect_poly_functions :
Sarek_typed_ast.tkernel ->
(string * bool * Sarek_typed_ast.tparam list * Sarek_typed_ast.texpr) listCollect all polymorphic function definitions and their call sites
val collect_call_sites :
string list ->
Sarek_typed_ast.texpr ->
(string * Sarek_types.typ list) listCollect call sites with their concrete types
val rewrite_calls :
mono_env ->
string list ->
Sarek_typed_ast.texpr ->
Sarek_typed_ast.texprRewrite calls to polymorphic functions with mangled names
val monomorphize : Sarek_typed_ast.tkernel -> Sarek_typed_ast.tkernelMain monomorphization entry point