Distribution.Types.Version

Cabal-2.2.0.1: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Types.Version

Contents

- Package versions
  - Backwards compatibility
- Internal

Synopsis

- data Version
- mkVersion :: [Int] -> Version
- mkVersion' :: Version -> Version
- versionNumbers :: Version -> [Int]
- nullVersion :: Version
- alterVersion :: ([Int] -> [Int]) -> Version -> Version
- version0 :: Version
- showVersion :: Version -> String
- validVersion :: Version -> Bool

# Package versions

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 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Version Source # toConstr :: Version -> Constr Source # dataTypeOf :: Version -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Version) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Version) Source # gmapT :: (forall b. Data b => b -> b) -> Version -> Version Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Version -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Version -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Version -> m Version Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version Source #
Ord Version # |
Instance details Defined in Distribution.Types.Version Methods compare :: Version -> Version -> Ordering # (<) :: Version -> Version -> Bool # (<=) :: Version -> Version -> Bool # (>) :: Version -> Version -> Bool # (>=) :: Version -> Version -> Bool # max :: Version -> Version -> Version # min :: Version -> Version -> Version #
Read Version # |
Instance details Defined in Distribution.Types.Version Methods readsPrec :: Int -> ReadS Version Source # readList :: ReadS [Version] Source # readPrec :: ReadPrec Version Source # readListPrec :: ReadPrec [Version] Source #
Show Version # |
Instance details Defined in Distribution.Types.Version Methods showsPrec :: Int -> Version -> ShowS Source # show :: Version -> String Source # showList :: [Version] -> ShowS Source #
Generic Version # |
Instance details Defined in Distribution.Types.Version Associated Types type Rep Version :: * -> * Source # Methods from :: Version -> Rep Version x Source # to :: Rep Version x -> Version Source #
NFData Version # |
Instance details Defined in Distribution.Types.Version Methods rnf :: Version -> () Source #
Binary Version # |
Instance details Defined in Distribution.Types.Version Methods put :: Version -> Put Source # get :: Get Version Source # putList :: [Version] -> Put Source #
Pretty Version # |
Instance details Defined in Distribution.Types.Version Methods pretty :: Version -> Doc #
Parsec Version # |
Instance details Defined in Distribution.Types.Version Methods parsec :: CabalParsing m => m Version #
Text Version # |
Instance details Defined in Distribution.Types.Version Methods disp :: Version -> Doc # parse :: ReadP r Version #
Newtype SpecVersion (Either Version VersionRange) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: Either Version VersionRange -> SpecVersion # unpack :: SpecVersion -> Either Version VersionRange #
type Rep Version # |
Instance details Defined in Distribution.Types.Version type Rep Version = D1 (MetaData "Version" "Distribution.Types.Version" "Cabal-2.2.0.1" False) (C1 (MetaCons "PV0" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Word64)) :+: C1 (MetaCons "PV1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Int])))

mkVersion :: [Int] -> Version #

Construct `Version` from list of version number components.

For instance, `mkVersion [3,2,1]` constructs a `Version` representing the version `3.2.1`.

All version components must be non-negative. `mkVersion []` currently represents the special null version; see also `nullVersion`.

Since: Cabal-2.0.0.2

mkVersion' :: Version -> Version #

Variant of `Version` which converts a Data.Version `Version` into Cabal's `Version` type.

Since: Cabal-2.0.0.2

versionNumbers :: Version -> [Int] #

Unpack `Version` into list of version number components.

This is the inverse to `mkVersion`, so the following holds:

    (versionNumbers . mkVersion) vs == vs

Since: Cabal-2.0.0.2

nullVersion :: Version #

Constant representing the special null `Version`

The `nullVersion` compares (via `Ord`) as less than every proper `Version` value.

Since: Cabal-2.0.0.2

alterVersion :: ([Int] -> [Int]) -> Version -> Version #

Apply function to list of version number components

    alterVersion f == mkVersion . f . versionNumbers

Since: Cabal-2.0.0.2

version0 :: Version #

Version 0. A lower bound of `Version`.

Since: Cabal-2.2

## Backwards compatibility

showVersion :: Version -> String #

Deprecated: Use prettyShow. This function will be removed in Cabal-3.0 (estimated Oct 2018)

# Internal

validVersion :: Version -> Bool #