prepare for 3.14

This commit is contained in:
Simon Cruanes 2024-09-10 08:47:46 -04:00
parent 9f8c2efe64
commit 6ab811f79b
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
14 changed files with 48 additions and 33 deletions

View file

@ -1,5 +1,20 @@
# Changelog # Changelog
## 3.14
- predicate combinators: `and_pred` and `or_pred`
- feat `pp`: add a bunch of extensions
- Kleisli Composition Operator and Apply_or for option/result/fun (#455)
- add `CCByte_buffer.to_slice`
- add a byte slice type `CCByte_slice`
- add `cons_when` to `CCListLabels`
- add `(|||>)` and `||>` to `CCFun`
- `CCVector`: Add function foldi
- add `containers.pvec`, a persistent vector type.
- perf: use a monomorphic impl for `CCMonomorphic.{min,max}`
## 3.13.1 ## 3.13.1
- list: TRMC was in 4.14, we can use it earlier - list: TRMC was in 4.14, we can use it earlier

View file

@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead # This file is generated by dune, edit dune-project instead
opam-version: "2.0" opam-version: "2.0"
version: "3.13.1" version: "3.14"
synopsis: "A set of advanced datatypes for containers" synopsis: "A set of advanced datatypes for containers"
maintainer: ["c-cube"] maintainer: ["c-cube"]
authors: ["c-cube"] authors: ["c-cube"]

View file

@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead # This file is generated by dune, edit dune-project instead
opam-version: "2.0" opam-version: "2.0"
version: "3.13.1" version: "3.14"
synopsis: synopsis:
"A modular, clean and powerful extension of the OCaml standard library" "A modular, clean and powerful extension of the OCaml standard library"
maintainer: ["c-cube"] maintainer: ["c-cube"]

View file

@ -2,7 +2,7 @@
(name containers) (name containers)
(generate_opam_files true) (generate_opam_files true)
(version 3.13.1) (version 3.14)
(authors c-cube) (authors c-cube)
(maintainers c-cube) (maintainers c-cube)
(license BSD-2-Clause) (license BSD-2-Clause)

View file

@ -13,7 +13,7 @@ type t = {
is undefined garbage. *) is undefined garbage. *)
} }
(** The byte buffer. (** The byte buffer.
The definition is public since NEXT_RELEASE . *) The definition is public since 3.13.1 . *)
type 'a iter = ('a -> unit) -> unit type 'a iter = ('a -> unit) -> unit
@ -89,7 +89,7 @@ val unsafe_set : t -> int -> char -> unit
val to_slice : t -> CCByte_slice.t val to_slice : t -> CCByte_slice.t
(** [to_slice buf] returns a slice of the current content. (** [to_slice buf] returns a slice of the current content.
The slice shares the same byte array as [buf] (until [buf] is resized). The slice shares the same byte array as [buf] (until [buf] is resized).
@since NEXT_RELEASE *) @since 3.13.1 *)
val contents : t -> string val contents : t -> string
(** Copy the internal data to a string. Allocates. *) (** Copy the internal data to a string. Allocates. *)
@ -102,7 +102,7 @@ val iter : (char -> unit) -> t -> unit
val iteri : (int -> char -> unit) -> t -> unit val iteri : (int -> char -> unit) -> t -> unit
(** Iterate with index. (** Iterate with index.
@since NEXT_RELEASE *) @since 3.13.1 *)
val fold_left : ('a -> char -> 'a) -> 'a -> t -> 'a val fold_left : ('a -> char -> 'a) -> 'a -> t -> 'a
val of_iter : char iter -> t val of_iter : char iter -> t

View file

