glimpse/error

Types

pub type GlimpseError(a) {
  LoadError(a)
  ParseError(
    glance_error: glance.Error,
    module_name: String,
    module_content: String,
  )
  ImportError(GlimpseImportError)
  TypeCheckError(TypeCheckError)
}

Constructors

pub type GlimpseImportError {
  CircularDependencyError(module_name: String)
  MissingImportError(module_name: String)
  SrcImportingDevDependency(module_name: String)
}

Constructors

  • CircularDependencyError(module_name: String)
  • MissingImportError(module_name: String)
  • SrcImportingDevDependency(module_name: String)

    Raised when a source module imports a module that is only available as a development dependency.

pub type TypeCheckError {
  InvalidReturnType(
    function_name: String,
    got: String,
    expected: String,
  )
  InvalidName(name: String)
  InvalidType(got: String, expected: String, message: String)
  InvalidBinOp(
    operator: String,
    left_got: String,
    right_got: String,
    expected: String,
  )
  UnknownCustomType(name: String)
  RecursiveTypeAlias(name: String)
  NotCallable(got: String)
  InvalidArguments(expected: String, actual_arguments: String)
  InvalidArgumentLabel(expected: String, got: String)
  DuplicateCustomType(name: String)
  InvalidFieldAccess(container: String, label: String)
  UnexpectedType(got: String, expected: String)
  InvalidAnnotation(got: String, expected: String, name: String)
  CaseClauseMismatch(got: String, expected: String)
  PatternMismatch(pattern: String, expected: String, got: String)
  InvalidGuard(got: String)
  InvalidGuardExpression
  LowercaseBoolPattern(name: String)
  MissingParameterAnnotation(name: String)
  InvalidUse(subject_count: Int)
  InexhaustivePattern(description: String)
  InvalidBitStringSegment(mismatch: String)
  UnsafeRecordUpdate(name: String)
  DuplicateArgument(field: String)
  MissingField(message: String)
  DuplicateArgumentName(name: String)
  UnlabelledArgumentAfterLabelled
  PositionalArgumentAfterLabelled
  DuplicateConstructor(name: String)
  PrivateTypeLeak(name: String)
  TodoInConstant
  UnusedTypeParameter(name: String)
  UnnecessarySpread
  InvalidPatternArity(expected: Int, got: Int)
  DoubleVariableAssignment
  DuplicateDefinition(name: String)
  DuplicateTypeParameter(name: String)
  DuplicateLabel(label: String)
  TypeUsedAsConstructor(type_name: String)
  ExternalTypeWithConstructors(type_name: String)
  IncorrectPatternCount(patterns: Int, subjects: Int)
  DuplicatePatternVariable(name: String)
  MissingPatternVariable(name: String)
  ExtraPatternVariable(name: String)
  RecursiveType
  FloatOutOfRange(value: String)
  UnsupportedTarget(name: String)
  DuplicateImport(name: String)
}

