staversion-0.2.3.0: 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: Cabal-2.0.0.2

Instances
Eq Version 
Instance details

Defined in Distribution.Types.Version

Methods

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

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

Data Version 
Instance details

Defined in Distribution.Types.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 
Instance details

Defined in Distribution.Types.Version

Read Version 
Instance details

Defined in Distribution.Types.Version

Show Version 
Instance details

Defined in Distribution.Types.Version

Generic Version 
Instance details

Defined in Distribution.Types.Version

Associated Types

type Rep Version :: * -> * #

Methods

from :: Version -> Rep Version x #

to :: Rep Version x -> Version #

Text Version 
Instance details

Defined in Distribution.Types.Version

Methods

disp :: Version -> Doc #

parse :: ReadP r Version #

Parsec Version 
Instance details

Defined in Distribution.Types.Version

Methods

parsec :: CabalParsing m => m Version #

Pretty Version 
Instance details

Defined in Distribution.Types.Version

Methods

pretty :: Version -> Doc #

Binary Version 
Instance details

Defined in Distribution.Types.Version

Methods

put :: Version -> Put #

get :: Get Version #

putList :: [Version] -> Put #

NFData Version 
Instance details

Defined in Distribution.Types.Version

Methods

rnf :: Version -> () #

type Rep Version 
Instance details

Defined in Distribution.Types.Version

data VersionRange #

Instances
Eq VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Data VersionRange 
Instance details

Defined in Distribution.Types.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 
Instance details

Defined in Distribution.Types.VersionRange

Show VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Generic VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Associated Types

type Rep VersionRange :: * -> * #

Text VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Parsec VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Pretty VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Methods

pretty :: VersionRange -> Doc #

Binary VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

NFData VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

Methods

rnf :: VersionRange -> () #

type Rep VersionRange 
Instance details

Defined in Distribution.Types.VersionRange

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

data Bound #

Instances
Eq Bound 
Instance details

Defined in Distribution.Types.VersionInterval

Methods

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

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

Show Bound 
Instance details

Defined in Distribution.Types.VersionInterval

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.