@ -1,6 +1,6 @@
(** A simple byte slice. (** A simple byte slice.
@since NEXT_RELEASE *) @since 3.13.1 *)
type t = { type t = {
bs: bytes; (** The bytes, potentially shared between many slices *) bs: bytes; (** The bytes, potentially shared between many slices *)

View file

@ -8,13 +8,13 @@ include module type of Fun
val and_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool val and_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool
(** [and_p f g x] is [(f x) && (g x)]. (** [and_p f g x] is [(f x) && (g x)].
Produces a predicate which is a conjunction of the two predicates. Produces a predicate which is a conjunction of the two predicates.
@since NEXT_RELEASE @since 3.13.1
*) *)
val or_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool val or_pred : ('a -> bool) -> ('a -> bool) -> 'a -> bool
(** [or_p f g x] is [(f x) || (g x)]. (** [or_p f g x] is [(f x) || (g x)].
Produces a predicate which is a disjunction of the two predicates. Produces a predicate which is a disjunction of the two predicates.
@since NEXT_RELEASE @since 3.13.1
*) *)
val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c val compose : ('a -> 'b) -> ('b -> 'c) -> 'a -> 'c
@ -96,11 +96,11 @@ module Infix : sig
val ( ||> ) : 'a * 'b -> ('a -> 'b -> 'c) -> 'c val ( ||> ) : 'a * 'b -> ('a -> 'b -> 'c) -> 'c
(** [x ||> f] is [f (fst x) (snd x)] (** [x ||> f] is [f (fst x) (snd x)]
@since NEXT_RELEASE *) @since 3.13.1 *)
val ( |||> ) : 'a * 'b * 'c -> ('a -> 'b -> 'c -> 'd) -> 'd val ( |||> ) : 'a * 'b * 'c -> ('a -> 'b -> 'c -> 'd) -> 'd
(** like [||>] but for tuples of size 3 (** like [||>] but for tuples of size 3
@since NEXT_RELEASE *) @since 3.13.1 *)
end end
include module type of Infix include module type of Infix

View file

@ -28,7 +28,7 @@ val cons_maybe : 'a option -> 'a t -> 'a t
val cons_when : bool -> 'a -> 'a t -> 'a t val cons_when : bool -> 'a -> 'a t -> 'a t
(** [cons_when true x l] is [x :: l]. (** [cons_when true x l] is [x :: l].
[cons_when false x l] is [l]. [cons_when false x l] is [l].
@since NEXT_RELEASE *) @since 3.13.1 *)
val cons' : 'a t -> 'a -> 'a t val cons' : 'a t -> 'a -> 'a t
(** [cons' l x] is the same as [x :: l]. This is convenient for fold (** [cons' l x] is the same as [x :: l]. This is convenient for fold

View file

@ -47,7 +47,7 @@ val cons_maybe : 'a option -> 'a t -> 'a t
val cons_when : bool -> 'a -> 'a t -> 'a t val cons_when : bool -> 'a -> 'a t -> 'a t
(** [cons_when true x l] is [x :: l]. (** [cons_when true x l] is [x :: l].
[cons_when false x l] is [l]. [cons_when false x l] is [l].
@since NEXT_RELEASE *) @since 3.13.1 *)
val filter : f:('a -> bool) -> 'a t -> 'a t val filter : f:('a -> bool) -> 'a t -> 'a t
(** [filter ~f l] returns all the elements of the list [l] (** [filter ~f l] returns all the elements of the list [l]

View file

@ -60,7 +60,7 @@ val bind : 'a t -> ('a -> 'b t) -> 'b t
val k_compose : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t val k_compose : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
(** Kleisli composition. Monadic equivalent of {!CCFun.compose} (** Kleisli composition. Monadic equivalent of {!CCFun.compose}
@since NEXT_RELEASE *) @since 3.13.1 *)
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
(** [map2 f o1 o2] maps ['a option] and ['b option] to a ['c option] using [f]. *) (** [map2 f o1 o2] maps ['a option] and ['b option] to a ['c option] using [f]. *)
@ -100,7 +100,7 @@ val apply_or : ('a -> 'a t) -> 'a -> 'a
(** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds. (** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds.
Useful for piping preprocessing functions together (such as string processing), Useful for piping preprocessing functions together (such as string processing),
turning functions like "remove" into "remove_if_it_exists". turning functions like "remove" into "remove_if_it_exists".
@since NEXT_RELEASE *) @since 3.13.1 *)
val value : 'a t -> default:'a -> 'a val value : 'a t -> default:'a -> 'a
(** [value o ~default] is similar to the Stdlib's [Option.value] and to {!get_or}. (** [value o ~default] is similar to the Stdlib's [Option.value] and to {!get_or}.
@ -187,7 +187,7 @@ module Infix : sig
val ( |?> ) : 'a -> ('a -> 'a t) -> 'a val ( |?> ) : 'a -> ('a -> 'a t) -> 'a
(** [x |?> f] is [apply_or f x] (** [x |?> f] is [apply_or f x]
@since NEXT_RELEASE *) @since 3.13.1 *)
val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t
val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t
@ -196,11 +196,11 @@ module Infix : sig
val ( >=> ) : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t val ( >=> ) : ('a -> 'b t) -> ('b -> 'c t) -> 'a -> 'c t
(** Monadic [k_compose]. (** Monadic [k_compose].
@since NEXT_RELEASE *) @since 3.13.1 *)
val ( <=< ) : ('b -> 'c t) -> ('a -> 'b t) -> 'a -> 'c t val ( <=< ) : ('b -> 'c t) -> ('a -> 'b t) -> 'a -> 'c t
(** Reverse monadic [k_compose]. (** Reverse monadic [k_compose].
@since NEXT_RELEASE *) @since 3.13.1 *)
end end
include module type of Infix include module type of Infix

View file

@ -100,7 +100,7 @@ val apply_or : ('a -> ('a, _) t) -> 'a -> 'a
(** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds. (** [apply_or f x] returns the original [x] if [f] fails, or unwraps [f x] if it succeeds.
Useful for piping preprocessing functions together (such as string processing), Useful for piping preprocessing functions together (such as string processing),
turning functions like "remove" into "remove_if_it_exists". turning functions like "remove" into "remove_if_it_exists".
@since NEXT_RELEASE *) @since 3.13.1 *)
val get_or_failwith : ('a, string) t -> 'a val get_or_failwith : ('a, string) t -> 'a
(** [get_or_failwith e] returns [x] if [e = Ok x], fails otherwise. (** [get_or_failwith e] returns [x] if [e = Ok x], fails otherwise.
@ -123,7 +123,7 @@ val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t
val k_compose : val k_compose :
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t ('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
(** Kleisli composition. Monadic equivalent of {!CCFun.compose}. (** Kleisli composition. Monadic equivalent of {!CCFun.compose}.
@since NEXT_RELEASE *) @since 3.13.1 *)
val equal : err:'err equal -> 'a equal -> ('a, 'err) t equal val equal : err:'err equal -> 'a equal -> ('a, 'err) t equal
val compare : err:'err ord -> 'a ord -> ('a, 'err) t ord val compare : err:'err ord -> 'a ord -> ('a, 'err) t ord
@ -202,7 +202,7 @@ module Infix : sig
val ( |?> ) : 'a -> ('a -> ('a, _) t) -> 'a val ( |?> ) : 'a -> ('a -> ('a, _) t) -> 'a
(** Alias for {!apply_or} (** Alias for {!apply_or}
@since NEXT_RELEASE *) @since 3.13.1 *)
val ( let+ ) : ('a, 'e) t -> ('a -> 'b) -> ('b, 'e) t val ( let+ ) : ('a, 'e) t -> ('a -> 'b) -> ('b, 'e) t
(** @since 2.8 *) (** @since 2.8 *)
@ -219,12 +219,12 @@ module Infix : sig
val ( >=> ) : val ( >=> ) :
('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t ('a -> ('b, 'err) t) -> ('b -> ('c, 'err) t) -> 'a -> ('c, 'err) t
(** Monadic [k_compose]. (** Monadic [k_compose].
@since NEXT_RELEASE *) @since 3.13.1 *)
val ( <=< ) : val ( <=< ) :
('b -> ('c, 'err) t) -> ('a -> ('b, 'err) t) -> 'a -> ('c, 'err) t ('b -> ('c, 'err) t) -> ('a -> ('b, 'err) t) -> 'a -> ('c, 'err) t
(** Reverse monadic [k_compose]. (** Reverse monadic [k_compose].
@since NEXT_RELEASE *) @since 3.13.1 *)
end end
include module type of Infix include module type of Infix

View file

@ -209,7 +209,7 @@ val fold : ('b -> 'a -> 'b) -> 'b -> ('a, _) t -> 'b
val foldi : (int -> 'b -> 'a -> 'b) -> 'b -> ('a, _) t -> 'b val foldi : (int -> 'b -> 'a -> 'b) -> 'b -> ('a, _) t -> 'b
(** [foldi f init v] is just like {!fold}, but it also passes in the index (** [foldi f init v] is just like {!fold}, but it also passes in the index
of each element as the first argument to the function [f]. of each element as the first argument to the function [f].
@since NEXT_RELEASE *) @since 3.13.1 *)
val exists : ('a -> bool) -> ('a, _) t -> bool val exists : ('a -> bool) -> ('a, _) t -> bool
(** Existential test (is there an element that satisfies the predicate?). *) (** Existential test (is there an element that satisfies the predicate?). *)

View file

@ -260,24 +260,24 @@ module Dump : sig
val list : t list -> t val list : t list -> t
val of_iter : ?sep:t -> ('a -> t) -> 'a iter -> t val of_iter : ?sep:t -> ('a -> t) -> 'a iter -> t
(** @since NEXT_RELEASE *) (** @since 3.13.1 *)
val of_array : ?sep:t -> ('a -> t) -> 'a array -> t val of_array : ?sep:t -> ('a -> t) -> 'a array -> t
(** @since NEXT_RELEASE *) (** @since 3.13.1 *)
val parens : t -> t val parens : t -> t
(** @since NEXT_RELEASE *) (** @since 3.13.1 *)
val braces : t -> t val braces : t -> t
(** @since NEXT_RELEASE *) (** @since 3.13.1 *)
val brackets : t -> t val brackets : t -> t
(** Adds '[' ']' around the term (** Adds '[' ']' around the term
@since NEXT_RELEASE *) @since 3.13.1 *)
val angles : t -> t val angles : t -> t
(** Adds '<' '>' around the term (** Adds '<' '>' around the term
@since NEXT_RELEASE *) @since 3.13.1 *)
end end
(** Simple colors in terminals *) (** Simple colors in terminals *)
@ -305,7 +305,7 @@ module Term_color : sig
val style_l : style list -> t -> t val style_l : style list -> t -> t
end end
(** @since NEXT_RELEASE *) (** @since 3.13.1 *)
module Char : sig module Char : sig
val bang : t val bang : t
val at : t val at : t
@ -343,4 +343,4 @@ end
val surround : ?width:int -> t -> t -> t -> t val surround : ?width:int -> t -> t -> t -> t
(** Generalization of {!bracket} (** Generalization of {!bracket}
@since NEXT_RELEASE *) @since 3.13.1 *)

View file

@ -5,7 +5,7 @@
{b status: experimental} {b status: experimental}
@since NEXT_RELEASE @since 3.13.1
*) *)
type 'a iter = ('a -> unit) -> unit type 'a iter = ('a -> unit) -> unit