scalus.compiler.intrinsics

Members list

Type members

Classlikes

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Support module (lowered once) for the BuiltinList / Data representation of List.

Support module (lowered once) for the BuiltinList / Data representation of List.

Every element here is in Data representation, so equality is just equalsData — no per-type code and no eq function to thread through. (Contrast NativeListOperations, whose elements are in Constant/native repr: there the dispatcher must pass equalsRepr, which produces different code per concrete type and so can't be baked into a once-lowered support.)

The intrinsic dispatchers (BuiltinListOperations / ...V11) just forward here. See docs/local/claude/compiler/v3-eq-eliminating.md.

List-returning ops build the result as List[Data] (each element a Data value) and return it typeProxy'd to List[A]. This support is lowered ONCE with A abstract, so it cannot relabel the result to A's concrete element repr (the element type is an unresolved TypeVar here). The dispatcher (BuiltinListOperations, re-lowered per concrete element type) does that relabel via typeProxyRepr — see there.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Intrinsic helper functions for type and representation casts.

Intrinsic helper functions for type and representation casts.

Marker methods intercepted by the compiler plugin. Never evaluated at runtime.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Native list intrinsics — thin delegation to NativeListOperations.

Native list intrinsics — thin delegation to NativeListOperations.

The IntrinsicResolver dispatches to these when the list has native element representation (SumBuiltinList with !isPackedData element repr). Each method delegates to NativeListOperations which has the actual implementations.

Type parameters carry @UplcRepr(TypeVar(Transparent)) so element bytes flow through without Data wrapping (matching the historical stampTransparent post-load semantics this annotation replaces). find is unannotated — see NativeListOperations.find for the rationale.

Simple methods (isEmpty, head, tail) are implemented inline since they're single builtins.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

UplcConstr list intrinsics — thin delegation to UplcConstrListOperations.

UplcConstr list intrinsics — thin delegation to UplcConstrListOperations.

The IntrinsicResolver dispatches to these when the list has SumUplcConstr representation. Type parameters are annotated @UplcRepr(TypeVar(Unwrapped)): the inliner substitutes the caller's concrete representation at the inlining site. Every List[_] / Option[_] in the signatures is annotated @UplcRepr(UplcConstr) — under the per-signature annotation regime (no uplcGeneratorPolicy swap), this is how the dispatcher's inline self match { ... } match lands on the UplcConstr code path and how its result stays in UplcConstr form. Simple methods (isEmpty, head, tail) are implemented inline since they're single pattern matches. Complex recursive methods delegate to UplcConstrListOperations (support module whose type params are Unwrapped).

For contains: Eq has known semantics (structural equality), so we use equalsData directly instead of calling the Eq function. Elements are converted to Data via toDefaultTypeVarRepr, then compared with a single equalsData builtin call.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Native-Constr Option intrinsics — thin delegation to UplcConstrOptionOperations.

Native-Constr Option intrinsics — thin delegation to UplcConstrOptionOperations.

The IntrinsicResolver dispatches to these when Option.method(...) is called on an Option whose lowered representation is SumUplcConstr. Type parameters are annotated @UplcRepr(TypeVar(Transparent)): the caller's concrete representation substitutes at the inline site. Every Option[_] container in the signatures is annotated @UplcRepr(UplcConstr) — under the per-signature annotation regime (no uplcGeneratorPolicy swap), this is how the dispatcher's inline self match { ... } lands on the UplcConstr code path and how its result stays in UplcConstr form.

Simple operations (isDefined, isEmpty, get) are implemented inline since they're single pattern matches. Higher-order operations (map, flatMap, filter, exists, forall) delegate to UplcConstrOptionOperations.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ListReprRules

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object MapReprRules

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Native list operations — implementations with Unwrapped TypeVars.

Native list operations — implementations with Unwrapped TypeVars.

Each generic type parameter carries @UplcRepr(TypeVar(Unwrapped)) so element bytes flow through in their stable default representation. find is intentionally NOT annotated — its Option.Some / Option.None if-then-else body exposes a lowering issue (Option.None doesn't propagate the target's annotated type-args when constructed under a @UplcRepr(UplcConstr) parent). Without the annotation, the Fixed-default lowering still works (this matched the historical behaviour, since the legacy IntrinsicResolver.stampTransparent call for this support module was a no-op due to a string-mismatch typo).

This is a support module — bindings are resolved on demand when referenced from intrinsic bodies. IntrinsicsNativeList delegates to these methods.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Repr rules for native list intrinsics (IntrinsicsNativeList).

Repr rules for native list intrinsics (IntrinsicsNativeList).

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

UplcConstr list operations — recursive implementations with local go functions.

UplcConstr list operations — recursive implementations with local go functions.

Every List[_] / Option[_] in the signatures carries a type-level @UplcRepr(UplcRepresentation.UplcConstr) annotation (List[A] @UplcRepr(UplcConstr)). The plugin's SIRTyper.sirTypeInEnv handles this AnnotatedType and wraps the SIR type with SIRType.Annotated(..., uplcRepr=UplcConstr). Unlike symbol-level annotations (which only wrap the DefDef's declared return), type-level annotations land in the SIR type itself, so a local def go(lst: List[A] @UplcRepr(UplcConstr)): List[A] @UplcRepr(UplcConstr) has a rhs.tp that is fully annotated on both in/out — matching what lowerLet:560 reads when computing rhsRepr.

Type parameters remain @UplcRepr(TypeVar(Unwrapped)): element bytes flow through in A's stable default representation.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Repr rules for UplcConstr list intrinsics (IntrinsicsUplcConstrList).

Repr rules for UplcConstr list intrinsics (IntrinsicsUplcConstrList).

Lists with SumUplcConstr representation use Constr(0, [h, t]) / Constr(1, []) instead of builtin lists. Operations use Case-based pattern matching. No repr rules for contains — the intrinsic body handles representation conversion internally via toDefaultTypeVarRepr.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Native-Constr Option operations — support-module bindings.

Native-Constr Option operations — support-module bindings.

Every Option[_] in the signatures is explicitly annotated @UplcRepr(UplcConstr) so the support-op body operates on native-Constr Options regardless of the caller's policy. Type parameters are @UplcRepr(TypeVar(Unwrapped)) — element bytes are in A's stable default representation, unaffected by any policy switch (there isn't one anymore).

Callers (the dispatcher in IntrinsicsUplcConstrOption) receive the user's Option in whatever shape and rely on the standard representation-conversion machinery to pass a SumUplcConstr value here. The match in each body is consequently always a genMatchUplcConstr destructure.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Repr rules for native UplcConstr Option intrinsics (IntrinsicsUplcConstrOption).

Repr rules for native UplcConstr Option intrinsics (IntrinsicsUplcConstrOption).

Mirrors UplcConstrListReprRules — each rule returns the output representation given the call site's concrete output type and the self argument's lowered representation.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Types

Argument conversion rule for factory intrinsics: (argType, resultType, lctx) => target repr. Returns Some(repr) to convert the argument before substitution, None to leave as-is.

Argument conversion rule for factory intrinsics: (argType, resultType, lctx) => target repr. Returns Some(repr) to convert the argument before substitution, None to leave as-is.

Attributes

A repr rule: (outputType, inputRepr, loweringContext) => outputRepr

A repr rule: (outputType, inputRepr, loweringContext) => outputRepr

Attributes

Deprecated types

Attributes

Deprecated
[Since version 0.16.0] Use scalus.compiler.UplcRepresentation instead

Use scalus.compiler.UplcRepresentation instead.

Value members

Deprecated fields

Attributes

Deprecated
[Since version 0.16.0] Use scalus.compiler.UplcRepresentation instead

Use scalus.compiler.UplcRepresentation instead.