After wading through the epic discussion of finali[sz]ers (reading
"War and Peace", "Lord of The Rings", and "The Art of Computer
Programming" (vol. 1-3) simultaneously would probably have taken
less time :-}, I've finally found some more time for the "deriving"
problem. Given the following source files
-- Bar.hs --------------------------------------------------
module Bar where
data Int32 = Int32 Int deriving ( Eq )
newtype CInt = CInt Int32 deriving ( Eq )
--Foo.hs ---------------------------------------------------
module Foo where
import Bar
newtype Window = Window CInt deriving ( Eq )
------------------------------------------------------------
"ghc --make" behaves as expected:
------------------------------------------------------------
panne@jeanluc:~> rm -f *.o *.hi ; ghc --make Bar.hs Foo.hs
ghc-5.05: chasing modules from: Bar.hs,Foo.hs
Compiling Bar ( Bar.hs, ./Bar.o )
Compiling Foo ( Foo.hs, ./Foo.o )
------------------------------------------------------------
But the (supposedly?!) equivalent
------------------------------------------------------------
panne@jeanluc:~> rm -f *.o *.hi ; ghc -c Bar.hs ; ghc -c Foo.hs
Foo.hs:3:
No instance for (Eq Int32)
arising from the instance declaration at Foo.hs:3
In the instance declaration for `Eq Window'
------------------------------------------------------------
fails. Changing the "data" in Bar.hs into "newtype" works, and
if (==)::CInt is used explicitly in Foo.hs, everything is fine,
too. Merging Bar.hs into Foo.hs is OK, too.
Looks like a task for Simon^2...
Cheers,
S.
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc