| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Ouroboros.Network.Data.Script
Synopsis
- newtype Script a = Script (NonEmpty a)
- data NonEmpty a = a :| [a]
- scriptHead :: Script a -> a
- singletonScript :: a -> Script a
- initScript :: MonadSTM m => Script a -> m (TVar m (Script a))
- stepScript :: MonadSTM m => TVar m (Script a) -> m a
- stepScriptSTM :: forall (m :: Type -> Type) a. MonadSTM m => TVar m (Script a) -> STM m a
- stepScriptOrFinish :: MonadSTM m => TVar m (Script a) -> m (Either a a)
- stepScriptOrFinishSTM :: forall (m :: Type -> Type) a. MonadSTM m => TVar m (Script a) -> STM m (Either a a)
- initScript' :: MonadSTM m => Script a -> m (StrictTVar m (Script a))
- stepScript' :: MonadSTM m => StrictTVar m (Script a) -> m a
- stepScriptSTM' :: forall (m :: Type -> Type) a. MonadSTM m => StrictTVar m (Script a) -> STM m a
- shrinkScriptWith :: (a -> [a]) -> Script a -> [Script a]
- arbitraryScriptOf :: Int -> Gen a -> Gen (Script a)
- prop_shrink_Script :: ShrinkCarefully (Script Int) -> Property
- data ScriptDelay
- type TimedScript a = Script (a, ScriptDelay)
- singletonTimedScript :: a -> TimedScript a
- playTimedScript :: (MonadAsync m, MonadDelay m) => Tracer m a -> TimedScript a -> m (TVar m a)
- type PickScript peeraddr = Script (PickMembers peeraddr)
- data PickMembers peeraddr
- arbitraryPickScript :: Gen (Set peeraddr) -> Gen (PickScript peeraddr)
- interpretPickScript :: forall (m :: Type -> Type) peeraddr. (MonadSTM m, Ord peeraddr) => StrictTVar m (PickScript peeraddr) -> Set peeraddr -> Int -> STM m (Set peeraddr)
Test scripts
Instances
| Functor Script Source # | |
| Foldable Script Source # | |
Defined in Test.Ouroboros.Network.Data.Script Methods fold :: Monoid m => Script m -> m # foldMap :: Monoid m => (a -> m) -> Script a -> m # foldMap' :: Monoid m => (a -> m) -> Script a -> m # foldr :: (a -> b -> b) -> b -> Script a -> b # foldr' :: (a -> b -> b) -> b -> Script a -> b # foldl :: (b -> a -> b) -> b -> Script a -> b # foldl' :: (b -> a -> b) -> b -> Script a -> b # foldr1 :: (a -> a -> a) -> Script a -> a # foldl1 :: (a -> a -> a) -> Script a -> a # elem :: Eq a => a -> Script a -> Bool # maximum :: Ord a => Script a -> a # minimum :: Ord a => Script a -> a # | |
| Traversable Script Source # | |
| Arbitrary a => Arbitrary (Script a) Source # | |
| NFData a => NFData (Script a) Source # | |
Defined in Test.Ouroboros.Network.Data.Script | |
| Show a => Show (Script a) Source # | |
| Eq a => Eq (Script a) Source # | |
Non-empty (and non-strict) list type.
Since: base-4.9.0.0
Constructors
| a :| [a] infixr 5 |
Instances
scriptHead :: Script a -> a Source #
singletonScript :: a -> Script a Source #
stepScriptOrFinishSTM :: forall (m :: Type -> Type) a. MonadSTM m => TVar m (Script a) -> STM m (Either a a) Source #
stepScript' :: MonadSTM m => StrictTVar m (Script a) -> m a Source #
stepScriptSTM' :: forall (m :: Type -> Type) a. MonadSTM m => StrictTVar m (Script a) -> STM m a Source #
shrinkScriptWith :: (a -> [a]) -> Script a -> [Script a] Source #
Timed scripts
data ScriptDelay Source #
Constructors
| NoDelay | |
| ShortDelay | |
| LongDelay | |
| Delay DiffTime |
Instances
| Arbitrary ScriptDelay Source # | |
Defined in Test.Ouroboros.Network.Data.Script | |
| Show ScriptDelay Source # | |
Defined in Test.Ouroboros.Network.Data.Script Methods showsPrec :: Int -> ScriptDelay -> ShowS # show :: ScriptDelay -> String # showList :: [ScriptDelay] -> ShowS # | |
| Eq ScriptDelay Source # | |
Defined in Test.Ouroboros.Network.Data.Script | |
type TimedScript a = Script (a, ScriptDelay) Source #
singletonTimedScript :: a -> TimedScript a Source #
Timed script which consists of a single element.
playTimedScript :: (MonadAsync m, MonadDelay m) => Tracer m a -> TimedScript a -> m (TVar m a) Source #
Pick scripts
type PickScript peeraddr = Script (PickMembers peeraddr) Source #
A pick script is used to interpret the policyPickKnownPeersForPeerShare and
the policyPickColdPeersToForget. It selects elements from the given
choices by their index (modulo the number of choices). This representation
was chosen because it allows easy shrinking.
data PickMembers peeraddr Source #
Instances
| (Arbitrary peeraddr, Ord peeraddr) => Arbitrary (PickMembers peeraddr) Source # | |
Defined in Test.Ouroboros.Network.Data.Script Methods arbitrary :: Gen (PickMembers peeraddr) # shrink :: PickMembers peeraddr -> [PickMembers peeraddr] # | |
| Show peeraddr => Show (PickMembers peeraddr) Source # | |
Defined in Test.Ouroboros.Network.Data.Script Methods showsPrec :: Int -> PickMembers peeraddr -> ShowS # show :: PickMembers peeraddr -> String # showList :: [PickMembers peeraddr] -> ShowS # | |
| Eq peeraddr => Eq (PickMembers peeraddr) Source # | |
Defined in Test.Ouroboros.Network.Data.Script Methods (==) :: PickMembers peeraddr -> PickMembers peeraddr -> Bool # (/=) :: PickMembers peeraddr -> PickMembers peeraddr -> Bool # | |
arbitraryPickScript :: Gen (Set peeraddr) -> Gen (PickScript peeraddr) Source #