-
Notifications
You must be signed in to change notification settings - Fork 103
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
Don't write out the cabal file if it matches the old one #555
Conversation
The motivation behind this change is avoid the `--force` option from triggering an unnecessary reload of `ghcid` if nothing changed. The context is that at work we use `hpack --force` to correct manual edits that users might make to the `.cabal` file, and we run `hpack --force` whenever users enter our Nix shell. If a user uses `direnv` on top of that then `hpack --force` runs every time they `cd` to the project directory. However, suppose that they load `ghcid` in one window and then `cd` to the project directory in another window. This causes `hpack --force` to run and even if nothing changed the `mwb.cabal` file is touched which causes `ghcid` to reload (which is expensive). This change fixes that.
Note that I could also structure this to check if the new/old cabal files are textually identical instead of the abstract syntax being identical. However, that would be a slightly more invasive change so I wanted to propose this first to solicit feedback. |
What is the reason that you use Do you have a modification hash in the generated Or is it, that you use different versions of
Yes, if we do anything here, then we would want textual comparison. But please hold back for a second. This code is already more complicated than it should be. We might want to remove support for modification hashes (and possibly even the |
@Gabriella439 please take a look at #557. Does this work for you? |
Yeah, #557 looks good to me. To answer your prior question, we would use |
The motivation behind this change is avoid the
--force
option from triggering an unnecessary reload ofghcid
if nothing changed.The context is that at work we use
hpack --force
to correct manual edits that users might make to the.cabal
file, and we runhpack --force
whenever users enter our Nix shell. If a user usesdirenv
on top of that thenhpack --force
runs every time theycd
to the project directory.However, suppose that they load
ghcid
in one window and thencd
to the project directory in another window. This causeshpack --force
to run and even if nothing changed themwb.cabal
file is touched which causesghcid
to reload (which is expensive). This change fixes that.