Load_path(3)
🌸 Load_path(3) — the OCaml library page, bestie edition 🌸
hey bestie, this is the Load_path(3) page from the OCaml library. It’s giving “management of include directories,” and honestly? iconic. 💅
💖 NAME 💖
Load_path — Management of include directories. Short, sweet, slay. ✨
🧚 Module 🧚
Module Load_path
: sig end
✨ Documentation ✨
okay so Load_path is a high-level interface to locating files in the load path. That path is constructed from -I and -H command line flags and a few other parameters. It makes the assumption that the contents of include directories doesn’t change during the execution of the compiler. like, the module is assuming peace and stability during the compiler run — do not be swapping files mid-compile, bestie. 🫶
Here’s the whole cast, in order, no skips, no cap:
🎀 The values and types, in order 🎀
val add_dir : hidden:bool -> string -> unit— Add a directory to the end of the load path (i.e. at lowest priority.) lowest priority means it’s at the back of the line, no cuts.val remove_dir : string -> unit— Remove a directory from the load path.val reset : unit -> unit— Remove all directories.module Dir : sig end— yep, there’s aDirsubmodule, and its signature is literallysig end.
The callback type is:
type auto_include_callback = (Dir.t -> string -> string option) -> string -> string
It’s the type of callback functions for init ~auto_include. iykyk.
val no_auto_include : auto_include_callback— No automatic directory inclusion: misses in the load path raiseNot_foundas normal. so if it’s not there, it’s not there.val init : auto_include:auto_include_callback -> visible:string list -> hidden:string list -> unit—init ~visible ~hiddenis the same as:
reset ();
List.iter add_dir (List.rev hidden);
List.iter add_dir (List.rev visible)
val auto_include_otherlibs : (string -> unit) -> auto_include_callback—auto_include_otherlibs alertis a callback function to be passed toLoad_path.initand automatically adds-I +libto the load path after callingalert lib. automatic otherlibs glow-up, periodt.val get_path_list : unit -> string list— Return the list of directories passed toadd_dirso far.
The paths record is:
type paths = {
visible : string list ;
hidden : string list ;
}
val get_paths : unit -> paths— Return the directories passed toadd_dirso far.val find : string -> string— Locate a file in the load path. RaiseNot_foundif the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn’t contain a directory separator.val find_normalized : string -> string— Same asfind, but search also for normalized unit name (seeMisc.normalized_unit_filename), i.e. ifnameisFoo.ml, allow/path/Foo.mland/path/foo.mlto match. normalization ate, fr fr.
The visibility type is:
type visibility =
| Visible
| Hidden
val find_normalized_with_visibility : string -> string * visibility— Same asfind_normalized, but also reports whether thecmiwas found in a-Idirectory (Visible) or a-Hdirectory (Hidden). the receipts are included, bestie.val add : Dir.t -> unit— Deprecated. Old name forLoad_path.append_dir.
🚨 bestie,addis deprecated — it’s the old name forLoad_path.append_dir. Use the new name, okay? 💅
val append_dir : Dir.t -> unit—append_dir daddsdto the end of the load path (i.e. at lowest priority.)val prepend_dir : Dir.t -> unit—prepend_dir daddsdto the start of the load path (i.e. at highest priority.) main character energy: front of the line.val get_visible : unit -> Dir.t list— Same asget_paths (), except that it returns aDir.t list, and doesn’t include the-Hpaths. visible only, hidden girlies not invited to this list.
okay that’s the whole page, every value and type accounted for, no details left on read. 💖
kisses, this page was generated by OCamldoc on 2026-06-22, and it’s page Load_path(3) — bye bestie! 🎀🦋🌸💜
📦 where this page comes from
- arch rolling: ocaml 5.5.0-1 · LGPL2.1 AND custom: QPL-1.0
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms