I encountered a problem with existentially quantified type
variables (yes, they can really be useful ;-) when they
appear in a .hi file in GHC 4.01.

Taking the following module 

  module T (T)
  where

  data T = forall a. T a (a -> Int)

which is imported by

  import T

  main = putStr "oops"

I get

  nomi chak 57 (~/haskell): ghc-4.01 -c T.hs
  ghc-4.01: module version changed to 1; reason: no old .hi file
  nomi chak 58 (~/haskell): ghc-4.01 -c bug.hs

  bug.hs:1: T.hi:6 Interface-file parse error; toks= []

  bug.hs:1: Could not find valid interface file `T'

The file T.hi looks as follows:

__interface T 1 401 where
import PrelBase 1 :: addr2Integer 1 foldr 1 int2Integer 1 integer_0 1 integer_1 1 
integer_2 1 integer_m1 1;
import PrelPack 1 :: packCString# 1 unpackAppendCString# 1 unpackCString# 1 
unpackFoldrCString# 1 unpackNBytes# 1;
__instimport IO ; __instimport PrelAddr ; __instimport PrelArr ; __instimport 
PrelBounded ; __instimport PrelCCall ; __instimport PrelForeign ; __instimport 
PrelIOBase ; __instimport PrelNum ; __instimport PrelNumExtra ; __instimport PrelTup ;
__export T T;
1 data T = __forall [_r8i] {} => T _r8i (_r8i -> PrelBase.Int) ;
                           ^^\after removing this, the .hi
                           is read correctly

The {} seems to be the problem.  I couldn't check whether
the problem persists in GHC 4.02, as I am still in the
middle of compiling it. It seems as if - at least for Linux
- the heap size is too small for many of the library
modules.  Sven, did you have the same problem?  (Or can it
be a problem that I compiled the compiler proper with 3.02?)

Manuel
 

Reply via email to