[Haskell-cafe] How to use cabal's data-files feature and run in-place?

Richard Cobbe cobbe at ccs.neu.edu
Fri Apr 22 13:57:36 CEST 2011


On Thu, Apr 21, 2011 at 11:27:10PM -0500, Antoine Latter wrote:
> 1. A side note - using the 'cabal' command line tool is easier for
> many tasks than 'runhaskell Setup'. In particular, it does a user
> install by default.

Interesting -- didn't know that was possible.  I didn't see that in the
Cabal manual; section 4 gives instructions entirely in terms of 'runhaskell
Setup'.  Am I overlooking something?

> 2. Here's what I do for the paths situation:
>
> In the package description, create a CPP option so you know you're
> compiling via Cabal:
>
> > Cpp-options: -DCABAL
>
> Then create a module to wrap around the autogenerated paths module,
> making sure to put the CPP Language pragma at the top:
>
> > {-# LANGUAGE CPP #-}
>
> You can then use #ifdef CABAL to decide to re-export the Cabal
> autogenerated paths functionality, or to use the ones you've written
> yourself (based on the current directory or whatever you need).
>
> I hope that this helps! I don't have any examples on hand at the moment.

That sounds like it should work, thanks.  I'd been thinking about using CPP
tricks, but I didn't know how to use CPP for a module in a way that would
work with the rest of the toolchain -- in particular, with both ghc and
ghci.  I'll give it a shot.

Thanks!

Richard



More information about the Haskell-Cafe mailing list