staversion-0.2.1.3: What version is the package X in stackage lts-Y.ZZ?

MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Staversion.Internal.Version

Contents

Description

This is an internal module. End-users should not use it.

Synopsis

Re-exports

data Version :: * #

A Version represents the version of a software entity.

Instances of Eq and Ord are provided, which gives exact equality and lexicographic ordering of the version number components (i.e. 2.1 > 2.0, 1.2.3 > 1.2.2, etc.).

This type is opaque and distinct from the Version type in Data.Version since Cabal-2.0. The difference extends to the Binary instance using a different (and more compact) encoding.

Since: 2.0.0.2

Instances

Eq Version 

Methods

(==) :: Version -> Version -> Bool #

(/=) :: Version -> Version -> Bool #

Data Version 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Version -> c Version #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Version #

toConstr :: Version -> Constr #

dataTypeOf :: Version -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Version) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Version) #

gmapT :: (forall b. Data b => b -> b) -> Version -> Version #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r #

gmapQ :: (forall d. Data d => d -> u) -> Version -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Version -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Version -> m Version #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version #

Ord Version 
Read Version 
Show Version 
Generic Version 

Associated Types

type Rep Version :: * -> * #

Methods

from :: Version -> Rep Version x #

to :: Rep Version x -> Version #

Text Version 

Methods

disp :: Version -> Doc #

parse :: ReadP r Version #

Binary Version 

Methods

put :: Version -> Put #

get :: Get Version #

putList :: [Version] -> Put #

NFData Version 

Methods

rnf :: Version -> () #

type Rep Version 

data VersionRange :: * #

Instances

Eq VersionRange 
Data VersionRange 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> VersionRange -> c VersionRange #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c VersionRange #

toConstr :: VersionRange -> Constr #

dataTypeOf :: VersionRange -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c VersionRange) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VersionRange) #

gmapT :: (forall b. Data b => b -> b) -> VersionRange -> VersionRange #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VersionRange -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VersionRange -> r #

gmapQ :: (forall d. Data d => d -> u) -> VersionRange -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> VersionRange -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> VersionRange -> m VersionRange #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VersionRange -> m VersionRange #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VersionRange -> m VersionRange #

Read VersionRange 
Show VersionRange 
Generic VersionRange 

Associated Types

type Rep VersionRange :: * -> * #

Text VersionRange 
Binary VersionRange 
NFData VersionRange 

Methods

rnf :: VersionRange -> () #

type Rep VersionRange 
type Rep VersionRange = D1 * (MetaData "VersionRange" "Distribution.Version" "Cabal-2.0.1.0" False) ((:+:) * ((:+:) * ((:+:) * (C1 * (MetaCons "AnyVersion" PrefixI False) (U1 *)) (C1 * (MetaCons "ThisVersion" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Version)))) ((:+:) * (C1 * (MetaCons "LaterVersion" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Version))) (C1 * (MetaCons "EarlierVersion" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Version))))) ((:+:) * ((:+:) * (C1 * (MetaCons "WildcardVersion" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Version))) (C1 * (MetaCons "MajorBoundVersion" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Version)))) ((:+:) * (C1 * (MetaCons "UnionVersionRanges" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * VersionRange)) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * VersionRange)))) ((:+:) * (C1 * (MetaCons "IntersectVersionRanges" PrefixI False) ((:*:) * (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * VersionRange)) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * VersionRange)))) (C1 * (MetaCons "VersionRangeParens" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * VersionRange)))))))

data Bound :: * #

Instances

Eq Bound 

Methods

(==) :: Bound -> Bound -> Bool #

(/=) :: Bound -> Bound -> Bool #

Show Bound 

Methods

showsPrec :: Int -> Bound -> ShowS #

show :: Bound -> String #

showList :: [Bound] -> ShowS #

thisVersion :: Version -> VersionRange #

The version range == v

withinRange v' (thisVersion v) = v' == v

unionVersionRanges :: VersionRange -> VersionRange -> VersionRange #

The version range vr1 || vr2

  withinRange v' (unionVersionRanges vr1 vr2)
= withinRange v' vr1 || withinRange v' vr2

simplifyVersionRange :: VersionRange -> VersionRange #

Simplify a VersionRange expression. For non-empty version ranges this produces a canonical form. Empty or inconsistent version ranges are left as-is because that provides more information.

If you need a canonical form use fromVersionIntervals . toVersionIntervals

It satisfies the following properties:

withinRange v (simplifyVersionRange r) = withinRange v r
    withinRange v r = withinRange v r'
==> simplifyVersionRange r = simplifyVersionRange r'
 || isNoVersion r
 || isNoVersion r'

fromVersionIntervals :: VersionIntervals -> VersionRange #

Convert a VersionIntervals value back into a VersionRange expression representing the version intervals.

asVersionIntervals :: VersionRange -> [VersionInterval] #

View a VersionRange as a union of intervals.

This provides a canonical view of the semantics of a VersionRange as opposed to the syntax of the expression used to define it. For the syntactic view use foldVersionRange.

Each interval is non-empty. The sequence is in increasing order and no intervals overlap or touch. Therefore only the first and last can be unbounded. The sequence can be empty if the range is empty (e.g. a range expression like && 2).

Other checks are trivial to implement using this view. For example:

isNoVersion vr | [] <- asVersionIntervals vr = True
               | otherwise                   = False
isSpecificVersion vr
   | [(LowerBound v  InclusiveBound
      ,UpperBound v' InclusiveBound)] <- asVersionIntervals vr
   , v == v'   = Just v
   | otherwise = Nothing

Compatibility

Util

type BaseVersion = Version Source #

A Version type by Data.Version.

parseVersionText :: Text -> Maybe Version Source #

Parse a version text. There must not be any trailing characters after a valid version text.