Using packages in ghci

Simon Marlow simonmar at
Tue Oct 5 08:25:04 EDT 2004

I think what's happening here is that you essentially have overlapping
.hi files: the interface for Data.Tree.AVL.List is found along the
search path, and also in a package (because the search path "." and the
import_dirs for the package point to the same place).

This is apparently confusing GHC, but I don't know exactly how.  We
could "fix" the problem by checking whether a given module can be found
in more than one place, but that would involve searching every package
for every module, which might slow things down.  When we store the list
of visible modules with a package we'll be able to do this much more


On 02 October 2004 08:42, Adrian Hey wrote:

> On Friday 01 Oct 2004 9:36 pm, Simon Marlow wrote:
>> Looks fine - GHCi is supposed to look in the directories in
>> import_dirs 
>> for .hi files.  What does ghci -v tell you?
> Quite a lot :-), but nothing very surprising. I think I've found what
> causes the problem. It does actually seem to work as expected,
> provided the current directory is not what it usually is when I'm
> working on the library. 
> I.E. /home/adrian/HaskellLibs/Data.Tree.AVL
> This is what I get
>> Prelude> :m Data.Tree.AVL
>> Prelude Data.Tree.AVL> asTreeL "ABCD"
>> <interactive>:1:
>>    tcLookup: `asTreeL' is not in scope
>>    In the definition of `it': it = asTreeL "ABCD"
>> Failed to load interface for `Data.Tree.AVL.List':
>>    Bad interface file: ./Data/Tree/AVL/List.hi
>>        ./Data/Tree/AVL/List.hi: openBinaryFile: does not exist (No
>> such file or directory) 
>> Failed to find interface decl for `asTreeL'
>> from module `Data.Tree.AVL.List'
> But if I cd to..
> I.E. /home/adrian/HaskellLibs/Data.Tree.AVL/pkg
> works fine. I've since discovered it also seems to work fine from
> from any other directory too. So it seems to something peculiar about
> the one particular directory that upsets it.
> This is with version 6.2.20040915, but 6.2.1 did the same thing IIRC.
> Regards

More information about the Glasgow-haskell-users mailing list