| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Test.Consensus.Genesis.TestSuite.SmallKey
Description
Synopsis
- class SmallKey a
- getAllKeys ∷ SmallKey k ⇒ [k]
Documentation
This class is meant to be derived Generically for the construction of
TestSuites only. Which is done in basically two settings:
- For enumeration types matching the
ConformanceTests in a module one-to-one. - For sums of other
SmallKeytypes for the composition ofTestSuites.
In essence, deriving an instance of this class is a declaration that the
type has a small finite number of values and that allKeys (getAllKeys)
constains them all. "Small" here is a performance requirement, meaning that
it is feasible to drive an exhaustive construction from its values.
Laws:
Any inhabitant of a SmallKey type must have a finite index in allKeys,
which must contain no duplicates. That is, whenever we have an Eq
instance for the type, the following should hold:
elemxallKeys==>length(filter(== x)allKeys) == 1
Minimal complete definition
allKeys
Instances
getAllKeys ∷ SmallKey k ⇒ [k] Source #