Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Versions vNum vData r = Versions {
- getVersions ∷ Map vNum (Version vData r)
- data Version vData r = Version {
- versionApplication ∷ vData → r
- versionData ∷ vData
- 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
- 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 | |
|
Version | |
|
data VersionMismatch vNum where Source #
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 #
Re-exports
A
like type which better explains its purpose.Maybe
class Acceptable v where Source #
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.
class Queryable v where Source #
queryVersion ∷ v → Bool Source #
Whether or not there was a query for the supported version.