Opened 8 years ago

Closed 8 years ago

Last modified 15 months ago

#1033 closed bug (fixed)

ghc-6.7: panic! (the 'impossible' happened) -- typechecker getting confused by Data.Generics?

Reported by: int-e Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Test Case: tc220
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

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.

Change History (4)

comment:1 Changed 8 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to tc220

Good bugs, thank you; it exposed bogosity in my work on implication constraints, now fixed.

Simon

comment:2 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:3 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:4 Changed 15 months ago by simonpj <simonpj@…>

In fbdb1520c3bb5048cbe257cd14a96a6dc8e1da2e/ghc:

Add test for Trac #1033
Note: See TracTickets for help on using tickets.