sig
  type state = {
    partial : bool;
    root : OpamPath.t;
    switch : OpamTypes.switch;
    compiler : OpamTypes.compiler;
    compiler_version : OpamTypes.compiler_version;
    opams : OpamFile.OPAM.t OpamTypes.package_map;
    descrs : OpamFile.Descr.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;
    pinned : OpamFile.Pinned.t;
    installed : OpamFile.Installed.t;
    installed_roots : OpamFile.Installed_roots.t;
    reinstall : OpamFile.Reinstall.t;
    config : OpamFile.Config.t;
    repo_index : OpamFile.Repo_index.t;
  }
  val load_state : ?save_cache:bool -> string -> OpamState.state
  val rebuild_state_cache : unit -> unit
  val remove_state_cache : unit -> unit
  val print_stats : unit -> unit
  val load_repository_state : string -> OpamState.state
  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 :
    OpamState.state -> OpamTypes.user_config option -> unit
  val update_setup_interactive :
    OpamState.state -> OpamTypes.shell -> OpamTypes.filename -> unit
  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 update_env_variables : OpamState.state -> unit
  val contents_of_variable :
    OpamState.state -> OpamTypes.full_variable -> OpamTypes.variable_contents
  val substitute_string : OpamState.state -> string -> string
  val substitute_file : OpamState.state -> OpamTypes.basename -> unit
  val eval_filter : OpamState.state -> OpamTypes.filter option -> bool
  val filter_commands :
    OpamState.state -> OpamTypes.command list -> string list list
  val mem_repository : OpamState.state -> OpamTypes.package -> bool
  val with_repository :
    OpamState.state ->
    OpamTypes.package ->
    (OpamTypes.repository_root -> OpamTypes.repository -> 'a) -> 'a
  val mem_repository_name :
    OpamState.state -> OpamTypes.repository_name -> bool
  val find_repository_name :
    OpamState.state -> OpamTypes.repository_name -> OpamTypes.repository
  val string_of_repositories :
    OpamFile.Repo_config.t OpamTypes.repository_name_map -> string
  val package_repository_map :
    OpamState.state -> OpamTypes.repository OpamTypes.package_map
  val compiler_repository_map :
    OpamState.state ->
    (OpamTypes.filename * OpamTypes.filename option) OpamTypes.compiler_map
  val sorted_repositories : OpamState.state -> OpamTypes.repository list
  val compilers : root:OpamTypes.dirname -> OpamTypes.compiler_set
  val install_compiler :
    OpamState.state ->
    quiet:bool -> OpamTypes.switch -> OpamTypes.compiler -> unit
  val get_compiler_packages :
    OpamState.state -> OpamTypes.compiler -> OpamTypes.atom list
  val mem_installed_package_by_name :
    OpamState.state -> OpamTypes.name -> bool
  val find_installed_package_by_name :
    OpamState.state -> OpamTypes.name -> OpamTypes.package
  val mem_installed_package_by_name_aux :
    OpamTypes.package_set -> OpamTypes.name -> bool
  val find_installed_package_by_name_aux :
    OpamTypes.package_set -> 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 dot_config : OpamState.state -> OpamTypes.name -> OpamFile.Dot_config.t
  val opam : OpamState.state -> OpamTypes.package -> OpamFile.OPAM.t
  val compiler : OpamState.state -> OpamTypes.compiler -> OpamFile.Comp.t
  val check : OpamTypes.lock -> unit
  val is_pinned : OpamState.state -> OpamTypes.name -> bool
  val pinned_package : OpamState.state -> OpamTypes.name -> OpamTypes.package
  val pinned_path :
    OpamState.state -> OpamTypes.name -> OpamTypes.dirname option
  val update_pinned_package :
    OpamState.state -> OpamTypes.name -> OpamTypes.dirname OpamTypes.download
  val add_to_reinstall :
    OpamState.state -> all:bool -> OpamTypes.package_set -> unit
  val create_system_compiler_description :
    OpamTypes.dirname -> OpamTypes.compiler_version option -> unit
  val confirm : ('a, unit, string, bool) Pervasives.format4 -> 'a
  val check_base_packages : OpamState.state -> unit
  module Types :
    sig
      type t =
        OpamState.state = {
        partial : bool;
        root : OpamPath.t;
        switch : OpamTypes.switch;
        compiler : OpamTypes.compiler;
        compiler_version : OpamTypes.compiler_version;
        opams : OpamFile.OPAM.t OpamTypes.package_map;
        descrs : OpamFile.Descr.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;
        pinned : OpamFile.Pinned.t;
        installed : OpamFile.Installed.t;
        installed_roots : OpamFile.Installed_roots.t;
        reinstall : OpamFile.Reinstall.t;
        config : OpamFile.Config.t;
        repo_index : OpamFile.Repo_index.t;
      }
    end
  val update_hook :
    (save_cache:bool -> OpamTypes.repository_name list -> unit)
    Pervasives.ref
  val switch_reinstall_hook : (OpamTypes.switch -> unit) Pervasives.ref
end