Module Middleend.Infer

Copyright 2026, Mikhail Gavrilenko, Danila Rudnev-Stepanyan, Daniel Vlasenko

SPDX-License-Identifier: LGPL-3.0-or-later

type error
val pprint_err : Stdlib.Format.formatter -> error -> unit
val reset_gensym : unit -> unit

resets counter for type variables

infer_exp env exp infers type of the expression exp in the environment env and returns updated environment and type of exp

infer_pat env pat infers type of the pattern pat in the environment env and returns updated environment and type of pat

infer_structure_item env item infers type of the item item in the environment env and returns updated environment and new names

infer_program env prog infers all types in program prog with initial environment env and returns updated environment and names of all new global identificators

for basic environment, use env_with_things

val env_with_things : (Common.Ast.ident * Common.Ast.TypeExpr.t) list

env_with_things is the basic environment that contains built-in functions and constructors