-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A command line program for extracting compiler arguments from a cabal file.
--
-- For further details please consult the README.
@package cabal-cargs
@version 0.5
module CabalCargs.CondVars
-- | The conditional variables that are used to resolve the conditionals
-- inside of the cabal file. Holds the enable state of the cabal flags
-- and the used OS and ARCH.
data CondVars
CondVars :: FlagMap -> OS -> Arch -> CondVars
-- | initialized with the default flag values which are accordingly
-- modified by the explicitely given flag values by the user
flags :: CondVars -> FlagMap
-- | the used OS, by default the one cabal was build on or given
-- explicitely by the user
os :: CondVars -> OS
-- | the used ARCH, by default the one cabal was build on or given
-- explicitely by the user
arch :: CondVars -> Arch
-- | Create a CondVars from the default flags of the cabal package
-- description. The os and arch fields are initialized by
-- the ones the cabal library was build on.
fromDefaults :: GenericPackageDescription -> CondVars
-- | Enable the given flag in CondVars.
enableFlag :: FlagName -> CondVars -> CondVars
-- | Disable the given flag in CondVars.
disableFlag :: FlagName -> CondVars -> CondVars
-- | Evaluate the Condition using the CondVars.
eval :: CondVars -> (Condition ConfVar) -> Bool
instance Show CondVars
module CabalCargs.Sections
-- | From which sections the compiler args should be collected.
data Sections
-- | all sections are considered
AllSections :: Sections
-- | only these sections are considered
Sections :: [Section] -> Sections
-- | A section of the cabal file.
data Section
Library :: Section
Executable :: String -> Section
TestSuite :: String -> Section
Benchmark :: String -> Section
instance Show Section
instance Eq Section
instance Show Sections
instance Eq Sections
module CabalCargs.Formatting
-- | How the fields from the cabal file should be printed out.
data Formatting
-- | as ghc compatible arguments
Ghc :: Formatting
-- | as hdevtools compatible arguments
Hdevtools :: Formatting
-- | the field values are printed as present in the cabal file
Pure :: Formatting
instance Typeable Formatting
instance Data Formatting
instance Show Formatting
instance Eq Formatting
instance Default Formatting
module CabalCargs.Fields
-- | A compiler relevant field. Till Package_Db all fields are from
-- the cabal file with the same name, just with lower case letters and
-- the _ replaced by a -.
data Field
Hs_Source_Dirs :: Field
Ghc_Options :: Field
Default_Extensions :: Field
Default_Language :: Field
Cpp_Options :: Field
C_Sources :: Field
Cc_Options :: Field
Extra_Lib_Dirs :: Field
Extra_Libraries :: Field
Ld_Options :: Field
Include_Dirs :: Field
Includes :: Field
Build_Depends :: Field
-- | the package database of a cabal sandbox
Package_Db :: Field
-- | dirs of automatically generated haskell source files by cabal (e.g.
-- Paths_*)
Autogen_Hs_Source_Dirs :: Field
-- | dirs of automatically generated include files by cabal
Autogen_Include_Dirs :: Field
-- | automatically generated include files by cabal (e.g. cabal_macros.h)
Autogen_Includes :: Field
-- | the socket file for hdevtools
Hdevtools_Socket :: Field
-- | Get all known fields.
allFields :: [Field]
-- | Which fields should be collected
type Fields = [Field]
instance Typeable Field
instance Data Field
instance Show Field
instance Eq Field
instance Enum Field
instance Bounded Field
module CabalCargs.BuildInfo
data BuildInfo
BuildInfo :: BuildInfo -> [Dependency] -> BuildInfo
buildInfo :: BuildInfo -> BuildInfo
buildDepends :: BuildInfo -> [Dependency]
buildInfosOfLib :: CondVars -> GenericPackageDescription -> [BuildInfo]
buildInfosOfExe :: String -> CondVars -> GenericPackageDescription -> [BuildInfo]
buildInfosOfTest :: String -> CondVars -> GenericPackageDescription -> [BuildInfo]
buildInfosOfBenchmark :: String -> CondVars -> GenericPackageDescription -> [BuildInfo]
buildInfosOf :: Section -> CondVars -> GenericPackageDescription -> [BuildInfo]
buildInfos :: CondVars -> GenericPackageDescription -> [BuildInfo]
-- | A lens from a BuildInfo to a list of stringified field entries
-- of the BuildInfo.
field :: Field -> Traversal' BuildInfo [String]
instance Show BuildInfo
instance Eq BuildInfo
module CabalCargs.Args
-- | The command line arguments of the cabal-cargs command.
data Args
Args :: Bool -> [String] -> [String] -> [String] -> Bool -> [Field] -> [Field] -> Formatting -> Maybe FilePath -> Maybe FilePath -> [String] -> [String] -> Maybe String -> Maybe String -> Bool -> Args
library :: Args -> Bool
executable :: Args -> [String]
testSuite :: Args -> [String]
benchmark :: Args -> [String]
allSections :: Args -> Bool
only :: Args -> [Field]
ignore :: Args -> [Field]
format :: Args -> Formatting
sourceFile :: Args -> Maybe FilePath
cabalFile :: Args -> Maybe FilePath
enable :: Args -> [String]
disable :: Args -> [String]
os :: Args -> Maybe String
arch :: Args -> Maybe String
relative :: Args -> Bool
get :: IO Args
instance Typeable Args
instance Data Args
instance Show Args
instance Eq Args
module CabalCargs.Spec
-- | Specifies which compiler args from which sections should be collected.
data Spec
Spec :: Sections -> Fields -> CondVars -> GenericPackageDescription -> FilePath -> Maybe FilePath -> Maybe FilePath -> Bool -> Spec
-- | the sections used for collecting the compiler args
sections :: Spec -> Sections
-- | for these fields compiler args are collected
fields :: Spec -> Fields
-- | used for the evaluation of the conditional fields in the cabal file
condVars :: Spec -> CondVars
-- | the package description of the read in cabal file
cabalPackage :: Spec -> GenericPackageDescription
-- | the cabal file read from
cabalFile :: Spec -> FilePath
-- | the dist directory of the cabal build, a relative path to the
-- directory of the cabal file
distDir :: Spec -> Maybe FilePath
-- | the directory of package database of the cabal sandbox, a relative
-- path to the directory of the cabal file
packageDB :: Spec -> Maybe FilePath
-- | if all returned paths are relative to the directory of the cabal file,
-- otherwise all paths are absolute
relativePaths :: Spec -> Bool
-- | Create a Spec by the command line arguments given to
-- 'cabal-cargs'.
--
-- Depending on the command line arguments fromCmdArgs might
-- behave like fromCabalFile, if only a cabal file was given, like
-- fromSourceFile, if only a source file was given or like a mix
-- of both, if a cabal file and a source file have been given.
fromCmdArgs :: Args -> IO (Either Error Spec)
module CabalCargs.CompilerArgs
-- | The collected compiler args from the cabal file. Till the field
-- packageDB all fields represent the equaliy named fields
-- (- replaced by CamelCase) from the cabal file.
data CompilerArgs
CompilerArgs :: [FilePath] -> [String] -> [String] -> [String] -> [String] -> [FilePath] -> [String] -> [FilePath] -> [String] -> [String] -> [FilePath] -> [String] -> [String] -> Maybe FilePath -> [FilePath] -> [FilePath] -> [String] -> Maybe FilePath -> CompilerArgs
hsSourceDirs :: CompilerArgs -> [FilePath]
ghcOptions :: CompilerArgs -> [String]
defaultExtensions :: CompilerArgs -> [String]
defaultLanguage :: CompilerArgs -> [String]
cppOptions :: CompilerArgs -> [String]
cSources :: CompilerArgs -> [FilePath]
ccOptions :: CompilerArgs -> [String]
extraLibDirs :: CompilerArgs -> [FilePath]
extraLibraries :: CompilerArgs -> [String]
ldOptions :: CompilerArgs -> [String]
includeDirs :: CompilerArgs -> [FilePath]
includes :: CompilerArgs -> [String]
buildDepends :: CompilerArgs -> [String]
-- | the path to the package database of the cabal sandbox
packageDB :: CompilerArgs -> Maybe FilePath
-- | dirs of automatically generated haskell source files by cabal (e.g.
-- Paths_*)
autogenHsSourceDirs :: CompilerArgs -> [FilePath]
-- | dirs of automatically generated include files by cabal
autogenIncludeDirs :: CompilerArgs -> [FilePath]
-- | automatically generated include files by cabal (e.g. cabal_macros.h)
autogenIncludes :: CompilerArgs -> [String]
-- | the path to the hdevtools socket file
hdevtoolsSocket :: CompilerArgs -> Maybe FilePath
-- | Create a CompilerArgs by the command line arguments given to
-- 'cabal-cargs'.
fromCmdArgs :: Args -> IO (Either Error CompilerArgs)
-- | Create a CompilerArgs and collect the compiler args specified
-- by Spec.
fromSpec :: Spec -> CompilerArgs
instance Show CompilerArgs
instance Eq CompilerArgs
module CabalCargs.Format
format :: Formatting -> CompilerArgs -> [String]