commercialhaskell / commercialhaskell/stack

Add "require-cabal-version" and use this to enable Cabal-1.24 build plans

Open
#2,479 11 comments 0 reactions 0 assignees View on GitHub
component: build type: discuss type: enhancement
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

The fix to haskell/cabal#1725 is in `Cabal >= 1.24`. This means that `configure` doesn't always need to take as many deps (for `buildable: false`). In https://github.com/commercialhaskell/stack/issues/2475 , this came up as issues with the solver, because the solver thinks some things aren't deps, that stack thinks are necessary deps.

Currently, the Cabal version in use is something selected by the user not the project, and this can be a source of non-determinism. Currently build plan resolution is independent of Cabal version, and we'd prefer to keep it that way. Why? Because then we have better hope for consistent results for users. Lets say we do vary build-plan based on installed Cabal version. Then, a `stack.yaml` for Cabal-1.24 could easily break for a user of Cabal-1.22.

How do we solve this? I think I prefer the following approach:

1) Add a `require-cabal-version` field, similar to `require-stack-version`. Check installed Cabal version on build.

2) When the version range excludes `< 1.24`, instead use the build plans with fewer deps. This way we can force consistency.

3) Relevant to #2475, for `stack init`, this would mean that when the user has `cabal-install >= 1.24`, it will output a `stack.yaml` with `require-cabal-version: ">= 1.24"`. If the user is using an earlier version, then a warning will be omitted and no `require-cabal-version` added.

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.