-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack does not apply GHC options in package.yaml #4576
Comments
@ad-si what section of |
library:
source-dirs: source
executables:
tasklite:
main: Main.hs
source-dirs: app
ghc-options:
- -Wall
- -Wcompat
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wredundant-constraints
- -fno-warn-orphans
dependencies:
- tasklite That's what it looks like at the moment. I can't see anything about a |
In the code that you show above
|
Ok cool, thanks for the tip. Unfortunately that doesn't fix my problem. Still no warnings. 😔 |
@ad-si showing the logs could help a lot. My suspicion is that you have your library already built so without a recompilation you won't get any warnings for sure. Just use |
Oh, wow, So this means it shows warnings only on the first compilation. I guesss I missed it because I was using `stack build --file-watch'. E.g. it built a file why I wasn't looking, then I made a change on another file and only then looked to the output. At this time, however, the warnings from the first file were already gone, never to be shown again. Why isn't this a problem for ghcid or ghci? |
I suppose your "Show GHC warnings on every build" isn't quite correct here because consecutive builds by default recompile only changed files, if you want to trigger complete package recompilation you could either use |
"recompile only changed files" and "Show GHC warnings on every build" isn't a contradiction. |
Stack could only show warnings from GHC and you won't get anything from it if compiler doesn't get invoked on a file which was already compiled. And as far as I understand GHCi loads all of the modules and
|
Well, I'm coming here solely from the user standpoint and when I run One workaround I just found is to set |
You could as well use |
So you're saying stack is only using |
It's a GHC behavior, see e.g. some details in https://downloads.haskell.org/~ghc/8.6.3/docs/html/users_guide/separate_compilation.html?highlight=fforce-recomp#ghc-flag--fforce-recomp and I don't think that it's a bug |
I had the same issue and had to search through the issues to find this. I think this needs some clarification in the docs? Also, it wasn't clear enough for me to put the Putting ghc-options in |
@sharno The |
General summary/comments
I have defined several GHC
-W
options in my package.yaml.When I run
ghcid
orstack ghci
they are applied and I get the corresponding warnings.However, when I run
stack build
no warnings appear.Maybe related to #4526 or #4548
Steps to reproduce
stack new test
- -Wall
toghc-options
in package.yamllet unused = 123
to src/Lib.hsstack ghci
and obsoerve the warningstack build
and observe no warningExpected
A
-Wunused-local-binds
warning to appearActual
No warnings whatsoever
The .cabal file contains has the correct
ghc-options
, so it's apparently not a problem of transforming the hpack config into the cabal config.Stack version
Method of installation
The text was updated successfully, but these errors were encountered: