-
Notifications
You must be signed in to change notification settings - Fork 710
Store hie files #9019
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
Store hie files #9019
Conversation
This should solve #8685 |
I think these changes probably should go in the changelog, but I don't know where. I don't see any release notes for the upcoming version of Cabal yet. Should I create them? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @nlander, see changelog.d/pr-8662 for an example changelog.
-- This is similar to 'findModuleFileEx' but doesn't fail if the file | ||
-- corresponding to the module is missing, instead returning Nothing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you avoding changing findModuleFileEx
to avoid a breaking change? Because, if we have already breaking changes, I'd prefer to change findModuleFileEx
to suit the new usecase and return Maybe (FilePath, FilePath)
.
In case we decide to introduce two new functions, I'd like to them to share a common implementation rather than duplicating code. E.g. findModuleFileEx
should call findAvailableModuleFileEx
.
Shouldn't this reuse the plug-in machinery we have for modpak files? I'd be much happier to see this using the generic plugin data infrastructure than hardcoding yet another file type. HIE files are not essential haskell files. They are Haskell Idea Engine is imo much closer to the plugin logic than for example S, h, c, hs, o, hi files. They are conceptually optional. |
#8662 seems like the ideal solution. Also wrt to what @andreabedini remarked here: #8685 (comment) |
I think |
@wz1000 why can we not easily change GHC? The hie files are not required for compilation, are the now used for compilation too? Why does cabal need to know about hie files? |
Adding
|
@andreabedini @angerman I think this is ready for another look. I wonder if I could clean up the codebase by assigning the string "extra-compilation-artifacts" to a constant variable instead of repeating the same string literal throughout the codebase. Where would be a good place to put such a constant? |
@nlander Thank you for reworking this <3 @fgaz @ulysses4ever Are you ok with this design? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nlander if you have capacity to look into #8696, it may bring some insights into how to make your contribution a bit more general than "just" HIE files. The thing is: various people want Cabal to produce various artifacts. It'd be good to design a mechanism that would be reusable for different purposes. I don't argue that the current attempt is not general enough, I just ask you to try to look into prior art to see if you think something could be improved in your approach. |
@ulysses4ever I took a look at #8696 and I wasn't able to get many insights for this PR specifically. I think the general solution for getting cabal to produce any optional build artifacts at this point is put them in |
@andreabedini What still needs to happen before this can be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pinging me again @nlander! It's 👍 for me.
2aea4d9
to
63e2369
Compare
This doesn't seem related to the CI. Maybe a few spins will fix it 😂. Give a shout if you need help @nlander. |
@andreabedini I have been able to reproduce this test failure on my Windows machine on master. How should I proceed? |
Please, rebase. We just merged supposed fix to master. |
7717a2f
to
d180c20
Compare
This reverts commit c3686d1.
@@ -576,6 +578,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = | |||
, ghcOptFfiIncludes = toNubListR $ includes bi | |||
, ghcOptObjDir = toFlag odir | |||
, ghcOptHiDir = toFlag odir | |||
, ghcOptHieDir = bool NoFlag (toFlag $ odir </> extraCompilationArtifacts) $ flagHie implInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a bit unfortunate to be placing files directly in extra-compilation-artifacts
. My hope when we agreed on this design was that users would instead place things in distinct subdirectories to avoid clutter and the potential for name conflicts. I wonder if it wouldn't be better to rather place these in odir </> extraCompilationArtifacts </> "hie"
or similar.
Perhaps it's not too late to revisit this given that we haven't yet released?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems reasonable to me. I will get a PR going for that, probably on Monday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed by #9244
Apologies for not seeing your ping, @ulysses4ever . Indeed I have a question above. |
@bgamari no worries at all and thanks a lot for attending to it! |
Would it not be desirable to add a specific option to a |
@mpickering If we added such an option for cabal.project, how would that combine with the -fwrite-ide-info flag? Would the user need to specify both the option and the ghc flag, or would either one by themselves result in generated hie files? |
@nlander the user would just need to set |
IIRC that was the initial design of @nlander's PR; then we decided to reuse the existing infrastructure to store extra compilation artefacts. This in way the hie-files are installed along with the package in a predictable location. I agree that using a subdirectory would a been a better idea but luckily @nlander was able to quickly address that. W.r.t to My 2c. |
I agree with @andreabedini here. We should not need a cabal interface for each GHC feature. Where does this end? Edit: (removed) |
@andreabedini I agree with the current design of the patch about where the hie files end up, it's the means that this gets enabled which I think could be improved. I disagree with @andreabedini and @angerman, essentially all of GHC features are guarded by cabal features.. It's more discoverable and nicer to use. Some more options which are guarded by cabal features.. A question, how do you propose to document to users how to generate ide-info? Where in the user guide does that go? |
I think I understand your point and I acknowledge that things have evolved as you describe. I still feel I don't like this design though, I will have to think more about this.
IMHO the problem is "which user guide"? How does GHC documents the feature? Hypotetically speaking, couldn't cabal defer to GHC user guide for GHC features? In my mind the value that cabal brings is in the definition of package, lib/exe/test/bench/flib components, flags, dependency resolution, build orchestration, etc. These are all GHC-independent features and still plenty! My 2c. |
This is not documented and for me as a user it is not discoverable how to profit from this. It's not even in the ticket description what exactly this is doing. From a user's perspective I would expect a Cabal config field to enable HIE files (read (as has been suggested by @bgamari and @mpickering) In its current form it's not entirely clear to me how we as a community can benefit from HIE files if:
|
Please include the following checklist in your PR:
Bonus points for added automated tests!