mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
enrich CCInt.Infix to get a uniform interface with CCInt{32,64}
This commit is contained in:
parent
9f2ef2f461
commit
da6d4a72fa
2 changed files with 22 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue