RULES ignored by recompilation checker
The recompilation checker does not seem to take RULES into account. This can lead to some really nasty optimisation bugs. A small example:
[rl@rl-lap stuff]$ cat T.hs
module T where
foo n = n+1
{-# RULES
"foo" forall n.
foo (foo n) = foo (n+2)
#-}
[rl@rl-lap stuff]$ cat U.hs
module Main where
import T
main = print $ foo (foo 5)
[rl@rl-lap stuff]$ ghc --make U.hs -O
Chasing modules from: U.hs
Compiling T ( ./T.hs, ./T.o )
Compiling Main ( U.hs, U.o )
Linking ...
Change the rule in T.hs:
[rl@rl-lap stuff]$ cat T.hs
module T where
foo n = n+1
{-# RULES
"foo" forall n.
foo (foo n) = foo (n+3)
#-}
[rl@rl-lap stuff]$ ghc --make U.hs -O
Chasing modules from: U.hs
Compiling T ( ./T.hs, ./T.o )
Skipping Main ( U.hs, U.o )
Linking ...
[rl@rl-lap stuff]$ ghc -c U.hs -O
compilation IS NOT required
Trac metadata
Trac field | Value |
---|---|
Version | 6.4.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |