[sledge] Switch from Base.Int to Stdlib and Containers

Reviewed By: ngorogiannis

Differential Revision: D24306060

fbshipit-source-id: bbb196f5f
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent 94bf571950
commit 99791f55f7

@ -23,17 +23,21 @@ include Iter.Import
(** Specialize polymorphic comparison to int *)
external ( = ) : int -> int -> bool = "%equal"
external ( <> ) : int -> int -> bool = "%notequal"
external ( < ) : int -> int -> bool = "%lessthan"
external ( > ) : int -> int -> bool = "%greaterthan"
external ( <= ) : int -> int -> bool = "%lessequal"
external ( >= ) : int -> int -> bool = "%greaterequal"
external compare : int -> int -> int = "%compare"
external equal : int -> int -> bool = "%equal"
let min x y = if x <= y then x else y
let max x y = if x >= y then x else y
module Int_compare = struct
external ( = ) : int -> int -> bool = "%equal"
external ( <> ) : int -> int -> bool = "%notequal"
external ( < ) : int -> int -> bool = "%lessthan"
external ( > ) : int -> int -> bool = "%greaterthan"
external ( <= ) : int -> int -> bool = "%lessequal"
external ( >= ) : int -> int -> bool = "%greaterequal"
external compare : int -> int -> int = "%compare"
external equal : int -> int -> bool = "%equal"
let min x y = if x <= y then x else y
let max x y = if x >= y then x else y
end
include Int_compare
(** Polymorphic comparison and hashing *)
module Poly = struct

@ -6,7 +6,46 @@
*)
open! NS0
include CCInt
include Base.Int
module Set = Set.Make (Base.Int)
module Map = Map.Make (Base.Int)
include Containers.Int
include Stdlib.Int
module T = struct
type t = int [@@deriving compare, equal, hash, sexp]
end
include T
module Infix = struct
include Containers.Int.Infix
include Int_compare
external ( + ) : t -> t -> t = "%addint"
external ( - ) : t -> t -> t = "%subint"
external ( ~- ) : t -> t = "%negint"
external ( * ) : t -> t -> t = "%mulint"
external ( / ) : t -> t -> t = "%divint"
let ( ** ) = pow
external ( mod ) : t -> t -> t = "%modint"
external ( land ) : t -> t -> t = "%andint"
external ( lor ) : t -> t -> t = "%orint"
external ( lxor ) : t -> t -> t = "%xorint"
let lnot = lnot
external ( lsl ) : t -> int -> t = "%lslint"
external ( lsr ) : t -> int -> t = "%lsrint"
external ( asr ) : t -> int -> t = "%asrint"
end
include Infix
let of_string = int_of_string_opt
let of_string_exn = int_of_string
let sign = Sign.of_int
let incr = incr
let decr = decr
module Set = Set.Make (T)
module Map = Map.Make (T)

@ -6,7 +6,39 @@
*)
open! NS0
include module type of CCInt
include module type of Base.Int
include module type of Containers.Int
include module type of Stdlib.Int
type t = int [@@deriving compare, equal, hash, sexp]
val of_string : string -> int option
val of_string_exn : string -> int
val sign : int -> Sign.t
val incr : int ref -> unit
val decr : int ref -> unit
module Infix : sig
val ( -- ) : t -> t -> t iter
val ( --^ ) : t -> t -> t iter
include module type of NS0.Int_compare
external ( + ) : t -> t -> t = "%addint"
external ( - ) : t -> t -> t = "%subint"
external ( ~- ) : t -> t = "%negint"
external ( * ) : t -> t -> t = "%mulint"
external ( / ) : t -> t -> t = "%divint"
val ( ** ) : t -> t -> t
external ( mod ) : t -> t -> t = "%modint"
external ( land ) : t -> t -> t = "%andint"
external ( lor ) : t -> t -> t = "%orint"
external ( lxor ) : t -> t -> t = "%xorint"
val lnot : t -> t
external ( lsl ) : t -> t -> t = "%lslint"
external ( lsr ) : t -> t -> t = "%lsrint"
external ( asr ) : t -> t -> t = "%asrint"
end
include module type of Infix
module Set : Set.S with type elt = int
module Map : Map.S with type key = int

Loading…
Cancel
Save