plutus-core-1.56.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Value

Synopsis

Documentation

data Value Source #

The underlying type of the UPLC built-in type Value.

Instances

Instances details
Generic Value Source # 
Instance details

Defined in PlutusCore.Value

Associated Types

type Rep ValueTypeType Source #

Methods

fromValueRep Value x Source #

toRep Value x → Value Source #

Show Value Source # 
Instance details

Defined in PlutusCore.Value

NFData Value Source # 
Instance details

Defined in PlutusCore.Value

Methods

rnfValue → () Source #

Eq Value Source # 
Instance details

Defined in PlutusCore.Value

Methods

(==)ValueValueBool Source #

(/=)ValueValueBool Source #

Hashable Value Source # 
Instance details

Defined in PlutusCore.Value

Methods

hashWithSaltIntValueInt Source #

hashValueInt Source #

ExMemoryUsage Value Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemoryUsage

Flat Value Source # 
Instance details

Defined in PlutusCore.Value

Pretty Value Source # 
Instance details

Defined in PlutusCore.Value

Methods

prettyValueDoc ann Source #

prettyList ∷ [Value] → Doc ann Source #

Serialise Value Source # 
Instance details

Defined in PlutusCore.Value

PrettyBy ConstConfig Value Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigValueDoc ann Source #

prettyListByConstConfig → [Value] → Doc ann Source #

KnownBuiltinTypeIn DefaultUni term ValueMakeKnownIn DefaultUni term Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnownValueBuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term ValueReadKnownIn DefaultUni term Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown ∷ term → ReadKnownM Value Source #

Contains DefaultUni Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeAst tyname DefaultUni ValueKnownTypeAst tyname DefaultUni Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAstType tyname DefaultUni () Source #

type Rep Value Source # 
Instance details

Defined in PlutusCore.Value

type IsBuiltin DefaultUni Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

data K Source #

A ByteString with maximum length of maxKeyLen bytes.

Instances

Instances details
Generic K Source # 
Instance details

Defined in PlutusCore.Value

Associated Types

type Rep KTypeType Source #

Methods

fromKRep K x Source #

toRep K x → K Source #

Show K Source # 
Instance details

Defined in PlutusCore.Value

Methods

showsPrecIntKShowS Source #

showKString Source #

showList ∷ [K] → ShowS Source #

NFData K Source # 
Instance details

Defined in PlutusCore.Value

Methods

rnfK → () Source #

Eq K Source # 
Instance details

Defined in PlutusCore.Value

Methods

(==)KKBool Source #

(/=)KKBool Source #

Ord K Source # 
Instance details

Defined in PlutusCore.Value

Methods

compareKKOrdering Source #

(<)KKBool Source #

(<=)KKBool Source #

(>)KKBool Source #

(>=)KKBool Source #

maxKKK Source #

minKKK Source #

Hashable K Source # 
Instance details

Defined in PlutusCore.Value

Methods

hashWithSaltIntKInt Source #

hashKInt Source #

Flat K Source # 
Instance details

Defined in PlutusCore.Value

Methods

encodeKEncoding Source #

decodeGet K Source #

sizeKNumBitsNumBits Source #

Serialise K Source # 
Instance details

Defined in PlutusCore.Value

PrettyBy ConstConfig K Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Methods

prettyByConstConfigKDoc ann Source #

prettyListByConstConfig → [K] → Doc ann Source #

type Rep K Source # 
Instance details

Defined in PlutusCore.Value

type Rep K = D1 ('MetaData "K" "PlutusCore.Value" "plutus-core-1.56.0.0-inplace" 'True) (C1 ('MetaCons "UnsafeK" 'PrefixI 'True) (S1 ('MetaSel ('Just "unK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

data Quantity Source #

A signed 128-bit integer quantity.

Instances

Instances details
Bounded Quantity Source # 
Instance details

Defined in PlutusCore.Value

Generic Quantity Source # 
Instance details

Defined in PlutusCore.Value

Associated Types

type Rep QuantityTypeType Source #

Show Quantity Source # 
Instance details

Defined in PlutusCore.Value

NFData Quantity Source # 
Instance details

Defined in PlutusCore.Value

Methods

rnfQuantity → () Source #

Eq Quantity Source # 
Instance details

Defined in PlutusCore.Value

Ord Quantity Source # 
Instance details

Defined in PlutusCore.Value

Hashable Quantity Source # 
Instance details

Defined in PlutusCore.Value

Flat Quantity Source # 
Instance details

Defined in PlutusCore.Value

Pretty Quantity Source # 
Instance details

Defined in PlutusCore.Value

Methods

prettyQuantityDoc ann Source #

prettyList ∷ [Quantity] → Doc ann Source #

Serialise Quantity Source # 
Instance details

Defined in PlutusCore.Value

PrettyBy ConstConfig Quantity Source # 
Instance details

Defined in PlutusCore.Pretty.PrettyConst

type Rep Quantity Source # 
Instance details

Defined in PlutusCore.Value

type Rep Quantity = D1 ('MetaData "Quantity" "PlutusCore.Value" "plutus-core-1.56.0.0-inplace" 'True) (C1 ('MetaCons "UnsafeQuantity" 'PrefixI 'True) (S1 ('MetaSel ('Just "unQuantity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

quantityIntegerMaybe Quantity Source #

Smart constructor for Quantity that validates bounds.

zeroQuantityQuantity Source #

The zero quantity.

addQuantityQuantityQuantityMaybe Quantity Source #

Safely add two quantities, checking for overflow.

unpackValueNestedMap Source #

Unpack a Value into a map from (currency symbol, token name) to quantity.

The map is guaranteed to not contain empty inner map or zero quantity.

packNestedMapValue Source #

Pack a map from (currency symbol, token name) to quantity into a Value.

The map will be filtered so that it does not contain empty inner map or zero quantity.

toListValue → [(K, [(K, Quantity)])] Source #

totalSizeValueInt Source #

Total size, i.e., the number of distinct `(currency symbol, token name)` pairs contained in the Value.

maxInnerSizeValueInt Source #

Size of the largest inner map.

insertCoinByteStringByteStringIntegerValueBuiltinResult Value Source #

\(O(\log \max(m, k))\), where \(m\) is the size of the outer map, and \(k\) is the size of the largest inner map.

deleteCoinByteStringByteStringValueValue Source #

\(O(\log \max(m, k))\)

scaleValueIntegerValueBuiltinResult Value Source #

\(O(n)\). Scale each token by the given constant factor.

lookupCoinByteStringByteStringValueInteger Source #

\(O(\log \max(m, k))\)

valueContainsValueValueBuiltinResult Bool Source #

\(O(n_{2}\log \max(m_{1}, k_{1}))\), where \(n_{2}\) is the total size of the second Value, \(m_{1}\) is the size of the outer map in the first Value and \(k_{1}\) is the size of the largest inner map in the first Value.

a contains b if for each (currency, token, quantity) in b, lookup currency token a >= quantity.

Both values must not contain negative amounts.

unionValueValueValueBuiltinResult Value Source #

\(O(n_{1}) + O(n_{2})\), where \(n_{1}\) and \(n_{2}\) are the total sizes (i.e., sum of inner map sizes) of the two maps.

Shortcircuits if either value is empty.

Since unionValue is commutative, we switch the arguments whenever the second value is larger in total size than the first one. We have found through experimentation that this results in better performance in practice.

valueDataValueData Source #

\(O(n)\). Encodes Value as Data, in the same way as non-builtin Value. This is the denotation of ValueData in Plutus V1, V2 and V3.

unValueDataDataBuiltinResult Value Source #

\(O(n \log n)\). Decodes Data into Value, in the same way as non-builtin Value. This is the denotation of UnValueData in Plutus V1, V2 and V3.