#1728: generic classes broken
-----------------------------------+----------------------------------------
  Reporter:  [EMAIL PROTECTED]  |          Owner:       
      Type:  bug                   |         Status:  new  
  Priority:  normal                |      Milestone:       
 Component:  Compiler              |        Version:  6.8  
  Severity:  normal                |       Keywords:       
Difficulty:  Unknown               |             Os:  Linux
  Testcase:                        |   Architecture:  x86  
-----------------------------------+----------------------------------------
I failed to get generic classes working with snapshot
 ghc-6.8.0.20070920-i386-unknown-linux.tar.bz2.

 I tried the following module:

 ---
 module Gen where

 import Data.Generics

 class Equal a where
       equal :: a -> a -> Bool
       equal {| Unit |}    Unit        Unit        = True
       equal {| u :+: v |} (Inl x)     (Inl y)     = equal x y
       equal {| u :+: v |} (Inr x)     (Inr y)     = equal x y
       equal {| u :+: v |} _           _           = False
       equal {| u :*: v |} (x1 :*: x2) (y1 :*: y2) = equal x1 y1 && equal
 x2 y2

 instance Equal Bool
 ---

 and got

 ---
 [EMAIL PROTECTED]:~/tmp> ghci -fglasgow-exts -XGenerics
 GHCi, version 6.8.0.20070920: http://www.haskell.org/ghc/  :? for help
 Loading package base ... linking ... done.
 Prelude> :l Gen.hs
 [1 of 1] Compiling Gen              ( Gen.hs, interpreted )

 Gen.hs:13:0:
       Can't find interface-file declaration for variable
 GHC.Base.$gfromBool
         Probable cause: bug in .hi-boot file, or inconsistent .hi file
         Use -ddump-if-trace to get an idea of which file caused the error
       In the first argument of `a', namely `(GHC.Base.$gfromBool b)'
       In the first argument of `(\ a -> a)', namely
           `(a (GHC.Base.$gfromBool b))'
       In the expression: (\ a -> a) (a (GHC.Base.$gfromBool b))
 Failed, modules loaded: none.
 ---

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1728>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to