consensus-test
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Consensus.PointSchedule.Peers

Description

This module contains the definition of point schedule _peers_ as well as all kind of utilities to manipulate them.

Synopsis

Documentation

data Peer a Source #

General-purpose functor associated with a peer.

Constructors

Peer 

Fields

Instances

Instances details
Foldable Peer Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

foldMonoid m ⇒ Peer m → m #

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

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

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

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

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

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

foldr1 ∷ (a → a → a) → Peer a → a #

foldl1 ∷ (a → a → a) → Peer a → a #

toListPeer a → [a] #

nullPeer a → Bool #

lengthPeer a → Int #

elemEq a ⇒ a → Peer a → Bool #

maximumOrd a ⇒ Peer a → a #

minimumOrd a ⇒ Peer a → a #

sumNum a ⇒ Peer a → a #

productNum a ⇒ Peer a → a #

Traversable Peer Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

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

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

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

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

Functor Peer Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

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

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

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

Defined in Test.Consensus.PointSchedule.Peers

Methods

showsPrecIntPeer a → ShowS #

showPeer a → String #

showList ∷ [Peer a] → ShowS #

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

Defined in Test.Consensus.PointSchedule.Peers

Methods

(==)Peer a → Peer a → Bool #

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

Condense a ⇒ Condense (Peer a) Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

condensePeer a → String Source #

CondenseList a ⇒ CondenseList (Peer a) Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

condenseList ∷ [Peer a] → [String] Source #

data PeerId Source #

Identifier used to index maps and specify which peer is active during a tick.

Constructors

HonestPeer 
PeerId String 

Instances

Instances details
IsString PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

fromStringStringPeerId #

Generic PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Associated Types

type Rep PeerIdTypeType #

Methods

fromPeerIdRep PeerId x #

toRep PeerId x → PeerId #

Show PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

showsPrecIntPeerIdShowS #

showPeerIdString #

showList ∷ [PeerId] → ShowS #

Eq PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

(==)PeerIdPeerIdBool #

(/=)PeerIdPeerIdBool #

Ord PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

comparePeerIdPeerIdOrdering #

(<)PeerIdPeerIdBool #

(<=)PeerIdPeerIdBool #

(>)PeerIdPeerIdBool #

(>=)PeerIdPeerIdBool #

maxPeerIdPeerIdPeerId #

minPeerIdPeerIdPeerId #

Hashable PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

hashWithSaltIntPeerIdInt Source #

hashPeerIdInt Source #

Condense PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

condensePeerIdString Source #

CondenseList PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

condenseList ∷ [PeerId] → [String] Source #

type Rep PeerId Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

type Rep PeerId = D1 ('MetaData "PeerId" "Test.Consensus.PointSchedule.Peers" "main" 'False) (C1 ('MetaCons "HonestPeer" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "PeerId" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data Peers a Source #

General-purpose functor for a set of peers.

REVIEW: There is a duplicate entry for the honest peer, here. We should probably either have only the Map or have the keys of the map be String?

Alternatively, we could just have 'newtype PeerId = PeerId String' with an alias for 'HonestPeer = PeerId "honest"'?

Constructors

Peers 

Fields

Instances

Instances details
Functor Peers Source # 
Instance details

Defined in Test.Consensus.PointSchedule.Peers

Methods

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

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

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

Defined in Test.Consensus.PointSchedule.Peers

Methods

showsPrecIntPeers a → ShowS #

showPeers a → String #

showList ∷ [Peers a] → ShowS #

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

Defined in Test.Consensus.PointSchedule.Peers

Methods

(==)Peers a → Peers a → Bool #

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

fromMap'Map PeerId a → Peers a Source #

Same as fromMap but the map contains unwrapped values.

getPeerPeerIdPeers a → Peer a Source #

getPeerIdsPeers a → NonEmpty PeerId Source #

Extract all PeerIds.

mkPeers ∷ a → [a] → Peers a Source #

Construct Peers from values, adding adversary names based on the default schema. A single adversary gets the ID adversary, multiple get enumerated as adversary N.

mkPeers' ∷ a → [Peer a] → Peers a Source #

Make a Peers structure from the honest value and the other peers. Fail if one of the other peers is the HonestPeer.

peersFromPeerIdListNonEmpty PeerId → a → Peers a Source #

Make a Peers structure from a non-empty list of peer ids and a default value. Fails if the honest peer is not exactly once in the list.

peersFromPeerListNonEmpty (Peer a) → Peers a Source #

Make a Peers structure from a non-empty list of peers. Fail if the honest peer is not exactly once in the list.

peersListPeers a → NonEmpty (Peer a) Source #

Convert Peers to a list of Peer.

peersOnlyHonest ∷ a → Peers a Source #

A set of peers with only one honest peer carrying the given value.

toMapPeers a → Map PeerId (Peer a) Source #

toMap'Peers a → Map PeerId a Source #

Same as toMap but the map contains unwrapped values.

updatePeer ∷ (a → a) → PeerIdPeers a → Peers a Source #