/usr/lib/ocaml/ocamlbricks/container.mli is in libocamlbricks-ocaml-dev 0.90+bzr400-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | (* This file is part of ocamlbricks
Copyright (C) 2013 Jean-Vincent Loddo
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. *)
(** The signature of an imperative stack or queue *)
module type T =
sig
type 'a t
val create : unit -> 'a t
val clear : 'a t -> unit
val copy : 'a t -> 'a t
val push : 'a -> 'a t -> unit
val pop : 'a t -> 'a
val top : 'a t -> 'a
val is_empty : 'a t -> bool
val length : 'a t -> int
val iter : ('a -> unit) -> 'a t -> unit
val filter : ('a -> bool) -> 'a t -> unit
val map : ('a -> 'a) -> 'a t -> unit
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
val rev : 'a t -> unit
val rev_copy : 'a t -> 'a t
val to_list : 'a t -> 'a list
val of_list : 'a list -> 'a t
(** The push method in the opposite discipline: if the container is LIFO
the co-pushing method is FIFO and vice-versa. For instance, in a
stack implemented by a list, the co-pushing method is the `append'
operation:
push x xs = x::xs
copush xs x = xs@[x]
In other words, the co-pushing method is the composition:
reverse; push; reverse *)
val copush : 'a t -> 'a -> unit
end
module type T_with_identifiers =
sig
type id = int
type 'a t
(* Functions with the same name but abstracting from identifiers: *)
val create : unit -> 'a t
val clear : 'a t -> unit
val copy : 'a t -> 'a t
val pop : 'a t -> 'a
val top : 'a t -> 'a
val is_empty : 'a t -> bool
val length : 'a t -> int
val iter : ('a -> unit) -> 'a t -> unit
val filter : ('a -> bool) -> 'a t -> unit
val map : ('a -> 'a) -> 'a t -> unit
val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
val rev : 'a t -> unit
val rev_copy : 'a t -> 'a t
val to_list : 'a t -> 'a list
val of_list : 'a list -> 'a t
(* There are two differences with the T signature about shared names:
both `push' and `copush' return the `id' generated for insertion: *)
val push : 'a -> 'a t -> id
val copush : 'a t -> 'a -> id
(* Identical functions but changing name ("i" suffix or "assoc_"): *)
val pushi : (id * 'a) -> 'a t -> unit
val copushi : 'a t -> (id * 'a) -> unit
val popi : 'a t -> id * 'a
val topi : 'a t -> id * 'a
val iteri : (id * 'a -> unit) -> 'a t -> unit
val filteri : (id * 'a -> bool) -> 'a t -> unit
val mapi : (id * 'a -> id * 'a) -> 'a t -> unit
val foldi : ('b -> id * 'a -> 'b) -> 'b -> 'a t -> 'b
val to_assoc_list : 'a t -> (id * 'a) list
val of_assoc_list : (id * 'a) list -> 'a t
(* The real purpose of having identifiers: *)
(* get_by_id may raise [Not_found] *)
val get_by_id : id -> 'a t -> 'a
(* Does nothing if the id doesn't exist: *)
val remove_by_id : id -> 'a t -> unit
(* The inner generator of fresh identifiers: *)
val fresh : unit -> int
(* The inner generator of fresh identifiers *as module*
(useful to have something ready to be provided to a functor).
(Note that fresh = Option.extract Fresh.fresh) *)
module Fresh : sig val fresh : (unit -> int) option end
end
module Add_identifiers :
(* Fresh is morally an optional functor argument: *)
functor (Fresh : sig val fresh : (unit -> int) option end) ->
functor (Container: T) -> T_with_identifiers
module Stack_with_identifiers : T_with_identifiers
module Queue_with_identifiers : T_with_identifiers
|