PackageImports + Prelude edge case
Summary
Combining a PackageImports
use of "base"
and an explicit import from Prelude
(which should disable the implicit import) fails to disable the implicit imports.
Steps to reproduce
{-# LANGUAGE PackageImports #-}
module Bug where
import "base" Prelude (zip)
wobbly :: String
wobbly = "hello"
Expected behavior
The above should fail to compile because String
is not in scope. A closer inspection (e.g. in ghci or with GHC.getNames
) reveals that all the imports are in scope when only zip
should be in scope.
Environment
- ghc 8.4.4
- ghc 8.6.5
Additional
This seems to be localised to the Prelude
hiding. I also tried with the following
module NotBug where
import "contravariant" Data.Functor.Contravariant.Divisible (Divisible)
wobble :: Divisible m => m ()
wobble = conquered
and it correctly fails to compile due to missing conquered
.