OpamTypes

# Module OpamTypes

    module OpamTypes: sig .. end

Common types used by other modules

    type 'a success = [ `Successful of 'a ]

## Error and continuation handling

    type 'a error = [ `Error of 'a | `Exception of exn ]

    type ('a, 'b) status = [ `Error of 'b | `Exception of exn | `Successful of 'a ]

## Filenames

    type basename = OpamFilename.Base.t

Basenames

    type dirname = OpamFilename.Dir.t

Directory names

    type filename = OpamFilename.t

Filenames

    type filename_set = OpamFilename.Set.t

Set of files

    type 'a filename_map = 'a OpamFilename.Map.t

Map of files

    type generic_file = OpamFilename.generic_file =

`|` | `D of `dirname``
`|` | `F of `filename``

Generalized file type

    type 'a download =

`|` | `Up_to_date of `'a``
`|` | `Not_available of `string``
`|` | `Result of `'a``

Download result

## Packages

    type package = OpamPackage.t

Packages are (`name` * `version`) tuple

    type package_set = OpamPackage.Set.t

Set of packages

    type 'a package_map = 'a OpamPackage.Map.t

Map of packages

    type name = OpamPackage.Name.t

Package names

    type name_set = OpamPackage.Name.Set.t

Set of package names

    type 'a name_map = 'a OpamPackage.Name.Map.t

Map of package names

    type version = OpamPackage.Version.t

Package versions

    type version_set = OpamPackage.Version.Set.t

Set of package versions

## Compilers

    type compiler = OpamCompiler.t

Compiler names

    type compiler_set = OpamCompiler.Set.t

Set of compiler names

    type 'a compiler_map = 'a OpamCompiler.Map.t

Maps of compiler names

    type compiler_version = OpamCompiler.Version.t

Compiler versions

    type opam_version = OpamVersion.t

OPAM versions

    type compiler_constraint = OpamCompiler.Version.constr

Compiler constraints

## Variables

    type variable = OpamVariable.t

Variables

    type full_variable = OpamVariable.Full.t

Fully qualified variables (ie. with the name of sections/sub-sections they appear in)

    type variable_contents = OpamVariable.variable_contents =

`|` | `B of `bool``
`|` | `S of `string``

Content of user-defined variables

    type variable_map = OpamVariable.variable_contents OpamVariable.Map.t

A map from variables to their contents (i.e an environment)

    type package_flag =

`|` | `Pkgflag_LightUninstall` | `(*` | The package doesn't require downloading to uninstall | `*)`
`|` | `Pkgflag_AllSwitches` | `(*` | The package is pervasive on all switches | `*)`
`|` | `Pkgflag_Verbose` | `(*` | The package's scripts output is to be displayed to the user | `*)`
`|` | `Pkgflag_Plugin` | `(*` | The package is an opam plugin that will install a `opam-<name>` exec, and may be auto-installed when doing `opam <name>` | `*)`
`|` | `Pkgflag_Unknown of `string`` | `(*` | Used for error reporting, otherwise ignored | `*)`

Opam package flags

    type package_dep_flag =

`|` | `Depflag_Build`
`|` | `Depflag_Test`
`|` | `Depflag_Doc`
`|` | `Depflag_Dev`
`|` | `Depflag_Unknown of `string`` | `(*` | Used for error reporting, otherwise ignored | `*)`

Flags on dependencies

    module type GenericPackage = sig .. end

At some point we want to abstract so that the same functions can be used over CUDF and OPAM packages

## Formulas

    type 'a generic_formula = 'a OpamFormula.formula =

`|` | `Empty`
`|` | `Atom of `'a``
`|` | `Block of `'a generic_formula``
`|` | `And of `'a generic_formula * 'a generic_formula``
`|` | `Or of `'a generic_formula * 'a generic_formula``

A generic formula

    type atom = OpamFormula.atom

Formula atoms

    type formula = OpamFormula.t

Formula over versionned packages

    type ext_formula = package_dep_flag list OpamFormula.ext_package_formula

Formula over versionned packages

    type 'a conjunction = 'a OpamFormula.conjunction

AND formulat

    type 'a disjunction = 'a OpamFormula.disjunction

OR formulat

## Repositories

    type repository_name = OpamRepositoryName.t

Repository names

    type 'a repository_name_map = 'a OpamRepositoryName.Map.t

Maps of repository names

    type repository_kind = [ `darcs | `git | `hg | `http | `local ]

Repository kind

    type address = string * string option

Repository address

    type repository_root = dirname

Repository root

    type repository = {

`` | `repo_root : `repository_root`;`
`` | `repo_name : `repository_name`;`
`` | `repo_kind : `repository_kind`;`
`` | `repo_address : `address`;`
`` | `repo_priority : `int`;`

}
Repositories

## Solver

    type 'a action =

`|` | `To_change of `'a option * 'a``
`|` | `To_delete of `'a``
`|` | `To_recompile of `'a``

The solver answers a list of actions to perform

    type 'a cause =

`|` | `Use of `'a list``
`|` | `Required_by of `'a list``
`|` | `Conflicts_with of `'a list``
`|` | `Upstream_changes`
`|` | `Requested`
`|` | `Unknown`

The possible causes of an action.

    type solver_result =

`|` | `Nothing_to_do`
`|` | `OK of `package action list`` | `(*` | List of successful actions | `*)`
`|` | `Aborted`
`|` | `No_solution`
`|` | `Error of `package action list * package action list * package action list`` | `(*` | List of successful actions, list of actions with errors, list of remaining undone actions | `*)`

Solver result

    type ('a, 'b) result =

`|` | `Success of `'a``
`|` | `Conflicts of `'b``

Solver result

    type solver_criteria = [ `Default | `Fixup | `Upgrade ]

    type 'a request = {

