Shell: add comparison operators to Tezos_data
This commit is contained in:
parent
a7a4564670
commit
d4ac1389e3
@ -14,6 +14,15 @@ module type DATA = sig
|
|||||||
val compare: t -> t -> int
|
val compare: t -> t -> int
|
||||||
val equal: t -> t -> bool
|
val equal: t -> t -> bool
|
||||||
|
|
||||||
|
val (=): t -> t -> bool
|
||||||
|
val (<>): t -> t -> bool
|
||||||
|
val (<): t -> t -> bool
|
||||||
|
val (<=): t -> t -> bool
|
||||||
|
val (>=): t -> t -> bool
|
||||||
|
val (>): t -> t -> bool
|
||||||
|
val min: t -> t -> t
|
||||||
|
val max: t -> t -> t
|
||||||
|
|
||||||
val pp: Format.formatter -> t -> unit
|
val pp: Format.formatter -> t -> unit
|
||||||
|
|
||||||
val encoding: t Data_encoding.t
|
val encoding: t Data_encoding.t
|
||||||
|
@ -16,6 +16,15 @@ module type DATA = sig
|
|||||||
val compare: t -> t -> int
|
val compare: t -> t -> int
|
||||||
val equal: t -> t -> bool
|
val equal: t -> t -> bool
|
||||||
|
|
||||||
|
val (=): t -> t -> bool
|
||||||
|
val (<>): t -> t -> bool
|
||||||
|
val (<): t -> t -> bool
|
||||||
|
val (<=): t -> t -> bool
|
||||||
|
val (>=): t -> t -> bool
|
||||||
|
val (>): t -> t -> bool
|
||||||
|
val min: t -> t -> t
|
||||||
|
val max: t -> t -> t
|
||||||
|
|
||||||
val pp: Format.formatter -> t -> unit
|
val pp: Format.formatter -> t -> unit
|
||||||
|
|
||||||
val encoding: t Data_encoding.t
|
val encoding: t Data_encoding.t
|
||||||
@ -71,6 +80,15 @@ module Fitness = struct
|
|||||||
|
|
||||||
let equal f1 f2 = compare f1 f2 = 0
|
let equal f1 f2 = compare f1 f2 = 0
|
||||||
|
|
||||||
|
let (=) = equal
|
||||||
|
let (<>) x y = compare x y <> 0
|
||||||
|
let (<) x y = compare x y < 0
|
||||||
|
let (<=) x y = compare x y <= 0
|
||||||
|
let (>=) x y = compare x y >= 0
|
||||||
|
let (>) x y = compare x y > 0
|
||||||
|
let min x y = if x <= y then x else y
|
||||||
|
let max x y = if x <= y then y else x
|
||||||
|
|
||||||
let rec pp fmt = function
|
let rec pp fmt = function
|
||||||
| [] -> ()
|
| [] -> ()
|
||||||
| [f] -> Format.fprintf fmt "%s" (Hex_encode.hex_of_bytes f)
|
| [f] -> Format.fprintf fmt "%s" (Hex_encode.hex_of_bytes f)
|
||||||
@ -128,6 +146,15 @@ module Operation = struct
|
|||||||
MBytes.compare o1.proto o2.proto
|
MBytes.compare o1.proto o2.proto
|
||||||
let equal b1 b2 = compare b1 b2 = 0
|
let equal b1 b2 = compare b1 b2 = 0
|
||||||
|
|
||||||
|
let (=) = equal
|
||||||
|
let (<>) x y = compare x y <> 0
|
||||||
|
let (<) x y = compare x y < 0
|
||||||
|
let (<=) x y = compare x y <= 0
|
||||||
|
let (>=) x y = compare x y >= 0
|
||||||
|
let (>) x y = compare x y > 0
|
||||||
|
let min x y = if x <= y then x else y
|
||||||
|
let max x y = if x <= y then y else x
|
||||||
|
|
||||||
let to_bytes v = Data_encoding.Binary.to_bytes encoding v
|
let to_bytes v = Data_encoding.Binary.to_bytes encoding v
|
||||||
let of_bytes b = Data_encoding.Binary.of_bytes encoding b
|
let of_bytes b = Data_encoding.Binary.of_bytes encoding b
|
||||||
let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b
|
let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b
|
||||||
@ -214,6 +241,15 @@ module Block_header = struct
|
|||||||
|
|
||||||
let equal b1 b2 = compare b1 b2 = 0
|
let equal b1 b2 = compare b1 b2 = 0
|
||||||
|
|
||||||
|
let (=) = equal
|
||||||
|
let (<>) x y = compare x y <> 0
|
||||||
|
let (<) x y = compare x y < 0
|
||||||
|
let (<=) x y = compare x y <= 0
|
||||||
|
let (>=) x y = compare x y >= 0
|
||||||
|
let (>) x y = compare x y > 0
|
||||||
|
let min x y = if x <= y then x else y
|
||||||
|
let max x y = if x <= y then y else x
|
||||||
|
|
||||||
let to_bytes v = Data_encoding.Binary.to_bytes encoding v
|
let to_bytes v = Data_encoding.Binary.to_bytes encoding v
|
||||||
let of_bytes b = Data_encoding.Binary.of_bytes encoding b
|
let of_bytes b = Data_encoding.Binary.of_bytes encoding b
|
||||||
let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b
|
let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b
|
||||||
@ -273,6 +309,15 @@ module Protocol = struct
|
|||||||
let compare = Pervasives.compare
|
let compare = Pervasives.compare
|
||||||
let equal = (=)
|
let equal = (=)
|
||||||
|
|
||||||
|
let (=) = equal
|
||||||
|
let (<>) x y = compare x y <> 0
|
||||||
|
let (<) x y = compare x y < 0
|
||||||
|
let (<=) x y = compare x y <= 0
|
||||||
|
let (>=) x y = compare x y >= 0
|
||||||
|
let (>) x y = compare x y > 0
|
||||||
|
let min x y = if x <= y then x else y
|
||||||
|
let max x y = if x <= y then y else x
|
||||||
|
|
||||||
let to_bytes v = Data_encoding.Binary.to_bytes encoding v
|
let to_bytes v = Data_encoding.Binary.to_bytes encoding v
|
||||||
let of_bytes b = Data_encoding.Binary.of_bytes encoding b
|
let of_bytes b = Data_encoding.Binary.of_bytes encoding b
|
||||||
let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b
|
let of_bytes_exn b = Data_encoding.Binary.of_bytes_exn encoding b
|
||||||
|
@ -16,6 +16,15 @@ module type DATA = sig
|
|||||||
val compare: t -> t -> int
|
val compare: t -> t -> int
|
||||||
val equal: t -> t -> bool
|
val equal: t -> t -> bool
|
||||||
|
|
||||||
|
val (=): t -> t -> bool
|
||||||
|
val (<>): t -> t -> bool
|
||||||
|
val (<): t -> t -> bool
|
||||||
|
val (<=): t -> t -> bool
|
||||||
|
val (>=): t -> t -> bool
|
||||||
|
val (>): t -> t -> bool
|
||||||
|
val min: t -> t -> t
|
||||||
|
val max: t -> t -> t
|
||||||
|
|
||||||
val pp: Format.formatter -> t -> unit
|
val pp: Format.formatter -> t -> unit
|
||||||
|
|
||||||
val encoding: t Data_encoding.t
|
val encoding: t Data_encoding.t
|
||||||
|
Loading…
Reference in New Issue
Block a user