aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/time/duration.lux18
1 files changed, 9 insertions, 9 deletions
diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux
index 1abac1cc0..d7b0abb24 100644
--- a/stdlib/source/lux/time/duration.lux
+++ b/stdlib/source/lux/time/duration.lux
@@ -8,7 +8,7 @@
["p" parser]
[monad (#+ do)]]
[data
- ["." number ("int/." Codec<Text,Int> Number<Int>)]
+ ["." number ("nat/." Codec<Text,Nat>) ("int/." Codec<Text,Int> Number<Int>)]
[text ("text/." Monoid<Text>)
["l" lexer]]
["e" error]]
@@ -61,9 +61,9 @@
))
(do-template [<name> <op>]
- [(def: #export (<name> duration)
+ [(def: #export <name>
(-> Duration Bit)
- (<op> +0 (:representation duration)))]
+ (|>> :representation (<op> +0)))]
[positive? i/>]
[negative? i/<]
@@ -101,12 +101,12 @@
[seconds time-left] [(query second time-left) (frame second time-left)]
millis (to-millis time-left)]
($_ text/compose
- (if signed? "-" "")
- (if (i/= +0 days) "" (text/compose (int/encode days) "D"))
- (if (i/= +0 hours) "" (text/compose (int/encode hours) "h"))
- (if (i/= +0 minutes) "" (text/compose (int/encode minutes) "m"))
- (if (i/= +0 seconds) "" (text/compose (int/encode seconds) "s"))
- (if (i/= +0 millis) "" (text/compose (int/encode millis) "ms"))
+ (if signed? "-" "+")
+ (if (i/= +0 days) "" (text/compose (nat/encode (.nat days)) "D"))
+ (if (i/= +0 hours) "" (text/compose (nat/encode (.nat hours)) "h"))
+ (if (i/= +0 minutes) "" (text/compose (nat/encode (.nat minutes)) "m"))
+ (if (i/= +0 seconds) "" (text/compose (nat/encode (.nat seconds)) "s"))
+ (if (i/= +0 millis) "" (text/compose (nat/encode (.nat millis)) "ms"))
))))
(def: (lex-section suffix)