cabal-helper-0.3.8.0: Simple interface to some of Cabal's configuration state used by ghc-mod

Safe HaskellNone
LanguageHaskell2010

Distribution.Helper

Contents

Synopsis

Documentation

data Programs Source

Paths or names of various programs we need.

Running Queries

data Query m a Source

Caches helper executable result so it doesn't have to be run more than once as reading in Cabal's LocalBuildInfo datatype from disk is very slow but running all possible queries against it at once is cheap.

Instances

Monad m => Monad (Query m) 
Functor m => Functor (Query m) 
(Monad m, Functor m) => Applicative (Query m) 
MonadIO m => MonadIO (Query m) 

runQuery Source

Arguments

:: Monad m 
=> FilePath

Path to dist/

-> Query m a 
-> m a 

runQuery query distdir. Run a Query. distdir is where Cabal's setup-config file is located.

runQuery' Source

Arguments

:: Monad m 
=> Programs 
-> FilePath

Path to dist/

-> Query m a 
-> m a 

Queries against Cabal's on disk state

packageDbStack :: MonadIO m => Query m [ChPkgDb] Source

List of package databases to use.

entrypoints :: MonadIO m => Query m [(ChComponentName, ChEntrypoint)] Source

Modules or files Cabal would have the compiler build directly. Can be used to compute the home module closure for a component.

sourceDirs :: MonadIO m => Query m [(ChComponentName, [FilePath])] Source

A component's source-dirs field, beware as if this is empty implicit behaviour in GHC kicks in.

ghcOptions :: MonadIO m => Query m [(ChComponentName, [String])] Source

All options cabal would pass to GHC.

ghcSrcOptions :: MonadIO m => Query m [(ChComponentName, [String])] Source

Only search path related GHC options.

ghcPkgOptions :: MonadIO m => Query m [(ChComponentName, [String])] Source

Only package related GHC options, sufficient for things don't need to access any home modules.

ghcMergedPkgOptions :: MonadIO m => Query m [String] Source

Like ghcPkgOptions but for the whole package not just one component

ghcLangOptions :: MonadIO m => Query m [(ChComponentName, [String])] Source

Only language related options, i.e. -XSomeExtension

Result types

data ChEntrypoint Source

Constructors

ChSetupEntrypoint

Almost like ChExeEntrypoint but main-is could either be "Setup.hs" or "Setup.lhs". Since we don't know where the source directory is you have to find these files.

ChLibEntrypoint 
ChExeEntrypoint 

General information

Managing dist/

reconfigure Source

Arguments

:: MonadIO m 
=> Programs

Program paths

-> [String]

Command line arguments to be passed to cabal

-> m () 

Run cabal configure

writeAutogenFiles Source

Arguments

:: MonadIO m 
=> FilePath

Path to the dist/ directory

-> m () 

Create cabal_macros.h and Paths_<pkg> possibly other generated files in the usual place.

$libexec related error handling

data LibexecNotFoundError Source

This exception is thrown by all runQuery functions if the internal wrapper executable cannot be found. You may catch this and present the user an appropriate error message however the default is to print libexecNotFoundError.

libexecNotFoundError Source

Arguments

:: String

Name of the executable we were trying to find

-> FilePath

Path to $libexecdir

-> String

URL the user will be directed towards to report a bug.

-> String