aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/time/instant.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/time/instant.lux24
1 files changed, 10 insertions, 14 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index 9dce5f8b3..51087e4fc 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -2,7 +2,7 @@
[lux #*
[abstract
[equivalence (#+ Equivalence)]
- [order (#+ Order)]
+ ["." order (#+ Order)]
[enum (#+ Enum)]
codec
[monad (#+ do Monad)]]
@@ -22,7 +22,7 @@
[type
abstract]]
[//
- ["." duration ("#@." order)]
+ ["." duration]
["." date (#+ Date)]
["." month (#+ Month)]
["." day (#+ Day)]])
@@ -59,14 +59,10 @@
(def: (= param subject)
(:: int.equivalence = (:representation param) (:representation subject))))
- (`` (structure: #export order (Order Instant)
- (def: &equivalence ..equivalence)
- (~~ (template [<name>]
- [(def: (<name> param subject)
- (:: int.order <name> (:representation param) (:representation subject)))]
-
- [<] [<=] [>] [>=]
- ))))
+ (structure: #export order (Order Instant)
+ (def: &equivalence ..equivalence)
+ (def: (< param subject)
+ (:: int.order < (:representation param) (:representation subject))))
(`` (structure: #export enum (Enum Instant)
(def: &order ..order)
@@ -105,7 +101,7 @@
duration.normal-year)]
(if (i/= +0 (duration.query year time-left))
[reference time-left]
- (if (duration@>= duration.empty time-left)
+ (if (order.>= duration.order duration.empty time-left)
(recur (inc reference) (duration.merge (duration.inverse year) time-left))
(recur (dec reference) (duration.merge year time-left)))
))))
@@ -123,7 +119,7 @@
(def: (find-month months time)
(-> (Row Nat) duration.Duration [Nat duration.Duration])
- (if (duration@>= duration.empty time)
+ (if (order.>= duration.order duration.empty time)
(row@fold (function (_ month-days [current-month time-left])
(let [month-duration (duration.scale-up month-days duration.day)]
(if (i/= +0 (duration.query month-duration time-left))
@@ -183,7 +179,7 @@
(i/+ (i// +4 years-of-era))
(i/- (i// +100 years-of-era)))))
day-time (duration.frame duration.day offset)
- days-of-year (if (duration@>= duration.empty day-time)
+ days-of-year (if (order.>= duration.order duration.empty day-time)
days-of-year
(dec days-of-year))
mp (|> days-of-year (i/* +5) (i/+ +2) (i// +153))
@@ -204,7 +200,7 @@
(def: #export (to-text instant)
(-> Instant Text)
(let [[[year month day] day-time] (extract-date instant)
- day-time (if (duration@>= duration.empty day-time)
+ day-time (if (order.>= duration.order duration.empty day-time)
day-time
(duration.merge duration.day day-time))
[hours day-time] [(duration.query duration.hour day-time) (duration.frame duration.hour day-time)]