Closed
Description
Your environment
Which OS do you use: Linux
Which LSP client (editor/plugin) do you use: NeoVim + lspconfig
Describe your project (alternative: link to the project): https://github.com/guibou/repro_hls_base_no_prelude
Steps to reproduce
You can checkout https://github.com/guibou/repro_hls_base_no_prelude, it contains two cabal project with one Main.hs
file with the following content:
{-# LANGUAGE NoImplicitPrelude #-}
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell!"
Expected behaviour
The code above should not typecheck (i.e. IO
is not in scope). Code action on the offending line should suggestion to import a few module, such as System.IO
or Prelude
.
Actual behaviour
There is two variations in the sample codebase.
- One is a project with
base
as a dependency. Code action works as expected and suggest to importSystem.IO
(as well as other modules frombase
which exportsIO
).
- The second project uses
base-noprelude
as a dependency.base-noprelude
is a package which reexport all modules from base butPrelude
.System.IO
is exported, see: https://github.com/haskell-hvr/base-noprelude/blob/master/base-noprelude.cabal#L232, However, code action does not suggest to importSystem.IO
:
Note that in both cases, importing System.IO
fixs the type error.