Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Ledger.Mary.Value
Synopsis
- newtype PolicyID crypto = PolicyID {
- policyID :: ScriptHash crypto
- newtype AssetName = AssetName {}
- data Value crypto = Value !Integer !(Map (PolicyID crypto) (Map AssetName Integer))
- insert :: (Integer -> Integer -> Integer) -> PolicyID crypto -> AssetName -> Integer -> Value crypto -> Value crypto
- lookup :: PolicyID crypto -> AssetName -> Value crypto -> Integer
- policies :: Value crypto -> Set (PolicyID crypto)
- prune :: Map (PolicyID crypto) (Map AssetName Integer) -> Map (PolicyID crypto) (Map AssetName Integer)
- showValue :: Value crypto -> String
- valueFromList :: Integer -> [(PolicyID era, AssetName, Integer)] -> Value era
Documentation
newtype PolicyID crypto Source #
Policy ID
Constructors
PolicyID | |
Fields
|
Instances
Eq (PolicyID crypto) Source # | |
Ord (PolicyID crypto) Source # | |
Defined in Cardano.Ledger.Mary.Value Methods compare :: PolicyID crypto -> PolicyID crypto -> Ordering # (<) :: PolicyID crypto -> PolicyID crypto -> Bool # (<=) :: PolicyID crypto -> PolicyID crypto -> Bool # (>) :: PolicyID crypto -> PolicyID crypto -> Bool # (>=) :: PolicyID crypto -> PolicyID crypto -> Bool # max :: PolicyID crypto -> PolicyID crypto -> PolicyID crypto # min :: PolicyID crypto -> PolicyID crypto -> PolicyID crypto # | |
Show (PolicyID crypto) Source # | |
NFData (PolicyID crypto) Source # | |
Defined in Cardano.Ledger.Mary.Value | |
Crypto crypto => ToCBOR (PolicyID crypto) Source # | |
Crypto crypto => FromCBOR (PolicyID crypto) Source # | |
NoThunks (PolicyID crypto) Source # | |
Asset Name
Constructors
AssetName | |
Fields |
Instances
The Value representing MultiAssets
Instances
insert :: (Integer -> Integer -> Integer) -> PolicyID crypto -> AssetName -> Integer -> Value crypto -> Value crypto Source #
insert comb policy asset n v, if comb = old new -> old, the integer in the Value is prefered over n if comb = old new -> new, then n is prefered over the integer in the Value if (comb old new) == 0, then that value should not be stored in the Map part of the Value.
policies :: Value crypto -> Set (PolicyID crypto) Source #
Extract the set of policies in the Value.
This function is equivalent to computing the support of the value in the spec.