prepare for 0.14

This commit is contained in:
Simon Cruanes 2015-11-08 13:04:09 +01:00
parent 344844ff9f
commit 60aea81750
25 changed files with 140 additions and 85 deletions

View file

@ -1,5 +1,60 @@
= Changelog
== 0.14
=== breaking changes
- change the type `'a CCParse.t` with continuations
- add labels on `CCParse.parse_*` functions
- change semantics of `CCList.Zipper.is_empty`
=== other changes
- deprecate `CCVector.rev'`, renamed into `CCVector.rev_in_place`
- deprecate `CCVector.flat_map'`, renamed `flat_map_seq`
- add `CCMap.add_{list,seq}`
- add `CCSet.add_{list,seq}`
- fix small uglyness in `Map.print` and `Set.print`
- add `CCFormat.{ksprintf,string_quoted}`
- add `CCArray.sort_generic` for sorting over array-like structures in place
- add `CCHashtbl.add` mimicking the stdlib `Hashtbl.add`
- add `CCString.replace` and tests
- add `CCPersistentHashtbl.stats`
- reimplementation of `CCPersistentHashtbl`
- add `make watch` target
- add `CCVector.rev_iter`
- add `CCVector.append_list`
- add `CCVector.ensure_with`
- add `CCVector.return`
- add `CCVector.find_map`
- add `CCVector.flat_map_list`
- add `Containers.Hashtbl` with most combinators of `CCHashtbl`
- many more functions in `CCList.Zipper`
- large update of `CCList.Zipper`
- add `CCHashtbl.update`
- improve `CCHashtbl.MakeCounter`
- add `CCList.fold_flat_map`
- add module `CCChar`
- add functions in `CCFormat`
- add `CCPrint.char`
- add `CCVector.to_seq_rev`
- doc and tests for `CCLevenshtein`
- expose blocking decoder in `CCSexpM`
- add `CCList.fold_map`
- add `CCError.guard_str_trace`
- add `CCError.of_exn_trace`
- add `CCKlist.memoize` for costly computations
- add `CCLevenshtein.Index.{of,to}_{gen,seq}` and `cardinal`
- small bugfix in `CCSexpM.print`
- fix broken link to changelog (fix #51)
- fix doc generation for `containers.string`
- bugfix in `CCString.find`
- raise exception in `CCString.replace` if `sub=""`
- bugfix in hashtable printing
- bugfix in `CCKList.take`, it was slightly too eager
== 0.13
=== Breaking changes

2
_oasis
View file

@ -1,6 +1,6 @@
OASISFormat: 0.4
Name: containers
Version: 0.13
Version: 0.14
Homepage: https://github.com/c-cube/ocaml-containers
Authors: Simon Cruanes
License: BSD-2-clause

View file

@ -250,5 +250,5 @@ val sort_generic :
?cmp:('elt -> 'elt -> int) -> 'arr -> unit
(** Sort the array, without allocating (eats stack space though). Performance
might be lower than {!Array.sort}.
@since NEXT_RELEASE *)
@since 0.14 *)

View file

@ -2,7 +2,7 @@
(** {1 Utils around char}
@since NEXT_RELEASE *)
@since 0.14 *)
type t = char

View file

@ -3,7 +3,7 @@
(** {1 Utils around char}
@since NEXT_RELEASE *)
@since 0.14 *)
type t = char

View file

@ -56,7 +56,7 @@ val of_exn_trace : exn -> ('a, string) t
Remember to call [Printexc.record_backtrace true] and compile with the
debug flag for this to work.
@since NEXT_RELEASE *)
@since 0.14 *)
val fail_printf : ('a, Buffer.t, unit, ('a,string) t) format4 -> 'a
(** [fail_printf format] uses [format] to obtain an error message
@ -121,7 +121,7 @@ val guard_str : (unit -> 'a) -> ('a, string) t
val guard_str_trace : (unit -> 'a) -> ('a, string) t
(** Same as {!guard_str} but uses {!of_exn_trace} instead of {!of_exn} so
that the stack trace is printed.
@since NEXT_RELEASE *)
@since 0.14 *)
val wrap1 : ('a -> 'b) -> 'a -> ('b, exn) t
(** Same as {!guard} but gives the function one argument. *)

View file

@ -44,14 +44,14 @@ val bool : bool printer
val float3 : float printer (* 3 digits after . *)
val float : float printer
val char : char printer (** @since NEXT_RELEASE *)
val int32 : int32 printer (** @since NEXT_RELEASE *)
val int64 : int64 printer (** @since NEXT_RELEASE *)
val nativeint : nativeint printer (** @since NEXT_RELEASE *)
val char : char printer (** @since 0.14 *)
val int32 : int32 printer (** @since 0.14 *)
val int64 : int64 printer (** @since 0.14 *)
val nativeint : nativeint printer (** @since 0.14 *)
val string_quoted : string printer
(** Similar to {!CCString.print}.
@since NEXT_RELEASE *)
@since 0.14 *)
val list : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> 'a list printer
val array : ?start:string -> ?stop:string -> ?sep:string -> 'a printer -> 'a array printer
@ -81,7 +81,7 @@ val sprintf : ('a, t, unit, string) format4 -> 'a
val fprintf : t -> ('a, t, unit ) format -> 'a
(** Alias to {!Format.fprintf}
@since NEXT_RELEASE *)
@since 0.14 *)
val ksprintf :
f:(string -> 'b) ->
@ -89,7 +89,7 @@ val ksprintf :
'a
(** [ksprintf fmt ~f] formats using [fmt], in a way similar to {!sprintf},
and then calls [f] on the resulting string.
@since NEXT_RELEASE *)
@since 0.14 *)
(*$= & ~printer:CCFormat.(to_string (opt string))
(Some "hello world") \

View file

@ -146,7 +146,7 @@ module type S = sig
returns [None] then [k] is removed/stays removed, if the call
returns [Some v'] then the binding [k -> v'] is inserted
using {!Hashtbl.replace}
@since NEXT_RELEASE *)
@since 0.14 *)
val print : key printer -> 'a printer -> 'a t printer
(** Printer for tables
@ -297,11 +297,11 @@ module type COUNTER = sig
val decr : t -> elt -> unit
(** Remove one occurrence of the element
@since NEXT_RELEASE *)
@since 0.14 *)
val length : t -> int
(** Number of distinct elements
@since NEXT_RELEASE *)
@since 0.14 *)
val add_seq : t -> elt sequence -> unit
(** Increment each element of the sequence *)
@ -311,18 +311,18 @@ module type COUNTER = sig
val to_seq : t -> (elt * int) sequence
(** [to_seq tbl] returns elements of [tbl] along with their multiplicity
@since NEXT_RELEASE *)
@since 0.14 *)
val add_list : t -> (elt * int) list -> unit
(** Similar to {!add_seq}
@since NEXT_RELEASE *)
@since 0.14 *)
val of_list : (elt * int) list -> t
(** Similar to {!of_seq}
@since NEXT_RELEASE *)
@since 0.14 *)
val to_list : t -> (elt * int) list
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
end
module MakeCounter(X : Hashtbl.HashedType)

View file

@ -74,7 +74,7 @@ val update : ('a, 'b) Hashtbl.t -> f:('a -> 'b option -> 'b option) -> k:'a -> u
returns [None] then [k] is removed/stays removed, if the call
returns [Some v'] then the binding [k -> v'] is inserted
using {!Hashtbl.replace}
@since NEXT_RELEASE *)
@since 0.14 *)
val print : 'a printer -> 'b printer -> ('a, 'b) Hashtbl.t printer
(** Printer for table
@ -123,7 +123,7 @@ module type S = sig
returns [None] then [k] is removed/stays removed, if the call
returns [Some v'] then the binding [k -> v'] is inserted
using {!Hashtbl.replace}
@since NEXT_RELEASE *)
@since 0.14 *)
val print : key printer -> 'a printer -> 'a t printer
(** Printer for tables
@ -194,11 +194,11 @@ module type COUNTER = sig
val decr : t -> elt -> unit
(** Remove one occurrence of the element
@since NEXT_RELEASE *)
@since 0.14 *)
val length : t -> int
(** Number of distinct elements
@since NEXT_RELEASE *)
@since 0.14 *)
val add_seq : t -> elt sequence -> unit
(** Increment each element of the sequence *)
@ -208,18 +208,18 @@ module type COUNTER = sig
val to_seq : t -> (elt * int) sequence
(** [to_seq tbl] returns elements of [tbl] along with their multiplicity
@since NEXT_RELEASE *)
@since 0.14 *)
val add_list : t -> (elt * int) list -> unit
(** Similar to {!add_seq}
@since NEXT_RELEASE *)
@since 0.14 *)
val of_list : (elt * int) list -> t
(** Similar to {!of_seq}
@since NEXT_RELEASE *)
@since 0.14 *)
val to_list : t -> (elt * int) list
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
end
module MakeCounter(X : Hashtbl.HashedType)
@ -227,4 +227,4 @@ module MakeCounter(X : Hashtbl.HashedType)
with type elt = X.t
and type t = int Hashtbl.Make(X).t
(** Create a new counter type
The type [t] is exposed @since NEXT_RELEASE *)
The type [t] is exposed @since 0.14 *)

View file

@ -69,12 +69,12 @@ val fold_while : ('a -> 'b -> 'a * [`Stop | `Continue]) -> 'a -> 'b t -> 'a
val fold_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list
(** [fold_map f acc l] is a [fold_left]-like function, but it also maps the
list to another list.
@since NEXT_RELEASE *)
@since 0.14 *)
val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list
(** [fold_map f acc l] is a [fold_left]-like function, but it also maps the
list to a list of list that is then [flatten]'d..
@since NEXT_RELEASE *)
@since 0.14 *)
val init : int -> (int -> 'a) -> 'a t
(** Similar to {!Array.init}
@ -323,7 +323,7 @@ module Zipper : sig
val to_rev_list : 'a t -> 'a list
(** Convert the zipper back to a {i reversed} list.
In other words, [to_list (l,r)] is [List.rev_append r l]
@since NEXT_RELEASE *)
@since 0.14 *)
val make : 'a list -> 'a t
(** Create a zipper pointing at the first element of the list *)
@ -334,7 +334,7 @@ module Zipper : sig
val left_exn : 'a t -> 'a t
(** Go to the left, or
@raise Invalid_argument if the zipper is already at leftmost pos
@since NEXT_RELEASE *)
@since 0.14 *)
val right : 'a t -> 'a t
(** Go to the right, or do nothing if the zipper is already at rightmost pos *)
@ -342,7 +342,7 @@ module Zipper : sig
val right_exn : 'a t -> 'a t
(** Go to the right, or
@raise Invalid_argument if the zipper is already at rightmost position
@since NEXT_RELEASE *)
@since 0.14 *)
val modify : ('a option -> 'a option) -> 'a t -> 'a t
(** Modify the current element, if any, by returning a new element, or
@ -351,16 +351,16 @@ module Zipper : sig
val insert : 'a -> 'a t -> 'a t
(** Insert an element at the current position. If an element was focused,
[insert x l] adds [x] just before it, and focuses on [x]
@since NEXT_RELEASE *)
@since 0.14 *)
val remove : 'a t -> 'a t
(** [remove l] removes the current element, if any.
@since NEXT_RELEASE *)
@since 0.14 *)
val is_focused : _ t -> bool
(** Is the zipper focused on some element? That is, will {!focused}
return a [Some v]?
@since NEXT_RELEASE *)
@since 0.14 *)
val focused : 'a t -> 'a option
(** Returns the focused element, if any. [focused zip = Some _] iff
@ -372,17 +372,17 @@ module Zipper : sig
val drop_before : 'a t -> 'a t
(** Drop every element on the "left" (calling {!left} then will do nothing).
@since NEXT_RELEASE *)
@since 0.14 *)
val drop_after : 'a t -> 'a t
(** Drop every element on the "right" (calling {!right} then will do nothing),
keeping the focused element, if any.
@since NEXT_RELEASE *)
@since 0.14 *)
val drop_after_and_focused : 'a t -> 'a t
(** Drop every element on the "right" (calling {!right} then will do nothing),
{i including} the focused element if it is present.
@since NEXT_RELEASE *)
@since 0.14 *)
(*$=
([1], [2]) (Zipper.drop_after ([1], [2;3]))

View file

@ -45,14 +45,14 @@ module type S = sig
val of_seq : (key * 'a) sequence -> 'a t
val add_seq : 'a t -> (key * 'a) sequence -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_seq : 'a t -> (key * 'a) sequence
val of_list : (key * 'a) list -> 'a t
val add_list : 'a t -> (key * 'a) list -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_list : 'a t -> (key * 'a) list

View file

@ -48,14 +48,14 @@ module type S = sig
val of_seq : (key * 'a) sequence -> 'a t
val add_seq : 'a t -> (key * 'a) sequence -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_seq : 'a t -> (key * 'a) sequence
val of_list : (key * 'a) list -> 'a t
val add_list : 'a t -> (key * 'a) list -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_list : 'a t -> (key * 'a) list

View file

@ -70,7 +70,7 @@ val bool : bool t
val float3 : float t (* 3 digits after . *)
val float : float t
val char : char t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val list : ?start:string -> ?stop:string -> ?sep:string -> 'a t -> 'a list t
val array : ?start:string -> ?stop:string -> ?sep:string -> 'a t -> 'a array t

View file

@ -36,14 +36,14 @@ module type S = sig
val of_seq : elt sequence -> t
val add_seq : t -> elt sequence -> t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_seq : t -> elt sequence
val of_list : elt list -> t
val add_list : t -> elt list -> t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_list : t -> elt list

View file

@ -38,14 +38,14 @@ module type S = sig
val of_seq : elt sequence -> t
val add_seq : t -> elt sequence -> t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_seq : t -> elt sequence
val of_list : elt list -> t
val add_list : t -> elt list -> t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_list : t -> elt list

View file

@ -141,7 +141,7 @@ val replace : ?which:[`Left|`Right|`All] -> sub:string -> by:string -> string ->
{- [`All] all occurrences (default)}
}
@raise Invalid_argument if [sub = ""]
@since NEXT_RELEASE *)
@since 0.14 *)
(*$= & ~printer:CCFun.id
(replace ~which:`All ~sub:"a" ~by:"b" "abcdabcd") "bbcdbbcd"

View file

@ -61,7 +61,7 @@ val create_with : ?capacity:int -> 'a -> ('a, rw) t
val return : 'a -> ('a, 'mut) t
(** Singleton vector
@since NEXT_RELEASE *)
@since 0.14 *)
val make : int -> 'a -> ('a, 'mut) t
(** [make n x] makes a vector of size [n], filled with [x] *)
@ -76,7 +76,7 @@ val ensure_with : init:'a -> ('a, rw) t -> int -> unit
(** Hint to the vector that it should have at least the given capacity.
@param init if [capacity v = 0], used as a filler
element for the underlying array (see {!create_with})
@since NEXT_RELEASE *)
@since 0.14 *)
val ensure : ('a, rw) t -> int -> unit
(** Hint to the vector that it should have at least the given capacity.
@ -100,7 +100,7 @@ val append_seq : ('a, rw) t -> 'a sequence -> unit
val append_list : ('a, rw) t -> 'a list -> unit
(** Append content of list
@since NEXT_RELEASE *)
@since 0.14 *)
val equal : 'a equal -> ('a,_) t equal
@ -182,7 +182,7 @@ val find_exn : ('a -> bool) -> ('a,_) t -> 'a
val find_map : ('a -> 'b option) -> ('a,_) t -> 'b option
(** [find_map f v] returns the first [Some y = f x] for [x] in [v],
or [None] if [f x = None] for each [x] in [v]
@since NEXT_RELEASE *)
@since 0.14 *)
val filter_map : ('a -> 'b option) -> ('a,_) t -> ('b, 'mut) t
(** Map elements with a function, possibly filtering some of them out *)
@ -193,16 +193,16 @@ val flat_map : ('a -> ('b,_) t) -> ('a,_) t -> ('b, 'mut) t
val flat_map_seq : ('a -> 'b sequence) -> ('a,_) t -> ('b, 'mut) t
(** Like {!flat_map}, but using {!sequence} for
intermediate collections.
@since NEXT_RELEASE *)
@since 0.14 *)
val flat_map_list : ('a -> 'b list) -> ('a,_) t -> ('b, 'mut) t
(** Like {!flat_map}, but using {!list} for
intermediate collections.
@since NEXT_RELEASE *)
@since 0.14 *)
val flat_map' : ('a -> 'b sequence) -> ('a,_) t -> ('b, 'mut) t
(** Alias to {!flat_map_seq}
@deprecated since NEXT_RELEASE , use {!flat_map_seq} *)
@deprecated since 0.14 , use {!flat_map_seq} *)
val (>>=) : ('a,_) t -> ('a -> ('b,_) t) -> ('b, 'mut) t
(** Infix version of {!flat_map} *)
@ -227,14 +227,14 @@ val rev : ('a,_) t -> ('a, 'mut) t
val rev_in_place : ('a, rw) t -> unit
(** Reverse the vector in place
@since NEXT_RELEASE *)
@since 0.14 *)
val rev' : ('a, rw) t -> unit
(** @deprecated old name for {!rev_in_place} *)
(** @deprecated since 0.14 old name for {!rev_in_place} *)
val rev_iter : ('a -> unit) -> ('a,_) t -> unit
(** [rev_iter f a] is the same as [iter f (rev a)], only more efficient.
@since NEXT_RELEASE *)
@since 0.14 *)
val size : ('a,_) t -> int
(** number of elements in vector *)
@ -267,7 +267,7 @@ val to_seq : ('a,_) t -> 'a sequence
val to_seq_rev : ('a, _) t -> 'a sequence
(** [to_seq_rev v] returns the sequence of elements of [v] in reverse order,
that is, the last elements of [v] are iterated on first.
@since NEXT_RELEASE *)
@since 0.14 *)
val slice : ('a,rw) t -> ('a array * int * int)
(** Vector as an array slice. By doing it we expose the internal array, so

View file

@ -62,7 +62,7 @@ module Fun = CCFun
module Hash = CCHash
module Int = CCInt
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
module Hashtbl = struct
include (Hashtbl : module type of Hashtbl
with type statistics = Hashtbl.statistics

View file

@ -71,7 +71,7 @@ module type S = sig
(** Add the binding to the table, returning a new table. The old binding
for this key, if it exists, is shadowed and will be restored upon
[remove tbl k].
@since NEXT_RELEASE *)
@since 0.14 *)
val replace : 'a t -> key -> 'a -> 'a t
(** Add the binding to the table, returning a new table. This erases
@ -138,7 +138,7 @@ module type S = sig
val stats : _ t -> Hashtbl.statistics
(** Statistics on the internal table.
@since NEXT_RELEASE *)
@since 0.14 *)
end
(*$inject

View file

@ -78,7 +78,7 @@ module type S = sig
(** Add the binding to the table, returning a new table. The old binding
for this key, if it exists, is shadowed and will be restored upon
[remove tbl k].
@since NEXT_RELEASE *)
@since 0.14 *)
val replace : 'a t -> key -> 'a -> 'a t
(** Add the binding to the table, returning a new table. This erases
@ -145,7 +145,7 @@ module type S = sig
val stats : _ t -> Hashtbl.statistics
(** Statistics on the internal table.
@since NEXT_RELEASE *)
@since 0.14 *)
end
(** {2 Implementation} *)

View file

@ -193,7 +193,7 @@ val sort_uniq : ?cmp:'a ord -> 'a t -> 'a t
val memoize : 'a t -> 'a t
(** Avoid recomputations by caching intermediate results
@since NEXT_RELEASE *)
@since 0.14 *)
(** {2 Fair Combinations} *)

View file

@ -88,11 +88,11 @@ end
module ID_MONAD : MONAD
(** The monad that just uses blocking calls as bind
@since NEXT_RELEASE *)
@since 0.14 *)
module D : module type of MakeDecode(ID_MONAD)
(** Decoder that just blocks when input is not available
@since NEXT_RELEASE *)
@since 0.14 *)
val parse_string : string -> t or_error
(** Parse a string *)

View file

@ -202,22 +202,22 @@ module type S = sig
(** Extract a list of pairs from an index *)
val add_seq : 'a t -> (string_ * 'a) sequence -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val of_seq : (string_ * 'a) sequence -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_seq : 'a t -> (string_ * 'a) sequence
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val add_gen : 'a t -> (string_ * 'a) gen -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val of_gen : (string_ * 'a) gen -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_gen : 'a t -> (string_ * 'a) gen
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val fold : ('a -> string_ -> 'b -> 'a) -> 'a -> 'b t -> 'a
(** Fold over the stored pairs string/value *)

View file

@ -160,22 +160,22 @@ module type S = sig
(** Extract a list of pairs from an index *)
val add_seq : 'a t -> (string_ * 'a) sequence -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val of_seq : (string_ * 'a) sequence -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_seq : 'a t -> (string_ * 'a) sequence
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val add_gen : 'a t -> (string_ * 'a) gen -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val of_gen : (string_ * 'a) gen -> 'a t
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val to_gen : 'a t -> (string_ * 'a) gen
(** @since NEXT_RELEASE *)
(** @since 0.14 *)
val fold : ('a -> string_ -> 'b -> 'a) -> 'a -> 'b t -> 'a
(** Fold over the stored pairs string/value *)

View file

@ -132,7 +132,7 @@ type 'a t = input -> ok:('a -> unit) -> err:(exn -> unit) -> unit
{- [ok] to call with the result when it's done}
{- [err] to call when the parser met an error}
}
The type definition changed since NEXT_RELEASE to avoid stack overflows
The type definition changed since 0.14 to avoid stack overflows
@raise ParseError in case of failure *)
val return : 'a -> 'a t
@ -263,7 +263,7 @@ val fix_memo : ('a t -> 'a t) -> 'a t
(** {2 Parse}
Those functions have a label [~p] on the parser, since NEXT_RELEASE.
Those functions have a label [~p] on the parser, since 0.14.
*)
val parse : input:input -> p:'a t -> 'a or_error
@ -312,11 +312,11 @@ module U : sig
'a t -> 'b t -> ('a * 'b) t
(** Parse a pair using OCaml whitespace conventions.
The default is "(a, b)".
@since NEXT_RELEASE *)
@since 0.14 *)
val triple : ?start:string -> ?stop:string -> ?sep:string ->
'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
(** Parse a triple using OCaml whitespace conventions.
The default is "(a, b, c)".
@since NEXT_RELEASE *)
@since 0.14 *)
end