haskell / haskell/hackage-server

Require top-level `build-depends` when it occurs in all branches of a conditional

Open
#984 9 comments 0 reactions 0 assignees View on GitHub
component: revisions
Dominant language
Haskell
Stars
467
Forks
225
PR merge metrics
No merged PRs in 30d

Description

This is the companion issue of https://github.com/haskell/cabal/issues/7768.

See e.g. https://github.com/jvranish/Lenses/issues/3.
Currently hackage does not allow revision of conditionals, and it does not allow new `build-depends` in a revision.
In the situation (1)
```
build-depends: base
, A
if cond
build-depends: B >= 0.1 && < 0.4
else
build-depends: B >= 0.2 && < 0.5
```
the constraints for `B` cannot be revised.
Thus, the better practice is to put a top-level `B` with extra constraints in the conditional (2):
```
build-depends: base
, A
, B >= 0.1 && < 0.5
if cond
build-depends: B < 0.4
else
build-depends: B >= 0.2
```
hackage uploads could be required to add a top-level `build-depends` if it appears in all branches. So (1) would be rejected, and a suggestion of adding `B` to the top-level dependencies could be given:
```
build-depends: base
, A
, B
if cond
build-depends: B >= 0.1 && < 0.4
else
build-depends: B >= 0.2 && < 0.5
```
Enforcing this discipline would help with revisions on hackage that tighten constraints.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.