From ef8d19ac65b58406b5dc5aa750c1e319a8181411 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 3 Dec 2018 09:47:35 -0600 Subject: [PATCH 1/3] some typos in unlabel --- src/unlabel.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unlabel.ml b/src/unlabel.ml index 443786d2..ad1076ef 100644 --- a/src/unlabel.ml +++ b/src/unlabel.ml @@ -28,7 +28,7 @@ let search_all pat s = List.rev (search_rest [] 0) ;; -(* replase first occurence of pat with subst in s *) +(* replace first occurrence of pat with subst in s *) let replace_first pat subst s = let pos = search pat s 0 in let patl = String.length pat @@ -43,7 +43,7 @@ let replace_first pat subst s = Bytes.unsafe_to_string buf ;; -(* replase first occurence of pat with subst in s *) +(* replace all occurrences of pat with subst in s *) let replace_all pat subst s = let pos = search_all pat s in let patl = String.length pat From 6a90cb25e7f81b52162c5e715f0c29e308c8164b Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 3 Dec 2018 09:47:45 -0600 Subject: [PATCH 2/3] wip: fix retrocompat issues in cclist --- src/core/CCArray.mli | 3 --- src/core/CCArrayLabels.mli | 3 --- src/core/CCList.mli | 9 ++++----- src/core/CCListLabels.mli | 5 ++--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/core/CCArray.mli b/src/core/CCArray.mli index 0b138167..b5ddb05d 100644 --- a/src/core/CCArray.mli +++ b/src/core/CCArray.mli @@ -110,12 +110,10 @@ val reverse_in_place : 'a t -> unit (** [reverse_in_place a] reverses the array [a] in place. *) val sorted : ('a -> 'a -> int) -> 'a t -> 'a array - (* FIXME: better label this ~cmp ?? *) (** [sorted f a] makes a copy of [a] and sorts it with [f]. @since 1.0 *) val sort_indices : ('a -> 'a -> int) -> 'a t -> int array - (* FIXME: better label this ~cmp ?? *) (** [sort_indices f a] returns a new array [b], with the same length as [a], such that [b.(i)] is the index at which the [i]-th element of [sorted f a] appears in [a]. [a] is not modified. @@ -125,7 +123,6 @@ val sort_indices : ('a -> 'a -> int) -> 'a t -> int array @since 1.0 *) val sort_ranking : ('a -> 'a -> int) -> 'a t -> int array - (* FIXME: better label this ~cmp ?? *) (** [sort_ranking f a] returns a new array [b], with the same length as [a], such that [b.(i)] is the index at which the [i]-th element of [a] appears in [sorted f a]. [a] is not modified. diff --git a/src/core/CCArrayLabels.mli b/src/core/CCArrayLabels.mli index c53ae79b..a8e6624f 100644 --- a/src/core/CCArrayLabels.mli +++ b/src/core/CCArrayLabels.mli @@ -108,12 +108,10 @@ val reverse_in_place : 'a t -> unit (** [reverse_in_place a] reverses the array [a] in place. *) val sorted : f:('a -> 'a -> int) -> 'a t -> 'a array - (* FIXME: better label this ~cmp ?? *) (** [sorted ~f a] makes a copy of [a] and sorts it with [~f]. @since 1.0 *) val sort_indices : f:('a -> 'a -> int) -> 'a t -> int array - (* FIXME: better label this ~cmp ?? *) (** [sort_indices ~f a] returns a new array [b], with the same length as [a], such that [b.(i)] is the index at which the [i]-th element of [sorted ~f a] appears in [a]. [a] is not modified. @@ -123,7 +121,6 @@ val sort_indices : f:('a -> 'a -> int) -> 'a t -> int array @since 1.0 *) val sort_ranking : f:('a -> 'a -> int) -> 'a t -> int array - (* FIXME: better label this ~cmp ?? *) (** [sort_ranking ~f a] returns a new array [b], with the same length as [a], such that [b.(i)] is the index at which the [i]-th element of [a] appears in [sorted ~f a]. [a] is not modified. diff --git a/src/core/CCList.mli b/src/core/CCList.mli index f2ab25cd..9d331dbe 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -377,9 +377,9 @@ val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option (** [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l], and [p x] holds. Otherwise returns [None]. *) -val remove : eq:('a -> 'a -> bool) -> 'a -> 'a t -> 'a t +val remove : eq:('a -> 'a -> bool) -> key:'a -> 'a t -> 'a t (* FIXME: the original CCList.mli uses ~x instead of ~key !! *) -(** [remove key l] removes every instance of [key] from [l]. Tail-recursive. +(** [remove ~key l] removes every instance of [key] from [l]. Tail-recursive. @param eq equality function. @since 0.11 *) @@ -589,9 +589,8 @@ module Assoc : sig @since 0.16 *) val update : - eq:('a->'a->bool) -> ('b option -> 'b option) -> 'a -> ('a,'b) t -> ('a,'b) t - (* FIXME: the original no labels mli kept the ~f label ! *) - (** [update k f l] updates [l] on the key [k], by calling [f (get l k)] + eq:('a->'a->bool) -> f:('b option -> 'b option) -> 'a -> ('a,'b) t -> ('a,'b) t + (** [update k ~f l] updates [l] on the key [k], by calling [f (get l k)] and removing [k] if it returns [None], mapping [k] to [v'] if it returns [Some v']. @since 0.16 *) diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index ce373ff3..fbfe7bd7 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -375,7 +375,7 @@ val find_idx : f:('a -> bool) -> 'a t -> (int * 'a) option (** [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l], and [p x] holds. Otherwise returns [None]. *) -val remove : eq:(('a -> 'a -> bool) [@keep_label]) -> key:'a -> 'a t -> 'a t +val remove : eq:(('a -> 'a -> bool) [@keep_label]) -> key:('a [@keep_label]) -> 'a t -> 'a t (* FIXME: the original CCList.mli uses ~x instead of ~key !! *) (** [remove ~key l] removes every instance of [key] from [l]. Tail-recursive. @param eq equality function. @@ -587,8 +587,7 @@ module Assoc : sig @since 0.16 *) val update : - eq:(('a->'a->bool) [@keep_label]) -> f:('b option -> 'b option) -> 'a -> ('a,'b) t -> ('a,'b) t - (* FIXME: the original no labels mli kept the ~f label ! *) + eq:(('a->'a->bool) [@keep_label]) -> f:(('b option -> 'b option) [@keep_label]) -> 'a -> ('a,'b) t -> ('a,'b) t (** [update k ~f l] updates [l] on the key [k], by calling [f (get l k)] and removing [k] if it returns [None], mapping [k] to [v'] if it returns [Some v']. From 8038528097697524f0ef5aa85916f72db2bd4d35 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 2 Feb 2019 13:59:14 -0600 Subject: [PATCH 3/3] prepare for 2.4.1 --- CHANGELOG.adoc | 4 ++++ containers.opam | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index ff5ac1db..9c2c8706 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -1,5 +1,9 @@ = Changelog +== 2.4.1 + +- revert some compatibility-breaking changes in label modules + == 2.4 === breaking: diff --git a/containers.opam b/containers.opam index 590e4d9d..e4a478e4 100644 --- a/containers.opam +++ b/containers.opam @@ -1,6 +1,6 @@ opam-version: "2.0" name: "containers" -version: "2.4" +version: "2.4.1" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "A modular, clean and powerful extension of the OCaml standard library"