|
7 | 7 |
|
8 | 8 | -- |
|
9 | 9 | -- Module : Data.Versions
|
10 |
| --- Copyright : (c) Colin Woodbury, 2015 - 2020 |
| 10 | +-- Copyright : (c) Colin Woodbury, 2015 - 2021 |
11 | 11 | -- License : BSD3
|
12 | 12 | -- Maintainer: Colin Woodbury <[email protected]>
|
13 | 13 | --
|
|
29 | 29 | -- currently using it. It provides consistency in version incrementing and has
|
30 | 30 | -- the best constraints on comparisons.
|
31 | 31 | --
|
| 32 | +-- __This library implements version @2.0.0@ of the SemVer spec.__ |
| 33 | +-- |
32 | 34 | -- == Using the Parsers
|
33 | 35 | -- In general, `versioning` is the function you want. It attempts to parse a
|
34 | 36 | -- given `Text` using the three individual parsers, `semver`, `version` and
|
@@ -250,16 +252,19 @@ _Mess :: Traversal' Text Mess
|
250 | 252 | _Mess f t = either (const (pure t)) (fmap prettyMess . f) $ mess t
|
251 | 253 | {-# INLINE _Mess #-}
|
252 | 254 |
|
| 255 | +-- | Possibly extract a `SemVer` from a `Versioning`. |
253 | 256 | _Ideal :: Traversal' Versioning SemVer
|
254 | 257 | _Ideal f (Ideal s) = Ideal <$> f s
|
255 | 258 | _Ideal _ v = pure v
|
256 | 259 | {-# INLINE _Ideal #-}
|
257 | 260 |
|
| 261 | +-- | Possibly extract a `Version` from a `Versioning`. |
258 | 262 | _General :: Traversal' Versioning Version
|
259 | 263 | _General f (General v) = General <$> f v
|
260 | 264 | _General _ v = pure v
|
261 | 265 | {-# INLINE _General #-}
|
262 | 266 |
|
| 267 | +-- | Possibly extract a `Mess` from a `Versioning`. |
263 | 268 | _Complex :: Traversal' Versioning Mess
|
264 | 269 | _Complex f (Complex m) = Complex <$> f m
|
265 | 270 | _Complex _ v = pure v
|
@@ -422,11 +427,13 @@ digits = Digits
|
422 | 427 | str :: Text -> Maybe VUnit
|
423 | 428 | str t = bool Nothing (Just $ Str t) $ T.all isAlpha t
|
424 | 429 |
|
| 430 | +-- | Possibly traverse the inner digit value of a `VUnit`. |
425 | 431 | _Digits :: Traversal' VUnit Word
|
426 | 432 | _Digits f (Digits i) = Digits <$> f i
|
427 | 433 | _Digits _ v = pure v
|
428 | 434 | {-# INLINE _Digits #-}
|
429 | 435 |
|
| 436 | +-- | Possibly traverse the inner text of a `VUnit`. |
430 | 437 | _Str :: Traversal' VUnit Text
|
431 | 438 | _Str f (Str t) = Str . (\t' -> bool t t' (T.all isAlpha t')) <$> f t
|
432 | 439 | _Str _ v = pure v
|
@@ -611,6 +618,7 @@ instance Semantic Version where
|
611 | 618 | semantic _ v = pure v
|
612 | 619 | {-# INLINE semantic #-}
|
613 | 620 |
|
| 621 | +-- | A `Version`'s inner epoch `Word`. |
614 | 622 | epoch :: Lens' Version (Maybe Word)
|
615 | 623 | epoch f v = fmap (\ve -> v { _vEpoch = ve }) (f $ _vEpoch v)
|
616 | 624 | {-# INLINE epoch #-}
|
@@ -738,7 +746,7 @@ data VSep = VColon | VHyphen | VPlus | VUnder
|
738 | 746 | --------------------------------------------------------------------------------
|
739 | 747 | -- Parsing
|
740 | 748 |
|
741 |
| --- | A synonym for the more verbose `megaparsec` error type. |
| 749 | +-- | A synonym for the more verbose 'megaparsec' error type. |
742 | 750 | type ParsingError = ParseErrorBundle Text Void
|
743 | 751 |
|
744 | 752 | -- | Parse a piece of `Text` into either an (Ideal) `SemVer`, a (General)
|
|
0 commit comments