The attached tgz archive contains 4 files:
  A.hs defines a type X and a type class Y
  B.hs imports A and makes X an instance of Y
  C.hs imports B and just exports everything again
  D.hs imports C and tries to use the fact that X is an instance of Y.

If you compile this using
  ghc -c [A/B/C/D].hs
then it should all go swimmingly (by the way, we are on Sparc-Solaris and using a 
version
downloaded at the end of last week).

If however you compile it using
  ghc -c [A/B/C/D].hs -i$PWD
(replace $PWD by the absolute path of directory containing A,B,C,D, if your shell 
doesn't)
then it doesn't work.  The reason is that C.hi now only contains the following:

__interface C 1  404 where
__export A X{FOO BAR} Y{p};

where it previously contained

__interface C 1  404 where
__export A X{FOO BAR} Y{p};
import A 1 ::;
import B 1 ! ::;

In other words it looks as if, because A and B were obtained from an absolute path,
ghc has decided to forget to add them to C's import list, so that the instance 
declaration
in B gets lost.

This is really exceptionally confusing.  I am not sure if it is intended or not, but I
certainly don't like it, and it doesn't seem to be documented.  If the use of 
absolute path names for interface files is deprecated then ITWSBT!

bug.tar.gz

Reply via email to