haskell / haskell/cabal

Version is not separated, VersionIntervals (current and Legacy) machinery doesn't take that into account.

Open
#8,486 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

By *separated* I mean that there would be a version between any pair of distinct versions. That is not true.

For example, there is no version between `1` and `1.0`, and `VersionInterval` machinery doesn't take that into account. It fails to simplify:

```haskell
import Data.Maybe

import Distribution.Pretty
import Distribution.Parsec
import Distribution.Types.VersionRange
import Distribution.Version
import qualified Distribution.Types.VersionInterval.Legacy as O
import qualified Distribution.Types.VersionInterval as N

unsafeParsec s = either error id (eitherParsec s)

main :: IO ()
main = do
putStrLn $ prettyShow $ O.fromVersionIntervals . O.toVersionIntervals $ unsafeParsec "<=1 || >=1.0" -- expected >=0 i.e. anyVersion
putStrLn $ prettyShow $ N.fromVersionIntervals . N.toVersionIntervals $ unsafeParsec "<=1 || >=1.0" -- expected >=0 i.e. anyVersion

putStrLn $ prettyShow $ O.fromVersionIntervals . O.toVersionIntervals $ unsafeParsec ">0 && <0.0" -- expected <0
putStrLn $ prettyShow $ N.fromVersionIntervals . N.toVersionIntervals $ unsafeParsec ">0 && <0.0" -- expected <0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.