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,
    term: option.Option(ast.Term),
  )
  InfiniteType(variable: Int, typ: ast.Type)
  UnhandledAbility(ast.AbilityRef)
  ImpureContext(ast.Requirement)
  LinearityViolation(term: String, expected: String)
}

Constructors

  • UnboundVariable(Int)
  • TypeMismatch(
      expected: ast.Type,
      actual: ast.Type,
      message: String,
      term: option.Option(ast.Term),
    )

    Arguments

    term

    The elaborated subterm that failed, when the failing site had one in scope. When that term is a ast.Located, its span is the source location of the error — elab_def lifts it into an At wrapper.

  • 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

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