
Hello Erik.
Yes, that solution may work, but seems ad-hoc to me. I would like to see a
way to actually import the Paths module. In the meanwhile, I will be using
your idea. Thank you for the response.
Anybody knows how to hack the Setup.hs so I can use the real Paths module?
On Wed, Jul 3, 2013 at 3:39 AM, Erik de Castro Lopo
Daniel Díaz Casanueva wrote:
Hi everyone.
I am writing a package where I am using the Paths module that cabal generates automatically. After adding the Paths module to the "other-modules" section in my cabal file everything worked just fine, until I wanted to write a custom Setup.hs. This Setup.hs just writes a couple of files in the system and then calls "defaultMain". The thing is that now "cabal install" does not find the Paths module, so the package is broken.
I ran into the same problem. I ended up fixing it by *not* using the auto generated Paths module and instead parsing the cabal file in Setup.hs.
This is not has horrible as it sounds as I used the Cabal insfrastructure to do it. Basically something like this:
import Distribution.Simple import Distribution.PackageDescription import Distribution.PackageDescription.Parse (readPackageDescription) import Distribution.Verbosity (silent)
version <- fmap (showVersion . pkgVersion . package . packageDescription) $ readPackageDescription silent "my-package.cabal"
and then used that version String to write a trivial 5 line file Version.hs.
HTH, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe