cabal-toolkit-0.0.6: Helper functions for writing custom Setup.hs scripts.

Copyright(c) 2017 Shao Cheng
LicenseBSD3
Maintainerastrohavoc@gmail.com
Stabilityalpha
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • Cpp
  • TemplateHaskell
  • TemplateHaskellQuotes

Distribution.Simple.Toolkit

Contents

Description

This module provides helper functions for writing custom Setup.hs scripts.

Synopsis

Writing build metadata in Setup.hs

userHooksWithBuildInfo :: UserHooks -> UserHooks Source #

Attach a post-configure action to a UserHooks which serializes PackageDescription to .pkg_descr.buildinfo and LocalBuildInfo to .lbi.buildinfo. They should be added to your project's .gitignore file. Don't forget to edit the custom-setup stanza of your project's .cabal file and add cabal-toolkit to the dependencies.

Retrieving build metadata via Template Haskell

packageDescriptionQ :: Q Exp Source #

The Template Haskell splice to retrieve PackageDescription.

localBuildInfoQ :: Q Exp Source #

The Template Haskell splice to retrieve LocalBuildInfo.

Convenient functions for working with build metadata

getComponentInstallDirs :: PackageDescription -> LocalBuildInfo -> ComponentName -> InstallDirs FilePath Source #

Retrieve the InstallDirs corresponding to a ComponentName, assuming that component does exist and is unique.

getComponentBuildInfo :: PackageDescription -> ComponentName -> BuildInfo Source #

Retrieve the BuildInfo corresponding to a ComponentName, assuming that component does exist and is unique.

getGHCLibDir :: LocalBuildInfo -> FilePath Source #

Equivalent to what you get from ghc --print-libdir.

runLBIProgram :: LocalBuildInfo -> Program -> [ProgArg] -> IO () Source #

Run a Program with default Verbosity.

getLBIProgramOutput :: LocalBuildInfo -> Program -> [ProgArg] -> IO String Source #

Run a Program and retrieve stdout with default Verbosity.

Convenient functions for working with GHC API

getGHCPackageDBFlags :: LocalBuildInfo -> [PackageDBFlag] Source #

Extract PackageDBFlags from LocalBuildInfo to put into the packageDBFlags field of DynFlags. This is useful to ensure the invocation of GHC API shares the same package databases (e.g. a stack snapshot)

Extra Programs