Case

scalus.uplc.Term.Case
final case class Case(arg: Term, cases: List[Term], annotation: UplcAnnotation = ...)

Members list

Value members

Inherited methods

infix def $(rhs: Term): Term

Applies the argument to the term.

Applies the argument to the term.

Attributes

Inherited from:
Term
infix def `α_==`(that: Term): Boolean

Alpha-equivalence check between two terms.

Alpha-equivalence check between two terms.

Attributes

Note

This method assumes that the terms are debruijn-indexed properly. Call DeBruijn.deBruijnTerm before using this method to ensure correct indexing.

Inherited from:
Term
def applyToList: (Term, List[Term])

Attributes

Inherited from:
Term

Attributes

Inherited from:
Term
def evaluate(using vm: PlutusVM): Term

Evaluate the term using the given VM.

Evaluate the term using the given VM.

Attributes

Throws
RuntimeException

on evaluation error

Note

This method just runs the CEK machine on the term. It does not follow Plutus specification like CIP-117

Inherited from:
Term
def evaluateDebug(using vm: PlutusVM): Result

Evaluate the term using the given VM.

Evaluate the term using the given VM.

Attributes

Returns

scalus.uplc.eval.Result with the evaluation result and the spent budget

Note

This method just runs the CEK machine on the term. It does not follow Plutus specification like CIP-117

Inherited from:
Term
def evaluateProfile(using vm: PlutusVM): Result

Evaluate the term with profiling enabled.

Evaluate the term with profiling enabled.

Like evaluateDebug but also collects profiling data by source location and function. Access profiling data via result.profile.

Attributes

Returns

scalus.uplc.eval.Result with profile set to Some(profilingData)

Note

This method just runs the CEK machine on the term. It does not follow Plutus specification like CIP-117

Inherited from:
Term

Bottom-up pass: gives every position-less subterm the source position of its nearest positioned descendant, and returns that representative position for this subtree (its own if positioned, else the first positioned child, preferring the function/scrutinee side).

Bottom-up pass: gives every position-less subterm the source position of its nearest positioned descendant, and returns that representative position for this subtree (its own if positioned, else the first positioned child, preferring the function/scrutinee side).

This is the main filler for lowered code: source positions sit on the leaves (the Var/ Const/Builtin a value references), while the Apply/Case/Constr spine that combines them is built position-less. A spine node here inherits the location of what it operates on — e.g. an application inherits the position of the function being applied — so its cost is attributed to that code rather than vanishing. Never overwrites an existing position.

Attributes

Inherited from:
Term

Top-down pass: stamps every position-less subterm with the source position of its nearest enclosing positioned ancestor (inherited at the root). Positioned subterms keep their own position and become the inherited position for their descendants.

Top-down pass: stamps every position-less subterm with the source position of its nearest enclosing positioned ancestor (inherited at the root). Positioned subterms keep their own position and become the inherited position for their descendants.

This completes fillEmptyPosBottomUp: per-value stamping during lowering can only place a position a lowered value actually knows, but many Apply/Let SIR nodes carry no position at all (the plugin doesn't stamp them), so the spines they build stay position-less. Here those nodes inherit the source location of the surrounding code — which is exactly what profiling and source traces should attribute their cost to.

Attributes

Inherited from:
Term

Wrap the term in a Plutus V1 program.

Wrap the term in a Plutus V1 program.

Attributes

Inherited from:
Term

Wrap the term in a Plutus V2 program.

Wrap the term in a Plutus V2 program.

Attributes

Inherited from:
Term

Wrap the term in a Plutus V3 program.

Wrap the term in a Plutus V3 program.

Attributes

Inherited from:
Term
def pretty: Doc

Pretty-print the term.

Pretty-print the term.

Attributes

Inherited from:
Term
def prettyXTerm: Doc

Pretty-print the term with XTerm syntax highlighting.

Pretty-print the term with XTerm syntax highlighting.

Attributes

Inherited from:
Term
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def show: String

Show the term as a string.

Show the term as a string.

Attributes

Inherited from:
Term
def showHighlighted: String

Show the term as a string with XTerm syntax highlighting.

Show the term as a string with XTerm syntax highlighting.

Attributes

Inherited from:
Term
def showShort: String

Show the term as a short string (truncated to 60 chars, first line only).

Show the term as a short string (truncated to 60 chars, first line only).

Attributes

Inherited from:
Term

Backwards-compatible accessor for the source position.

Backwards-compatible accessor for the source position.

Attributes

Inherited from:
Term
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Term -> Any
Inherited from:
Term
def unary_!: Term

Forces the term.

Forces the term.

Attributes

Inherited from:
Term
def unary_~: Term

Delays the term.

Delays the term.

Attributes

Inherited from:
Term

Returns a copy of this term with the given annotation.

Returns a copy of this term with the given annotation.

Attributes

Inherited from:
Term

Sets the annotation on this term and recursively on subterms, but only where the annotation is currently empty. Recursion stops at terms that already have an annotation.

Sets the annotation on this term and recursively on subterms, but only where the annotation is currently empty. Recursion stops at terms that already have an annotation.

Attributes

Inherited from:
Term

Returns a copy of this term with the given source position.

Returns a copy of this term with the given source position.

Attributes

Inherited from:
Term

Sets the source position on this term and recursively on subterms, but only where the position is currently empty. Recursion stops at terms that already have a position.

Sets the source position on this term and recursively on subterms, but only where the position is currently empty. Recursion stops at terms that already have a position.

Attributes

Inherited from:
Term
infix def ~!=~(that: Term): Boolean

Position-ignoring structural inequality. Negation of ~=~.

Position-ignoring structural inequality. Negation of ~=~.

Attributes

Inherited from:
Term
infix def ~=~(that: Term): Boolean

Position-ignoring structural equality. Like α_== but works on named terms too and ignores annotation fields.

Position-ignoring structural equality. Like α_== but works on named terms too and ignores annotation fields.

Attributes

Inherited from:
Term