Legend:
Library
Module
Module type
Parameter
Class
Class type
This module is the toplevel of the Base library; it's what you get when you write open Base.
The recommended way to use Base is to build with -open Base. Files compiled this way will have the environment described in this file as their initial environment.
Base extends some modules and data structures from the standard library, like Array, Buffer, Bytes, Char, Hashtbl, Int32, Int64, Lazy, List, Map, Nativeint, Printf, Random, Set, String, Sys, and Uchar. One key difference is that Base doesn't use exceptions as much as the standard library and instead makes heavy use of the Result type, as in:
type ('a,'b) result = Ok of 'a | Error of 'b
Base also adds entirely new modules, most notably:
Comparable, Comparator, and Comparisons in lieu of polymorphic compare.
Container, which provides a consistent interface across container-like data structures (arrays, lists, strings).
Result, Error, and Or_error, supporting the or-error pattern.
Broadly the goal of Base is both to be a more complete standard library, with richer APIs, and to be more consistent in its design. For instance, in the standard library some things have modules and others don't; in Base, everything is a module.
This module defines signatures that are to be included in other signatures to ensure a consistent interface to equal functions. There is a signature (S, S1, S2, S3) for each arity of type. Usage looks like:
Provides generic signatures for containers that support indexed iteration (iteri, foldi, ...). In principle, any container that has iter can also implement iteri, but the idea is that Indexed_container_intf should be included only for containers that have a meaningful underlying ordering.
This module defines signatures that are to be included in other signatures to ensure a consistent interface to invariant-style functions. There is a signature (S, S1, S2, S3) for each arity of type. Usage looks like:
Immutable, singly-linked lists, giving fast access to the front of the list, and slow (i.e., O(n)) access to the back of the list. The comparison functions on lists are lexicographic.
A monad is an abstraction of the concept of sequencing of computations. A value of type 'a monad represents a computation that returns a value of type 'a.
'a Option_array.t is a compact representation of 'a option array: it avoids allocating heap objects representing Some x, usually representing them with x instead. It uses a special representation for None that's guaranteed to never collide with any representation of Some x.
Poly is a convenient shorthand for Polymorphic_compare in the common case that one wants to use a polymorphic comparator directly in an expression, e.g., Poly.equal a
b.
Provides functors for making modules sexpable. New code should use the [@@deriving
sexp] syntax directly. These module types (S, S1, S2, and S3) are exported for backwards compatibility only.
This module defines various abstract interfaces that are convenient when one needs a module that matches a bare signature with just a type. This sometimes occurs in functor arguments and in interfaces.
The purpose of Type_equal is to represent type equalities that the type checker otherwise would not know, perhaps because the type equality depends on dynamic data, or perhaps because the type system isn't powerful enough.
Exporting the ad-hoc types that are recognized by ppx_sexp_* converters. sexp_array, sexp_list, and sexp_option allow a record field to be absent when converting from a sexp, and if absent, the field will take a default value of the appropriate type: