Cabal-1.22.5.0: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2005
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Distribution.PackageDescription

Contents

- Package descriptions
  - Renaming
  - Libraries
  - Executables
- Tests
- Benchmarks
- Build information
  - Supplementary build information
- package configuration
- Source repositories

Description

This defines the data structure for the `.cabal` file format. There are several parts to this structure. It has top level info and then `Library`, `Executable`, `TestSuite`, and `Benchmark` sections each of which have associated `BuildInfo` data that's used to build the library, exe, test, or benchmark. To further complicate things there is both a `PackageDescription` and a `GenericPackageDescription`. This distinction relates to cabal configurations. When we initially read a `.cabal` file we get a `GenericPackageDescription` which has all the conditional sections. Before actually building a package we have to decide on each conditional. Once we've done that we get a `PackageDescription`. It was done this way initially to avoid breaking too much stuff when the feature was introduced. It could probably do with being rationalised at some point to make it simpler.

Synopsis

- data PackageDescription = PackageDescription {
  - package :: PackageIdentifier
  - 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)]
  - buildDepends :: [Dependency]
  - specVersionRaw :: Either Version VersionRange
  - buildType :: Maybe BuildType
  - library :: Maybe Library
  - executables :: [Executable]
  - testSuites :: [TestSuite]
  - benchmarks :: [Benchmark]
  - dataFiles :: [FilePath]
  - dataDir :: FilePath
  - extraSrcFiles :: [FilePath]
  - extraTmpFiles :: [FilePath]
  - extraDocFiles :: [FilePath]
  }
- emptyPackageDescription :: PackageDescription
- specVersion :: PackageDescription -> Version
- descCabalVersion :: PackageDescription -> VersionRange
- data BuildType
  - = Simple
  - | Configure
  - | Make
  - | Custom
  - | UnknownBuildType String
- knownBuildTypes :: [BuildType]
- data ModuleRenaming = ModuleRenaming Bool [(ModuleName, ModuleName)]
- defaultRenaming :: ModuleRenaming
- lookupRenaming :: Package pkg => pkg -> Map PackageName ModuleRenaming -> ModuleRenaming
- data Library = Library {
  - exposedModules :: [ModuleName]
  - reexportedModules :: [ModuleReexport]
  - requiredSignatures :: [ModuleName]
  - exposedSignatures :: [ModuleName]
  - libExposed :: Bool
  - libBuildInfo :: BuildInfo
  }
- data ModuleReexport = ModuleReexport {
  - moduleReexportOriginalPackage :: Maybe PackageName
  - moduleReexportOriginalName :: ModuleName
  - moduleReexportName :: ModuleName
  }
- emptyLibrary :: Library
- withLib :: PackageDescription -> (Library -> IO ()) -> IO ()
- hasLibs :: PackageDescription -> Bool
- libModules :: Library -> [ModuleName]
- data Executable = Executable {
  - exeName :: String
  - modulePath :: FilePath
  - buildInfo :: BuildInfo
  }
- emptyExecutable :: Executable
- withExe :: PackageDescription -> (Executable -> IO ()) -> IO ()
- hasExes :: PackageDescription -> Bool
- exeModules :: Executable -> [ModuleName]
- data TestSuite = TestSuite {
  - testName :: String
  - testInterface :: TestSuiteInterface
  - testBuildInfo :: BuildInfo
  - testEnabled :: Bool
  }
- data TestSuiteInterface
  - = TestSuiteExeV10 Version FilePath
  - | TestSuiteLibV09 Version ModuleName
  - | TestSuiteUnsupported TestType
- data TestType
  - = TestTypeExe Version
  - | TestTypeLib Version
  - | TestTypeUnknown String Version
- testType :: TestSuite -> TestType
- knownTestTypes :: [TestType]
- emptyTestSuite :: TestSuite
- hasTests :: PackageDescription -> Bool
- withTest :: PackageDescription -> (TestSuite -> IO ()) -> IO ()
- testModules :: TestSuite -> [ModuleName]
- enabledTests :: PackageDescription -> [TestSuite]
- data Benchmark = Benchmark {
  - benchmarkName :: String
  - benchmarkInterface :: BenchmarkInterface
  - benchmarkBuildInfo :: BuildInfo
  - benchmarkEnabled :: Bool
  }
- data BenchmarkInterface
  - = BenchmarkExeV10 Version FilePath
  - | BenchmarkUnsupported BenchmarkType
- data BenchmarkType
  - = BenchmarkTypeExe Version
  - | BenchmarkTypeUnknown String Version
- benchmarkType :: Benchmark -> BenchmarkType
- knownBenchmarkTypes :: [BenchmarkType]
- emptyBenchmark :: Benchmark
- hasBenchmarks :: PackageDescription -> Bool
- withBenchmark :: PackageDescription -> (Benchmark -> IO ()) -> IO ()
- benchmarkModules :: Benchmark -> [ModuleName]
- enabledBenchmarks :: PackageDescription -> [Benchmark]
- data BuildInfo = BuildInfo {
  - buildable :: Bool
  - buildTools :: [Dependency]
  - cppOptions :: [String]
  - ccOptions :: [String]
  - ldOptions :: [String]
  - pkgconfigDepends :: [Dependency]
  - frameworks :: [String]
  - cSources :: [FilePath]
  - jsSources :: [FilePath]
  - hsSourceDirs :: [FilePath]
  - otherModules :: [ModuleName]
  - defaultLanguage :: Maybe Language
  - otherLanguages :: [Language]
  - defaultExtensions :: [Extension]
  - otherExtensions :: [Extension]
  - oldExtensions :: [Extension]
  - extraLibs :: [String]
  - extraGHCiLibs :: [String]
  - extraLibDirs :: [String]
  - includeDirs :: [FilePath]
  - includes :: [FilePath]
  - installIncludes :: [FilePath]
  - options :: [(CompilerFlavor, [String])]
  - profOptions :: [(CompilerFlavor, [String])]
  - sharedOptions :: [(CompilerFlavor, [String])]
  - customFieldsBI :: [(String, String)]
  - targetBuildDepends :: [Dependency]
  - targetBuildRenaming :: Map PackageName ModuleRenaming
  }
- emptyBuildInfo :: BuildInfo
- allBuildInfo :: PackageDescription -> [BuildInfo]
- allLanguages :: BuildInfo -> [Language]
- allExtensions :: BuildInfo -> [Extension]
- usedExtensions :: BuildInfo -> [Extension]
- hcOptions :: CompilerFlavor -> BuildInfo -> [String]
- hcProfOptions :: CompilerFlavor -> BuildInfo -> [String]
- hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String]
- type HookedBuildInfo = (Maybe BuildInfo, [(String, BuildInfo)])
- emptyHookedBuildInfo :: HookedBuildInfo
- updatePackageDescription :: HookedBuildInfo -> PackageDescription -> PackageDescription
- data GenericPackageDescription = GenericPackageDescription {
  - packageDescription :: PackageDescription
  - genPackageFlags :: [Flag]
  - condLibrary :: Maybe (CondTree ConfVar [Dependency] Library)
  - condExecutables :: [(String, CondTree ConfVar [Dependency] Executable)]
  - condTestSuites :: [(String, CondTree ConfVar [Dependency] TestSuite)]
  - condBenchmarks :: [(String, CondTree ConfVar [Dependency] Benchmark)]
  }
- data Flag = MkFlag {
  - flagName :: FlagName
  - flagDescription :: String
  - flagDefault :: Bool
  - flagManual :: Bool
  }
- newtype FlagName = FlagName String
- type FlagAssignment = [(FlagName, Bool)]
- data CondTree v c a = CondNode {
  - condTreeData :: a
  - condTreeConstraints :: c
  - condTreeComponents :: [(Condition v, CondTree v c a, Maybe (CondTree v c a))]
  }
- data ConfVar
  - = OS OS
  - | Arch Arch
  - | Flag FlagName
  - | Impl CompilerFlavor VersionRange
- data Condition c
  - = Var c
  - | Lit Bool
  - | CNot (Condition c)
  - | COr (Condition c) (Condition c)
  - | CAnd (Condition c) (Condition c)
- data SourceRepo = SourceRepo {
  - repoKind :: RepoKind
  - repoType :: Maybe RepoType
  - repoLocation :: Maybe String
  - repoModule :: Maybe String
  - repoBranch :: Maybe String
  - repoTag :: Maybe String
  - repoSubdir :: Maybe FilePath
  }
