Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The types and functions that are common among all ledger Plutus versions.
Synopsis
- type SerialisedScript = ShortByteString
- data ScriptForEvaluation
- serialisedScript ∷ ScriptForEvaluation → SerialisedScript
- deserialisedScript ∷ ScriptForEvaluation → ScriptNamedDeBruijn
- serialiseCompiledCode ∷ ∀ a. CompiledCode a → SerialisedScript
- serialiseUPLC ∷ Program DeBruijn DefaultUni DefaultFun () → SerialisedScript
- deserialiseScript ∷ ∀ m. MonadError ScriptDecodeError m ⇒ PlutusLedgerLanguage → MajorProtocolVersion → SerialisedScript → m ScriptForEvaluation
- uncheckedDeserialiseUPLC ∷ SerialisedScript → Program DeBruijn DefaultUni DefaultFun ()
- data ScriptDecodeError
- newtype ScriptNamedDeBruijn = ScriptNamedDeBruijn (Program NamedDeBruijn DefaultUni DefaultFun ())
- evaluateScriptCounting ∷ PlutusLedgerLanguage → MajorProtocolVersion → VerboseMode → EvaluationContext → ScriptForEvaluation → [Data] → (LogOutput, Either EvaluationError ExBudget)
- evaluateScriptRestricting ∷ PlutusLedgerLanguage → MajorProtocolVersion → VerboseMode → EvaluationContext → ExBudget → ScriptForEvaluation → [Data] → (LogOutput, Either EvaluationError ExBudget)
- evaluateTerm ∷ ExBudgetMode cost DefaultUni DefaultFun → MajorProtocolVersion → VerboseMode → EvaluationContext → Term NamedDeBruijn DefaultUni DefaultFun () → (Either (CekEvaluationException NamedDeBruijn DefaultUni DefaultFun) (Term NamedDeBruijn DefaultUni DefaultFun ()), cost, [Text])
- data VerboseMode
- type LogOutput = [Text]
- data EvaluationError
- newtype MajorProtocolVersion = MajorProtocolVersion {}
- data PlutusLedgerLanguage
- data Version = Version {}
- builtinsIntroducedIn ∷ Map (PlutusLedgerLanguage, MajorProtocolVersion) (Set DefaultFun)
- builtinsAvailableIn ∷ PlutusLedgerLanguage → MajorProtocolVersion → Set DefaultFun
- ledgerLanguageIntroducedIn ∷ PlutusLedgerLanguage → MajorProtocolVersion
- ledgerLanguagesAvailableIn ∷ MajorProtocolVersion → Set PlutusLedgerLanguage
- data ExBudget = ExBudget {}
- newtype ExCPU = ExCPU CostingInteger
- newtype ExMemory = ExMemory CostingInteger
- data SatInt
- fromSatInt ∷ Num a ⇒ SatInt → a
- type CostModelParams = Map Text Int64
- toCostModelParams ∷ IsParamName p ⇒ [(p, Int64)] → CostModelParams
- assertWellFormedCostModelParams ∷ MonadError CostModelApplyError m ⇒ CostModelParams → m ()
- class (Enum a, Bounded a) ⇒ IsParamName a where
- showParamName ∷ a → Text
- readParamName ∷ Text → Maybe a
- data GenericParamName a
- data CostModelApplyError
- data CostModelApplyWarn
- = CMTooManyParamsWarn {
- cmExpected ∷ !Int
- cmActual ∷ !Int
- | CMTooFewParamsWarn {
- cmExpected ∷ !Int
- cmActual ∷ !Int
- = CMTooManyParamsWarn {
- data EvaluationContext = EvaluationContext {}
- mkDynEvaluationContext ∷ MonadError CostModelApplyError m ⇒ PlutusLedgerLanguage → [BuiltinSemanticsVariant DefaultFun] → (MajorProtocolVersion → BuiltinSemanticsVariant DefaultFun) → CostModelParams → m EvaluationContext
- toMachineParameters ∷ MajorProtocolVersion → EvaluationContext → DefaultMachineParameters
- mkTermToEvaluate ∷ MonadError EvaluationError m ⇒ PlutusLedgerLanguage → MajorProtocolVersion → ScriptForEvaluation → [Data] → m (Term NamedDeBruijn DefaultUni DefaultFun ())
- data BuiltinByteString
- toBuiltin ∷ HasToBuiltin a ⇒ a → ToBuiltin a
- fromBuiltin ∷ HasFromBuiltin arep ⇒ arep → FromBuiltin arep
- toOpaque ∷ HasToOpaque a arep ⇒ a → arep
- fromOpaque ∷ HasFromOpaque arep a ⇒ arep → a
- data Data
- data BuiltinData = BuiltinData ~Data
- class ToData a where
- toBuiltinData ∷ a → BuiltinData
- class FromData a where
- fromBuiltinData ∷ BuiltinData → Maybe a
- class UnsafeFromData a where
- toData ∷ ToData a ⇒ a → Data
- fromData ∷ FromData a ⇒ Data → Maybe a
- unsafeFromData ∷ UnsafeFromData a ⇒ Data → a
- dataToBuiltinData ∷ Data → BuiltinData
- builtinDataToData ∷ BuiltinData → Data
- class Monad m ⇒ MonadError e (m ∷ Type → Type) | m → e
Script (de)serialization
type SerialisedScript = ShortByteString Source #
Scripts to the ledger are serialised bytestrings.
data ScriptForEvaluation Source #
A Plutus script ready to be evaluated on-chain, via evaluateScriptRestricting
.
Instances
Generic ScriptForEvaluation Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript | |
Show ScriptForEvaluation Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript | |
NFData ScriptForEvaluation Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript rnf ∷ ScriptForEvaluation → () Source # | |
Eq ScriptForEvaluation Source # | |
NoThunks ScriptForEvaluation Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript | |
type Rep ScriptForEvaluation Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript type Rep ScriptForEvaluation = D1 ('MetaData "ScriptForEvaluation" "PlutusLedgerApi.Common.SerialisedScript" "plutus-ledger-api-1.36.0.0-inplace" 'False) (C1 ('MetaCons "UnsafeScriptForEvaluation" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SerialisedScript) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ScriptNamedDeBruijn))) |
serialisedScript ∷ ScriptForEvaluation → SerialisedScript Source #
Get a SerialisedScript
from a ScriptForEvaluation
. O(1).
deserialisedScript ∷ ScriptForEvaluation → ScriptNamedDeBruijn Source #
Get a ScriptNamedDeBruijn
from a ScriptForEvaluation
. O(1).
serialiseCompiledCode ∷ ∀ a. CompiledCode a → SerialisedScript Source #
Turns a program which was compiled using the 'PlutusTx' toolchain into a binary format that is understood by the network and can be stored on-chain.
serialiseUPLC ∷ Program DeBruijn DefaultUni DefaultFun () → SerialisedScript Source #
Turns a program's AST (most likely manually constructed) into a binary format that is understood by the network and can be stored on-chain.
∷ ∀ m. MonadError ScriptDecodeError m | |
⇒ PlutusLedgerLanguage | the Plutus ledger language of the script. |
→ MajorProtocolVersion | which major protocol version the script was submitted in. |
→ SerialisedScript | the script to deserialise. |
→ m ScriptForEvaluation |
The deserialization from a serialised script into a ScriptForEvaluation
,
ready to be evaluated on-chain.
Called inside phase-1 validation (i.e., deserialisation error is a phase-1 error).
uncheckedDeserialiseUPLC ∷ SerialisedScript → Program DeBruijn DefaultUni DefaultFun () Source #
Deserialises a SerialisedScript
back into an AST. Does *not* do
ledger-language-version-specific checks like for allowable builtins.
data ScriptDecodeError Source #
An error that occurred during script deserialization.
CBORDeserialiseError !DeserialiseFailureInfo | an error from the underlying CBOR/serialise library |
RemainderError !ByteString | Script was successfully parsed, but more (runaway) bytes encountered after script's position |
LedgerLanguageNotAvailableError | the plutus version of the given script is not enabled yet |
| |
PlutusCoreLanguageNotAvailableError | |
|
Instances
newtype ScriptNamedDeBruijn Source #
A script with named de-bruijn indices.
Instances
Generic ScriptNamedDeBruijn Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript | |
Show ScriptNamedDeBruijn Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript | |
NFData ScriptNamedDeBruijn Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript rnf ∷ ScriptNamedDeBruijn → () Source # | |
Eq ScriptNamedDeBruijn Source # | |
type Rep ScriptNamedDeBruijn Source # | |
Defined in PlutusLedgerApi.Common.SerialisedScript type Rep ScriptNamedDeBruijn = D1 ('MetaData "ScriptNamedDeBruijn" "PlutusLedgerApi.Common.SerialisedScript" "plutus-ledger-api-1.36.0.0-inplace" 'True) (C1 ('MetaCons "ScriptNamedDeBruijn" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Program NamedDeBruijn DefaultUni DefaultFun ())))) |
Script evaluation
evaluateScriptCounting Source #
∷ PlutusLedgerLanguage | The Plutus ledger language of the script under execution. |
→ MajorProtocolVersion | Which major protocol version to run the operation in |
→ VerboseMode | Whether to produce log output |
→ EvaluationContext | Includes the cost model to use for tallying up the execution costs |
→ ScriptForEvaluation | The script to evaluate |
→ [Data] | The arguments to the script |
→ (LogOutput, Either EvaluationError ExBudget) |
Evaluates a script, returning the minimum budget that the script would need
to evaluate successfully. This will take as long as the script takes, if you need to
limit the execution time of the script also, you can use evaluateScriptRestricting
, which
also returns the used budget.
Note: Parameterized over the ledger-plutus-version since the builtins allowed (during decoding) differs.
evaluateScriptRestricting Source #
∷ PlutusLedgerLanguage | The Plutus ledger language of the script under execution. |
→ MajorProtocolVersion | Which major protocol version to run the operation in |
→ VerboseMode | Whether to produce log output |
→ EvaluationContext | Includes the cost model to use for tallying up the execution costs |
→ ExBudget | The resource budget which must not be exceeded during evaluation |
→ ScriptForEvaluation | The script to evaluate |
→ [Data] | The arguments to the script |
→ (LogOutput, Either EvaluationError ExBudget) |
Evaluates a script, with a cost model and a budget that restricts how many resources it can use according to the cost model. Also returns the budget that was actually used.
Can be used to calculate budgets for scripts, but even in this case you must give a limit to guard against scripts that run for a long time or loop.
Note: Parameterized over the LedgerPlutusVersion
since
1. The builtins allowed (during decoding) differ, and
2. The Plutus language versions allowed differ.
evaluateTerm ∷ ExBudgetMode cost DefaultUni DefaultFun → MajorProtocolVersion → VerboseMode → EvaluationContext → Term NamedDeBruijn DefaultUni DefaultFun () → (Either (CekEvaluationException NamedDeBruijn DefaultUni DefaultFun) (Term NamedDeBruijn DefaultUni DefaultFun ()), cost, [Text]) Source #
Evaluate a fully-applied term using the CEK machine. Useful for mimicking the behaviour of the on-chain evaluator.
data VerboseMode Source #
A simple toggle indicating whether or not we should accumulate logs during script execution.
Instances
Eq VerboseMode Source # | |
Defined in PlutusLedgerApi.Common.Eval (==) ∷ VerboseMode → VerboseMode → Bool Source # (/=) ∷ VerboseMode → VerboseMode → Bool Source # |
type LogOutput = [Text] Source #
The type of the executed script's accumulated log output: a list of Text
.
It will be an empty list if the VerboseMode
is set to Quiet
.
data EvaluationError Source #
Errors that can be thrown when evaluating a Plutus script.
CekError !(CekEvaluationException NamedDeBruijn DefaultUni DefaultFun) | An error from the evaluator itself |
DeBruijnError !FreeVariableError | An error in the pre-evaluation step of converting from de-Bruijn indices |
CodecError !ScriptDecodeError | A deserialisation error TODO: make this error more informative when we have more information about what went wrong |
CostModelParameterMismatch | An error indicating that the cost model parameters didn't match what we expected |
InvalidReturnValue | The script evaluated to a value that is not a valid return value. |
Instances
Network's versioning
The network's behaviour (and plutus's by extension) can change via hard forks, which directly correspond to major-number protocol version bumps.
newtype MajorProtocolVersion Source #
This represents the major component of the Cardano protocol version. The ledger can only supply the major component of the protocol version, not the minor component, and Plutus should only need to care about the major component anyway. This relies on careful understanding between us and the ledger as to what this means.
Instances
data PlutusLedgerLanguage Source #
The Plutus ledger language. These are entirely different script languages from the ledger's perspective, which on our side are interpreted in very similar ways.
It is a simple enumerated datatype (there is no major and minor components as in protocol version) and the ordering of constructors is essential for deriving Enum,Ord,Bounded.
IMPORTANT: this is different from the Plutus Core language version, Version
Instances
The version of Plutus Core used by this program.
The intention is to convey different levels of backwards compatibility for existing scripts: - Major version changes are backwards-incompatible - Minor version changes are backwards-compatible - Patch version changes should be entirely invisible (and we will likely not use this level)
The version used should be changed only when the language itself changes. For example, adding a new kind of term to the language would require a minor version bump; removing a kind of term would require a major version bump.
Similarly, changing the semantics of the language will require a version bump, typically a major one. This is the main reason why the version is actually tracked in the AST: we can have two language versions with identical ASTs but different semantics, so we need to track the version explicitly.
Compatibility is about compatibility for specific scripts, not about e.g. tools which consume scripts. Adding a new kind of term does not change how existing scripts behave, but does change what tools would need to do to process scripts.
Instances
Generic Version | |
Show Version | |
NFData Version | |
Defined in PlutusCore.Version | |
Eq Version | |
Ord Version | |
Defined in PlutusCore.Version | |
Hashable Version | |
Pretty Version | |
type Rep Version | |
Defined in PlutusCore.Version type Rep Version = D1 ('MetaData "Version" "PlutusCore.Version" "plutus-core-1.36.0.0-inplace" 'False) (C1 ('MetaCons "Version" 'PrefixI 'True) (S1 ('MetaSel ('Just "_versionMajor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: (S1 ('MetaSel ('Just "_versionMinor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: S1 ('MetaSel ('Just "_versionPatch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)))) |
builtinsIntroducedIn ∷ Map (PlutusLedgerLanguage, MajorProtocolVersion) (Set DefaultFun) Source #
A map indicating which builtin functions were introduced in which MajorProtocolVersion
.
This must be updated when new builtins are added. See Note [New builtins/language versions and protocol versions]
builtinsAvailableIn ∷ PlutusLedgerLanguage → MajorProtocolVersion → Set DefaultFun Source #
Which builtin functions are available in the given given PlutusLedgerLanguage
and MajorProtocolVersion
?
See Note [New builtins/language versions and protocol versions]
ledgerLanguageIntroducedIn ∷ PlutusLedgerLanguage → MajorProtocolVersion Source #
Query the protocol version that a specific Plutus ledger language was first introduced in.
ledgerLanguagesAvailableIn ∷ MajorProtocolVersion → Set PlutusLedgerLanguage Source #
Which Plutus language versions are available in the given MajorProtocolVersion
?
See Note [New builtins/language versions and protocol versions]
Costing-related types
Instances
Counts CPU units in picoseconds: maximum value for SatInt is 2^63 ps, or appproximately 106 days.
Instances
FromJSON ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory | |
ToJSON ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory | |
Monoid ExCPU | |
Semigroup ExCPU | |
Bounded ExCPU | |
Generic ExCPU | |
Num ExCPU | |
Read ExCPU | |
Show ExCPU | |
NFData ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory | |
Eq ExCPU | |
Ord ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory | |
NoThunks ExCPU | |
Pretty ExCPU | |
Serialise ExCPU | |
PrettyBy config ExCPU | |
Lift ExCPU | |
type Rep ExCPU | |
Defined in PlutusCore.Evaluation.Machine.ExMemory type Rep ExCPU = D1 ('MetaData "ExCPU" "PlutusCore.Evaluation.Machine.ExMemory" "plutus-core-1.36.0.0-inplace" 'True) (C1 ('MetaCons "ExCPU" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CostingInteger))) |
Counts size in machine words.
Instances
Instances
fromSatInt ∷ Num a ⇒ SatInt → a Source #
An optimized version of fromIntegral . unSatInt
.
Network's costing parameters
A less drastic approach (that does not rely on a HF) to affect the network's (and plutus's by extension) behaviour is by tweaking the values of the cost model parameters.
The network does not associate names to cost model parameters; Plutus attaches names to the network's cost model parameters (values) either in a raw textual form or typed by a specific plutus version.
See Note [Cost model parameters]
type CostModelParams = Map Text Int64 Source #
A raw representation of the ledger's cost model parameters.
The associated keys/names to the parameter values are arbitrarily set by the plutus team; the ledger does not hold any such names.
See Note [Cost model parameters]
toCostModelParams ∷ IsParamName p ⇒ [(p, Int64)] → CostModelParams Source #
Untags the plutus version from the typed cost model parameters and returns their raw textual form (internally used by CostModelInterface).
assertWellFormedCostModelParams ∷ MonadError CostModelApplyError m ⇒ CostModelParams → m () Source #
class (Enum a, Bounded a) ⇒ IsParamName a where Source #
A parameter name for different plutus versions.
Each Plutus version should expose such an enumeration as an ADT and create
an instance of ParamName
out of it.
A valid parameter name has to be enumeration, bounded, ordered, and prettyprintable to a "lower-Kebab" string.
showParamName ∷ a → Text Source #
Produce the raw textual form for a given typed-by-plutus-version cost model parameter
Any implementation *must be* an injective function.
The GIsParamName
generic implementation guarantees injectivity.
readParamName ∷ Text → Maybe a Source #
default implementation that inverts the showParamName operation (not very efficient)
Instances
IsParamName ParamName Source # | |
Defined in PlutusLedgerApi.V1.ParamName | |
IsParamName ParamName Source # | |
Defined in PlutusLedgerApi.V2.ParamName | |
IsParamName ParamName Source # | |
Defined in PlutusLedgerApi.V3.ParamName | |
(Enum (GenericParamName a), Bounded (GenericParamName a), Generic a, GIsParamName (Rep a)) ⇒ IsParamName (GenericParamName a) Source # | |
Defined in PlutusLedgerApi.Common.ParamName showParamName ∷ GenericParamName a → Text Source # readParamName ∷ Text → Maybe (GenericParamName a) Source # |
data GenericParamName a Source #
A Generic wrapper for use with deriving via
Instances
data CostModelApplyError Source #
A fatal error when trying to create a cost given some plain costmodel parameters.
CMUnknownParamError !Text | a costmodel parameter with the give name does not exist in the costmodel to be applied upon |
CMInternalReadError | internal error when we are transforming the applyParams' input to json (should not happen) |
CMInternalWriteError !String | internal error when we are transforming the applied params from json with given jsonstring error (should not happen) |
Instances
data CostModelApplyWarn Source #
A non-fatal warning when trying to create a cost given some plain costmodel parameters.
CMTooManyParamsWarn | See Note [Cost model parameters from the ledger's point of view] |
| |
CMTooFewParamsWarn | See Note [Cost model parameters from the ledger's point of view] |
|
Instances
Pretty CostModelApplyWarn | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface pretty ∷ CostModelApplyWarn → Doc ann Source # prettyList ∷ [CostModelApplyWarn] → Doc ann Source # |
Evaluation context
data EvaluationContext Source #
An opaque type that contains all the static parameters that the evaluator needs to evaluate a script. This is so that they can be computed once and cached, rather than being recomputed on every evaluation.
Different protocol versions may require different bundles of machine parameters, which allows us for
example to tweak the shape of the costing function of a builtin, so that the builtin costs less.
Currently this means that we have to create multiple DefaultMachineParameters
per language
version, which we put into a cache (represented by an association list) in order to avoid costly
recomputation of machine parameters.
In order to get the appropriate DefaultMachineParameters
at validation time we look it up in the
cache using a semantics variant as a key. We compute the semantics variant from the protocol
version using the stored function. Note that the semantics variant depends on the language version
too, but the latter is known statically (because each language version has its own evaluation
context), hence there's no reason to require it to be provided at runtime.
To say it differently, there's a matrix of semantics variants indexed by (LL, PV) pairs and we
cache its particular row corresponding to the statically given LL in an EvaluationContext
.
The reason why we associate a DefaultMachineParameters
with a semantics variant rather than a
protocol version are
- generally there are far more protocol versions than semantics variants supported by a specific language version, so we save on pointless duplication of bundles of machine parameters
- builtins don't know anything about protocol versions, only semantics variants. It is therefore more semantically precise to associate bundles of machine parameters with semantics variants than with protocol versions
EvaluationContext | |
|
Instances
mkDynEvaluationContext ∷ MonadError CostModelApplyError m ⇒ PlutusLedgerLanguage → [BuiltinSemanticsVariant DefaultFun] → (MajorProtocolVersion → BuiltinSemanticsVariant DefaultFun) → CostModelParams → m EvaluationContext Source #
Create an EvaluationContext
given all builtin semantics variants supported by the provided
language version.
The input is a Map
of Text
s to cost integer values (aka CostModelParams
, CostModel
)
See Note [Inlining meanings of builtins].
IMPORTANT: the toSemVar
argument computes the semantics variant for each MajorProtocolVersion
and it must only return semantics variants from the semVars
list, as well as cover ANY
MajorProtocolVersion
, including those that do not exist yet (i.e. toSemVar
must never fail).
IMPORTANT: The evaluation context of every Plutus version must be recreated upon a protocol update with the updated cost model parameters.
∷ MonadError EvaluationError m | |
⇒ PlutusLedgerLanguage | the Plutus ledger language of the script under execution. |
→ MajorProtocolVersion | which major protocol version to run the operation in |
→ ScriptForEvaluation | the script to evaluate |
→ [Data] | the arguments that the script's underlying term will be applied to |
→ m (Term NamedDeBruijn DefaultUni DefaultFun ()) |
Shared helper for the evaluation functions: evaluateScriptCounting
and evaluateScriptRestricting
,
Given a ScriptForEvaluation
:
1) applies the term to a list of Data
arguments (e.g. Datum, Redeemer, ScriptContext
)
2) checks that the applied-term is well-scoped
3) returns the applied-term
Supporting types used in the context types
Builtins
data BuiltinByteString Source #
An opaque type representing Plutus Core ByteStrings.
Instances
toBuiltin ∷ HasToBuiltin a ⇒ a → ToBuiltin a Source #
fromBuiltin ∷ HasFromBuiltin arep ⇒ arep → FromBuiltin arep Source #
toOpaque ∷ HasToOpaque a arep ⇒ a → arep Source #
fromOpaque ∷ HasFromOpaque arep a ⇒ arep → a Source #
Data
A generic "data" type.
The main constructor Constr
represents a datatype value in sum-of-products
form: Constr i args
represents a use of the i
th constructor along with its arguments.
The other constructors are various primitives.
Instances
data BuiltinData Source #
A type corresponding to the Plutus Core builtin equivalent of Data
.
The point of this type is to be an opaque equivalent of Data
, so as to
ensure that it is only used in ways that the compiler can handle.
As such, you should use this type in your on-chain code, and in any data structures that you want to be representable on-chain.
For off-chain usage, there are conversion functions builtinDataToData
and
dataToBuiltinData
, but note that these will not work on-chain.
Instances
A typeclass for types that can be converted to and from BuiltinData
.
toBuiltinData ∷ a → BuiltinData Source #
Convert a value to BuiltinData
.
Instances
class FromData a where Source #
fromBuiltinData ∷ BuiltinData → Maybe a Source #
Convert a value from BuiltinData
, returning Nothing
if this fails.