Module SCL/Expressions

This module is undocumented. This is a list of its definitions.

applyModifier :: a -> b -> ()
createExpressionEvaluator :: RuntimeEnvironment -> String -> <Proc> ExpressionEvaluator

Creates an evaluator for the given expression text in the given runtime environment. The expression is not compiled here; that happens in eval.

eval :: ExpressionEvaluator -> <Proc> a

Compiles the expression and evaluates it.

Throws an SCLExpressionCompilationException if the expression does not parse, does not resolve in the environment or does not type check; the exception carries the compilation errors. An exception thrown by the expression itself while it runs passes through unchanged.

evaluateExpression :: Typeable a => RuntimeEnvironment -> [EvaluationModifier] -> String -> <Proc> a

Compiles and evaluates the given expression text in the given runtime environment, requiring the expression to have the type expected at the call site.

Throws an SCLExpressionCompilationException if the expression does not compile, including when its type differs from the expected one. The modifier list is ignored.

expectedType :: ExpressionEvaluator -> Type -> <Proc> ExpressionEvaluator

Requires the expression to have the given type, and returns the same evaluator so that the calls can be chained. Without this the type is whatever the expression itself determines.

untypedEvaluateExpression :: RuntimeEnvironment -> [EvaluationModifier] -> String -> <Proc> a

Like evaluateExpression, but puts no requirement on the type of the expression. The value is returned at whatever type the call site asks for, without a check, so a mismatch fails later rather than as a compilation error.