Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Versions vNum vData r = Versions {
- getVersions :: Map vNum (Version vData r)
- updateVersionData :: (vData -> vData) -> Versions vNum vData r -> Versions vNum vData r
- data Version vData r = Version {
- versionApplication :: vData -> r
- versionData :: vData
- data VersionMismatch vNum where
- NoCommonVersion :: forall vNum. VersionMismatch vNum
- InconsistentVersion :: forall vNum. 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
- data Accept vData
- class Acceptable v where
- acceptableVersion :: v -> v -> Accept v
- class Queryable v where
- queryVersion :: v -> Bool
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 ...) , ... ]
Versions | |
|
updateVersionData :: (vData -> vData) -> Versions vNum vData r -> Versions vNum vData r Source #
Version | |
|
data VersionMismatch vNum where Source #
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 #
combineVersions :: (Ord vNum, Foldable f, HasCallStack) => f (Versions vNum extra r) -> Versions vNum extra r Source #
Re-exports
A
like type which better explains its purpose.Maybe
class Acceptable v where #
acceptableVersion :: v -> v -> Accept v #
The acceptableVersion
function ought to be symmetric, this guarantees
that local and remote sides will agree on the same data.
queryVersion :: v -> Bool #
Whether or not there was a query for the supported version.