úÎMðI}9      !"#$%&'()*+,-./012345678(c) Colin Woodbury, 2015, 2016BSD3"Colin Woodbury <colingw@gmail.com>Safe+“A wrapper for a parser function. Can be composed via their Semigroup instance, such that a different parser can be tried if a previous one fails.mDevelopers use a number of symbols to seperate groups of digits/letters in their version numbers. These are:&A colon (:). Often denotes an "epoch". A hyphen (-).EA plus (+). Stop using this outside of metadata if you are. Example:  10.2+0.93+1-1.An underscore (_). Stop using this if you are.A (Complex) Mess. This is a  descriptiveQ parser, based on examples of stupidly crafted version numbers used in the wild.[Groups of letters/numbers, separated by a period, can be further separated by the symbols _-+:Unfortunately, VChunk=s cannot be used here, as some developers have numbers like 1.003.04 which make parsers quite sad..Not guaranteed to have well-defined ordering (Ord8) behaviour, but so far interal tests show consistency. .A (General) Version. Not quite as ideal as a Y, but has some internal consistancy from version to version. Generally conforms to the x.x.x-x pattern. Examples of Version that are not SemVer: 0.25-2, 8.u51-1, 20150826-1QA logical unit of a version number. Can consist of multiple letters and numbers.aA single unit of a Version. May be digits or a string of characters. Groups of these are called ?s, and are the identifiers separated by periods in the source.KAn (Ideal) version number that conforms to Semantic Versioning. This is a  prescriptive0 parser, meaning it follows the SemVer standard.<Legal semvers are of the form: MAJOR.MINOR.PATCH-PREREL+METAExample: 1.2.3-r1+commithash Extra Rules: Pre-release versions have lower! precedence than normal versions.2Build metadata does not affect version precedence.For more information, see http://semver.orgôA top-level Versioning type. Acts as a wrapper for the more specific types. This allows each subtype to have its own parser, and for said parsers to be composed. This is useful for specifying custom behaviour for when a certain parser fails.,Traverse some Text for its inner versioning. )_Versioning :: Traversal' Text Versioning >("1.2.3" & _Versioning . _Ideal . svPatch %~ (+ 1)) == "1.2.4" &_Ideal :: Traversal' Versioning SemVer )_General :: Traversal' Versioning Version! &_Complex :: Traversal' Versioning Mess9 Convert a  to a  .: Convert a   to a ." svMajor :: Lens' SemVer Int# svMinor :: Lens' SemVer Int$ svPatch :: Lens' SemVer Int% svPreRel :: Lens' SemVer Int& svMeta :: Lens' SemVer Int' _Digits :: Traversal' VUnit Int( _Str :: Traversal' VUnit Text) !vChunks :: Lens' Version [VChunk]* vRel :: Lens' Version [VChunk]+Parse a piece of TextJ into either an (Ideal) SemVer, a (General) Version, or a (Complex) Mess., A wrapped , parser. Can be composed with other parsers.-!Parse a (Ideal) Semantic Version..-Parse a Semantic Version, as a legacy String.;DParse a group of digits, which can't be lead by a 0, unless it is 0./ A wrapped  , parser. Can be composed with other parsers.0Parse a (General)  , as defined above.1Parse a  %, where the input is a legacy String.2 A wrapped , parser. Can be composed with other parsers.3Parse a (Complex) , as defined above. 4Parse a %, where the input is a legacy String.5AConvert any parsed Versioning type to its textual representation.6 Convert a $ back to its textual representation.7 Convert a  $ back to its textual representation.8 Convert a $ back to its textual representation.< Analogous to = and >k. If a given Foldable is empty, a default value is returned. Else, a function is applied to that Foldable.?Flip an Ordering.@2Build metadata does not affect version precedence.A>Two SemVers are equal if all fields except metadata are equal.BComparison of Ideals is always well defined.If comparison of General's is well-defined, then comparison of Ideal and General: is well-defined, as there exists a perfect mapping from Ideal to General.If comparison of Complex'es is well-defined, then comparison of General and ComplexB is well defined for the same reason. This implies comparison of Ideal and Complex is also well-defined.U  !9:"#$%&'()*+,-.C;DEFGHIJK/01L234MNOPQR5678S<?TUV@AB9  !"#$%&'()*+,-./0123456789  -.0134+,/25678 !"#$%&)*'(?   !9:"#$%&'()*+,-.C;DEFGHIJK/01L234MNOPQR5678S<?TUV@ABW       !"#$%&'()*+,-./0123456789:;<=><?@ABCDEFGHIJKLMNOPQRSTUVWXYversi_4fMhmaZrhtvKrmqzZNwsg4 Data.VersionsVParserrunVPVSepVColonVHyphenVPlusVUnderMessVLeafVNodeVersion_vChunks_vRelVChunkVUnitDigitsStrSemVer_svMajor_svMinor_svPatch _svPreRel_svMeta VersioningIdealGeneralComplex _Versioning_Ideal_General_ComplexsvMajorsvMinorsvPatchsvPreRelsvMeta_Digits_StrvChunksvRelparseVsemverPsemversemver'versionPversionversion'messPmessmess'prettyV prettySemVer prettyVer prettyMessvFromSmFromVdigitsfoldablebase Data.Maybemaybe Data.Eithereitheropposite $fOrdSemVer $fEqSemVer$fOrdVersioningsemanticVersionmajorminorpatchpreRelmetaDatachunksiunitsunit versionNum messNumberleafnodetchunkssepsepCh chunksAsTshowt$fSemigroupVParser $fOrdMess