package opam-lib
Install
Dune Dependency
Authors
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
AAnil Madhavapeddy <anil@recoil.org>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
Maintainers
Sources
sha256=625767c3465219cc8799aad1449c74279b31686db0821300cfdb92fbff17e9fd
md5=e0688c0cf9a55f93ee93f62d07cf6b74
doc/opam-lib.format/OpamFormula/index.html
Module OpamFormula
Management of formulas
binary operations (compatible with the Dose type for Cudf operators !)
val string_of_relop : relop -> string
Pretty-printing of relops
val relop_of_string : string -> relop
Parsing relops
type version_constraint = relop * OpamPackage.Version.t
Version constraints for OPAM
type atom = OpamPackage.Name.t * version_constraint option
Formula atoms for OPAM
val string_of_atom : atom -> string
Pretty-printing of atoms
val short_string_of_atom : atom -> string
The compact atom format used in requests, "pkgOPvers", with '.' allowed instead of '='
val string_of_atoms : atom list -> string
Prints atoms as a conjunction ("&") using the short format
val check : atom -> OpamPackage.t -> bool
Checks if a package verifies an atom
val string_of_conjunction : ('a -> string) -> 'a conjunction -> string
Pretty print AND 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
val eval : ('a -> bool) -> 'a formula -> bool
Eval a formula
val check_relop : relop -> int -> bool
Check a relational operator against an integer from compare
val eval_relop :
relop ->
OpamPackage.Version.t ->
OpamPackage.Version.t ->
bool
Evaluate a relational operator between versions
val string_of_formula : ('a -> string) -> 'a formula -> string
Pretty print a formula
Convert a list of formulas to an AND-formula (Empty
formulas are ignored)
Converts back an AND-formula to a list (flattens top-level ands)
Convert a list of formulas to an OR-formula (Empty
formulas are ignored)
Converts back an OR-formula to a list (flattens top-level ors)
Map on atoms. Atoms for which the given function returns Empty will be simply removed
Negates a formula (given the function to negate atoms)
val iter : ('a -> unit) -> 'a formula -> unit
Iter function
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b formula -> 'a
Fold function
type version_formula = version_constraint formula
Expressions composed entirely of version constraints
type t = (OpamPackage.Name.t * version_formula) formula
An atom is: name
* (relop
* version
) formula. Examples of valid formulae:
- "foo" {> "1" & (<"3" | ="5")}
- "foo" {= "1" | > "4"} | ("bar" "bouh")
Transform a formula where versions can be expressed using formulas to a flat atom formula
val simplify_version_formula : version_formula -> version_formula
Reduces the formula, finding a shorter description of the same version set. Keeps conflicting formula, for documentation, when the set is empty.
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
type 'a ext_package_formula =
(OpamPackage.Name.t * ('a * version_formula)) formula
Formula over versionned packages with additional flags (used to handle eg. build-deps)
val formula_of_extended : filter:('a -> bool) -> 'a ext_package_formula -> t
Turns an extended package formula to a normal formula, by filtering out the packages on the flags of which filter
returns false
.