Commit d6515ad9 authored by Raphaël Proust's avatar Raphaël Proust

Stdlib: remove or document exception raising functions

parent 5c04c6c7
......@@ -33,13 +33,14 @@ val create : unit -> 'a t
(** Put an element inside the dropbox. If the dropbox was already
containing an element, the old element is replaced by the new one.
The function might return [Closed] if the dropbox has been closed
with [close]. *)
@raise [Closed] if the dropbox has been closed with [close]. *)
val put : 'a t -> 'a -> unit
(** Wait until the dropbox contains an element, then returns the elements.
The elements is removed from the dropbox. The function might return
[Closed] if the dropbox is empty and closed. *)
The elements is removed from the dropbox.
@raise [Closed] if the dropbox has been closed with [close] and is empty. *)
val take : 'a t -> 'a Lwt.t
(** Like [take] except that it returns [None] after [timeout seconds]
......@@ -56,6 +57,6 @@ exception Closed
(** Close the dropbox. It terminates all the waiting reader with the
exception [Closed]. All further read or write will also immediately
fail with [Closed], except if the dropbox is not empty when
[close] is called. In that can, a single (and last) [take] will
[close] is called. In that case, a single (and last) [take] will
succeed. *)
val close : 'a t -> unit
......@@ -83,10 +83,6 @@ module Ring = struct
!acc
let elements t = fold t ~init:[] ~f:(fun acc elt -> elt :: acc)
exception Empty
let last_exn r = match last r with None -> raise Empty | Some d -> d
end
include Ring
......
......@@ -25,12 +25,6 @@
(** Imperative Ring Buffer *)
(** An imperative ring buffer: a mutable structure that holds at most
a fixed number of values of a same type. Values are never removed,
once the limit is reached, adding a value replaces the oldest one
in the ring buffer. *)
exception Empty
type 'a t
(** Allocates a ring buffer for a given number of values. *)
......@@ -51,9 +45,6 @@ val clear : 'a t -> unit
(** Retrieves the most recent value, or [None] when empty. *)
val last : 'a t -> 'a option
(** Same as {!last}, but raises {!Empty} when empty. *)
val last_exn : 'a t -> 'a
(** Iterates over the elements, oldest to newest. *)
val fold : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b
......
......@@ -40,5 +40,6 @@ val cut : ?copy:bool -> int -> Bytes.t -> Bytes.t list
(** Print a paragraph in a box *)
val display_paragraph : Format.formatter -> string -> unit
(** [finalize f g ] ensures g() called after f(), even if exception raised *)
(** [finalize f g] ensures [g ()] called after [f ()], even if an exception is
raised *)
val finalize : (unit -> 'a) -> (unit -> unit) -> 'a
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment