Skip to content

compiler panic with existential types and ... ?

This code is is based upon a post by Oleg at
http://www.haskell.org/pipermail/haskell-cafe/2004-October/007160.html.

{-# OPTIONS -fglasgow-exts #-}
import Control.Monad.Trans

data Bar m = forall t. (MonadTrans t, Monad (t m)) =>
               Bar (t m () -> m ()) (t m Int)

data Foo = Foo (forall m. Monad m => Bar m)

runProg (Foo (Bar run op)) = run $ prog op

prog op = do
          lift $ putStrLn "Running prog"
          return ()
                                   
data ABC = A 
instance Show ABC where
  show A = "A"

main = putStrLn $ show A

It seems to be nearly minimal, though I have no idea
why.  When I compile with ghc 6.2.1 from Debian
unstable, I get

% ghc try.hs
ghc-6.2.1: panic! (the `impossible' happened, GHC
version 6.2.1):
        cgPanic
    zddMonad {- v aGa -}
    static binds for:
    local binds for:
    Main.prog {- v rz -}
    show {- v rJG -}
    SRT labelghc-6.2.1: panic! (the `impossible'
happened, GHC version 6.2.1):
        initC: srt
Trac metadata
Trac field Value
Version None
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedWon'tFix
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited by pimlott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information