sig
  module Types :
    sig
      type t = {
        partial : bool;
        root : OpamPath.t;
        switch : OpamTypes.switch;
        compiler : OpamTypes.compiler;
        compiler_version : OpamTypes.compiler_version lazy_t;
        opams : OpamFile.OPAM.t OpamTypes.package_map;
        repositories : OpamFile.Repo_config.t OpamTypes.repository_name_map;
        packages : OpamTypes.package_set;
        available_packages : OpamTypes.package_set Lazy.t;
        aliases : OpamFile.Aliases.t;
        compilers : OpamTypes.compiler_set;
        pinned : OpamFile.Pinned.t;
        installed : OpamFile.Installed.t;
        installed_roots : OpamFile.Installed_roots.t;
        reinstall : OpamFile.Reinstall.t;
        config : OpamFile.Config.t;
        package_index : OpamFile.Package_index.t;
        compiler_index : OpamFile.Compiler_index.t;
      }
    end
  type state = OpamState.Types.t
  val load_state : ?save_cache:bool -> string -> OpamState.state
  val rebuild_state_cache : unit -> unit
  val remove_state_cache : unit -> unit
  val load_env_state : string -> OpamState.state
  val universe :
    OpamState.state -> OpamTypes.user_action -> OpamTypes.universe
  val get_full_env : OpamState.state -> OpamTypes.env
  val get_opam_env : OpamState.state -> OpamTypes.env
  val add_to_env :
    OpamState.state ->
    OpamTypes.env -> (string * string * string) list -> OpamTypes.env
  val print_env_warning_at_init :
    OpamState.state -> OpamTypes.user_config -> unit
  val print_env_warning_at_switch : OpamState.state -> unit
  val update_setup_interactive :
    OpamState.state -> OpamTypes.shell -> OpamTypes.filename -> bool
  val display_setup :
    OpamState.state -> OpamTypes.shell -> OpamTypes.filename -> unit
  val update_setup :
    OpamState.state ->
    OpamTypes.user_config option -> OpamTypes.global_config option -> unit
  val contents_of_variable :
    OpamState.state ->
    OpamTypes.variable_map ->
    OpamTypes.full_variable -> OpamTypes.variable_contents option
  val contents_of_variable_exn :
    OpamState.state ->
    OpamTypes.variable_map ->
    OpamTypes.full_variable -> OpamTypes.variable_contents
  val substitute_string :
    OpamState.state -> OpamTypes.variable_map -> string -> string
  val substitute_file :
    OpamState.state -> OpamTypes.variable_map -> OpamTypes.basename -> unit
  val eval_filter :
    OpamState.state ->
    OpamTypes.variable_map -> OpamTypes.filter option -> bool
  val filter_commands :
    OpamState.state ->
    OpamTypes.variable_map -> OpamTypes.command list -> string list list
  val opam : OpamState.state -> OpamTypes.package -> OpamFile.OPAM.t
  val opam_opt :
    OpamState.state -> OpamTypes.package -> OpamFile.OPAM.t option
  val url : OpamState.state -> OpamTypes.package -> OpamFile.URL.t option
  val descr : OpamState.state -> OpamTypes.package -> OpamFile.Descr.t
  val descr_opt :
    OpamState.state -> OpamTypes.package -> OpamFile.Descr.t option
  val files :
    OpamState.state -> OpamTypes.package -> OpamTypes.dirname option
  val compiler_comp :
    OpamState.state -> OpamTypes.compiler -> OpamFile.Comp.t
  val string_of_repositories :
    OpamFile.Repo_config.t OpamTypes.repository_name_map -> string
  val package_index :
    OpamState.state ->
    (OpamTypes.repository_name * string option) OpamTypes.package_map
  val compiler_index :
    OpamState.state ->
    (OpamTypes.repository_name * string option) OpamTypes.compiler_map
  val sorted_repositories : OpamState.state -> OpamTypes.repository list
  val mem_repository : OpamState.state -> OpamTypes.repository_name -> bool
  val find_repository :
    OpamState.state -> OpamTypes.repository_name -> OpamTypes.repository
  val find_repository_opt :
    OpamState.state ->
    OpamTypes.repository_name -> OpamTypes.repository option
  val redirect :
    OpamState.state ->
    OpamTypes.repository ->
    (OpamTypes.repository * OpamTypes.filter option) option
  val install_global_config : OpamTypes.dirname -> OpamTypes.switch -> unit
  val install_compiler :
    OpamState.state ->
    quiet:bool -> OpamTypes.switch -> OpamTypes.compiler -> unit
  val update_switch_config : OpamState.state -> OpamTypes.switch -> unit
  val get_compiler_packages :
    OpamState.state -> OpamTypes.compiler -> OpamTypes.atom list
  val is_compiler_installed : OpamState.state -> OpamTypes.compiler -> bool
  val is_switch_installed : OpamState.state -> OpamTypes.switch -> bool
  val compiler_state :
    OpamState.state -> OpamTypes.checksums OpamTypes.compiler_map
  val compiler_repository_state :
    OpamState.state -> OpamTypes.checksums OpamTypes.compiler_map
  val repository_and_prefix_of_compiler :
    OpamState.state ->
    OpamTypes.compiler -> (OpamTypes.repository * string option) option
  val is_name_installed : OpamState.state -> OpamTypes.name -> bool
  val is_package_installed : OpamState.state -> OpamTypes.package -> bool
  val find_installed_package_by_name :
    OpamState.state -> OpamTypes.name -> OpamTypes.package
  val find_packages_by_name :
    OpamState.state -> OpamTypes.name -> OpamTypes.package_set option
  val installed_map : OpamState.state -> OpamTypes.version OpamTypes.name_map
  val base_packages : OpamTypes.name list
  val all_installed : OpamState.state -> OpamTypes.package_set
  val installed_versions :
    OpamState.state ->
    OpamTypes.name -> OpamTypes.switch list OpamTypes.package_map
  val download_archive :
    OpamState.state -> OpamTypes.package -> OpamTypes.filename option
  val download_upstream :
    OpamState.state ->
    OpamTypes.package -> OpamTypes.dirname -> OpamTypes.generic_file option
  val package_state :
    OpamState.state -> OpamTypes.checksums OpamTypes.package_map
  val package_partial_state :
    OpamState.state ->
    OpamTypes.package -> archive:bool -> bool * OpamTypes.checksums
  val package_repository_state :
    OpamState.state -> OpamTypes.checksums OpamTypes.package_map
  val package_repository_partial_state :
    OpamState.state ->
    OpamTypes.package -> archive:bool -> bool * OpamTypes.checksums
  val repository_of_package :
    OpamState.state -> OpamTypes.package -> OpamTypes.repository option
  val repository_and_prefix_of_package :
    OpamState.state ->
    OpamTypes.package -> (OpamTypes.repository * string option) option
  val add_to_reinstall :
    OpamState.state -> all:bool -> OpamTypes.package_set -> unit
  val copy_files :
    OpamState.state -> OpamTypes.package -> OpamTypes.dirname -> unit
  val install_metadata : OpamState.state -> OpamTypes.package -> unit
  val remove_metadata : OpamState.state -> OpamTypes.package_set -> unit
  val dev_packages : OpamState.state -> OpamTypes.package_set
  val update_dev_packages : OpamState.state -> OpamTypes.package_set
  val is_dev_package : OpamState.state -> OpamTypes.package -> bool
  val dot_config : OpamState.state -> OpamTypes.name -> OpamFile.Dot_config.t
  val check : OpamTypes.lock -> unit
  val is_pinned : OpamState.state -> OpamTypes.name -> bool
  val is_locally_pinned : OpamState.state -> OpamTypes.name -> bool
  val pinning_version :
    OpamState.state -> OpamTypes.package -> OpamTypes.package
  val url_of_locally_pinned_package :
    OpamState.state -> OpamTypes.name -> OpamFile.URL.t
  val repository_of_locally_pinned_package :
    OpamState.state -> OpamTypes.name -> OpamTypes.repository
  val overlay_of_name :
    OpamState.state -> OpamTypes.name -> OpamTypes.package
  val add_opam_overlay :
    OpamState.state -> OpamTypes.package -> OpamFile.OPAM.t -> unit
  val add_url_overlay :
    OpamState.state -> OpamTypes.package -> OpamFile.URL.t -> unit
  val add_descr_overlay :
    OpamState.state -> OpamTypes.package -> OpamFile.Descr.t -> unit
  val add_files_overlay :
    OpamState.state ->
    OpamTypes.package -> OpamTypes.dirname -> OpamTypes.filename list -> unit
  val add_pinned_overlay : OpamState.state -> OpamTypes.name -> unit
  val remove_overlay : OpamState.state -> OpamTypes.package -> unit
  val create_system_compiler_description :
    OpamTypes.dirname -> OpamTypes.compiler_version option -> unit
  val jobs : OpamState.state -> int
  val confirm : ('a, unit, string, bool) Pervasives.format4 -> 'a
  val check_base_packages : OpamState.state -> unit
  val switch_reinstall_hook : (OpamTypes.switch -> unit) Pervasives.ref
  val fix_descriptions_hook :
    (?save_cache:bool -> OpamState.state -> verbose:bool -> unit)
    Pervasives.ref
end