[Haskell-cafe] Build without install, using cabal

Corey O'Connor coreyoconnor at gmail.com
Tue Oct 21 00:48:38 EDT 2008

I think, though I haven't tried this, that you can replace the
instHooks with one that:
 1.  filters out the private executables from the PackageDescription
 2. Provides this new PackageDescription to the standard instHook.
Which I would think is the instHook of the UserHooks parameter passed
to your modifed instHook.

Something like (psuedo-code typed in email):

main = defaultMainWithHooks $ defaultUserHooks { instHook = filteredInstHook }

filteredInstHook :: PackageDescription -> LocalBuildInfo -> UserHooks
-> InstallFlags -> IO ()
filteredInstHook package lbi user_hooks install_flags = do
    let package' = package { executables = filter_private_executable
(executables package) }
    instHook user_hooks package' lbi user_hooks install_flags

Though that last line may need to read:
    instHook defaultUserHooks package' lbi user_hooks install_flags

-Corey O'Connor

On Mon, Oct 20, 2008 at 12:04 PM, Mauricio <briqueabraque at yahoo.com> wrote:
> Hi,
> I would like to include a few source files
> as 'executable' sections in a .cabal package
> description. However, although I do want to
> use main=mainDefault features, I do not want
> those packages to be installed when I run
> 'Setup.hs install'.
> Is it possible to do that? I believe there's
> no flag that indicates install step, since (I
> guess) flags are checked only at configure
> time.
> Thanks for your help,
> Maurício
> _______________________________________________
> 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