Skip to content

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

Closed

Description

@ahri

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? :)

Activity

  1. changed the title [-]Support for multiple stack.yaml files?[/-] [+]Support for multiple GHC versions via multiple stack.yaml files?[/+] on Aug 1, 2020
  2. fendor commented on Aug 2, 2020

    @fendor
    Collaborator

    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.

  3. ahri commented on Aug 2, 2020

    @ahri
    Author

    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 👍

  4. ahri commented on Aug 2, 2020

    @ahri
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions