Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines a generalised notion of a "value" - that is, something with which we may quantify a transaction output.
Synopsis
- 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
- zero ∷ t
- (<+>) ∷ t → t → t
- (<×>) ∷ Integral i ⇒ i → t → t
- (<->) ∷ t → t → t
- isZero ∷ t → Bool
- coin ∷ t → Coin
- modifyCoin ∷ (Coin → Coin) → t → t
- size ∷ t → Integer
- pointwise ∷ (Integer → Integer → Bool) → t → t → Bool
- isAdaOnly ∷ t → Bool
- isAdaOnlyCompact ∷ CompactForm t → Bool
- coinCompact ∷ CompactForm t → CompactForm Coin
- injectCompact ∷ CompactForm Coin → CompactForm t
- modifyCompactCoin ∷ (CompactForm Coin → CompactForm Coin) → CompactForm t → CompactForm t
- inject ∷ Inject t s ⇒ t → s
- scale ∷ (Val t, Integral i) ⇒ i → t → t
- invert ∷ Val t ⇒ t → t
- sumVal ∷ (Foldable t, Val v) ⇒ t v → v
- adaOnly ∷ Val v ⇒ v → Bool
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 #
(<×>), coin, modifyCoin, size, pointwise, isAdaOnly, isAdaOnlyCompact, coinCompact, injectCompact, modifyCompactCoin
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)
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.
Check if value contains only ADA. Must hold property:
inject (coin v) == v
isAdaOnlyCompact ∷ CompactForm t → Bool Source #
coinCompact ∷ CompactForm t → CompactForm Coin Source #
injectCompact ∷ CompactForm Coin → CompactForm t Source #
modifyCompactCoin ∷ (CompactForm Coin → CompactForm Coin) → CompactForm t → CompactForm t Source #