
Hassan Al-Awwadi pushed to branch wip/haanss/depdir at Glasgow Haskell Compiler / GHC Commits: 1cb08157 by Hassan Al-Awwadi at 2025-07-11T19:09:34+02:00 updated comments for addDependentDirectory and addDependentFile - - - - - 2 changed files: - docs/users_guide/separate_compilation.rst - libraries/ghc-internal/src/GHC/Internal/TH/Syntax.hs Changes: ===================================== docs/users_guide/separate_compilation.rst ===================================== @@ -732,12 +732,14 @@ be recompiled. When using Template Haskell or plugins, you can use the functions ``addDependentFile`` and ``addDependentDirectory`` to add additional -dependencies to the module being compiled. When adding a file, this means -that the contents of the file changing between compilations will trigger a -recompilation of the module. When adding a directory, this means that any -file or subdirectory *added* to or *removed* from the directory will trigger -recompilation of the module, so it is not a recursive dependency. - +dependencies to the module being compiled. + +- When adding a file, this means that the contents of the file changing between + compilations will trigger a recompilation of the module. +- When adding a directory, this means that any file or subdirectory *added* to or + *removed* from the directory will trigger recompilation of the module, so + it is not a recursive dependency. + .. _mutual-recursion: Mutually recursive modules and hs-boot files ===================================== libraries/ghc-internal/src/GHC/Internal/TH/Syntax.hs ===================================== @@ -836,13 +836,17 @@ getPackageRoot = Q qGetPackageRoot -- -- * ghc -M does not know about these dependencies - it does not execute TH. -- --- * The dependency is shallow, just a hash of its direct contents. It returns --- a list of the contents (absolute paths), files and subdirectories both, so --- you can manually depend on (a subset of) those, if you wish. +-- * The dependency is shallow, just a hash of its direct contents. +-- Basically, it only sees a list of names, and hashes those names. +-- It does not look at directory metadata, recurse into subdirectories +-- or look at file contents. As long as the list of names remains the same, +-- the directory is considered unchanged. +-- +-- * The state of the directory is read at the interface generation time, +-- not at the time of the function call. addDependentDirectory :: FilePath -> Q () addDependentDirectory dp = Q (qAddDependentDirectory dp) - -- | Record external files that runIO is using (dependent upon). -- The compiler can then recognize that it should re-compile the Haskell file -- when an external file changes. @@ -853,7 +857,11 @@ addDependentDirectory dp = Q (qAddDependentDirectory dp) -- -- * ghc -M does not know about these dependencies - it does not execute TH. -- --- * The dependency is based on file content, not a modification time +-- * The dependency is based on file content, not a modification time or +-- any other metadata associated with the file (e.g. permissions). +-- +-- * The state of the file is read at the interface generation time, +-- not at the time of the function call. addDependentFile :: FilePath -> Q () addDependentFile fp = Q (qAddDependentFile fp) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1cb0815780f2af72d2659806816f42ce... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1cb0815780f2af72d2659806816f42ce... You're receiving this email because of your account on gitlab.haskell.org.