Seq causes panic in GHCi
While trying to understand the semantic differences between seq and pseq, when looking at the Control.Parallel page, it says that the compiler may transform "x seq
y" into "y seq
x seq
y"
Trying this in GHCi lead me to this:
$ ghci
GHCi, version 6.8.3: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
Prelude> let x = tail [1..]
Prelude> x `seq` ()
()
Prelude> () `seq` x `seq` ()
ghc-6.8.3: panic! (the 'impossible' happened)
(GHC version 6.8.3 for i386-apple-darwin):
nameModule (){v 71}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Prelude>
When testing this in a file however, things go smoothly:
$ cat seq.hs
x = tail [1..]
-- x `seq` y can apparently be transformed
-- into y `seq` x `seq y
v = () `seq` x `seq` ()
main = return v
$ ghc --make seq.hs
[1 of 1] Compiling Main ( seq.hs, seq.o )
Linking seq ...
$ ./seq; echo $?
0
$
I cannot be sure if this bug still occurs as of GHC 6.9.20080720, as ghci is apparently broken in my build (this could have to do with build settings but I am not sure, it has to do with the fact that the base library can't find the _environ symbol; should I file another report?)
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |