shelley-spec-ledger-0.1.0.0
Safe HaskellNone
LanguageHaskell98

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 #

Minimal complete definition

(<×>), coin, inject, modifyCoin, size, pointwise

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)

inject :: Coin -> t Source #

Create a value containing only this amount of ADA

modifyCoin :: (Coin -> Coin) -> t -> t Source #

modify the blessed Coin part of t

size :: t -> Integer Source #

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.

scale :: (Val t, Integral i) => i -> t -> t Source #

invert :: Val t => t -> t Source #

sumVal :: (Foldable t, Val v) => t v -> v Source #

class DecodeNonNegative v where Source #

Instances

Instances details
DecodeNonNegative Coin Source # 
Instance details

Defined in Cardano.Ledger.Val

(DecodeNonNegative a, Compactible a, Show a) => DecodeNonNegative (CompactForm a) Source # 
Instance details

Defined in Cardano.Ledger.Val

class DecodeMint v where Source #

Methods

decodeMint :: Decoder s v Source #

Instances

Instances details
DecodeMint Coin Source # 
Instance details

Defined in Cardano.Ledger.Val

class EncodeMint v where Source #

Methods

encodeMint :: v -> Encoding Source #

Instances

Instances details
EncodeMint Coin Source # 
Instance details

Defined in Cardano.Ledger.Val