HLS can't find extra-deps defined in stack.yaml
Opened this issue · 2 comments
Your environment
Which OS do you use?
Linux
Which version of GHC do you use and how did you install it?
9.8.4 from ghcup 0.1.50.2
How is your project built (alternative: link to the project)?
Which LSP client (editor/plugin) do you use?
NeoVim 0.11 with lsp-config
Which version of HLS do you use and how did you install it?
2.10.0 from ghcup
Have you configured HLS in any way (especially: a hie.yaml file)?
I have added an hie.yaml that only includes:
cradle:
stack:
What's wrong?
I am trying to update my xmonad config using neovim and hls, my stack.yaml has two packages xmonad and xmonad-contrib and one extra-dep split-0.2.5 running stack build works fine, however jumping into neovim, the lsp gives me the error:
not found: Could not load module 'Data.List.Split'. It is a member of the hidden package 'split-0.2.5'
I've been trying to make this work for a bit and found that setting ghc-options in stack.yaml like this:
ghc-options:
"$locals": -package split
Fixes the issue for hls but breaks the stack build.
I have tried using gen-hie and also setting components manually but have not been able to get around this, I am positive I must be doing something wrong but I'm not sure what that is.
stack repl and stack ghci both work, but in order to use Data.List.Split I also need to :set -package split
Debug information
I can't exactly reproduce, I tried to create a reproducer here: https://github.com/sgillespie/hls-4743/blob/main/hls-extra-deps.cabal.
However, if I add split to the package.yaml under dependencies to works as expected:
2025-10-24T20:04:28.536222Z | Info | updateFileDiagnostics published different from new diagnostics - file diagnostics: File: /home/sgillespie/dev/hacking/haskell/hls-4743/src/Lib.hs
Hidden: no
Range: 5:1-5:23
Source: typecheck
Severity: DiagnosticSeverity_Warning
Code: GHC-66111
Message:
The import of ‘Data.List.Split’ is redundant
except perhaps to import instances from ‘Data.List.Split’
To import instances alone, use: import Data.List.Split()
Is there any way you can provide you stack.yaml and your package.yaml or .cabal?
Hi @sgillespie, thanks for taking the time to look into this, it looks like I forgot to add any links to my files; these are the files I'm having issues with:
https://github.com/cloverinteractive/dotfiles/tree/features/picom-config-updates/.config/xmonad
I do not have a .cabal or package.yaml file though, only the stack.yaml and hie.yaml files in that repo, I followed xmonad's instructions on how to build/install xmonad then only added split as a dependency since I use split in my xmonad.hs let me know if there's anything else I can provide to help narrow this down.