aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/number/complex.lux6
-rw-r--r--stdlib/source/lux/data/text/format.lux2
-rw-r--r--stdlib/source/lux/macro/poly/json.lux7
-rw-r--r--stdlib/source/lux/time/instant.lux17
4 files changed, 15 insertions, 17 deletions
diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux
index d17180530..876ab66d1 100644
--- a/stdlib/source/lux/data/number/complex.lux
+++ b/stdlib/source/lux/data/number/complex.lux
@@ -8,8 +8,6 @@
["p" parser])
(data [number "frac/" Number<Frac> "f/" Codec<Text,Frac>]
[text "text/" Monoid<Text>]
- text/format
- ["E" error]
[maybe]
(coll [list "L/" Monad<List>]))
[macro]
@@ -127,8 +125,8 @@
(let [(^slots [#real #imaginary]) subject]
{#real (f/* (math.cosh imaginary)
(math.cos real))
- #imaginary (f/* (math.sinh imaginary)
- (frac/negate (math.sin real)))}))
+ #imaginary (frac/negate (f/* (math.sinh imaginary)
+ (math.sin real)))}))
(def: #export (cosh subject)
(-> Complex Complex)
diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux
index 80d672d67..c511d194d 100644
--- a/stdlib/source/lux/data/text/format.lux
+++ b/stdlib/source/lux/data/text/format.lux
@@ -51,7 +51,7 @@
[%hex Nat (:: number.Hex@Codec<Text,Nat> encode)]
[%xml xml.XML (:: xml.Codec<Text,XML> encode)]
[%json json.JSON (:: json.Codec<Text,JSON> encode)]
- [%instant instant.Instant (:: instant.Codec<Text,Instant> encode)]
+ [%instant instant.Instant instant.to-text]
[%duration duration.Duration (:: duration.Codec<Text,Duration> encode)]
[%date date.Date (:: date.Codec<Text,Date> encode)]
)
diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux
index 9a3096dff..cbe3877d7 100644
--- a/stdlib/source/lux/macro/poly/json.lux
+++ b/stdlib/source/lux/macro/poly/json.lux
@@ -17,7 +17,7 @@
[sequence #+ Sequence sequence "sequence/" Monad<Sequence>]
["d" dict])
(format ["//" json #+ JSON]))
- (time ["i" instant]
+ (time ## ["i" instant]
["du" duration]
["da" date])
[macro #+ with-gensyms]
@@ -50,6 +50,7 @@
(|> low nat-to-int int-to-frac #//.Number)))))
(def: (decode input)
(<| (//.run input)
+ //.array
(do p.Monad<Parser>
[high //.number
low //.number])
@@ -97,7 +98,7 @@
(|>> (:: <codec> (~' encode)) #//.String)))))]
[du.Duration du.Codec<Text,Duration>]
- [i.Instant i.Codec<Text,Instant>]
+ ## [i.Instant i.Codec<Text,Instant>]
[da.Date da.Codec<Text,Date>]
[da.Day da.Codec<Text,Day>]
[da.Month da.Codec<Text,Month>])]
@@ -209,7 +210,7 @@
(p.codec <codec> //.string)))))]
[du.Duration du.Codec<Text,Duration>]
- [i.Instant i.Codec<Text,Instant>]
+ ## [i.Instant i.Codec<Text,Instant>]
[da.Date da.Codec<Text,Date>]
[da.Day da.Codec<Text,Day>]
[da.Month da.Codec<Text,Month>])]
diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux
index 334b05115..22d57a06e 100644
--- a/stdlib/source/lux/time/instant.lux
+++ b/stdlib/source/lux/time/instant.lux
@@ -192,7 +192,7 @@
day-time]))
## Based on this: https://stackoverflow.com/a/42936293/6823464
-(def: (encode instant)
+(def: #export (to-text instant)
(-> Instant Text)
(let [[[year month day] day-time] (extract-date instant)
day-time (if (duration/>= duration.empty day-time)
@@ -200,8 +200,7 @@
(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)]
- ]
+ [seconds millis] [(duration.query duration.second day-time) (duration.frame duration.second day-time)]]
($_ text/compose (int/encode year) "-" (pad month) "-" (pad day) "T"
(pad hours) ":" (pad minutes) ":" (pad seconds)
(|> millis
@@ -299,13 +298,13 @@
(-> Text (e.Error Instant))
(l.run input lex-instant))
-(struct: #export _
- {#.doc "Based on ISO 8601.
+## (struct: #export _
+## {#.doc "Based on ISO 8601.
- For example: 2017-01-15T21:14:51.827Z"}
- (Codec Text Instant)
- (def: encode encode)
- (def: decode decode))
+## For example: 2017-01-15T21:14:51.827Z"}
+## (Codec Text Instant)
+## (def: encode encode)
+## (def: decode decode))
(def: #export now
(IO Instant)