issues with configurations
Einar Karttunen
ekarttun at cs.helsinki.fi
Thu Aug 10 16:44:08 EDT 2006
Hello
This is a formulation after more discussion on #haskell.
This is for build-depends with the configurable things.
Not sure whether this is the best way.
- Einar Karttunen
bexp = package-with-version
| '(' bexp ')'
| bexp '|' bexp
| bexp ',' bexp
| 'Flag(' string ')'
| 'T'
Semantics:
package-with-version
* satisfied iff a suitable version of P installed
* depends on p
'(' e ')'
* satisfied iff e satisfied
* dependencies from e
a '|' b
* satisfied iff a or b is satisfied
* if a is satisfied then a else b
a ',' b
* satisfied iff a and b are satisfied
* dependencies are the combination of a and b
* union of packages and intersection of versions
'Flag(' string ')'
* satisfied iff string in environment
* no dependencies
'T'
* always satisfied
* no dependencies
Code follows:
data BExp = BP String Version
| BOr BExp BExp
| BAnd BExp BExp
| BFlag String
| BTrue
eval (BP n v) = return [(n,v)]
eval (BOr a b) = eval a `mplus` eval b
eval (BAnd a b) = do x <- eval a
y <- eval b
return [(name, intersectVersions $ map snd xs) | xs@((name,_):_) <- groupByFst (x++y) ]
liftM2 (comb) (eval a) (eval b)
eval (BFlag s) = getFlag s >> return []
eval (BTrue) = return []
groupByFst = groupBy eqFst where eqFst (a,_) (b,_) = a == b
- Einar Karttunen
More information about the cabal-devel
mailing list