- data RepoKind
  - = RepoHead
  - | RepoThis
  - | RepoKindUnknown String
- data RepoType
  - = Darcs
  - | Git
  - | SVN
  - | CVS
  - | Mercurial
  - | GnuArch
  - | Bazaar
  - | Monotone
  - | OtherRepoType String
- knownRepoTypes :: [RepoType]

# Package descriptions

data PackageDescription Source

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.

Constructors

PackageDescription |

Fields

package :: PackageIdentifier
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

  A one-line summary of this package

description :: String

  A more verbose description of this package

category :: String
customFieldsPD :: [(String, String)]

  Custom fields starting with x-, stored in a simple assoc-list. | YOU PROBABLY DON'T WANT TO USE THIS FIELD. This field is special! Depending on how far along processing the PackageDescription we are, the contents of this field are either nonsense, or the collected dependencies of *all* the components in this package. buildDepends is initialized by `finalizePackageDescription` and `flattenPackageDescription`; prior to that, dependency info is stored in the `CondTree` built around a `GenericPackageDescription`. When this resolution is done, dependency info is written to the inner `BuildInfo` and this field. This is all horrible, and #2066 tracks progress to get rid of this field.

buildDepends :: [Dependency]
specVersionRaw :: Either Version VersionRange

  The version of the Cabal spec that this package description uses. For historical reasons this is specified with a version range but only ranges of the form `>= v` make sense. We are in the process of transitioning to specifying just a single version, not a range.

buildType :: Maybe BuildType
library :: Maybe Library
executables :: [Executable]
testSuites :: [TestSuite]
benchmarks :: [Benchmark]
dataFiles :: [FilePath]
dataDir :: FilePath
extraSrcFiles :: [FilePath]
extraTmpFiles :: [FilePath]
extraDocFiles :: [FilePath]

Instances

Eq PackageDescription Source |
Data PackageDescription Source |
Read PackageDescription Source |
Show PackageDescription Source |
Generic PackageDescription Source |
Binary PackageDescription Source |
Package PackageDescription Source |
type Rep PackageDescription Source |

emptyPackageDescription :: PackageDescription Source

specVersion :: PackageDescription -> Version Source

The version of the Cabal spec that this package should be interpreted against.

Historically we used a version range but we are switching to using a single version. Currently we accept either. This function converts into a single version by ignoring upper bounds in the version range.

descCabalVersion :: PackageDescription -> VersionRange Source

Deprecated: Use specVersion instead

The range of versions of the Cabal tools that this package is intended to work with.

This function is deprecated and should not be used for new purposes, only to support old packages that rely on the old interpretation.

data BuildType Source

The type of build system used by this package.

Constructors

Simple | calls `Distribution.Simple.defaultMain`
Configure | calls `Distribution.Simple.defaultMainWithHooks defaultUserHooks`, which invokes `configure` to generate additional build information used by later phases.
Make | calls `Distribution.Make.defaultMain`
Custom | uses user-supplied `Setup.hs` or `Setup.lhs` (default)
UnknownBuildType String | a package that uses an unknown build type cannot actually be built. Doing it this way rather than just giving a parse error means we get better error messages and allows you to inspect the rest of the package description.

Instances

Eq BuildType Source |
Data BuildType Source |
Read BuildType Source |
Show BuildType Source |
Generic BuildType Source |
Binary BuildType Source |
Text BuildType Source |
type Rep BuildType Source |

knownBuildTypes :: [BuildType] Source

## Renaming

data ModuleRenaming Source

Renaming applied to the modules provided by a package. The boolean indicates whether or not to also include all of the original names of modules. Thus, `ModuleRenaming False []` is "don't expose any modules, and `ModuleRenaming True [(Data.Bool, Bool)]` is, "expose all modules, but also expose `Data.Bool` as `Bool`".

Constructors

ModuleRenaming Bool [(ModuleName, ModuleName)] |

Instances

Eq ModuleRenaming Source |
Data ModuleRenaming Source |
Ord ModuleRenaming Source |
Read ModuleRenaming Source |
Show ModuleRenaming Source |
Generic ModuleRenaming Source |
Monoid ModuleRenaming Source |
Binary ModuleRenaming Source |
Text ModuleRenaming Source |
type Rep ModuleRenaming Source |

defaultRenaming :: ModuleRenaming Source

lookupRenaming :: Package pkg => pkg -> Map PackageName ModuleRenaming -> ModuleRenaming Source

## Libraries

data Library Source

Constructors

Library |

Fields

exposedModules :: [ModuleName]
reexportedModules :: [ModuleReexport]
requiredSignatures :: [ModuleName]

  What sigs need implementations?

exposedSignatures :: [ModuleName]

  What sigs are visible to users?

libExposed :: Bool

  Is the lib to be exposed by default?

libBuildInfo :: BuildInfo

Instances

Eq Library Source |
Data Library Source |
Read Library Source |
Show Library Source |
Generic Library Source |
Monoid Library Source |
Binary Library Source |
type Rep Library Source |

data ModuleReexport Source

Constructors

ModuleReexport |

Fields

moduleReexportOriginalPackage :: Maybe PackageName
moduleReexportOriginalName :: ModuleName
moduleReexportName :: ModuleName

Instances

Eq ModuleReexport Source |
Data ModuleReexport Source |
Read ModuleReexport Source |
Show ModuleReexport Source |
Generic ModuleReexport Source |
Binary ModuleReexport Source |
Text ModuleReexport Source |
type Rep ModuleReexport Source |

emptyLibrary :: Library Source

withLib :: PackageDescription -> (Library -> IO ()) -> IO () Source

If the package description has a library section, call the given function with the library build info as argument.

hasLibs :: PackageDescription -> Bool Source

does this package have any libraries?

libModules :: Library -> [ModuleName] Source

Get all the module names from the library (exposed and internal modules) which need to be compiled. (This does not include reexports, which do not need to be compiled.)

## Executables

data Executable Source

Constructors

Executable |

Fields

exeName :: String
modulePath :: FilePath
buildInfo :: BuildInfo

Instances

Eq Executable Source |
Data Executable Source |
Read Executable Source |
Show Executable Source |
Generic Executable Source |
Monoid Executable Source |
Binary Executable Source |
type Rep Executable Source |

emptyExecutable :: Executable Source

withExe :: PackageDescription -> (Executable -> IO ()) -> IO () Source

Perform the action on each buildable `Executable` in the package description.

hasExes :: PackageDescription -> Bool Source

does this package have any executables?

exeModules :: Executable -> [ModuleName] Source

Get all the module names from an exe

# Tests

data TestSuite Source

A "test-suite" stanza in a cabal file.

Constructors

TestSuite |

Fields

testName :: String
testInterface :: TestSuiteInterface
testBuildInfo :: BuildInfo
testEnabled :: Bool

Instances

Eq TestSuite Source |
Data TestSuite Source |
Read TestSuite Source |
Show TestSuite Source |
Generic TestSuite Source |
Monoid TestSuite Source |
Binary TestSuite Source |
type Rep TestSuite Source |

data TestSuiteInterface Source

The test suite interfaces that are currently defined. Each test suite must specify which interface it supports.

More interfaces may be defined in future, either new revisions or totally new interfaces.

Constructors

TestSuiteExeV10 Version FilePath | Test interface "exitcode-stdio-1.0". The test-suite takes the form of an executable. It returns a zero exit code for success, non-zero for failure. The stdout and stderr channels may be logged. It takes no command line parameters and nothing on stdin.
TestSuiteLibV09 Version ModuleName | Test interface "detailed-0.9". The test-suite takes the form of a library containing a designated module that exports "tests :: [Test]".
TestSuiteUnsupported TestType | A test suite that does not conform to one of the above interfaces for the given reason (e.g. unknown test type).

Instances

Eq TestSuiteInterface Source |
Data TestSuiteInterface Source |
Read TestSuiteInterface Source |
Show TestSuiteInterface Source |
Generic TestSuiteInterface Source |
Monoid TestSuiteInterface Source |
Binary TestSuiteInterface Source |
type Rep TestSuiteInterface Source |

data TestType Source

The "test-type" field in the test suite stanza.

Constructors

TestTypeExe Version | "type: exitcode-stdio-x.y"
TestTypeLib Version | "type: detailed-x.y"
TestTypeUnknown String Version | Some unknown test type e.g. "type: foo"

