Safe Haskell | None |
---|---|
Language | Haskell98 |
Utility functions for reading cabal file fields through template haskell.
Synopsis
- packageVariable :: Text a => (PackageDescription -> a) -> Q Exp
- packageVariableFrom :: Text a => FilePath -> (PackageDescription -> a) -> Q Exp
- packageString :: String -> DocString
- data PackageDescription = PackageDescription {
- specVersionRaw :: Either Version VersionRange
- package :: PackageIdentifier
- licenseRaw :: Either License License
- licenseFiles :: [FilePath]
- copyright :: String
- maintainer :: String
- author :: String
- stability :: String
- testedWith :: [(CompilerFlavor, VersionRange)]
- homepage :: String
- pkgUrl :: String
- bugReports :: String
- sourceRepos :: [SourceRepo]
- synopsis :: String
- description :: String
- category :: String
- customFieldsPD :: [(String, String)]
- buildTypeRaw :: Maybe BuildType
- setupBuildInfo :: Maybe SetupBuildInfo
- library :: Maybe Library
- subLibraries :: [Library]
- executables :: [Executable]
- foreignLibs :: [ForeignLib]
- testSuites :: [TestSuite]
- benchmarks :: [Benchmark]
- dataFiles :: [FilePath]
- dataDir :: FilePath
- extraSrcFiles :: [FilePath]
- extraTmpFiles :: [FilePath]
- extraDocFiles :: [FilePath]
- data PackageIdentifier = PackageIdentifier {}
- data Version
Template Haskell functions
packageVariable :: Text a => (PackageDescription -> a) -> Q Exp Source #
Renders the package variable specified by the function. The cabal file interrogated is the first one that is found in the current working directory.
packageVariableFrom :: Text a => FilePath -> (PackageDescription -> a) -> Q Exp Source #
Renders the package variable specified by the function, from a cabal file and the given path.
packageString :: String -> DocString Source #
Provides a Text instance for String, allowing text fields to be used
in packageVariable
. Use it composed with an accessor, eg.
packageVariable (packageString . copyright)
Cabal file data structures
The data structures for the cabal file are re-exported here for ease of use.
data PackageDescription #
This data type is the internal representation of the file pkg.cabal
.
It contains two kinds of information about the package: information
which is needed for all packages, such as the package name and version, and
information which is needed for the simple build system only, such as
the compiler options and library name.
PackageDescription | |
|
Instances
data PackageIdentifier #
The name and version of a package.
PackageIdentifier | |
|
Instances
A Version
represents the version of a software entity.
Instances of Eq
and Ord
are provided, which gives exact
equality and lexicographic ordering of the version number
components (i.e. 2.1 > 2.0, 1.2.3 > 1.2.2, etc.).
This type is opaque and distinct from the Version
type in
Data.Version since Cabal-2.0
. The difference extends to the
Binary
instance using a different (and more compact) encoding.
Since: Cabal-2.0.0.2