-
Herbert Valerio Riedel authored
This implements a new syntactic sugar: The version range operator `^>=` which is equivalent to `>=` intersected with an automatically inferred major upper bound. This new syntax is only allowed for `cabal-version: >=2.0`, and allows to describe the most common use of version bounds more conveniently: build-depends: foo ^>= 1.2.3.4, bar ^>= 1 The declaration above is exactly equivalent to build-depends: foo >= 1.2.3.4 && < 1.3, bar >= 1 && < 1.1 This also helps with the issue of the wildcard operator having the surprising effect that e.g. `== 1.0.*` does not include the single digit version `1`. The `^`-symbol was chosen because it can serve as a mnemonic when the `>` sign is rotated and interpreted as "less than ceiling" Moreover, `^` appears to become a quasi-standard to denote morally equivalent operator that way in other language ecosystems which similiar to Haskell have adopted semantic versioning: - Node: https://nodesource.com/blog/semver-tilde-and-caret/ - Bower: https://bower.io/docs/api/#install - PHP: https://getcomposer.org/doc/articles/versions.md#caret Ruby, on the other hand, uses a Tilde operator (`~>`) for that purpose (but with a less robust semantic): - https://blog.codeship.com/optimists-guide-pessimistic-library-versioning And Python is currently planing to use an `~=` operator: - https://www.python.org/dev/peps/pep-0440/#compatible-release
c7f788a6