| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Cardano.Ledger.Val
Description
This module defines a generalised notion of a "value" - that is, something with which we may quantify a transaction output.
Documentation
class (Abelian t, Eq t) => Val t where Source #
Methods
the value with nothing in it
(<+>) :: t -> t -> t infixl 6 Source #
add two value
(<×>) :: Integral i => i -> t -> t infixl 7 Source #
scale a value by an Integral constant
(<->) :: t -> t -> t infixl 6 Source #
subtract two values
Is the argument zero?
Get the ADA present in the value (since ADA is our "blessed" currency)
Create a value containing only this amount of ADA
modifyCoin :: (Coin -> Coin) -> t -> t Source #
modify the blessed Coin part of t
pointwise :: (Integer -> Integer -> Bool) -> t -> t -> Bool Source #
used to compare values pointwise. Rather than using: (v1 <= v2) use: pointwise (<=) v1 v2
| If a quantity is stored in only one of v1 or v2, we use 0 for the missing quantity.
Instances
| Val DeltaCoin Source # | |
Defined in Cardano.Ledger.Val Methods (<+>) :: DeltaCoin -> DeltaCoin -> DeltaCoin Source # (<×>) :: Integral i => i -> DeltaCoin -> DeltaCoin Source # (<->) :: DeltaCoin -> DeltaCoin -> DeltaCoin Source # isZero :: DeltaCoin -> Bool Source # coin :: DeltaCoin -> Coin Source # inject :: Coin -> DeltaCoin Source # modifyCoin :: (Coin -> Coin) -> DeltaCoin -> DeltaCoin Source # size :: DeltaCoin -> Integer Source # pointwise :: (Integer -> Integer -> Bool) -> DeltaCoin -> DeltaCoin -> Bool Source # | |
| Val Coin Source # | |
Defined in Cardano.Ledger.Val Methods (<+>) :: Coin -> Coin -> Coin Source # (<×>) :: Integral i => i -> Coin -> Coin Source # (<->) :: Coin -> Coin -> Coin Source # isZero :: Coin -> Bool Source # inject :: Coin -> Coin Source # modifyCoin :: (Coin -> Coin) -> Coin -> Coin Source # size :: Coin -> Integer Source # pointwise :: (Integer -> Integer -> Bool) -> Coin -> Coin -> Bool Source # | |
class DecodeNonNegative v where Source #
Methods
decodeNonNegative :: Decoder s v Source #
Instances
| DecodeNonNegative Coin Source # | |
Defined in Cardano.Ledger.Val Methods decodeNonNegative :: Decoder s Coin Source # | |
| (DecodeNonNegative a, Compactible a, Show a) => DecodeNonNegative (CompactForm a) Source # | |
Defined in Cardano.Ledger.Val Methods decodeNonNegative :: Decoder s (CompactForm a) Source # | |
class DecodeMint v where Source #
Methods
decodeMint :: Decoder s v Source #
Instances
| DecodeMint Coin Source # | |
Defined in Cardano.Ledger.Val Methods decodeMint :: Decoder s Coin Source # | |
class EncodeMint v where Source #
Methods
encodeMint :: v -> Encoding Source #
Instances
| EncodeMint Coin Source # | |
Defined in Cardano.Ledger.Val Methods encodeMint :: Coin -> Encoding Source # | |