Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class (Enum a, Bounded a) ⇒ IsParamName a where
- showParamName ∷ a → Text
- readParamName ∷ Text → Maybe a
- newtype GenericParamName a = GenericParamName a
- toCostModelParams ∷ IsParamName p ⇒ [(p, Int64)] → CostModelParams
- tagWithParamNames ∷ ∀ k m. (Enum k, Bounded k, MonadError CostModelApplyError m, MonadWriter [CostModelApplyWarn] m) ⇒ [Int64] → m [(k, Int64)]
- data CostModelApplyError
- data CostModelApplyWarn
- = CMTooManyParamsWarn {
- cmExpected ∷ !Int
- cmActual ∷ !Int
- | CMTooFewParamsWarn {
- cmExpected ∷ !Int
- cmActual ∷ !Int
- = CMTooManyParamsWarn {
Documentation
class (Enum a, Bounded a) ⇒ IsParamName a where Source #
A parameter name for different plutus versions.
Each Plutus version should expose such an enumeration as an ADT and create
an instance of ParamName
out of it.
A valid parameter name has to be enumeration, bounded, ordered, and prettyprintable to a "lower-Kebab" string.
showParamName ∷ a → Text Source #
Produce the raw textual form for a given typed-by-plutus-version cost model parameter
Any implementation *must be* an injective function.
The GIsParamName
generic implementation guarantees injectivity.
readParamName ∷ Text → Maybe a Source #
default implementation that inverts the showParamName operation (not very efficient)
Instances
IsParamName ParamName Source # | |
Defined in PlutusLedgerApi.V1.ParamName | |
IsParamName ParamName Source # | |
Defined in PlutusLedgerApi.V2.ParamName | |
IsParamName ParamName Source # | |
Defined in PlutusLedgerApi.V3.ParamName | |
(Enum (GenericParamName a), Bounded (GenericParamName a), Generic a, GIsParamName (Rep a)) ⇒ IsParamName (GenericParamName a) Source # | |
Defined in PlutusLedgerApi.Common.ParamName showParamName ∷ GenericParamName a → Text Source # readParamName ∷ Text → Maybe (GenericParamName a) Source # |
newtype GenericParamName a Source #
A Generic wrapper for use with deriving via
Instances
toCostModelParams ∷ IsParamName p ⇒ [(p, Int64)] → CostModelParams Source #
Untags the plutus version from the typed cost model parameters and returns their raw textual form (internally used by CostModelInterface).
tagWithParamNames ∷ ∀ k m. (Enum k, Bounded k, MonadError CostModelApplyError m, MonadWriter [CostModelApplyWarn] m) ⇒ [Int64] → m [(k, Int64)] Source #
Given an ordered list of parameter values, tag them with their parameter names. If the passed parameter values are more than expected: the function will ignore the extraneous values at the tail of the list, if the passed values are less than expected: the function will throw an error; for more information, see Note [Cost model parameters from the ledger's point of view]
data CostModelApplyError Source #
A fatal error when trying to create a cost given some plain costmodel parameters.
CMUnknownParamError !Text | a costmodel parameter with the give name does not exist in the costmodel to be applied upon |
CMInternalReadError | internal error when we are transforming the applyParams' input to json (should not happen) |
CMInternalWriteError !String | internal error when we are transforming the applied params from json with given jsonstring error (should not happen) |
Instances
data CostModelApplyWarn Source #
A non-fatal warning when trying to create a cost given some plain costmodel parameters.
CMTooManyParamsWarn | See Note [Cost model parameters from the ledger's point of view] |
| |
CMTooFewParamsWarn | See Note [Cost model parameters from the ledger's point of view] |
|
Instances
Pretty CostModelApplyWarn | |
Defined in PlutusCore.Evaluation.Machine.CostModelInterface pretty ∷ CostModelApplyWarn → Doc ann Source # prettyList ∷ [CostModelApplyWarn] → Doc ann Source # |