Typle.Inference.Guard (Typle v0.1.0)

View Source

Refines variable types based on guard expressions.

Analyzes guard AST to narrow the types of variables that appear in type-checking guards like is_integer/1, is_binary/1, etc.

Summary

Functions

Analyzes a guard expression and returns type refinements for variables.

Types

refinements()

@type refinements() :: %{required(atom()) => Typle.Type.t()}

Functions

refine(guard_ast)

@spec refine(Macro.t()) :: refinements()

Analyzes a guard expression and returns type refinements for variables.

Returns a map of %{var_name => refined_type}.