diff --git a/CHANGELOG.md b/CHANGELOG.md index 357c8dba..21485845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## 0.12 + +### breaking + +- change type of `CCString.blit` so it writes into `Bytes.t` +- better default opening flags for `CCIO.with_{in, out}` + +### non-breaking + +note: use of `containers.io` is deprecated (its only module has moved to `containers`) + +- add `CCString.mem` +- add `CCString.set` for updating immutable strings +- add `CCList.cons` function +- enable `-safe-string` on the project; fix `-safe-string` issues +- move `CCIO` from `containers.io` to `containers`, add dummy module in `containers.io` +- add `CCIO.read_all_bytes`, reading a whole file into a `Bytes.t` +- add `CCIO.with_in_out` to read and write a file +- add `CCArray1` in containers.bigarray, a module on 1-dim bigarrays (experimental) +- add module `CCGraph` in `containers.data`, a simple graph abstraction similar to `LazyGraph` +- add a lot of string functions in `CCString` +- add `CCError.catch`, in prevision of the future standard `Result.t` type +- add `CCError.Infix` module +- add `CCHashconsedSet` in `containers.data` (set with maximal struct sharing) + +- fix: use the proper array module in `CCRingBuffer` +- bugfix: `CCRandom.float_range` + ## 0.11 - add `CCList.{remove,is_empty}` diff --git a/_oasis b/_oasis index d39a25cd..0afbb4d2 100644 --- a/_oasis +++ b/_oasis @@ -1,6 +1,6 @@ OASISFormat: 0.4 Name: containers -Version: 0.11 +Version: 0.12 Homepage: https://github.com/c-cube/ocaml-containers Authors: Simon Cruanes License: BSD-2-clause @@ -18,8 +18,9 @@ Description: extend the stdlib (e.g. CCList provides safe map/fold_right/append, and additional functions on lists). - It also features an optional library for dealing with strings, and a `misc` - library full of experimental ideas (not stable, not necessarily usable). + It also features optional libraries for dealing with strings, helpers for unix, + threads, lwt and a `misc` library full of experimental ideas (not stable, not + necessarily usable). Flag "misc" Description: Build the misc library, with experimental modules still susceptible to change diff --git a/src/bigarray/CCArray1.mli b/src/bigarray/CCArray1.mli index 62643361..1a6dab57 100644 --- a/src/bigarray/CCArray1.mli +++ b/src/bigarray/CCArray1.mli @@ -26,8 +26,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (** {1 Bigarrays of dimension 1} - {b status: unstable} - @since NEXT_RELEASE *) + {b status: experimental} + @since 0.12 *) (** {2 used types} *) diff --git a/src/core/CCError.ml b/src/core/CCError.ml index 1d56ba6b..47498964 100644 --- a/src/core/CCError.ml +++ b/src/core/CCError.ml @@ -52,9 +52,6 @@ let fail_printf format = (* TODO: easy ways to print backtrace/stack *) -(* TODO: something of type [ ('a -> 'b) -> ('err -> 'b) -> ('a, 'err) t -> 'b] - to make it easier to switch into a regular variant if it happens *) - let _printers = ref [] let register_printer p = _printers := p :: !_printers diff --git a/src/core/CCError.mli b/src/core/CCError.mli index dac93dc1..072ecc96 100644 --- a/src/core/CCError.mli +++ b/src/core/CCError.mli @@ -81,7 +81,7 @@ val catch : ('a, 'err) t -> ok:('a -> 'b) -> err:('err -> 'b) -> 'b This is useful for code that does not want to depend on the exact definition of [('a, 'b) t] used, for instance once OCaml gets a standard [Result.t] type. - @since NEXT_RELEASE *) + @since 0.12 *) val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t @@ -130,7 +130,7 @@ val (<*>) : ('a -> 'b, 'err) t -> ('a, 'err) t -> ('b, 'err) t (** {2 Infix} - @since NEXT_RELEASE *) + @since 0.12 *) module Infix : sig val (>|=) : ('a, 'err) t -> ('a -> 'b) -> ('b, 'err) t diff --git a/src/core/CCIO.mli b/src/core/CCIO.mli index e4633952..79a8ce64 100644 --- a/src/core/CCIO.mli +++ b/src/core/CCIO.mli @@ -55,7 +55,7 @@ Examples: @since 0.6 -@before NEXT_RELEASE was in 'containers.io', now moved into 'containers' +@before 0.12 was in 'containers.io', now moved into 'containers' *) @@ -92,7 +92,7 @@ val read_all : ?size:int -> in_channel -> string val read_all_bytes : ?size:int -> in_channel -> Bytes.t (** Read the whole channel into a mutable byte array @param size the internal buffer size - @since NEXT_RELEASE *) + @since 0.12 *) (** {6 Output} *) @@ -125,7 +125,7 @@ val with_in_out : ?mode:int -> ?flags:open_flag list -> string -> (in_channel -> out_channel -> 'a) -> 'a (** Combines {!with_in} and {!with_out}. @param flags opening flags (default [[Open_creat]]) - @since NEXT_RELEASE *) + @since 0.12 *) (** {2 Misc for Generators} *) diff --git a/src/core/CCList.mli b/src/core/CCList.mli index 70f44bee..06cb20db 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -43,7 +43,7 @@ val (>|=) : 'a t -> ('a -> 'b) -> 'b t val cons : 'a -> 'a t -> 'a t (** [cons x l] is [x::l] - @since NEXT_RELEASE *) + @since 0.12 *) val append : 'a t -> 'a t -> 'a t (** Safe version of append *) diff --git a/src/core/CCString.mli b/src/core/CCString.mli index 521ab379..e4954971 100644 --- a/src/core/CCString.mli +++ b/src/core/CCString.mli @@ -110,7 +110,7 @@ val find : ?start:int -> sub:string -> string -> int val mem : ?start:int -> sub:string -> string -> bool (** [mem ~sub s] is true iff [sub] is a substring of [s] - @since NEXT_RELEASE *) + @since 0.12 *) (*$T mem ~sub:"bc" "abcd" @@ -120,7 +120,7 @@ val mem : ?start:int -> sub:string -> string -> bool val rfind : sub:string -> string -> int (** Find [sub] in string from the right, returns its first index or [-1]. Should only be used with very small [sub] - @since NEXT_RELEASE *) + @since 0.12 *) (*$T rfind ~sub:"bc" "abcd" = 1 @@ -183,7 +183,7 @@ val set : string -> int -> char -> string (** [set s i c] creates a new string which is a copy of [s], except for index [i], which becomes [c]. @raise Invalid_argument if [i] is an invalid index - @since NEXT_RELEASE *) + @since 0.12 *) (*$T set "abcd" 1 '_' = "a_cd" @@ -193,32 +193,32 @@ val set : string -> int -> char -> string val iter : (char -> unit) -> string -> unit (** Alias to {!String.iter} - @since NEXT_RELEASE *) + @since 0.12 *) val iteri : (int -> char -> unit) -> string -> unit (** iter on chars with their index - @since NEXT_RELEASE *) + @since 0.12 *) val map : (char -> char) -> string -> string (** map chars - @since NEXT_RELEASE *) + @since 0.12 *) val mapi : (int -> char -> char) -> string -> string (** map chars with their index - @since NEXT_RELEASE *) + @since 0.12 *) val flat_map : ?sep:string -> (char -> string) -> string -> string (** map each chars to a string, then concatenates them all @param sep optional separator between each generated string - @since NEXT_RELEASE *) + @since 0.12 *) val for_all : (char -> bool) -> string -> bool (** true for all chars? - @since NEXT_RELEASE *) + @since 0.12 *) val exists : (char -> bool) -> string -> bool (** true for some char? - @since NEXT_RELEASE *) + @since 0.12 *) include S with type t := string @@ -227,32 +227,32 @@ include S with type t := string val map2 : (char -> char -> char) -> string -> string -> string (** map pairs of chars @raises Invalid_argument if the strings have not the same length - @since NEXT_RELEASE *) + @since 0.12 *) val iter2: (char -> char -> unit) -> string -> string -> unit (** iterate on pairs of chars @raises Invalid_argument if the strings have not the same length - @since NEXT_RELEASE *) + @since 0.12 *) val iteri2: (int -> char -> char -> unit) -> string -> string -> unit (** iterate on pairs of chars with their index @raises Invalid_argument if the strings have not the same length - @since NEXT_RELEASE *) + @since 0.12 *) val fold2: ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'a (** fold on pairs of chars @raises Invalid_argument if the strings have not the same length - @since NEXT_RELEASE *) + @since 0.12 *) val for_all2 : (char -> char -> bool) -> string -> string -> bool (** all pair of chars respect the predicate? @raises Invalid_argument if the strings have not the same length - @since NEXT_RELEASE *) + @since 0.12 *) val exists2 : (char -> char -> bool) -> string -> string -> bool (** exists a pair of chars? @raises Invalid_argument if the strings have not the same length - @since NEXT_RELEASE *) + @since 0.12 *) (** {2 Splitting} *) @@ -294,7 +294,7 @@ module Split : sig val left : by:string -> string -> (string * string) option (** Split on the first occurrence of [by] from the left-most part of the string - @since NEXT_RELEASE *) + @since 0.12 *) (*$T Split.left ~by:" " "ab cde f g " = Some ("ab", "cde f g ") @@ -304,7 +304,7 @@ module Split : sig val right : by:string -> string -> (string * string) option (** Split on the first occurrence of [by] from the rightmost part of the string - @since NEXT_RELEASE *) + @since 0.12 *) (*$T Split.right ~by:" " "ab cde f g" = Some ("ab cde f", "g") diff --git a/src/data/CCGraph.mli b/src/data/CCGraph.mli index 3fb3bff4..e7f75193 100644 --- a/src/data/CCGraph.mli +++ b/src/data/CCGraph.mli @@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. {b status: unstable} - @since NEXT_RELEASE *) + @since 0.12 *) type 'a sequence = ('a -> unit) -> unit (** A sequence of items of type ['a], possibly infinite *) diff --git a/src/data/CCHashconsedSet.mli b/src/data/CCHashconsedSet.mli index d9ef01a7..972a0668 100644 --- a/src/data/CCHashconsedSet.mli +++ b/src/data/CCHashconsedSet.mli @@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. {b status: unstable} - @since NEXT_RELEASE + @since 0.12 *) module type ELT = sig