mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
prepare for 0.12
This commit is contained in:
parent
1a73ad7e29
commit
963f61a0f5
10 changed files with 60 additions and 34 deletions
28
CHANGELOG.md
28
CHANGELOG.md
|
|
@ -1,5 +1,33 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.12
|
||||||
|
|
||||||
|
### breaking
|
||||||
|
|
||||||
|
- change type of `CCString.blit` so it writes into `Bytes.t`
|
||||||
|
- better default opening flags for `CCIO.with_{in, out}`
|
||||||
|
|
||||||
|
### non-breaking
|
||||||
|
|
||||||
|
note: use of `containers.io` is deprecated (its only module has moved to `containers`)
|
||||||
|
|
||||||
|
- add `CCString.mem`
|
||||||
|
- add `CCString.set` for updating immutable strings
|
||||||
|
- add `CCList.cons` function
|
||||||
|
- enable `-safe-string` on the project; fix `-safe-string` issues
|
||||||
|
- move `CCIO` from `containers.io` to `containers`, add dummy module in `containers.io`
|
||||||
|
- add `CCIO.read_all_bytes`, reading a whole file into a `Bytes.t`
|
||||||
|
- add `CCIO.with_in_out` to read and write a file
|
||||||
|
- add `CCArray1` in containers.bigarray, a module on 1-dim bigarrays (experimental)
|
||||||
|
- add module `CCGraph` in `containers.data`, a simple graph abstraction similar to `LazyGraph`
|
||||||
|
- add a lot of string functions in `CCString`
|
||||||
|
- add `CCError.catch`, in prevision of the future standard `Result.t` type
|
||||||
|
- add `CCError.Infix` module
|
||||||
|
- add `CCHashconsedSet` in `containers.data` (set with maximal struct sharing)
|
||||||
|
|
||||||
|
- fix: use the proper array module in `CCRingBuffer`
|
||||||
|
- bugfix: `CCRandom.float_range`
|
||||||
|
|
||||||
## 0.11
|
## 0.11
|
||||||
|
|
||||||
- add `CCList.{remove,is_empty}`
|
- add `CCList.{remove,is_empty}`
|
||||||
|
|
|
||||||
7
_oasis
7
_oasis
|
|
@ -1,6 +1,6 @@
|
||||||
OASISFormat: 0.4
|
OASISFormat: 0.4
|
||||||
Name: containers
|
Name: containers
|
||||||
Version: 0.11
|
Version: 0.12
|
||||||
Homepage: https://github.com/c-cube/ocaml-containers
|
Homepage: https://github.com/c-cube/ocaml-containers
|
||||||
Authors: Simon Cruanes
|
Authors: Simon Cruanes
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
|
|
@ -18,8 +18,9 @@ Description:
|
||||||
extend the stdlib (e.g. CCList provides safe map/fold_right/append, and
|
extend the stdlib (e.g. CCList provides safe map/fold_right/append, and
|
||||||
additional functions on lists).
|
additional functions on lists).
|
||||||
|
|
||||||
It also features an optional library for dealing with strings, and a `misc`
|
It also features optional libraries for dealing with strings, helpers for unix,
|
||||||
library full of experimental ideas (not stable, not necessarily usable).
|
threads, lwt and a `misc` library full of experimental ideas (not stable, not
|
||||||
|
necessarily usable).
|
||||||
|
|
||||||
Flag "misc"
|
Flag "misc"
|
||||||
Description: Build the misc library, with experimental modules still susceptible to change
|
Description: Build the misc library, with experimental modules still susceptible to change
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
(** {1 Bigarrays of dimension 1}
|
(** {1 Bigarrays of dimension 1}
|
||||||
|
|
||||||
{b status: unstable}
|
{b status: experimental}
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(** {2 used types} *)
|
(** {2 used types} *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,6 @@ let fail_printf format =
|
||||||
|
|
||||||
(* TODO: easy ways to print backtrace/stack *)
|
(* TODO: easy ways to print backtrace/stack *)
|
||||||
|
|
||||||
(* TODO: something of type [ ('a -> 'b) -> ('err -> 'b) -> ('a, 'err) t -> 'b]
|
|
||||||
to make it easier to switch into a regular variant if it happens *)
|
|
||||||
|
|
||||||
let _printers = ref []
|
let _printers = ref []
|
||||||
|
|
||||||
let register_printer p = _printers := p :: !_printers
|
let register_printer p = _printers := p :: !_printers
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ val catch : ('a, 'err) t -> ok:('a -> 'b) -> err:('err -> 'b) -> 'b
|
||||||
This is useful for code that does not want to depend on the exact
|
This is useful for code that does not want to depend on the exact
|
||||||
definition of [('a, 'b) t] used, for instance once OCaml gets a
|
definition of [('a, 'b) t] used, for instance once OCaml gets a
|
||||||
standard [Result.t] type.
|
standard [Result.t] type.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t
|
val flat_map : ('a -> ('b, 'err) t) -> ('a, 'err) t -> ('b, 'err) t
|
||||||
|
|
||||||
|
|
@ -130,7 +130,7 @@ val (<*>) : ('a -> 'b, 'err) t -> ('a, 'err) t -> ('b, 'err) t
|
||||||
|
|
||||||
(** {2 Infix}
|
(** {2 Infix}
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
module Infix : sig
|
module Infix : sig
|
||||||
val (>|=) : ('a, 'err) t -> ('a -> 'b) -> ('b, 'err) t
|
val (>|=) : ('a, 'err) t -> ('a -> 'b) -> ('b, 'err) t
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ Examples:
|
||||||
|
|
||||||
@since 0.6
|
@since 0.6
|
||||||
|
|
||||||
@before NEXT_RELEASE was in 'containers.io', now moved into 'containers'
|
@before 0.12 was in 'containers.io', now moved into 'containers'
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ val read_all : ?size:int -> in_channel -> string
|
||||||
val read_all_bytes : ?size:int -> in_channel -> Bytes.t
|
val read_all_bytes : ?size:int -> in_channel -> Bytes.t
|
||||||
(** Read the whole channel into a mutable byte array
|
(** Read the whole channel into a mutable byte array
|
||||||
@param size the internal buffer size
|
@param size the internal buffer size
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(** {6 Output} *)
|
(** {6 Output} *)
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ val with_in_out : ?mode:int -> ?flags:open_flag list ->
|
||||||
string -> (in_channel -> out_channel -> 'a) -> 'a
|
string -> (in_channel -> out_channel -> 'a) -> 'a
|
||||||
(** Combines {!with_in} and {!with_out}.
|
(** Combines {!with_in} and {!with_out}.
|
||||||
@param flags opening flags (default [[Open_creat]])
|
@param flags opening flags (default [[Open_creat]])
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(** {2 Misc for Generators} *)
|
(** {2 Misc for Generators} *)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
|
|
||||||
val cons : 'a -> 'a t -> 'a t
|
val cons : 'a -> 'a t -> 'a t
|
||||||
(** [cons x l] is [x::l]
|
(** [cons x l] is [x::l]
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val append : 'a t -> 'a t -> 'a t
|
val append : 'a t -> 'a t -> 'a t
|
||||||
(** Safe version of append *)
|
(** Safe version of append *)
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ val find : ?start:int -> sub:string -> string -> int
|
||||||
|
|
||||||
val mem : ?start:int -> sub:string -> string -> bool
|
val mem : ?start:int -> sub:string -> string -> bool
|
||||||
(** [mem ~sub s] is true iff [sub] is a substring of [s]
|
(** [mem ~sub s] is true iff [sub] is a substring of [s]
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
mem ~sub:"bc" "abcd"
|
mem ~sub:"bc" "abcd"
|
||||||
|
|
@ -120,7 +120,7 @@ val mem : ?start:int -> sub:string -> string -> bool
|
||||||
val rfind : sub:string -> string -> int
|
val rfind : sub:string -> string -> int
|
||||||
(** Find [sub] in string from the right, returns its first index or [-1].
|
(** Find [sub] in string from the right, returns its first index or [-1].
|
||||||
Should only be used with very small [sub]
|
Should only be used with very small [sub]
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
rfind ~sub:"bc" "abcd" = 1
|
rfind ~sub:"bc" "abcd" = 1
|
||||||
|
|
@ -183,7 +183,7 @@ val set : string -> int -> char -> string
|
||||||
(** [set s i c] creates a new string which is a copy of [s], except
|
(** [set s i c] creates a new string which is a copy of [s], except
|
||||||
for index [i], which becomes [c].
|
for index [i], which becomes [c].
|
||||||
@raise Invalid_argument if [i] is an invalid index
|
@raise Invalid_argument if [i] is an invalid index
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
set "abcd" 1 '_' = "a_cd"
|
set "abcd" 1 '_' = "a_cd"
|
||||||
|
|
@ -193,32 +193,32 @@ val set : string -> int -> char -> string
|
||||||
|
|
||||||
val iter : (char -> unit) -> string -> unit
|
val iter : (char -> unit) -> string -> unit
|
||||||
(** Alias to {!String.iter}
|
(** Alias to {!String.iter}
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val iteri : (int -> char -> unit) -> string -> unit
|
val iteri : (int -> char -> unit) -> string -> unit
|
||||||
(** iter on chars with their index
|
(** iter on chars with their index
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val map : (char -> char) -> string -> string
|
val map : (char -> char) -> string -> string
|
||||||
(** map chars
|
(** map chars
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val mapi : (int -> char -> char) -> string -> string
|
val mapi : (int -> char -> char) -> string -> string
|
||||||
(** map chars with their index
|
(** map chars with their index
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val flat_map : ?sep:string -> (char -> string) -> string -> string
|
val flat_map : ?sep:string -> (char -> string) -> string -> string
|
||||||
(** map each chars to a string, then concatenates them all
|
(** map each chars to a string, then concatenates them all
|
||||||
@param sep optional separator between each generated string
|
@param sep optional separator between each generated string
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val for_all : (char -> bool) -> string -> bool
|
val for_all : (char -> bool) -> string -> bool
|
||||||
(** true for all chars?
|
(** true for all chars?
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val exists : (char -> bool) -> string -> bool
|
val exists : (char -> bool) -> string -> bool
|
||||||
(** true for some char?
|
(** true for some char?
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
include S with type t := string
|
include S with type t := string
|
||||||
|
|
||||||
|
|
@ -227,32 +227,32 @@ include S with type t := string
|
||||||
val map2 : (char -> char -> char) -> string -> string -> string
|
val map2 : (char -> char -> char) -> string -> string -> string
|
||||||
(** map pairs of chars
|
(** map pairs of chars
|
||||||
@raises Invalid_argument if the strings have not the same length
|
@raises Invalid_argument if the strings have not the same length
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val iter2: (char -> char -> unit) -> string -> string -> unit
|
val iter2: (char -> char -> unit) -> string -> string -> unit
|
||||||
(** iterate on pairs of chars
|
(** iterate on pairs of chars
|
||||||
@raises Invalid_argument if the strings have not the same length
|
@raises Invalid_argument if the strings have not the same length
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val iteri2: (int -> char -> char -> unit) -> string -> string -> unit
|
val iteri2: (int -> char -> char -> unit) -> string -> string -> unit
|
||||||
(** iterate on pairs of chars with their index
|
(** iterate on pairs of chars with their index
|
||||||
@raises Invalid_argument if the strings have not the same length
|
@raises Invalid_argument if the strings have not the same length
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val fold2: ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'a
|
val fold2: ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'a
|
||||||
(** fold on pairs of chars
|
(** fold on pairs of chars
|
||||||
@raises Invalid_argument if the strings have not the same length
|
@raises Invalid_argument if the strings have not the same length
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val for_all2 : (char -> char -> bool) -> string -> string -> bool
|
val for_all2 : (char -> char -> bool) -> string -> string -> bool
|
||||||
(** all pair of chars respect the predicate?
|
(** all pair of chars respect the predicate?
|
||||||
@raises Invalid_argument if the strings have not the same length
|
@raises Invalid_argument if the strings have not the same length
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
val exists2 : (char -> char -> bool) -> string -> string -> bool
|
val exists2 : (char -> char -> bool) -> string -> string -> bool
|
||||||
(** exists a pair of chars?
|
(** exists a pair of chars?
|
||||||
@raises Invalid_argument if the strings have not the same length
|
@raises Invalid_argument if the strings have not the same length
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(** {2 Splitting} *)
|
(** {2 Splitting} *)
|
||||||
|
|
||||||
|
|
@ -294,7 +294,7 @@ module Split : sig
|
||||||
val left : by:string -> string -> (string * string) option
|
val left : by:string -> string -> (string * string) option
|
||||||
(** Split on the first occurrence of [by] from the left-most part of
|
(** Split on the first occurrence of [by] from the left-most part of
|
||||||
the string
|
the string
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
Split.left ~by:" " "ab cde f g " = Some ("ab", "cde f g ")
|
Split.left ~by:" " "ab cde f g " = Some ("ab", "cde f g ")
|
||||||
|
|
@ -304,7 +304,7 @@ module Split : sig
|
||||||
val right : by:string -> string -> (string * string) option
|
val right : by:string -> string -> (string * string) option
|
||||||
(** Split on the first occurrence of [by] from the rightmost part of
|
(** Split on the first occurrence of [by] from the rightmost part of
|
||||||
the string
|
the string
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
(*$T
|
(*$T
|
||||||
Split.right ~by:" " "ab cde f g" = Some ("ab cde f", "g")
|
Split.right ~by:" " "ab cde f g" = Some ("ab cde f", "g")
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
{b status: unstable}
|
{b status: unstable}
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.12 *)
|
||||||
|
|
||||||
type 'a sequence = ('a -> unit) -> unit
|
type 'a sequence = ('a -> unit) -> unit
|
||||||
(** A sequence of items of type ['a], possibly infinite *)
|
(** A sequence of items of type ['a], possibly infinite *)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
{b status: unstable}
|
{b status: unstable}
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.12
|
||||||
*)
|
*)
|
||||||
|
|
||||||
module type ELT = sig
|
module type ELT = sig
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue