[GHC] #9841: Touching a file that uses TH triggers TH recompilation flood

GHC ghc-devs at haskell.org
Thu Nov 27 16:41:28 UTC 2014


#9841: Touching a file that uses TH triggers TH recompilation flood
-------------------------------------+-------------------------------------
       Reporter:  nh2                |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:  7.10.1
      Component:  Build System       |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:  Building
     Blocked By:                     |  GHC failed
Related Tickets:  #481, #7277        |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 Check out this test case:

    https://github.com/nh2/ghc-th-recomp-touch-test

 I have 2 modules, A and B, both using TH (using aeson) with B importing A.

 After the first compilation, `touch A.hs && ghc --make B.hs` causes B to
 be recompiled.

 Why should this be the case? If we see that the A.hi file is completely
 identical with what it was before, why should we recompile B?

 This problem actually hits pretty hard when working in projects with > 200
 modules.

 (This all is under the assumption that TH doesn't do any IO with
 observably different result; we do already have this assumption if I
 understand it correctly, since otherwise we would always recompile all TH
 code, which we don't.)

 ----

 Another problem is that the process is not very repeatable:

 If you do `touch A.hs && ghc --make All.hs` and hit `Ctrl-C` before
 everything is done (e.g. after the 3rd modules), and then run just `ghc
 --make All.hs`, then GHC will decide to compile nothing at all, even
 though it had determined just before that everything needs to be
 recompiled. Is this expected?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9841>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list