Documentation

SemVer.Basic

SemVer.Basic - Types for Version Numbers #

Semantic Versioning defines a grammar for versions and precedence rules for two version.

Basic.lean provides the types for the the left-hand side of a grammar rules in Backus–Naur Form Grammar for Valid SemVer Versions.

@[implicit_reducible]

String.Slice has no Repr but uses ToString instead. However, the default implementation does not provide the surrounding quotes (") and that's an own instance is provided that overrides the default.

Before defining an instance for Repr String.Slice:

#synth (Repr String.Slice) -- failed to synthesize Repr Slice
#synth (ToString String.Slice) -- instToString
#eval "abc" -- "abc"
#eval "abc".toSlice -- abc without surrounding quotes

After defining the own instance:

#synth (Repr String.Slice) -- instRepr_semVer
#eval "abc".toSlice -- "abc" with surrounding quotes
Equations

Returns the n preceding characters of s in underlying string as String.Slice. If there are less then n characters before s, all characters preceding s are returned.

def s : String.Slice := "red green blue".slice ⟨⟨4⟩, by decide⟩ ⟨⟨9⟩, by decide⟩ (by decide)

#eval s -- "green"
#eval s.getPrefixn 2 -- "d "
#eval s.getPrefixn 10 -- "red "
Equations
Instances For

    Returns the full prefix of s (i.e. all characters before s) in the underlying string as String.Slice.

    Equations
    Instances For

      Returns the n succeeding characters of s in underlying string as String.Slice. If there are less then n characters after s, all characters following s are returned.

      def s : String.Slice := "red green blue".slice ⟨⟨4⟩, by decide⟩ ⟨⟨9⟩, by decide⟩ (by decide)
      
      #eval s -- "green"
      #eval s.getSuffixn 2 -- " b"
      #eval s.getSuffixn 10 -- " blue"
      
      Equations
      Instances For

        Returns the full suffix of s (i.e. all characters after s) within the underlying string as String.Slice.

        Equations
        Instances For
          structure ParserError :

          If parsing fails, a ParserError is returned. In that, message gives an explanation of the error and input optionally provides the section of the input string that could not be parsed and thus caused the error.

          Instances For
            @[implicit_reducible]
            Equations
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[implicit_reducible]
              Equations
              Equations
              Instances For

                Returns a formatted string that contains the error message some context if some slice is provided.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[implicit_reducible]

                  Defines a default with "unknown error" as message and no input.

                  Equations
                  inductive ParserResult (α : Type) :

                  Parsers return a ParserResult. If parsing was successful, some value of type α is included, which has by retrieved from the input. If the input was incorrect, ParserResult is wrapper of a ParserError.

                  Instances For
                    @[implicit_reducible]
                    instance instReprParserResult {α✝ : Type} [Repr α✝] :
                    Equations
                    def instReprParserResult.repr {α✝ : Type} [Repr α✝] :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[implicit_reducible]
                      instance instBEqParserResult {α✝ : Type} [BEq α✝] :
                      Equations
                      @[implicit_reducible]

                      Defines a default for ParserResult α based on the default of ParserError.

                      Equations
                      @[implicit_reducible]
                      Equations

                      Returns true iff the ParserResult results from a successful parser call.

                      Equations
                      Instances For
                        def ParserResult.to? {α : Type} (res : ParserResult α) :

                        Converts a parser result of type ParserResult α into a value if type Option α that is none in case of failure and some result if parsing was successful.

                        Equations
                        Instances For
                          def ParserResult.to! {α : Type} [Inhabited α] (res : ParserResult α) :
                          α

                          Unwraps the value from a .successful parser result and panics if a ParserResult with a .failure is provided.

                          Equations
                          Instances For
                            def ParserResult.toIO! {α : Type} (res : ParserResult α) :
                            IO α

                            Converts the value from a successful parser result into an term of IO α and throws an error, if a ParserResult with .failure is provided.

                            Equations
                            Instances For
                              class Parser (α : Type) :

                              A Parser provides function parse that takes a String.Slice as input and returns a ParserResult.

                              Instances
                                class SplitMapParser (α : Type) [Parser α] (β : TypeType) :

                                A SplitMapParser implements parse by splitting the provided String.Slice based on separator sep and mapping Parser α to each sub-slice.

                                Instances
                                  def NonEmptyList (α : Type) :

                                  Defines non-empty lists as subtype of List.

                                  Equations
                                  Instances For
                                    def NonEmptyList.repr {α : Type} [Repr α] (a : NonEmptyList α) (n : Nat) :

                                    Provides a representation for a non-empty list so that #eval can be used.

                                    Equations
                                    Instances For
                                      @[implicit_reducible]
                                      instance NonEmptyList.instRepr (α : Type) [Repr α] :
                                      Equations
                                      def NonEmptyList.lt {α : Type} [LT α] (a b : NonEmptyList α) :

                                      Less-than-relation for non-empty lists, which is List.lt applied to the two lists (lexicographic ordering of lists with respect to an ordering on their elements).

                                      Equations
                                      Instances For
                                        @[implicit_reducible]
                                        instance NonEmptyList.instLT (α : Type) [LT α] :
                                        Equations
                                        def NonEmptyList.decLt {α : Type} [DecidableEq α] [LT α] [DecidableLT α] (a b : NonEmptyList α) :
                                        Decidable (a < b)

                                        Decidable less-than for NonEmptyList.

                                        Equations
                                        Instances For

                                          Renders a non-empty list as string with its elements separated by ".".

                                          For instance,

                                          #eval toDotSeparatedString (⟨[0, 1, 2, 3, 4], rfl⟩ : NonEmptyList Nat)
                                          

                                          results in "0.1.2.3.4".

                                          Equations
                                          Instances For

                                            Parses the given string slice and, if possible, returns a result containing a non-empty list of terms of type α.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              Equations
                                              Instances For

                                                Defines non-empty strings as subtype of String.

                                                They ensure that the requirement "Identifiers MUST NOT be empty." fulfilled that is stated as item #9 in semver.org.

                                                Equations
                                                Instances For

                                                  Less-than-relation for non-empty strings.

                                                  Equations
                                                  Instances For

                                                    decLt is the decidable <-relation for non-empty strings, which allows for comparing two non-empty strings as in

                                                    #eval decLt (⟨"abc", rfl⟩ : NonEmptyString) (⟨"bcd", rfl⟩ : NonEmptyString)
                                                    
                                                    Equations
                                                    Instances For
                                                      @[implicit_reducible]
                                                      Equations

                                                      Parses a given string slice and returns a result containing a non-empty string if possible and a result that wraps a ParserError otherwise.

                                                      Equations
                                                      Instances For

                                                        Converts a character representing a digit for base ten (10) to the natural number corresponding to this digit - for other characters none is returned.

                                                        This implementation is seemingly better suited for proofs compared to e.g.

                                                        def toDigit? (c: Char) : Option Nat :=
                                                          if c.isDigit then
                                                            some (c.toNat - '0'.toNat)
                                                          else
                                                            none
                                                        
                                                        Equations
                                                        Instances For

                                                          Is an alternative implementation to the standard function Char.isDigit that is based on Char.toDigit?.

                                                          This implementation appears to be better suited for proofs than Char.isDigit.

                                                          Equations
                                                          Instances For
                                                            def Char.toDigit (c : Char) (h : c.isDigit' = true) :

                                                            Returns the digit as natural number for a given character that is known to be one of '0', '1' ... '9'

                                                            Equations
                                                            Instances For

                                                              Converts a digit to a natural number and panics for characters that are not digits (for base ten).

                                                              Equations
                                                              Instances For

                                                                Returns true if the NonEmptyString that is provided as input only contains digits (for base ten). It is based on Char.isDigit', so that it easier to work with it in proofs.

                                                                Hence it is used here instead of shorter implementations like

                                                                def NonEmptyString.hasOnlyDigits (nes: NonEmptyString) : Bool := nes.val.isNat
                                                                
                                                                Equations
                                                                Instances For

                                                                  Defines a subtype of NonEmptyString with the restriction that all characters must be digits (for base ten).

                                                                  This is used for the definitions

                                                                    <digits> ::= <digit>
                                                                              | <digit> <digits>
                                                                  
                                                                    <digit> ::= "0"
                                                                              | <positive digit>
                                                                  
                                                                    <positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
                                                                  

                                                                  (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                  Equations
                                                                  Instances For
                                                                    @[implicit_reducible]
                                                                    Equations
                                                                    @[implicit_reducible]
                                                                    Equations
                                                                    @[implicit_reducible]
                                                                    Equations

                                                                    Converts a non-empty string of digits to Nat.

                                                                    Also here, shorter implementations exists like

                                                                    def toNat (nes: NonEmptyString) : Nat := nes.val.toNat!
                                                                    

                                                                    However, for direct use in proofs, this implementation appears as preferable.

                                                                    Equations
                                                                    Instances For
                                                                      def Digits.lt (a b : Digits) :

                                                                      Less-than-relation for digits, which is based on Nat (and not String) as defined in https://semver.org/ under 4.1:

                                                                      Identifiers consisting of only digits are compared numerically.
                                                                      

                                                                      This means that the canonical injection fun (a : Digits) => a.val is not a strictly increasing function as the following example shows:

                                                                      def a : NonEmptyString := ⟨"23", rfl⟩
                                                                      def b : NonEmptyString := ⟨"123", rfl⟩
                                                                      #eval b < a -- true
                                                                      
                                                                      def a' : Digits := ⟨a, rfl⟩
                                                                      def b' : Digits := ⟨b, rfl⟩
                                                                      #eval a' < b' -- true
                                                                      
                                                                      Equations
                                                                      Instances For
                                                                        @[implicit_reducible]
                                                                        Equations
                                                                        def Digits.decLt (a b : Digits) :
                                                                        Decidable (a < b)

                                                                        Decidable less-than for Digits.

                                                                        Equations
                                                                        Instances For
                                                                          @[implicit_reducible]
                                                                          instance Digits.decidableLT (a b : Digits) :
                                                                          Decidable (a < b)
                                                                          Equations

                                                                          Converts a string slice into Digits if possible - wrapped into a ParserResult.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            @[implicit_reducible]
                                                                            Equations

                                                                            Detects if a given term of type Digits has a leading zero.

                                                                            https://semver.org/ forbids leading zeros for both, numbers in the version core and numeric identifiers.

                                                                            Equations
                                                                            Instances For

                                                                              Numeric identifiers are sequences of digits without leading zeros.

                                                                              Examples: Strings "1234" and "0" are valid numeric identifiers while "01" is not.

                                                                              This is used for the definition

                                                                                <numeric identifier> ::= "0"
                                                                                                      | <positive digit>
                                                                                                      | <positive digit> <digits>
                                                                              

                                                                              (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                              Equations
                                                                              Instances For
                                                                                @[implicit_reducible]
                                                                                Equations
                                                                                @[implicit_reducible]
                                                                                Equations

                                                                                Converts a numeric identifier to a natural number.

                                                                                Equations
                                                                                Instances For

                                                                                  Less-than-relation for numerical identifiers, which is based on their value as natural number and not as strings.

                                                                                  Equations
                                                                                  Instances For
                                                                                    @[implicit_reducible]
                                                                                    Equations
                                                                                    def NumIdent.decLt (a b : NumIdent) :
                                                                                    Decidable (a < b)

                                                                                    Decidable less-than for NumIdent.

                                                                                    Equations
                                                                                    Instances For
                                                                                      @[implicit_reducible]
                                                                                      instance NumIdent.decidableLT (a b : NumIdent) :
                                                                                      Decidable (a < b)
                                                                                      Equations

                                                                                      Parses string slices into NumIdent wrapped into a ParserResult if possible.

                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        @[implicit_reducible]
                                                                                        Equations

                                                                                        Checks if a character is allowed for identifiers, i.e. it is either an letter (upper or lowercase), a digit (for base 10) or '-'.

                                                                                        This is used for the definition

                                                                                          <identifier character> ::= <digit>
                                                                                                                  | <non-digit>
                                                                                          <non-digit> ::= <letter>
                                                                                                      | "-"
                                                                                        
                                                                                          <digits> ::= <digit>
                                                                                                    | <digit> <digits>
                                                                                        
                                                                                          <digit> ::= "0"
                                                                                                    | <positive digit>
                                                                                        
                                                                                          <positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
                                                                                        
                                                                                          <letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J"
                                                                                                     | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
                                                                                                     | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d"
                                                                                                     | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n"
                                                                                                     | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x"
                                                                                                     | "y" | "z"
                                                                                        

                                                                                        (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                        Equations
                                                                                        Instances For

                                                                                          Checks if a NonEmptyString only contains characters that are allowed for identifiers.

                                                                                          The shorter implementation

                                                                                          def NonEmptyString.isAllowedAsIdentifier (s: NonEmptyString) : Bool :=
                                                                                            s.val.all Char.isAllowedForIdentifier
                                                                                          

                                                                                          does not work for statements like

                                                                                          example : NonEmptyString.isAllowedAsIdentifier ⟨"12ab", by decide⟩ == true := by decide
                                                                                          

                                                                                          with by decide as proof but requires seemingly a more sophisticated proof.

                                                                                          Equations
                                                                                          Instances For
                                                                                            def Ident :

                                                                                            Defines the base type for the different kinds of identifiers.

                                                                                            Equations
                                                                                            Instances For
                                                                                              @[implicit_reducible]
                                                                                              Equations
                                                                                              @[implicit_reducible]
                                                                                              Equations
                                                                                              @[implicit_reducible]
                                                                                              Equations
                                                                                              def Ident.lt (a b : Ident) :

                                                                                              Defines the less-than-relation for Ident.

                                                                                              Equations
                                                                                              Instances For
                                                                                                @[implicit_reducible]
                                                                                                Equations
                                                                                                def Ident.decLt (a b : Ident) :
                                                                                                Decidable (a < b)

                                                                                                Decidable less-than for Ident.

                                                                                                Equations
                                                                                                Instances For
                                                                                                  @[implicit_reducible]
                                                                                                  instance Ident.decidableLT (a b : Ident) :
                                                                                                  Decidable (a < b)
                                                                                                  Equations

                                                                                                  Parses the given string slice and if it is not empty and contains only allowed characters, returns an Ident wrapped in a ParserResult.

                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For
                                                                                                    @[implicit_reducible]
                                                                                                    Equations

                                                                                                    Returns true iff the character is allowed for identifiers but is not a digit, i.e. is in [A-Za-z\-].

                                                                                                    This is used for

                                                                                                      <alphanumeric identifier> ::= <non-digit>
                                                                                                                                  | <non-digit> <identifier characters>
                                                                                                                                  | <identifier characters> <non-digit>
                                                                                                                                  | <identifier characters> <non-digit> <identifier characters>
                                                                                                    

                                                                                                    (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                    Equations
                                                                                                    Instances For

                                                                                                      Returns true iff at least one character in the given identifier is not a digit.

                                                                                                      Again, there are shorter implementation such as

                                                                                                      def Ident.hasNonDigit (i: Ident) : Bool :=
                                                                                                        i.val.val.any Char.isAllowedAndNonDigit
                                                                                                      

                                                                                                      but they less convenient in proofs.

                                                                                                      Equations
                                                                                                      Instances For

                                                                                                        AlphanumIdent is the type for alphanumeric identifiers.

                                                                                                        Equations
                                                                                                        Instances For

                                                                                                          Defines the less-than-relation for AlphanumIdent.

                                                                                                          Equations
                                                                                                          Instances For

                                                                                                            Decidable less-than for AlphanumIdent.

                                                                                                            Equations
                                                                                                            Instances For
                                                                                                              @[implicit_reducible]
                                                                                                              Equations

                                                                                                              Parses the given string slice and if it is a valid alphanumeric identifier, returns it wrapped in a ParserResult.

                                                                                                              Equations
                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                              Instances For
                                                                                                                inductive BuildIdent :

                                                                                                                Defines build-identifiers in accordance with

                                                                                                                  <build identifier> ::= <alphanumeric identifier>
                                                                                                                                      | <digits>
                                                                                                                

                                                                                                                (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                                Instances For
                                                                                                                  @[implicit_reducible]
                                                                                                                  Equations
                                                                                                                  Equations
                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                  Instances For
                                                                                                                    @[implicit_reducible]
                                                                                                                    Equations

                                                                                                                    Returns the string representation of a build identifier.

                                                                                                                    Equations
                                                                                                                    Instances For

                                                                                                                      Parses the given string slice and if it is a valid build identifier, returns it wrapped in a ParserResult.

                                                                                                                      Equations
                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                      Instances For
                                                                                                                        @[implicit_reducible]
                                                                                                                        Equations

                                                                                                                        Defines dot-separated build identifiers as non-empty lists of BuildIdents in accordance with

                                                                                                                          <dot-separated build identifiers> ::= <build identifier>
                                                                                                                                                            | <build identifier> "." <dot-separated build identifiers>
                                                                                                                        

                                                                                                                        (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                                        Equations
                                                                                                                        Instances For
                                                                                                                          @[implicit_reducible]

                                                                                                                          Defines a default value for DotSepBuildIdents so that to! can be used on ParserResult DotSepBuildIdents.

                                                                                                                          Equations
                                                                                                                          • One or more equations did not get rendered due to their size.

                                                                                                                          Returns a string representation of dot-separated build identifiers.

                                                                                                                          Equations
                                                                                                                          Instances For

                                                                                                                            Parses the given string slice and if it is a valid dot-separated build identifiers, returns it wrapped in a ParserResult.

                                                                                                                            Equations
                                                                                                                            Instances For
                                                                                                                              inductive PreRelIdent :

                                                                                                                              Defines the type for pre-release identifiers in accordance with

                                                                                                                                <pre-release identifier> ::= <alphanumeric identifier>
                                                                                                                                                          | <numeric identifier>
                                                                                                                              

                                                                                                                              (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                                              Instances For
                                                                                                                                @[implicit_reducible]
                                                                                                                                Equations
                                                                                                                                @[implicit_reducible]
                                                                                                                                Equations
                                                                                                                                Equations
                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                Instances For

                                                                                                                                  Less-than-relation for pre-release identifiers. Numeric identifiers always have lower precedence than alphanumeric (non-numeric) identifiers (see https://semver.org/, section 11.4.3).

                                                                                                                                  Equations
                                                                                                                                  Instances For
                                                                                                                                    @[implicit_reducible]
                                                                                                                                    Equations

                                                                                                                                    Returns the string representation of a pre-release identifier.

                                                                                                                                    Equations
                                                                                                                                    Instances For

                                                                                                                                      Parses the given string slice and if it is a valid pre-release identifier, returns it wrapped in a ParserResult.

                                                                                                                                      Equations
                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                      Instances For

                                                                                                                                        Defines dot-separated pre-release identifiers in accordance with

                                                                                                                                          <dot-separated pre-release identifiers> ::= <pre-release identifier>
                                                                                                                                                                                | <pre-release identifier> "." <dot-separated pre-release identifiers>
                                                                                                                                        

                                                                                                                                        (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                                                        Equations
                                                                                                                                        Instances For
                                                                                                                                          @[implicit_reducible]
                                                                                                                                          Equations
                                                                                                                                          • One or more equations did not get rendered due to their size.

                                                                                                                                          Provides a representation for dot-separated pre-release identifiers so that #eval can be used.

                                                                                                                                          Equations
                                                                                                                                          Instances For
                                                                                                                                            Equations
                                                                                                                                            Instances For

                                                                                                                                              Decidable less-than-relation for DotSepPreRelIdents.

                                                                                                                                              Equations
                                                                                                                                              Instances For

                                                                                                                                                Parses the given string slice and if it is a valid dot-separated pre-release identifiers, returns it wrapped in a ParserResult.

                                                                                                                                                Equations
                                                                                                                                                Instances For
                                                                                                                                                  structure VersionCore :

                                                                                                                                                  Defines the version core in accordance with

                                                                                                                                                    <version core> ::= <major> "." <minor> "." <patch>
                                                                                                                                                    <major> ::= <numeric identifier>
                                                                                                                                                    <minor> ::= <numeric identifier>
                                                                                                                                                    <patch> ::= <numeric identifier>
                                                                                                                                                  

                                                                                                                                                  (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                                                                  Version cores default to 1.0.0.

                                                                                                                                                  Instances For
                                                                                                                                                    def instDecidableEqVersionCore.decEq (x✝ x✝¹ : VersionCore) :
                                                                                                                                                    Decidable (x✝ = x✝¹)
                                                                                                                                                    Equations
                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                    Instances For
                                                                                                                                                      Equations
                                                                                                                                                      Instances For
                                                                                                                                                        @[implicit_reducible]
                                                                                                                                                        Equations
                                                                                                                                                        Equations
                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                        Instances For
                                                                                                                                                          @[implicit_reducible]
                                                                                                                                                          Equations

                                                                                                                                                          Returns the string representation of a version core.

                                                                                                                                                          Equations
                                                                                                                                                          Instances For

                                                                                                                                                            Returns the version core as list of three natural numbers.

                                                                                                                                                            Equations
                                                                                                                                                            Instances For

                                                                                                                                                              Constructs a version core from a list of three natural numbers.

                                                                                                                                                              Equations
                                                                                                                                                              Instances For

                                                                                                                                                                Less-than-relation for version cores.

                                                                                                                                                                Equations
                                                                                                                                                                Instances For
                                                                                                                                                                  @[implicit_reducible]
                                                                                                                                                                  Equations

                                                                                                                                                                  Decides if < holds true for two version cores.

                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For

                                                                                                                                                                    Parses the given string and if it is a valid version core, returns it wrapped in a ParserResult.

                                                                                                                                                                    Equations
                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                    Instances For
                                                                                                                                                                      structure Versionextends VersionCore :

                                                                                                                                                                      Defines a full semantic version in accordance with

                                                                                                                                                                        <version> ::= <version core>
                                                                                                                                                                                    | <version core> "-" <pre-release>
                                                                                                                                                                                    | <version core> "+" <build>
                                                                                                                                                                                    | <version core> "-" <pre-release> "+" <build>
                                                                                                                                                                        <pre-release> ::= <dot-separated pre-release identifiers>
                                                                                                                                                                        <build> ::= <dot-separated build identifiers>
                                                                                                                                                                      

                                                                                                                                                                      (see https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions).

                                                                                                                                                                      Instances For
                                                                                                                                                                        def instDecidableEqVersion.decEq (x✝ x✝¹ : Version) :
                                                                                                                                                                        Decidable (x✝ = x✝¹)
                                                                                                                                                                        Equations
                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                        Instances For
                                                                                                                                                                          @[implicit_reducible]
                                                                                                                                                                          Equations
                                                                                                                                                                          Equations
                                                                                                                                                                          Instances For
                                                                                                                                                                            Equations
                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                            Instances For
                                                                                                                                                                              @[implicit_reducible]
                                                                                                                                                                              Equations
                                                                                                                                                                              Equations
                                                                                                                                                                              Instances For

                                                                                                                                                                                Returns the string representation of a version.

                                                                                                                                                                                Equations
                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                Instances For
                                                                                                                                                                                  @[implicit_reducible]
                                                                                                                                                                                  Equations

                                                                                                                                                                                  Helper function for comparing the parts of versions outside the version core.

                                                                                                                                                                                  Equations
                                                                                                                                                                                  Instances For
                                                                                                                                                                                    def Version.lt (v w : Version) :

                                                                                                                                                                                    Less-than-relation for versions in accordance with section 11 of the SemVer specification.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      @[implicit_reducible]
                                                                                                                                                                                      Equations
                                                                                                                                                                                      def Version.decLt (v w : Version) :
                                                                                                                                                                                      Decidable (v < w)

                                                                                                                                                                                      Decides if < holds true for two versions.

                                                                                                                                                                                      Equations
                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                      Instances For

                                                                                                                                                                                        Helper function that parses the version core and optional pre-release-part of a version string slice.

                                                                                                                                                                                        Equations
                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                        Instances For

                                                                                                                                                                                          Parses the given string slice and if it is a valid version, returns it wrapped in a ParserResult.

                                                                                                                                                                                          Equations
                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                          Instances For
                                                                                                                                                                                            @[implicit_reducible]
                                                                                                                                                                                            Equations

                                                                                                                                                                                            Returns true if public API provided under this version is stable.

                                                                                                                                                                                            Equations
                                                                                                                                                                                            Instances For

                                                                                                                                                                                              Returns a version that is the next major version based on the provided version. The returned version has no pre-release or build metadata.

                                                                                                                                                                                              Equations
                                                                                                                                                                                              Instances For

                                                                                                                                                                                                Returns a version that is the next minor version based on the provided version. The returned version has no pre-release or build metadata.

                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For

                                                                                                                                                                                                  Returns a version that is the next patch version based on the provided version. The returned version has no pre-release or build metadata.

                                                                                                                                                                                                  Equations
                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                    Returns a version that is the subsequent pre-release version based on the provided version and pre-release string.

                                                                                                                                                                                                    If the resulting version is not greater than the provided version, or if the pre-release string is invalid, none is returned.

                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                      Returns a version that is the same as the provided version but with the pre-release part set to the provided string.

                                                                                                                                                                                                      If the resulting version is not greater than the provided version, or if the pre-release string is invalid, none is returned.

                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                        Returns a version that is the same as the provided version but with the build part set to the provided string.

                                                                                                                                                                                                        If the given string is not valid as build metadata, none is returned.

                                                                                                                                                                                                        Equations
                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                          def Version.isPossibleStart (previous : Option Char) (current : Char) :

                                                                                                                                                                                                          Helper function that checks if a character can be the start of a version in a string, given the previous character (if any).

                                                                                                                                                                                                          Equations
                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                            Helper function that checks if a character is valid in a version string.

                                                                                                                                                                                                            Equations
                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                Extracts all versions that are contained in a given string.

                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  Instances For