diff --git a/CHANGELOG.md b/CHANGELOG.md index 49a1efda..38227a2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 2.7 + +- deprecate CCKList in favor of the standard Seq +- CCIO: add `_gen` suffixes to some functions +- ccsexp: provide ability to annotate parsed S-exprs with their position +- ccsexp: functorize the parser/printer +- ccsexp: support `#;` for commenting a sexp +- fix: remove dep from vec to list +- add `to_string` to many modules (#270) +- add `CCDeque.{remove_*;update_*}`,` CCDeque.{*_opt}` +- add `CCDeque.{filter,filter_map}` +- add `CCDeque.filter_in_place` +- add `CCBool.{to,of}_int` +- add `Result.flatten_l` to turn a list of results into a result of list +- refactor: remove stdlib's code, simple reimplementation of `Stdlib.Fun` +- add `CCArray.Infix` +- Document behaviour of `Fun.finally` when finaliser raises + +- travis: test on OCaml 4.09, too. +- more docs for IO + ## 2.6.1 bugfix release: diff --git a/README.md b/README.md index 7fbde80e..1eda99e5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OCaml-containers 📦 +# OCaml-containers 📦 [![Build Status](https://travis-ci.org/c-cube/ocaml-containers.svg?branch=master)](https://travis-ci.org/c-cube/ocaml-containers) A modular, clean and powerful extension of the OCaml standard library. @@ -12,8 +12,6 @@ map/fold_right/append, and additional functions on lists). Alternatively, `open Containers` will bring enhanced versions of the standard modules into scope. -[![Build Status](https://travis-ci.org/c-cube/ocaml-containers.svg?branch=master)](https://travis-ci.org/c-cube/ocaml-containers) - ## Quick Summary Containers is: diff --git a/containers.opam b/containers.opam index b91d0b10..855aa323 100644 --- a/containers.opam +++ b/containers.opam @@ -1,6 +1,6 @@ opam-version: "2.0" name: "containers" -version: "2.6.1" +version: "2.7" author: "Simon Cruanes" maintainer: "simon.cruanes.2007@m4x.org" synopsis: "A modular, clean and powerful extension of the OCaml standard library" @@ -19,7 +19,6 @@ depends: [ "iter" { with-test } "gen" { with-test } "uutf" { with-test } - "mdx" { with-test } "odoc" { with-doc } "ocaml" { >= "4.02.0" } ] diff --git a/doc/dune b/doc/dune index 54a2b6f7..2dbb14d7 100644 --- a/doc/dune +++ b/doc/dune @@ -1,8 +1,8 @@ -(alias - (name runtest) - (deps containers.md) - (action (progn - (run mdx test %{deps}) - (diff? %{deps} %{deps}.corrected)))) - +;(alias +; (name runtest) +; (deps containers.md) +; (action (progn +; (run mdx test %{deps}) +; (diff? %{deps} %{deps}.corrected)))) +; diff --git a/dune b/dune index d5e5e21b..b630eb92 100644 --- a/dune +++ b/dune @@ -1,8 +1,8 @@ -(alias - (name runtest) - (deps README.md) - (action (progn - (run mdx test %{deps}) - (diff? %{deps} %{deps}.corrected)))) +;(alias +; (name runtest) +; (deps README.md) +; (action (progn +; (run mdx test %{deps}) +; (diff? %{deps} %{deps}.corrected)))) diff --git a/qtest/dune b/qtest/dune index 8ecd4942..faf6d55e 100644 --- a/qtest/dune +++ b/qtest/dune @@ -17,7 +17,7 @@ (modes native) (modules run_qtest) ; disable some warnings in qtests - (flags :standard -warn-error -a -w -33-35-27-39 -nolabels) + (flags :standard -warn-error -a -w -3-33-35-27-39 -nolabels) (libraries iter gen qcheck containers containers.unix containers.data containers.thread containers.iter containers.sexp uutf) diff --git a/src/core/CCArray.mli b/src/core/CCArray.mli index e25c68ca..482cbcb2 100644 --- a/src/core/CCArray.mli +++ b/src/core/CCArray.mli @@ -247,7 +247,7 @@ val random_choose : 'a t -> 'a random_gen val to_string : ?sep:string -> ('a -> string) -> 'a array -> string (** [to_string ~sep item_to_string a] print [a] to a string using [sep] as a separator between elements of [a]. - @since NEXT_RELEASE *) + @since 2.7 *) val to_seq : 'a t -> 'a sequence (** [to_seq a] returns a [sequence] of the elements of an array [a]. diff --git a/src/core/CCArrayLabels.mli b/src/core/CCArrayLabels.mli index b14e42e4..e1eb036c 100644 --- a/src/core/CCArrayLabels.mli +++ b/src/core/CCArrayLabels.mli @@ -248,7 +248,7 @@ val random_choose : 'a t -> 'a random_gen val to_string : ?sep:string -> ('a -> string) -> 'a array -> string (** [to_string ~sep item_to_string a] print [a] to a string using [sep] as a separator between elements of [a]. - @since NEXT_RELEASE *) + @since 2.7 *) val to_seq : 'a t -> 'a sequence (** [to_seq a] returns a [sequence] of the elements of an array [a]. diff --git a/src/core/CCBool.mli b/src/core/CCBool.mli index a454552a..8e341368 100644 --- a/src/core/CCBool.mli +++ b/src/core/CCBool.mli @@ -11,11 +11,11 @@ val equal : t -> t -> bool val to_int : t -> int (** [to_int true = 1], [to_int false = 0]. - @since NEXT_RELEASE *) + @since 2.7 *) val of_int : int -> t (** [of_int i] is the same as [i <> 0] - @since NEXT_RELEASE *) + @since 2.7 *) val negate : t -> t (** Negation on booleans (functional version of [not]). diff --git a/src/core/CCChar.mli b/src/core/CCChar.mli index 3e9f3fa3..e936871a 100644 --- a/src/core/CCChar.mli +++ b/src/core/CCChar.mli @@ -42,7 +42,7 @@ val to_int : t -> int val to_string : t -> string (** [to_string c] return a string containing [c] - @since NEXT_RELEASE *) + @since 2.7 *) val pp_buf : Buffer.t -> t -> unit (** Renamed from [pp] since 2.0. *) diff --git a/src/core/CCHeap.ml b/src/core/CCHeap.ml index 42d2ba82..ebc9f1d8 100644 --- a/src/core/CCHeap.ml +++ b/src/core/CCHeap.ml @@ -204,7 +204,7 @@ module type S = sig val to_string : ?sep:string -> (elt -> string) -> t -> string (** Print the heap in a string - @since NEXT_RELEASE *) + @since 2.7 *) val pp : ?sep:string -> elt printer -> t printer (** @since 0.16 diff --git a/src/core/CCHeap.mli b/src/core/CCHeap.mli index 52c4077c..b0bc278e 100644 --- a/src/core/CCHeap.mli +++ b/src/core/CCHeap.mli @@ -144,7 +144,7 @@ module type S = sig val to_string : ?sep:string -> (elt -> string) -> t -> string (** Print the heap in a string - @since NEXT_RELEASE *) + @since 2.7 *) val pp : ?sep:string -> elt printer -> t printer (** Printer. diff --git a/src/core/CCList.mli b/src/core/CCList.mli index 6391e0b1..533c3ef5 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -689,7 +689,7 @@ val to_string : ?start:string -> ?stop:string -> ?sep:string -> ('a -> string) -> 'a t -> string (** [to_string ~start ~stop ~sep item_to_string l] print [l] to a string using [sep] as a separator between elements of [l]. - @since NEXT_RELEASE *) + @since 2.7 *) val to_seq : 'a t -> 'a sequence (** Return a [sequence] of the elements of the list. *) diff --git a/src/core/CCListLabels.mli b/src/core/CCListLabels.mli index d32f582a..310ea91a 100644 --- a/src/core/CCListLabels.mli +++ b/src/core/CCListLabels.mli @@ -687,7 +687,7 @@ val to_string : ?start:string -> ?stop:string -> ?sep:string -> ('a -> string) -> 'a t -> string (** [to_string ~start ~stop ~sep item_to_string l] print [l] to a string using [sep] as a separator between elements of [l]. - @since NEXT_RELEASE *) + @since 2.7 *) val to_seq : 'a t -> 'a sequence (** Return a [sequence] of the elements of the list. *) diff --git a/src/core/CCPair.mli b/src/core/CCPair.mli index bd8cedc8..b82ecfa8 100644 --- a/src/core/CCPair.mli +++ b/src/core/CCPair.mli @@ -69,7 +69,7 @@ val compare : ('a -> 'a -> int) -> ('b -> 'b -> int) -> ('a * 'b) -> ('a * 'b) - val to_string : ?sep:string -> ('a -> string) -> ('b -> string) -> ('a * 'b) -> string (** Print tuple in a string - @since NEXT_RELEASE *) + @since 2.7 *) type 'a printer = Format.formatter -> 'a -> unit diff --git a/src/core/CCResult.mli b/src/core/CCResult.mli index ec8c7a4c..acb4edd2 100644 --- a/src/core/CCResult.mli +++ b/src/core/CCResult.mli @@ -189,7 +189,7 @@ end val flatten_l : ('a, 'err) t list -> ('a list, 'err) t (** Same as [map_l id]: returns [Ok [x1;…;xn]] if [l=[Ok x1; …; Ok xn]], or the first error otherwise. - @since NEXT_RELEASE + @since 2.7 *) val map_l : ('a -> ('b, 'err) t) -> 'a list -> ('b list, 'err) t diff --git a/src/core/CCSet.ml b/src/core/CCSet.ml index 6f91db6b..36f21a2e 100644 --- a/src/core/CCSet.ml +++ b/src/core/CCSet.ml @@ -70,7 +70,7 @@ module type S = sig ?start:string -> ?stop:string -> ?sep:string -> (elt -> string) -> t -> string (** Print the set in a string - @since NEXT_RELEASE *) + @since 2.7 *) val pp : ?start:string -> ?stop:string -> ?sep:string -> diff --git a/src/core/CCSet.mli b/src/core/CCSet.mli index d26f054b..f31246ef 100644 --- a/src/core/CCSet.mli +++ b/src/core/CCSet.mli @@ -69,7 +69,7 @@ module type S = sig ?start:string -> ?stop:string -> ?sep:string -> (elt -> string) -> t -> string (** Print the set in a string - @since NEXT_RELEASE *) + @since 2.7 *) val pp : ?start:string -> ?stop:string -> ?sep:string -> diff --git a/src/core/CCVector.mli b/src/core/CCVector.mli index de5b0e6c..84d25709 100644 --- a/src/core/CCVector.mli +++ b/src/core/CCVector.mli @@ -291,7 +291,7 @@ val to_string : ?start:string -> ?stop:string -> ?sep:string -> ('a -> string) -> ('a,_) t -> string (** Print the vector in a string - @since NEXT_RELEASE *) + @since 2.7 *) val pp : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> ('a,_) t printer diff --git a/src/data/CCDeque.mli b/src/data/CCDeque.mli index 3acec9a7..c617c94d 100644 --- a/src/data/CCDeque.mli +++ b/src/data/CCDeque.mli @@ -47,7 +47,7 @@ val peek_front : 'a t -> 'a val peek_front_opt : 'a t -> 'a option (** First value. - @since NEXT_RELEASE *) + @since 2.7 *) val peek_back : 'a t -> 'a (** Last value. @@ -55,15 +55,15 @@ val peek_back : 'a t -> 'a val peek_back_opt : 'a t -> 'a option (** Last value. - @since NEXT_RELEASE *) + @since 2.7 *) val remove_back : 'a t -> unit (** Remove last value. If the deque is empty do nothing - @since NEXT_RELEASE *) + @since 2.7 *) val remove_front : 'a t -> unit (** Remove first value. If the deque is empty do nothing - @since NEXT_RELEASE *) + @since 2.7 *) val take_back : 'a t -> 'a (** Take last value. @@ -71,7 +71,7 @@ val take_back : 'a t -> 'a val take_back_opt : 'a t -> 'a option (** Take last value. - @since NEXT_RELEASE *) + @since 2.7 *) val take_front : 'a t -> 'a (** Take first value. @@ -79,18 +79,18 @@ val take_front : 'a t -> 'a val take_front_opt : 'a t -> 'a option (** Take first value. - @since NEXT_RELEASE *) + @since 2.7 *) val update_back : 'a t -> ('a -> 'a option) -> unit (** Update last value. If the deque is empty do nothing. If the function returns [None], remove last element; if it returns [Some x], replace last element with [x]. - @since NEXT_RELEASE *) + @since 2.7 *) val update_front : 'a t -> ('a -> 'a option) -> unit (** Update first value. If the deque is empty do nothing. Similar to {!update_back} but for the first value. - @since NEXT_RELEASE *) + @since 2.7 *) val append_front : into:'a t -> 'a t -> unit (** [append_front ~into q] adds all elements of [q] at the front @@ -160,15 +160,15 @@ val to_rev_list : 'a t -> 'a list val filter : ('a -> bool) -> 'a t -> 'a t (** Filter into a new copy. - @since NEXT_RELEASE *) + @since 2.7 *) val filter_map : ('a -> 'b option) -> 'a t -> 'b t (** Filter map into a new copy - @since NEXT_RELEASE *) + @since 2.7 *) val filter_in_place : 'a t -> ('a -> bool) -> unit (** Keep only elements that satisfy the predicate. - @since NEXT_RELEASE *) + @since 2.7 *) (** {2 print} *) diff --git a/src/iter/CCKList.mli b/src/iter/CCKList.mli index e6a83910..aa9da07f 100644 --- a/src/iter/CCKList.mli +++ b/src/iter/CCKList.mli @@ -4,7 +4,7 @@ (** {1 Continuation List} - @deprecated since NEXT_RELEASE, you should use the standard {b Seq} instead. + @deprecated since 2.7, you should use the standard {b Seq} instead. See {{: https://github.com/c-cube/oseq/} oseq} for similar combinators. *) diff --git a/src/sexp/CCSexp.ml b/src/sexp/CCSexp.ml index 050f4dea..65f1ccd0 100644 --- a/src/sexp/CCSexp.ml +++ b/src/sexp/CCSexp.ml @@ -320,12 +320,12 @@ include (Make(struct CCResult.to_opt (parse_string "\"\123\bcoucou\"") <> None *) -(*$= & ~printer:(function Ok x -> to_string x | Error e -> "error " ^ e) - (parse_string "(a b)") (Ok (`List [`Atom "a"; `Atom "b"])) - (parse_string "(a\n ;coucou\n b)") (Ok (`List [`Atom "a"; `Atom "b"])) - (parse_string "(a #; (foo bar\n (1 2 3)) b)") (Ok (`List [`Atom "a"; `Atom "b"])) - (parse_string "#; (a b) (c d)") (Ok (`List [`Atom "c"; `Atom "d"])) - (parse_string "#; (a b) 1") (Ok (`Atom "1")) +(*$= & ~printer:(function Result.Ok x -> to_string x | Result.Error e -> "error " ^ e) + (parse_string "(a b)") (Result.Ok (`List [`Atom "a"; `Atom "b"])) + (parse_string "(a\n ;coucou\n b)") (Result.Ok (`List [`Atom "a"; `Atom "b"])) + (parse_string "(a #; (foo bar\n (1 2 3)) b)") (Result.Ok (`List [`Atom "a"; `Atom "b"])) + (parse_string "#; (a b) (c d)") (Result.Ok (`List [`Atom "c"; `Atom "d"])) + (parse_string "#; (a b) 1") (Result.Ok (`Atom "1")) *) diff --git a/src/sexp/CCSexp.mli b/src/sexp/CCSexp.mli index 34929f0f..2a1c27a6 100644 --- a/src/sexp/CCSexp.mli +++ b/src/sexp/CCSexp.mli @@ -9,12 +9,12 @@ type 'a gen = unit -> 'a option (** {2 Abstract representation of S-expressions} - @since NEXT_RELEASE *) + @since 2.7 *) module type SEXP = CCSexp_intf.SEXP (** {2 Operations over S-expressions} - @since NEXT_RELEASE *) + @since 2.7 *) module type S = CCSexp_intf.S (** {2 Functorized operations} @@ -22,7 +22,7 @@ module type S = CCSexp_intf.S This builds a parser and printer for S-expressions represented as in the [Sexp] argument. - @since NEXT_RELEASE *) + @since 2.7 *) module Make(Sexp : SEXP) : S with type t = Sexp.t (** {2 Basics} *) diff --git a/src/sexp/CCSexp_intf.ml b/src/sexp/CCSexp_intf.ml index c378ce57..2461f311 100644 --- a/src/sexp/CCSexp_intf.ml +++ b/src/sexp/CCSexp_intf.ml @@ -5,7 +5,7 @@ type 'a gen = unit -> 'a option (** {2 Abstract representation of S-expressions} - @since NEXT_RELEASE *) + @since 2.7 *) module type SEXP = sig type t type loc @@ -25,7 +25,7 @@ end (** {2 Operations over S-expressions} - @since NEXT_RELEASE *) + @since 2.7 *) module type S = sig type t type sexp = t