Instances

Eq TestType Source |
Data TestType Source |
Read TestType Source |
Show TestType Source |
Generic TestType Source |
Binary TestType Source |
Text TestType Source |
type Rep TestType Source |

testType :: TestSuite -> TestType Source

knownTestTypes :: [TestType] Source

emptyTestSuite :: TestSuite Source

hasTests :: PackageDescription -> Bool Source

Does this package have any test suites?

withTest :: PackageDescription -> (TestSuite -> IO ()) -> IO () Source

Perform an action on each buildable `TestSuite` in a package.

testModules :: TestSuite -> [ModuleName] Source

Get all the module names from a test suite.

enabledTests :: PackageDescription -> [TestSuite] Source

Get all the enabled test suites from a package.

# Benchmarks

data Benchmark Source

A "benchmark" stanza in a cabal file.

Constructors

Benchmark |

Fields

benchmarkName :: String
benchmarkInterface :: BenchmarkInterface
benchmarkBuildInfo :: BuildInfo
benchmarkEnabled :: Bool

Instances

Eq Benchmark Source |
Data Benchmark Source |
Read Benchmark Source |
Show Benchmark Source |
Generic Benchmark Source |
Monoid Benchmark Source |
Binary Benchmark Source |
type Rep Benchmark Source |

data BenchmarkInterface Source

The benchmark interfaces that are currently defined. Each benchmark must specify which interface it supports.

More interfaces may be defined in future, either new revisions or totally new interfaces.

Constructors

BenchmarkExeV10 Version FilePath | Benchmark interface "exitcode-stdio-1.0". The benchmark takes the form of an executable. It returns a zero exit code for success, non-zero for failure. The stdout and stderr channels may be logged. It takes no command line parameters and nothing on stdin.
BenchmarkUnsupported BenchmarkType | A benchmark that does not conform to one of the above interfaces for the given reason (e.g. unknown benchmark type).

Instances

Eq BenchmarkInterface Source |
Data BenchmarkInterface Source |
Read BenchmarkInterface Source |
Show BenchmarkInterface Source |
Generic BenchmarkInterface Source |
Monoid BenchmarkInterface Source |
Binary BenchmarkInterface Source |
type Rep BenchmarkInterface Source |

data BenchmarkType Source

The "benchmark-type" field in the benchmark stanza.

Constructors

BenchmarkTypeExe Version | "type: exitcode-stdio-x.y"
BenchmarkTypeUnknown String Version | Some unknown benchmark type e.g. "type: foo"

Instances

Eq BenchmarkType Source |
Data BenchmarkType Source |
Read BenchmarkType Source |
Show BenchmarkType Source |
Generic BenchmarkType Source |
Binary BenchmarkType Source |
Text BenchmarkType Source |
type Rep BenchmarkType Source |

benchmarkType :: Benchmark -> BenchmarkType Source

knownBenchmarkTypes :: [BenchmarkType] Source

emptyBenchmark :: Benchmark Source

hasBenchmarks :: PackageDescription -> Bool Source

Does this package have any benchmarks?

withBenchmark :: PackageDescription -> (Benchmark -> IO ()) -> IO () Source

Perform an action on each buildable `Benchmark` in a package.

benchmarkModules :: Benchmark -> [ModuleName] Source

Get all the module names from a benchmark.

enabledBenchmarks :: PackageDescription -> [Benchmark] Source

Get all the enabled benchmarks from a package.

# Build information

data BuildInfo Source

Constructors

BuildInfo |

Fields

buildable :: Bool

  component is buildable here

buildTools :: [Dependency]

  tools needed to build this bit

cppOptions :: [String]

  options for pre-processing Haskell code

ccOptions :: [String]

  options for C compiler

ldOptions :: [String]

  options for linker

pkgconfigDepends :: [Dependency]

  pkg-config packages that are used

frameworks :: [String]

  support frameworks for Mac OS X

cSources :: [FilePath]
jsSources :: [FilePath]
hsSourceDirs :: [FilePath]

  where to look for the Haskell module hierarchy

otherModules :: [ModuleName]

  non-exposed or non-main modules

defaultLanguage :: Maybe Language

  language used when not explicitly specified

otherLanguages :: [Language]

  other languages used within the package

