| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusCore.Value
Synopsis
- data Value
- data K
- k ∷ ByteString → Maybe K
- unK ∷ K → ByteString
- maxKeyLen ∷ Int
- negativeAmounts ∷ Value → Int
- type NestedMap = Map K (Map K Integer)
- unpack ∷ Value → NestedMap
- pack ∷ NestedMap → Value
- empty ∷ Value
- fromList ∷ [(K, [(K, Integer)])] → Value
- toList ∷ Value → [(K, [(K, Integer)])]
- toFlatList ∷ Value → [(K, K, Integer)]
- totalSize ∷ Value → Int
- maxInnerSize ∷ Value → Int
- insertCoin ∷ ByteString → ByteString → Integer → Value → BuiltinResult Value
- deleteCoin ∷ ByteString → ByteString → Value → Value
- lookupCoin ∷ ByteString → ByteString → Value → Integer
- valueContains ∷ Value → Value → BuiltinResult Bool
- unionValue ∷ Value → Value → Value
- valueData ∷ Value → Data
- unValueData ∷ Data → BuiltinResult Value
Documentation
The underlying type of the UPLC built-in type Value.
Instances
A ByteString with maximum length of maxKeyLen bytes.
Instances
| Generic K Source # | |
| Show K Source # | |
| NFData K Source # | |
Defined in PlutusCore.Value | |
| Eq K Source # | |
| Ord K Source # | |
| Hashable K Source # | |
| Flat K Source # | |
| Serialise K Source # | |
| PrettyBy ConstConfig K Source # | |
Defined in PlutusCore.Pretty.PrettyConst Methods prettyBy ∷ ConstConfig → K → Doc ann Source # prettyListBy ∷ ConstConfig → [K] → Doc ann Source # | |
| type Rep K Source # | |
Defined in PlutusCore.Value type Rep K = D1 ('MetaData "K" "PlutusCore.Value" "plutus-core-1.54.0.0-inplace" 'True) (C1 ('MetaCons "UnsafeK" 'PrefixI 'True) (S1 ('MetaSel ('Just "unK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
unK ∷ K → ByteString Source #
negativeAmounts ∷ Value → Int Source #
unpack ∷ Value → NestedMap Source #
Unpack a Value into a map from (currency symbol, token name) to amount.
The map is guaranteed to not contain empty inner map or zero amount.
pack ∷ NestedMap → Value Source #
Pack a map from (currency symbol, token name) to amount into a Value.
The map will be filtered so that it does not contain empty inner map or zero amount.
totalSize ∷ Value → Int Source #
Total size, i.e., the number of distinct `(currency symbol, token name)` pairs
contained in the Value.
maxInnerSize ∷ Value → Int Source #
Size of the largest inner map.
insertCoin ∷ ByteString → ByteString → Integer → Value → BuiltinResult 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.
deleteCoin ∷ ByteString → ByteString → Value → Value Source #
\(O(\log \max(m, k))\)
lookupCoin ∷ ByteString → ByteString → Value → Integer Source #
\(O(\log \max(m, k))\)
valueContains ∷ Value → Value → BuiltinResult 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, amount) in b, if amount > 0, then
lookup currency token a >= amount, and if amount < 0, then
lookup currency token a == amount.
unionValue ∷ Value → Value → 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.