Hassan Al-Awwadi pushed to branch wip/haanss/depdir at Glasgow Haskell Compiler / GHC
Commits:
-
6f0e08a8
by Hassan Al-Awwadi at 2025-07-11T14:11:49+02:00
-
53045685
by Hassan Al-Awwadi at 2025-07-11T14:41:21+02:00
3 changed files:
- compiler/GHC/Tc/Gen/Splice.hs
- docs/users_guide/9.14.1-notes.rst
- docs/users_guide/separate_compilation.rst
Changes:
| ... | ... | @@ -173,8 +173,6 @@ import GHC.Parser.HaddockLex (lexHsDoc) |
| 173 | 173 | import GHC.Parser (parseIdentifier)
|
| 174 | 174 | import GHC.Rename.Doc (rnHsDoc)
|
| 175 | 175 | |
| 176 | -import System.Directory(listDirectory)
|
|
| 177 | - |
|
| 178 | 176 | {-
|
| 179 | 177 | Note [Template Haskell state diagram]
|
| 180 | 178 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -232,6 +232,11 @@ Cmm |
| 232 | 232 | They are replaced, respectively, by ``SpecialiseEP``, ``pragSpecED`` and
|
| 233 | 233 | ``pragSpecInlED``.
|
| 234 | 234 | |
| 235 | +- We have added the ``addDependentDirectory`` function to match
|
|
| 236 | + ``addDependentFile``, which adds a directory to the list of dependencies that
|
|
| 237 | + the recompilation checker will look at to determine if a module needs to be
|
|
| 238 | + recompiled.
|
|
| 239 | + |
|
| 235 | 240 | Included libraries
|
| 236 | 241 | ~~~~~~~~~~~~~~~~~~
|
| 237 | 242 |
| ... | ... | @@ -710,7 +710,7 @@ beautiful sight! |
| 710 | 710 | You can read about :ghc-wiki:`how all this works <commentary/compiler/recompilation-avoidance>` in the GHC commentary.
|
| 711 | 711 | |
| 712 | 712 | Recompilation for Template Haskell and Plugins
|
| 713 | -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
| 713 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 714 | 714 | |
| 715 | 715 | Recompilation checking gets a bit more complicated when using Template Haskell or
|
| 716 | 716 | plugins. Both these features execute code at compile time and so if any of the
|
| ... | ... | @@ -727,6 +727,17 @@ if ``foo`` is from module ``A`` and ``bar`` is from module ``B``, the module wil |
| 727 | 727 | now depend on ``A.o`` and ``B.o``, if either of these change then the module will
|
| 728 | 728 | be recompiled.
|
| 729 | 729 | |
| 730 | +``addDependentFile`` and ``addDependentDirectory``
|
|
| 731 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
| 732 | + |
|
| 733 | +When using Template Haskell or plugins, you can use the functions
|
|
| 734 | +``addDependentFile`` and ``addDependentDirectory`` to add additional
|
|
| 735 | +dependencies to the module being compiled. When adding a file, this means
|
|
| 736 | +that the contents of the file changing between compilations will trigger a
|
|
| 737 | +recompilation of the module. When adding a directory, this means that any
|
|
| 738 | +file or subdirectory *added* to or *removed* from the directory will trigger
|
|
| 739 | +recompilation of the module, so it is not a recursive dependency.
|
|
| 740 | +
|
|
| 730 | 741 | .. _mutual-recursion:
|
| 731 | 742 | |
| 732 | 743 | Mutually recursive modules and hs-boot files
|