curry.interpreter.eval module

Implements Interpreter.eval.

curry.interpreter.eval.eval(interp, *args, **kwds)[source]

Evaluate a Curry goal.

Parameters:
  • *args – Positional arguments that specify the goal. These are passed to Interpreter.expr. One function symbol whose scheme has class constraints and no value parameter, a goal without a signature such as main = Just 5, is applied to its dictionaries first: the constraints are defaulted with the table of the PAKCS REPL (see curry.typecheck.defaulting), so the goal evaluates to a value and not to a partial application. An expression of curry.compile(mode='expr') whose text declared where x free variables absent from its result type yields its values with the bindings of those variables (curry.typecheck.goals.Bindings).

  • converter – Keyword-only argument specifying the converter to use when returning results. The default is ‘default’, the flag defaultconverter. 'topython' applies curry.topython(), None and any other name leave the Curry value, and a callable f(interp, value) converts as it pleases. See :func:curry.interpreter.conversions.getconverter.

  • exprtype – Keyword-only argument: the type of the goal in Curry syntax, passed to Interpreter.expr.

  • **kwds – Any other keyword names an anchor, as in Interpreter.expr.

Raises:
Returns:

A generator producing the values of the specified Curry program.