Closed Nifrec closed 1 year ago
We suggest using ghcup to manage your GHCs. Otherwise this sounds like a Manjaro packaging problem.
It should be mentioned that ghcup
integrates quite nicely with stack
, see here.
Sorry for the late response, only finally got time to get around to try it (was expecting a lot of issues). Installed ghcup, it works smoothly out of the box and installed the right versions automatically. Also my text editor found compatible language servers in the different projects, so the issue is solved! 🙂
Your environment
Which OS do you use? Manjaro Linux (Mostly identical to Arch Linux, can also use AUR packages).
Which version of GHC do you use and how did you install it?
How is your project built (alternative: link to the project)? Via the stack tool. It uses the resolver
lts-16.13
.Which LSP client (editor/plugin) do you use? Vim with CoC.
Which version of HLS do you use and how did you install it? The version from the Manjaro repositories (see below in Debug information).
Have you configured HLS in any way (especially: a
hie.yaml
file)? No I have not.What's wrong?
So far I have used Manjaro's Haskell packages (including GHC and HLS), and match well with my text editor. However, for a university project I needed to install stack and use a snapshot using an older version of the GHC. Stack installed the older version of GHC, and in this directory it indeed uses this older version correctly. Somehow, also my text editor gets routed to using this older GHC, but it still uses the system HLS. This version of HLS is incompatible with the project. But I do not know how to install the different versions of HLS side-by-side?
Error in Vim:
Tried
I have tried to install the older version of HLS from source:
$stack install --stack-yaml stack-lts16.yaml
. This does make my text editor work within the university project, but now, of course, it breaks in projects using the newer HLS version:If I launch Vim instead with a modified
PATH
that excludes the stack directory (~/.local.bin
), then everything also works for projects using GHC 9.0.2.This is rather cumbersome though, and it gets much more complicated as soon as I need to work with 3 versions of GHC. Is there perhaps a more elegant solution?
Debug information
Official HLS packages from the Manjaro repository:
System Haskell version:
Stack Haskell version (inside project):
Outside the project directory stack also uses 9.0.2.