Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A JSON representation of costing functions for Plutus Core builtins which produces a simple cost model which can be used from Agda and other executables
Synopsis
- data LinearFunction = LinearFunction {}
- data TwoVariableLinearFunction = TwoVariableLinearFunction {}
- data OneVariableQuadraticFunction = OneVariableQuadraticFunction {}
- data TwoVariableQuadraticFunction = TwoVariableQuadraticFunction {}
- data Model
- = ConstantCost Integer
- | AddedSizes LinearFunction
- | MultipliedSizes LinearFunction
- | MinSize LinearFunction
- | MaxSize LinearFunction
- | LinearInX LinearFunction
- | LinearInY LinearFunction
- | LinearInZ LinearFunction
- | LiteralInYOrLinearInZ LinearFunction
- | LinearInMaxYZ LinearFunction
- | LinearInYAndZ TwoVariableLinearFunction
- | QuadraticInY OneVariableQuadraticFunction
- | QuadraticInZ OneVariableQuadraticFunction
- | QuadraticInXAndY TwoVariableQuadraticFunction
- | SubtractedSizes LinearFunction Integer
- | ConstAboveDiagonal Integer Model
- | ConstBelowDiagonal Integer Model
- | ConstOffDiagonal Integer Model
- data CpuAndMemoryModel = CpuAndMemoryModel {}
Documentation
data LinearFunction Source #
Instances
FromJSON LinearFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON parseJSON ∷ Value → Parser LinearFunction parseJSONList ∷ Value → Parser [LinearFunction] | |
Show LinearFunction Source # | |
Lift LinearFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON lift ∷ Quote m ⇒ LinearFunction → m Exp Source # liftTyped ∷ ∀ (m ∷ Type → Type). Quote m ⇒ LinearFunction → Code m LinearFunction Source # |
data TwoVariableLinearFunction Source #
Instances
FromJSON TwoVariableLinearFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON parseJSON ∷ Value → Parser TwoVariableLinearFunction parseJSONList ∷ Value → Parser [TwoVariableLinearFunction] | |
Show TwoVariableLinearFunction Source # | |
Lift TwoVariableLinearFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON lift ∷ Quote m ⇒ TwoVariableLinearFunction → m Exp Source # liftTyped ∷ ∀ (m ∷ Type → Type). Quote m ⇒ TwoVariableLinearFunction → Code m TwoVariableLinearFunction Source # |
data OneVariableQuadraticFunction Source #
Instances
FromJSON OneVariableQuadraticFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON parseJSON ∷ Value → Parser OneVariableQuadraticFunction parseJSONList ∷ Value → Parser [OneVariableQuadraticFunction] | |
Show OneVariableQuadraticFunction Source # | |
Lift OneVariableQuadraticFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON lift ∷ Quote m ⇒ OneVariableQuadraticFunction → m Exp Source # liftTyped ∷ ∀ (m ∷ Type → Type). Quote m ⇒ OneVariableQuadraticFunction → Code m OneVariableQuadraticFunction Source # |
data TwoVariableQuadraticFunction Source #
Instances
FromJSON TwoVariableQuadraticFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON parseJSON ∷ Value → Parser TwoVariableQuadraticFunction parseJSONList ∷ Value → Parser [TwoVariableQuadraticFunction] | |
Show TwoVariableQuadraticFunction Source # | |
Lift TwoVariableQuadraticFunction Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON lift ∷ Quote m ⇒ TwoVariableQuadraticFunction → m Exp Source # liftTyped ∷ ∀ (m ∷ Type → Type). Quote m ⇒ TwoVariableQuadraticFunction → Code m TwoVariableQuadraticFunction Source # |
This type reflects what is actually in the JSON. The stuff in CostingFun.Core and CostingFun.JSON is much more rigid, allowing parsing only for the model types applicable to the various ModelNArguments types; it also requires entries for everything in DefaultFun. Using the type defined here allows us to be more flexible and parse stuff that's not exactly what's expected in builtinCostModel.json.
data CpuAndMemoryModel Source #
A CPU usage modelling function and a memory usage modelling function bundled together
Instances
FromJSON CpuAndMemoryModel Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON parseJSON ∷ Value → Parser CpuAndMemoryModel parseJSONList ∷ Value → Parser [CpuAndMemoryModel] | |
Show CpuAndMemoryModel Source # | |
Lift CpuAndMemoryModel Source # | |
Defined in PlutusCore.Evaluation.Machine.CostingFun.SimpleJSON lift ∷ Quote m ⇒ CpuAndMemoryModel → m Exp Source # liftTyped ∷ ∀ (m ∷ Type → Type). Quote m ⇒ CpuAndMemoryModel → Code m CpuAndMemoryModel Source # |