diff --git a/src/core/CCBool.ml b/src/core/CCBool.ml index b7e97bb5..ab35f362 100644 --- a/src/core/CCBool.ml +++ b/src/core/CCBool.ml @@ -1,9 +1,6 @@ (* This file is free software, part of containers. See file "license" for more details. *) -type t = bool - -let equal (a : bool) b = Stdlib.( = ) a b -let compare (a : bool) b = Stdlib.compare a b +include Bool let if_then f x = if x then @@ -17,12 +14,6 @@ let if_then_else f g x = else g () -let to_int (x : bool) : int = - if x then - 1 - else - 0 - let of_int x : t = x <> 0 type 'a printer = Format.formatter -> 'a -> unit diff --git a/src/core/CCBool.mli b/src/core/CCBool.mli index 0ac4c40c..81a7c346 100644 --- a/src/core/CCBool.mli +++ b/src/core/CCBool.mli @@ -2,13 +2,8 @@ (** Basic Bool functions *) -type t = bool - -val compare : t -> t -> int -(** [compare b1 b2] is the total ordering on booleans [b1] and [b2], similar to {!Stdlib.compare}. *) - -val equal : t -> t -> bool -(** [equal b1 b2] is [true] if [b1] and [b2] are the same. *) +include module type of Bool +(** @inline *) val if_then : (unit -> 'a) -> t -> 'a option (** [if_then f x] is [Some (f ())] if [x] is true and None otherwise. @@ -18,10 +13,6 @@ val if_then_else : (unit -> 'a) -> (unit -> 'a) -> t -> 'a (** [if_then_else f g x] is [f ()] if [x] is true and [g ()] otherwise. @since 3.13 *) -val to_int : t -> int -(** [to_int true = 1], [to_int false = 0]. - @since 2.7 *) - val of_int : int -> t (** [of_int i] is the same as [i <> 0] @since 2.7 *)