builder/inspect
Types
Represents a resolved type definition with its source module
pub type TypeDefinition {
TypeAlias(
source: glance.Definition(glance.TypeAlias),
module: module.Module,
)
CustomType(
source: glance.Definition(glance.CustomType),
module: module.Module,
)
}
Constructors
-
TypeAlias( source: glance.Definition(glance.TypeAlias), module: module.Module, ) -
CustomType( source: glance.Definition(glance.CustomType), module: module.Module, )
Values
pub fn filter_attributes(
definitions: List(glance.Definition(definition)),
attribute_name: String,
) -> List(#(glance.Attribute, definition))
Filter a list of definitions to only those with a specific attribute
Returns pairs of the matching attribute and its definition.
pub fn find_attribute(
definition: glance.Definition(definition),
attribute_name: String,
) -> Result(#(glance.Attribute, definition), Nil)
Find a specific attribute by name in a definition
Returns the attribute along with the definition it belongs to.
pub fn find_type_definition(
ctx: context.BuildContext,
type_: glance.Type,
module: module.Module,
) -> Result(TypeDefinition, Nil)
Searches for the type definition in the current module and follows imports to resolve qualified and unqualified type references.
pub fn is_prelude_type(
ctx: context.BuildContext,
type_: glance.Type,
current_module: module.Module,
) -> Bool
Check if a type is a Gleam prelude type (built-in type)
Returns True for types like Int, Float, Bool, String, Nil, BitArray, List, Result, tuples, and functions that don’t have custom definitions.