Module OpamFormula

module OpamFormula: sig .. end
Management of formulas

type relop = [ `Eq | `Geq | `Gt | `Leq | `Lt | `Neq ] 
binary operations
val string_of_relop : relop -> string
Pretty-printing of relops
val relop_of_string : string -> relop
Parsing relops
type atom = OpamPackage.Name.t * (relop * OpamPackage.Version.t) option 
Formula atoms for OPAM
val string_of_atom : atom -> string
Pretty-printing of atoms
type 'a conjunction = 'a list 
AND formulas
val string_of_conjunction : ('a -> string) -> 'a conjunction -> string
Pretty print AND formulas
type 'a disjunction = 'a list 
OR formulas
val string_of_disjunction : ('a -> string) -> 'a disjunction -> string
Pretty print OR formulas
type 'a cnf = 'a disjunction conjunction 
CNF formulas (Conjunctive Normal Form)
type 'a dnf = 'a conjunction disjunction 
DNF formulas (Disjunctive Normal Form)
val string_of_cnf : ('a -> string) -> 'a cnf -> string
Pretty print CNF formulas
val string_of_dnf : ('a -> string) -> 'a dnf -> string
Pretty print DNF formulas
type 'a formula = 
| Empty
| Atom of 'a
| Block of 'a formula
| And of 'a formula * 'a formula
| Or of 'a formula * 'a formula
General formulas
val eval : ('a -> bool) -> 'a formula -> bool
Eval a formula
val string_of_formula : ('a -> string) -> 'a formula -> string
Pretty print a formula
val ands : 'a formula list -> 'a formula
Convert a list of formulas to an AND-formula
val ors : 'a formula list -> 'a formula
Convert a list of formulas to an OR-formula
val map : ('a -> 'b formula) ->
'a formula -> 'b formula
Map function
val iter : ('a -> unit) -> 'a formula -> unit
Iter function
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b formula -> 'a
Fold function
type t = (OpamPackage.Name.t *
(relop * OpamPackage.Version.t) formula)
formula
An atom is: name * (relop * version) formula. Examples of valid formulaes:
val cnf_of_formula : 'a formula -> 'a formula
Convert a formula to CNF
val dnf_of_formula : 'a formula -> 'a formula
Convert a formula to DNF
val to_atom_formula : t -> atom formula
Transform a formula where versions can be expressed using formulas to a flat atom formula
val of_atom_formula : atom formula -> t
Convert an atom-formula to a t-formula

Atoms


val atoms : t -> atom list
Return all the atoms
val to_string : t -> string
Pretty print the formula
val to_conjunction : t -> atom conjunction
Return a conjunction. If the initial formula is not a conjunction, then fail.
val of_conjunction : atom conjunction -> t
Return a formula from a conjunction of atoms
val to_disjunction : t -> atom disjunction
Return a disjunction. It the initial formula is not a disjunction, then fail.
val of_disjunction : atom disjunction -> t
Return a formula from a disjunction of atoms
val to_cnf : t -> atom cnf
Return an equivalent CNF formula
val to_dnf : t -> atom dnf
Return an equivalent DNF formula