Stop ghci's own import of Prelude triggering -Wmissing-import-lists
Motivation
When ghci
is started with -Wmissing-import-lists
, the warning is triggered by the implicit import of Prelude
for the interactive prompt. When warnings are treated as errors, this means ghci immediately terminates, and thus cannot be started.
❯ ghci -Wmissing-import-lists -Werror
GHCi, version 9.2.4: https://www.haskell.org/ghc/ :? for help
<interactive>:1:1: error: [-Wmissing-import-lists, -Werror=missing-import-lists]
The module ‘Prelude’ does not have an explicit import list
I wasn't sure whether to call this a bug report or a feature request, since it's arguably just those flags doing what they say on the tin. But it's extremely inconvenient when you have settings in your .cabal
file to warn on missing import lists and treat warnings as errors; cabal repl
cannot be used without passing --ghc-options -Wno-missing-import-lists
. (A .ghci
file cannot be used to save this setting, because those settings are applied after the initial Prelude
import)
Proposal
Simply: the implicit Prelude
import by ghci
should not trigger the missing-import-lists warning (as is already the case for the implicit Prelude
import in modules).