From da6d4a72fa92029fcb8a06299c590412e656298c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 27 Feb 2018 21:12:04 -0600 Subject: [PATCH] enrich `CCInt.Infix` to get a uniform interface with `CCInt{32,64}` --- src/core/CCInt.ml | 23 ++++++++--------------- src/core/CCInt.mli | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/core/CCInt.ml b/src/core/CCInt.ml index cc87f080..909833e4 100644 --- a/src/core/CCInt.ml +++ b/src/core/CCInt.ml @@ -1,9 +1,16 @@ (* This file is free software, part of containers. See file "license" for more details. *) +module Infix = struct + include Pervasives + let (--) = range + let (--^) = range' +end +include Infix + type t = int -let equal (a:int) b = a=b +let equal (a:int) b = Pervasives.(=) a b let compare a b = compare a b @@ -245,17 +252,3 @@ let range' i j yield = [5;4;3] (range' 5 2 |> Sequence.to_list) *) - -module Infix = struct - let (=) = (=) - let (<>) = (<>) - let (<) = (<) - let (>) = (>) - let (<=) = (<=) - let (>=) = (>=) - let (--) = range - let (--^) = range' -end -include Infix -let min = min -let max = max diff --git a/src/core/CCInt.mli b/src/core/CCInt.mli index 76295bcb..2d0389ac 100644 --- a/src/core/CCInt.mli +++ b/src/core/CCInt.mli @@ -115,6 +115,20 @@ module Infix : sig val (--^) : t -> t -> t sequence (** Alias to {!range'}. @since 1.2 *) + + val (+) : t -> t -> t (** @since NEXT_RELEASE *) + val (-) : t -> t -> t (** @since NEXT_RELEASE *) + val (~-) : t -> t (** @since NEXT_RELEASE *) + val ( * ) : t -> t -> t (** @since NEXT_RELEASE *) + val (/) : t -> t -> t (** @since NEXT_RELEASE *) + val (mod) : t -> t -> t (** @since NEXT_RELEASE *) + val (land) : t -> t -> t (** @since NEXT_RELEASE *) + val (lor) : t -> t -> t (** @since NEXT_RELEASE *) + val (lxor) : t -> t -> t (** @since NEXT_RELEASE *) + val lnot : t -> t (** @since NEXT_RELEASE *) + val (lsl) : t -> int -> t (** @since NEXT_RELEASE *) + val (lsr) : t -> int -> t (** @since NEXT_RELEASE *) + val (asr) : t -> int -> t (** @since NEXT_RELEASE *) end include module type of Infix