Constructors

  • InvalidReturnType(
      function_name: String,
      got: String,
      expected: String,
    )
  • InvalidName(name: String)
  • InvalidType(got: String, expected: String, message: String)
  • InvalidBinOp(
      operator: String,
      left_got: String,
      right_got: String,
      expected: String,
    )
  • UnknownCustomType(name: String)
  • RecursiveTypeAlias(name: String)

    Raised when type aliases reference each other in a cycle

  • NotCallable(got: String)
  • InvalidArguments(expected: String, actual_arguments: String)
  • InvalidArgumentLabel(expected: String, got: String)
  • DuplicateCustomType(name: String)
  • InvalidFieldAccess(container: String, label: String)
  • UnexpectedType(got: String, expected: String)

    Raised when a type is used where a tuple/record/etc is required

  • InvalidAnnotation(got: String, expected: String, name: String)

    Raised when an annotation on a let or parameter does not match the inferred type

  • CaseClauseMismatch(got: String, expected: String)

    Raised when a case expression’s clauses don’t all agree on their type

  • PatternMismatch(pattern: String, expected: String, got: String)

    Raised when a pattern expects a type that doesn’t match the scrutinee

  • InvalidGuard(got: String)

    Raised when the guard of a case clause is not a Bool

  • InvalidGuardExpression

    Raised when a case clause guard uses syntax that is not part of the restricted guard grammar (e.g. function calls, pipelines, case).

  • LowercaseBoolPattern(name: String)

    Raised when a pattern names a variable true or false, which is almost certainly a mistake for the True/False constructors.

  • MissingParameterAnnotation(name: String)

    Raised when a function parameter is missing a type annotation

  • InvalidUse(subject_count: Int)

    Raised when use syntax is used with an unsupported number of subjects

  • InexhaustivePattern(description: String)

    Raised when a case (or let/use) pattern does not cover every possible shape of its subject type.

  • InvalidBitStringSegment(mismatch: String)

    Raised when a bit-array segment mixes options from different families (e.g. conflicting sizes, units, or signedness/endianness duplicates).

  • UnsafeRecordUpdate(name: String)

    Raised when a .. record update is unsafe because the spread value’s variant is open or its type parameters would change.

  • DuplicateArgument(field: String)

    Raised when a record update lists a field more than once.

  • MissingField(message: String)

    Raised when a field access is attempted on a label that is not present on every variant (or is at a different position across variants).

  • DuplicateArgumentName(name: String)

    Raised when an anonymous function declares two parameters with the same name, or a signature declares the same label twice.

  • UnlabelledArgumentAfterLabelled

    Raised when a signature places an unlabelled parameter after a labelled one.

  • PositionalArgumentAfterLabelled

    Raised when a function call passes a positional argument after a labelled one.

  • DuplicateConstructor(name: String)

    Raised when a custom type defines two constructors with the same name.

  • PrivateTypeLeak(name: String)

    Raised when a private type (or value) appears in a public interface.

  • TodoInConstant

    Raised when todo is used in a module constant value.

  • UnusedTypeParameter(name: String)

    Raised when a type alias declares a type parameter it never uses.

  • UnnecessarySpread

    Raised when a constructor pattern lists every field yet also uses ...

  • InvalidPatternArity(expected: Int, got: Int)

    Raised when a constructor pattern names the wrong number of fields, e.g. Some(x) matched against a two-field constructor.

  • DoubleVariableAssignment

    Raised when a bit-string pattern assigns a variable twice, e.g. <<a as b>>.

  • DuplicateDefinition(name: String)

    Raised when a module defines two functions, two constants, or a function and a constant with the same name.

  • DuplicateTypeParameter(name: String)

    Raised when a custom type or type alias declares the same type parameter name twice.

  • DuplicateLabel(label: String)

    Raised when a constructor declares two fields with the same label.

  • TypeUsedAsConstructor(type_name: String)

    Raised when a type that takes no parameters is written with an argument list, e.g. -> Int().

  • ExternalTypeWithConstructors(type_name: String)

    Raised when a custom type has an @external annotation yet declares constructors.

  • IncorrectPatternCount(patterns: Int, subjects: Int)

    Raised when a case clause lists a different number of patterns than the case has subjects.

  • DuplicatePatternVariable(name: String)

    Raised when a pattern binds the same variable twice, or when a variable is bound to different positions by the alternatives of a clause.

  • MissingPatternVariable(name: String)

    Raised when a variable bound by one or-alternative of a clause is not bound by the other alternatives.

  • ExtraPatternVariable(name: String)

    Raised when a variable is bound by an or-alternative of a clause but not by the alternative that came before it.

  • RecursiveType

    Raised when a value’s type is defined in terms of itself.

  • FloatOutOfRange(value: String)

    Raised when a float literal is too large to be represented.

  • UnsupportedTarget(name: String)

    Raised when a value is only implemented for another build target.

  • DuplicateImport(name: String)

    Raised when two imports resolve to the same local module name.

pub type TypeCheckFold(a) =
  list.ContinueOrStop(Result(a, TypeCheckError))
pub type TypeCheckResult(a) =
  Result(a, TypeCheckError)
Search Document