Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Programs = Programs {}
- defaultPrograms :: Programs
- data QueryEnv
- qeReadProcess :: QueryEnv -> FilePath -> [String] -> String -> IO String
- qePrograms :: QueryEnv -> Programs
- qeProjectDir :: QueryEnv -> FilePath
- qeDistDir :: QueryEnv -> FilePath
- qeCabalPkgDb :: QueryEnv -> Maybe FilePath
- qeCabalVer :: QueryEnv -> Maybe Version
- defaultQueryEnv :: FilePath -> FilePath -> QueryEnv
- data Query m a
- runQuery :: Monad m => QueryEnv -> Query m a -> m a
- packageDbStack :: MonadIO m => Query m [ChPkgDb]
- entrypoints :: MonadIO m => Query m [(ChComponentName, ChEntrypoint)]
- sourceDirs :: MonadIO m => Query m [(ChComponentName, [FilePath])]
- ghcOptions :: MonadIO m => Query m [(ChComponentName, [String])]
- ghcSrcOptions :: MonadIO m => Query m [(ChComponentName, [String])]
- ghcPkgOptions :: MonadIO m => Query m [(ChComponentName, [String])]
- ghcMergedPkgOptions :: MonadIO m => Query m [String]
- ghcLangOptions :: MonadIO m => Query m [(ChComponentName, [String])]
- pkgLicenses :: MonadIO m => Query m [(String, [(String, Version)])]
- flags :: MonadIO m => Query m [(String, Bool)]
- configFlags :: MonadIO m => Query m [(String, Bool)]
- nonDefaultConfigFlags :: MonadIO m => Query m [(String, Bool)]
- packageId :: MonadIO m => Query m (String, Version)
- compilerVersion :: MonadIO m => Query m (String, Version)
- newtype ChModuleName = ChModuleName String
- data ChComponentName
- data ChPkgDb
- data ChEntrypoint
- = ChSetupEntrypoint
- | ChLibEntrypoint { }
- | ChExeEntrypoint { }
- buildPlatform :: (FilePath -> [String] -> String -> IO String) -> IO String
- getSandboxPkgDb :: (FilePath -> [String] -> String -> IO String) -> FilePath -> Version -> IO (Maybe FilePath)
- prepare :: MonadIO m => (FilePath -> [String] -> String -> IO String) -> FilePath -> FilePath -> m ()
- prepare' :: MonadIO m => QueryEnv -> m ()
- reconfigure :: MonadIO m => (FilePath -> [String] -> String -> IO String) -> Programs -> [String] -> m ()
- writeAutogenFiles :: MonadIO m => (FilePath -> [String] -> String -> IO String) -> FilePath -> FilePath -> m ()
- writeAutogenFiles' :: MonadIO m => QueryEnv -> m ()
- data LibexecNotFoundError = LibexecNotFoundError String FilePath
- libexecNotFoundError :: String -> FilePath -> String -> String
Documentation
Paths or names of various programs we need.
qeReadProcess :: QueryEnv -> FilePath -> [String] -> String -> IO String Source #
How to start the cabal-helper process. Useful if you need to capture stderr output from the helper.
qePrograms :: QueryEnv -> Programs Source #
qeProjectDir :: QueryEnv -> FilePath Source #
Path to project directory, i.e. the one containing the
project.cabal
file
qeCabalPkgDb :: QueryEnv -> Maybe FilePath Source #
Where to look for the Cabal library when linking the helper
qeCabalVer :: QueryEnv -> Maybe Version Source #
If dist/setup-config
wasn't written by this version of Cabal throw
an error
Running Queries
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.
runQuery :: Monad m => QueryEnv -> Query m a -> m a Source #
runQuery query distdir
. Run a Query
. distdir
is where Cabal's
setup-config
file is located.
Queries against Cabal's on disk state
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
pkgLicenses :: MonadIO m => Query m [(String, [(String, Version)])] Source #
Get the licenses of the packages the current project is linking against.
nonDefaultConfigFlags :: MonadIO m => Query m [(String, Bool)] Source #
Flag assignments from setup-config which differ from the default setting. This can also include flags which cabal decided to modify, i.e. don't rely on these being the flags set by the user directly.
packageId :: MonadIO m => Query m (String, Version) Source #
Package identifier, i.e. package name and version
compilerVersion :: MonadIO m => Query m (String, Version) Source #
The version of GHC the project is configured to use
Result types
newtype ChModuleName Source #
data ChComponentName Source #
data ChEntrypoint Source #
ChSetupEntrypoint | Almost like |
ChLibEntrypoint | |
ChExeEntrypoint | |
|
General information
Stuff that cabal-install really should export
:: (FilePath -> [String] -> String -> IO String) | |
-> FilePath | Cabal build platform, i.e. |
-> Version | GHC version ( |
-> IO (Maybe FilePath) |
Get the path to the sandbox package-db in a project
Managing dist/
prepare :: MonadIO m => (FilePath -> [String] -> String -> IO String) -> FilePath -> FilePath -> m () Source #
Deprecated: Will be replaced by prepare' in the next major release
prepare' :: MonadIO m => QueryEnv -> m () Source #
Make sure the appropriate helper executable for the given project is installed and ready to run queries.
:: MonadIO m | |
=> (FilePath -> [String] -> String -> IO String) | |
-> Programs | Program paths |
-> [String] | Command line arguments to be passed to |
-> m () |
Run cabal configure
:: MonadIO m | |
=> (FilePath -> [String] -> String -> IO String) | |
-> FilePath | Path to project directory, i.e. the one containing the
|
-> FilePath | Path to the |
-> m () |
Deprecated: Will be replaced by writeAutogenFiles' in the next major release
writeAutogenFiles' :: MonadIO m => QueryEnv -> m () Source #
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
.