Browse Source

move monomorphic comparison operators to an Infix module

main
zapashcanon 3 months ago
parent
commit
5dab6a36c0
Signed by: zapashcanon GPG Key ID: 8981C3C62D1D28F1
  1. 2
      CHANGES.md
  2. 57
      src/prelude.ml

2
CHANGES.md

@ -1,5 +1,7 @@
## unreleased
- move monoporphic comparison operators to Infix submodule
## 0.2 - 2024-07-23
- add monomorphic comparison operators to Float and Int{32|64}

57
src/prelude.ml

@ -10,64 +10,67 @@ module Empty = struct end
module Float = struct
include Float
(* Taken from base *)
external ( < ) : float -> float -> bool = "%lessthan"
module Infix = struct
external ( < ) : float -> float -> bool = "%lessthan"
external ( <= ) : float -> float -> bool = "%lessequal"
external ( <= ) : float -> float -> bool = "%lessequal"
external ( <> ) : float -> float -> bool = "%notequal"
external ( <> ) : float -> float -> bool = "%notequal"
external ( = ) : float -> float -> bool = "%equal"
external ( = ) : float -> float -> bool = "%equal"
external ( > ) : float -> float -> bool = "%greaterthan"
external ( > ) : float -> float -> bool = "%greaterthan"
external ( >= ) : float -> float -> bool = "%greaterequal"
external ( >= ) : float -> float -> bool = "%greaterequal"
external compare : float -> float -> int = "%compare"
external compare : float -> float -> int = "%compare"
external equal : float -> float -> bool = "%equal"
external equal : float -> float -> bool = "%equal"
end
end
module Int32 = struct
include Int32
(* Taken from base *)
external ( < ) : int32 -> int32 -> bool = "%lessthan"
module Infix = struct
external ( < ) : int32 -> int32 -> bool = "%lessthan"
external ( <= ) : int32 -> int32 -> bool = "%lessequal"
external ( <= ) : int32 -> int32 -> bool = "%lessequal"
external ( <> ) : int32 -> int32 -> bool = "%notequal"
external ( <> ) : int32 -> int32 -> bool = "%notequal"
external ( = ) : int32 -> int32 -> bool = "%equal"
external ( = ) : int32 -> int32 -> bool = "%equal"
external ( > ) : int32 -> int32 -> bool = "%greaterthan"
external ( > ) : int32 -> int32 -> bool = "%greaterthan"
external ( >= ) : int32 -> int32 -> bool = "%greaterequal"
external ( >= ) : int32 -> int32 -> bool = "%greaterequal"
external compare : int32 -> int32 -> int = "%compare"
external compare : int32 -> int32 -> int = "%compare"
external equal : int32 -> int32 -> bool = "%equal"
external equal : int32 -> int32 -> bool = "%equal"
end
end
module Int64 = struct
include Int64
(* Taken from base *)
external ( < ) : int64 -> int64 -> bool = "%lessthan"
module Infix = struct
external ( < ) : int64 -> int64 -> bool = "%lessthan"
external ( <= ) : int64 -> int64 -> bool = "%lessequal"
external ( <= ) : int64 -> int64 -> bool = "%lessequal"
external ( <> ) : int64 -> int64 -> bool = "%notequal"
external ( <> ) : int64 -> int64 -> bool = "%notequal"
external ( = ) : int64 -> int64 -> bool = "%equal"
external ( = ) : int64 -> int64 -> bool = "%equal"
external ( > ) : int64 -> int64 -> bool = "%greaterthan"
external ( > ) : int64 -> int64 -> bool = "%greaterthan"
external ( >= ) : int64 -> int64 -> bool = "%greaterequal"
external ( >= ) : int64 -> int64 -> bool = "%greaterequal"
external compare : int64 -> int64 -> int = "%compare"
external compare : int64 -> int64 -> int = "%compare"
external equal : int64 -> int64 -> bool = "%equal"
external equal : int64 -> int64 -> bool = "%equal"
end
end
(* Use the fmt library instead. *)

Loading…
Cancel
Save