| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusCore.Evaluation.Machine.CostingFun.Core
Synopsis
- data CostingFun model = CostingFun {
- costingFunCpu ∷ model
- costingFunMemory ∷ model
- class UnimplementedCostingFun a where
- unimplementedCostingFun ∷ b → CostingFun a
- newtype Intercept = Intercept {}
- newtype Slope = Slope {}
- newtype Coefficient0 = Coefficient0 {}
- newtype Coefficient1 = Coefficient1 {}
- newtype Coefficient2 = Coefficient2 {}
- newtype Coefficient00 = Coefficient00 {}
- newtype Coefficient10 = Coefficient10 {}
- newtype Coefficient01 = Coefficient01 {}
- newtype Coefficient20 = Coefficient20 {}
- newtype Coefficient11 = Coefficient11 {}
- newtype Coefficient02 = Coefficient02 {}
- newtype Coefficient12 = Coefficient12 {}
- data OneVariableLinearFunction = OneVariableLinearFunction {}
- data OneVariableQuadraticFunction = OneVariableQuadraticFunction {}
- data TwoVariableLinearFunction = TwoVariableLinearFunction {}
- data TwoVariableQuadraticFunction = TwoVariableQuadraticFunction {
- twoVariableQuadraticFunctionMinimum ∷ CostingInteger
- twoVariableQuadraticFunctionC00 ∷ Coefficient00
- twoVariableQuadraticFunctionC10 ∷ Coefficient10
- twoVariableQuadraticFunctionC01 ∷ Coefficient01
- twoVariableQuadraticFunctionC20 ∷ Coefficient20
- twoVariableQuadraticFunctionC11 ∷ Coefficient11
- twoVariableQuadraticFunctionC02 ∷ Coefficient02
- data ExpModCostingFunction = ExpModCostingFunction {}
- data ModelSubtractedSizes = ModelSubtractedSizes {}
- data ModelConstantOrLinear = ModelConstantOrLinear {}
- data ModelConstantOrOneArgument = ModelConstantOrOneArgument {}
- data ModelConstantOrTwoArguments = ModelConstantOrTwoArguments {}
- data ModelOneArgument
- data ModelTwoArguments
- = ModelTwoArgumentsConstantCost CostingInteger
- | ModelTwoArgumentsLinearInX OneVariableLinearFunction
- | ModelTwoArgumentsLinearInY OneVariableLinearFunction
- | ModelTwoArgumentsLinearInXAndY TwoVariableLinearFunction
- | ModelTwoArgumentsAddedSizes OneVariableLinearFunction
- | ModelTwoArgumentsSubtractedSizes ModelSubtractedSizes
- | ModelTwoArgumentsMultipliedSizes OneVariableLinearFunction
- | ModelTwoArgumentsMinSize OneVariableLinearFunction
- | ModelTwoArgumentsMaxSize OneVariableLinearFunction
- | ModelTwoArgumentsLinearOnDiagonal ModelConstantOrLinear
- | ModelTwoArgumentsConstOffDiagonal ModelConstantOrOneArgument
- | ModelTwoArgumentsConstAboveDiagonal ModelConstantOrTwoArguments
- | ModelTwoArgumentsConstBelowDiagonal ModelConstantOrTwoArguments
- | ModelTwoArgumentsQuadraticInY OneVariableQuadraticFunction
- | ModelTwoArgumentsQuadraticInXAndY TwoVariableQuadraticFunction
- data ModelThreeArguments
- = ModelThreeArgumentsConstantCost CostingInteger
- | ModelThreeArgumentsLinearInX OneVariableLinearFunction
- | ModelThreeArgumentsLinearInY OneVariableLinearFunction
- | ModelThreeArgumentsLinearInZ OneVariableLinearFunction
- | ModelThreeArgumentsQuadraticInZ OneVariableQuadraticFunction
- | ModelThreeArgumentsLiteralInYOrLinearInZ OneVariableLinearFunction
- | ModelThreeArgumentsLinearInMaxYZ OneVariableLinearFunction
- | ModelThreeArgumentsLinearInYAndZ TwoVariableLinearFunction
- | ModelThreeArgumentsQuadraticInYAndZ TwoVariableQuadraticFunction
- | ModelThreeArgumentsExpModCost ExpModCostingFunction
- data ModelFourArguments = ModelFourArgumentsConstantCost CostingInteger
- data ModelFiveArguments = ModelFiveArgumentsConstantCost CostingInteger
- data ModelSixArguments = ModelSixArgumentsConstantCost CostingInteger
- runCostingFunOneArgument ∷ ExMemoryUsage a1 ⇒ CostingFun ModelOneArgument → a1 → ExBudgetStream
- runCostingFunTwoArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2) ⇒ CostingFun ModelTwoArguments → a1 → a2 → ExBudgetStream
- runCostingFunThreeArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3) ⇒ CostingFun ModelThreeArguments → a1 → a2 → a3 → ExBudgetStream
- runCostingFunFourArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4) ⇒ CostingFun ModelFourArguments → a1 → a2 → a3 → a4 → ExBudgetStream
- runCostingFunFiveArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4, ExMemoryUsage a5) ⇒ CostingFun ModelFiveArguments → a1 → a2 → a3 → a4 → a5 → ExBudgetStream
- runCostingFunSixArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4, ExMemoryUsage a5, ExMemoryUsage a6) ⇒ CostingFun ModelSixArguments → a1 → a2 → a3 → a4 → a5 → a6 → ExBudgetStream
- class Eq a ⇒ Hashable a
Documentation
data CostingFun model Source #
A type of costing functions parametric over a model type. In practice the we have one model type `ModelNArguments` for every N, where N is the arity of the builtin whose costs we want to model. Each model type has a number of constructors defining different "shapes" of N-parameter functions which calculate a cost given the sizes of the builtin's arguments.
Constructors
| CostingFun | |
Fields
| |
Instances
class UnimplementedCostingFun a where Source #
In the initial stages of implementing a new builtin it is necessary to
provide a temporary costing function which is used until the builtin has been
properly costed: `see CostModelGeneration.md`. Each `ModelNArguments` type
defines an instance of this class where unimplementedCostingFun is a
constant costing function which returns a very high cost for all inputs.
This prevents new functions from being used in situations where costs are
important until a sensible costing function has been implemented.
Methods
unimplementedCostingFun ∷ b → CostingFun a Source #
Instances
A wrapped CostingInteger that is supposed to be used as an intercept.
Constructors
| Intercept | |
Fields | |
Instances
| FromJSON Intercept Source # | |
| ToJSON Intercept Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.JSON Methods toEncoding ∷ Intercept → Encoding toJSONList ∷ [Intercept] → Value toEncodingList ∷ [Intercept] → Encoding | |
| Generic Intercept Source # | |
| Num Intercept Source # | |
| Show Intercept Source # | |
| NFData Intercept Source # | |
| Eq Intercept Source # | |
| Lift Intercept Source # | |
| type Rep Intercept Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.Core type Rep Intercept = D1 ('MetaData "Intercept" "PlutusCore.Evaluation.Machine.CostingFun.Core" "plutus-core-1.53.0.0-inplace" 'True) (C1 ('MetaCons "Intercept" 'PrefixI 'True) (S1 ('MetaSel ('Just "unIntercept") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CostingInteger))) | |
A wrapped CostingInteger that is supposed to be used as a slope.
Constructors
| Slope | |
Fields | |
Instances
| FromJSON Slope Source # | |
| ToJSON Slope Source # | |
| Generic Slope Source # | |
| Num Slope Source # | |
| Show Slope Source # | |
| NFData Slope Source # | |
| Eq Slope Source # | |
| Lift Slope Source # | |
| type Rep Slope Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.Core type Rep Slope = D1 ('MetaData "Slope" "PlutusCore.Evaluation.Machine.CostingFun.Core" "plutus-core-1.53.0.0-inplace" 'True) (C1 ('MetaCons "Slope" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSlope") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CostingInteger))) | |
newtype Coefficient0 Source #
A wrapped CostingInteger that is supposed to be used as the degree 0
coefficient of a polynomial.
Constructors
| Coefficient0 | |
Fields | |
Instances
newtype Coefficient1 Source #
A wrapped CostingInteger that is supposed to be used as the degree 1
coefficient of a polynomial.
Constructors
| Coefficient1 | |
Fields | |
Instances
newtype Coefficient2 Source #
A wrapped CostingInteger that is supposed to be used as the degree 2
coefficient of a polynomial.
Constructors
| Coefficient2 | |
Fields | |
Instances
newtype Coefficient00 Source #
A wrapped CostingInteger that is supposed to be used as the degree (0,0)
coefficient of a two-variable polynomial.
Constructors
| Coefficient00 | |
Fields | |
Instances
newtype Coefficient10 Source #
A wrapped CostingInteger that is supposed to be used as the degree (1,0)
coefficient of a two-variable polynomial.
Constructors
| Coefficient10 | |
Fields | |
Instances
newtype Coefficient01 Source #
A wrapped CostingInteger that is supposed to be used as the degree (0,1)
coefficient of a two-variable polynomial.
Constructors
| Coefficient01 | |
Fields | |
Instances
newtype Coefficient20 Source #
A wrapped CostingInteger that is supposed to be used as the degree (2,0)
coefficient of a two-variable polynomial.
Constructors
| Coefficient20 | |
Fields | |
Instances
newtype Coefficient11 Source #
A wrapped CostingInteger that is supposed to be used as the degree (1,1)
coefficient of a two-variable polynomial.
Constructors
| Coefficient11 | |
Fields | |
Instances
newtype Coefficient02 Source #
A wrapped CostingInteger that is supposed to be used as the degree (0,2)
coefficient of a two-variable polynomial.
Constructors
| Coefficient02 | |
Fields | |
Instances
newtype Coefficient12 Source #
A wrapped CostingInteger that is supposed to be used as the degree (1,2)
coefficient of a two-variable polynomial.
Constructors
| Coefficient12 | |
Fields | |
Instances
data OneVariableLinearFunction Source #
s * x + I
Constructors
| OneVariableLinearFunction | |
Instances
data OneVariableQuadraticFunction Source #
c0 + c1*x + c2*x^2
Constructors
| OneVariableQuadraticFunction | |
Instances
data TwoVariableLinearFunction Source #
s1 * x + s2 * y + I
Constructors
| TwoVariableLinearFunction | |
Instances
data TwoVariableQuadraticFunction Source #
c00 + c10*x + c01*y + c20*x^2 + c11*c*y + c02*y^2
Constructors
Instances
data ExpModCostingFunction Source #
c00 + c01x*y + c12x*y^2
This is used only for expModInteger, whose costing is quite complex.
Constructors
| ExpModCostingFunction | |
Instances
data ModelSubtractedSizes Source #
s * (x - y) + I
Constructors
| ModelSubtractedSizes | |
Instances
data ModelConstantOrLinear Source #
if p then s*x else c; p depends on usage
Constructors
| ModelConstantOrLinear | |
Instances
data ModelConstantOrOneArgument Source #
if p then f(x) else c; p depends on usage
Constructors
| ModelConstantOrOneArgument | |
Instances
data ModelConstantOrTwoArguments Source #
if p then f(x,y) else c; p depends on usage
Constructors
| ModelConstantOrTwoArguments | |
Instances
data ModelOneArgument Source #
Constructors
| ModelOneArgumentConstantCost CostingInteger | |
| ModelOneArgumentLinearInX OneVariableLinearFunction |
Instances
data ModelTwoArguments Source #
Constructors
Instances
data ModelThreeArguments Source #
Constructors
Instances
data ModelFourArguments Source #
Constructors
| ModelFourArgumentsConstantCost CostingInteger |
Instances
data ModelFiveArguments Source #
Constructors
| ModelFiveArgumentsConstantCost CostingInteger |
Instances
data ModelSixArguments Source #
Constructors
| ModelSixArgumentsConstantCost CostingInteger |
Instances
runCostingFunOneArgument ∷ ExMemoryUsage a1 ⇒ CostingFun ModelOneArgument → a1 → ExBudgetStream Source #
runCostingFunTwoArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2) ⇒ CostingFun ModelTwoArguments → a1 → a2 → ExBudgetStream Source #
runCostingFunThreeArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3) ⇒ CostingFun ModelThreeArguments → a1 → a2 → a3 → ExBudgetStream Source #
runCostingFunFourArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4) ⇒ CostingFun ModelFourArguments → a1 → a2 → a3 → a4 → ExBudgetStream Source #
runCostingFunFiveArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4, ExMemoryUsage a5) ⇒ CostingFun ModelFiveArguments → a1 → a2 → a3 → a4 → a5 → ExBudgetStream Source #
runCostingFunSixArguments ∷ (ExMemoryUsage a1, ExMemoryUsage a2, ExMemoryUsage a3, ExMemoryUsage a4, ExMemoryUsage a5, ExMemoryUsage a6) ⇒ CostingFun ModelSixArguments → a1 → a2 → a3 → a4 → a5 → a6 → ExBudgetStream Source #
class Eq a ⇒ Hashable a Source #
The class of types that can be converted to a hash value.
Minimal implementation: hashWithSalt.
Hashable is intended exclusively for use in in-memory data structures.
.
Hashable does not have a fixed standard.
This allows it to improve over time.
.
Because it does not have a fixed standard, different computers or computers on different versions of the code will observe different hash values.
As such, Hashable is not recommended for use other than in-memory datastructures.
Specifically, Hashable is not intended for network use or in applications which persist hashed values.
For stable hashing use named hashes: sha256, crc32, xxhash etc.
If you are looking for Hashable instance in time package,
check time-compat