prepare for 0.16

This commit is contained in:
Simon Cruanes 2016-02-24 22:08:26 +01:00
parent 8524f43120
commit a2179d4355
27 changed files with 150 additions and 94 deletions

View file

@ -1,5 +1,61 @@
= Changelog
== 0.16
=== breaking
- change the signature of `CCHeap.{of_gen,of_seq,of_klist}`
- change the API of `CCMixmap`
- make type `CCHash.state` abstract (used to be `int64`)
- optional argument `~eq` to `CCGraph.Dot.pp`
- rename `CCFuture` into `CCPool`
=== deprecations
- deprecate `containers.bigarray`
- deprecate `CCHashtbl.{Counter,Default}` tables
- deprecate `CCLinq` in favor of standalone `OLinq` (to be released)
=== bugfixes
- fix wrong signature of `CCHashtbl.Make.{keys,values}_list`
- missing constraint in `CCSexpM.ID_MONAD`
=== new features
- add a tutorial file
- add a printer into CCHeap
- add `{CCList,CCOpt}.Infix` modules
- add `CCOpt.map_or`, deprecating `CCopt.maybe`
- add `CCFormat.sprintf_no_color`
- add `CCFormat.{h,v,hov,hv}box` printer combinators
- add `CCFormat.{with_color, with_colorf}`
- add `CCList.hd_tl`
- add `CCResult.{map_or,get_or}`
- add `CCGraph.make` and utils
- add `CCHashtbl.add_list`
- add counter function in `CCHashtbl`, to replace `CCHashtbl.Counter`
- add `CCPair.make`
- add `CCString.Split.{left,right}_exn`
- add `CCIO.File.{read,write,append}` for quickly handling files
- add `CCRandom.pick_{list,array}`
- add `CCList.Assoc.update`
- add `CCList.Assoc.mem`
- add `{CCMap,CCHashtbl}.get_or` for lookup with default value
- add `CCLock.{decr_then_get, get_then_{decr,set,clear}}`
- rename `CCFuture` into `CCPool`, expose the thread pool
- split `CCTimer` out of `CCFuture`, a standalone 1-thread timer
- move `CCThread.Queue` into `CCBlockingQueue`
- add `CCResult`, with dependency on `result` for retrocompat
- add `CCThread.spawn{1,2}`
- add many helpers in `CCUnix` (for sockets, files, and processes)
- add `CCFun.finally{1,2}`, convenience around `finally`
- add `CCLock.update_map`
- add `CCLock.{incr_then_get,get_then_incr}`
- add breaking space in `CCFormat.{pair,triple,quad}`
- update `examples/id_sexp` so it can read on stdin
- add `CCList.fold_map2`
== 0.15
=== breaking changes
@ -15,7 +71,7 @@
- add `CCMap.{keys,values}`
- add wip `CCAllocCache`, an allocation cache for short-lived arrays
- add `CCError.{join,both}` applicative functions for CCError
- opam: depend on ocamlbuild
- opam: depend on ecamlbuild
- work on `CCRandom` by octachron:
* add an uniformity test
* Make `split_list` uniform

2
_oasis
View file

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

View file

@ -47,21 +47,21 @@ val map : ('a -> 'b) -> 'b printer -> 'a printer
val vbox : ?i:int -> 'a printer -> 'a printer
(** Wrap the printer in a vertical box
@param i level of indentation within the box (default 0)
@since NEXT_RELEASE *)
@since 0.16 *)
val hvbox : ?i:int -> 'a printer -> 'a printer
(** Wrap the printer in a horizontal/vertical box
@param i level of indentation within the box (default 0)
@since NEXT_RELEASE *)
@since 0.16 *)
val hovbox : ?i:int -> 'a printer -> 'a printer
(** Wrap the printer in a horizontal or vertical box
@param i level of indentation within the box (default 0)
@since NEXT_RELEASE *)
@since 0.16 *)
val hbox : 'a printer -> 'a printer
(** Wrap the printer in an horizontal box
@since NEXT_RELEASE *)
@since 0.16 *)
(** {2 ANSI codes}
@ -117,13 +117,13 @@ val with_color : string -> 'a printer -> 'a printer
(** [with_color "Blue" pp] behaves like the printer [pp], but with the given
style.
{b status: experimental}
@since NEXT_RELEASE *)
@since 0.16 *)
val with_colorf : string -> t -> ('a, t, unit, unit) format4 -> 'a
(** [with_colorf "Blue" out "%s %d" "yolo" 42] will behave like {!Format.fprintf},
but wrapping the content with the given style
{b status: experimental}
@since NEXT_RELEASE *)
@since 0.16 *)
(** {2 IO} *)
@ -139,7 +139,7 @@ val sprintf : ('a, t, unit, string) format4 -> 'a
val sprintf_no_color : ('a, t, unit, string) format4 -> 'a
(** Similar to {!sprintf} but never prints colors
@since NEXT_RELEASE *)
@since 0.16 *)
val fprintf : t -> ('a, t, unit ) format -> 'a
(** Alias to {!Format.fprintf}

View file

@ -58,12 +58,12 @@ val finally : h:(unit -> _) -> f:(unit -> 'a) -> 'a
val finally1 : h:(unit -> _) -> ('a -> 'b) -> 'a -> 'b
(** [finally1 ~h f x] is the same as [f x], but after the computation,
[h ()] is called whether [f x] rose an exception or not.
@since NEXT_RELEASE *)
@since 0.16 *)
val finally2 : h:(unit -> _) -> ('a -> 'b -> 'c) -> 'a -> 'b -> 'c
(** [finally2 ~h f x y] is the same as [f x y], but after the computation,
[h ()] is called whether [f x y] rose an exception or not.
@since NEXT_RELEASE *)
@since 0.16 *)
(** {2 Monad}

View file

@ -10,7 +10,7 @@ type t = int
type state
(** State required by the hash function.
@since NEXT_RELEASE the state is abstract, for more flexibility *)
@since 0.16 the state is abstract, for more flexibility *)
type 'a hash_fun = 'a -> state -> state
(** Hash function for values of type ['a], merging a fingerprint of the

View file

@ -127,25 +127,25 @@ module type S = sig
val get_or : 'a t -> key -> or_:'a -> 'a
(** [get_or tbl k ~or_] returns the value associated to [k] if present,
and returns [or_] otherwise (if [k] doesn't belong in [tbl])
@since NEXT_RELEASE *)
@since 0.16 *)
val add_list : 'a list t -> key -> 'a -> unit
(** [add_list tbl x y] adds [y] to the list [x] is bound to. If [x] is
not bound, it becomes bound to [[y]].
@since NEXT_RELEASE *)
@since 0.16 *)
val incr : ?by:int -> int t -> key -> unit
(** [incr ?by tbl x] increments or initializes the counter associated with [x].
If [get tbl x = None], then after update, [get tbl x = Some 1];
otherwise, if [get tbl x = Some n], now [get tbl x = Some (n+1)].
@param by if specified, the int value is incremented by [by] rather than 1
@since NEXT_RELEASE *)
@since 0.16 *)
val decr : ?by:int -> int t -> key -> unit
(** Same as {!incr} but substract 1 (or the value of [by]).
If the value reaches 0, the key is removed from the table.
This does nothing if the key is not already present in the table.
@since NEXT_RELEASE *)
@since 0.16 *)
val keys : 'a t -> key sequence
(** Iterate on keys (similar order as {!Hashtbl.iter}) *)
@ -172,17 +172,17 @@ module type S = sig
val add_seq : 'a t -> (key * 'a) sequence -> unit
(** Add the corresponding pairs to the table, using {!Hashtbl.add}.
@since NEXT_RELEASE *)
@since 0.16 *)
val add_seq_count : int t -> key sequence -> unit
(** [add_seq_count tbl seq] increments the count of each element of [seq]
by calling {!incr}. This is useful for counting how many times each
element of [seq] occurs.
@since NEXT_RELEASE *)
@since 0.16 *)
val of_seq_count : key sequence -> int t
(** Similar to {!add_seq_count}, but allocates a new table and returns it
@since NEXT_RELEASE *)
@since 0.16 *)
val to_list : 'a t -> (key * 'a) list
(** List of bindings (order unspecified) *)

View file

@ -18,7 +18,7 @@ val get : ('a,'b) Hashtbl.t -> 'a -> 'b option
val get_or : ('a,'b) Hashtbl.t -> 'a -> or_:'b -> 'b
(** [get_or tbl k ~or_] returns the value associated to [k] if present,
and returns [or_] otherwise (if [k] doesn't belong in [tbl])
@since NEXT_RELEASE *)
@since 0.16 *)
val keys : ('a,'b) Hashtbl.t -> 'a sequence
(** Iterate on keys (similar order as {!Hashtbl.iter}) *)
@ -42,13 +42,13 @@ val incr : ?by:int -> ('a, int) Hashtbl.t -> 'a -> unit
If [get tbl x = None], then after update, [get tbl x = Some 1];
otherwise, if [get tbl x = Some n], now [get tbl x = Some (n+1)].
@param by if specified, the int value is incremented by [by] rather than 1
@since NEXT_RELEASE *)
@since 0.16 *)
val decr : ?by:int -> ('a, int) Hashtbl.t -> 'a -> unit
(** Same as {!incr} but substract 1 (or the value of [by]).
If the value reaches 0, the key is removed from the table.
This does nothing if the key is not already present in the table.
@since NEXT_RELEASE *)
@since 0.16 *)
val to_seq : ('a,'b) Hashtbl.t -> ('a * 'b) sequence
(** Iterate on bindings in the table *)
@ -56,11 +56,11 @@ val to_seq : ('a,'b) Hashtbl.t -> ('a * 'b) sequence
val add_list : ('a, 'b list) Hashtbl.t -> 'a -> 'b -> unit
(** [add_list tbl x y] adds [y] to the list [x] is bound to. If [x] is
not bound, it becomes bound to [[y]].
@since NEXT_RELEASE *)
@since 0.16 *)
val add_seq : ('a,'b) Hashtbl.t -> ('a * 'b) sequence -> unit
(** Add the corresponding pairs to the table, using {!Hashtbl.add}.
@since NEXT_RELEASE *)
@since 0.16 *)
val of_seq : ('a * 'b) sequence -> ('a,'b) Hashtbl.t
(** From the given bindings, added in order *)
@ -69,11 +69,11 @@ val add_seq_count : ('a, int) Hashtbl.t -> 'a sequence -> unit
(** [add_seq_count tbl seq] increments the count of each element of [seq]
by calling {!incr}. This is useful for counting how many times each
element of [seq] occurs.
@since NEXT_RELEASE *)
@since 0.16 *)
val of_seq_count : 'a sequence -> ('a, int) Hashtbl.t
(** Similar to {!add_seq_count}, but allocates a new table and returns it
@since NEXT_RELEASE *)
@since 0.16 *)
val to_list : ('a,'b) Hashtbl.t -> ('a * 'b) list
(** List of bindings (order unspecified) *)
@ -104,25 +104,25 @@ module type S = sig
val get_or : 'a t -> key -> or_:'a -> 'a
(** [get_or tbl k ~or_] returns the value associated to [k] if present,
and returns [or_] otherwise (if [k] doesn't belong in [tbl])
@since NEXT_RELEASE *)
@since 0.16 *)
val add_list : 'a list t -> key -> 'a -> unit
(** [add_list tbl x y] adds [y] to the list [x] is bound to. If [x] is
not bound, it becomes bound to [[y]].
@since NEXT_RELEASE *)
@since 0.16 *)
val incr : ?by:int -> int t -> key -> unit
(** [incr ?by tbl x] increments or initializes the counter associated with [x].
If [get tbl x = None], then after update, [get tbl x = Some 1];
otherwise, if [get tbl x = Some n], now [get tbl x = Some (n+1)].
@param by if specified, the int value is incremented by [by] rather than 1
@since NEXT_RELEASE *)
@since 0.16 *)
val decr : ?by:int -> int t -> key -> unit
(** Same as {!incr} but substract 1 (or the value of [by]).
If the value reaches 0, the key is removed from the table.
This does nothing if the key is not already present in the table.
@since NEXT_RELEASE *)
@since 0.16 *)
val keys : 'a t -> key sequence
(** Iterate on keys (similar order as {!Hashtbl.iter}) *)
@ -149,17 +149,17 @@ module type S = sig
val add_seq : 'a t -> (key * 'a) sequence -> unit
(** Add the corresponding pairs to the table, using {!Hashtbl.add}.
@since NEXT_RELEASE *)
@since 0.16 *)
val add_seq_count : int t -> key sequence -> unit
(** [add_seq_count tbl seq] increments the count of each element of [seq]
by calling {!incr}. This is useful for counting how many times each
element of [seq] occurs.
@since NEXT_RELEASE *)
@since 0.16 *)
val of_seq_count : key sequence -> int t
(** Similar to {!add_seq_count}, but allocates a new table and returns it
@since NEXT_RELEASE *)
@since 0.16 *)
val to_list : 'a t -> (key * 'a) list
(** List of bindings (order unspecified) *)
@ -187,7 +187,7 @@ module Make(X : Hashtbl.HashedType) :
A table with a default element for keys that were never added.
@deprecated since NEXT_RELEASE, should be merged into [Make] itself *)
@deprecated since 0.16, should be merged into [Make] itself *)
module type DEFAULT = sig
type key
@ -223,7 +223,7 @@ module MakeDefault(X : Hashtbl.HashedType) : DEFAULT with type key = X.t
(** {2 Count occurrences using a Hashtbl}
@deprecated since NEXT_RELEASE, should be merged into [Make] itself *)
@deprecated since 0.16, should be merged into [Make] itself *)
module type COUNTER = sig
type elt

View file

@ -116,28 +116,28 @@ module type S = sig
(** {2 Conversions}
The interface of [of_gen], [of_seq], [of_klist]
has changed @since NEXT_RELEASE (the old signatures
has changed @since 0.16 (the old signatures
are now [add_seq], [add_gen], [add_klist]) *)
val to_list : t -> elt list
val add_list : t -> elt list -> t (** @since NEXT_RELEASE *)
val add_list : t -> elt list -> t (** @since 0.16 *)
val of_list : elt list -> t
val add_seq : t -> elt sequence -> t (** @since NEXT_RELEASE *)
val add_seq : t -> elt sequence -> t (** @since 0.16 *)
val of_seq : elt sequence -> t
val to_seq : t -> elt sequence
val add_klist : t -> elt klist -> t (** @since NEXT_RELEASE *)
val add_klist : t -> elt klist -> t (** @since 0.16 *)
val of_klist : elt klist -> t
val to_klist : t -> elt klist
val add_gen : t -> elt gen -> t (** @since NEXT_RELEASE *)
val add_gen : t -> elt gen -> t (** @since 0.16 *)
val of_gen : elt gen -> t
@ -146,7 +146,7 @@ module type S = sig
val to_tree : t -> elt ktree
val print : ?sep:string -> elt printer -> t printer
(** @since NEXT_RELEASE *)
(** @since 0.16 *)
end
module Make(E : PARTIAL_ORD) : S with type elt = E.t = struct

View file

@ -67,28 +67,28 @@ module type S = sig
(** {2 Conversions}
The interface of [of_gen], [of_seq], [of_klist]
has changed @since NEXT_RELEASE (the old signatures
has changed @since 0.16 (the old signatures
are now [add_seq], [add_gen], [add_klist]) *)
val to_list : t -> elt list
val add_list : t -> elt list -> t (** @since NEXT_RELEASE *)
val add_list : t -> elt list -> t (** @since 0.16 *)
val of_list : elt list -> t
val add_seq : t -> elt sequence -> t (** @since NEXT_RELEASE *)
val add_seq : t -> elt sequence -> t (** @since 0.16 *)
val of_seq : elt sequence -> t
val to_seq : t -> elt sequence
val add_klist : t -> elt klist -> t (** @since NEXT_RELEASE *)
val add_klist : t -> elt klist -> t (** @since 0.16 *)
val of_klist : elt klist -> t
val to_klist : t -> elt klist
val add_gen : t -> elt gen -> t (** @since NEXT_RELEASE *)
val add_gen : t -> elt gen -> t (** @since 0.16 *)
val of_gen : elt gen -> t
@ -97,7 +97,7 @@ module type S = sig
val to_tree : t -> elt ktree
val print : ?sep:string -> elt printer -> t printer
(** @since NEXT_RELEASE *)
(** @since 0.16 *)
end
module Make(E : PARTIAL_ORD) : S with type elt = E.t

View file

@ -164,27 +164,27 @@ module File : sig
val read_exn : t -> string
(** Read the content of the given file, or raises some exception
@since NEXT_RELEASE *)
@since 0.16 *)
val read : t -> string or_error
(** Read the content of the given file
@since NEXT_RELEASE *)
@since 0.16 *)
val append_exn : t -> string -> unit
(** Append the given string into the given file, possibly raising
@since NEXT_RELEASE *)
@since 0.16 *)
val append : t -> string -> unit or_error
(** Append the given string into the given file
@since NEXT_RELEASE *)
@since 0.16 *)
val write_exn : t -> string -> unit
(** Write the given string into the given file, possibly raising
@since NEXT_RELEASE *)
@since 0.16 *)
val write : t -> string -> unit or_error
(** Write the given string into the given file
@since NEXT_RELEASE *)
@since 0.16 *)
type walk_item = [`File | `Dir] * t

View file

@ -51,7 +51,7 @@ val fold_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list
val fold_map2 : ('acc -> 'a -> 'b -> 'acc * 'c) -> 'acc -> 'a list -> 'b list -> 'acc * 'c list
(** [fold_map2] is to [fold_map] what [List.map2] is to [List.map].
@raise Invalid_argument if the lists do not have the same length
@since NEXT_RELEASE *)
@since 0.16 *)
val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list
(** [fold_flat_map f acc l] is a [fold_left]-like function, but it also maps the
@ -109,7 +109,7 @@ val drop : int -> 'a t -> 'a t
val hd_tl : 'a t -> 'a * 'a t
(** [hd_tl (x :: l)] returns [hd, l].
@raise Failure if the list is empty
@since NEXT_RELEASE *)
@since 0.16 *)
val take_drop : int -> 'a t -> 'a t * 'a t
(** [take_drop n l] returns [l1, l2] such that [l1 @ l2 = l] and
@ -286,14 +286,14 @@ module Assoc : sig
val mem : ?eq:('a->'a->bool) -> ('a,_) t -> 'a -> bool
(** [mem l x] returns [true] iff [x] is a key in [l]
@since NEXT_RELEASE *)
@since 0.16 *)
val update :
?eq:('a->'a->bool) -> ('a,'b) t -> 'a -> f:('b option -> 'b option) -> ('a,'b) t
(** [update l k ~f] updates [l] on the key [k], by calling [f (get l k)]
and removing [k] if it returns [None], mapping [k] to [v'] if it
returns [Some v']
@since NEXT_RELEASE *)
@since 0.16 *)
end
(** {2 Zipper} *)
@ -469,7 +469,7 @@ val of_klist : 'a klist -> 'a t
It is convenient to {!open CCList.Infix} to access the infix operators
without cluttering the scope too much.
@since NEXT_RELEASE *)
@since 0.16 *)
module Infix : sig
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

View file

@ -16,7 +16,7 @@ module type S = sig
val get_or : key -> 'a t -> or_:'a -> 'a
(** [get_or k m ~or_] returns the value associated to [k] if present,
and returns [or_] otherwise (if [k] doesn't belong in [m])
@since NEXT_RELEASE *)
@since 0.16 *)
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
(** [update k f m] calls [f (Some v)] if [find k m = v],

View file

@ -19,7 +19,7 @@ module type S = sig
val get_or : key -> 'a t -> or_:'a -> 'a
(** [get_or k m ~or_] returns the value associated to [k] if present,
and returns [or_] otherwise (if [k] doesn't belong in [m])
@since NEXT_RELEASE *)
@since 0.16 *)
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
(** [update k f m] calls [f (Some v)] if [find k m = v],

View file

@ -15,7 +15,7 @@ val maybe : ('a -> 'b) -> 'b -> 'a t -> 'b
val map_or : default:'b -> ('a -> 'b) -> 'a t -> 'b
(** [map_or ~default f o] is [f x] if [o = Some x], [default otherwise]
@since NEXT_RELEASE *)
@since 0.16 *)
val is_some : _ t -> bool
@ -94,7 +94,7 @@ val (<+>) : 'a t -> 'a t -> 'a t
val choice : 'a t list -> 'a t
(** [choice] returns the first non-[None] element of the list, or [None] *)
(** {2 Infix Operators}
@since NEXT_RELEASE *)
@since 0.16 *)
module Infix : sig
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

View file

@ -7,7 +7,7 @@ type ('a,'b) t = ('a * 'b)
val make : 'a -> 'b -> ('a, 'b) t
(** Make a tuple from its components
@since NEXT_RELEASE *)
@since 0.16 *)
val map1 : ('a -> 'b) -> ('a * 'c) -> ('b * 'c)

View file

@ -65,17 +65,17 @@ val list_seq : 'a t list -> 'a list t
@since 0.4 *)
exception Pick_from_empty
(** @since NEXT_RELEASE *)
(** @since 0.16 *)
val pick_list : 'a list -> 'a t
(** Pick an element at random from the list
@raise Pick_from_empty if the list is empty
@since NEXT_RELEASE *)
@since 0.16 *)
val pick_array : 'a array -> 'a t
(** Pick an element at random from the array
@raise Pick_from_empty if the array is empty
@since NEXT_RELEASE *)
@since 0.16 *)
val small_int : int t

View file

@ -5,7 +5,7 @@
Uses the new "result" type from OCaml 4.03.
@since NEXT_RELEASE *)
@since 0.16 *)
type 'a sequence = ('a -> unit) -> unit
type 'a equal = 'a -> 'a -> bool

View file

@ -302,7 +302,7 @@ module Split : sig
val left_exn : by:string -> string -> string * string
(** Split on the first occurrence of [by] from the leftmost part of the string
@raise Not_found if [by] is not part of the string
@since NEXT_RELEASE *)
@since 0.16 *)
(*$T
Split.left ~by:" " "ab cde f g " = Some ("ab", "cde f g ")
@ -317,7 +317,7 @@ module Split : sig
val right_exn : by:string -> string -> string * string
(** Split on the first occurrence of [by] from the rightmost part of the string
@raise Not_found if [by] is not part of the string
@since NEXT_RELEASE *)
@since 0.16 *)
(*$T
Split.right ~by:" " "ab cde f g" = Some ("ab cde f", "g")

View file

@ -81,17 +81,17 @@ val make :
dest:('e -> 'v) ->
('v -> 'e sequence) -> ('v, 'e) t
(** Make a graph by providing its fields
@since NEXT_RELEASE *)
@since 0.16 *)
val make_labelled_tuple :
('v -> ('a * 'v) sequence) -> ('v, ('v * 'a * 'v)) t
(** Make a graph with edges being triples [(origin,label,dest)]
@since NEXT_RELEASE *)
@since 0.16 *)
val make_tuple :
('v -> 'v sequence) -> ('v, ('v * 'v)) t
(** Make a graph with edges being pairs [(origin,dest)]
@since NEXT_RELEASE *)
@since 0.16 *)
(** Mutable tags from values of type ['v] to tags of type [bool] *)
type 'v tag_set = {

View file

@ -27,7 +27,7 @@
]}
@since 0.9
@since NEXT_RELEASE change of API, the map is last argument to
@since 0.16 change of API, the map is last argument to
make piping with [|>] easier. *)
type 'a injection

View file

@ -89,7 +89,7 @@ end
module ID_MONAD : MONAD with type 'a t = 'a
(** The monad that just uses blocking calls as bind
@since 0.14
['a t = 'a] contraint is @since NEXT_RELEASE *)
['a t = 'a] contraint is @since 0.16 *)
module D : module type of MakeDecode(ID_MONAD)
(** Decoder that just blocks when input is not available

View file

@ -6,7 +6,7 @@
This queue has a limited size. Pushing a value on the queue when it
is full will block.
@since NEXT_RELEASE *)
@since 0.16 *)
type 'a t
(** Safe-thread queue for values of type ['a] *)

View file

@ -42,7 +42,7 @@ val update : 'a t -> ('a -> 'a) -> unit
val update_map : 'a t -> ('a -> 'a * 'b) -> 'b
(** [update_map l f] computes [x', y = f (get l)], then puts [x'] in [l]
and returns [y]
@since NEXT_RELEASE *)
@since 0.16 *)
val mutex : _ t -> Mutex.t
(** Underlying mutex *)
@ -64,24 +64,24 @@ val decr : int t -> unit
val incr_then_get : int t -> int
(** [incr_then_get x] increments [x], and return its new value
@since NEXT_RELEASE *)
@since 0.16 *)
val get_then_incr : int t -> int
(** [get_then_incr x] increments [x], and return its previous value
@since NEXT_RELEASE *)
@since 0.16 *)
val decr_then_get : int t -> int
(** [decr_then_get x] decrements [x], and return its new value
@since NEXT_RELEASE *)
@since 0.16 *)
val get_then_decr : int t -> int
(** [get_then_decr x] decrements [x], and return its previous value
@since NEXT_RELEASE *)
@since 0.16 *)
val get_then_set : bool t -> bool
(** [get_then_set b] sets [b] to [true], and return the old value
@since NEXT_RELEASE *)
@since 0.16 *)
val get_then_clear : bool t -> bool
(** [get_then_clear b] sets [b] to [false], and return the old value
@since NEXT_RELEASE *)
@since 0.16 *)

