ghcid
ghcid copied to clipboard
Handle `-Wprepositive-qualified-syntax` and `-Wmissing-local-signatures`
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
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.
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
.
The solution is probably to add to https://github.com/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.
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. :)