| Haskell Hierarchical Libraries (Cabal package) | Source code | Contents | Index
Distribution.PackageDescription |
Portability | portable
Stability | alpha
Maintainer | Isaac Jones <ijones@syntaxpolice.org>
Contents
Package descriptions Build information Supplementary build information Utilities
Description
Package description and parsing.
Synopsis
data PackageDescription = PackageDescription {
package :: PackageIdentifier
license :: License
licenseFile :: FilePath
copyright :: String
maintainer :: String
author :: String
stability :: String
testedWith :: [(CompilerFlavor, VersionRange)]
homepage :: String
pkgUrl :: String
synopsis :: String
description :: String
category :: String
buildDepends :: [Dependency]
descCabalVersion :: VersionRange
library :: (Maybe Library)
executables :: [Executable]
dataFiles :: [FilePath]
extraSrcFiles :: [FilePath]
extraTmpFiles :: [FilePath]
}
emptyPackageDescription :: PackageDescription
readPackageDescription :: FilePath -> IO PackageDescription
parseDescription :: String -> ParseResult PackageDescription
data StanzaField a = StanzaField {
fieldName :: String
fieldGet :: (a -> Doc)
fieldSet :: (LineNo -> String -> a -> ParseResult a)
}
type LineNo = Int
basicStanzaFields :: [StanzaField PackageDescription]
writePackageDescription :: FilePath -> PackageDescription -> IO ()
showPackageDescription :: PackageDescription -> String
sanityCheckPackage :: PackageDescription -> IO ([String], [String])
errorOut :: [String] -> [String] -> IO ()
setupMessage :: String -> PackageDescription -> IO ()
data Library = Library {
exposedModules :: [String]
libBuildInfo :: BuildInfo
}
withLib :: PackageDescription -> a -> (Library -> IO a) -> IO a
hasLibs :: PackageDescription -> Bool
libModules :: PackageDescription -> [String]
data Executable = Executable {
exeName :: String
modulePath :: FilePath
buildInfo :: BuildInfo
}
withExe :: PackageDescription -> (Executable -> IO a) -> IO ()
exeModules :: PackageDescription -> [String]
data BuildInfo = BuildInfo {
buildable :: Bool
ccOptions :: [String]
ldOptions :: [String]
frameworks :: [String]
cSources :: [FilePath]
hsSourceDirs :: [FilePath]
otherModules :: [String]
extensions :: [Extension]
extraLibs :: [String]
extraLibDirs :: [String]
includeDirs :: [FilePath]
includes :: [FilePath]
installIncludes :: [FilePath]
options :: [(CompilerFlavor, [String])]
ghcProfOptions :: [String]
}
emptyBuildInfo :: BuildInfo
type HookedBuildInfo = (Maybe BuildInfo, [(String, BuildInfo)])
emptyHookedBuildInfo :: HookedBuildInfo
readHookedBuildInfo :: FilePath -> IO HookedBuildInfo
parseHookedBuildInfo :: String -> ParseResult HookedBuildInfo
writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> IO ()
showHookedBuildInfo :: HookedBuildInfo -> String
updatePackageDescription :: HookedBuildInfo -> PackageDescription -> PackageDescription
data ParseResult a
= ParseFailed PError
| ParseOk [PWarning] a
data PError
type PWarning = String
showError :: PError -> String
hcOptions :: CompilerFlavor -> [(CompilerFlavor, [String])] -> [String]
autogenModuleName :: PackageDescription -> String
haddockName :: PackageDescription -> FilePath
Package descriptions
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.
Constructors
PackageDescription |
package :: PackageIdentifier |
license :: License |
licenseFile :: FilePath |
copyright :: String |
maintainer :: String |
author :: String |
stability :: String |
testedWith :: [(CompilerFlavor, VersionRange)] |
homepage :: String |
pkgUrl :: String |
synopsis :: String | A one-line summary of this package
description :: String | A more verbose description of this package
category :: String |
buildDepends :: [Dependency] |
descCabalVersion :: VersionRange | If this package depends on a specific version of Cabal, give that here. components
library :: (Maybe Library) |
executables :: [Executable] |
dataFiles :: [FilePath] |
extraSrcFiles :: [FilePath] |
extraTmpFiles :: [FilePath] |
Instances
Eq PackageDescription
Read PackageDescription
Show PackageDescription
emptyPackageDescription :: PackageDescription
readPackageDescription :: FilePath -> IO PackageDescription
Parse the given package file.
parseDescription :: String -> ParseResult PackageDescription
data StanzaField a
Constructors
StanzaField |
fieldName :: String |
fieldGet :: (a -> Doc) |
fieldSet :: (LineNo -> String -> a -> ParseResult a) |
type LineNo = Int
basicStanzaFields :: [StanzaField PackageDescription]
writePackageDescription :: FilePath -> PackageDescription -> IO ()
showPackageDescription :: PackageDescription -> String
sanityCheckPackage :: PackageDescription -> IO ([String], [String])
Sanity check this description file.
errorOut
:: [String] | Warnings
-> [String] | errors
-> IO () |
Output warnings and errors. Exit if any errors.
setupMessage :: String -> PackageDescription -> IO ()
data Library
Constructors
Library |
exposedModules :: [String] |
libBuildInfo :: BuildInfo |
Instances
Eq Library
Read Library
Show Library
withLib :: PackageDescription -> a -> (Library -> IO a) -> IO a
If the package description has a library section, call the given function with the library build info as argument.
hasLibs :: PackageDescription -> Bool
does this package have any libraries?
libModules :: PackageDescription -> [String]
Get all the module names from the libraries in this package
data Executable
Constructors
Executable |
exeName :: String |
modulePath :: FilePath |
buildInfo :: BuildInfo |
Instances
Eq Executable
Read Executable
Show Executable
withExe :: PackageDescription -> (Executable -> IO a) -> IO ()
Perform the action on each buildable `Executable` in the package description.
exeModules :: PackageDescription -> [String]
Get all the module names from the exes in this package
Build information
data BuildInfo
Constructors
BuildInfo |
buildable :: Bool | component is buildable here
ccOptions :: [String] | options for C compiler
ldOptions :: [String] | options for linker
frameworks :: [String] | support frameworks for Mac OS X
cSources :: [FilePath] |
hsSourceDirs :: [FilePath] | where to look for the haskell module hierarchy
otherModules :: [String] | non-exposed or non-main modules
extensions :: [Extension] |
extraLibs :: [String] | what libraries to link with when compiling a program that uses your package
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])] |
ghcProfOptions :: [String] |
Instances
Eq BuildInfo
Read BuildInfo
Show BuildInfo
emptyBuildInfo :: BuildInfo
Supplementary build information
type HookedBuildInfo = (Maybe BuildInfo, [(String, BuildInfo)])
emptyHookedBuildInfo :: HookedBuildInfo
readHookedBuildInfo :: FilePath -> IO HookedBuildInfo
parseHookedBuildInfo :: String -> ParseResult HookedBuildInfo
writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> IO ()
showHookedBuildInfo :: HookedBuildInfo -> String
updatePackageDescription :: HookedBuildInfo -> PackageDescription -> PackageDescription
Update the given package description with the output from the pre-hooks.
Utilities
data ParseResult a
Constructors
ParseFailed PError |
ParseOk [PWarning] a |
Instances
Monad ParseResult
Show a => Show (ParseResult a)
data PError
Instances
Show PError
type PWarning = String
showError :: PError -> String
hcOptions :: CompilerFlavor -> [(CompilerFlavor, [String])] -> [String]
Select options for a particular Haskell compiler.
autogenModuleName :: PackageDescription -> String
The name of the auto-generated module associated with a package
haddockName :: PackageDescription -> FilePath
Produced by Haddock version 0.8