ghc-6.7: panic! (the 'impossible' happened) -- typechecker getting confused by Data.Generics?
This bug is triggered by http://www.cse.unsw.edu.au/~dons/lambdabot/Lib/Pointful.hs. A reduced test case follows.
{-# OPTIONS_GHC -fglasgow-exts #-}
module Pointful' where
import Language.Haskell.Syntax
import Data.Generics
import Control.Monad.State
-- rename :: () -> HsExp -> State (HsName, [HsName]) HsExp
rename = \_ -> everywhereM (mkM (\e -> case e of HsWildCard -> return e))
{-
Pointful.hs:9:0:ghc-6.7: panic! (the 'impossible' happened)
(GHC version 6.7 for i386-unknown-linux):
dictPred
ic{v a1nF} :: {forall a{tv a1iH} [sk].
(base:Data.Generics.Basics.Data{tc 29} a{tv a1iH} [sk]) =>
<pred>base:GHC.Base.Monad{tc 28} m{tv a1nq} [tau]}
Refinement {[]}
-}
-- rename _ = everywhereM (mkM (\e -> case e of HsWildCard -> return e))
{-
Pointful.hs:30:17:
Couldn't match expected type `Monad m' against inferred type `()'
In the first argument of `rename', namely `()'
In the expression: rename () undefined
In the definition of `uncomb'': uncomb' = rename () undefined
-}
uncomb' :: State (HsName, [HsName]) HsExp
uncomb' = rename () undefined
The errors can be reproduced by uncommenting the line immediately preceding it (and commenting out the other one). In both cases the error can be fixed by uncommenting the type signature for rename
.
Tested with ghc-6.7 as of 2006-11-27. ghc-6.6 and ghc-6.4.2 are both fine.
Trac metadata
Trac field | Value |
---|---|
Version | 6.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |