Safe Haskell | Safe-Inferred |
---|
An abstract syntax tree for Cabal files. There are thoughts in the Cartel module documentation on why this wheel is reinvented rather than reusing the types already available in the Cabal library.
The Cabal
data type represents the root of the Cabal file; all
other types in this file are ultimately components of the Cabal
type.
Much documentation in this module is copied from the Developing Cabal Packages guide at
http://www.haskell.org/cabal/users-guide/developing-packages.html
- data Logical
- newtype Version = Version {}
- data Constraint = Constraint {}
- data ConstrTree
- data BuildType
- data License
- = GPL
- | AGPL
- | LGPL
- | BSD2
- | BSD3
- | BSD4
- | MIT
- | MPL
- | Apache
- | PublicDomain
- | AllRightsReserved
- | OtherLicense
- data Compiler
- data Properties = Properties {
- prName :: String
- prVersion :: Version
- prCabalVersion :: (Int, Int)
- prBuildType :: BuildType
- prLicense :: License
- prLicenseFile :: String
- prLicenseFiles :: [String]
- prCopyright :: String
- prAuthor :: String
- prMaintainer :: String
- prStability :: String
- prHomepage :: String
- prBugReports :: String
- prPackageUrl :: String
- prSynopsis :: String
- prDescription :: [String]
- prCategory :: String
- prTestedWith :: [(Compiler, ConstrTree)]
- prDataFiles :: [String]
- prDataDir :: String
- prExtraSourceFiles :: [String]
- prExtraDocFiles :: [String]
- prExtraTmpFiles :: [String]
- data RepoKind
- data Vcs
- data Repository = Repository {
- repoVcs :: Vcs
- repoKind :: RepoKind
- repoLocation :: String
- repoBranch :: String
- repoTag :: String
- repoSubdir :: String
- data Flag = Flag {}
- data Package = Package {}
- data Language
- = Haskell98
- | Haskell2010
- data BuildInfoField
- = BuildDepends [Package]
- | OtherModules [String]
- | HsSourceDirs [String]
- | Extensions [String]
- | BuildTools [Package]
- | Buildable Bool
- | GHCOptions [String]
- | GHCProfOptions [String]
- | GHCSharedOptions [String]
- | HugsOptions [String]
- | Nhc98Options [String]
- | Includes [String]
- | InstallIncludes [String]
- | IncludeDirs [String]
- | CSources [String]
- | ExtraLibraries [String]
- | ExtraLibDirs [String]
- | CCOptions [String]
- | CPPOptions [String]
- | LDOptions [String]
- | PkgConfigDepends [Package]
- | Frameworks [String]
- | DefaultLanguage Language
- data Condition
- data CondTree
- data CondBlock a = CondBlock {}
- class Field a where
- conditional :: CondBlock a -> a
- buildInfo :: BuildInfoField -> a
- data LibraryField
- newtype Library = Library {
- libFields :: [LibraryField]
- data ExecutableField
- data Executable = Executable {
- exeName :: String
- exeFields :: [ExecutableField]
- data TestSuiteType
- data TestSuiteField
- data TestSuite = TestSuite {
- tsName :: String
- tsFields :: [TestSuiteField]
- data BenchmarkField
- data Benchmark = Benchmark {}
- data Cabal = Cabal {
- cProperties :: Properties
- cRepositories :: [Repository]
- cFlags :: [Flag]
- cLibrary :: Maybe Library
- cExecutables :: [Executable]
- cTestSuites :: [TestSuite]
- cBenchmarks :: [Benchmark]
Constraint trees
A version number. The Cabal documentation says this "usually" consists of a sequence of natural numbers separated by dots. Though this suggests that a version number could contain something other than natural numbers, in fact the types in the Cabal library do not allow anything other than numbers and you will get a parse error if you try to use anything else.
Therefore Cartel's Version
type only allows a list of Int
in
a version number.
data Constraint Source
A version constraint; used primarily when specifying the build
dependencies of a package. For example, to specify
less than version 1.0
, use Constraint LT (Version [1,0])
.
There is no way to express less than or equal to
or greater
than or equal to
; for that, use ConstrTree
.
data ConstrTree Source
Expresses a tree of constraints. This is how you represent
more complex dependency relationships. For example, to represent
less than or equal to version 1.0
, use
> let one = Version [1,0] > in Branch Or (Constraint LT one) (Constraint EQ one)
Combinators in Cartel.Tools help you build the most common cases.
Global package description
data Properties Source
Global package properties. Most of the String
fields are
optional; to leave them blank, use the empty string. To future
proof your code, use properties
, which provides
this record already filled in with default values (which are
typically blank.) Then you only alter the fields you wish to
fill in.
Properties | |
|
Repositories
What kind of VCS repository is this?
data Repository Source
Repository | |
|
Flags
A single flag.
Flag | |
|
Build information
A single package, consisting of a package name and an optional
set of constraints. Used when specifying BuildDepends
,
BuildTools
, and PkgConfigDepends
.
Default language. Currently not documented in Cabal docs, see
data BuildInfoField Source
A single field of build information. This can appear in a Library, Executable, Test-Suite, or Benchmark.
BuildDepends [Package] | A list of packages needed to build this component |
OtherModules [String] | Modules used but not exposed. For libraries, these are
hidden modules; for executable, these are auxiliary modules to
be linked with the file in the
|
HsSourceDirs [String] | Root directories for the module hierarchy |
Extensions [String] | Haskell extensions used by every module. |
BuildTools [Package] | Programs needed to build this package, such as c2hs. |
Buildable Bool | Is this component buildable? |
GHCOptions [String] | |
GHCProfOptions [String] | |
GHCSharedOptions [String] | |
HugsOptions [String] | |
Nhc98Options [String] | |
Includes [String] | Header files to be included in any compilations via C. Applies to both header files that are already installed on the system and to those coming with the package to be installed. |
InstallIncludes [String] | Header files to be installed into |
IncludeDirs [String] | List of diretories to search for header files when dealing with C compilations. |
CSources [String] | C sources to be compiled and lined with the Haskell files. |
ExtraLibraries [String] | Extra libraries to link with. |
ExtraLibDirs [String] | Directories to search for libraries. |
CCOptions [String] | C Compiler options. |
CPPOptions [String] | C Preprocessor options. Undocumented, see https://github.com/haskell/cabal/issues/646 |
LDOptions [String] | Linker options. |
PkgConfigDepends [Package] | List of pkg-config packages needed to build this component. |
Frameworks [String] | OS X frameworks. |
DefaultLanguage Language |
Conditionals
Conditions to use in the if
statement when defining
conitional blocks.
OS String | Operating system; tested against |
Arch String | Argument is matched against |
Impl (Compiler, Maybe ConstrTree) | Tests for the configured Haskell implementation. |
CFlag String | Evaluates to the current assignment of the flag of the given name. Flag names are case insensitive. Testing for flags that have not been introduced with a flag section is an error. |
CTrue | Always true. |
CFalse | Always false. |
Tree of conditions to use in a CondBlock
.
An if-then-else
block.
Field class
Things that can be an item in a field in a Cabal file.
conditional :: CondBlock a -> aSource
Takes a conditional block and wraps it in the field type.
buildInfo :: BuildInfoField -> aSource
Takes a build information field and wraps it in the field type.
Libraries
data LibraryField Source
A field in the Library
section of the Cabal file. A
Library
section can have multiple fields.
LibExposedModules [String] | Exposed modules. |
LibExposed Bool | Is the library exposed? GHC can hide libraries. |
LibConditional (CondBlock LibraryField) | The |
LibInfo BuildInfoField | The |
The entire Library
section.
Library | |
|
Executables
data ExecutableField Source
A single field in an Executable
section. An Executable
section may have multiple fields.
ExeMainIs String |
|
ExeConditional (CondBlock ExecutableField) | An |
ExeInfo BuildInfoField | An |
data Executable Source
An entire Executable
section.
Executable | |
|
Test suites
data TestSuiteType Source
What kind of test suite is this?
ExitcodeStdio | An |
Detailed | The |
data TestSuiteField Source
A single field value in a test suite section. A single test suite section may contain mulitple fields.
TestType TestSuiteType | What kind of test this is |
TestMainIs String | The name of the |
TestModule String | The module exporting the |
TestConditional (CondBlock TestSuiteField) | A test may contain zero or more conditional blocks. |
TestInfo BuildInfoField | A test suite can contain build information fields. |
An entire test suite section.
TestSuite | |
|
Benchmarks
data BenchmarkField Source
A single field in a Benchmark
section. Because Cabal
currently supports only one benchmark interface, which is
exitcode-stdio-1.0
, all Cartel-generated files using benchmarks
will have benchmarks of this type.
BenchmarkConditional (CondBlock BenchmarkField) | A benchmark can have conditional blocks. |
BenchmarkInfo BuildInfoField | A benchmark can have build information fields. |
Cabal
Data for the entire Cabal file.
Cabal | |
|