id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
1376	panic caused in ghci by the following code involving monad transformers	logancapaldo@…		"I was attempting to learn to use monad transformers when I came across this bug,
the following is the contents of StateAccum.hs
{{{
import Control.Monad
import Control.Monad.State
import Control.Monad.List

sumUp :: [Int] -> State Int [()]
sumUp = sequence . map (modify . (+))

type StateWithList = ListT (State Int)

sumUp' xs = do x <- xs
               lift (modify (+x))
               return (lift get)


sumThreeLists :: [Int] -> [Int] -> [Int] -> Int
sumThreeLists xs ys zs = execState (sumUp xs >> sumUp ys >> sumUp zs) 0

main = do print $ execState (sumUp [1,2,3]) 0
          print $ sumThreeLists [1..10] [1..10] [1..10]
}}}

This is a transcript of the ghci session that causes the panic:
{{{
% ghci StateAccum.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Loading package base ... linking ... done.
[1 of 1] Compiling Main             ( StateAccum.hs, interpreted )
Ok, modules loaded: Main.
*Main> sumUp' [return 1, return 2]
ghc-6.6.1: panic! (the 'impossible' happened)
  (GHC version 6.6.1 for powerpc-apple-darwin):
        nameModule it{v a1es}

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

*Main> 
}}}

I'm using the binary ghc package for Mac OS PPC provided on the ghc site. The output for uname -a on my machine is

{{{ Darwin Logan-Capaldos-Computer.local 8.9.0 Darwin Kernel Version 8.9.0: Thu Feb 22 20:54:07 PST 2007; root:xnu-792.17.14~1/RELEASE_PPC Power Macintosh powerpc }}}

Running with ghci -v, this is the output
{{{
% ghci -v StateAccum.hs
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

Using package config file: /usr/local/lib/ghc-6.6.1/package.conf
wired-in package base mapped to base-2.1.1
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.1
Hsc static flags: -static
Loading package base ... linking ... done.
wired-in package base mapped to base-2.1.1
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.1
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
wired-in package base mapped to base-2.1.1
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.1
*** Chasing dependencies:
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Upsweep completely successful.
*** Deleting temp files:
Deleting: 
*** Chasing dependencies:
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
compile: input file StateAccum.hs
*** Checking old interface for main:Main:
[1 of 1] Compiling Main             ( StateAccum.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
    Result size = 244
*** Simplify:
    Result size = 292
    Result size = 263
    Result size = 263
*** Tidy Core:
    Result size = 263
*** CorePrep:
    Result size = 331
*** ByteCodeGen:
*** Deleting temp files:
Deleting: 
Upsweep completely successful.
*** Deleting temp files:
Deleting: 
Ok, modules loaded: Main.
*Main> sumUp' [return 1, return 2]
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
ghc-6.6.1: panic! (the 'impossible' happened)
  (GHC version 6.6.1 for powerpc-apple-darwin):
        nameModule it{v a1es}

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

*Main> 
}}}"	bug	closed	normal	6.8.1	Compiler	6.6.1	fixed			MacOS X	powerpc		Unknown				
