VersionRange abstract, role of VersionRangeF?
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
While writing tools that deal with dependency version bounds, I am a bit struggling with the fact that `VersionRange` is abstract (the constructors are only exported from an `.Internal` module, so probably I am not supposed to use that?
For example, I’d like to append a disjunction at the end (`\vr' -> unionMajorBounds vr' vr`). But if I do that and `vr` is already a disjunction, it’s associated the wrong way, and I get ugly changes like
```
- bytestring ^>=0.10.12.0 || ^>=0.11.3.1,
+ bytestring (^>=0.10.12.0 || ^>=0.11.3.1) || ^>=0.12.0.0,
```
I could implement a smarter “append” function that reassociates, if I can traverse the data structure directly.
Since 2.2 there is also the [F-Algebra](https://hackage.haskell.org/package/Cabal-syntax-3.10.1.0/docs/Distribution-Types-VersionRange.html#t:VersionRangeF), which has its constructors exported. Does that mean should use use that detour if I want to write VersionRange-modifying functions?
(For this particular case, maybe [`normaliseVersionRange`](https://hackage.haskell.org/package/Cabal-syntax-3.10.1.0/docs/src/Distribution.Types.VersionRange.html#normaliseVersionRange) should reassociate disjunctions, to give API users one less reasons to look into VersionRanges?)
Contributor guide
Assessment
This issue has not been assessed yet.