Typle.Inference (Typle v0.1.0)

View Source

Orchestrates type inference for a module or file.

Parses the source file, walks each function definition through the expression inference engine, and collects a map of {line, col} => Typle.Type.t() for every expression in the module.

Summary

Functions

Infers types for all expressions in the given source file.

Infers types for all expressions in a compiled module.

Types

type_map()

@type type_map() :: %{
  required({non_neg_integer(), non_neg_integer()}) => Typle.Type.t()
}

Functions

infer_file(file_path)

@spec infer_file(String.t()) :: {:ok, type_map()} | {:error, term()}

Infers types for all expressions in the given source file.

Returns a map of {line, col} => type for each expression node that has position metadata.

infer_module(module)

@spec infer_module(module()) :: {:ok, type_map()} | {:error, term()}

Infers types for all expressions in a compiled module.

Locates the source file from the module's compile info and delegates to infer_file/1.