Opened 13 years ago

Closed 13 years ago

Last modified 44 years ago

#575 closed bug (Wont Fix)

GHCi Crash

Reported by: nobody Owned by: nobody
Priority: normal Milestone:
Component: Compiler Version: None
Keywords: Cc:
Operating System: Architecture:
Type of failure: Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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

Change History (1)

comment:1 Changed 13 years ago by simonmar

  • Status changed from assigned to closed
Logged In: YES 
user_id=48280

Support for generic classes is currently broken, and won't 
be fixed in 5.02 I'm afraid.
Note: See TracTickets for help on using tickets.