cardano-ledger-core-1.16.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 (Compactible t, Inject Coin t, EncCBOR (CompactForm t), DecCBOR (CompactForm t), Abelian t, NoThunks t, EncCBOR t, DecCBOR t, ToJSON t, NFData t, Show t, Eq t) ⇒ Val t where Source #

Methods

zero ∷ t Source #

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

isZero ∷ t → Bool Source #

Is the argument zero?

coin ∷ t → Coin Source #

Get the ADA present in the value (since ADA is our "blessed" currency)

modifyCoin ∷ (CoinCoin) → t → t Source #

modify the blessed Coin part of t

size ∷ t → Integer Source #

pointwise ∷ (IntegerIntegerBool) → 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.

isAdaOnly ∷ t → Bool Source #

Check if value contains only ADA. Must hold property:

inject (coin v) == v

isAdaOnlyCompactCompactForm t → Bool Source #

coinCompactCompactForm t → CompactForm Coin Source #

injectCompactCompactForm CoinCompactForm t Source #

modifyCompactCoin ∷ (CompactForm CoinCompactForm Coin) → CompactForm t → CompactForm t Source #

Instances

Instances details
Val Coin Source # 
Instance details

Defined in Cardano.Ledger.Val

Val DeltaCoin Source # 
Instance details

Defined in Cardano.Ledger.Val

injectInject t s ⇒ t → s Source #

scale ∷ (Val t, Integral i) ⇒ i → t → t Source #

invertVal t ⇒ t → t Source #

sumVal ∷ (Foldable t, Val v) ⇒ t v → v Source #