haskell/haskell-ide-engine

is it possible to install older versions of Hie?

Opened this issue · 6 comments

This might not be the place to ask (sorry) but I'm running low on new ideas. I'm a CS student who has to do a project for one of my courses.
However, my professor has created a stack folder (project) for us to use. The project is running on Ghc-8.6.5 and the new version of Haskell Language Server you can get for VS Code is running 8.8.3 this gives me a mismatch in my versions.

I've tried to force a newer version of GHC into the project (ghc-8.8.3) which I currently have installed on my machine. But my professor has created an automated test for the project which reverts back to 8.6.5 which is causing trouble.

I'm not a very experience programmer (yet) so if someone could please be so kind and spend a little extra time explaining the different aspects I would really appreciate it. Right now I just want to get everything to work so I can start on my exam.

Haskell Language server works fine if I create a new file and just start using haskell but wont work with stack.

I'm working on a windows computer with win10 as operating system.

ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3

stack --version
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2

hie --version
Version 1.3, Git revision 6dc7d43 (3880 commits) x86_64 ghc-8.8.3

Ask if you need more information I will try to provide it asap!
-Thank you in advance!

I dont think you need an old version of HIE, you just need to install HIE with the correct GHC version.
How did you install HIE?
I think the correct invocation in the root of the haskell-ide-engine is:

stack install.hs hie-8.6.5

Which creates three executables, hie, hie-8.6 and hie-8.6.5 and hie-wrapper.
Now you just need to open the correct folder, where stack.yaml is in the root of your project, and hie-wrapper should select the correct HIE version.
To test-it, you can invoke

hie-wrapper --debug --dry-run .

In the root of your project.

EDIT:
You need to install HIE with the same GHC version as the project you are trying to compile.
We need this, because Haskell is a fast evolving language and the boot libraries, such as GHC, change between major versions. The internal AST representation changes, too.
Therefore, in your case, you need to install hie with ghc 8.6.5.

Hey Fendor, thanks for the quick answers!
I installed hie using the guidlines found through the "Haskell Language Server" in VS Code using Stack

C:> git clone https://github.com/haskell/haskell-ide-engine --recursive hie
C:> cd hie && stack .\install.hs hie

Ok, then now use

stack .\install.hs hie-8.6.5

in the hie dir.
Then you should have hie-8.6.5 available in the shell.

Problem solved!
Thank you SO much!

in case anyone else was wondering. I had prior installed hie-8.8.3 which I deleted from
C:\Users\%USERNAME%\AppData\Roaming\local\bin

I don't know if this was needed, but better safe than sorry.
And then applied the steps mentioned by Fendor.

Closing the thread again

Deleting the old binary should not be necessary, the correct binary is selected by hie-wrapper.
happy to help! Good luck with your course!

I know I asked for this thread to close. I didn't see that you edited one of your posts. Should I install ghc-8.6.5 manually or is there a smart command to install a specific version of ghc using stack. I just got ghc-8.8.3 installed as default using "stack setup"

Edit:
I did: Stack --resolver ghc-8.6.5 setup
and then forgot to add \bin to the System Environment Variables.

It's working now.