I am completely new to haskell. From what I've gathered so far about the tool chain, cabal and Stack are competing build/package management tools. The answers to this question were quite informative.
I was happy to learn that haskell has a mature language server available, but in going to test it out on a project created via stack new
, confused to find that the server immediately crashed. Here are some relevant log lines:
2022-07-22 17:09:54.8270000 [client] INFO Executing 'ghcup --no-verbose whereis ghc 9.0.2' in cwd '/home/randy'
2022-07-22 17:09:54.8440000 [client] ERROR Error executing 'ghcup --no-verbose whereis ghc 9.0.2' with error code 30
2022-07-22 17:09:54.8440000 [client] ERROR stderr: [1m[ Error ][0m The version 9.0.2 of the tool ghc is not installed.
2022-07-22 17:09:59.1650000 [client] INFO User accepted download for ghc-9.0.2.
I installed haskell via GHCup, which installed GHC 8.10.7 and Stack 2.7.5. However, the generated stack.yaml
references the following resolver url, which specifies GHC 9.0.2: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/16.yaml.
Once the language server starts, it crashes repeatedly because of ABI mismatches:
[0;31mGHC ABIs don't match![0m
[0;31m[0m
[0;31mExpected: Cabal-3.4.1.0:bd8a150942e263abdddf4556ba717d44 array-0.5.4.0:6e4d88804dfcdc3d22d4fbacc50bc1d6 ...
[0;31mGot: Cabal-3.4.1.0:ab74f2c3161b496273c112bc304128c5 array-0.5.4.0:60b03bb14f2fb672c7d45b226c353ec1 ...
I also tried creating a new project with cabal init --interactive
. That project seems to be satisfied with the installed GHC version, and the language server works as expected.
My best guess at this point is that the GHC version difference in the Stack project is to blame, but I don't know why it happens or how to fix it.
For reference, the installed HLS is v1.7.0.0, and cabal is at v3.6.2.0.