Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.Protocol.Handshake.Version
Contents
Synopsis
-
newtype
Versions
vNum vData r =
Versions
{
- getVersions :: Map vNum ( Version vData r)
-
data
Version
vData r =
Version
{
- versionApplication :: vData -> r
- versionData :: vData
- data Accept vData
-
class
Acceptable
v
where
- acceptableVersion :: v -> v -> Accept v
-
data
VersionMismatch
vNum
where
- NoCommonVersion :: VersionMismatch vNum
- InconsistentVersion :: vNum -> VersionMismatch vNum
- simpleSingletonVersions :: vNum -> vData -> r -> Versions vNum vData r
- foldMapVersions :: ( Ord vNum, Foldable f, HasCallStack ) => (x -> Versions vNum extra r) -> f x -> Versions vNum extra r
- combineVersions :: ( Ord vNum, Foldable f, HasCallStack ) => f ( Versions vNum extra r) -> Versions vNum extra r
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
|
Constructors
Version | |
Fields
|
A
like type which better explains its purpose.
Maybe
class Acceptable v where Source #
Methods
acceptableVersion :: v -> v -> Accept v Source #
data VersionMismatch vNum where Source #
Constructors
NoCommonVersion :: VersionMismatch 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 #
combineVersions :: ( Ord vNum, Foldable f, HasCallStack ) => f ( Versions vNum extra r) -> Versions vNum extra r Source #