License | BSD3 |
---|---|
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
- data MajorMinor ver = MajorMinor
- data Major maj = Major
- class OrdVersion ver where
- cmpVersion :: (ver ~ (proxy :: k -> *) (v1 :: k), ord ~ VersionOrd (proxy v1) (proxy v2), SingOrd ord) => proxy v1 -> proxy (v2 :: k) -> Proxy ord
- type family VersionOrd v1 v2 :: Ordering
- compareVersion :: (OrdVersion (proxy v1), SingOrd (VersionOrd (proxy v1) (proxy v2))) => proxy (v1 :: k) -> proxy (v2 :: k) -> Ordering
Versioning styles
data MajorMinor ver Source
A Style of versioning which has a Major version and a Minor version.
OrdVersion (MajorMinor ((,) Nat Nat maj min)) Source | |
type VersionOrd * (MajorMinor ((,) Nat Nat maj1 min1)) (MajorMinor ((,) Nat Nat maj2 min2)) = EQ Source |
A Style of versioning which has only has a Major version.
OrdVersion (Major maj) Source | |
type VersionOrd * (Major m) (Major n) = CmpNat m n Source |
Building custom versions
class OrdVersion ver where Source
Comparison between versions.
Nothing
cmpVersion :: (ver ~ (proxy :: k -> *) (v1 :: k), ord ~ VersionOrd (proxy v1) (proxy v2), SingOrd ord) => proxy v1 -> proxy (v2 :: k) -> Proxy ord Source
OrdVersion (Major maj) Source | |
OrdVersion (MajorMinor ((,) Nat Nat maj min)) Source |
type family VersionOrd v1 v2 :: Ordering Source
Defines ordering of versions.
type VersionOrd * (Major m) (Major n) = CmpNat m n Source | |
type VersionOrd * (MajorMinor ((,) Nat Nat maj1 min1)) (MajorMinor ((,) Nat Nat maj2 min2)) = EQ Source |
compareVersion :: (OrdVersion (proxy v1), SingOrd (VersionOrd (proxy v1) (proxy v2))) => proxy (v1 :: k) -> proxy (v2 :: k) -> Ordering Source
Comparison between two versions. Returns an Ord
.
>>>
compareVersion (MajorMinor :: MajorMinor (0, 0)) (MajorMinor :: MajorMinor (0, 1)) == LT
True