webapi-0.3: WAI based library for web api

LicenseBSD3
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

WebApi.Versioning

Contents

Description

 

Synopsis

Versioning styles

data MajorMinor ver Source

A Style of versioning which has a Major version and a Minor version.

Constructors

MajorMinor 

Instances

OrdVersion (MajorMinor ((,) Nat Nat maj min)) Source 
type VersionOrd * (MajorMinor ((,) Nat Nat maj1 min1)) (MajorMinor ((,) Nat Nat maj2 min2)) = EQ Source 

data Major maj Source

A Style of versioning which has only has a Major version.

Constructors

Major 

Instances

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.

Minimal complete definition

Nothing

Methods

cmpVersion :: (ver ~ (proxy :: k -> *) (v1 :: k), ord ~ VersionOrd (proxy v1) (proxy v2), SingOrd ord) => proxy v1 -> proxy (v2 :: k) -> Proxy ord Source

Instances

type family VersionOrd v1 v2 :: Ordering Source

Defines ordering of versions.

Instances

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