Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data GenericPackageDescription = GenericPackageDescription {
- packageDescription :: PackageDescription
- genPackageFlags :: [Flag]
- condLibrary :: Maybe (CondTree ConfVar [Dependency] Library)
- condSubLibraries :: [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
- condForeignLibs :: [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
- condExecutables :: [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
- condTestSuites :: [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
- condBenchmarks :: [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
- emptyGenericPackageDescription :: GenericPackageDescription
- data Flag = MkFlag {}
- emptyFlag :: FlagName -> Flag
- data FlagName
- mkFlagName :: String -> FlagName
- unFlagName :: FlagName -> String
- data FlagAssignment
- mkFlagAssignment :: [(FlagName, Bool)] -> FlagAssignment
- unFlagAssignment :: FlagAssignment -> [(FlagName, Bool)]
- lookupFlagAssignment :: FlagName -> FlagAssignment -> Maybe Bool
- insertFlagAssignment :: FlagName -> Bool -> FlagAssignment -> FlagAssignment
- diffFlagAssignment :: FlagAssignment -> FlagAssignment -> FlagAssignment
- findDuplicateFlagAssignments :: FlagAssignment -> [FlagName]
- nullFlagAssignment :: FlagAssignment -> Bool
- showFlagValue :: (FlagName, Bool) -> String
- dispFlagAssignment :: FlagAssignment -> Doc
- parseFlagAssignment :: ReadP r FlagAssignment
- parsecFlagAssignment :: ParsecParser FlagAssignment
- data ConfVar
Documentation
data GenericPackageDescription #
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.
MkFlag | |
|
A FlagName
is the name of a user-defined configuration flag
Use mkFlagName
and unFlagName
to convert from/to a String
.
This type is opaque since Cabal-2.0
Since: 2.0.0.2
mkFlagName :: String -> FlagName #
Construct a FlagName
from a String
mkFlagName
is the inverse to unFlagName
Note: No validations are performed to ensure that the resulting
FlagName
is valid
Since: 2.0.0.2
data FlagAssignment #
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)]
Eq FlagAssignment # | |
Ord FlagAssignment # | |
Read FlagAssignment # | Since: 2.2.0 |
Show FlagAssignment # | Since: 2.2.0 |
Semigroup FlagAssignment # | |
Monoid FlagAssignment # | |
Binary FlagAssignment # | |
NFData FlagAssignment # | |
mkFlagAssignment :: [(FlagName, Bool)] -> FlagAssignment #
Construct a FlagAssignment
from a list of flag/value pairs.
If duplicate flags occur in the input list, the later entries in the list will take precedence.
Since: 2.2.0
unFlagAssignment :: FlagAssignment -> [(FlagName, Bool)] #
Deconstruct a FlagAssignment
into a list of flag/value pairs.
null
(findDuplicateFlagAssignments
fa) ==> (mkFlagAssignment
.unFlagAssignment
) fa == fa
Since: 2.2.0
lookupFlagAssignment :: FlagName -> FlagAssignment -> Maybe Bool #
Lookup the value for a flag
Returns Nothing
if the flag isn't contained in the FlagAssignment
.
Since: 2.2.0
insertFlagAssignment :: FlagName -> Bool -> FlagAssignment -> FlagAssignment #
Insert or update the boolean value of a flag.
If the flag is already present in the FlagAssigment
, the
value will be updated and the fact that multiple values have
been provided for that flag will be recorded so that a
warning can be generated later on.
Since: 2.2.0
diffFlagAssignment :: FlagAssignment -> FlagAssignment -> FlagAssignment #
Remove all flag-assignments from the first FlagAssignment
that
are contained in the second FlagAssignment
NB/TODO: This currently only removes flag assignments which also match the value assignment! We should review the code which uses this operation to figure out if this it's not enough to only compare the flagnames without the values.
Since: 2.2.0
findDuplicateFlagAssignments :: FlagAssignment -> [FlagName] #
Find the FlagName
s that have been listed more than once.
Since: 2.2.0
nullFlagAssignment :: FlagAssignment -> Bool #
Test whether FlagAssignment
is empty.
Since: 2.2.0
showFlagValue :: (FlagName, Bool) -> String #
String representation of a flag-value pair.
dispFlagAssignment :: FlagAssignment -> Doc #
Pretty-prints a flag assignment.
parseFlagAssignment :: ReadP r FlagAssignment #
Parses a flag assignment.
parsecFlagAssignment :: ParsecParser FlagAssignment #
Parses a flag assignment.