- Bumped upper bound on
base
.
- Account for large numbers when parsing on 32-bit (or smaller) systems.
- Certain illegal versions were parsing as PVP.
- Bump dependencies to support GHC 9.8.
Data
instances for the various data types.- Simple conversion functions between the main version types.
- Compile-time constructors via Template Haskell, like
versioningQ
.
Lift
instances for the various types, which allows parsing version numbers at compile time within Template Haskell quotes. Currently there is no exported function that supports this directly, but you could write one like:
-- | Parse a `Versioning` at compile time.
thVer :: Text -> Q Exp
thVer nm =
case versioning nm of
Left err -> fail (errorBundlePretty err)
Right v -> lift v
- Due to the new dependency on
template-haskell
, GHC 8.8 is now the lowest supported compiler version.
- Restored the ability to compile with GHC versions earlier than 9.
A number of type changes have been made to improve parsing and comparison logic. Doing so fixed several bugs and made the code cleaner overall.
If you're just doing basic parsing and comparisons and not actually inspecting the types themselves, you shouldn't notice a difference.
- New types
Release
,Chunks
, andChunk
.
- Both
SemVer
andVersion
now contain a better-behavingRelease
type for their prerelease info. - Similarly,
Version
now also has a better-behavingChunks
type for its main version number sections. - The
release
traversal now yields aMaybe Release
. - Versions with
~
in their metadata will now parse as aMess
. Example:12.0.0-3ubuntu1~20.04.5
- The various
Semigroup
instances. Adding version numbers together is a nonsensical operation and should never have been added in the first place. - The
VChunk
andVUnit
types and their associated functions.
- Leading zeroes are handled a little better in
SemVer
pre-release data.
- Bumped
base
bound to support GHC 9.6.
- Bumped
base
bound to support GHC 9.4.
- A bug in
prettyVer
that flipped the order of thepreRel
andmeta
fields.
text-2.0
support.
- Support for GHC 9.2.
- Remove redundant pattern match.
This release brings versions
in line with version 2.0.0
of the SemVer spec.
The main addition to the spec is the allowance of hyphens in both the prerelease
and metadata sections. As such, certain versions like 1.2.3+1-1
which
previously would not parse as SemVer now do.
To accomodate this and other small spec updates, the SemVer
and Version
types have received breaking changes here.
- Breaking: The
_svMeta
field ofSemVer
is now parsed as a dumberMaybe Text
instead of[VChunk]
, due to metadata now being allowed to possess leading zeroes. - Breaking: Like the above, the
_vMeta
field ofVersion
is nowMaybe Text
. - Breaking: The
_vRel
and_vMeta
fields ofVersion
have had their order flipped. Further, the prelease and meta sections are now expected in the same order asSemVer
when parsing (prerel first, meta second).Version
is thus now a quite similar toSemVer
, except allowing letters in more permissive positions. - Breaking: The
meta
traversal has been altered to accomodate the metadata field changes.
- Parsing certain legal SemVers specified in the spec.
- Support for GHC 9.
- A bug in zero parsing within SemVer prereleases. #42
- An infinite loop in
Version
comparison. aura#652
- Breaking:
VChunk
now cannot be empty. - Breaking: A
Version
now guaranteesNonEmpty
chunks. - Breaking: A
Mess
now guaranteesNonEmpty
chunks, and its structure has been significantly changed. Particularly,Mess
values are now aware of theInt
values they hold (when they do), as well as "revision" values of the patternrXYZ
. - Comparison of
Version
values is more memory efficient.
Version
now has an extra field,_vMeta :: [VChunk]
for capturing "metadata" like Semver. This prevents otherwise nice-looking versions from being demoted toMess
.- The
MChunk
type to accomodate the changes toMess
mentioned above.
- Breaking:
Version
no longer has aMonoid
instance.
""
no longer parses in any way. #32- Version strings with trailing whitespace no longer parse via
versioning
. #33 - Particular edge cases involving
Mess
comparisons. aura#646 - A particular edge case involving prereleases in
Version
comparisons. aura#586
- The functions
isIdeal
,isGeneral
, andisComplex
forBool
-based inspection of parse results. messMajor
,messMinor
,messPatch
, andmessPatchChunk
for improved introspection intoMess
values.
- Improved
Mess
comparison logic.
- GHC 8.10 support.
- Added a new
PVP
type and parsers.
- GHC 8.8 compatibility.
- Updated to
megaparsec-7
. OurParsingError
type alias has changed to match Megaparsec's new error model, anderrorBundlePretty
is now exposed instead of the oldparseErrorPretty
.
- Enhanced the whitespace handling in
semver'
,version'
, andmess'
.
- Removed
ParseV
and surrounding machinery. Useversioning
now instead of theparseV
function.
- GHC 8.4.1 compatibility.
- New
Semantic
typeclass that provides Traversals for SemVer-like data out of all the version types.Text
was also given an instance, so its much easier to manipulate directly:
λ "1.2.3" & minor %~ (+ 1)
"1.3.3"
Some Lenses and Traversals had their names changed or were removed entirely to accomodate this new typeclass.
SemVer
andVersion
should never contain negative values, so their numeric components were changed fromInt
toWord
.
- Updated for
megaparsec-6
and GHC 8.2.
- Added instances for common typeclasses:
Generic
,NFData
, andHashable
. This is to avoid having users define these instances themselves as orphans. If there are more instances you want added, please let me know.Data
was left out on purpose.
- Added support for epoch numbers in the
Version
type. These are numbers like the1:
in1:2.3.4
. These are used in Arch Linux in rare cases where packages change their versioning scheme, but need a reliable integer prefix to establish ordering. TheVersion
type has been given a new field,_vEpoch :: Maybe Int
, and a corresponding lens,vEpoch
.
- Expose internal parsers so that they could be used in other parser programs that parse version numbers in larger files.
- Updated for
megaparsec-5
andghc-8
- Switched to
megaparsec
to perform all parsing asText
- Support for legacy
String
removed - Added more Traversals and INLINE'd all Lenses/Traversals
- Added Lenses and Traversals (no
lens
dependency)