curry package

The public surface is installed beside the package as curry/__init__.pyi. It records the names and signatures available in this version.

The public Python surface of Sprite.

Build typed terms with module calls, term and parse. Evaluate them with eval or solve and print values with show. The installed __init__.pyi describes the public names and their landed signatures.

class curry.Anonymous[source]

Bases: object

A fresh variable at each occurrence in a term.

class curry.Answer(value: object, bindings: Bindings)[source]

Bases: NamedTuple

A value and its bindings. Its text is the REPL’s answer line.

bindings: Bindings

Alias for field number 1

value: object

Alias for field number 0

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

Bases: CurryTypeError

S :: scheme takes N arguments, M given.

class curry.Bindings(items=(), variables=())[source]

Bases: Mapping

Bindings in occurrence order, indexed by name, display name or Var.

class curry.Char(value)[source]

Bases: str

A Curry character, distinguished from a String.

exception curry.CompileError(message, report=None, line=None, column=None)[source]

Bases: CurryError

Raised when an error occurs while compiling Curry code.

class curry.ConstructorClass(interp, form, symbol=None, args=(), annotation=None)[source]

Bases: DataClass

The base of the values of one loaded Curry constructor.

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

Bases: CurryTypeError

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.CurryError[source]

Bases: Exception

The root of the Curry exception tree.

exception curry.CurryFileNotFoundError[source]

Bases: CurryIOError, FileNotFoundError

An I/O action could not find its file.

exception curry.CurryIOError[source]

Bases: EvaluationError, OSError

An uncaught error of an I/O action.

exception curry.CurryIndexError[source]

Bases: CurryError, IndexError

Raised when indexing into a Curry expression fails.

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

Bases: CurryError, TypeError

Raised when a type error occurs while evaluating a Curry program.

property first_line
exception curry.CurryWarning[source]

Bases: UserWarning

A warning of the front end or loader.

class curry.Data(interp, form, symbol=None, args=(), annotation=None)[source]

Bases: Term

A constructor value with converted arguments.

property args
class curry.DataClass(interp, form, symbol=None, args=(), annotation=None)[source]

Bases: Data

The base of the values of one loaded Curry data type.

class curry.DataType(datatype, module)[source]

Bases: object

The metadata of a data type in a module.

property constructors
property fullname
property name
exception curry.DefaultingError(message, scheme, predicate=None)[source]

Bases: CurryTypeError

The table cannot default the constraints of a scheme.

Variables:
  • scheme – The scheme.

  • predicate – The constraint the table rejected.

exception curry.DivisionByZeroError[source]

Bases: EvaluationError, ZeroDivisionError

An integral division has a zero divisor.

exception curry.EvaluationError[source]

Bases: CurryError

Signals an error raised from a Curry program.

exception curry.EvaluationTimeout[source]

Bases: EvaluationError

An evaluation exceeded its time limit.

exception curry.FlagError[source]

Bases: CurryError, ValueError

An unknown flag or a value its validator refuses.

exception curry.ForkError[source]

Bases: CurryError, RuntimeError

Sprite was busy when this child process was forked.

class curry.Function(interp, form, symbol=None, args=(), annotation=None)[source]

Bases: Term

A function value, including a partial constructor application.

property args
exception curry.InstantiationError[source]

Bases: EvaluationError

A free variable of function type could not be instantiated.

exception curry.IntOverflowError[source]

Bases: CurryError, OverflowError

A bounded conversion is out of range, or a Float is not finite.

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

Bases: CurryTypeError

The interface of a module cannot be read.

exception curry.LoadError[source]

Bases: CurryError, OSError

An object could not be written, read or replaced.

exception curry.ManyValuesError[source]

Bases: CurryError, ValueError

Results.one found a second value.

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

Bases: CurryTypeError

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

curry.Module

alias of CurryModule

exception curry.ModuleExistsError[source]

Bases: CurryError, ValueError

A module of the given name is already loaded.

exception curry.ModuleLookupError[source]

Bases: CurryError, ModuleNotFoundError

Raised when a Curry module is not found.

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

Bases: CurryTypeError

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

exception curry.NoValueError[source]

Bases: CurryError, LookupError

Results.one found no value.

exception curry.NondetError(message='non-determinism in monadic actions occurred!')[source]

Bases: EvaluationError

A choice occurred inside an I/O action.

CTOR_INDEX = 3
exception curry.NotConstructorError(arg)[source]

Bases: CurryError, ValueError

Raised when a non-constructor value occurs where disallowed.

exception curry.PrerequisiteError[source]

Bases: CurryError, OSError

Raised when a build prerequisite is invalid.

exception curry.ReentrancyError[source]

Bases: CurryError, RuntimeError

A host callback entered Sprite while its thread held an internal lock.

class curry.Reference(interp, name)[source]

Bases: Term

A binding reference, resolved only by its enclosing let.

class curry.Results(values, text)[source]

Bases: Iterator

A lazy search. Closing it releases the evaluation.

close()[source]
one()[source]
exception curry.StackLimitError[source]

Bases: EvaluationError, RecursionError

An evaluation reached its stack limit.

exception curry.StaleError[source]

Bases: CurryError, RuntimeError

An object belongs to an earlier session or module version.

class curry.Stream(values)[source]

Bases: Iterator

The ordered values yielded by an I/O action; result is set at its end.

close()[source]
exception curry.SuspensionError(message='Evaluation suspended')[source]

Bases: EvaluationError

Evaluation failed due to suspended constraints.

class curry.Symbol(info, module)[source]

Bases: object

The metadata of a function or constructor, separate from its term.

property arity
property fields
property fixity
property fullname
property info
property kind
property name
property public
property signature
exception curry.SymbolLookupError[source]

Bases: CurryError, AttributeError

Raised when a Curry symbol is not found.

class curry.Term(interp, form, symbol=None, args=(), annotation=None)[source]

Bases: object

A typed Curry expression held by Python.

property args
property free_vars
classmethod from_symbol(info, module)[source]
exception curry.TypeLookupError[source]

Bases: CurryError, AttributeError

Raised when a Curry type is not found.

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

Bases: CurryTypeError

A type annotation cannot be parsed or has an invalid type or kind.

class curry.Values(interp, form, symbol=None, args=(), annotation=None)[source]

Bases: Term, Collection

The finite multiset produced by a set function.

class curry.Var(interp, name=None, type=None)[source]

Bases: Term

One Python object, one free variable, with a persistent static type.

curry.choice(first, second, *more)[source]
curry.compile(source, *, name=None, imports=())[source]
curry.cpm_path(root)[source]

Return source directories of a local CPM project and its packages.

curry.eval(goal, *, search=None)[source]

Return the converted values of a goal as a lazy Results.

curry.free(name=None, *, type=None)[source]
curry.import_(name, *, path=None)[source]
curry.info(module)[source]
curry.let(body, /, **bindings)[source]
curry.load(path)[source]
curry.parse(text, *, imports=())[source]
curry.program_arguments

Arguments supplied to the Curry program; defaults to Python command arguments.

curry.program_name

Curry program name; defaults to the Python invocation name.

curry.ref(name)[source]
curry.reload(module, *, text=None)[source]

Reload a module, dropping its interpreter’s queued and posted hot work.

Still-loaded interpreted functions become hot again after the threshold’s count of calls. A module belonging to another interpreter is refused.

curry.reset(**flags)[source]
curry.save(module, path, *, main=None)[source]
curry.show(value)[source]
curry.solve(goal, *, search=None)[source]
curry.stats()[source]
curry.stream(action)[source]

Return the ordered values yielded by a lazy I/O action as a Stream.

curry.symbol(name)[source]
curry.term(value, *, type=None)[source]
curry.type(name)[source]
curry.typeof(value, *, defaulted=False)[source]
curry.wait(module=None)[source]