package base
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ae7076435fb2b4e92b0a6a831ee76a2869b924a47d89ba3d5fc771aa8f54f66d
CHANGES.md.html
Release v0.16.0
Changes across many modules:
Replaced
Caml
withStdlib
. TheCaml
module predatedStdlib
and has been redundant for some time.Added support for local allocations. This is a nonstandard OCaml extension available at https://github.com/ocaml-flambda/ocaml-jst.
Support includes:
updating functions to accept
[@local]
arguments, especially closureslocal constructors, like
Array.create_local
andBytes.create_local
new versions of interfaces supporting
local
values, such asApplicative.S_local
[@@deriving globalize]
on some types, for converting local values to global values
Rename
Polymorphic_compare
submodules toComparisons
. The former was a misnomer. While the comparisons for a given type are meant to replace polymorphic compare operators, they are not polymorphic themselves.Added
Container.S_with_creators
andIndexed_container.S_with_creators
. Used these in container modules such asArray
,List
, andString
. These interfaces standardize functions likemap
andfilter
. Along the way, refactored module types inContainer
andIndexed_container
.In signatures for
fold*
functions, renamed accumulator type variables to'acc
for improved readability.Added
of_string_opt
toInt_intf.S
.Added
dequeue_and_ignore_exn
toQueue_intf.S
.
Changes to individual modules:
Bool
: addedselect
, a primitive usingCMOV
on architectures that support it.Comparable
:Added
'a reversed
andcompare_reversed
, to support deriving inverted comparisons, e.g.:[%compare: My_type.t Comparable.reversed]
Added
Derived2_phantom
, similar toDerived_phantom
.Made
Derived*.comparator_witness
types injective.
Float
:Added hyperbolic trig functions
acosh
,asinh
, andatanh
toFloat
.Added
Float.of_string_opt
.
Hash_set
: Madet
injective.Hashtbl
:Added
choose_randomly
andchoose_randomly_exn
.Made
Hashtbl.t
injective.
Lazy
: Addedpeek
, extracting an already-forced value if present.Map
:Added
split_le_gt
,split_lt_ge
, andtranspose_keys
.Added
Make_applicative_traversals
, allowing some applicatives to improve performance when operating on maps.Corrected documentation of performance for
filter*
functions.Refactored module types in
map_intf.ml
. Among other changes, propagated~comparator
argument slightly differently to allow expressing type oftranspose_keys
properly.
Monad
: Documented performance characteristics ofIdent
.Option
: Deprecated functions fromContainer
but not particularly useful for options.Ppx_compare_lib
: Removed primitive functions;ppx_compare
now explicitly refers to these viaStdlib
.Sequence
: ChangedStep.t
variant type to use inlined records.Set
:Added
of_tree
,to_tree
,split_le_gt
, andsplit_lt_ge
.Created a single shared
'a Named.t
type toset_intf.ml
, rather than using a new type in every instance ofAccessors
.Made
Set.t
injective in both type arguments.Refactored module types in
set_intf.ml
.
Sexpable
:Of_stringable
now providest_sexp_grammar
.Sign
andSign_or_nan
: Addedto_string_hum
.Stack
: addedfilter
,filter_inplace
, andfilter_map
.String
: addedconcat_lines
,pad_left
,pad_right
, andunsafe_sub
Sys
: addedopaque_identity_global
, which forces its argument to be globally allocated.Type_equal
:Id.Uid
now implementsIdentifiable.S
Uniform_array
: addsort
Old pre-v0.15 changelogs (very likely stale and incomplete)
git version
Renamed
Result.ok_fst
toResult.to_either
(old name remains as deprecated alias). Added analogousResult.of_either
function.Removed deprecated values
Array.truncate
,{Obj_array, Uniform_array}.unsafe_truncate
,Result.ok_unit
,{Result, Or_error}.ignore
.Changed the signature of
Hashtbl.equal
to take the data equality function first, allowing it to be used with[%equal: t]
.Remove deprecated function
List.dedup
.Remove deprecated string mutation functions from the
String
module.Removed deprecated function
Monad.all_ignore
in favor ofMonad.all_unit
.Deprecated
Or_error.ignore
andResult.ignore
in favor ofOr_error.ignore_m
andResult.ignore_m
.Ordered_collection_common.get_pos_len
now returns anOr_error.t
Added
Bool.Non_short_circuiting
.Added
Float.square
.Remove module
Or_error.Ok
.module
Ref
doesn't implementContainer.S1
anymore.Rename parameter of
Sequence.merge
fromcmp
tocompare
.Added
Info.of_lazy_t
Added
List.partition_result
function, to partition a list ofResult.t
valuesChanged the signature of
equal
from'a t -> 'a t -> equal:('a -> 'a -> bool) -> bool
to('a -> 'a -> bool) -> 'a t -> 'a t -> bool
.Optimized
Lazy.compare
to check physical equality before forcing the lazy values.Deprecated
Args
in theApplicative
interface in favor of usingppx_let
.Deprecated
Array.replace arr i ~f
in favor of usingarr.(i) <- (f (arr.(i)))
Rename collection length parameter of
Ordered_collection_common
functions fromlength
tototal_length
, and add a unit argument toget_pos_len
andget_pos_len_exn
.Removed functions that were deprecated in 2016 from the
Array
andSet
modules.Int.Hex.of_string
and friends no longer silently ignore a suffix of non-hexadecimal garbage.Added
?backtrace
argument toOr_error.of_exn_result
.List.zip
now returns aList.Or_unequal_lengths.t
instead of anoption
.Remove functions from the
Sequence
module that were deprecated in 2015.Container.Make
andContainer.Make0
now require callers to either provide a customlength
function or request that one be derived fromfold
.Container.to_array
's signature is also changed to acceptlength
anditer
instead offold
.Exposed module
Int_math
.
v0.11
Deprecated
Not_found
, people who need it can useCaml.Not_found
, but its use isn't recommended.Added the
Sexp.Not_found_s
exception which will replaceCaml.Not_found
as the default exception in a future release.Document that
Array.find_exn
,Array.find_map_exn
, andArray.findi_exn
may throwCaml.Not_found
orNot_found_s
.Document that
Hashtbl.find_exn
may throwCaml.Not_found
orNot_found_s
.Document that
List.find_exn
, andList.find_map_exn
may throwCaml.Not_found
orNot_found_s
.Document that
List.find_exn
may throwCaml.Not_found
orNot_found_s
.Document that
String.lsplit2_exn
, andString.rsplit2_exn
may throwCaml.Not_found
orNot_found_s
.Added
Sys.backend_type
.Removed unnecessary unit argument from
Hashtbl.create
.Removed deprecated operations from
Hashtbl
.Removed
Hashable.t
constructors fromHashtbl
andHash_set
, instead favoring the first-class module constructors.Removed
Container
operations fromEither.First
andEither.Second
.Changed the type of
fold_until
in theContainer
interfaces. Rather than returning aFinished_or_stopped_early.t
(which has also been removed), the function now takes afinish
function that will be applied the result iff
never returned aStop _
.Removed the
String_dict
module.Added a
Queue
module that is backed by anOption_array
for efficient and (non-allocating) implementations of most operations.Added a
Poly
submodule toMap
andSet
that exposes constructors that use polymorphic compare.Deprecated
all_ignore
in theMonad
andApplicative
interfaces in favor ofall_unit
.Deprecated
Array.replace_all
in favor ofArray.map_inplace
, which is the standard name for that sort of operation within Base.Document that
List.find_exn
, andList.find_map_exn
may throwCaml.Not_found
orNot_found_s
.Make
~compare
a required argument toList.dedup_and_sort
,List.dedup
,List.find_a_dup
,List.contains_dup
, andList.find_all_dups
.Removed
List.exn_if_dup
. It is still available in core_kernel.Removed "normalized" index operation
List.slice
. It is still available in core_kernel.Remove "normalized" index operations from
Array
, which inclucedArray.normalize
,Array.slice
,Array.nget
andArray.nset
. These operations are still available in core_kernel.Added
Uniform_array
module that is just like anArray
except guarantees that the representation array is not tagged withDouble_array_tag
, the tag for float arrays.Added
Option_array
module that allows for a compact representation of'a optoin array
, which avoids allocating heap objects representingSome a
.Remove "normalized" index operations from
String
, which inclucedString.normalize
,String.slice
,String.nget
andString.nset
. These operations are still available in core_kernel.Added missing conversions between
Int63
and other integer types, specifically, the versions that return options.Added truncating versions of integer conversions, with a suffix of
_trunc
. These allow fast conversions via bit arithmetic without any conditional failure; excess bits beyond the width of the output type are simply dropped.Added
Sequence.group
, similar toList.group
.Reimplemented
String.Caseless.compare
so that it does not allocate.Added
String.is_substring_at string ~pos ~substring
. Used it as back-end foris_suffix
andis_prefix
.Moved all remaining
Replace_polymorphic_compare
submodules from Base types and consolidated them in one place withinImport0
.Removed
(<=.)
and its friends.Added
Sys.argv
.Added a infix exponentation operator for int.
Added a
Formatter
module to reexport theFormat.formatter
type and updated the deprecation message forFormat
.
v0.10
(Changes that can break existing programs are marked with a "*")
Bugfixes
Generalized the type of
Printf.ifprintf
to reflect OCaml's stdlib.Made
Sequence.fold_m
anditer_m
respectSkip
steps and explicitly bind when they occur.Changed
Float.is_negative
andis_non_positive
onNaN
to returnfalse
rather thantrue
.Fixed the
Validate.protect
function, which was mistakenly raising exceptions.
API changes
Renamed
Map.add
asset
, and deprecatedadd
. A later feature will addadd
andadd_exn
in the style ofHashtbl
.A different hash function is used to implement
Base.Int.hash
. The old implementation wasInt.abs
but collision resistance is not enough, we want avalanching as well. The new function is an adaptation of one of the Thomas Wang hash functions to OCaml (63-bit integers), which results in reasonably good avalanching.Made
open Base
expose infix float operators (+., -., etc.).
Renamed
List.dedup
toList.dedup_and_sort
, to better reflect its existing behavior.
Added
Hashtbl.find_multi
andMap.find_multi
.Added function
Map.of_increasing_sequence
for constructing aMap.t
from an orderedSequence.t
Added function
List.chunks_of : 'a t -> length : int -> 'a t t
, for breaking a list into chunks of equal length.Add to module
Random
numeric functions that take upper and lower inclusive bounds, e.g.Random.int_incl : int -> int -> int
.
Replaced
Exn.Never_elide_backtrace
withBacktrace.elide
, aref
cell that determines whetherBacktrace.to_string
andBacktrace.sexp_of_t
elide backtraces.
Exposed infix operator
Base.( @@ )
.Exposed modules
Base.Continue_or_stop
andFinished_or_stopped_early
, used with theContainer.fold_until
function.Exposed module types Base.T, T1, T2, and T3.
Added
Sequence.Expert
functionsnext_step
anddelayed_fold_step
, for clients that want to explicitly handleSkip
steps.Added
Bytes
module. This includes the submodulesFrom_string
andTo_string
with blit functions. N.B. the signature (and name) ofunsafe_to_string
andunsafe_of_string
are different from the one in the standard library (and hopefully more explicit).Add bytes functions to
Buffer
. Also addedBuffer.content_bytes
, the analog ofcontents
but that returnsbytes
rather thanstring
.
Enabled
-safe-string
.
Added function
Int63.of_int32
, which was missing.
Deprecated a number of
String
mutating functions.
Added module
Obj_array
, moved in fromCore_kernel
.
In module type
Hashtbl.Accessors
, removed deprecated functions, moving them into a new module type,Deprecated
.
Exported
sexp_*
types that are recognized byppx_sexp_*
converters:sexp_array
,sexp_list
,sexp_opaque
,sexp_option
.
Reworked the
Or_error
module's interface, moving theContainer.S
interface to anOk
submodule, and adding functionsis_ok
,is_error
, andok
to more closely resemble the interface of theResult
module.
Removed
Int.O.of_int_exn
.Exposed
Base.force
function.Changed the deprecation warning for
mod
to recommend( % )
rather thanCaml.( mod )
.
Performance related changes
Optimized
List.compare
, removing its closure allocation.Optimized
String.mem
to not allocate.Optimized
Float.is_negative
,is_non_negative
,is_positive
, andis_non_positive
to avoid some boxing.Changed
Hashtbl.merge
to relax its equality check on the input tables'Hashable.t
records, checking physical equality componentwise if the records aren't physically equal.Added
Result.combine_errors
, similar toOr_error.combine_errors
, with a slightly different type.Added
Result.combine_errors_unit
, similar toOr_error.combine_errors_unit
.Optimized the
With_return.return
type by adding the[@@unboxed]
attribute.Improved a number of deprecation warnings.
v0.9
Initial release.