Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data CR hashAlgo (hashToDataMap ∷ Type → Type → Type) commitData
- data CRSt hashAlgo hashToDataMap commitData = CRSt {
- hashToData ∷ !(hashToDataMap (Hash hashAlgo Data) commitData)
- committedHashes ∷ !(Set (Hash hashAlgo Data))
- class MapLike m k v where
- data NoOpMap a b = NoOpMap
- data CRSignal hashAlgo commitData
- isCommit ∷ CRSignal hashAlgo commitData → Bool
- newtype Data = Data {}
- newtype Id = Id {}
- data CRPredicateFailure hashAlgo (hashToDataMap ∷ Type → Type → Type) commitData
- = InvalidReveal Data
- | AlreadyComitted (Hash hashAlgo Data)
- prop_qc_UniqueData ∷ Property
- prop_qc_OnlyValidSignals ∷ Property
Documentation
data CR hashAlgo (hashToDataMap ∷ Type → Type → Type) commitData Source #
Commit-reveal transition system, where data hashes are committed and then revealed.
The first type parameter denotes the type of hash algorithm used.
The second parameter denotes the structure used to associate a commit to its
hash. See CRSt
The third parameter is the data that will be associated to the Commit
signal.
Instances
(HashAlgorithm hashAlgo, Typeable hashToDataMap, Typeable commitData, MapLike hashToDataMap (Hash hashAlgo Data) commitData, Monoid (hashToDataMap (Hash hashAlgo Data) commitData)) ⇒ STS (CR hashAlgo hashToDataMap commitData) Source # | |
Defined in Test.Control.State.Transition.Examples.CommitReveal type State (CR hashAlgo hashToDataMap commitData) Source # type Signal (CR hashAlgo hashToDataMap commitData) Source # type Environment (CR hashAlgo hashToDataMap commitData) Source # type BaseM (CR hashAlgo hashToDataMap commitData) ∷ Type → Type Source # type Event (CR hashAlgo hashToDataMap commitData) Source # type PredicateFailure (CR hashAlgo hashToDataMap commitData) Source # initialRules ∷ [InitialRule (CR hashAlgo hashToDataMap commitData)] Source # transitionRules ∷ [TransitionRule (CR hashAlgo hashToDataMap commitData)] Source # assertions ∷ [Assertion (CR hashAlgo hashToDataMap commitData)] Source # renderAssertionViolation ∷ AssertionViolation (CR hashAlgo hashToDataMap commitData) → String Source # | |
HashAlgorithm hashAlgo ⇒ HasTrace (CR hashAlgo Map Data) () Source # | |
Defined in Test.Control.State.Transition.Examples.CommitReveal interpretSTS ∷ HasCallStack ⇒ BaseEnv (CR hashAlgo Map Data) → BaseM (CR hashAlgo Map Data) a → a Source # envGen ∷ () → Gen (Environment (CR hashAlgo Map Data)) Source # sigGen ∷ () → Environment (CR hashAlgo Map Data) → State (CR hashAlgo Map Data) → Gen (Signal (CR hashAlgo Map Data)) Source # shrinkSignal ∷ Signal (CR hashAlgo Map Data) → [Signal (CR hashAlgo Map Data)] Source # | |
type BaseM (CR hashAlgo hashToDataMap commitData) Source # | |
type Environment (CR hashAlgo hashToDataMap commitData) Source # | |
type Event (CR hashAlgo hashToDataMap commitData) Source # | |
type PredicateFailure (CR hashAlgo hashToDataMap commitData) Source # | |
Defined in Test.Control.State.Transition.Examples.CommitReveal type PredicateFailure (CR hashAlgo hashToDataMap commitData) = CRPredicateFailure hashAlgo hashToDataMap commitData | |
type Signal (CR hashAlgo hashToDataMap commitData) Source # | |
type State (CR hashAlgo hashToDataMap commitData) Source # | |
type BaseEnv (CR hashAlgo Map Data) Source # | |
data CRSt hashAlgo hashToDataMap commitData Source #
Commit-reveal transition system state.
CRSt | |
|
data CRSignal hashAlgo commitData Source #
Instances
Show commitData ⇒ Show (CRSignal hashAlgo commitData) Source # | |
Eq commitData ⇒ Eq (CRSignal hashAlgo commitData) Source # | |
Ord commitData ⇒ Ord (CRSignal hashAlgo commitData) Source # | |
Defined in Test.Control.State.Transition.Examples.CommitReveal compare ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → Ordering Source # (<) ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → Bool Source # (<=) ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → Bool Source # (>) ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → Bool Source # (>=) ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → Bool Source # max ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → CRSignal hashAlgo commitData Source # min ∷ CRSignal hashAlgo commitData → CRSignal hashAlgo commitData → CRSignal hashAlgo commitData Source # |
Instances
Arbitrary Data Source # | |
Show Data Source # | |
EncCBOR Data Source # | |
Eq Data Source # | |
Ord Data Source # | |
HashAlgorithm hashAlgo ⇒ HasTrace (CR hashAlgo Map Data) () Source # | |
Defined in Test.Control.State.Transition.Examples.CommitReveal interpretSTS ∷ HasCallStack ⇒ BaseEnv (CR hashAlgo Map Data) → BaseM (CR hashAlgo Map Data) a → a Source # envGen ∷ () → Gen (Environment (CR hashAlgo Map Data)) Source # sigGen ∷ () → Environment (CR hashAlgo Map Data) → State (CR hashAlgo Map Data) → Gen (Signal (CR hashAlgo Map Data)) Source # shrinkSignal ∷ Signal (CR hashAlgo Map Data) → [Signal (CR hashAlgo Map Data)] Source # | |
type BaseEnv (CR hashAlgo Map Data) Source # | |
data CRPredicateFailure hashAlgo (hashToDataMap ∷ Type → Type → Type) commitData Source #
InvalidReveal Data | |
AlreadyComitted (Hash hashAlgo Data) |
Instances
Show (CRPredicateFailure hashAlgo hashToDataMap commitData) Source # | |
Eq (CRPredicateFailure hashAlgo hashToDataMap commitData) Source # | |
Defined in Test.Control.State.Transition.Examples.CommitReveal (==) ∷ CRPredicateFailure hashAlgo hashToDataMap commitData → CRPredicateFailure hashAlgo hashToDataMap commitData → Bool Source # (/=) ∷ CRPredicateFailure hashAlgo hashToDataMap commitData → CRPredicateFailure hashAlgo hashToDataMap commitData → Bool Source # |
prop_qc_UniqueData ∷ Property Source #
Check that unique data is generated. This is supposed to fail, since there's nothing in the STS that prevents two commits of the same data. The resulting minimal counterexample should be a trace of the form:
commit (hash d0) -> reveal d0 -> commit (hash d0)
where it shouldn't be possible to shrink d0
any further.
prop_qc_OnlyValidSignals ∷ Property Source #
Check that only valid signals are generated.
This property should fail since the generators don't check that the generated commits are unique. The resulting minimal counterexample should be a trace of the form:
commit (hash d0) -> commit (hash d0)
where it shouldn't be possible to shrink d0
any further.