curry.typecheck.errors module

The errors of the engine: the catalogue of section 7 of the design of the typed boundary.

Every error is a CurryTypeError. The first line of a message names the class of the error; the lines after it name the symbol with its scheme, the argument path, and the types. An error carries the same facts as attributes, so a caller can build another message from them. The error of a goal the defaulting table cannot handle is DefaultingError; the engine raises it with the words of the oracle.

exception curry.typecheck.errors.AmbiguousTypeError(what, scheme, detail=None, **kwds)[source]

Bases: TypeCheckError

A class constraint that nothing fixes and the table cannot default: ambiguous type in S :: scheme, with the sentence of the oracle.

exception curry.typecheck.errors.ArityError(scheme, ntaken, ngiven, **kwds)[source]

Bases: TypeCheckError

S :: scheme takes N arguments, M given.

exception curry.typecheck.errors.ContextInExprTypeError(text, **kwds)[source]

Bases: ExprTypeError

exprtype takes a type without a context; the context is inferred.

exception curry.typecheck.errors.ConversionError(lines, where=None, symbol=None, expected=None, actual=None, value=None)[source]

Bases: TypeCheckError

A Python value under a type it cannot take: cannot convert 2.5 to Int at argument N of S. None is such a value under every type.

exception curry.typecheck.errors.ExprTypeError(lines, text=None, **kwds)[source]

Bases: TypeCheckError

A problem with an exprtype string or a curry.typed annotation.

exception curry.typecheck.errors.ExprTypeMismatchError(text, inferred, detail=None, **kwds)[source]

Bases: ExprTypeError

exprtype T does not match the inferred type U.

exception curry.typecheck.errors.ExprTypeSyntaxError(text, reason, column, **kwds)[source]

Bases: ExprTypeError

cannot parse exprtype 'text': ... at column N.

exception curry.typecheck.errors.FreeFunctionError(where, typetext, **kwds)[source]

Bases: TypeCheckError

A free variable at a function type: free variable at argument N of S would have the function type T.

exception curry.typecheck.errors.KindError(name, arity, ngiven, text, **kwds)[source]

Bases: ExprTypeError

A type constructor applied to the wrong number of arguments.

exception curry.typecheck.errors.MismatchError(lines, where=None, symbol=None, expected=None, actual=None, value=None)[source]

Bases: TypeCheckError

Two arguments disagree, or an argument does not fit its parameter: type mismatch in argument N of S :: scheme.

exception curry.typecheck.errors.NoInstanceError(classname, typetext, where, **kwds)[source]

Bases: TypeCheckError

no instance for Show (a -> a) in argument 1 of Prelude.show.

exception curry.typecheck.errors.TypeCheckError(lines, where=None, symbol=None, expected=None, actual=None, value=None)[source]

Bases: CurryTypeError

A typing failure of the engine.

Variables:
  • where – The text of the location, e.g., argument 2 of Prelude.+ :: Num a => a -> a -> a, or None.

  • symbol – The qualified name of the symbol whose argument failed, or None.

  • expected – The expected type, as a FlatCurry type, or None.

  • actual – The inferred type, or None.

  • value – The Python value that failed to convert, or None.

property first_line
exception curry.typecheck.errors.UnknownTypeConstructorError(name, searched, text=None, detail=None, **kwds)[source]

Bases: ExprTypeError

unknown type constructor T; searched the interfaces of M1, M2; curry.compile(..., exprtype=...) accepts any Curry type.

exception curry.typecheck.errors.ValueTooLargeError(where, cap, what='value', **kwds)[source]

Bases: TypeCheckError

The walk that types a Curry value stopped at its cap: the value at argument N of S has more than 100000 nodes; pass curry.typed(node, 'T'). With what='type of the value' the type of the value grew past the cap: a value that shares a node between the components of a pair at every level has a type exponential in its size.