| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Ouroboros.Consensus.ChainGenerator.RaceIterator
Description
These functions iteratively produce all race windows in a slot vector.
The first window is produced by init, which unconditionally starts the window at the first slot.
This window can then be passed to next, which starts the new window after the first active slot.
---X--X--X--X-- ... ^ start of window 1 frominit^ start of window 2 fromnext^ start of window 3 fromnext
Valid windows must have k+1 active slots.
If the vector doesn't have sufficient slots to meet this condition, init and next return Nothing and we fall back
to initConservative and nextConservative, which return windows truncated at the end of time.
Synopsis
- newtype Race base where
- UnsafeRace (SomeWindow RaceLbl base 'SlotE)
- pattern Race ∷ SomeWindow RaceLbl base 'SlotE → Race base
- data RaceLbl
- init ∷ Kcp → Vector base 'SlotE S → Maybe (Race base)
- initConservative ∷ Vector base 'SlotE S → Race base
- next ∷ Vector base 'SlotE S → Race base → Maybe (Race base)
- nextConservative ∷ Vector base 'SlotE S → Race base → Maybe (Race base)
Documentation
A window whose last slot contains the k+1st active slot in it
Constructors
| UnsafeRace (SomeWindow RaceLbl base 'SlotE) |
Bundled Patterns
| pattern Race ∷ SomeWindow RaceLbl base 'SlotE → Race base |
init ∷ Kcp → Vector base 'SlotE S → Maybe (Race base) Source #
Yields the race window starting at position 0 of the given
vector if the k+1 active slot exists.
initConservative ∷ Vector base 'SlotE S → Race base Source #
initConservative creates a window for the whole vector.