Recompiling results in a missing instance
The attached program compiles without error using cabal.
import Bar
main :: IO ()
main = do
let x = True -- line 5
--x <- True -- line 6
foo x bar
foo :: Bool -> IO () -> IO ()
foo _ _ = undefined
However:
-
cabal build. This succeeds. [This step isn't required to reproduce the bug, but it shows that the program should compile.] - Replace line 5 with line 6 in Main.hs
-
cabal build. GHC correctly reports a compile error (Couldn't match expected type 'IO Bool' with actual type 'Bool') - Fix the problem by reinstating line 5 and removing line 6.
-
cabal build. This step *should* compile without errors, but instead I get a GHC error about a missing instance related to themonad-classeslibrary. -
cabal buildall day. Themissing instanceerror still occurs until you clean temporary files and start from scratch.
I suspect the error in step 5 is itself a (different?) GHC bug, but for now it is reported here. This GHC bug report is specifically about compiling with identical source code (steps 1 and 5) and getting different outcomes (step 1 compiles, step 5 has an error), which shouldn't happen regardless of other bugs.
[Note I can produce the missing instance issue without having to recompile GHC, which is why I think it might be independent of this bug.]
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |