From 0097fd3c3de6dc029e2e262576c62bc028e76d50 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 1 Feb 2021 10:40:28 -0500 Subject: [PATCH] prepare for 3.2 --- CHANGELOG.md | 20 ++++++++++++++++++++ README.md | 5 ++++- containers-data.opam | 2 +- containers-thread.opam | 2 +- containers.opam | 2 +- src/core/CCEither.mli | 2 +- src/core/CCFormat.mli | 12 ++++++------ src/core/CCList.mli | 6 +++--- src/core/CCListLabels.mli | 6 +++--- src/core/CCString.mli | 12 ++++++------ src/core/CCStringLabels.mli | 12 ++++++------ src/core/CCUtf8_string.mli | 2 +- 12 files changed, 53 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b30927fa..63842cdfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 3.2 + +- add CCEither module +- add `CCList.chunks` +- add iter/seq functions to `CCString` +- add `CCList.reduce` (resolves #305) +- fix: in `CCInt` pick popcount at runtime on 64 bits +- fix: in shims, use configurator properly to determine int size +- in `CCFormat`, add `append`, `append_l`, infix `++` for sequencing, + `space`, `break`, `cut` +- fix: in `CCSexp`, handle non-ascii escapes in strings +- `CCUtf8_string`: add and expose `uchar_to_bytes` + +- enable auto deploy of doc +- improve CI: test core on non ubuntu platform, test all on ubuntu +- update readme +- CCImmutArray: add tests (#344) +- add fuzzing (#339) +- add stronger test to compare with uutf in ccutf8string + ## 3.1 - add `List.combine_chop` and corresponding `(and&)` synchronized product diff --git a/README.md b/README.md index 4cdfce438..a979bea87 100644 --- a/README.md +++ b/README.md @@ -371,6 +371,8 @@ the library, including printers, maps, etc. ```ocaml # (|>) ;; (* quick reminder of this awesome standard operator *) - : 'a -> ('a -> 'b) -> 'b = +# 10 |> succ;; +- : int = 11 # open CCList.Infix;; @@ -383,7 +385,8 @@ val l : int list = 76; 77; 78; 79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96; 97; 98; 99; 100] -# l +# (* transform a list, dropping some elements *) + l |> CCList.filter_map (fun x-> if x mod 3=0 then Some (float x) else None) |> CCList.take 5 ;; diff --git a/containers-data.opam b/containers-data.opam index 519c472b3..37a7449b1 100644 --- a/containers-data.opam +++ b/containers-data.opam @@ -1,5 +1,5 @@ opam-version: "2.0" -version: "3.1" +version: "3.2" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "A set of advanced datatypes for containers" diff --git a/containers-thread.opam b/containers-thread.opam index c44e1eb54..2da1c855c 100644 --- a/containers-thread.opam +++ b/containers-thread.opam @@ -1,5 +1,5 @@ opam-version: "2.0" -version: "3.1" +version: "3.2" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "An extension of containers for threading" diff --git a/containers.opam b/containers.opam index 6ad34ac59..39d567eca 100644 --- a/containers.opam +++ b/containers.opam @@ -1,6 +1,6 @@ opam-version: "2.0" name: "containers" -version: "3.1" +version: "3.2" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "A modular, clean and powerful extension of the OCaml standard library" diff --git a/src/core/CCEither.mli b/src/core/CCEither.mli index 9ec879ba0..c9afb1982 100644 --- a/src/core/CCEither.mli +++ b/src/core/CCEither.mli @@ -5,7 +5,7 @@ Module that is compatible with Either form OCaml 4.12 but can be use with any ocaml version compatible with container - @since NEXT_RELEASE + @since 3.2 *) type 'a iter = ('a -> unit) -> unit diff --git a/src/core/CCFormat.mli b/src/core/CCFormat.mli index 6b9b52e27..10bc81f0a 100644 --- a/src/core/CCFormat.mli +++ b/src/core/CCFormat.mli @@ -36,15 +36,15 @@ val exn : exn printer val space : unit printer (** Alias to {!pp_print_space}. - @since NEXT_RELEASE *) + @since 3.2 *) val cut : unit printer (** Alias to {!pp_print_cut}. - @since NEXT_RELEASE *) + @since 3.2 *) val break : (int * int) printer (** Tuple-ized {!printer} form of {!pp_print_break}. - @since NEXT_RELEASE *) + @since 3.2 *) val newline : unit printer (** Force newline (see {!Format.pp_force_newline}). @@ -100,11 +100,11 @@ val quad : ?sep:unit printer -> 'a printer -> 'b printer -> val append : unit printer -> unit printer -> unit printer (** [append ppa ppb] first prints [ppa ()], then prints [ppb ()]. - @since NEXT_RELEASE *) + @since 3.2 *) val append_l : unit printer list -> unit printer (** [append_l pps] runs the printers in [pps] sequentially. - @since NEXT_RELEASE *) + @since 3.2 *) val within : string -> string -> 'a printer -> 'a printer (** [within a b p] wraps [p] inside the strings [a] and [b]. Convenient, @@ -364,7 +364,7 @@ end module Infix : sig val (++) : unit printer -> unit printer -> unit printer (** Alias to {!append}. - @since NEXT_RELEASE *) + @since 3.2 *) end include module type of Infix diff --git a/src/core/CCList.mli b/src/core/CCList.mli index ae933c880..792423d4f 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -84,12 +84,12 @@ val scan_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc list val reduce : ('a -> 'a -> 'a) -> 'a list -> 'a option (** [reduce f (hd::tl)] returns [Some (fold_left f hd tl)]. If [l] is empty, then [None] is returned. - @since NEXT_RELEASE *) + @since 3.2 *) val reduce_exn : ('a -> 'a -> 'a) -> 'a list -> 'a (** [reduce_exn] is the unsafe version of {!reduce}. @raise Invalid_argument if the given list is empty. - @since NEXT_RELEASE *) + @since 3.2 *) val fold_map2 : ('acc -> 'a -> 'b -> 'acc * 'c) -> 'acc -> 'a list -> 'b list -> 'acc * 'c list (** [fold_map2 f init l1 l2] is to [fold_map] what [List.map2] is to [List.map]. @@ -328,7 +328,7 @@ val chunks : int -> 'a list -> 'a list list Each item of [l] will occur in exactly one chunk. Only the last chunk might be of length smaller than [n]. Invariant: [(chunks n l |> List.flatten) = l]. - @since NEXT_RELEASE *) + @since 3.2 *) val intersperse : 'a -> 'a list -> 'a list (** [intersperse x l] inserts the element [x] between adjacent elements of the list [l]. diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index 8b5b87cad..66206661f 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -88,12 +88,12 @@ val scan_left : f:('acc -> 'a -> 'acc) -> init:'acc -> 'a list -> 'acc list val reduce : f:('a -> 'a -> 'a) -> 'a list -> 'a option (** [reduce f (hd::tl)] returns [Some (fold_left f hd tl)]. If [l] is empty, then [None] is returned. - @since NEXT_RELEASE *) + @since 3.2 *) val reduce_exn : f:('a -> 'a -> 'a) -> 'a list -> 'a (** [reduce_exn] is the unsafe version of {!reduce}. @raise Invalid_argument if the given list is empty. - @since NEXT_RELEASE *) + @since 3.2 *) val fold_map2 : f:('acc -> 'a -> 'b -> 'acc * 'c) -> init:'acc -> 'a list -> 'b list -> 'acc * 'c list (** [fold_map2 ~f ~init l1 l2] is to [fold_map] what [List.map2] is to [List.map]. @@ -332,7 +332,7 @@ val chunks : int -> 'a list -> 'a list list Each item of [l] will occur in exactly one chunk. Only the last chunk might be of length smaller than [n]. Invariant: [(chunks n l |> List.flatten) = l]. - @since NEXT_RELEASE *) + @since 3.2 *) val intersperse : x:'a -> 'a list -> 'a list (** [intersperse ~x l] inserts the element [x] between adjacent elements of the list [l]. diff --git a/src/core/CCString.mli b/src/core/CCString.mli index 3112a9f1f..fabe76ead 100644 --- a/src/core/CCString.mli +++ b/src/core/CCString.mli @@ -189,11 +189,11 @@ val lines_gen : string -> string gen val lines_iter : string -> string iter (** [lines_iter s] returns the [iter] of the lines of [s] (splits along '\n'). - @since NEXT_RELEASE *) + @since 3.2 *) val lines_seq : string -> string Seq.t (** [lines_seq s] returns the [Seq.t] of the lines of [s] (splits along '\n'). - @since NEXT_RELEASE *) + @since 3.2 *) val concat_gen : sep:string -> string gen -> string (** [concat_gen ~sep gen] concatenates all strings of [gen], separated with [sep]. @@ -201,11 +201,11 @@ val concat_gen : sep:string -> string gen -> string val concat_seq : sep:string -> string Seq.t -> string (** [concat_seq ~sep seq] concatenates all strings of [seq], separated with [sep]. - @since NEXT_RELEASE *) + @since 3.2 *) val concat_iter : sep:string -> string iter -> string (** [concat_iter ~sep iter] concatenates all strings of [iter], separated with [sep]. - @since NEXT_RELEASE *) + @since 3.2 *) val unlines : string list -> string (** [unlines ls] concatenates all strings of [ls], separated with '\n'. @@ -217,11 +217,11 @@ val unlines_gen : string gen -> string val unlines_iter : string iter -> string (** [unlines_iter iter] concatenates all strings of [iter], separated with '\n'. - @since NEXT_RELEASE *) + @since 3.2 *) val unlines_seq : string Seq.t -> string (** [unlines_seq seq] concatenates all strings of [seq], separated with '\n'. - @since NEXT_RELEASE *) + @since 3.2 *) val set : string -> int -> char -> string (** [set s i c] creates a new string which is a copy of [s], except diff --git a/src/core/CCStringLabels.mli b/src/core/CCStringLabels.mli index 6d63a509d..5dc09d094 100644 --- a/src/core/CCStringLabels.mli +++ b/src/core/CCStringLabels.mli @@ -194,15 +194,15 @@ val lines_gen : string -> string gen val lines_iter : string -> string iter (** [lines_iter s] returns the [iter] of the lines of [s] (splits along '\n'). - @since NEXT_RELEASE *) + @since 3.2 *) val lines_seq : string -> string Seq.t (** [lines_seq s] returns the [Seq.t] of the lines of [s] (splits along '\n'). - @since NEXT_RELEASE *) + @since 3.2 *) val concat_iter : sep:string -> string iter -> string (** [concat_iter ~sep iter] concatenates all strings of [iter], separated with [sep]. - @since NEXT_RELEASE *) + @since 3.2 *) val concat_gen : sep:(string [@keep_label]) -> string gen -> string (** [concat_gen ~sep gen] concatenates all strings of [gen], separated with [sep]. @@ -210,7 +210,7 @@ val concat_gen : sep:(string [@keep_label]) -> string gen -> string val concat_seq : sep:string -> string Seq.t -> string (** [concat_seq ~sep seq] concatenates all strings of [seq], separated with [sep]. - @since NEXT_RELEASE *) + @since 3.2 *) val unlines : string list -> string (** [unlines ls] concatenates all strings of [ls], separated with '\n'. @@ -222,11 +222,11 @@ val unlines_gen : string gen -> string val unlines_iter : string iter -> string (** [unlines_iter iter] concatenates all strings of [iter], separated with '\n'. - @since NEXT_RELEASE *) + @since 3.2 *) val unlines_seq : string Seq.t -> string (** [unlines_seq seq] concatenates all strings of [seq], separated with '\n'. - @since NEXT_RELEASE *) + @since 3.2 *) val set : string -> int -> char -> string (** [set s i c] creates a new string which is a copy of [s], except diff --git a/src/core/CCUtf8_string.mli b/src/core/CCUtf8_string.mli index 93c006166..37a23ba4e 100644 --- a/src/core/CCUtf8_string.mli +++ b/src/core/CCUtf8_string.mli @@ -95,7 +95,7 @@ val uchar_to_bytes : uchar -> char iter This can be used, for example, in combination with {!Buffer.add_char} on a pre-allocated buffer to add the bytes one by one (despite its name, {!Buffer.add_char} takes individual bytes, not unicode codepoints). - @since NEXT_RELEASE *) + @since 3.2 *) val of_gen : uchar gen -> t