Typle.Inference.Pattern (Typle v0.1.0)

View Source

Extracts variable type bindings from pattern matches.

Given a pattern AST and the type of the expression being matched, produces a map of %{var_name => inferred_type}.

Summary

Functions

Infers variable types from a pattern, given the type of the matched expression.

Types

bindings()

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

Functions

infer(pattern, matched_type)

@spec infer(Macro.t(), Typle.Type.t()) :: bindings()

Infers variable types from a pattern, given the type of the matched expression.

Returns a map of variable names to their inferred types.