PartialEvaluator

scalus.uplc.transform.PartialEvaluator

Compile-time partial evaluator for UPLC terms.

Evaluates closed subexpressions (no free variables) at compile time using the CEK machine and replaces them with their result. This covers saturated builtin applications, lambda applications with constant arguments, case/constr elimination on known constructors, and any composition of the above.

==Safety==

A budget cap prevents expensive computations from slowing the compiler. Failed evaluations (runtime errors, budget exceeded) leave the original term unchanged, preserving semantics.

Attributes

See also

Inliner which calls this after inlining and beta-reduction

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def tryEval(term: Term, maxBudget: ExUnits = ...): Option[Term]

Try to partially evaluate a closed term.

Try to partially evaluate a closed term.

Returns Some(result) if the term is closed, reducible, and CEK evaluation succeeds within budget producing a constant. Returns None otherwise.

Attributes

Concrete fields

Default budget cap for partial evaluation attempts.

Default budget cap for partial evaluation attempts.

Attributes