ouroboros-network-testing-0.6.1.0: Common modules used for testing in ouroboros-network and ouroboros-consensus
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.Testing.Data.Script

Synopsis

Test scripts

newtype Script a Source #

Constructors

Script (NonEmpty a) 

Instances

Instances details
Foldable Script Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

foldMonoid m ⇒ Script m → m #

foldMapMonoid 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 #

toListScript a → [a] #

nullScript a → Bool #

lengthScript a → Int #

elemEq a ⇒ a → Script a → Bool #

maximumOrd a ⇒ Script a → a #

minimumOrd a ⇒ Script a → a #

sumNum a ⇒ Script a → a #

productNum a ⇒ Script a → a #

Traversable Script Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

traverseApplicative f ⇒ (a → f b) → Script a → f (Script b) #

sequenceAApplicative f ⇒ Script (f a) → f (Script a) #

mapMMonad m ⇒ (a → m b) → Script a → m (Script b) #

sequenceMonad m ⇒ Script (m a) → m (Script a) #

Functor Script Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

fmap ∷ (a → b) → Script a → Script b #

(<$) ∷ a → Script b → Script a #

Arbitrary a ⇒ Arbitrary (Script a) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

arbitraryGen (Script a) Source #

shrinkScript a → [Script a] Source #

Show a ⇒ Show (Script a) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

showsPrecIntScript a → ShowS #

showScript a → String #

showList ∷ [Script a] → ShowS #

Eq a ⇒ Eq (Script a) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

(==)Script a → Script a → Bool #

(/=)Script a → Script a → Bool #

data NonEmpty a #

Non-empty (and non-strict) list type.

Since: base-4.9.0.0

Constructors

a :| [a] infixr 5 

Instances

Instances details
Foldable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

foldMonoid m ⇒ NonEmpty m → m #

foldMapMonoid m ⇒ (a → m) → NonEmpty a → m #

foldMap'Monoid m ⇒ (a → m) → NonEmpty a → m #

foldr ∷ (a → b → b) → b → NonEmpty a → b #

foldr' ∷ (a → b → b) → b → NonEmpty a → b #

foldl ∷ (b → a → b) → b → NonEmpty a → b #

foldl' ∷ (b → a → b) → b → NonEmpty a → b #

foldr1 ∷ (a → a → a) → NonEmpty a → a #

foldl1 ∷ (a → a → a) → NonEmpty a → a #

toListNonEmpty a → [a] #

nullNonEmpty a → Bool #

lengthNonEmpty a → Int #

elemEq a ⇒ a → NonEmpty a → Bool #

maximumOrd a ⇒ NonEmpty a → a #

minimumOrd a ⇒ NonEmpty a → a #

sumNum a ⇒ NonEmpty a → a #

productNum a ⇒ NonEmpty a → a #

Traversable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverseApplicative f ⇒ (a → f b) → NonEmpty a → f (NonEmpty b) #

sequenceAApplicative f ⇒ NonEmpty (f a) → f (NonEmpty a) #

mapMMonad m ⇒ (a → m b) → NonEmpty a → m (NonEmpty b) #

sequenceMonad m ⇒ NonEmpty (m a) → m (NonEmpty a) #

Applicative NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

pure ∷ a → NonEmpty a #

(<*>)NonEmpty (a → b) → NonEmpty a → NonEmpty b #

liftA2 ∷ (a → b → c) → NonEmpty a → NonEmpty b → NonEmpty c #

(*>)NonEmpty a → NonEmpty b → NonEmpty b #

(<*)NonEmpty a → NonEmpty b → NonEmpty a #

Functor NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

fmap ∷ (a → b) → NonEmpty a → NonEmpty b #

(<$) ∷ a → NonEmpty b → NonEmpty a #

Monad NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(>>=)NonEmpty a → (a → NonEmpty b) → NonEmpty b #

(>>)NonEmpty a → NonEmpty b → NonEmpty b #

return ∷ a → NonEmpty a #

NFData1 NonEmpty

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf ∷ (a → ()) → NonEmpty a → () #

Hashable1 NonEmpty

Since: hashable-1.3.1.0

Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt ∷ (Int → a → Int) → IntNonEmpty a → Int Source #

Generic1 NonEmpty 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 NonEmpty ∷ k → Type #

Methods

from1 ∷ ∀ (a ∷ k). NonEmpty a → Rep1 NonEmpty a #

to1 ∷ ∀ (a ∷ k). Rep1 NonEmpty a → NonEmpty a #

Lift a ⇒ Lift (NonEmpty a ∷ Type)

