This commit is contained in:
juloo 2018-05-29 14:57:08 +00:00 committed by GitHub
commit 8e854f9053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 46 additions and 2 deletions

View file

@ -7,6 +7,8 @@ let equal (a:bool) b = Pervasives.(=) a b
let compare (a:bool) b = Pervasives.compare a b let compare (a:bool) b = Pervasives.compare a b
let leq (a:bool) b = Pervasives.(<=) a b
let negate = not let negate = not
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit

View file

@ -8,6 +8,10 @@ type t = bool
val compare : t -> t -> int val compare : t -> t -> int
(** Total ordering on booleans, similar to {!Pervasives.compare}. *) (** Total ordering on booleans, similar to {!Pervasives.compare}. *)
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val equal : t -> t -> bool val equal : t -> t -> bool
val negate : t -> t val negate : t -> t

View file

@ -8,6 +8,8 @@ include Char
let equal (a:char) b = Pervasives.(=) a b let equal (a:char) b = Pervasives.(=) a b
let leq (a:char) b = Pervasives.(<=) a b
let pp_buf = Buffer.add_char let pp_buf = Buffer.add_char
let pp = Format.pp_print_char let pp = Format.pp_print_char

View file

@ -15,6 +15,10 @@ val compare : t -> t -> int
allows the module [Char] to be passed as argument to the functors allows the module [Char] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *) {!Set.Make} and {!Map.Make}. *)
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val lowercase_ascii : t -> t val lowercase_ascii : t -> t
(** Convert the given character to its equivalent lowercase character, (** Convert the given character to its equivalent lowercase character,
using the US-ASCII character set. using the US-ASCII character set.

View file

@ -76,6 +76,7 @@ let equal (a:float) b = a=b
let hash : t -> int = Hashtbl.hash let hash : t -> int = Hashtbl.hash
let compare (a:float) b = Pervasives.compare a b let compare (a:float) b = Pervasives.compare a b
let leq (a:float) b = Pervasives.(<=) a b
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit
type 'a random_gen = Random.State.t -> 'a type 'a random_gen = Random.State.t -> 'a

View file

@ -55,6 +55,10 @@ val equal : t -> t -> bool
val compare : t -> t -> int val compare : t -> t -> int
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit
type 'a random_gen = Random.State.t -> 'a type 'a random_gen = Random.State.t -> 'a

View file

@ -7,6 +7,8 @@ let equal (a:int) b = Pervasives.(=) a b
let compare a b = compare a b let compare a b = compare a b
let leq (a:int) b = Pervasives.(<=) a b
let hash i = i land max_int let hash i = i land max_int
let range i j yield = let range i j yield =

View file

@ -11,6 +11,10 @@ val compare : t -> t -> int
val equal : t -> t -> bool val equal : t -> t -> bool
(** Equality function for integers. *) (** Equality function for integers. *)
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val hash : t -> int val hash : t -> int
val sign : t -> int val sign : t -> int

View file

@ -2,7 +2,8 @@
include Int32 include Int32
let equal (x:t) y = Pervasives.(=) x y let equal (x:int32) y = Pervasives.(=) x y
let leq (a:int32) b = Pervasives.(<=) a b
module Infix = struct module Infix = struct
let (+) = add let (+) = add

View file

@ -96,6 +96,10 @@ val equal : t -> t -> bool
(** The equal function for 32-bit integers. (** The equal function for 32-bit integers.
Like {!Pervasives.(=) x y)}. *) Like {!Pervasives.(=) x y)}. *)
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val hash : t -> int val hash : t -> int
(** Like {!Pervasives.abs (to_int x)}. *) (** Like {!Pervasives.abs (to_int x)}. *)

View file

@ -2,7 +2,8 @@
include Int64 include Int64
let equal (x:t) y = Pervasives.(=) x y let equal (x:int64) y = Pervasives.(=) x y
let leq (a:int64) b = Pervasives.(<=) a b
module Infix = struct module Infix = struct
let (+) = add let (+) = add

View file

@ -102,6 +102,10 @@ val compare : t -> t -> int
allows the module [CCInt64] to be passed as argument to the functors allows the module [CCInt64] to be passed as argument to the functors
{!Set.Make} and {!Map.Make}. *) {!Set.Make} and {!Map.Make}. *)
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val hash : t -> int val hash : t -> int
(** Like {!Pervasives.abs (to_int x)}. *) (** Like {!Pervasives.abs (to_int x)}. *)

View file

@ -66,6 +66,8 @@ let equal (a:string) b = Pervasives.(=) a b
let compare_int (a : int) b = Pervasives.compare a b let compare_int (a : int) b = Pervasives.compare a b
let compare = String.compare let compare = String.compare
let leq (a:string) b = String.compare a b <= 0
let hash s = Hashtbl.hash s let hash s = Hashtbl.hash s
let length = String.length let length = String.length

View file

@ -64,6 +64,10 @@ val equal : string -> string -> bool
val compare : string -> string -> int val compare : string -> string -> int
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val is_empty : string -> bool val is_empty : string -> bool
(** [is_empty s] returns [true] iff [s] is empty (i.e. its length is 0). (** [is_empty s] returns [true] iff [s] is empty (i.e. its length is 0).
@since 1.5 *) @since 1.5 *)

View file

@ -10,6 +10,7 @@ type 'a gen = unit -> 'a option
type 'a sequence = ('a -> unit) -> unit type 'a sequence = ('a -> unit) -> unit
let equal (a:string) b = Pervasives.(=) a b let equal (a:string) b = Pervasives.(=) a b
let leq (a:string) b = String.compare a b <= 0
let hash : string -> int = Hashtbl.hash let hash : string -> int = Hashtbl.hash
let pp = Format.pp_print_string let pp = Format.pp_print_string

View file

@ -29,6 +29,10 @@ val hash : t -> int
val compare : t -> t -> int val compare : t -> t -> int
val leq : t -> t -> bool
(** Equivalent of [(<=)]
Allows to be passed to {!Heap.Make} *)
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
val to_string : t -> string val to_string : t -> string