Using ghc-options at the top-level in project encouraged by docs but unavailable.
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
The behaviour of setting `ghc-options` at the top-level in `cabal.project` (or `cabal.project.local`) doesn't agree with the docs.
> Package options affect the building of specific packages. There are three ways a package option can be specified:
>
> * They can be specified at the top-level, in which case they apply only to local package, or
> * They can be specified inside a package stanza, in which case they apply to the build of the package, whether or not it is local or external.
> * They can be specified inside an package * stanza, in which case they apply to all packages, local ones from the project and also external dependencies.
SOURCE: [Project | package-configuration-options](https://github.com/haskell/cabal/blob/master/doc/cabal-project.rst#package-configuration-options)
**To Reproduce**
For a `cabal.project`, add a `cabal.project.local` with one line `ghc-options: -Werror`
```
$ cabal build all --project-file=cabal.project
Warning:
/.../cabal.project.local:
Unrecognized field 'ghc-options' on line 1
```
**Expected behavior**
That `ghc-options` can be added to projects at the top-level to apply to local packages.
**System information**
- Ubuntu 22.04.1 LTS
```
$ cabal --version
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.2.5
```
Contributor guide
Research direction
Start with the package-configuration-options section in doc/cabal-project.rst and reproduce the warning using cabal.project.local with `ghc-options: -Werror`. Trace how top-level project fields are parsed and applied to local packages; done means the documented top-level form is accepted and applies to local packages without the unrecognized-field warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100