[Haskell-cafe] a couple of cabal related questions

Antoine Latter aslatter at gmail.com
Wed Oct 13 01:45:32 EDT 2010


On Tue, Oct 12, 2010 at 10:41 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 13 October 2010 02:00, Magnus Therning <magnus at therning.org> wrote:
>> On Tue, Oct 12, 2010 at 15:34, Dmitry V'yal <akamaus at gmail.com> wrote:
>>> 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 :-)
>
> Yeah, I think that's the common consensus; there is _some_
> documentation of the Paths_foo module in the Cabal user guide, but it
> doesn't cover much.
>
> One thing I do wish was possible: the ability to use a "stub"
> Paths_foo module for testing purposes (as currently you have to have
> done a "cabal configure && cabal build" to get it), but I couldn't
> find a way to do so without Cabal packaging the stub version when
> creating the distribution tarball :s
>

I've used CPP, something like:

module MyPaths
 ( export contents of Paths_magic ) where

#ifdef SOME_DEF_SET_BY_CABAL
import Paths_magic
#else

mock implementation of paths magic here

#endif

Then in your .cabal file declare the define which causes it to use the
real magic paths module. When not compiling via cabal, you'll at least
have something sensible (like the current directory or something).

I'm pretty sure I didn't make this up, but I have used it. It's a bit
of a pain to set up, though.

Antoine


More information about the Haskell-Cafe mailing list