special handling of "Main.hs" contradicts Report

Mark Tullsen mtullsen at cse.ogi.edu
Fri Apr 18 12:56:58 EDT 2003


The problem comes when I try to import the module.
Note:
  tests $ cat X.hs
  module X where t1 = t1

  tests $ cp X.hs Main.hs

  tests $ ghc -c X.hs Main.hs

  tests $ ghc --show-iface X.hi
  __interface "Main" X 2 where
  __export  X t1;
  import GHC.Base ! :: 1;
  import Foreign.Ptr !;
  ;
  1 t1 :: forall t. t;
  (1, [])

  tests $ ghc --show-iface Main.hi
  __interface "Main" Main 5 where
  import GHC.IOBase :: 1;
  import GHC.TopHandler :: 1;
  import GHC.Base ! :: 1;
  import Foreign.Ptr !;
  import System.IO :: 1;
  ;
  1 ($main) :: GHC.IOBase.IO ();
  (1, [])

Two identical files but their interface files are different.

- Mark

Simon Marlow wrote:

> 
>  
>
>>I have this simple module:
>>
>>   module X where
>>   t1 = t1
>>
>>If it's in a file called "X.hs," all works as expected,
>>it exports 't1'.  But if it's in a file called "Main.hs,"
>>then it doesn't export 't1'.
>>    
>>
>
>Nope, I can't reproduce that:
>
>Prelude> :!cat Main.hs
>module X where
>t1 = t1
>Prelude> :l Main.hs
>Compiling X                ( Main.hs, interpreted )
>Ok, modules loaded: X.
>*X> :b X
>t1 :: forall t. t
>*X> 
>
>  
>
>>The same is true if we have "module Main" instead of "module X".
>>    
>>
>
>Hmm, there might be a bug here.  I always thought that if you write 'module Main where' as the module header, then the compiler is
>allowed to interpret it as 'module Main (main) where', but I just checked the report and it doesn't seem to say that (perhaps it was
>an older version of Haskell?  Anyone remember?).
>
>Cheers,
>	Simon
>
>
>  
>




More information about the Glasgow-haskell-bugs mailing list