Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Ledger.Tables.Basics
Contents
Synopsis
- type LedgerStateKind = MapKind → Type
- type MapKind = Type → Type → Type
- newtype LedgerTables (l ∷ LedgerStateKind) (mk ∷ MapKind) = LedgerTables {
- getLedgerTables ∷ mk (TxIn l) (TxOut l)
- type family MemPackIdx (l ∷ LedgerStateKind) (mk ∷ MapKind) where ...
- type SameUtxoTypes (l ∷ LedgerStateKind) (l' ∷ LedgerStateKind) = (TxIn l ~ TxIn l', TxOut l ~ TxOut l')
- type family TxIn (l ∷ LedgerStateKind)
- type family TxOut (l ∷ LedgerStateKind)
- castLedgerTables ∷ ∀ (l ∷ LedgerStateKind) (l' ∷ LedgerStateKind) (mk ∷ MapKind). SameUtxoTypes l l' ⇒ LedgerTables l mk → LedgerTables l' mk
Kinds
For convenience' sake, we define these kinds which convey the intended instantiation for the type variables.
type LedgerStateKind = MapKind → Type Source #
type MapKind = Type → Type → Type Source #
Something that holds two types, which intend to represent keys and values.
Ledger tables
newtype LedgerTables (l ∷ LedgerStateKind) (mk ∷ MapKind) Source #
The Ledger Tables represent the portion of the data on disk that has been pulled from disk and attached to the in-memory Ledger State or that will eventually be written to disk.
With UTxO-HD and the split of the Ledger ledger state into the in-memory
part and the on-disk part, this splitting was reflected in the new type
parameter added to the (Consensus)
LedgerState
, to which we refer as "the
MapKind" or mk
.
Every LedgerState
(or LedgerState
-like
type, such as the ExtLedgerState
) is
associated with a LedgerTables
and they both share the mk
. They both are
of kind LedgerStateKind
. LedgerTables
is just a way to refer only to a
partial view of the on-disk data without having the rest of the in-memory
LedgerState
in scope.
The mk
can be instantiated to anything that is map-like, i.e. that expects
two type parameters, the key and the value.
Constructors
LedgerTables | |
Fields
|
Instances
type family MemPackIdx (l ∷ LedgerStateKind) (mk ∷ MapKind) where ... Source #
Auxiliary information for IndexedMemPack
.
Equations
MemPackIdx (LedgerTables l) mk = MemPackIdx l mk | |
MemPackIdx (Ticked l) mk = MemPackIdx l mk | |
MemPackIdx l mk = l mk |
type SameUtxoTypes (l ∷ LedgerStateKind) (l' ∷ LedgerStateKind) = (TxIn l ~ TxIn l', TxOut l ~ TxOut l') Source #
type family TxIn (l ∷ LedgerStateKind) Source #
Each LedgerState
instance will have the notion of a TxIn
for the tables.
This will change once there is more than one table.
Instances
type TxIn (LedgerState (HardForkBlock xs)) Source # | Must be the |
type TxIn (LedgerState (DualBlock m a)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
type TxIn (ExtLedgerState blk) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended | |
type TxIn (TrivialLedgerTables l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables | |
type TxIn (LedgerTables l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |
type TxIn (Ticked l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics |
type family TxOut (l ∷ LedgerStateKind) Source #
Each LedgerState
instance will have the notion of a TxOut
for the
tables.
This will change once there is more than one table.
Instances
type TxOut (LedgerState (HardForkBlock xs)) Source # | Must be the |
type TxOut (LedgerState (DualBlock m a)) Source # | |
Defined in Ouroboros.Consensus.Ledger.Dual | |
type TxOut (ExtLedgerState blk) Source # | |
Defined in Ouroboros.Consensus.Ledger.Extended | |
type TxOut (TrivialLedgerTables l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables | |
type TxOut (LedgerTables l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics | |
type TxOut (Ticked l) Source # | |
Defined in Ouroboros.Consensus.Ledger.Tables.Basics |
castLedgerTables ∷ ∀ (l ∷ LedgerStateKind) (l' ∷ LedgerStateKind) (mk ∷ MapKind). SameUtxoTypes l l' ⇒ LedgerTables l mk → LedgerTables l' mk Source #