[Haskell-cafe] Stupid question about Cabal file

Fernand quarantedeux42 at yahoo.fr
Thu Jun 26 08:01:49 EDT 2008


Excuse me in advance if this is a trivial question, but I have been 
unable to find (understand?) the answer in Cabal's documentation.
My issue is simple : I build a Cabal package named, let's say, "foo". 
That package is a library (libHSfoo.a, something like that), which 
exposes its Foo.Bar and Foobar modules. I wrote the cabal file, register 
it, everything seems fine.
The issue comes when I try to use that package when compiling a main 
program, like this :

ghc -package foo MyMain.hs [other options]

I get an error about the compiler not finding the interface files 
Foobar.hi and Bar.hi, as I have "import Bar" and "import Foo.Bar" in my 
"MyMain.hs" file. Of course, I could add "-l" flags to point to the 
".hi" files that I used to compile my package, but I get the well-known 
issue about the fact that the package's names of the interface files 
(which were compiled with the "-package-name foo" option) are not the 
correct ones ("Bad interface file: ../foo/Foobar.hi, Something is amiss; 
requested module  main:Foobar differs from name found in the interface 
file foo:Foobar") ; and that solution is ugly anyway.

So far, I found some Cabal documentation talking about the import-dirs 
property, but I did not manage to "make it work", I mean, my package 
does not seems to "include" the interface files. I am sure, on the other 
hand, that it is possible :)

Sincerely yours,


More information about the Haskell-Cafe mailing list