Skip to content

stale hie files are not deleted by GHC

Summary

In our company CI we use weeder with an option to make sure source files exist:

weeder --require-hs-files

That flag is essentially an imperfect workaround for GHC not deleting stale HIE files. After we began caching dist-newstyle across CI runs in GHC 9.4 however the workaround stopped working for us.

It seems to me that the proper fix is for GHC to delete these stale HIE files by default.

Steps to reproduce

I haven't retested this set of steps, but to best of my memory:

  • Build a haskell project using -fwrite-ide-info with module A and function f
  • copy the dist-newstyle directory that includes hie files to initial-dist-newstyle
  • verify the HIE file for module A is there
  • remove module A entirely
  • build again with -fwrite-ide-info
  • observe that the HIE file for module A still exists

Expected behavior

When I remove the source file for module A, any subsequent call to ghc should remove any stale HIE files.

Environment

  • GHC version used: 9.4.4

Optional:

  • Operating System:
  • System Architecture:
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information