Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains queries that operate on a PackageDescription. It provides a function to extract all targets along with their dependencies.
- data Target = Target {
- info :: TargetInfo
- dependencies :: [(String, Maybe Version)]
- sourceDirs :: [FilePath]
- includeDirs :: [FilePath]
- ghcOptions :: [String]
- cppOptions :: [String]
- extensions :: [String]
- buildable :: Bool
- otherModules :: [String]
- cSources :: [String]
- enabled :: Bool
- data TargetInfo
- data PackageDescription
- targets :: Query PackageDescription [Target]
- targetName :: Target -> String
- isLibrary :: Target -> Bool
- isExecutable :: Target -> Bool
- isTest :: Target -> Bool
- isBench :: Target -> Bool
- _name :: Applicative f => (String -> f String) -> TargetInfo -> f TargetInfo
- _mainModule :: Applicative f => (FilePath -> f FilePath) -> TargetInfo -> f TargetInfo
- _info :: Functor f => (TargetInfo -> f TargetInfo) -> Target -> f Target
- _dependencies :: Functor f => ([(String, Maybe Version)] -> f [(String, Maybe Version)]) -> Target -> f Target
- _sourceDirs :: Functor f => ([FilePath] -> f [FilePath]) -> Target -> f Target
- _includeDirs :: Functor f => ([FilePath] -> f [FilePath]) -> Target -> f Target
- _ghcOptions :: Functor f => ([String] -> f [String]) -> Target -> f Target
- _cppOptions :: Functor f => ([String] -> f [String]) -> Target -> f Target
- _extensions :: Functor f => ([String] -> f [String]) -> Target -> f Target
- _buildable :: Functor f => (Bool -> f Bool) -> Target -> f Target
- _otherModules :: Functor f => ([String] -> f [String]) -> Target -> f Target
- _enabled :: Functor f => (Bool -> f Bool) -> Target -> f Target
Data types for targets
A target is a single Library, an Executable, a TestSuite or a Benchmark.
Target | |
|
data TargetInfo Source
The specific information on a target, depending on the target type. Libraries don't have a name, they are always named after the package, but other types do
Library [String] | contains the names of exposed modules |
Executable String FilePath | contains the name of the executable and the path to the Main module |
TestSuite String (Maybe FilePath) | contains the name of the test suite and the path to the Main module, for stdio tests |
BenchSuite String (Maybe FilePath) | contains the name of the benchmark and the path to the Main module, for stdio benchmarks |
data PackageDescription Source
A package description type. This type has no constructors, and is only used for type-safety purposes.
Queries
targets :: Query PackageDescription [Target] Source
Query the available targets. This will return all targets, even disabled ones. If a package is disabled or not buildable, it's possible that not all dependencies have versions, some can be Nothing.
targetName :: Target -> String Source
return the target name, or the empty string for the library target
isExecutable :: Target -> Bool Source
is the target an executable?
Lenses and traversals for target related data types
_name :: Applicative f => (String -> f String) -> TargetInfo -> f TargetInfo Source
Traverse the name of a target, if available (libraries don't have names).
_mainModule :: Applicative f => (FilePath -> f FilePath) -> TargetInfo -> f TargetInfo Source
Traverse the path of the main module, if available.
_info :: Functor f => (TargetInfo -> f TargetInfo) -> Target -> f Target Source