@@ -205,6 +205,30 @@ its subdirectories.
205
205
206
206
## Controlling what gets built
207
207
208
+ Stack will rebuild a targeted project package if it considers one or more of
209
+ its files to be dirty.
210
+
211
+ Stack will consider a package to be dirty if a file is added to the
212
+ ` extra-source-files ` field of its Cabal file or the contents of an existing file
213
+ listed in the ` extra-source-files ` field is changed.
214
+
215
+ ??? note "GHC's recompilation checker and Template Haskell"
216
+
217
+ GHC's recompilation checker (which is on by default) stops compilation early
218
+ if GHC can determine that a module does not need to be recompiled.
219
+
220
+ For modules that use Template Haskell, when the module is compiled, GHC can
221
+ determine dependencies, or be told about dependent files, of the code
222
+ inserted by the splice. (Instances of the `Quasi` class promise to provide
223
+ `qAddDependentFile`; see package `template-haskell`.)
224
+
225
+ However, GHC cannot be told of as yet *unknown* dependent files when a
226
+ module using Template Haskell is compiled. For example, this can affect the
227
+ `embedDir` function provided by package `file-embed`, when files are added
228
+ to the directory in question after the module is compiled. The resolution is
229
+ either to specify GHC's `-fforce-recomp` option (to turn off the
230
+ recompilation checker for the package) or to do a clean build.
231
+
208
232
Stack will automatically build the necessary dependencies. See the introductory
209
233
part of Stack's
210
234
[ user's guide] ( ../tutorial/building_your_project.md#adding-dependencies ) for
0 commit comments