sig
  type 'a success = [ `Successful of 'a ]
  type 'a error = [ `Error of '| `Exception of exn ]
  type ('a, 'b) status =
      [ `Error of '| `Exception of exn | `Successful of 'a ]
  type basename = OpamFilename.Base.t
  type dirname = OpamFilename.Dir.t
  type filename = OpamFilename.t
  type filename_set = OpamFilename.Set.t
  type 'a filename_map = 'OpamFilename.Map.t
  type generic_file =
    OpamFilename.generic_file =
      D of OpamTypes.dirname
    | F of OpamTypes.filename
  type 'a download =
      Up_to_date of 'a
    | Not_available of string
    | Result of 'a
  type package = OpamPackage.t
  type package_set = OpamPackage.Set.t
  type 'a package_map = 'OpamPackage.Map.t
  type name = OpamPackage.Name.t
  type name_set = OpamPackage.Name.Set.t
  type 'a name_map = 'OpamPackage.Name.Map.t
  type version = OpamPackage.Version.t
  type version_set = OpamPackage.Version.Set.t
  type compiler = OpamCompiler.t
  type compiler_set = OpamCompiler.Set.t
  type 'a compiler_map = 'OpamCompiler.Map.t
  type compiler_version = OpamCompiler.Version.t
  type opam_version = OpamVersion.t
  type compiler_constraint = OpamCompiler.Version.constr
  type variable = OpamVariable.t
  type full_variable = OpamVariable.Full.t
  type variable_contents =
    OpamVariable.variable_contents =
      B of bool
    | S of string
  type variable_map = OpamVariable.variable_contents OpamVariable.Map.t
  type package_flag =
      Pkgflag_LightUninstall
    | Pkgflag_AllSwitches
    | Pkgflag_Verbose
    | Pkgflag_Plugin
    | Pkgflag_Unknown of string
  type package_dep_flag =
      Depflag_Build
    | Depflag_Test
    | Depflag_Doc
    | Depflag_Dev
    | Depflag_Unknown of string
  module type GenericPackage =
    sig
      type t
      val to_string : t -> string
      val to_json : t -> OpamJson.t
      val compare : t -> t -> int
      val hash : t -> int
      val equal : t -> t -> bool
      val name_to_string : t -> string
      val version_to_string : t -> string
    end
  type 'a generic_formula =
    'OpamFormula.formula =
      Empty
    | Atom of 'a
    | Block of 'OpamTypes.generic_formula
    | And of 'OpamTypes.generic_formula * 'OpamTypes.generic_formula
    | Or of 'OpamTypes.generic_formula * 'OpamTypes.generic_formula
  type atom = OpamFormula.atom
  type formula = OpamFormula.t
  type ext_formula =
      OpamTypes.package_dep_flag list OpamFormula.ext_package_formula
  type 'a conjunction = 'OpamFormula.conjunction
  type 'a disjunction = 'OpamFormula.disjunction
  type repository_name = OpamRepositoryName.t
  type 'a repository_name_map = 'OpamRepositoryName.Map.t
  type repository_kind = [ `darcs | `git | `hg | `http | `local ]
  type address = string * string option
  type repository_root = OpamTypes.dirname
  type repository = {
    repo_root : OpamTypes.repository_root;
    repo_name : OpamTypes.repository_name;
    repo_kind : OpamTypes.repository_kind;
    repo_address : OpamTypes.address;
    repo_priority : int;
  }
  type 'a action =
      To_change of 'a option * 'a
    | To_delete of 'a
    | To_recompile of 'a
  type 'a cause =
      Use of 'a list
    | Required_by of 'a list
    | Conflicts_with of 'a list
    | Upstream_changes
    | Requested
    | Unknown
  type solver_result =
      Nothing_to_do
    | OK of OpamTypes.package OpamTypes.action list
    | Aborted
    | No_solution
    | Error of OpamTypes.package OpamTypes.action list *
        OpamTypes.package OpamTypes.action list *
        OpamTypes.package OpamTypes.action list
  type ('a, 'b) result = Success of '| Conflicts of 'b
  type solver_criteria = [ `Default | `Fixup | `Upgrade ]
  type 'a request = {
    criteria : OpamTypes.solver_criteria;
    wish_install : 'OpamTypes.conjunction;
    wish_remove : 'OpamTypes.conjunction;
    wish_upgrade : 'OpamTypes.conjunction;
  }
  type user_action =
      Install of OpamTypes.name_set
    | Upgrade of OpamTypes.package_set
    | Reinstall of OpamTypes.package_set
    | Depends
    | Init
    | Remove
    | Switch of OpamTypes.name_set
    | Import of OpamTypes.name_set
  type universe = {
    u_packages : OpamTypes.package_set;
    u_installed : OpamTypes.package_set;
    u_available : OpamTypes.package_set;
    u_depends : OpamTypes.ext_formula OpamTypes.package_map;
    u_depopts : OpamTypes.ext_formula OpamTypes.package_map;
    u_conflicts : OpamTypes.formula OpamTypes.package_map;
    u_action : OpamTypes.user_action;
    u_installed_roots : OpamTypes.package_set;
    u_pinned : OpamTypes.package_set;
    u_base : OpamTypes.package_set;
  }
  type upload = {
    upl_opam : OpamTypes.filename;
    upl_descr : OpamTypes.filename;
    upl_archive : OpamTypes.filename;
  }
  type pin_option =
      Version of OpamTypes.version
    | Local of OpamTypes.dirname
    | Git of OpamTypes.address
    | Darcs of OpamTypes.address
    | Hg of OpamTypes.address
    | Http of OpamTypes.address
  type pin_kind = [ `darcs | `git | `hg | `http | `local | `version ]
  type shell = [ `bash | `csh | `fish | `sh | `zsh ]
  type global_config = { complete : bool; switch_eval : bool; }
  type user_config = {
    shell : OpamTypes.shell;
    ocamlinit : bool;
    dot_profile : OpamTypes.filename option;
  }
  type relop = OpamFormula.relop
  type logop = [ `And | `Or ]
  type pfxop = [ `Not ]
  type filter =
      FBool of bool
    | FString of string
    | FIdent of
        (OpamTypes.name list * OpamTypes.variable * (string * string) option)
    | FOp of OpamTypes.filter * OpamTypes.relop * OpamTypes.filter
    | FAnd of OpamTypes.filter * OpamTypes.filter
    | FOr of OpamTypes.filter * OpamTypes.filter
    | FNot of OpamTypes.filter
    | FUndef
  type simple_arg = CString of string | CIdent of string
  type arg = OpamTypes.simple_arg * OpamTypes.filter option
  type command = OpamTypes.arg list * OpamTypes.filter option
  type pos = OpamTypes.filename * int * int
  type value =
      Bool of OpamTypes.pos * bool
    | Int of OpamTypes.pos * int
    | String of OpamTypes.pos * string
    | Relop of OpamTypes.pos * OpamTypes.relop * OpamTypes.value *
        OpamTypes.value
    | Prefix_relop of OpamTypes.pos * OpamTypes.relop * OpamTypes.value
    | Logop of OpamTypes.pos * OpamTypes.logop * OpamTypes.value *
        OpamTypes.value
    | Pfxop of OpamTypes.pos * OpamTypes.pfxop * OpamTypes.value
    | Ident of OpamTypes.pos * string
    | List of OpamTypes.pos * OpamTypes.value list
    | Group of OpamTypes.pos * OpamTypes.value list
    | Option of OpamTypes.pos * OpamTypes.value * OpamTypes.value list
    | Env_binding of OpamTypes.pos * string * OpamTypes.value *
        OpamTypes.value
  type file_section = {
    section_kind : string;
    section_name : string;
    section_items : OpamTypes.file_item list;
  }
  and file_item =
      Section of OpamTypes.pos * OpamTypes.file_section
    | Variable of OpamTypes.pos * string * OpamTypes.value
  type file = {
    file_contents : OpamTypes.file_item list;
    file_name : string;
    file_format : OpamTypes.opam_version;
  }
  type switch = OpamSwitch.t
  type switch_set = OpamSwitch.Set.t
  type 'a switch_map = 'OpamSwitch.Map.t
  type lock =
      Read_lock of (unit -> unit)
    | Global_lock of (unit -> unit)
    | Switch_lock of (unit -> unit)
    | Global_with_switch_cont_lock of
        (unit -> OpamTypes.switch * (unit -> unit))
  type file_attribute = OpamFilename.Attribute.t
  type file_attribute_set = OpamFilename.Attribute.Set.t
  type 'a optional = { c : 'a; optional : bool; }
  type stats = {
    s_install : int;
    s_reinstall : int;
    s_upgrade : int;
    s_downgrade : int;
    s_remove : int;
  }
  type env = (string * string) list
  type env_updates = (string * string * string) list
  type tags = OpamMisc.StringSet.t OpamMisc.StringSetMap.t
  type checksums = string list
  type json = OpamJson.t
  type 'a updates = {
    created : 'a;
    updated : 'a;
    deleted : 'a;
    changed : 'a;
  }
end