aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/format
diff options
context:
space:
mode:
authorEduardo Julian2022-12-11 16:07:39 -0400
committerEduardo Julian2022-12-11 16:07:39 -0400
commiteef4422b1f16be2b8c651461f2c006dc4c11f314 (patch)
tree0fa040c7a628d03551b7d7d4244a4af025d5edba /stdlib/source/format
parentfd3f02c024687bc5c2b9741f6386719a0affb7bb (diff)
Added support for fixed-point arithmetic.
Diffstat (limited to 'stdlib/source/format')
-rw-r--r--stdlib/source/format/lux/data/text.lux21
1 files changed, 14 insertions, 7 deletions
diff --git a/stdlib/source/format/lux/data/text.lux b/stdlib/source/format/lux/data/text.lux
index 532edba75..43117912e 100644
--- a/stdlib/source/format/lux/data/text.lux
+++ b/stdlib/source/format/lux/data/text.lux
@@ -16,13 +16,14 @@
[collection
["[0]" list (.use "[1]#[0]" monad)]]]
[math
- ["[0]" modular]
[number
["[0]" nat]
["[0]" int]
["[0]" rev]
["[0]" frac]
- ["[0]" ratio]]]
+ ["[0]" ratio]]
+ [arithmetic
+ ["[0]" modular]]]
[meta
["[0]" location]
["[0]" symbol]
@@ -40,8 +41,9 @@
["[0]" day]
["[0]" month]]]]])
-(.type .public (Format a)
- (-> a Text))
+(.type .public (Format of)
+ (-> of
+ Text))
(def .public functor
(contravariant.Functor Format)
@@ -113,18 +115,23 @@
)
(def .public (mod modular)
- (All (_ m) (Format (modular.Mod m)))
+ (All (_ %)
+ (Format (modular.Mod %)))
(let [codec (modular.codec (modular.modulus modular))]
(of codec encoded modular)))
(def .public (list formatter)
- (All (_ a) (-> (Format a) (Format (List a))))
+ (All (_ of)
+ (-> (Format of)
+ (Format (List of))))
(|>> (list#each (|>> formatter (format " ")))
text.together
(text.enclosed ["(list" ")"])))
(def .public (maybe format)
- (All (_ a) (-> (Format a) (Format (Maybe a))))
+ (All (_ of)
+ (-> (Format of)
+ (Format (Maybe of))))
(function (_ value)
(when value
{.#None}