scope change

S.D.Mechveliani mechvel at math.botik.ru
Thu Jul 5 08:04:50 EDT 2001


To my report 

>> ghc-5.00.1 -interactive    (binary distribution, linux i386-unknown)
           2
>> finds or does not find the value  allPermuts
>> depending on the directory where  ghci  is run.
>>
>>  ghci ... -package docon
>>  ...
>>  Prelude> Permut.allPermuts $ reverse [1..3]
>> 

Simon Marlow writes


> GHC 5.00.2 now says:
>
>	<no file>:0:
>	    failed to load interface for `Permut':
>	        Module `Permut' is not loaded
>
>	<no file>:0: Variable not in scope: `Permut.allPermuts'
>
> which means that it thought "Permut" is a home module (i.e. in the
> "Main" package"), and you hadn't loaded it with :l.  The reason is that
> it found Permut.hi first on the home path, and didn't look on the
> package path.  The home path and package path should be distinct - but
> because your current directory is the same as a package directory, this
> isn't true.
>
> GHC should give a more informative diagnostic, or better still it could
> ignore the copy of Permut.hi on the home path because the package name
> in the interface file isn't "Main".  I'll look into this.


Also Simon Marlow writes that this bug is fixed now.

I doubt how it is fixed because do not understand how do you treat
directories.
For any occasion, I add that the directories are
           
    D/export/           -- contains .hi files, .o, .a libraries
    D/source/           -- contains  Permut.hs  and other modules
    D/source/demotest/  -- contains other modules

  The  docon  package refers to  D/export/
  Permut.hi  resides in          D/export/  only.

  ghci ... -package docon   

    is run in  D/source/demotest/  - and it works,
    then, in   D/source/           - and it reports

      ... failed to load interface for `Permut': ...

I do not understand why you say 

> ... your current directory is the same as a package directory ...

The current directory is    D/source/  
and a package directory is  D/export/     (?)

Aslo  Permut.hi  resides in  D/export/  only.
I suspect that we are confusing things, are we?

-----------------
Serge Mechveliani
mechvel at botik.ru








More information about the Glasgow-haskell-bugs mailing list