Avi-D-coder / implicit-hie

Auto generate a stack or cabal multi component hie.yaml file
BSD 3-Clause "New" or "Revised" License
201 stars 17 forks source link

Operate on cabal project files not called cabal.project #49

Open lf- opened 1 year ago

lf- commented 1 year ago

Cabal has a flag --project, but it seems that there's not any way of using that with implicit-hie.

The practical use case of --project is when you may have a nix vs non-nix dependency setup, for instance.

fendor commented 1 year ago

You might be interested in the feature https://github.com/haskell/hie-bios/pull/357

With that feature, it'd be enough to have a hie.yaml:

cradle:
  cabal:
    project-file: cabal.project.8.8.4

and stuff like that. Leave a comment if you think that feature would help you.

lf- commented 1 year ago

It wouldn't, surprisingly. Long story, marred by my own cursed workflows on top of a codebase that needs to be weird to be usable.

The reason is that there's overlapping cabal targets in the work project due to test-dev (https://jade.fyi/blog/cabal-test-dev-trick/). This is used to paper over multiple home units' absence on a codebase that is extremely marginal HLS perf wise (Well-Typed has worked on it specifically in the past) by sticking test and lib into one cabal target. So I need to delete some of those rules and thus a manual hie.yaml is necessary.

The thing I use gen-hie for is when I'm doing hacks (see "yolo method" of https://jade.fyi/blog/nix-hls-for-deps/) to work on dependencies in-situ, replacing the nix versions, and don't want to write the hie.yaml rules for the stuff I just added by hand. So I run it and copy the appropriate prefix rules for the dependency I just stuck into nix-shell.cabal.project.local

N.B. the reason there are two cabal project files is that the not nix-shell one has source-repository-package to make git deps build on non nix systems.