Hi, I am working with Obsidiansystems Obelisk and try to get the haskell-language-server running.
I am stuck with a somewhat frustrating detail. The hls doesn’t want to start, erroring out with
Found "/home/ruben/code/my-palantype/learn-palantype/hie.yaml" for "/home/ruben/code/my-palantype/learn-palantype/a"
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 1.6.1.0, Git revision f4022c5bb8530cd306c53b941878244bf27a5d41 (dirty) x86_64 ghc-8.10.7
Current directory: /home/ruben/code/my-palantype/learn-palantype
Operating system: linux
Arguments: ["--lsp","-d","-l","/run/user/1000/hls.log"]
Cradle directory: /home/ruben/code/my-palantype/learn-palantype
Cradle type: Cabal
Tool versions found on the $PATH
cabal: 3.8.1.0
stack: 2.9.1
ghc: Not found
Consulting the cradle to get project GHC version...
Failed to get project GHC version:CradleError {cradleErrorDependencies = [], cradleErrorExitCode = ExitFailure 1, cradleErrorStderr = ["Error when calling cabal --builddir=/home/ruben/.cache/hie-bios/dist-learn-palantype-8a6791f81bf6f884398119cfc941c18b v2-exec --with-compiler /home/ruben/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --numeric-version","","Error: cabal: The program 'ghc' version >=7.0.1 is required but the version of\n/home/ruben/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b could not\nbe determined.\n\n"]}
Process lsp-haskell stderr finished
However, running the command in question in the terminal, works perfectly fine:
$ cabal --builddir=/home/ruben/.cache/hie-bios/dist-learn-palantype-8a6791f81bf6f884398119cfc941c18b v2-exec --with-compiler /home/ruben/.cache/hie-bios/wrapper-13a09b18ea883dd377d59db5e821a86b ghc -v0 -- --numeric-version
8.10.7
I am working on the development branch of Obelisk, to get GHC 8.10.7 and I am using easy-hls-nix to select the haskell-language-server for me. In the obelisk configuration this looks like this:
-- default.nix
with pkgs.haskell.lib;
obelisk.project ./. ({ ... }: {
shellToolOverrides = self: super: {
inherit easy-hls;
inherit (pkgs) cabal-install;
inherit (pkgs.haskell.compiler) ghc8107Binary;
};
-- ...
})
This is why I am effectively using haskell-language-server version 1.6.1.0.
Also, note that I run a nix shell specific to obelisk projects
$ nix-shell -A shells.ghc
prior to starting emacs (which then tries to connect to hls) and also when testing hls outside of emacs.