Please disable warnings during GHCi's initialization
Proposal
Please disable warnings during GHCi's initialization.
Motivation
I want to use -Weverything
because I can try new warning flags easily when I update my GHC version.
Also, I want to use ghcid
which monitors files in a project and runs a predefined command if one of them is modified. It is useful to run tests automatically.
The problem is that ghcid
runs cabal repl
which loads some modules during GHCi's initialization, but GHC warns against the modules, and prevents ghcid
from running tests.
I may submit an issue to the ghcid
repository, but since Paths_xxx.hs
has {-# OPTIONS_GHC -w #-}
, I thought disabling warnings for the modules would be reasonable.
Reproduction
- Install
ghcid
- Run
cabal init haruhi --lib
with default selections (I selected BSD-2-Clause as the license, fyi) cd haruhi
- Modify
ghc-options
ofcommon warnings
inharuhi.cabal
to include only-Weverything
- Create
.ghcid
and add the following there--test "cabal repl haruhi:test:haruhi-test"
- Run
ghcid
. You'll see warnings both from source files (e.g.,src/Lib.hs
) and from<interactive>
. We can suppress the former, but not the latter.
<interactive>:1:1: warning: [GHC-64414] [-Wmissing-local-signatures]
Polymorphic local binding with no type signature:
_compileParsedExpr :: forall {a}.
ghc-prim-0.11.0:GHC.Types.IO a -> ghc-prim-0.11.0:GHC.Types.IO a
src/MyLib.hs:1:1: warning: [GHC-29747] [-Wmissing-safe-haskell-mode]
haruhi-0.1.0.0-inplace:MyLib is missing Safe Haskell mode
|
1 | module MyLib (someFunc) where
| ^
src/MyLib.hs:1:1: warning: [GHC-20540] [-Wimplicit-prelude]
Module ‘Prelude’ implicitly imported.
|
1 | module MyLib (someFunc) where
| ^
<interactive>:2:8-16: warning: [GHC-07924] [-Wprepositive-qualified-module]
Found ‘qualified’ in prepositive position
Suggested fixes:
• Place ‘qualified’ after the module name.
• Perhaps you intended to use ImportQualifiedPost
<interactive>:1:1: warning: [GHC-85401] [-Wmissing-export-lists]
The export item ‘module Ghci1’ is missing an export list
Versions
Cabal: 3.10.3.0
GHC: tried both 9.4.8 and 9.8.2
ghcid
: 0.8.7