[Haskell-cafe] a couple of cabal related questions
Magnus Therning
magnus at therning.org
Tue Oct 12 11:00:13 EDT 2010
On Tue, Oct 12, 2010 at 15:34, Dmitry V'yal <akamaus at gmail.com> wrote:
> On 12.10.2010 13:45, Magnus Therning wrote:
>>
>> On Tue, Oct 12, 2010 at 10:20, Dmitry V'yal<akamaus at gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> recently I've cabalized my program and it brought some problems.
>>>
>>> First of all, I made use of 'import Paths_<package name>' functionality
>>> to
>>> get the path of installed data files. It works great, but now I can no
>>> longer run my program in ghci because this module is auto-generated by
>>> cabal. I tried to supply my own. This way ghci works, but my stub module
>>> gets compiled into the binary in place of auto-generated. And things
>>> break
>>> again. What's the best way to overcome it?
>>
>> Create a file called .ghci in the directory where you run ghci and
>> make it contains something like this:
>>
>> :set -idist/build/autogen
>>
>>> And another question. I'd like to make my program output it's version
>>> string. Of course, I can hardcode it into sources, but I've already
>>> specified one in the cabal file. Is there any way to get it back in the
>>> run
>>> time?
>>
>> It's in Paths_<package name> as the variable 'version'.
>>
>> /M
>>
>
> That's perfectly what I was looking for, thanks a lot!
>
> By the way, the 'version' variable doesn't mentioned in Cabal user guide, or
> at least I missed it. Is it documented somewhere?
I don't know, I think I found it in the source more or less by mistake :-)
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus@therning.org Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe
More information about the Haskell-Cafe
mailing list