ouroboros-network-testing-0.1.0.0: Common modules used for testing in ouroboros-network and ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Testing.Data.Script

Synopsis

Test scripts

newtype Script a Source #

Constructors

Script (NonEmpty a) 

Instances

Instances details
Functor Script Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

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

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

Foldable Script Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

foldMonoid m ⇒ Script m → m Source #

foldMapMonoid m ⇒ (a → m) → Script a → m Source #

foldMap'Monoid m ⇒ (a → m) → Script a → m Source #

foldr ∷ (a → b → b) → b → Script a → b Source #

foldr' ∷ (a → b → b) → b → Script a → b Source #

foldl ∷ (b → a → b) → b → Script a → b Source #

foldl' ∷ (b → a → b) → b → Script a → b Source #

foldr1 ∷ (a → a → a) → Script a → a Source #

foldl1 ∷ (a → a → a) → Script a → a Source #

toListScript a → [a] Source #

nullScript a → Bool Source #

lengthScript a → Int Source #

elemEq a ⇒ a → Script a → Bool Source #

maximumOrd a ⇒ Script a → a Source #

minimumOrd a ⇒ Script a → a Source #

sumNum a ⇒ Script a → a Source #

productNum a ⇒ Script a → a Source #

Traversable Script Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

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

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

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

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

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

Defined in Ouroboros.Network.Testing.Data.Script

Methods

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

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

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

Defined in Ouroboros.Network.Testing.Data.Script

Methods

showsPrecIntScript a → ShowS Source #

showScript a → String Source #

showList ∷ [Script a] → ShowS Source #

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

Defined in Ouroboros.Network.Testing.Data.Script

Methods

arbitrary ∷ Gen (Script a)

shrinkScript a → [Script a]

data NonEmpty a Source #

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

Since: base-4.9.0.0

Constructors

a :| [a] infixr 5 

Instances

Instances details
Monad NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

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

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

return ∷ a → NonEmpty a Source #

Functor NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

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

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

Applicative NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

pure ∷ a → NonEmpty a Source #

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

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

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

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

Foldable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

foldMonoid m ⇒ NonEmpty m → m Source #

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

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

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

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

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

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

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

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

toListNonEmpty a → [a] Source #

nullNonEmpty a → Bool Source #

lengthNonEmpty a → Int Source #

elemEq a ⇒ a → NonEmpty a → Bool Source #

maximumOrd a ⇒ NonEmpty a → a Source #

minimumOrd a ⇒ NonEmpty a → a Source #

sumNum a ⇒ NonEmpty a → a Source #

productNum a ⇒ NonEmpty a → a Source #

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) Source #

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

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

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

Eq1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq ∷ (a → b → Bool) → NonEmpty a → NonEmpty b → Bool Source #

Ord1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare ∷ (a → b → Ordering) → NonEmpty a → NonEmpty b → Ordering Source #

Read1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec ∷ (IntReadS a) → ReadS [a] → IntReadS (NonEmpty a) Source #

liftReadList ∷ (IntReadS a) → ReadS [a] → ReadS [NonEmpty a] Source #

liftReadPrecReadPrec a → ReadPrec [a] → ReadPrec (NonEmpty a) Source #

liftReadListPrecReadPrec a → ReadPrec [a] → ReadPrec [NonEmpty a] Source #

Show1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec ∷ (Int → a → ShowS) → ([a] → ShowS) → IntNonEmpty a → ShowS Source #

liftShowList ∷ (Int → a → ShowS) → ([a] → ShowS) → [NonEmpty a] → ShowS Source #

Hashable1 NonEmpty 
Instance details

Defined in Data.Hashable.Class

Methods

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

Lift a ⇒ Lift (NonEmpty a ∷ Type)

Since: template-haskell-2.15.0.0

Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftNonEmpty a → Q Exp Source #

liftTypedNonEmpty a → Q (TExp (NonEmpty a)) Source #

IsList (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Exts

Associated Types

type Item (NonEmpty a) Source #

Methods

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

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

toListNonEmpty a → [Item (NonEmpty a)] Source #

Eq a ⇒ Eq (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

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

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

Ord a ⇒ Ord (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

compareNonEmpty a → NonEmpty a → Ordering Source #

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

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

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

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

maxNonEmpty a → NonEmpty a → NonEmpty a Source #

minNonEmpty a → NonEmpty a → NonEmpty a Source #

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

Generic (NonEmpty a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep (NonEmpty a) ∷ TypeType Source #

Methods

fromNonEmpty a → Rep (NonEmpty a) x Source #

toRep (NonEmpty a) x → NonEmpty a Source #

Semigroup (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

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

sconcatNonEmpty (NonEmpty a) → NonEmpty a Source #

stimesIntegral b ⇒ b → NonEmpty a → NonEmpty a Source #

Hashable a ⇒ Hashable (NonEmpty a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSaltIntNonEmpty a → Int

hashNonEmpty a → Int

Serialise a ⇒ Serialise (NonEmpty a) 
Instance details

Defined in Codec.Serialise.Class

Methods

encodeNonEmpty a → Encoding #

decode ∷ Decoder s (NonEmpty a) #

encodeList ∷ [NonEmpty a] → Encoding #

decodeList ∷ Decoder s [NonEmpty a] #

Generic1 NonEmpty

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

Associated Types

type Rep1 NonEmpty ∷ k → Type Source #

Methods

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

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

type Rep (NonEmpty a) 
Instance details

Defined in GHC.Generics

type Item (NonEmpty a) 
Instance details

Defined in GHC.Exts

type Item (NonEmpty a) = a
type Rep1 NonEmpty 
Instance details

Defined in GHC.Generics

initScript ∷ MonadSTM m ⇒ Script a → STM m (TVar m (Script a)) Source #

stepScript ∷ MonadSTM m ⇒ TVar m (Script a) → m a Source #

stepScriptSTM ∷ MonadSTM m ⇒ TVar m (Script a) → STM m a Source #

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

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

stepScriptSTM' ∷ MonadSTM m ⇒ TVar m (Script a) → STM m a Source #

arbitraryScriptOfInt → Gen a → Gen (Script a) Source #

prop_shrink_Script ∷ Fixed (Script Int) → Property Source #

Timed scripts

playTimedScript ∷ (MonadAsync m, MonadTimer 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 policyPickKnownPeersForGossip 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
Eq peeraddr ⇒ Eq (PickMembers peeraddr) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

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

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

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

Defined in Ouroboros.Network.Testing.Data.Script

Methods

showsPrecIntPickMembers peeraddr → ShowS Source #

showPickMembers peeraddr → String Source #

showList ∷ [PickMembers peeraddr] → ShowS Source #

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

Defined in Ouroboros.Network.Testing.Data.Script

Methods

arbitrary ∷ Gen (PickMembers peeraddr)

shrinkPickMembers peeraddr → [PickMembers peeraddr]

arbitraryPickScript ∷ Gen (Set peeraddr) → Gen (PickScript peeraddr) Source #

interpretPickScript ∷ (MonadSTM m, Ord peeraddr) ⇒ TVar m (PickScript peeraddr) → Set peeraddr → Int → STM m (Set peeraddr) Source #