AB.Infer (AB v0.2.1)

View Source

Type inference utilities for analyzing runtime values and inferring appropriate typespecs.

This module provides functions to infer typespec ASTs from actual runtime values, which is useful for typespec correction suggestions and type validation.

Summary

Functions

Infers a human-readable type name from a result value.

Infers a typespec AST from an actual runtime value.

Functions

infer_result_type(result)

@spec infer_result_type(any()) :: String.t()

Infers a human-readable type name from a result value.

infer_type_ast_from_value(value)

@spec infer_type_ast_from_value(any()) :: any()

Infers a typespec AST from an actual runtime value.

This is the inverse of the generator - given a value, it returns the most specific type AST that describes that value.