[GHC] #8029: batch-mode recompilation checking sometimes fails

GHC ghc-devs at haskell.org
Thu Jul 4 10:51:36 CEST 2013


#8029: batch-mode recompilation checking sometimes fails
------------------------------------------+---------------------------------
    Reporter:  jwlato                     |       Owner:                  
        Type:  bug                        |      Status:  new             
    Priority:  normal                     |   Milestone:                  
   Component:  Compiler                   |     Version:  7.6.3           
    Keywords:  recompilation, batch-mode  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple           |     Failure:  None/Unknown    
  Difficulty:  Unknown                    |    Testcase:                  
   Blockedby:                             |    Blocking:                  
     Related:                             |  
------------------------------------------+---------------------------------

Comment(by simonpj):

 Ah, now I understand.  Here is what is happening, when using `OneShot`
 mode, i.e. the "`-c`" flag:

  * From `import Foo` GHC looks for `Foo.hi` in some exposed package.
  * When it finds that file, it trusts it.
  * In this case, `Data/List.hi` exists and is trusted; but actually
 `Data/List.hs` has gone away.
  * As you say, for installed packages, the `.hs` files may legitimately
 not exist.

 Dealing with the dependencies between `.hi` files and `.hs` files is
 really what `--make` is for, but I can see the confusion.

 Here are a couple of suggestions

  * We could easily make the error message say
 {{{
     It could refer to
     either `Data.List.foo',
            imported from `Data.List' (package base) at Data/Top.hs:3:1-16
         or `Data.OtherList.foo',
            imported from `Data.OtherList' at Data/Top.hs:4:1-21
 }}}
   That is, add `(package X)` to say which package the module is from.
 Probably nothing for the "home package".  That might help a little.

  * A bit harder would be this: for the '''home''' package only, we ''do''
 expect source files to exist.  So I suppose `Finder.findHomeModule` could
 look for the source file too, and complain if it finds a `.hi` file
 without a corresponding `.hs` file (and maybe also check modification
 times).

  But of course that too is only a sticking plaster. The source file might
 exist, and the `.hi` file might have a later modification time; but it
 might still all be out of date because some module lower down is out of
 date.  And that takes you back to `--make`.

 Design suggestions, and subsequent patches, would be welcome!

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/8029#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list