haskell / haskell/cabal

Improve behavior around `--with-ghc`

Open
#9,394 1 comment 3 reactions 0 assignees View on GitHub
documentation re: --with-compiler type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I've been using `--with-ghc` for years because I thought `--with-compiler` was a relic from when there were popular Haskell compilers other than GHC. However, I just discovered that `--with-compiler` does seem to be the preferred way to specify the version of `ghc` that `cabal` should use. Compare the two invocations below. Clearly then it's `--with-compiler` that should be preferred, not `--with-ghc`.

Could we come to an understanding about what the correct flag is and if it is not `--with-ghc` then emit a more helpful error message, perhaps saying to try `--with-compiler`?

See also a [Discourse thread](https://discourse.haskell.org/t/surprising-difference-between-cabal-with-ghc-and-with-compiler/7984) on the same topic.

----

```
% cabal install --with-ghc ghc-9.6 pandoc
The path to the compiler program (or programs used by the
compiler) cannot be specified on a per-package basis in the
cabal.project file (i.e. setting the 'ghc-location' for package 'pandoc').
All packages have to use the same compiler, so specify the path in a
global 'program-locations' section.
```

```
% cabal install --with-compiler ghc-9.6 pandoc
Resolving dependencies...

```

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.