gleamunison/types

Types

pub type ComputedType {
  CTTerm(typ: ast.Type)
  CTType
  CTAbility(operations: List(OperationType))
}

Constructors

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

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

pub type OperationType {
  OperationType(
    name: option.Option(String),
    inputs: List(ast.Type),
    output: ast.Type,
  )
}

Constructors

pub type TypeCache {
  TypeCache(
    entries: dict.Dict(identity.DefinitionRef, ComputedType),
  )
}

Constructors

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)
Search Document