[GHC] #7277: Recompilation check fails for TH unless functions are inlined

GHC cvs-ghc at haskell.org
Wed Oct 3 14:22:01 CEST 2012


#7277: Recompilation check fails for TH unless functions are inlined
---------------------------------+------------------------------------------
    Reporter:  orenbenkiki       |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  high              |   Milestone:  7.6.2                      
   Component:  Template Haskell  |     Version:  7.4.2                      
    Keywords:                    |          Os:  Unknown/Multiple           
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
  Difficulty:  Unknown           |    Testcase:                             
   Blockedby:                    |    Blocking:                             
     Related:  481               |  
---------------------------------+------------------------------------------

Comment(by orenbenkiki):

 Off the top of my head, each module should have two hashes. One for the
 interface and one for the implementation. The interface-hash would depend
 only on the module itself (I think). The implementation-hash would depend
 on the implementation-hash of all recursively used modules.

 Any module would need to be recompiled if the interface-hash of a used
 module changes. A module that does use TH would also need to be recompiled
 if the implementation-hash of any module reached from within $( ...) has
 changed.

 Something like (typing off the bat, excuse typos etc.):

 {{{
 moduleInterfaceHash :: Module -> Hash
 moduleLocalImplementationHash :: Module -> Hash
 moduleUsedModules :: Module -> [ Module ]
 moduleUsedModulesTH :: Module -> [ Module ]
 combineHashes :: [ Hash ] -> Hash

 moduleImplementationHash :: Module -> Hash
 moduleImplementationHash module = combineHashes $ localHash : usedHashes
  where
    localHash = moduleLocalImplementationHash module
    usedHahses = map moduleImplementationHash $ moduleUsedModules module

 moduleDependencyHash :: Module -> Hash
 moduleDependencyHash module = combineHashes $ interfacesHashes ++
 implementationHashes
   where
     interfacesHashes = map moduleInterfaceHash $ moduleUsedModules module
     implementationHashes = map moduleImplementationHash $
 moduleUsedModulesTH
 }}}

 And the module should be recompiled if the moduleDependencyHash changes.

 Or something like that...?

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



More information about the Glasgow-haskell-bugs mailing list