Typle.Inference
(Typle v0.3.1)
View Source
Orchestrates type inference for a module or file.
Parses the source file, expands macros in function bodies via
Typle.Inference.Expander (powered by ExPanda), then walks each
function definition through the expression inference engine.
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 expr_map() :: %{required({non_neg_integer(), non_neg_integer()}) => String.t()}
@type type_map() :: %{ required({non_neg_integer(), non_neg_integer()}) => Typle.Type.t() }
Functions
@spec infer_file( String.t(), keyword() ) :: {:ok, inference_result()} | {:error, term()}
Infers types for all expressions in the given source file.
Returns {:ok, %{types: type_map, exprs: expr_map}} where type_map maps
{line, col} to types and expr_map maps positions to source expression strings.
Options
:unstable- whentrue, uses the compiler-replay engine fromTyple.Unstablefor deeper inference (default:false)
@spec infer_module( module(), keyword() ) :: {:ok, inference_result()} | {: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.
Options
:unstable- whentrue, uses the compiler-replay engine fromTyple.Unstablefor deeper inference (default:false)