| Cabal-1.2.1: A framework for packaging Haskell software | Contents | Index |
|
Distribution.Configuration | Portability | portable | Stability | alpha | Maintainer | Isaac Jones <ijones@syntaxpolice.org> |
|
|
|
Description |
Configurations
|
|
Synopsis |
|
|
|
Documentation |
|
data Flag |
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 | | flagName :: String | | flagDescription :: String | | flagDefault :: Bool | |
|
| Instances | |
|
|
data ConfVar |
A ConfVar represents the variable type used.
| Constructors | | Instances | |
|
|
data Condition c |
A boolean expression parameterized over the variable type used.
| Constructors | | Instances | |
|
|
parseCondition :: ReadP r (Condition ConfVar) |
Parse a configuration condition from a string.
|
|
simplifyCondition |
:: Condition c | | -> (c -> Either d Bool) | (partial) variable assignment
| -> (Condition d, [d]) | | Simplify the condition and return its free variables.
|
|
|
data CondTree v c a |
Constructors | | Instances | (Show v, Show c) => Show (CondTree v c a) |
|
|
|
ppCondTree :: Show v => CondTree v c a -> (c -> Doc) -> Doc |
|
mapTreeData :: (a -> b) -> CondTree v c a -> CondTree v c b |
|
resolveWithFlags |
:: Monoid a | | => [(String, [Bool])] | Domain for each flag name, will be tested in order.
| -> String | OS name, as returned by System.Info.os
| -> String | arch name, as returned by System.Info.arch
| -> (String, Version) | Compiler name + version
| -> [CondTree ConfVar [d] a] | | -> ([d] -> DepTestRslt [d]) | Dependency test function.
| -> Either [d] ([a], [d], [(String, Bool)]) | | Try to find a flag assignment that satisfies the constaints of all trees.
Returns either the missing dependencies, or a tuple containing the
resulting data, the associated dependencies, and the chosen flag
assignments.
In case of failure, the _smallest_ number of of missing dependencies is
returned. [XXX: Could also be specified with a function argument.]
XXX: The current algorithm is rather naive. A better approach would be to:
- Rule out possible paths, by taking a look at the associated dependencies.
- Infer the required values for the conditions of these paths, and
calculate the required domains for the variables used in these
conditions. Then picking a flag assignment would be linear (I guess).
This would require some sort of SAT solving, though, thus it's not
implemented unless we really need it.
|
|
|
ignoreConditions :: (Monoid a, Monoid c) => CondTree v c a -> (a, c) |
Flatten a CondTree. This will resolve the CondTree by taking all
possible paths into account. Note that since branches represent exclusive
choices this may not result in a sane result.
|
|
data DepTestRslt d |
Result of dependency test. Isomorphic to Maybe d but renamed for
clarity.
| Constructors | | Instances | |
|
|
Produced by Haddock version 0.8 |