ghci does not work if base is hidden
Summary
Multiple tools (at least cabal and Stack) are capable of creating a situation with ghci
where it will complain about missing the System.IO
module, even though ghci
knows it can be found in base
.
Steps to reproduce
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.4
$ cat ghc-env
clear-package-db
global-package-db
$ GHC_ENVIRONMENT=ghc-env ghci
GHCi, version 8.6.4: http://www.haskell.org/ghc/ :? for help
Loaded package environment from ghc-env
Loaded package environment from ghc-env
<interactive>:1:6: error:
Not in scope: ‘System.IO.hSetBuffering’
No module named ‘System.IO’ is imported.
<interactive>:1:30: error:
Not in scope: ‘System.IO.stdin’
No module named ‘System.IO’ is imported.
<interactive>:1:46: error:
Not in scope: data constructor ‘System.IO.NoBuffering’
No module named ‘System.IO’ is imported.
<interactive>:1:70: error:
Not in scope: ‘System.IO.hSetBuffering’
No module named ‘System.IO’ is imported.
<interactive>:1:94: error:
Not in scope: ‘System.IO.stdout’
No module named ‘System.IO’ is imported.
<interactive>:1:111: error:
Not in scope: data constructor ‘System.IO.NoBuffering’
No module named ‘System.IO’ is imported.
<interactive>:1:135: error:
Not in scope: ‘System.IO.hSetBuffering’
No module named ‘System.IO’ is imported.
<interactive>:1:159: error:
Not in scope: ‘System.IO.stderr’
No module named ‘System.IO’ is imported.
<interactive>:1:176: error:
Not in scope: data constructor ‘System.IO.NoBuffering’
No module named ‘System.IO’ is imported.
Expected behavior
No warnings or errors should be printed. Instead, ghci
should find System.IO
in the base
package.
Environment
- GHC version used: 8.6.4, though this seems to apply to older versions as well.
Optional:
- Operating System: OS X
- System Architecture: x86-64
Related: