ghcide on windows - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

James King

Does anyone know what the most painless way to install ghcide on Windows is? I've been trying to get it to work with stack but I've been running into errors compiling it with 8.8.3 and it won't even build with the 8.10 resolver.

James King

The build plan fails with stack:

resolver: nightly-2020-02-13
compiler: ghc-8.10.1
allow-newer: true
extra-deps:
- haskell-lsp-0.22.0.0
- haskell-lsp-types-0.22.0.0
- lsp-test-0.11.0.1
- ghc-check-0.3.0.1
- hie-bios-0.5.0

# for ghc-8.10
- Cabal-3.2.0.0
- lens-4.19.1

nix:
  packages: [zlib]

which says

Unrecognized fields in Snapshot: allow-newer, extra-deps, nix

and fails with

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for haddock-library-1.8.0:
    base-4.14.0.0 from stack configuration does not match >=4.7 && <4.14  (latest matching version is 4.13.0.0)
needed due to ghcide-0.2.0 -> haddock-library-1.8.0

I've had it able to build with 8.8.3 but then the test runs into the readCreateProcess error they mention in the troubleshooting guide and nothing I've been able to do resolves that.

Are there pre-built binaries somewhere?

Magnus Therning

Is it Windows proper or WSL?

Georgi Lyubenov // googleson78

and also the "unrecognized fields" bit is very weird, what's your stack invocation?

James King

Version 2.3.1, Git revision de2a7b694f07de7e6cf17f8c92338c16286b2878 (8103 commits) x86_64 hpack-0.33.0
stack install --resolver stack810.yaml

James King

from a clean checkout of the ghcide repo

Georgi Lyubenov // googleson78

the flag to pass a specific stack.yaml is --stack-yaml, not --resolver

Georgi Lyubenov // googleson78

but the readCreateProcess problem sounds like it might not go away after this

James King

It does appear but the test says it completed successfully...

[INFO] Making new HscEnv[main,main,main]
Error while checking GHC version: "C:\\\\Users\\\\james\\\\AppData\\\\Local\\\\Programs\\\\stack\\\\x86_64-windows\\\\ghc-8.10.1\\\\lib\\bin\\ghc: readCreateProcess: does not exist (No such file or directory)"
Error while checking GHC version: "C:\\\\Users\\\\james\\\\AppData\\\\Local\\\\Programs\\\\stack\\\\x86_64-windows\\\\ghc-8.10.1\\\\lib\\bin\\ghc: readCreateProcess: does not exist (No such file or directory)"
Error while checking GHC version: "C:\\\\Users\\\\james\\\\AppData\\\\Local\\\\Programs\\\\stack\\\\x86_64-windows\\\\ghc-8.10.1\\\\lib\\bin\\ghc: readCreateProcess: does not exist (No such file or directory)"

Completed (4 files worked, 0 files failed)
Georgi Lyubenov // googleson78

and I'm guessing ghc actually exists there?

Georgi Lyubenov // googleson78

I guess you tried the "run ghcide from stack environment via stack exec" thing that they suggested?

James King

Yes, ran from the stack environment

James King

I might look into a way to do pre-packaged builds for Windows at some point with a nice installer. :thinking:

Georgi Lyubenov // googleson78

also, there's currently this issue, it would be great if it works out - https://github.com/haskell/haskell-language-server/issues/158

It's becoming increasingly obvious that one of the major turnoffs for newcomers is the manual installation. Since we're pulling in so many dependencies, and for a complete install of all th...
James King

Georgi Lyubenov // googleson78 said:

what was wrong?

I don't know what exactly was wrong with GHC 8.8.x but when I ran into the readCreateProcess issue and couldn't resolve it. I talked to someone on Slack iirc who mentioned successfully building ghcide and using it with stack as long as they used GHC 8.10.x -- once I used the right command to load the stack810.yaml file bundled with ghcide and tweaked a few things it worked.

It turns out that

package:
- .

no longer parses and I had to add a recent version of Cabal, the same one used in the ghcide stack config to my own project.

After that it build and runs perfectly. :+1: