Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
PlutusCore.Builtin.Runtime
Synopsis
- data BuiltinRuntime val
- = BuiltinCostedResult ExBudgetStream ~(BuiltinResult val)
- | BuiltinExpectArgument (val → BuiltinRuntime val)
- | BuiltinExpectForce (BuiltinRuntime val)
- data BuiltinsRuntime fun val = BuiltinsRuntime {
- unBuiltinsRuntime ∷ fun → BuiltinRuntime val
- builtinRuntimeFailure ∷ BuiltinError → BuiltinRuntime val
- lookupBuiltin ∷ fun → BuiltinsRuntime fun val → BuiltinRuntime val
Documentation
data BuiltinRuntime val Source #
A BuiltinRuntime
represents a possibly partial builtin application, including an empty
builtin application (i.e. just the builtin with no arguments).
Applying or type-instantiating a builtin peels off the corresponding constructor from its
BuiltinRuntime
.
BuiltinCostedResult
contains the cost (an ExBudgetStream
) and the result (a
BuiltinResult (HeadSpine val)
) of the builtin application. The cost is stored strictly, since
the evaluator is going to look at it and the result is stored lazily, since it's not supposed to
be forced before accounting for the cost of the application. If the cost exceeds the available
budget, the evaluator discards the result of the builtin application without ever forcing it and
terminates with evaluation failure. Allowing the user to compute something that they don't have
the budget for would be a major bug.
Evaluators that ignore the entire concept of costing (e.g. the CK machine) may of course force the result of the builtin application unconditionally.
Constructors
BuiltinCostedResult ExBudgetStream ~(BuiltinResult val) | |
BuiltinExpectArgument (val → BuiltinRuntime val) | |
BuiltinExpectForce (BuiltinRuntime val) |
Instances
Show (BuiltinRuntime (CkValue uni fun)) Source # | |
Defined in PlutusCore.Evaluation.Machine.Ck | |
Show (BuiltinRuntime (CekValue uni fun ann)) Source # | |
NFData (BuiltinRuntime val) Source # | |
Defined in PlutusCore.Builtin.Runtime Methods rnf ∷ BuiltinRuntime val → () Source # | |
NoThunks (BuiltinRuntime val) Source # | |
Defined in PlutusCore.Builtin.Runtime |
data BuiltinsRuntime fun val Source #
A data
wrapper around a function returning the BuiltinRuntime
of a built-in function.
In order for lookups to be efficient the BuiltinRuntime
s need to be cached, i.e. pulled out
of the function statically. See makeBuiltinMeaning
for how we achieve that.
Constructors
BuiltinsRuntime | |
Fields
|
Instances
(Bounded fun, Enum fun) ⇒ NFData (BuiltinsRuntime fun val) Source # | |
Defined in PlutusCore.Builtin.Runtime Methods rnf ∷ BuiltinsRuntime fun val → () Source # | |
(Bounded fun, Enum fun) ⇒ NoThunks (BuiltinsRuntime fun val) Source # | |
Defined in PlutusCore.Builtin.Runtime |
lookupBuiltin ∷ fun → BuiltinsRuntime fun val → BuiltinRuntime val Source #
Look up the runtime info of a built-in function during evaluation.