Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 {}
- 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 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
- 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.
CostingFun | |
|
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.
unimplementedCostingFun :: b -> CostingFun a Source #
Instances
A wrapped CostingInteger
that is supposed to be used as an intercept.
Instances
A wrapped CostingInteger
that is supposed to be used as a slope.
Instances
FromJSON Slope | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.JSON parseJSON :: Value -> Parser Slope parseJSONList :: Value -> Parser [Slope] | |
ToJSON Slope | |
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.36.0.0-7ehJj5tIPqoJIiiivXkX9N" '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.
Instances
newtype Coefficient1 Source #
A wrapped CostingInteger
that is supposed to be used as the degree 1
coefficient of a polynomial.
Instances
newtype Coefficient2 Source #
A wrapped CostingInteger
that is supposed to be used as the degree 2
coefficient of a polynomial.
Instances
newtype Coefficient00 Source #
A wrapped CostingInteger
that is supposed to be used as the degree (0,0)
coefficient of a two-variable polynomial.
Instances
newtype Coefficient10 Source #
A wrapped CostingInteger
that is supposed to be used as the degree (1,0)
coefficient of a two-variable polynomial.
Instances
newtype Coefficient01 Source #
A wrapped CostingInteger
that is supposed to be used as the degree (0,1)
coefficient of a two-variable polynomial.
Instances
newtype Coefficient20 Source #
A wrapped CostingInteger
that is supposed to be used as the degree (2,0)
coefficient of a two-variable polynomial.
Instances
newtype Coefficient11 Source #
A wrapped CostingInteger
that is supposed to be used as the degree (1,1)
coefficient of a two-variable polynomial.
Instances
newtype Coefficient02 Source #
A wrapped CostingInteger
that is supposed to be used as the degree (0,2)
coefficient of a two-variable polynomial.
Instances
data OneVariableLinearFunction Source #
s * x + I
Instances
data OneVariableQuadraticFunction Source #
c0 + c1*x + c2*x^2
Instances
data TwoVariableLinearFunction Source #
s1 * x + s2 * y + I
Instances
data TwoVariableQuadraticFunction Source #
c00 + c10*x + c01*y + c20*x^2 + c11*c*y + c02*y^2
Instances
data ModelSubtractedSizes Source #
s * (x - y) + I
Instances
data ModelConstantOrLinear Source #
NB: this is subsumed by ModelConstantOrOneArgument, but we have to keep it for the time being. See Note [Backward compatibility for costing functions]. | if p then s*x else c; p depends on usage
Instances
data ModelConstantOrOneArgument Source #
if p then f(x) else c; p depends on usage
Instances
data ModelConstantOrTwoArguments Source #
if p then f(x,y) else c; p depends on usage
Instances
data ModelOneArgument Source #
Instances
data ModelTwoArguments Source #
Instances
data ModelThreeArguments Source #
Instances
data ModelFourArguments Source #
Instances
data ModelFiveArguments Source #
Instances
data ModelSixArguments Source #
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 #