defaultExtensions :: [Extension]

  language extensions used by all modules

otherExtensions :: [Extension]

  other language extensions used within the package

oldExtensions :: [Extension]

  the old extensions field, treated same as `defaultExtensions`

extraLibs :: [String]

  what libraries to link with when compiling a program that uses your package

extraGHCiLibs :: [String]

  if present, overrides extraLibs when package is loaded with GHCi.

extraLibDirs :: [String]
includeDirs :: [FilePath]

  directories to find .h files

includes :: [FilePath]

  The .h files to be found in includeDirs

installIncludes :: [FilePath]

  .h files to install with the package

options :: [(CompilerFlavor, [String])]
profOptions :: [(CompilerFlavor, [String])]
sharedOptions :: [(CompilerFlavor, [String])]
customFieldsBI :: [(String, String)]

  Custom fields starting with x-, stored in a simple assoc-list.

targetBuildDepends :: [Dependency]

  Dependencies specific to a library or executable target

targetBuildRenaming :: Map PackageName ModuleRenaming

Instances

Eq BuildInfo Source |
Data BuildInfo Source |
Read BuildInfo Source |
Show BuildInfo Source |
Generic BuildInfo Source |
Monoid BuildInfo Source |
Binary BuildInfo Source |
type Rep BuildInfo Source |

emptyBuildInfo :: BuildInfo Source

allBuildInfo :: PackageDescription -> [BuildInfo] Source

The `BuildInfo` for the library (if there is one and it's buildable), and all buildable executables, test suites and benchmarks. Useful for gathering dependencies.

allLanguages :: BuildInfo -> [Language] Source

The `Language`s used by this component

allExtensions :: BuildInfo -> [Extension] Source

The `Extension`s that are used somewhere by this component

usedExtensions :: BuildInfo -> [Extension] Source

The `Extensions` that are used by all modules in this component

hcOptions :: CompilerFlavor -> BuildInfo -> [String] Source

Select options for a particular Haskell compiler.

hcProfOptions :: CompilerFlavor -> BuildInfo -> [String] Source

hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String] Source

## Supplementary build information

type HookedBuildInfo = (Maybe BuildInfo, [(String, BuildInfo)]) Source

emptyHookedBuildInfo :: HookedBuildInfo Source

updatePackageDescription :: HookedBuildInfo -> PackageDescription -> PackageDescription Source

# package configuration

data GenericPackageDescription Source

Constructors

GenericPackageDescription |

Fields

packageDescription :: PackageDescription
genPackageFlags :: [Flag]
condLibrary :: Maybe (CondTree ConfVar [Dependency] Library)
condExecutables :: [(String, CondTree ConfVar [Dependency] Executable)]
condTestSuites :: [(String, CondTree ConfVar [Dependency] TestSuite)]
condBenchmarks :: [(String, CondTree ConfVar [Dependency] Benchmark)]

Instances

Eq GenericPackageDescription Source |
Data GenericPackageDescription Source |
Show GenericPackageDescription Source |
Package GenericPackageDescription Source |

data Flag Source

A flag can represent a feature to be included, or a way of linking a target against its dependencies, or in fact whatever you can think of.

Constructors

MkFlag |

Fields

flagName :: FlagName
flagDescription :: String
flagDefault :: Bool
flagManual :: Bool

Instances

Eq Flag Source |
Data Flag Source |
Show Flag Source |

newtype FlagName Source

A `FlagName` is the name of a user-defined configuration flag

Constructors

FlagName String |

Instances

Eq FlagName Source |
Data FlagName Source |
Ord FlagName Source |
Read FlagName Source |
Show FlagName Source |
Generic FlagName Source |
Binary FlagName Source |
type Rep FlagName Source |

type FlagAssignment = [(FlagName, Bool)] Source

A `FlagAssignment` is a total or partial mapping of `FlagName`s to `Bool` flag values. It represents the flags chosen by the user or discovered during configuration. For example `--flags=foo --flags=-bar` becomes `[("foo", True), ("bar", False)]`

data CondTree v c a Source

Constructors

CondNode |

Fields

condTreeData :: a
condTreeConstraints :: c
condTreeComponents :: [(Condition v, CondTree v c a, Maybe (CondTree v c a))]

Instances

