diff options
Diffstat (limited to 'stdlib/source/lux/time/instant.lux')
-rw-r--r-- | stdlib/source/lux/time/instant.lux | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 06e11a664..9dce5f8b3 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -13,16 +13,16 @@ ["." error (#+ Error)] ["." maybe] [number - ["." int ("#;." decimal)]] - ["." text ("#;." monoid) + ["." int ("#@." decimal)]] + ["." text ("#@." monoid) ["l" lexer]] [collection - ["." list ("#;." fold)] - ["." row (#+ Row row) ("#;." functor fold)]]] + ["." list ("#@." fold)] + ["." row (#+ Row row) ("#@." functor fold)]]] [type abstract]] [// - ["." duration ("#;." order)] + ["." duration ("#@." order)] ["." date (#+ Date)] ["." month (#+ Month)] ["." day (#+ Day)]]) @@ -105,7 +105,7 @@ duration.normal-year)] (if (i/= +0 (duration.query year time-left)) [reference time-left] - (if (duration;>= duration.empty time-left) + (if (duration@>= duration.empty time-left) (recur (inc reference) (duration.merge (duration.inverse year) time-left)) (recur (dec reference) (duration.merge year time-left))) )))) @@ -123,15 +123,15 @@ (def: (find-month months time) (-> (Row Nat) duration.Duration [Nat duration.Duration]) - (if (duration;>= duration.empty time) - (row;fold (function (_ month-days [current-month time-left]) + (if (duration@>= 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)) [current-month time-left] [(inc current-month) (duration.merge (duration.inverse month-duration) time-left)]))) [0 time] months) - (row;fold (function (_ month-days [current-month time-left]) + (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)) [current-month time-left] @@ -142,8 +142,8 @@ (def: (pad value) (-> Int Text) (if (i/< +10 value) - (text;compose "0" (int;encode value)) - (int;encode value))) + (text@compose "0" (int@encode value)) + (int@encode value))) (def: (adjust-negative space duration) (-> duration.Duration duration.Duration duration.Duration) @@ -154,10 +154,10 @@ (def: (encode-millis millis) (-> Int Text) (cond (i/= +0 millis) "" - (i/< +10 millis) ($_ text;compose ".00" (int;encode millis)) - (i/< +100 millis) ($_ text;compose ".0" (int;encode millis)) + (i/< +10 millis) ($_ text@compose ".00" (int@encode millis)) + (i/< +100 millis) ($_ text@compose ".0" (int@encode millis)) ## (i/< +1,000 millis) - ($_ text;compose "." (int;encode millis)))) + ($_ text@compose "." (int@encode millis)))) (def: seconds-per-day Int (duration.query duration.second duration.day)) (def: days-up-to-epoch Int +719468) @@ -183,7 +183,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 (duration@>= duration.empty day-time) days-of-year (dec days-of-year)) mp (|> days-of-year (i/* +5) (i/+ +2) (i// +153)) @@ -204,13 +204,13 @@ (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 (duration@>= 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)] [minutes day-time] [(duration.query duration.minute day-time) (duration.frame duration.minute day-time)] [seconds millis] [(duration.query duration.second day-time) (duration.frame duration.second day-time)]] - ($_ text;compose (int;encode year) "-" (pad month) "-" (pad day) "T" + ($_ text@compose (int@encode year) "-" (pad month) "-" (pad day) "T" (pad hours) ":" (pad minutes) ":" (pad seconds) (|> millis (adjust-negative duration.second) @@ -292,7 +292,7 @@ ## month-days-so-far (|> months ## row.to-list ## (list.take (.nat (dec utc-month))) -## (list;fold n/+ 0)) +## (list@fold n/+ 0)) ## total-days (|> year-days-so-far ## (i/+ (.int month-days-so-far)) ## (i/+ (dec utc-day)))]] @@ -336,7 +336,7 @@ +10 #month.November +11 #month.December _ (undefined)) - #date.day (.nat day)})) + #date.day (.nat (dec day))})) (def: #export (month instant) (-> Instant Month) |