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.lux50
1 files changed, 25 insertions, 25 deletions
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index 1a2af827e..68a86bf9d 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -13,7 +13,7 @@
["e" error]
[maybe]
(coll [list "L/" Fold<List> Functor<List>]
- [sequence #+ Sequence sequence "sequence/" Functor<Sequence> Fold<Sequence>]))
+ [row #+ Row row "row/" Functor<Row> Fold<Row>]))
(type abstract))
(// [duration "duration/" Order<Duration>]
[date]))
@@ -102,33 +102,33 @@
))))
(def: normal-months
- (Sequence Nat)
- (sequence +31 +28 +31
- +30 +31 +30
- +31 +31 +30
- +31 +30 +31))
+ (Row Nat)
+ (row +31 +28 +31
+ +30 +31 +30
+ +31 +31 +30
+ +31 +30 +31))
(def: leap-year-months
- (Sequence Nat)
- (sequence.update [+1] inc normal-months))
+ (Row Nat)
+ (row.update [+1] inc normal-months))
(def: (find-month months time)
- (-> (Sequence Nat) duration.Duration [Nat duration.Duration])
+ (-> (Row Nat) duration.Duration [Nat duration.Duration])
(if (duration/>= duration.empty time)
- (sequence/fold (function (_ month-days [current-month time-left])
- (let [month-duration (duration.scale (.int month-days) duration.day)]
- (if (i/= 0 (duration.query month-duration time-left))
- [current-month time-left]
- [(inc current-month) (duration.merge (duration.scale -1 month-duration) time-left)])))
- [+0 time]
- months)
- (sequence/fold (function (_ month-days [current-month time-left])
- (let [month-duration (duration.scale (.int month-days) duration.day)]
- (if (i/= 0 (duration.query month-duration time-left))
- [current-month time-left]
- [(dec current-month) (duration.merge month-duration time-left)])))
- [+11 time]
- (sequence.reverse months))))
+ (row/fold (function (_ month-days [current-month time-left])
+ (let [month-duration (duration.scale (.int month-days) duration.day)]
+ (if (i/= 0 (duration.query month-duration time-left))
+ [current-month time-left]
+ [(inc current-month) (duration.merge (duration.scale -1 month-duration) time-left)])))
+ [+0 time]
+ months)
+ (row/fold (function (_ month-days [current-month time-left])
+ (let [month-duration (duration.scale (.int month-days) duration.day)]
+ (if (i/= 0 (duration.query month-duration time-left))
+ [current-month time-left]
+ [(dec current-month) (duration.merge month-duration time-left)])))
+ [+11 time]
+ (row.reverse months))))
(def: (pad value)
(-> Int Text)
@@ -251,7 +251,7 @@
leap-year-months
normal-months)
month-days (|> months
- (sequence.nth (.nat (dec utc-month)))
+ (row.nth (.nat (dec utc-month)))
maybe.assume)]
_ (l.this "-")
utc-day lex-section
@@ -281,7 +281,7 @@
year-days-so-far (|> (i/* 365 years-since-epoch)
(i/+ previous-leap-days))
month-days-so-far (|> months
- sequence.to-list
+ row.to-list
(list.take (.nat (dec utc-month)))
(L/fold n/+ +0))
total-days (|> year-days-so-far