Use of reexported-modules & mixins ought to be considered an implicit impl() constraint by solver
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
When a `.cabal` package description contains an **active** (see below) `reexported-moduels` or `mixins` declaration the solver currently happily lets such a package description be picked for a compiler which doesn't support it, rather than fail early and possibly backtrack picking a different build plan; e.g.:
```
$ cabal new-repl -w ghc-7.8.4 --build-d binary-serialise-cbor
Resolving dependencies...
Build profile: -w ghc-7.8.4 -O1
In order, the following will be built (use -v for more details):
- half-0.2.2.3 (lib) (requires build)
- cborg-0.2.0.0 (lib) (requires build)
- serialise-0.2.0.0 (lib) (requires build)
- binary-serialise-cbor-0.2.0.0 (lib) (requires build)
- fake-package-0 (lib) (first run)
Starting half-0.2.2.3 (lib)
Building half-0.2.2.3 (lib)
Installing half-0.2.2.3 (lib)
Completed half-0.2.2.3 (lib)
Starting cborg-0.2.0.0 (lib)
Building cborg-0.2.0.0 (lib)
Installing cborg-0.2.0.0 (lib)
Completed cborg-0.2.0.0 (lib)
Starting serialise-0.2.0.0 (lib)
Building serialise-0.2.0.0 (lib)
Installing serialise-0.2.0.0 (lib)
Completed serialise-0.2.0.0 (lib)
Starting binary-serialise-cbor-0.2.0.0 (lib)
Failed to build binary-serialise-cbor-0.2.0.0. The failure occurred during the configure step.
Build log (
/home/hvr/.cabal/logs/ghc-7.8.4/binary-serialise-cbor-0.2.0.0-8c322c17c66282e266189a4e4d2d41b59dc34d368a90d64358c99099780de9f4.log
):
Configuring library for binary-serialise-cbor-0.2.0.0..
cabal: Your compiler does not support module re-exports. To use this feature you must use GHC 7.9 or later.
cabal: Failed to build binary-serialise-cbor-0.2.0.0 (which is required by fake-package-0). See the build log above for details.
```
In the case of `mixins` you'd get an error like
```
cabal: Your compiler does not support thinning and renaming on package flags. To use this feature you must use GHC 7.9 or later.
```
Only *active* `mixins` or `reexported-modules` ought to imply a constraint; e.g. in case of something like
```
if impl(ghc >= 7.10)
build-depends: base >= 4.8 && < 4.13
mixins: base hiding (Prelude)
else
build-depends: base-noprelude >= 4.3 && < 4.8
```
this ought to be compatible with e.g. a GHC 7.8.4 compiler
Contributor guide
Research direction
Reproduce the issue with the shown cabal new-repl command using GHC 7.8.4, then inspect the Cabal solver's handling of active reexported-modules and mixins declarations. Done means an active declaration constrains compiler selection early, while declarations in inactive conditional branches remain compatible with older compilers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100