module FindlibUnits

: sig

FindlibUnits provides compilation unit inference queries for findlib packages.


module Map : Map.S with type key = string

A basic map with string keys

module Set : Set.S with type elt = string

A basic set of strings

type state = {
# sublibraries_of_package
: Set.t Map.t;
# packages_of_dir
: Set.t Map.t;

A snapshot of some findlib state

type source =
# | Archive of string
# | Meta
# | Path

The source of the inference that a unit belongs to a findlib package

type u = {
# name
: string;(*The name of the module the compilation unit represents*)
# path
: string;(*The path where the compilation unit is found*)
# cmi
: string;(*The filename of the cmi containing the unit*)
# source
: source;(*The means by which the unit's membership was inferred*)

An identified compilation unit

type t = u Map.t Map.t

A map from findlib package names to unit names to units


Note: if multiple top-level packages share an installation directory, only those units which can be found through archives or META files are included and no paths will be searched. This means that these queries may miss certain units such as those that describe module interfaces with only types and lack .ml implementations. In the case of subpackages, loose .cmi files are associated to the top-level package.

val state : unit -> state

state () is a snapshot of some of the current findlib state.

val of_package_only : state -> string -> u Map.t

of_package_only state name is a map of unit names to units for a findlib package. A state value is required to disambiguate packages that share the same directory.

val of_package : state -> string -> t

of_package state name is a map of findlib package names to unit names to units. All packages with name as self or an ancestor are included with their full names. The subpackage search is based on state which may be generated by state.

val all : state -> t

all state is a map of findlib packages to unit names to units.