[Haskell-cafe] a couple of cabal related questions

Neil Mitchell ndmitchell at gmail.com
Wed Oct 13 14:58:33 EDT 2010


I do this using a .ghci file. For Hoogle I have a file called Paths.hs
with the module name Paths_hoogle and stub exports. I then have my
.ghci file as:

:load Main.hs Paths.hs

Now Paths.hs will never interfere, or be picked up in ghc --make,
because it has the wrong name - but is used in ghci.

Thanks, Neil

On Wed, Oct 13, 2010 at 6:45 AM, Antoine Latter <aslatter at gmail.com> wrote:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list