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

Do not break on -Wunused-packages #356

Open
LennartSpitzner opened this issue Mar 15, 2022 · 2 comments
Open

Do not break on -Wunused-packages #356

LennartSpitzner opened this issue Mar 15, 2022 · 2 comments

Comments

@LennartSpitzner
Copy link

LennartSpitzner commented Mar 15, 2022

If you start a ghci session is started with "unused-packages" warning enabled you can get output like this:

<no location info>: warning: [-Wunused-packages]
    The following packages were specified via -package or -package-id flags,
    but were not needed for compilation:
      - foo-0.2.0.0
      - bar-1.0.0.1

at the end of loading iirc before it start compiling the first module. This seems to break ghcid, which, on first load, reports errors as expected, but then hangs on the first reload. Of course fixing the warning (removing foo/bar or disabling the warning if your setup just adds spurious -packages) is the obvious fix, but it might be worth making ghcid more robust, as just hanging without any error output is annoying to debug.

I guess this would need an addition to https://github.com/ndmitchell/ghcid/blob/master/src/Language/Haskell/Ghcid/Parser.hs#L60, right? Or would it be better (for now) to just force the warning off for the time being (by insert a :set into the ghci session)

Do you think it is worth fixing this? Suggestion on best approach?

This happens for us on a slightly larger project; I somewhat assume it is easy to reproduce, but if it is not I can of course come up with a sample project setup for reproduction.

@LennartSpitzner LennartSpitzner changed the title Do not break on `-Wunused-packages Do not break on -Wunused-packages Mar 15, 2022
@jumper149
Copy link

jumper149 commented Mar 18, 2022

I'm experiencing the same.

Actually the same warning is also printed with cabal repl.
So maybe this problem should be addressed there (in GHCi or cabal, idk)?
cabal build works as expected at least :)

This also falls into the same category as #358.

@ndmitchell
Copy link
Owner

I think the right solution is to adjust the parser to take account of this warning. Unconditionally disabling warnings is a bit annoying because it varies between GHC version, they can be set later on in the process, and you also lose warnings that are presumably useful. PR welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants