prepare for 0.13

This commit is contained in:
Simon Cruanes 2015-09-23 16:26:07 +02:00
parent f56a40b753
commit 044cbf0c20
32 changed files with 160 additions and 98 deletions

View file

@ -1,5 +1,67 @@
= Changelog = Changelog
== 0.13
=== Breaking changes
- big refactoring of `CCLinq` (now simpler and cleaner)
- changed the types `input` and `ParseError` in `CCParse`
- move `containers.misc` and `containers.lwt` into their own repo
- change the exceptions in `CCVector`
- change signature of `CCDeque.of_seq`
=== Other changes
- add module `CCWBTree`, a weight-balanced tree, in `containers.data`.
- add module `CCBloom` in `containers.data`, a bloom filter
- new module `CCHashTrie` in `containers.data`, HAMT-like associative map
- add module `CCBitField` in `containers.data`, a safe abstraction for bitfields of < 62 bits
- add module `CCHashSet` into `containers.data`, a mutable set
- add module `CCInt64`
- move module `RAL` into `containers.data` as `CCRAL`
- new module `CCThread` in `containers.thread`, utils for threading (+ blocking queue)
- new module `CCSemaphore` in `containers.thread`, with simple semaphore
- add `containers.top`, a small library that installs printers
- add `CCParse.memo` for memoization (changes `CCParse.input`)
- add `CCString.compare_versions`
- update `CCHash` with a functor and module type for generic hashing
- add `CCList.{take,drop}_while`; improve map performance
- add `CCList.cons_maybe`
- add `CCArray.bsearch` (back from batteries)
- add fair functions to `CCKList`
- deprecate `CCList.split`, introduce `CCList.take_drop` instead.
- add `CCKtree.force`
- add tests to `CCIntMap`; now flagged "stable" (for the API)
- add `CCOpt.choice_seq`
- add `CCOpt.print`
- add `CCIntMap.{equal,compare,{of,to,add}_{gen,klist}}`
- add `CCThread.Barrier` for simple synchronization
- add `CCPersistentArray.{append,flatten,flat_map,of_gen,to_gen}`
- add `CCDeque.clear`
- add `CCDeque.{fold,append_{front,back},{of,to}_{gen,list}}` and others
- add `CCKList.{zip, unzip}`
- add `CCKList.{of_array,to_array}`
- add `CCKList.{head,tail,mapi,iteri}`
- add `CCKList.{unfold,of_gen}`
- add `CCParse.{input_of_chan,parse_file,parse_file_exn}`
- modify `CCParse.U.list` to skip newlines
- add `CCDeque.print`
- add `CCBV.print`
- add printer to `CCHashtbl`
- bugfix in `CCSexpM`
- new tests in `CCTrie`; bugfix in `CCTrie.below`
- lots of new tests
- more benchmarks; cleanup of benchmarks
- migration of tests to 100% qtest
- migration markdown to asciidoc for doc (readme, etc.)
- add tests to `CCIntMap`, add type safety, and fix various bugs in `{union,inter}`
- more efficient `CCThread.Queue.{push,take}_list`
- slightly different implem for `CCThread.Queue.{take,push}`
- new implementation for `CCDeque`, more efficient
- update makefile (target devel)
== 0.12 == 0.12
=== breaking === breaking

2
_oasis
View file

@ -1,6 +1,6 @@
OASISFormat: 0.4 OASISFormat: 0.4
Name: containers Name: containers
Version: 0.12 Version: 0.13
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

View file

@ -124,7 +124,7 @@ val empty : 'a t
val start : 'a -> 'a t val start : 'a -> 'a t
(** Start with a single value (** Start with a single value
@deprecated since NEXT_RELEASE, use {!return} instead *) @deprecated since 0.13, use {!return} instead *)
val return : 'a -> 'a t val return : 'a -> 'a t
(** Return one value *) (** Return one value *)

View file

@ -110,7 +110,7 @@ val to_seq_slice : t -> int -> int -> char sequence
val to_gen_slice : t -> int -> int -> char gen val to_gen_slice : t -> int -> int -> char gen
val print : t printer val print : t printer
(** @since NEXT_RELEASE *) (** @since 0.13 *)
(** {2 Memory-map} *) (** {2 Memory-map} *)

View file

@ -108,7 +108,7 @@ module type S = sig
- [`Empty] if the array is empty - [`Empty] if the array is empty
@raise Invalid_argument if the array is found to be unsorted w.r.t [cmp] @raise Invalid_argument if the array is found to be unsorted w.r.t [cmp]
@since NEXT_RELEASE *) @since 0.13 *)
val for_all : ('a -> bool) -> 'a t -> bool val for_all : ('a -> bool) -> 'a t -> bool

View file

@ -110,7 +110,7 @@ module type S = sig
- [`Empty] if the array is empty - [`Empty] if the array is empty
@raise Invalid_argument if the array is found to be unsorted w.r.t [cmp] @raise Invalid_argument if the array is found to be unsorted w.r.t [cmp]
@since NEXT_RELEASE *) @since 0.13 *)
val for_all : ('a -> bool) -> 'a t -> bool val for_all : ('a -> bool) -> 'a t -> bool

View file

@ -55,7 +55,7 @@ val apply : 'a hash_fun -> 'a -> int
(** {2 Basic Combinators} (** {2 Basic Combinators}
Those combinators have been renamed in NEXT_RELEASE, so as to Those combinators have been renamed in 0.13, so as to
remove the trailing "_". remove the trailing "_".
They are now defined by the application of {!Make} They are now defined by the application of {!Make}
@ -112,7 +112,7 @@ val klist : 'a hash_fun -> 'a klist hash_fun
This can for instance be used for cryptographic hashing or This can for instance be used for cryptographic hashing or
checksums such as MD5. checksums such as MD5.
@since NEXT_RELEASE *) @since 0.13 *)
module type HASH = sig module type HASH = sig
type state type state

View file

@ -70,7 +70,7 @@ val of_list : ('a * 'b) list -> ('a,'b) Hashtbl.t
val print : 'a printer -> 'b printer -> ('a, 'b) Hashtbl.t printer val print : 'a printer -> 'b printer -> ('a, 'b) Hashtbl.t printer
(** Printer for table (** Printer for table
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Functor} *) (** {2 Functor} *)
@ -111,7 +111,7 @@ module type S = sig
val print : key printer -> 'a printer -> 'a t printer val print : key printer -> 'a printer -> 'a t printer
(** Printer for tables (** Printer for tables
@since NEXT_RELEASE *) @since 0.13 *)
end end
module Make(X : Hashtbl.HashedType) : module Make(X : Hashtbl.HashedType) :

View file

@ -58,8 +58,8 @@ val pp : t printer
val print : t formatter val print : t formatter
val to_string : t -> string val to_string : t -> string
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val of_string : string -> t option val of_string : string -> t option
(** @since NEXT_RELEASE *) (** @since 0.13 *)

View file

@ -5,7 +5,7 @@
Helpers for in64. Helpers for in64.
@since NEXT_RELEASE *) @since 0.13 *)
type t = int64 type t = int64

View file

@ -51,7 +51,7 @@ val append : 'a t -> 'a t -> 'a t
val cons_maybe : 'a option -> 'a t -> 'a t val cons_maybe : 'a option -> 'a t -> 'a t
(** [cons_maybe (Some x) l] is [x :: l] (** [cons_maybe (Some x) l] is [x :: l]
[cons_maybe None l] is [l] [cons_maybe None l] is [l]
@since NEXT_RELEASE *) @since 0.13 *)
val (@) : 'a t -> 'a t -> 'a t val (@) : 'a t -> 'a t -> 'a t
@ -119,14 +119,14 @@ val take_drop : int -> 'a t -> 'a t * 'a t
[length l1 = min (length l) n] *) [length l1 = min (length l) n] *)
val take_while : ('a -> bool) -> 'a t -> 'a t val take_while : ('a -> bool) -> 'a t -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val drop_while : ('a -> bool) -> 'a t -> 'a t val drop_while : ('a -> bool) -> 'a t -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val split : int -> 'a t -> 'a t * 'a t val split : int -> 'a t -> 'a t * 'a t
(** synonym to {!take_drop} (** synonym to {!take_drop}
@deprecated since NEXT_RELEASE: conflict with the {!List.split} standard function *) @deprecated since 0.13: conflict with the {!List.split} standard function *)
val last : int -> 'a t -> 'a t val last : int -> 'a t -> 'a t
(** [last n l] takes the last [n] elements of [l] (or less if (** [last n l] takes the last [n] elements of [l] (or less if

View file

@ -129,7 +129,7 @@ val random : 'a random_gen -> 'a t random_gen
val choice_seq : 'a t sequence -> 'a t val choice_seq : 'a t sequence -> 'a t
(** [choice_seq s] is similar to {!choice}, but works on sequences. (** [choice_seq s] is similar to {!choice}, but works on sequences.
It returns the first [Some x] occurring in [s], or [None] otherwise. It returns the first [Some x] occurring in [s], or [None] otherwise.
@since NEXT_RELEASE *) @since 0.13 *)
val to_gen : 'a t -> 'a gen val to_gen : 'a t -> 'a gen
val to_seq : 'a t -> 'a sequence val to_seq : 'a t -> 'a sequence
@ -137,5 +137,5 @@ val to_seq : 'a t -> 'a sequence
val pp : 'a printer -> 'a t printer val pp : 'a printer -> 'a t printer
val print : 'a fmt -> 'a t fmt val print : 'a fmt -> 'a t fmt
(** @since NEXT_RELEASE *) (** @since 0.13 *)

View file

@ -317,7 +317,7 @@ end
val compare_versions : string -> string -> int val compare_versions : string -> string -> int
(** [compare_versions a b] compares {i version strings} [a] and [b], (** [compare_versions a b] compares {i version strings} [a] and [b],
considering that numbers are above text. considering that numbers are above text.
@since NEXT_RELEASE *) @since 0.13 *)
(*$T (*$T
compare_versions "0.1.3" "0.1" > 0 compare_versions "0.1.3" "0.1" > 0

View file

@ -92,4 +92,4 @@ end
module Vector = CCVector module Vector = CCVector
module Int64 = CCInt64 module Int64 = CCInt64
(** @since NEXT_RELEASE *) (** @since 0.13 *)

View file

@ -123,4 +123,4 @@ val of_seq : int sequence -> t
val print : Format.formatter -> t -> unit val print : Format.formatter -> t -> unit
(** Print the bitvector as a string of bits (** Print the bitvector as a string of bits
@since NEXT_RELEASE *) @since 0.13 *)

View file

@ -27,7 +27,7 @@ Format.printf "f: %a@." B.pp f;;
{b status: experimental} {b status: experimental}
@since NEXT_RELEASE @since 0.13
*) *)
exception TooManyFields exception TooManyFields

View file

@ -5,7 +5,7 @@
{b status: experimental} {b status: experimental}
@since NEXT_RELEASE *) @since 0.13 *)
type 'a sequence = ('a -> unit) -> unit type 'a sequence = ('a -> unit) -> unit
type 'a gen = unit -> 'a option type 'a gen = unit -> 'a option

View file

@ -35,7 +35,7 @@ val create : unit -> 'a t
val clear : _ t -> unit val clear : _ t -> unit
(** Remove all elements (** Remove all elements
@since NEXT_RELEASE *) @since 0.13 *)
val is_empty : 'a t -> bool val is_empty : 'a t -> bool
(** Is the deque empty? *) (** Is the deque empty? *)
@ -44,12 +44,12 @@ val equal : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool
(** [equal a b] checks whether [a] and [b] contain the same sequence of (** [equal a b] checks whether [a] and [b] contain the same sequence of
elements. elements.
@param eq comparison function for elements @param eq comparison function for elements
@since NEXT_RELEASE *) @since 0.13 *)
val compare : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int val compare : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int
(** [equal a b] compares lexicographically [a] and [b] (** [equal a b] compares lexicographically [a] and [b]
@param cmp comparison function for elements @param cmp comparison function for elements
@since NEXT_RELEASE *) @since 0.13 *)
val length : 'a t -> int val length : 'a t -> int
(** Number of elements (** Number of elements
@ -76,18 +76,18 @@ val take_front : 'a t -> 'a
val append_front : into:'a t -> 'a t -> unit val append_front : into:'a t -> 'a t -> unit
(** [append_front ~into q] adds all elements of [q] at the front (** [append_front ~into q] adds all elements of [q] at the front
of [into] of [into]
@since NEXT_RELEASE *) @since 0.13 *)
val append_back : into:'a t -> 'a t -> unit val append_back : into:'a t -> 'a t -> unit
(** [append_back ~into q] adds all elements of [q] at the back of [into] (** [append_back ~into q] adds all elements of [q] at the back of [into]
@since NEXT_RELEASE *) @since 0.13 *)
val iter : ('a -> unit) -> 'a t -> unit val iter : ('a -> unit) -> 'a t -> unit
(** Iterate on elements *) (** Iterate on elements *)
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
(** Fold on elements (** Fold on elements
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Conversions} *) (** {2 Conversions} *)
@ -96,44 +96,44 @@ type 'a sequence = ('a -> unit) -> unit
val of_seq : 'a sequence -> 'a t val of_seq : 'a sequence -> 'a t
(** Create a deque from the sequence. (** Create a deque from the sequence.
@since NEXT_RELEASE optional argument [deque] disappears, use @since 0.13 optional argument [deque] disappears, use
{!add_seq_back} instead *) {!add_seq_back} instead *)
val to_seq : 'a t -> 'a sequence val to_seq : 'a t -> 'a sequence
val of_gen : 'a gen -> 'a t val of_gen : 'a gen -> 'a t
(** [of_gen g] makes a deque containing the elements of [g] (** [of_gen g] makes a deque containing the elements of [g]
@since NEXT_RELEASE *) @since 0.13 *)
val to_gen : 'a t -> 'a gen val to_gen : 'a t -> 'a gen
(** Iterates on elements of the deque (** Iterates on elements of the deque
@since NEXT_RELEASE *) @since 0.13 *)
val add_seq_front : 'a t -> 'a sequence -> unit val add_seq_front : 'a t -> 'a sequence -> unit
(** [add_seq_front q seq] adds elements of [seq] into the front of [q], (** [add_seq_front q seq] adds elements of [seq] into the front of [q],
in reverse order in reverse order
@since NEXT_RELEASE *) @since 0.13 *)
val add_seq_back : 'a t -> 'a sequence -> unit val add_seq_back : 'a t -> 'a sequence -> unit
(** [add_seq_back q seq] adds elements of [seq] into the back of [q], (** [add_seq_back q seq] adds elements of [seq] into the back of [q],
in order in order
@since NEXT_RELEASE *) @since 0.13 *)
val copy : 'a t -> 'a t val copy : 'a t -> 'a t
(** Fresh copy *) (** Fresh copy *)
val of_list : 'a list -> 'a t val of_list : 'a list -> 'a t
(** Conversion from list, in order (** Conversion from list, in order
@since NEXT_RELEASE *) @since 0.13 *)
val to_list : 'a t -> 'a list val to_list : 'a t -> 'a list
(** List of elements, in order (** List of elements, in order
{b warning: not tailrec} {b warning: not tailrec}
@since NEXT_RELEASE *) @since 0.13 *)
val to_rev_list : 'a t -> 'a list val to_rev_list : 'a t -> 'a list
(** Efficient conversion to list, in reverse order (** Efficient conversion to list, in reverse order
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 print} *) (** {2 print} *)
@ -141,4 +141,4 @@ type 'a printer = Format.formatter -> 'a -> unit
val print : 'a printer -> 'a t printer val print : 'a printer -> 'a t printer
(** Print the elements (** Print the elements
@since NEXT_RELEASE *) @since 0.13 *)

View file

@ -150,4 +150,4 @@ val (--) : int -> int -> int t
@since 0.10 *) @since 0.10 *)
val print : 'a printer -> 'a t printer val print : 'a printer -> 'a t printer
(** @since NEXT_RELEASE *) (** @since 0.13 *)

View file

@ -4,7 +4,7 @@
{b status: unstable} {b status: unstable}
@since NEXT_RELEASE *) @since 0.13 *)
type 'a sequence = ('a -> unit) -> unit type 'a sequence = ('a -> unit) -> unit
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit

View file

@ -13,7 +13,7 @@
{b status: unstable} {b status: unstable}
@since NEXT_RELEASE @since 0.13
*) *)
type 'a sequence = ('a -> unit) -> unit type 'a sequence = ('a -> unit) -> unit

View file

@ -52,11 +52,11 @@ val remove : int -> 'a t -> 'a t
val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool
(** [equal ~eq a b] checks whether [a] and [b] have the same set of pairs (** [equal ~eq a b] checks whether [a] and [b] have the same set of pairs
(key, value), comparing values with [eq] (key, value), comparing values with [eq]
@since NEXT_RELEASE *) @since 0.13 *)
val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int
(** Total order between maps; the precise order is unspecified . (** Total order between maps; the precise order is unspecified .
@since NEXT_RELEASE *) @since 0.13 *)
val update : int -> ('a option -> 'a option) -> 'a t -> 'a t val update : int -> ('a option -> 'a option) -> 'a t -> 'a t
@ -99,22 +99,22 @@ val keys : _ t -> int sequence
val values : 'a t -> 'a sequence val values : 'a t -> 'a sequence
val add_gen : 'a t -> (int * 'a) gen -> 'a t val add_gen : 'a t -> (int * 'a) gen -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val of_gen : (int * 'a) gen -> 'a t val of_gen : (int * 'a) gen -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val to_gen : 'a t -> (int * 'a) gen val to_gen : 'a t -> (int * 'a) gen
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val add_klist : 'a t -> (int * 'a) klist -> 'a t val add_klist : 'a t -> (int * 'a) klist -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val of_klist : (int * 'a) klist -> 'a t val of_klist : (int * 'a) klist -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val to_klist : 'a t -> (int * 'a) klist val to_klist : 'a t -> (int * 'a) klist
(** @since NEXT_RELEASE *) (** @since 0.13 *)
type 'a tree = unit -> [`Nil | `Node of 'a * 'a tree list] type 'a tree = unit -> [`Nil | `Node of 'a * 'a tree list]
@ -125,7 +125,7 @@ val as_tree : 'a t -> [`Node of int * int | `Leaf of int * 'a ] tree
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit
val print : 'a printer -> 'a t printer val print : 'a printer -> 'a t printer
(** @since NEXT_RELEASE *) (** @since 0.13 *)
(** Helpers *) (** Helpers *)

View file

@ -86,15 +86,15 @@ val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val append : 'a t -> 'a t -> 'a t val append : 'a t -> 'a t -> 'a t
(** Append the two arrays (** Append the two arrays
@since NEXT_RELEASE *) @since 0.13 *)
val flatten : 'a t t -> 'a t val flatten : 'a t t -> 'a t
(** Concatenates all the sub-arrays (** Concatenates all the sub-arrays
@since NEXT_RELEASE *) @since 0.13 *)
val flat_map : ('a -> 'b t) -> 'a t -> 'b t val flat_map : ('a -> 'b t) -> 'a t -> 'b t
(** Flat map (map + concatenation) (** Flat map (map + concatenation)
@since NEXT_RELEASE *) @since 0.13 *)
val to_array : 'a t -> 'a array val to_array : 'a t -> 'a array
(** [to_array t] returns a mutable copy of [t]. *) (** [to_array t] returns a mutable copy of [t]. *)
@ -110,7 +110,7 @@ val of_list : 'a list -> 'a t
val of_rev_list : 'a list -> 'a t val of_rev_list : 'a list -> 'a t
(** [of_rev_list l] is the same as [of_list (List.rev l)] but more efficient (** [of_rev_list l] is the same as [of_list (List.rev l)] but more efficient
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Conversions} *) (** {2 Conversions} *)
@ -122,15 +122,15 @@ val to_seq : 'a t -> 'a sequence
val of_seq : 'a sequence -> 'a t val of_seq : 'a sequence -> 'a t
val of_gen : 'a gen -> 'a t val of_gen : 'a gen -> 'a t
(** @since NEXT_RELEASE *) (** @since 0.13 *)
val to_gen : 'a t -> 'a gen val to_gen : 'a t -> 'a gen
(** @since NEXT_RELEASE *) (** @since 0.13 *)
(** {2 IO} *) (** {2 IO} *)
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit
val print : 'a printer -> 'a t printer val print : 'a printer -> 'a t printer
(** @since NEXT_RELEASE *) (** @since 0.13 *)

View file

@ -12,7 +12,7 @@
{b status: stable} {b status: stable}
@since NEXT_RELEASE @since 0.13
*) *)
type +'a t type +'a t

View file

@ -5,7 +5,7 @@
{b status: experimental} {b status: experimental}
@since NEXT_RELEASE *) @since 0.13 *)
type 'a sequence = ('a -> unit) -> unit type 'a sequence = ('a -> unit) -> unit
type 'a gen = unit -> 'a option type 'a gen = unit -> 'a option

View file

@ -60,27 +60,27 @@ val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t
(** [unfold f acc] calls [f acc] and: (** [unfold f acc] calls [f acc] and:
- if [f acc = Some (x, acc')], yield [x], continue with [unfold f acc'] - if [f acc = Some (x, acc')], yield [x], continue with [unfold f acc']
- if [f acc = None], stops - if [f acc = None], stops
@since NEXT_RELEASE *) @since 0.13 *)
val is_empty : 'a t -> bool val is_empty : 'a t -> bool
val head : 'a t -> 'a option val head : 'a t -> 'a option
(** Head of the list (** Head of the list
@since NEXT_RELEASE *) @since 0.13 *)
val head_exn : 'a t -> 'a val head_exn : 'a t -> 'a
(** Unsafe version of {!head} (** Unsafe version of {!head}
@raise Not_found if the list is empty @raise Not_found if the list is empty
@since NEXT_RELEASE *) @since 0.13 *)
val tail : 'a t -> 'a t option val tail : 'a t -> 'a t option
(** Tail of the list (** Tail of the list
@since NEXT_RELEASE *) @since 0.13 *)
val tail_exn : 'a t -> 'a t val tail_exn : 'a t -> 'a t
(** Unsafe version of {!tail} (** Unsafe version of {!tail}
@raise Not_found if the list is empty @raise Not_found if the list is empty
@since NEXT_RELEASE *) @since 0.13 *)
val equal : 'a equal -> 'a t equal val equal : 'a equal -> 'a t equal
(** Equality step by step. Eager. *) (** Equality step by step. Eager. *)
@ -95,7 +95,7 @@ val iter : ('a -> unit) -> 'a t -> unit
val iteri : (int -> 'a -> unit) -> 'a t -> unit val iteri : (int -> 'a -> unit) -> 'a t -> unit
(** Iterate with index (starts at 0) (** Iterate with index (starts at 0)
@since NEXT_RELEASE *) @since 0.13 *)
val length : _ t -> int val length : _ t -> int
(** Number of elements in the list. (** Number of elements in the list.
@ -114,7 +114,7 @@ val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
(** Map with index (starts at 0) (** Map with index (starts at 0)
@since NEXT_RELEASE *) @since 0.13 *)
val fmap : ('a -> 'b option) -> 'a t -> 'b t val fmap : ('a -> 'b option) -> 'a t -> 'b t
@ -173,11 +173,11 @@ val merge : 'a ord -> 'a t -> 'a t -> 'a t
val zip : 'a t -> 'b t -> ('a * 'b) t val zip : 'a t -> 'b t -> ('a * 'b) t
(** Combine elements pairwise. Stops as soon as one of the lists stops. (** Combine elements pairwise. Stops as soon as one of the lists stops.
@since NEXT_RELEASE *) @since 0.13 *)
val unzip : ('a * 'b) t -> 'a t * 'b t val unzip : ('a * 'b) t -> 'a t * 'b t
(** Splits each tuple in the list (** Splits each tuple in the list
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Misc} *) (** {2 Misc} *)
@ -195,15 +195,15 @@ val sort_uniq : ?cmp:'a ord -> 'a t -> 'a t
val interleave : 'a t -> 'a t -> 'a t val interleave : 'a t -> 'a t -> 'a t
(** Fair interleaving of both streams. (** Fair interleaving of both streams.
@since NEXT_RELEASE *) @since 0.13 *)
val fair_flat_map : ('a -> 'b t) -> 'a t -> 'b t val fair_flat_map : ('a -> 'b t) -> 'a t -> 'b t
(** Fair version of {!flat_map}. (** Fair version of {!flat_map}.
@since NEXT_RELEASE *) @since 0.13 *)
val fair_app : ('a -> 'b) t -> 'a t -> 'b t val fair_app : ('a -> 'b) t -> 'a t -> 'b t
(** Fair version of {!(<*>)} (** Fair version of {!(<*>)}
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Implementations} (** {2 Implementations}
@since 0.3.3 *) @since 0.3.3 *)
@ -216,11 +216,11 @@ val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
val (>>-) : 'a t -> ('a -> 'b t) -> 'b t val (>>-) : 'a t -> ('a -> 'b t) -> 'b t
(** Infix version of {! fair_flat_map} (** Infix version of {! fair_flat_map}
@since NEXT_RELEASE *) @since 0.13 *)
val (<.>) : ('a -> 'b) t -> 'a t -> 'b t val (<.>) : ('a -> 'b) t -> 'a t -> 'b t
(** Infix version of {!fair_app} (** Infix version of {!fair_app}
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Monadic Operations} *) (** {2 Monadic Operations} *)
module type MONAD = sig module type MONAD = sig
@ -246,11 +246,11 @@ val to_list : 'a t -> 'a list
val of_array : 'a array -> 'a t val of_array : 'a array -> 'a t
(** Iterate on the array (** Iterate on the array
@since NEXT_RELEASE *) @since 0.13 *)
val to_array : 'a t -> 'a array val to_array : 'a t -> 'a array
(** Convert into array. Iterates twice. (** Convert into array. Iterates twice.
@since NEXT_RELEASE *) @since 0.13 *)
val to_rev_list : 'a t -> 'a list val to_rev_list : 'a t -> 'a list
(** Convert to a list, in reverse order. More efficient than {!to_list} *) (** Convert to a list, in reverse order. More efficient than {!to_list} *)
@ -261,7 +261,7 @@ val to_gen : 'a t -> 'a gen
val of_gen : 'a gen -> 'a t val of_gen : 'a gen -> 'a t
(** [of_gen g] consumes the generator and caches intermediate results (** [of_gen g] consumes the generator and caches intermediate results
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 IO} *) (** {2 IO} *)

View file

@ -94,7 +94,7 @@ val bfs : ?pset:'a pset -> 'a t -> 'a klist
val force : 'a t -> ([ `Nil | `Node of 'a * 'b list ] as 'b) val force : 'a t -> ([ `Nil | `Node of 'a * 'b list ] as 'b)
(** [force t] evaluates [t] completely and returns a regular tree (** [force t] evaluates [t] completely and returns a regular tree
structure structure
@since NEXT_RELEASE *) @since 0.13 *)
val find : ?pset:'a pset -> ('a -> 'b option) -> 'a t -> 'b option val find : ?pset:'a pset -> ('a -> 'b option) -> 'a t -> 'b option
(** Look for an element that maps to [Some _] *) (** Look for an element that maps to [Some _] *)

View file

@ -44,8 +44,8 @@ type input = {
cur : unit -> char; (** Current char *) cur : unit -> char; (** Current char *)
next : unit -> char; (** if not {!is_done}, move to next char *) next : unit -> char; (** if not {!is_done}, move to next char *)
pos : unit -> int; (** Current pos *) pos : unit -> int; (** Current pos *)
lnum : unit -> line_num; (** Line number @since NEXT_RELEASE *) lnum : unit -> line_num; (** Line number @since 0.13 *)
cnum : unit -> col_num; (** column number @since NEXT_RELEASE *) cnum : unit -> col_num; (** column number @since 0.13 *)
memo : memo_; (** memoization table, if any *) memo : memo_; (** memoization table, if any *)
backtrack : int -> unit; (** Restore to previous pos *) backtrack : int -> unit; (** Restore to previous pos *)
sub : int -> int -> string; (** Extract slice from [pos] with [len] *) sub : int -> int -> string; (** Extract slice from [pos] with [len] *)

View file

@ -64,17 +64,17 @@ parse_string_exn "[abc , de, hello ,world ]" p;;
type 'a or_error = [`Ok of 'a | `Error of string] type 'a or_error = [`Ok of 'a | `Error of string]
type line_num = int (** @since NEXT_RELEASE *) type line_num = int (** @since 0.13 *)
type col_num = int (** @since NEXT_RELEASE *) type col_num = int (** @since 0.13 *)
exception ParseError of line_num * col_num * (unit -> string) exception ParseError of line_num * col_num * (unit -> string)
(** position * message (** position * message
This type changed at NEXT_RELEASE *) This type changed at 0.13 *)
(** {2 Input} *) (** {2 Input} *)
(** @since NEXT_RELEASE *) (** @since 0.13 *)
module MemoTbl : sig module MemoTbl : sig
type t type t
val create: int -> t (** New memoization table *) val create: int -> t (** New memoization table *)
@ -89,8 +89,8 @@ type input = {
otherwise throw ParseError *) otherwise throw ParseError *)
pos : unit -> int; (** Current pos *) pos : unit -> int; (** Current pos *)
lnum : unit -> line_num; (** Line number @since NEXT_RELEASE *) lnum : unit -> line_num; (** Line number @since 0.13 *)
cnum : unit -> col_num; (** column number @since NEXT_RELEASE *) cnum : unit -> col_num; (** column number @since 0.13 *)
memo : MemoTbl.t; (** memoization table, if any *) memo : MemoTbl.t; (** memoization table, if any *)
backtrack : int -> unit; (** Restore to previous pos *) backtrack : int -> unit; (** Restore to previous pos *)
sub : int -> int -> string; (** [sub pos len] extracts slice from [pos] with [len] *) sub : int -> int -> string; (** [sub pos len] extracts slice from [pos] with [len] *)
@ -105,7 +105,7 @@ val input_of_chan : ?size:int -> in_channel -> input
(** [input_of_chan ic] reads lazily the content of [ic] as parsing goes. (** [input_of_chan ic] reads lazily the content of [ic] as parsing goes.
All content that is read is saved to an internal buffer for backtracking. All content that is read is saved to an internal buffer for backtracking.
@param size number of bytes read at once from [ic] @param size number of bytes read at once from [ic]
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Combinators} *) (** {2 Combinators} *)
@ -187,7 +187,7 @@ val is_space : char -> bool
val is_white : char -> bool val is_white : char -> bool
(** True on ' ' and '\t' and '\n' (** True on ' ' and '\t' and '\n'
@since NEXT_RELEASE *) @since 0.13 *)
val (~~~) : (char -> bool) -> char -> bool val (~~~) : (char -> bool) -> char -> bool
(** Negation on predicates *) (** Negation on predicates *)
@ -232,11 +232,11 @@ val memo : 'a t -> 'a t
is a lot of backtracking involving [p]. is a lot of backtracking involving [p].
This function is not thread-safe. This function is not thread-safe.
@since NEXT_RELEASE *) @since 0.13 *)
val fix_memo : ('a t -> 'a t) -> 'a t val fix_memo : ('a t -> 'a t) -> 'a t
(** Same as {!fix}, but the fixpoint is memoized. (** Same as {!fix}, but the fixpoint is memoized.
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Parse} *) (** {2 Parse} *)
@ -257,11 +257,11 @@ val parse_file : ?size:int -> file:string -> 'a t -> 'a or_error
(** [parse_file ~file p] parses [file] with [p] by opening the file (** [parse_file ~file p] parses [file] with [p] by opening the file
and using {!input_of_chan}. and using {!input_of_chan}.
@param size size of chunks read from file @param size size of chunks read from file
@since NEXT_RELEASE *) @since 0.13 *)
val parse_file_exn : ?size:int -> file:string -> 'a t -> 'a val parse_file_exn : ?size:int -> file:string -> 'a t -> 'a
(** Unsafe version of {!parse_file} (** Unsafe version of {!parse_file}
@since NEXT_RELEASE *) @since 0.13 *)
(** {2 Utils} *) (** {2 Utils} *)

View file

@ -41,7 +41,7 @@ val with_lock : 'a t -> ('a -> 'b) -> 'b
fails too but the lock is released *) fails too but the lock is released *)
(** Type allowing to manipulate the lock as a reference (** Type allowing to manipulate the lock as a reference
@since NEXT_RELEASE *) @since 0.13 *)
module LockRef : sig module LockRef : sig
type 'a t type 'a t
@ -56,7 +56,7 @@ val with_lock_as_ref : 'a t -> f:('a LockRef.t -> 'b) -> 'b
(** [with_lock_as_ref l f] calls [f] with a reference-like object (** [with_lock_as_ref l f] calls [f] with a reference-like object
that allows to manipulate the value of [l] safely. that allows to manipulate the value of [l] safely.
The object passed to [f] must not escape the function call The object passed to [f] must not escape the function call
@since NEXT_RELEASE *) @since 0.13 *)
val update : 'a t -> ('a -> 'a) -> unit val update : 'a t -> ('a -> 'a) -> unit
(** [update l f] replaces the content [x] of [l] with [f x], atomically *) (** [update l f] replaces the content [x] of [l] with [f x], atomically *)
@ -69,13 +69,13 @@ val get : 'a t -> 'a
val set : 'a t -> 'a -> unit val set : 'a t -> 'a -> unit
(** Atomically set the value (** Atomically set the value
@since NEXT_RELEASE *) @since 0.13 *)
val incr : int t -> unit val incr : int t -> unit
(** Atomically increment the value (** Atomically increment the value
@since NEXT_RELEASE *) @since 0.13 *)
val decr : int t -> unit val decr : int t -> unit
(** Atomically decrement the value (** Atomically decrement the value
@since NEXT_RELEASE *) @since 0.13 *)

View file

@ -3,7 +3,7 @@
(** {1 Semaphores} (** {1 Semaphores}
@since NEXT_RELEASE *) @since 0.13 *)
type t type t
(** A semaphore *) (** A semaphore *)

View file

@ -4,7 +4,7 @@
(** {1 Threads} (** {1 Threads}
{b status: unstable} {b status: unstable}
@since NEXT_RELEASE *) @since 0.13 *)
type t = Thread.t type t = Thread.t