Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 Ouroboros.Network.Testing.Data.Script 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 # | |
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
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 #
initScript' :: MonadSTM m => Script a -> m (StrictTVar m (Script 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 #
Instances
Arbitrary ScriptDelay Source # | |
Defined in Ouroboros.Network.Testing.Data.Script arbitrary :: Gen ScriptDelay # shrink :: ScriptDelay -> [ScriptDelay] # | |
Show ScriptDelay Source # | |
Defined in Ouroboros.Network.Testing.Data.Script showsPrec :: Int -> ScriptDelay -> ShowS # show :: ScriptDelay -> String # showList :: [ScriptDelay] -> ShowS # | |
Eq ScriptDelay Source # | |
Defined in Ouroboros.Network.Testing.Data.Script (==) :: ScriptDelay -> ScriptDelay -> Bool # (/=) :: ScriptDelay -> ScriptDelay -> Bool # |
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 Ouroboros.Network.Testing.Data.Script arbitrary :: Gen (PickMembers peeraddr) # shrink :: PickMembers peeraddr -> [PickMembers peeraddr] # | |
Show peeraddr => Show (PickMembers peeraddr) Source # | |
Defined in Ouroboros.Network.Testing.Data.Script showsPrec :: Int -> PickMembers peeraddr -> ShowS # show :: PickMembers peeraddr -> String # showList :: [PickMembers peeraddr] -> ShowS # | |
Eq peeraddr => Eq (PickMembers peeraddr) Source # | |
Defined in Ouroboros.Network.Testing.Data.Script (==) :: PickMembers peeraddr -> PickMembers peeraddr -> Bool # (/=) :: PickMembers peeraddr -> PickMembers peeraddr -> Bool # |
arbitraryPickScript :: Gen (Set peeraddr) -> Gen (PickScript peeraddr) Source #
interpretPickScript :: forall (m :: Type -> Type) peeraddr. (MonadSTM m, Ord peeraddr) => StrictTVar m (PickScript peeraddr) -> Set peeraddr -> Int -> STM m (Set peeraddr) Source #