View file

@ -4,7 +4,7 @@
(** {1 Thread Pool, and Futures}
Renamed and heavily updated from [CCFuture]
@since NEXT_RELEASE *)
@since 0.16 *)
type +'a state =
| Done of 'a

View file

@ -12,11 +12,11 @@ val spawn : (unit -> _) -> t
val spawn1 : ('a -> _) -> 'a -> t
(** [spawn1 f x] is like [spawn (fun () -> f x)].
@since NEXT_RELEASE *)
@since 0.16 *)
val spawn2 : ('a -> 'b -> _) -> 'a -> 'b -> t
(** [spawn2 f x y] is like [spawn (fun () -> f x y)].
@since NEXT_RELEASE *)
@since 0.16 *)
val detach : (unit -> 'a) -> unit
(** [detach f] is the same as [ignore (spawn f)] *)

View file

@ -4,7 +4,7 @@
(** {1 Event timer}
Used to be part of [CCFuture]
@since NEXT_RELEASE *)
@since 0.16 *)
type t
(** A scheduler for events. It runs in its own thread. *)

View file

@ -114,25 +114,25 @@ val with_in : ?mode:int -> ?flags:Unix.open_flag list ->
on the input channel. When the function raises or returns, the
channel is closed.
@param flags opening flags. [Unix.O_RDONLY] is used in any cases
@since NEXT_RELEASE *)
@since 0.16 *)
val with_out : ?mode:int -> ?flags:Unix.open_flag list ->
string -> f:(out_channel -> 'a) -> 'a
(** Same as {!with_in} but for an output channel
@param flags opening flags (default [[Unix.O_CREAT; Unix.O_TRUNC]])
[Unix.O_WRONLY] is used in any cases.
@since NEXT_RELEASE *)
@since 0.16 *)
val with_process_in : string -> f:(in_channel -> 'a) -> 'a
(** Open a subprocess and obtain a handle to its stdout
@since NEXT_RELEASE *)
@since 0.16 *)
val with_process_out : string -> f:(out_channel -> 'a) -> 'a
(** Open a subprocess and obtain a handle to its stdin
@since NEXT_RELEASE *)
@since 0.16 *)
(** Handle to a subprocess.
@since NEXT_RELEASE *)
@since 0.16 *)
type process_full = <
stdin: out_channel;
stdout: in_channel;
@ -143,11 +143,11 @@ type process_full = <
val with_process_full : ?env:string array -> string -> f:(process_full -> 'a) -> 'a
(** Open a subprocess and obtain a handle to its channels.
@param env environment to pass to the subprocess.
@since NEXT_RELEASE *)
@since 0.16 *)
val with_connection : Unix.sockaddr -> f:(in_channel -> out_channel -> 'a) -> 'a
(** Wrap {!Unix.open_connection} with a handler
@since NEXT_RELEASE *)
@since 0.16 *)
exception ExitServer
@ -155,7 +155,7 @@ val establish_server : Unix.sockaddr -> f:(in_channel -> out_channel -> _) -> un
(** Listen on the address and calls the handler in a blocking fashion.
Using {!Thread} is recommended if handlers might take time.
The callback should raise {!ExitServer} to stop the loop.
@since NEXT_RELEASE *)
@since 0.16 *)
(** {2 Infix Functions} *)