
On Fri, 2011-04-22 at 05:51 +0400, Richard Cobbe wrote:
I did some googling and came across a blog post
which suggested that I provide my own Paths_pkg.hs file that points to
files' location in the development copy. When I build with Cabal, the generated form of this module would override my hand-written one, and it should therefore work in the installed case as well.
Unfortunately, that's not happening. Cabal is clearly generating the module; I can see it in dist/build/autogen. But my copy is overriding
(http://neilmitchell.blogspot.com/2008/02/adding-data-files-using-cabal.html) the the
autogenerated one, even for cabal builds -- at least, that's what I'm seeing when I run the binary out of dist/build/<package>/<executable>.
Is there a way to be able to use data files in both contexts?
For such purposes I use separate directory for Paths_pkg.hs and don't notice it in pkg.cabal. For example, imagine "src" directory with source files (appropriately mentioned in pkg.cabal with "hs-source-dirs: src") and additional "plugs" directory with "Paths_pkg.hs" (that is not mentioned in pkg.cabal). In such case cabal builds project with autogenerated Paths_pkg.hs and ghci also can be launched in "src" directory with "ghci Main.hs -i../plugs". Vladimir