diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/time/instant.lux | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 7d9906733..64c8d674e 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -12,16 +12,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)]]) @@ -104,7 +104,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))) )))) @@ -122,15 +122,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] @@ -141,8 +141,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) @@ -153,10 +153,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) @@ -182,7 +182,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)) @@ -203,13 +203,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) @@ -291,7 +291,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)))]] |