| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Ouroboros.Consensus.ChainGenerator.Slot
Synopsis
- data E
- complementActive ∷ ∀ proxy (pol ∷ Pol) base which. proxy pol → Size base 'SlotE → Count base (PreImage pol 'ActiveSlotE) which → Count base (PreImage pol 'EmptySlotE) which
- complementEmpty ∷ ∀ proxy (pol ∷ Pol) base which. proxy pol → Size base 'SlotE → Count base (PreImage pol 'EmptySlotE) which → Count base (PreImage pol 'ActiveSlotE) which
- data S
- showS ∷ S → ShowS
- genS ∷ RandomGen g ⇒ Asc → g → (S, g)
- class POL (pol ∷ Pol) where
- data Pol
- type family PreImage (pol ∷ Pol) (e ∷ E) ∷ E where ...
- inverted ∷ Proxy 'Inverted
- notInverted ∷ Proxy 'NotInverted
Counting
Type-level names for the different kinds of slots counted in this library
The data constructors of this type are used in promoted form with
-XDataKinds.
Constructors
| ActiveSlotE | Active slots must be filled on the honest chain and may be filled on an alternative chain. |
| EmptySlotE | Empty slots may be filled on the honest chain and must not be filled on an alternative chain. |
| SlotE |
|
complementActive ∷ ∀ proxy (pol ∷ Pol) base which. proxy pol → Size base 'SlotE → Count base (PreImage pol 'ActiveSlotE) which → Count base (PreImage pol 'EmptySlotE) which Source #
Every slot is either active or empty
complementEmpty ∷ ∀ proxy (pol ∷ Pol) base which. proxy pol → Size base 'SlotE → Count base (PreImage pol 'EmptySlotE) which → Count base (PreImage pol 'ActiveSlotE) which Source #
Every slot is either active or empty
Slot
The activeness of some slot
Instances
Reuse
class POL (pol ∷ Pol) where Source #
Overloaded slot operations for the two polarities
Methods
mkActive ∷ proxy pol → S Source #
Make an active slot
test ∷ proxy pol → S → Bool Source #
Test whether pol maps the given bit to one
Instances
| POL 'Inverted Source # | |
| POL 'NotInverted Source # | |
Defined in Test.Ouroboros.Consensus.ChainGenerator.Slot | |
The polarity of a type
This is used to toggle how functions in this library interact with vectors
of S values.
If the polarity is Inverted, then the function will treat all S values as
if they were first complemented.
The PreImage type family does the corresponding parameterization of
ActiveSlotE and EmptySlotE at the type level.
NOTE: No S value is ever actually complemented because of Inverted, but
the functions parameterized by pol will treat them as if they were.
Constructors
| Inverted | |
| NotInverted |
type family PreImage (pol ∷ Pol) (e ∷ E) ∷ E where ... Source #
PreImage pol e is the complement of e if pol is Inverted and simply e if it's NotInverted
Equations
| PreImage 'Inverted 'EmptySlotE = 'ActiveSlotE | |
| PreImage 'Inverted 'ActiveSlotE = 'EmptySlotE | |
| PreImage 'NotInverted e = e |