scalus

package scalus

Members list

Packages

package scalus.builtin

Backward compatibility package for scalus.builtin.

Backward compatibility package for scalus.builtin.

Provides BLS12-381 type aliases that are still in transition.

Attributes

package scalus.cardano
package scalus.compiler
package scalus.crypto
package scalus.prelude

Re-exports common extension methods from scalus.cardano.onchain.plutus.prelude for use in this package.

Re-exports common extension methods from scalus.cardano.onchain.plutus.prelude for use in this package.

Attributes

package scalus.testing
package scalus.uplc
package scalus.utils

Type members

Classlikes

trait InteropApi

Marker for per-platform interop surface traits.

Marker for per-platform interop surface traits.

Java/JS-facing members that would degrade the Scala API live in per-platform traits mixed into the shared (or platform) type; every such trait extends this marker so the interop surface is mechanically enumerable by tests.

See docs/superpowers/specs/2026-07-11-cross-language-interop-style-guide-design.md.

Attributes

Supertypes
class Object
trait Matchable
class Any

Selects test baselines that legitimately differ between Scala compiler versions.

Selects test baselines that legitimately differ between Scala compiler versions.

Budgets and compiled-script sizes shift between Scala 3.3.x (LTS) and 3.8.x because the host compiler desugars some constructs more leanly since 3.8.x — e.g. a tuple-datum pattern match no longer destructures-then-reconstructs the tuple, so the Scalus plugin sees a smaller tree. These differences are correctness-neutral (the contracts evaluate identically); only the exact budget/size numbers change. The 3.3.x LTS keeps the older, larger baselines; 3.8.x and the next LTS (which inherits the leaner desugaring) use the smaller ones.

Lives in scalus-testkit (not the example test sources) so that standalone projects ejected via eject-examples — which bundle the example tests but depend only on published artifacts — can still resolve scalus.ScalaCompilerVersion.

The active compiler version is injected by build.sbt (-Dscalus.test.scalaVersion). It can't be read from scala.util.Properties.versionNumberString, which reports the 2.13 standard-library version (2.13.x) on the Scala 3.3 LTS rather than the compiler version. When the property is absent (e.g. an ejected project, which pins the 3.3.x LTS) it defaults to "3.3.8".

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Extensions

Extensions

extension [A](inline a: A)
infix inline def |>[B](inline f: A => B): B

Pipe operator

Pipe operator

Attributes

Deprecated extensions

extension (sir: SIR)
def lowerToUplc(using options: Options = ...): Term

Lowers with the given Options only (no parameter overrides).

Lowers with the given Options only (no parameter overrides).

Attributes

Deprecated
[Since version 1.0.0] use toUplc instead
def pretty: Doc

Pretty-prints the SIR as a plain-text Doc.

Pretty-prints the SIR as a plain-text Doc.

Attributes

def prettyXTerm: Doc

Pretty-prints the SIR as a Doc with XTerm color escape codes.

Pretty-prints the SIR as a Doc with XTerm color escape codes.

Attributes

def show: String

Renders pretty at 80 columns.

Renders pretty at 80 columns.

Attributes

def showHighlighted: String

Renders prettyXTerm at 80 columns (colored, for terminal output).

Renders prettyXTerm at 80 columns (colored, for terminal output).

Attributes

def showShort: String

First line of the rendered SIR, truncated to 60 characters - for log messages.

First line of the rendered SIR, truncated to 60 characters - for log messages.

Attributes

def toLoweredValue(using options: Options = ...)(generateErrorTraces: Boolean = ..., debug: Boolean = ...): LoweredValue

Exposes the V3 backend's intermediate lowering result.

Exposes the V3 backend's intermediate lowering result.

LoweredValue is compiler-internal IR with no stability guarantees, and this method bypasses the unified pipeline (no trace removal, no SIR-level optimization).

Attributes

Deprecated
[Since version 1.0.0] internal lowering IR; use SirToUplcV3Lowering.fromOptions(sir, options).toLoweredValue() ".+("for lowering debugging, or PlutusV3.compile for compilation")
def toUplc(using options: Options = ...)(generateErrorTraces: Boolean = ..., backend: TargetLoweringBackend = ..., optimizeUplc: Boolean = ..., debug: Boolean = ...): Term

Lowers the SIR to a UPLC Term through the single scalus.compiler.sir.lowering.UplcPipeline (the same pipeline scalus.uplc.CompiledPlutus uses): removeTraces? -> mutual-recursion elimination -> static-argument transformation? -> backend lowering -> optimization? -> source-position back-fill.

Lowers the SIR to a UPLC Term through the single scalus.compiler.sir.lowering.UplcPipeline (the same pipeline scalus.uplc.CompiledPlutus uses): removeTraces? -> mutual-recursion elimination -> static-argument transformation? -> backend lowering -> optimization? -> source-position back-fill.

Intended for tests and inspection of the lowered term. For production scripts use scalus.uplc.PlutusV3.compile instead - it also produces the versioned program, serialized script, and script address.

Each parameter defaults to the corresponding field of the given Options and overrides it when passed explicitly.

Value parameters

backend

the lowering backend; the default V3 backend is right for almost all uses

debug

verbose lowering diagnostics

generateErrorTraces

emit trace calls with error details on failure paths (bigger, costlier script)

optimizeUplc

run the SIR- and UPLC-level optimizers (what Options.release enables)

Attributes

def toUplcOptimized(using options: Options = ...)(generateErrorTraces: Boolean = ..., backend: TargetLoweringBackend = ..., debug: Boolean = ...): Term

toUplc with optimizeUplc = true: lowers and runs the full optimizer pipeline.

toUplc with optimizeUplc = true: lowers and runs the full optimizer pipeline.

Intended for tests comparing optimized output. For production scripts use scalus.uplc.PlutusV3.compile with Options.release instead.

Attributes