Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
PlutusCore.Evaluation.Machine.ExMemoryUsage
Synopsis
- data CostRose = CostRose !CostingInteger ![CostRose]
- singletonRose ∷ CostingInteger → CostRose
- class ExMemoryUsage a where
- memoryUsage ∷ a → CostRose
- flattenCostRose ∷ CostRose → CostStream
- newtype LiteralByteSize = LiteralByteSize {}
Documentation
A lazy tree of costs. Convenient for calculating the costs of values of built-in types, because
they may have arbitrary branching (in particular a Data
object can contain a list of Data
objects inside of it).
CostRose
gets collapsed to a lazy linear structure down the pipeline, so that we can
stream the costs to the outside where, say, the CEK machine picks them up one by one and handles
somehow (in particular, subtracts from the remaining budget).
Constructors
CostRose !CostingInteger ![CostRose] |
singletonRose ∷ CostingInteger → CostRose Source #
Create a CostRose
containing a single cost.
class ExMemoryUsage a where Source #
Methods
memoryUsage ∷ a → CostRose Source #
Instances
newtype LiteralByteSize Source #
When invoking a built-in function, a value of type LiteralByteSize can be
used transparently as a built-in Integer but with a different size measure:
see Note [Integral types as Integer]. This is required by the
integerToByteString
builtin, which takes an argument w
specifying the
width (in bytes) of the output bytestring (zero-padded to the desired size).
The memory consumed by the function is given by w
, *not* the size of w
.
The LiteralByteSize
type wraps an Integer w
in a newtype whose
ExMemoryUsage
is equal to the number of eight-byte words required to
contain w
bytes, allowing its costing function to work properly.
Constructors
LiteralByteSize | |
Fields |