
#16211: Recompiling results in a missing instance -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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: 1. `cabal build`. This succeeds. [This step isn't required to reproduce the bug, but it shows that the program should compile.] 2. Replace line 5 with line 6 in Main.hs 3. `cabal build`. GHC correctly reports a compile error (`Couldn't match expected type 'IO Bool' with actual type 'Bool'`) 4. Fix the problem by reinstating line 5 and removing line 6. 5. `cabal build`. This step *should* compile without errors, but instead I get a GHC error about a missing instance related to the `monad-classes` library. 6. `cabal build` all day. The `missing instance` error 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 [https://github.com/strake/monad-classes.hs/issues/4 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.] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16211 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler