ghci recompilation avoidance

Evan Laforge qdunkan at
Wed May 30 07:37:29 UTC 2018

On Tue, May 29, 2018 at 11:46 PM, Kim-Ee Yeoh <ky3 at> wrote:
>> It turns out that git checkouts update the modtime on checked-out files,
>> even
> when they get reverted back to their original contents.
> Looks to me the problem's right here. Namely, git checkout.
> If the contents didn't change, the modtime shouldn't either. What's the
> reason behind changing it?

The contents do change, but then they change back again.  Say you
visit another branch then come back.

> Have you brought this up to the git maintainers? Compensating for flaws in
> co-tools costs code and complexity in ghc we would rather do without.

Here's an explanation with some links:

> In the meantime, it shouldn't be hard to kludge up some shell scripts that
> run before and after git checkout to reset the modtime back to what it
> should be.

That sounds like code and complexity too!  Only it would be repeated
in every repo.  And it sounds pretty hard too.  I'd have to keep and
update a Map (Branch, FilePath) ModTime, and hook every checkout to
record and restore every modified file.  At that point I've more or
less written my own checkout command.

More information about the ghc-devs mailing list