Apply `--ghc-options` in stack ghci even when no packages get loaded #2199

Closed
mgsloan opened this Issue May 27, 2016 · 5 comments

Projects

None yet

2 participants

@mgsloan
Collaborator
mgsloan commented May 27, 2016

Via #haskell-stack, @chreekat just ran into a case where stack ghci --ghc-options ".." did not behave as expected. Namely, since this was run with the package-less global project, --ghc-options does not get applied to anything. We have a couple options for dealing with this:

  • Apply CLI --ghc-options even if there are no local package targets. This is the approach I prefer.
  • Warn when --ghc-options aren't getting applied to anything. This would actually be a good enhancement independently of ghci.

If both of these actions are taken, then we should make sure that stack ghci --ghc-options doesen't warn about --ghc-options not being applied.

@mgsloan mgsloan added this to the P2: Should milestone May 27, 2016
@chreekat
Contributor

I also feel like this could also be improved with documentation somehow, since I didn't grasp that --ghc-options and --ghci-options could ever both be useful at the same time. Maybe:

--ghc-options OPTION       Additional options passed to GHC when building the project,
                           before launching the interpreter. See --ghci-options.

I know that's a global option though, so I'm not sure if the helpdoc can be tweaked when running stack ghci --help.

@mgsloan
Collaborator
mgsloan commented May 27, 2016 edited

Yeah, it'd be tough to do conditional option docs like that. I think I'd prefer to address the root cause and just have --ghc-options always apply to ghci. For the very rare case where that would cause issues, the user can always perform a stack build --ghc-options ... followed by a stack ghci --no-build ...

@chreekat
Contributor

Yeah, to be clear I like your proposed solutions.

@mgsloan
Collaborator
mgsloan commented Oct 18, 2016

Easy fix! stack ghci will now use --ghc-options.

@mgsloan mgsloan closed this Oct 18, 2016
@mgsloan
Collaborator
mgsloan commented Oct 19, 2016

I have actually resolved this a different, better way, which is to no longer take all of the CLI build options with stack ghci.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment