logo       

Re: special handling of "Main.hs" contradicts Report: msg#00051

lang.haskell.glasgow.bugs

Subject: Re: special handling of "Main.hs" contradicts Report

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





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise