[GHC] #481: Recompilation check fails for TH

GHC trac at galois.com
Fri Jan 13 06:37:46 EST 2006


#481: Recompilation check fails for TH
-------------------------------+--------------------------------------------
  Reporter:  simonpj           |          Owner:  simonpj 
      Type:  bug               |         Status:  assigned
  Priority:  low               |      Milestone:          
 Component:  Template Haskell  |        Version:  6.4.1   
  Severity:  normal            |     Resolution:  None    
  Keywords:                    |             Os:  Unknown 
Difficulty:  Unknown           |   Architecture:  Unknown 
-------------------------------+--------------------------------------------
Changes (by simonmar):

  * architecture:  => Unknown
  * difficulty:  => Unknown
  * version:  None => 6.4.1
  * os:  => Unknown

Old description:

> {{{
> The recompilation check only recompiles a module when
> the *interface* of a module it imports changes.  But
> with Template Haskell, it may need to be recompiled
> when the *implementation* changes.
>
> Concrete example below.  It's quite awkward to fix.
>
> * Perhaps a module that contains any splices should be
> recompiled always.
> * Perhaps a module that exports any TH stuff (how
> would we tell?) should be flagged as changed if
> anything about it changes.
>
> Simon
>
> The following scenario reproduces this error
> (thanks to Bulat Ziganshin bulatz at HotPOP.com):
>
> 1) create Main.hs containing code
>
> module Main where
> import Sub
> main = print $x
>
> and Sub.hs containing code
>
> module Sub where
> x = [| 1 |]
>

>
> 2) compile them with --make:
>
> C:\!\Haskell\!>ghc --make -fth Main.hs
> Chasing modules from: Main.hs
> Compiling Sub              ( ./Sub.hs, ./Sub.o )
> Compiling Main             ( Main.hs, Main.o )
> Loading package base-1.0 ... linking ... done.
> Loading package haskell98-1.0 ... linking ... done.
> Loading package template-haskell-1.0 ... linking ...
> done.
> Linking ...
>
> C:\!\Haskell\!>main.exe
> 1
>

> 3) now change Sub.hs to the following code:
>
> module Sub where
> x = [| 2 |]
>

>
> 4) and recompile program:
>
> C:\!\Haskell\!>ghc --make -fth Main.hs
> Chasing modules from: Main.hs
> Compiling Sub              ( ./Sub.hs, ./Sub.o )
> Skipping  Main             ( Main.hs, Main.o )
> Linking ...
>
> C:\!\Haskell\!>main.exe
> 1
>

> As you see, Main.hs is not recompiled despite the fact
> that definition
> of x is changed and now program must print "2"
>

> }}}

New description:

 {{{
 The recompilation check only recompiles a module when
 the *interface* of a module it imports changes.  But
 with Template Haskell, it may need to be recompiled
 when the *implementation* changes.

 Concrete example below.  It's quite awkward to fix.

 * Perhaps a module that contains any splices should be
 recompiled always.
 * Perhaps a module that exports any TH stuff (how
 would we tell?) should be flagged as changed if
 anything about it changes.

 Simon

 The following scenario reproduces this error
 (thanks to Bulat Ziganshin bulatz at HotPOP.com):

 1) create Main.hs containing code

 module Main where
 import Sub
 main = print $x

 and Sub.hs containing code

 module Sub where
 x = [| 1 |]



 2) compile them with --make:

 C:\!\Haskell\!>ghc --make -fth Main.hs
 Chasing modules from: Main.hs
 Compiling Sub              ( ./Sub.hs, ./Sub.o )
 Compiling Main             ( Main.hs, Main.o )
 Loading package base-1.0 ... linking ... done.
 Loading package haskell98-1.0 ... linking ... done.
 Loading package template-haskell-1.0 ... linking ...
 done.
 Linking ...

 C:\!\Haskell\!>main.exe
 1


 3) now change Sub.hs to the following code:

 module Sub where
 x = [| 2 |]



 4) and recompile program:

 C:\!\Haskell\!>ghc --make -fth Main.hs
 Chasing modules from: Main.hs
 Compiling Sub              ( ./Sub.hs, ./Sub.o )
 Skipping  Main             ( Main.hs, Main.o )
 Linking ...

 C:\!\Haskell\!>main.exe
 1


 As you see, Main.hs is not recompiled despite the fact
 that definition
 of x is changed and now program must print "2"


 }}}

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


More information about the Glasgow-haskell-bugs mailing list