(Eq v, Eq c, Eq a) => Eq (CondTree v c a) Source |
(Data v, Data c, Data a) => Data (CondTree v c a) Source |
(Show v, Show c, Show a) => Show (CondTree v c a) Source |

data ConfVar Source

A `ConfVar` represents the variable type used.

Constructors

OS OS |
Arch Arch |
Flag FlagName |
Impl CompilerFlavor VersionRange |

Instances

Eq ConfVar Source |
Data ConfVar Source |
Show ConfVar Source |

data Condition c Source

A boolean expression parameterized over the variable type used.

Constructors

Var c |
Lit Bool |
CNot (Condition c) |
COr (Condition c) (Condition c) |
CAnd (Condition c) (Condition c) |

Instances

Eq c => Eq (Condition c) Source |
Data c => Data (Condition c) Source |
Show c => Show (Condition c) Source |

# Source repositories

data SourceRepo Source

Information about the source revision control system for a package.

When specifying a repo it is useful to know the meaning or intention of the information as doing so enables automation. There are two obvious common purposes: one is to find the repo for the latest development version, the other is to find the repo for this specific release. The `ReopKind` specifies which one we mean (or another custom one).

A package can specify one or the other kind or both. Most will specify just a head repo but some may want to specify a repo to reconstruct the sources for this package release.

The required information is the `RepoType` which tells us if it's using `Darcs`, `Git` for example. The `repoLocation` and other details are interpreted according to the repo type.

Constructors

SourceRepo |

Fields

repoKind :: RepoKind

  The kind of repo. This field is required.

repoType :: Maybe RepoType

  The type of the source repository system for this repo, eg `Darcs` or `Git`. This field is required.

repoLocation :: Maybe String

  The location of the repository. For most `RepoType`s this is a URL. This field is required.

repoModule :: Maybe String

  `CVS` can put multiple "modules" on one server and requires a module name in addition to the location to identify a particular repo. Logically this is part of the location but unfortunately has to be specified separately. This field is required for the `CVS` `RepoType` and should not be given otherwise.

repoBranch :: Maybe String

  The name or identifier of the branch, if any. Many source control systems have the notion of multiple branches in a repo that exist in the same location. For example `Git` and `CVS` use this while systems like `Darcs` use different locations for different branches. This field is optional but should be used if necessary to identify the sources, especially for the `RepoThis` repo kind.

repoTag :: Maybe String

  The tag identify a particular state of the repository. This should be given for the `RepoThis` repo kind and not for `RepoHead` kind.

repoSubdir :: Maybe FilePath

  Some repositories contain multiple projects in different subdirectories This field specifies the subdirectory where this packages sources can be found, eg the subdirectory containing the `.cabal` file. It is interpreted relative to the root of the repository. This field is optional. If not given the default is "." ie no subdirectory.

Instances

Eq SourceRepo Source |
Data SourceRepo Source |
Read SourceRepo Source |
Show SourceRepo Source |
Generic SourceRepo Source |
Binary SourceRepo Source |
type Rep SourceRepo Source |

data RepoKind Source

What this repo info is for, what it represents.

Constructors

RepoHead | The repository for the "head" or development version of the project. This repo is where we should track the latest development activity or the usual repo people should get to contribute patches.
RepoThis | The repository containing the sources for this exact package version or release. For this kind of repo a tag should be given to give enough information to re-create the exact sources.
RepoKindUnknown String |

Instances

Eq RepoKind Source |
Data RepoKind Source |
Ord RepoKind Source |
Read RepoKind Source |
Show RepoKind Source |
Generic RepoKind Source |
Binary RepoKind Source |
Text RepoKind Source |
type Rep RepoKind Source |

data RepoType Source

An enumeration of common source control systems. The fields used in the `SourceRepo` depend on the type of repo. The tools and methods used to obtain and track the repo depend on the repo type.

Constructors

Darcs |
Git |
SVN |
CVS |
Mercurial |
GnuArch |
Bazaar |
Monotone |
OtherRepoType String |

Instances

Eq RepoType Source |
Data RepoType Source |
Ord RepoType Source |
Read RepoType Source |
Show RepoType Source |
Generic RepoType Source |
Binary RepoType Source |
Text RepoType Source |
type Rep RepoType Source |

knownRepoTypes :: [RepoType] Source