feat: LT for Timestamp and Duration (#8422)
This PR adds `LT` and `Decidable` `LT` instances for `Std.Time.Timestamp` and `Std.Time.Duration`.
This commit is contained in:
parent
3790f8c78e
commit
8e0870beec
2 changed files with 12 additions and 0 deletions
|
|
@ -34,6 +34,12 @@ instance : LE Timestamp where
|
|||
instance { x y : Timestamp } : Decidable (x ≤ y) :=
|
||||
inferInstanceAs (Decidable (x.val ≤ y.val))
|
||||
|
||||
instance : LT Timestamp where
|
||||
lt x y := x.val < y.val
|
||||
|
||||
instance { x y : Timestamp } : Decidable (x < y) :=
|
||||
inferInstanceAs (Decidable (x.val < y.val))
|
||||
|
||||
instance : OfNat Timestamp n where
|
||||
ofNat := ⟨OfNat.ofNat n⟩
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,12 @@ instance : LE Duration where
|
|||
instance {x y : Duration} : Decidable (x ≤ y) :=
|
||||
inferInstanceAs (Decidable (x.toNanoseconds ≤ y.toNanoseconds))
|
||||
|
||||
instance : LT Duration where
|
||||
lt d1 d2 := d1.toNanoseconds < d2.toNanoseconds
|
||||
|
||||
instance {x y : Duration} : Decidable (x < y) :=
|
||||
inferInstanceAs (Decidable (x.toNanoseconds < y.toNanoseconds))
|
||||
|
||||
/--
|
||||
Converts a `Duration` to a `Minute.Offset`
|
||||
-/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue