Constr
scalus.uplc.builtin.Data.Constr
Constructor application - represents sum types and product types.
This is the primary way to encode algebraic data types in Plutus:
- For sum types,
constris the constructor index (0, 1, 2, ...) - For product types (case classes),
constris typically 0 argscontains the constructor's field values
Corresponds to UPLC builtins constrData and unConstrData.
Value parameters
- args
-
the constructor arguments as a list of Data values
- constr
-
the constructor index (must be non-negative)
Attributes
- Example
-
// A pair (Int, String) Constr(0, List(I(42), B(ByteString.fromString("hello")))) // Either.Left(10) Constr(0, List(I(10))) // Either.Right("x") Constr(1, List(B(ByteString.fromString("x")))) - Graph
-
- Supertypes
Members list
In this article