Skip to content
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 ghci doesn't accept ghc-options #971

Closed
bergmark opened this issue Sep 10, 2015 · 3 comments
Closed

stack ghci doesn't accept ghc-options #971

bergmark opened this issue Sep 10, 2015 · 3 comments

Comments

@bergmark
Copy link
Member

Woops, accidental submit typing

@bergmark
Copy link
Member Author

This seems to be a change in 0.1.4.0 (I Just upgraded to the bindist, Version 0.1.4.0, Git revision dac8cfe51802e08edb523b80c51cf35e21933513 (1722 commits) X86_64)

Previously my workflow was stack build --pedantic and then stack ghci a-package if a-package failed to compile. in 0.1.4.0 this happens:

$ stack ghci package
tostring-0.2.1.1-0dadd4186e26cc4bb0de459985e35fa9: unregistering (flags changed from ["--ghc-options","-Wall","--ghc-options","-Werror"] to [])

stack ghci --pedantic isn't supported, but adding the --ghc-options manually doesn't work either, stack still prints the new flags as []

Does this have something to do with stack build --pedantic foo resetting flags for other packages? Has this problem propagated to stack ghci? Running stack ghci and loading all packages is not an option for me unfortunately, a lot of modules makes it very slow.

Am I correct thinking this is what's going on? Is this expected behavior now? Any workarounds?

@chrisdone
Copy link
Member

Right, stack ghci doesn't pass its arguments through to the build process, they're only passed to ghc --interactive. This would probably lead to unwelcome recompiling too if you provide stuff for ghc --interactive that has no relation to building of dependencies. And stack build doesn't save any state about the options you provide for ghc-options so you have to pass --pedantic every time and so should do so when calling stack ghci too.

Perhaps we need to distinguish between build flags and ghc --interactive flags. Maybe e.g.

  • --ghc-options => passed to ghc --interactive
  • --build-ghc-options => passed into the build process
  • --pedantic => a shortcut for: --ghc-options "-Wall -Werror" --build-ghc-options "-Wall -Werror"

Then your regular use-case will work:

$ stack build --pedantic
$ stack ghci --pedantic

But also you can specify custom things in the rarer case like:

$ stack build --ghc-options -fno-warn-orphans
$ stack ghci --build-ghc-options -fno-warn-orphans --ghc-options -fobject-code

@mgsloan
Copy link
Contributor

mgsloan commented Nov 4, 2015

Looks like this got covered by the build-ghc-options flag, and furthermore will be addressed by #1186

@mgsloan mgsloan closed this as completed Nov 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants