ouroboros-network-framework
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 #

(<$) :: a -> Versions vNum extra b -> Versions vNum extra a #

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 #

sconcat :: NonEmpty (Versions vNum vData r) -> Versions vNum vData r #

stimes :: Integral b => b -> Versions vNum vData r -> Versions vNum vData r #

updateVersionData :: (vData -> vData) -> 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 #

(<$) :: a -> Version vData b -> Version vData a #

data VersionMismatch vNum where Source #

Constructors

NoCommonVersion :: forall vNum. VersionMismatch vNum 
InconsistentVersion :: forall vNum. 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 #

Re-exports

data Accept vData #

A Maybe like type which better explains its purpose.

Constructors

Accept vData 
Refuse !Text 

Instances

Instances details
Show vData => Show (Accept vData) 
Instance details

Defined in Ouroboros.Network.Handshake.Acceptable

Methods

showsPrec :: Int -> Accept vData -> ShowS #

show :: Accept vData -> String #

showList :: [Accept vData] -> ShowS #

Eq vData => Eq (Accept vData) 
Instance details

Defined in Ouroboros.Network.Handshake.Acceptable

Methods

(==) :: Accept vData -> Accept vData -> Bool #

(/=) :: Accept vData -> Accept vData -> Bool #