include BaseThis 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 'bBase 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.
module Applicative = Base.Applicativemodule Array = Base.Arraymodule Avltree = Base.Avltreemodule Backtrace = Base.Backtracemodule Binary_search = Base.Binary_searchmodule Binary_searchable = Base.Binary_searchablemodule Blit = Base.Blitmodule Bool = Base.Boolmodule Buffer = Base.Buffermodule Bytes = Base.Bytesmodule Char = Base.Charmodule Commutative_group = Base.Commutative_groupmodule Comparable = Base.Comparablemodule Comparator = Base.Comparatormodule Comparisons = Base.Comparisonsmodule Container = Base.Containermodule Either = Base.Eithermodule Equal = Base.Equalmodule Error = Base.Errormodule Exn = Base.Exnmodule Field = Base.Fieldmodule Float = Base.Floatmodule Floatable = Base.Floatablemodule Fn = Base.Fnmodule Formatter = Base.Formattermodule Hash = Base.Hashmodule Hash_set = Base.Hash_setmodule Hashable = Base.Hashablemodule Hasher = Base.Hashermodule Hashtbl = Base.Hashtblmodule Heap_block = Base.Heap_blockmodule Identifiable = Base.Identifiablemodule Indexed_container = Base.Indexed_containermodule Info = Base.Infomodule Int = Base.Intmodule Int32 = Base.Int32module Int63 = Base.Int63module Int64 = Base.Int64module Intable = Base.Intablemodule Invariant = Base.Invariantmodule Lazy = Base.Lazymodule List = Base.Listmodule Map = Base.Mapmodule Maybe_bound = Base.Maybe_boundmodule Monad = Base.Monadmodule Nativeint = Base.Nativeintmodule Option = Base.Optionmodule Option_array = Base.Option_arraymodule Or_error = Base.Or_errormodule Ordered_collection_common = Base.Ordered_collection_commonmodule Ordering = Base.Orderingmodule Poly = Base.PolyPoly 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.
module Polymorphic_compare = Base.Polymorphic_comparemodule Popcount = Base.Popcountmodule Pretty_printer = Base.Pretty_printermodule Printf = Base.Printfmodule Linked_queue = Base.Linked_queuemodule Queue = Base.Queuemodule Random = Base.Randommodule Ref = Base.Refmodule Result = Base.Resultmodule Sequence = Base.Sequencemodule Set = Base.Setmodule Sexpable = Base.Sexpablemodule Sign = Base.Signmodule Source_code_position = Base.Source_code_positionmodule Staged = Base.Stagedmodule String = Base.Stringmodule Stringable = Base.Stringablemodule Sys = Base.Sysmodule T = Base.Tmodule Type_equal = Base.Type_equalmodule Uniform_array = Base.Uniform_arraymodule Unit = Base.Unitmodule Uchar = Base.Ucharmodule Validate = Base.Validatemodule Variant = Base.Variantmodule With_return = Base.With_returnmodule Word_size = Base.Word_sizeinclude TThis 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.
module type T : sig ... endmodule type T1 : sig ... endmodule type T2 : sig ... endmodule type T3 : sig ... endmodule Sexp = Base.Sexpmodule Export = Base.Exportinclude Exportval hash_fold_bool : Hash.state ‑> bool ‑> Hash.stateval hash_bool : bool ‑> Hash.hash_valueval hash_fold_char : Hash.state ‑> char ‑> Hash.stateval hash_char : char ‑> Hash.hash_valueval hash_fold_float : Hash.state ‑> float ‑> Hash.stateval hash_float : float ‑> Hash.hash_valueval hash_fold_int : Hash.state ‑> int ‑> Hash.stateval hash_int : int ‑> Hash.hash_valueval hash_fold_int32 : Hash.state ‑> int32 ‑> Hash.stateval hash_int32 : int32 ‑> Hash.hash_valueval hash_fold_int64 : Hash.state ‑> int64 ‑> Hash.stateval hash_int64 : int64 ‑> Hash.hash_valueval hash_fold_list : a. (Hash.state ‑> 'a ‑> Hash.state) ‑> Hash.state ‑> 'a list ‑> Hash.stateval hash_fold_nativeint : Hash.state ‑> nativeint ‑> Hash.stateval hash_nativeint : nativeint ‑> Hash.hash_valueval hash_fold_option : a. (Hash.state ‑> 'a ‑> Hash.state) ‑> Hash.state ‑> 'a option ‑> Hash.stateval hash_fold_string : Hash.state ‑> string ‑> Hash.stateval hash_string : string ‑> Hash.hash_valueval hash_fold_unit : Hash.state ‑> unit ‑> Hash.stateval hash_unit : unit ‑> Hash.hash_valueFormat stuff
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:
sexp_array [||]
sexp_bool false
sexp_list []
sexp_option Nonesexp_opaque causes the conversion to sexp to produce the atom <opaque>.
For more documentation, see sexplib/README.md.
List operators
include List.Infixval (@) : 'a Base__List.t ‑> 'a Base__List.t ‑> 'a Base__List.tInt operators and comparisons
include Int.OA sub-module designed to be opened to make working with ints more convenient.
Float operators
include Float.O_dotSimilar to O, except that operators are suffixed with a dot, allowing one to have
both int and float operators in scope simultaneously.
Similar to O, except that operators are suffixed with a dot, allowing one to have
both int and float operators in scope simultaneously.
val (+.) : Base.Float.t ‑> Base.Float.t ‑> Base.Float.tval (-.) : Base.Float.t ‑> Base.Float.t ‑> Base.Float.tval (*.) : Base.Float.t ‑> Base.Float.t ‑> Base.Float.tval (/.) : Base.Float.t ‑> Base.Float.t ‑> Base.Float.tval (**.) : Base.Float.t ‑> Base.Float.t ‑> Base.Float.tval (~-.) : Base.Float.t ‑> Base.Float.texternal (|>) : 'a ‑> ('a ‑> 'b) ‑> 'b = "%revapply" Reverse application operator. x |> g |> f is equivalent to f (g (x)).
external (@@) : ('a ‑> 'b) ‑> 'a ‑> 'b = "%apply" Application operator. g @@ f @@ x is equivalent to g (f (x)).
Boolean operations
external ignore : _ ‑> unit = "%ignore" Reference operations
external (!) : 'a ref ‑> 'a = "%field0" external ref : 'a ‑> 'a ref = "%makemutable" Pair operations
Exceptions stuff
val raise_s : Sexp.t ‑> 'aMisc
external force : 'a Lazy.t ‑> 'a = "%lazy_force" module Continue_or_stop = Base__.Container_intf.Export.Continue_or_stopContinue_or_stop.t is used by the f argument to fold_until in order to
indicate whether folding should continue, or stop early.
exception Not_found_s of Sexplib0.Sexp.tmodule Not_exposed_properly = Base.Not_exposed_properly