gleamunison/types
Types
pub type ComputedType {
CTTerm(typ: ast.Type)
CTType
CTAbility(operations: List(OperationType))
}
Constructors
-
CTTerm(typ: ast.Type) -
CTType -
CTAbility(operations: List(OperationType))
pub type HandlerError {
MissingOperation(
ability: identity.DefinitionRef,
op_name: String,
op_index: Int,
)
ExtraOperation(ability: identity.DefinitionRef, op_index: Int)
ArityMismatch(
ability: identity.DefinitionRef,
op_name: String,
op_index: Int,
expected: Int,
got: Int,
)
}
Constructors
-
MissingOperation( ability: identity.DefinitionRef, op_name: String, op_index: Int, ) -
ExtraOperation(ability: identity.DefinitionRef, op_index: Int) -
ArityMismatch( ability: identity.DefinitionRef, op_name: String, op_index: Int, expected: Int, got: Int, )
pub type InferenceError {
UnboundVariable(Int)
TypeMismatch(
expected: ast.Type,
actual: ast.Type,
message: String,
)
InfiniteType(variable: Int, typ: ast.Type)
UnhandledAbility(ast.AbilityRef)
ImpureContext(ast.Requirement)
LinearityViolation(term: String, expected: String)
}
Constructors
-
UnboundVariable(Int) -
-
InfiniteType(variable: Int, typ: ast.Type) -
UnhandledAbility(ast.AbilityRef) -
ImpureContext(ast.Requirement) -
LinearityViolation(term: String, expected: String)
pub type OperationType {
OperationType(
name: option.Option(String),
inputs: List(ast.Type),
output: ast.Type,
)
}
Constructors
-
OperationType( name: option.Option(String), inputs: List(ast.Type), output: ast.Type, )
pub type TypeCache {
TypeCache(
entries: dict.Dict(identity.DefinitionRef, ComputedType),
)
}
Constructors
-
TypeCache( entries: dict.Dict(identity.DefinitionRef, ComputedType), )
Values
pub fn empty_cache() -> TypeCache
pub fn validate_handler(
cache: TypeCache,
ability_ref: identity.DefinitionRef,
handler_ops: dict.Dict(Int, #(String, Int)),
) -> Result(Nil, HandlerError)