GHCi Crash
farrand@maoli:/tmp$ ghci -fgenerics -package lang
-fglasgow-exts Bin.hs
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version
5.00.2, For Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package std ... linking ... done.
Loading package lang ... linking ... done.
Compiling Bin ( Bin.hs, interpreted )
ghc-5.00.2: panic! (the `impossible' happened, GHC
version 5.00.2):
ByteCodeGen.lookupCE PrelTup.zdgfromZ1T{-47-}
Please report it as a compiler bug to
glasgow-haskell-bugs@haskell.org,
or http://sourceforge.net/projects/ghc/.
farrand@maoli:/tmp$ cat Bin.hs
module Bin where
import Generics
class Bin a where
toBin :: a -> [Int]
fromBin :: [Int] -> (a, [Int])
toBin {| Unit |} Unit = []
toBin {| a :+: b |} (Inl x) = 0 : toBin x
toBin {| a :+: b |} (Inr y) = 1 : toBin y
toBin {| a :*: b |} (x :*: y) = toBin x ++
toBin y
fromBin {| Unit |} bs = (Unit, bs)
fromBin {| a :+: b |} (0:bs) = (Inl x, bs')
where (x,bs') = fromBin bs
fromBin {| a :+: b |} (1:bs) = (Inr y, bs')
where (y,bs') = fromBin bs
fromBin {| a :*: b |} bs = (x :*: y, bs'')
where
(x,bs' ) = fromBin bs
(y,bs'') = fromBin bs'
instance Bin Int where
toBin i = [i]
fromBin (h:t) = (h,t)
instance (Bin a, Bin b) => Bin (a,b) where
farrand@maoli:/tmp$ ghc --version
The Glorious Glasgow Haskell Compilation System,
version 5.00.2
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 |