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 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 encoding: t Data_encoding.t
|
||||
|
@ -16,6 +16,15 @@ module type DATA = sig
|
||||
val compare: t -> t -> int
|
||||
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 encoding: t Data_encoding.t
|
||||
@ -71,6 +80,15 @@ module Fitness = struct
|
||||
|
||||
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
|
||||
| [] -> ()
|
||||
| [f] -> Format.fprintf fmt "%s" (Hex_encode.hex_of_bytes f)
|
||||
@ -128,6 +146,15 @@ module Operation = struct
|
||||
MBytes.compare o1.proto o2.proto
|
||||
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 of_bytes b = Data_encoding.Binary.of_bytes 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
|
||||
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 of_bytes b = Data_encoding.Binary.of_bytes 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 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 of_bytes b = Data_encoding.Binary.of_bytes 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 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 encoding: t Data_encoding.t
|
||||
|
Loading…
Reference in New Issue
Block a user