common.mli 3.15 KB
Newer Older
Stephane Glondu's avatar
Stephane Glondu committed
1 2 3
(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
Stephane Glondu's avatar
Stephane Glondu committed
4
(*  Copyright © 2012-2018 Inria                                           *)
Stephane Glondu's avatar
Stephane Glondu committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
(*                                                                        *)
(*  This program is free software: you can redistribute it and/or modify  *)
(*  it under the terms of the GNU Affero General Public License as        *)
(*  published by the Free Software Foundation, either version 3 of the    *)
(*  License, or (at your option) any later version, with the additional   *)
(*  exemption that compiling, linking, and/or using OpenSSL is allowed.   *)
(*                                                                        *)
(*  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     *)
(*  Affero General Public License for more details.                       *)
(*                                                                        *)
(*  You should have received a copy of the GNU Affero General Public      *)
(*  License along with this program.  If not, see                         *)
(*  <http://www.gnu.org/licenses/>.                                       *)
(**************************************************************************)

Stephane Glondu's avatar
Stephane Glondu committed
22 23
open Signatures

24 25
module Array : sig
  include module type of Array
26
  val exists : ('a -> bool) -> 'a array -> bool
27
  val forall : ('a -> bool) -> 'a array -> bool
28
  val forall2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool
Stephane Glondu's avatar
Stephane Glondu committed
29 30 31
  val fforall : ('a -> bool) -> 'a array array -> bool
  val fforall2 : ('a -> 'b -> bool) ->
    'a array array -> 'b array array -> bool
32 33
  val fforall3 : ('a -> 'b -> 'c -> bool) ->
    'a array array -> 'b array array -> 'c array array -> bool
Stephane Glondu's avatar
Debug  
Stephane Glondu committed
34
  val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array
35 36 37 38 39 40 41 42
  val map3 : ('a -> 'b -> 'c -> 'd) ->
    'a array -> 'b array -> 'c array -> 'd array
  val mmap : ('a -> 'b) -> 'a array array -> 'b array array
  val mmap2 : ('a -> 'b -> 'c) ->
    'a array array -> 'b array array -> 'c array array
  val mmap3 : ('a -> 'b -> 'c -> 'd) ->
    'a array array -> 'b array array -> 'c array array -> 'd array array
  val ssplit : ('a * 'b) array array -> 'a array array * 'b array array
43
  val findi : (int -> 'a -> 'b option) -> 'a array -> 'b option
44
end
45

46 47
module String : sig
  include module type of String
Stephane Glondu's avatar
Stephane Glondu committed
48
  val startswith : string -> string -> bool
49
end
50

51 52 53 54 55
module List : sig
  include module type of List
  val join : 'a -> 'a list -> 'a list
  val filter_map : ('a -> 'b option) -> 'a list -> 'b list
end
Stephane Glondu's avatar
Stephane Glondu committed
56

57
module Option : sig
Stephane Glondu's avatar
Stephane Glondu committed
58
  val iter : ('a -> unit) -> 'a option -> unit
59 60 61
  val get : 'a option -> 'a -> 'a
  val map : ('a -> 'b) -> 'a option -> 'b option
end
62

63
val save_to : string -> (Bi_outbuf.t -> 'a -> unit) -> 'a -> unit
64

65 66
val compare_b64 : string -> string -> int

67
module SMap : Map.S with type key = string
Stephane Glondu's avatar
Stephane Glondu committed
68

Stephane Glondu's avatar
Stephane Glondu committed
69 70
val bytes_to_sample : Platform.Z.t -> int

Stephane Glondu's avatar
Stephane Glondu committed
71
module DirectRandom : RANDOM with type 'a t = 'a