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

Handle -Wprepositive-qualified-syntax and -Wmissing-local-signatures #358

Open
jumper149 opened this issue Mar 17, 2022 · 4 comments
Open

Comments

@jumper149
Copy link

jumper149 commented Mar 17, 2022

When -Wprepositive-qualified-syntax is enabled, an artifact remains after reloading finishes:

<interactive>:1:8-16: warning: [-Wprepositive-qualified-module]
    Found ‘qualified’ in prepositive position
    Suggested fix: place  ‘qualified’ after the module name instead.

Note, that cabal build doesn't throw this warning. I guess this comes from the initialization of ghcid, but I'm no expert here. ^^

Edit:

  • Just checked my ghcid version: Auto reloading GHCi daemon v0.8.7
  • I am using nixpkgs pinned to e9545762b032559c27d8ec9141ed63ceca1aa1ac
  • Using the regular haskellPackages, which uses GHC 8.10.7
@jumper149
Copy link
Author

I just noticed, that the same thing happens for -Wmissing-local-signatures:

<interactive>:1:1: warning: [-Wmissing-local-signatures]
    Polymorphic local binding with no type signature:
      _compileParsedExpr :: forall a.
                            ghc-prim-0.6.1:GHC.Types.IO a -> ghc-prim-0.6.1:GHC.Types.IO a
<interactive>:1:8-16: warning: [-Wprepositive-qualified-module]
    Found ‘qualified’ in prepositive position
    Suggested fix: place  ‘qualified’ after the module name instead.

@jumper149 jumper149 changed the title Handle -Wprepositive-qualified-syntax Handle -Wprepositive-qualified-syntax and -Wmissing-local-signatures Mar 18, 2022
@jumper149
Copy link
Author

Also, this might be of interest:

-Wmissing-local-signatures is also thrown by cabal repl:

<interactive>:1:1: warning: [-Wmissing-local-signatures]
    Polymorphic local binding with no type signature:
      _compileParsedExpr :: forall a.
                            ghc-prim-0.6.1:GHC.Types.IO a -> ghc-prim-0.6.1:GHC.Types.IO a

-Wprepositive-qualified-module is NOT thrown by cabal repl.

@ndmitchell
Copy link
Owner

The solution is probably to add to https:/ndmitchell/ghcid/blob/master/src/Language/Haskell/Ghcid/Parser.hs#L60, so these are understood and the scope of the warning can be determined. Ghcid doesn't really know if things come from the underlying ghci or cabal, so the same parser handles both.

@theophile-scrive
Copy link

I believe this is going to become a more widespread issue as more codebases enter GHC2021.
@ndmitchell If you know the path to resolution it could be interesting to send out a call for contribution on this specific issue. :)

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