[GHC] #14049: relax -Wmissing-import-lists to allow one module without implicit imports when using NoImplicitPrelude
GHC
ghc-devs at haskell.org
Fri Jul 28 13:50:27 UTC 2017
#14049: relax -Wmissing-import-lists to allow one module without implicit imports
when using NoImplicitPrelude
-------------------------------------+-------------------------------------
Reporter: cdepillabout | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version:
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
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:
{{{#!hs
{-# 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,
[https://github.com/purescript/purescript/issues/1869 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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14049>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list