Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple GHC versions via multiple stack.yaml files? #268

Closed
ahri opened this issue Aug 1, 2020 · 3 comments
Closed

Support for multiple GHC versions via multiple stack.yaml files? #268

ahri opened this issue Aug 1, 2020 · 3 comments
Labels

Comments

@ahri
Copy link

ahri commented Aug 1, 2020

I have 2 separate (but related) projects with different stack.yaml files defining different LTS versions for different GHC versions. I can't see an obvious way to tell HIE about this via the hie.yaml, i.e. I can't say the path ./client is a stack cradle, but please execute with ./client/stack.yaml as the root.

From another perspective, I can run both of these commands and they work, but I don't know how to write a hie.yaml that captures this:

$ stack repl project:exe:server
$ stack --stack-yaml client/stack.yaml repl project-js:exe:client

It looks like haskell/hie-bios#230 captures this requirement for me, but as that's not neccessarily going to be merged, I wonder whether there's some other solution I'm missing due to my fairly limited experience with Haskell builds; my case is that I have a server/client architecture with Haskell on both ends, but I'm using Haste (which is stuck on GHC 7.10.3) - in order to get my client code compiling for use by HIE I'm using Stack LTS 6.35 in a separate directory.

Should I restructure my project to have multiple hie.yaml files? Would they have to be in parallel (rather than nested) directories? Am I simply missing something obvious? :)

@ahri ahri changed the title Support for multiple stack.yaml files? Support for multiple GHC versions via multiple stack.yaml files? Aug 1, 2020
@fendor
Copy link
Collaborator

fendor commented Aug 2, 2020

Hi!
Unfortunately, this can not work at all in the current architecture of hls/ghcide. Ghcide essentially acts as your compiler, it typechecks your code, generates .hi files, etc... you need to install ghcide with excactly the ghc version you are using to compile your project. Different ghc versions are not compatible with each other, e.g. you cant load interface files generated by ghc 8.6.5 in ghc 8.8.3.
That is why, you can not use one hls/ghcide version for two projects with different ghc versions.

The change haskell/hie-bios#230 only allows you do specify which stack.yaml you want to use, but it does not allow different GHC versions in the same language server sessions.

The only way to work around it, is to have two different editor/language server sessions, one for each ghc version you need.

@ahri
Copy link
Author

ahri commented Aug 2, 2020

That makes perfect sense, of course it's a shame I can't do what I want, but I understand why!

I think then that I'll split things out into 2 projects for now. Thanks a lot for explaining 👍

@ahri ahri closed this as completed Aug 2, 2020
@ahri
Copy link
Author

ahri commented Aug 2, 2020

I obviously didn't think this through:

haskell-language-server 0.2.2 for GHC 7.10.3 is not available on Linux

I guess I'll just give up on this for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants