relax -Wmissing-import-lists to allow one module with implicit imports when using NoImplicitPrelude
It would be nice to modify the -Wmissing-import-lists
warning flag to allow one module with implicit imports when using the NoImplicitPrelude
pragma.
For example, imagine the following program:
{-# LANGUAGE NoImplicitPrelude #-}
module Main where
import MyCustomPrelude
import Control.Monad.Trans.Reader (Reader, runReader)
what :: Reader Int String -> String
what x = runReader x 3
main :: IO ()
main = print "hello"
If this program is compiled with the -Wmissing-import-lists
flag, the following warning will be produced:
example.hs:5:1: warning: [-Wmissing-import-lists]
The module ‘MyCustomPrelude’ does not have an explicit import list
I think it would be nice if this warning did not appear.
Ideally, when using NoImplicitPrelude
and -Wmissing-import-lists
together, I would want one import per module to be permitted not to be explicit. This would make it possible to use an alternative Prelude and -Wmissing-import-lists
at the same time.
Alternatively, a new warning flag could be created with the above behavior. Maybe it could be called something like -Wmulti-implicit-imports
or -Wmulti-open-imports
. I would appreciate feedback/suggestions for the name.
PureScript currently works like I have described above. By default the Prelude
module is not imported (so you must explicitly import it), and the compiler will warn you if you have more than one implicit import. I really like this combination and it would be nice to be able to get the same thing in Haskell.
In case anyone is interested, here is the issue for PureScript where they talked about making this change.
If it seems like this is a good idea and other people are onboard, I'd be willing to implement it. I think it would be a relatively easy change, so it would be good for a first-time contributor.
Trac metadata
Trac field | Value |
---|---|
Version | |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |