agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
876 stars 47 forks source link

Added hie.yaml, fixes HLS problems #323

Closed farzadbekran closed 2 years ago

farzadbekran commented 2 years ago

Auto generated via:

> stack install implicit-hie
> gen-hie > hie.yaml

then changed cradle type (line 2) from cabal to stack.

agentm commented 2 years ago

I haven't used HLS, but is there any indication of why it can't work automatically and without this generated hie.yaml file?

farzadbekran commented 2 years ago

In my case, it seems the reason was that HLS tried to compile with cabal, which then uses my system-wide GHC. Since I don't use cabal at all, that ended up missing the packages and dependencies. So putting this file there forces HLS to use stack, and renaming stack-ghc8.8.yaml to stack.yaml sloved my HLS issues.

agentm commented 2 years ago

Ah, thanks for the explanation. If we merge this, will cabal users get an error then? Since cabal is my primary dev tool, I'll test it out.

farzadbekran commented 2 years ago

I don't think so. As far as I know, this only affects HLS.

agentm commented 2 years ago

Sorry, to clarify, if a user wants to use HLS without stack (only cabal is installed), will this hie.yaml file prevent them from using HLS? I'll test that before merging.

farzadbekran commented 2 years ago

Yes, in that case they would need to change line 2 to cabal:

ilyakooo0 commented 2 years ago

We could provide two versions of the hie.yaml file named stack.hie.yaml and cabal.hie.yaml. Then, we add hie.yaml to gitignore.

This way everyone can symlink whichever version they want to use to hie.yaml and everyone wins.

On Mon, 1 Nov 2021 at 08:21, Farzad Bekran @.***> wrote:

Yes, in that case they would need to change line 2 to cabal:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/agentm/project-m36/pull/323#issuecomment-955942711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPMAW7LLXX26JWYWP3YC6DUJYPV7ANCNFSM5HBRZ5AA .

farzadbekran commented 2 years ago

We could provide two versions of the hie.yaml file named stack.hie.yaml and cabal.hie.yaml. Then, we add hie.yaml to gitignore. This way everyone can symlink whichever version they want to use to hie.yaml and everyone wins. On Mon, 1 Nov 2021 at 08:21, Farzad Bekran @.***> wrote: Yes, in that case they would need to change line 2 to cabal: — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#323 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPMAW7LLXX26JWYWP3YC6DUJYPV7ANCNFSM5HBRZ5AA .

Yeah makes sense. Thanks for the suggestion.

farzadbekran commented 2 years ago

@agentm do you want me to close this?

agentm commented 2 years ago

No, I intend to test this myself- I just haven't had yet time. Sorry for the delay!

farzadbekran commented 2 years ago

No it's allright, I thought maybe you are just being nice to me and want me to do it myself XD

agentm commented 2 years ago

project-m36.cabal includes -f-external-interpreter which causes HLS to crash. The hie.yaml for cabal mode will need to override this flag.

farzadbekran commented 2 years ago

Makes sense I guess. The other day which I was trying to reach you, my HLS was acting up again. I eventually ended up changing my hie.yaml to this:

cradle:
  stack:
    stackYaml: "./stack.yaml"
    component: "project-m36:lib"

Also, in my project-m36.cabal I changed the haskell-scripting flag's default to False. This got things working again. Could you check on your end @agentm? This seems to work correctly for me.

agentm commented 2 years ago

I added some developer-oriented documentation and two files (cabal.hie.yaml and stack.hie.yaml) which the user can choose. Stackage LTS 18.20 was released a few days ago which support GHC 8.10.7, so I bumped up the stack.ghc8.10.yaml configuration to use that and pointed the stack.hie.yaml configuration at that.