Generics in 6.8.0 RC

Dirk Kleeblatt klee at
Sat Sep 22 04:45:50 EDT 2007

Dear *,

I just failed to get generic classes working with snapshot
ghc- Are generics broken in
the RC, or am I doing something wrong?

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

klee at romulus:~/tmp> ghci -fglasgow-exts -XGenerics
GHCi, version  :? for help
Loading package base ... linking ... done.
Prelude> :l Gen.hs
[1 of 1] Compiling Gen              ( Gen.hs, interpreted )

      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.

Using -ddump-if-trace as suggested gave me no idea of anything, ;-) but
if you're interested, I can post the dump, too.

Any hints appreciated!

Kind regards,

More information about the Glasgow-haskell-users mailing list