`` | `criteria : `solver_criteria`;`
`` | `wish_install : `'a conjunction`;`
`` | `wish_remove : `'a conjunction`;`
`` | `wish_upgrade : `'a conjunction`;`

}
Solver request

    type user_action =

`|` | `Install of `name_set`` | `(*` | The 'root' packages to be installed | `*)`
`|` | `Upgrade of `package_set`` | `(*` | The subset of packages to upgrade | `*)`
`|` | `Reinstall of `package_set``
`|` | `Depends`
`|` | `Init`
`|` | `Remove`
`|` | `Switch of `name_set`` | `(*` | The 'root' packages to be installed | `*)`
`|` | `Import of `name_set`` | `(*` | The 'root' packages to be installed | `*)`

user request action

    type universe = {

`` | `u_packages : `package_set`;`
`` | `u_installed : `package_set`;`
`` | `u_available : `package_set`;`
`` | `u_depends : `ext_formula package_map`;`
`` | `u_depopts : `ext_formula package_map`;`
`` | `u_conflicts : `formula package_map`;`
`` | `u_action : `user_action`;`
`` | `u_installed_roots : `package_set`;`
`` | `u_pinned : `package_set`;`
`` | `u_base : `package_set`;`

}
Solver universe

## Command line arguments

    type upload = {

`` | `upl_opam : `filename`;`
`` | `upl_descr : `filename`;`
`` | `upl_archive : `filename`;`

}
Upload arguments

    type pin_option =

`|` | `Version of `version``
`|` | `Local of `dirname``
`|` | `Git of `address``
`|` | `Darcs of `address``
`|` | `Hg of `address``
`|` | `Http of `address``

Pinned packages options

    type pin_kind = [ `darcs | `git | `hg | `http | `local | `version ]

Pin kind

    type shell = [ `bash | `csh | `fish | `sh | `zsh ]

Shell compatibility modes

    type global_config = {

`` | `complete : `bool`;`
`` | `switch_eval : `bool`;`

}
Global configuration option

    type user_config = {

`` | `shell : `shell`;`
`` | `ocamlinit : `bool`;`
`` | `dot_profile : `filename option`;`

}
User configuration option

## Filtered commands

    type relop = OpamFormula.relop

    type logop = [ `And | `Or ]

    type pfxop = [ `Not ]

    type filter =

`|` | `FBool of `bool``
`|` | `FString of `string``
`|` | `FIdent of `(name list * variable * (string * string) option)`` | `(*` | packages, variable name, string converter (val_if_true, val_if_false_or_undef) | `*)`
`|` | `FOp of `filter * relop * filter``
`|` | `FAnd of `filter * filter``
`|` | `FOr of `filter * filter``
`|` | `FNot of `filter``
`|` | `FUndef`

Filter

    type simple_arg =

`|` | `CString of `string``
`|` | `CIdent of `string``

A command argument

    type arg = simple_arg * filter option

Command argument

    type command = arg list * filter option

Command

## Untyped generic file format

    type pos = filename * int * int

Source file positions: filename, line, column

    type value =

`|` | `Bool of `pos * bool``
`|` | `Int of `pos * int``
`|` | `String of `pos * string``
`|` | `Relop of `pos * relop * value * value``
`|` | `Prefix_relop of `pos * relop * value``
`|` | `Logop of `pos * logop * value * value``
`|` | `Pfxop of `pos * pfxop * value``
`|` | `Ident of `pos * string``
`|` | `List of `pos * value list``
`|` | `Group of `pos * value list``
`|` | `Option of `pos * value * value list``
`|` | `Env_binding of `pos * string * value * value``

Base values

    type file_section = {

`` | `section_kind : `string`;`
`` | `section_name : `string`;`
`` | `section_items : `file_item list`;`

}
A file section

    type file_item =

`|` | `Section of `pos * file_section``
`|` | `Variable of `pos * string * value``

A file is composed of sections and variable definitions

    type file = {

`` | `file_contents : `file_item list`;`
`` | `file_name : `string`;`
`` | `file_format : `opam_version`;`

}
A file is a list of items and the filename

## Switches

    type switch = OpamSwitch.t

Compiler switches

    type switch_set = OpamSwitch.Set.t

Set of compiler switches

    type 'a switch_map = 'a OpamSwitch.Map.t

Map of compile switches

## Misc

    type lock =

`|` | `Read_lock of `(unit -> unit)``
`|` | `Global_lock of `(unit -> unit)``
`|` | `Switch_lock of `(unit -> unit)``
`|` | `Global_with_switch_cont_lock of `(unit -> switch * (unit -> unit))``

The different kinds of locks

    type file_attribute = OpamFilename.Attribute.t

A line in urls.tx

    type file_attribute_set = OpamFilename.Attribute.Set.t

All the lines in urls.txt

    type 'a optional = {

`` | `c : `'a`;` | `(*` | Contents | `*)`
`` | `optional : `bool`;` | `(*` | Is the contents optional | `*)`

}
Optional contents

    type stats = {

`` | `s_install : `int`;`
`` | `s_reinstall : `int`;`
`` | `s_upgrade : `int`;`
`` | `s_downgrade : `int`;`
`` | `s_remove : `int`;`

}
Upgrade statistics

    type env = (string * string) list

Environement variables

    type env_updates = (string * string * string) list

Environment updates

    type tags = OpamMisc.StringSet.t OpamMisc.StringSetMap.t

Tags

## Repository and global states

    type checksums = string list

Checksums

    type json = OpamJson.t

## JSON

    type 'a updates = {

`` | `created : `'a`;`
`` | `updated : `'a`;`
`` | `deleted : `'a`;`
`` | `changed : `'a`;`

}

## Updates