Since: template-haskell-2.15.0.0

Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftQuote m ⇒ NonEmpty a → m Exp #

liftTyped ∷ ∀ (m ∷ TypeType). Quote m ⇒ NonEmpty a → Code m (NonEmpty a) #

Semigroup (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(<>)NonEmpty a → NonEmpty a → NonEmpty a #

sconcatNonEmpty (NonEmpty a) → NonEmpty a #

stimesIntegral b ⇒ b → NonEmpty a → NonEmpty a #

Generic (NonEmpty a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (NonEmpty a) ∷ TypeType #

Methods

fromNonEmpty a → Rep (NonEmpty a) x #

toRep (NonEmpty a) x → NonEmpty a #

IsList (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.IsList

Associated Types

type Item (NonEmpty a) #

Methods

fromList ∷ [Item (NonEmpty a)] → NonEmpty a #

fromListNInt → [Item (NonEmpty a)] → NonEmpty a #

toListNonEmpty a → [Item (NonEmpty a)] #

Read a ⇒ Read (NonEmpty a)

Since: base-4.11.0.0

Instance details

Defined in GHC.Read

Show a ⇒ Show (NonEmpty a)

Since: base-4.11.0.0

Instance details

Defined in GHC.Show

Methods

showsPrecIntNonEmpty a → ShowS #

showNonEmpty a → String #

showList ∷ [NonEmpty a] → ShowS #

NFData a ⇒ NFData (NonEmpty a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnfNonEmpty a → () #

Eq a ⇒ Eq (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(==)NonEmpty a → NonEmpty a → Bool #

(/=)NonEmpty a → NonEmpty a → Bool #

Ord a ⇒ Ord (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

compareNonEmpty a → NonEmpty a → Ordering #

(<)NonEmpty a → NonEmpty a → Bool #

(<=)NonEmpty a → NonEmpty a → Bool #

(>)NonEmpty a → NonEmpty a → Bool #

(>=)NonEmpty a → NonEmpty a → Bool #

maxNonEmpty a → NonEmpty a → NonEmpty a #

minNonEmpty a → NonEmpty a → NonEmpty a #

Hashable a ⇒ Hashable (NonEmpty a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSaltIntNonEmpty a → Int Source #

hashNonEmpty a → Int Source #

Pretty a ⇒ Pretty (NonEmpty a) 
Instance details

Defined in Prettyprinter.Internal

Methods

prettyNonEmpty a → Doc ann Source #

prettyList ∷ [NonEmpty a] → Doc ann Source #

Serialise a ⇒ Serialise (NonEmpty a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

type Rep1 NonEmpty

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Rep (NonEmpty a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Item (NonEmpty a) 
Instance details

Defined in GHC.IsList

type Item (NonEmpty a) = a

initScriptMonadSTM m ⇒ Script a → m (TVar m (Script a)) Source #

stepScriptMonadSTM m ⇒ TVar m (Script a) → m a Source #

stepScriptSTMMonadSTM m ⇒ TVar m (Script a) → STM m a Source #

stepScriptOrFinishMonadSTM m ⇒ TVar m (Script a) → m (Either a a) Source #

Return Left if it was the last step, return Right if the script can continue.

initScript'MonadSTM m ⇒ Script a → m (StrictTVar m (Script a)) Source #

stepScript'MonadSTM m ⇒ StrictTVar m (Script a) → m a Source #

shrinkScriptWith ∷ (a → [a]) → Script a → [Script a] Source #

Timed scripts

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 #

Constructors

PickFirst 
PickAll 
PickSome (Set peeraddr) 

Instances

Instances details
(Arbitrary peeraddr, Ord peeraddr) ⇒ Arbitrary (PickMembers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

arbitraryGen (PickMembers peeraddr) Source #

shrinkPickMembers peeraddr → [PickMembers peeraddr] Source #

Show peeraddr ⇒ Show (PickMembers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

showsPrecIntPickMembers peeraddr → ShowS #

showPickMembers peeraddr → String #

showList ∷ [PickMembers peeraddr] → ShowS #

Eq peeraddr ⇒ Eq (PickMembers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

(==)PickMembers peeraddr → PickMembers peeraddr → Bool #

(/=)PickMembers peeraddr → PickMembers peeraddr → Bool #

arbitraryPickScriptGen (Set peeraddr) → Gen (PickScript peeraddr) Source #

interpretPickScript ∷ (MonadSTM m, Ord peeraddr) ⇒ StrictTVar m (PickScript peeraddr) → Set peeraddr → IntSTM m (Set peeraddr) Source #