Hello all,
I tried searching the issues to find something similar and was unsuccessful (#1359 is not the same issue).
I'm trying to use hie with coc.nvim on arch. I get a popup that says:
[bios] [E] Could not find module 'Prelude'
There are files missing in the 'base-4.12.0.0`package,
try running 'ghc-pkg check'.
The output of ghc-pkg check is quite long, let me know if that output is needed in order to help.
I also get a similar error on any import statement. E.g. import Data.List gives me an identical error as above, but with Could not find module 'Prelude' replaced by Could not find module 'Data.List
Are you using stack or cabal?
Neither, in this particular case. Is that the issue? Apologies if I sound like an idiot. I'm new to the haskell ecosystem. I just have a directory that contains some *.hs files. I am working through the Haskell Wikibook.
I installed stack and made a dummy project to test. It works fine there. Thanks for the help and sorry for the noise.
No worries. Let us know if you have any other questions.
Same behavior here, currently using haskell-language-server. Is there any way to have it working without involving cabal or stack, for simple single file coding, as alternative to ghci? ghci works fine on my system so I dunno why the server can't find Prelude of the system ghc.
Figured it out. Just had to install the ghc-static package, as ArchLinux primarily have a -dynamic setup, which the server can't pick by default and seems there's no way to set a -dynamic flag in LSP configuration alone.
Reference: https://bugs.archlinux.org/task/65661
@oblitum I would advise using ghcup to manage GHC and cabal installs.
I'm also on arch; arch's Haskell packaging is a monstrosity, -static suffix pkgs are better, but still have issues.
If you use stack set system-ghc: true in ~/.stack/global-project/stack.yaml
And just use ghcup, this will work better with cabal. Even if you use stack, most opensource packages will be using cabal.
I would also advise using cabal, it's better than stack these days (from a IDE dev and user perspective).
If your not into ghcup, I hear nix also works well.
@Avi-D-coder thanks for tips! I'm doing all that. I'm going to pick Haskell for a look again, left it before because tooling is nightmarish. I always found stack and cabal duplicating work, and I'm a simple man, so, I'm going to try sticking to cabal only, since it looks like to have improved substantially, if ghcup becomes as simple as rustup, then I'm all for it and dumping pacman's ghc in my endeavor.
Most helpful comment
@Avi-D-coder thanks for tips! I'm doing all that. I'm going to pick Haskell for a look again, left it before because tooling is nightmarish. I always found
stackandcabalduplicating work, and I'm a simple man, so, I'm going to try sticking to cabal only, since it looks like to have improved substantially, ifghcupbecomes as simple asrustup, then I'm all for it and dumping pacman'sghcin my endeavor.