ouroboros-network-framework-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.Handshake.Version

Synopsis

Documentation

newtype Versions vNum vData r Source #

The version map supported by the local agent keyed on the version identifier.

Each Version contains a function which takes negotiated version data and returns negotiated application (the r type variable).

If one needs to combine multiple versions the simplest way is to use one of the combinators: foldMapVersions, combineVersions or the Semigroup instance directly:

fold $ (simpleSingletonVersions ...)
      :| [ (simpleSingletonVersions ...)
         , (simpleSingletonVersions ...)
         , ...
         ]

Constructors

Versions 

Fields

Instances

Instances details
Functor (Versions vNum extra) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

fmap ∷ (a → b) → Versions vNum extra a → Versions vNum extra b Source #

(<$) ∷ a → Versions vNum extra b → Versions vNum extra a Source #

Ord vNum ⇒ Semigroup (Versions vNum vData r) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

(<>)Versions vNum vData r → Versions vNum vData r → Versions vNum vData r Source #

sconcatNonEmpty (Versions vNum vData r) → Versions vNum vData r Source #

stimesIntegral b ⇒ b → Versions vNum vData r → Versions vNum vData r Source #

data Version vData r Source #

Constructors

Version 

Fields

Instances

Instances details
Functor (Version vData) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

fmap ∷ (a → b) → Version vData a → Version vData b Source #

(<$) ∷ a → Version vData b → Version vData a Source #

data Accept vData Source #

A Maybe like type which better explains its purpose.

Constructors

Accept vData 
Refuse !Text 

Instances

Instances details
Eq vData ⇒ Eq (Accept vData) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

(==)Accept vData → Accept vData → Bool Source #

(/=)Accept vData → Accept vData → Bool Source #

Show vData ⇒ Show (Accept vData) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.Handshake.Version

Methods

showsPrecIntAccept vData → ShowS Source #

showAccept vData → String Source #

showList ∷ [Accept vData] → ShowS Source #

class Acceptable v where Source #

Methods

acceptableVersion ∷ v → v → Accept v Source #

The acceptableVersion function ought to be symmetric, this guarantees that local and remote sides will agree on the same data.

data VersionMismatch vNum where Source #

Constructors

NoCommonVersionVersionMismatch vNum 
InconsistentVersion ∷ vNum → VersionMismatch vNum 

Simple or no versioning

simpleSingletonVersions ∷ vNum → vData → r → Versions vNum vData r Source #

Singleton smart constructor for Versions.

foldMapVersions ∷ (Ord vNum, Foldable f, HasCallStack) ⇒ (x → Versions vNum extra r) → f x → Versions vNum extra r Source #

Useful for folding multiple Versions.

A foldMap restricted to the Versions Semigroup.

PRECONDITION: f x is non-empty.

combineVersions ∷ (Ord vNum, Foldable f, HasCallStack) ⇒ f (Versions vNum extra r) → Versions vNum extra r Source #