aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/text.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/text.lux23
1 files changed, 12 insertions, 11 deletions
diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux
index 777c7da22..921e7c96c 100644
--- a/stdlib/source/lux/data/text.lux
+++ b/stdlib/source/lux/data/text.lux
@@ -12,7 +12,7 @@
[number
["." i64]]
[collection
- ["." list ("list/." Fold<List>)]]]
+ ["." list ("list/." fold)]]]
[platform
[compiler
["." host]]]])
@@ -135,7 +135,7 @@
(def: #export (split-with token sample)
(-> Text Text (Maybe [Text Text]))
- (do maybe.Monad<Maybe>
+ (do maybe.monad
[index (index-of token sample)
[pre post'] (split index sample)
[_ post] (split (size token) post')]
@@ -156,7 +156,7 @@
(def: #export (replace-once pattern value template)
(-> Text Text Text Text)
(<| (maybe.default template)
- (do maybe.Monad<Maybe>
+ (do maybe.monad
[[pre post] (split-with pattern template)]
(wrap ($_ "lux text concat" pre value post)))))
@@ -169,12 +169,12 @@
#.None
template))
-(structure: #export _ (Equivalence Text)
+(structure: #export equivalence (Equivalence Text)
(def: (= test subject)
("lux text =" subject test)))
-(structure: #export _ (Order Text)
- (def: eq Equivalence<Text>)
+(structure: #export order (Order Text)
+ (def: &equivalence ..equivalence)
(def: (< test subject)
("lux text <" subject test))
@@ -191,13 +191,14 @@
("lux text =" test subject)))
)
-(structure: #export _ (Monoid Text)
+(structure: #export monoid (Monoid Text)
(def: identity "")
+
(def: (compose left right)
("lux text concat" left right)))
-(structure: #export _ (Hash Text)
- (def: eq Equivalence<Text>)
+(structure: #export hash (Hash Text)
+ (def: &equivalence ..equivalence)
(def: (hash input)
(`` (for {(~~ (static host.jvm))
@@ -220,7 +221,7 @@
(def: #export concat
(-> (List Text) Text)
- (let [(^open ".") Monoid<Text>]
+ (let [(^open ".") ..monoid]
(|>> list.reverse (list/fold compose identity))))
(def: #export (join-with sep texts)
@@ -236,7 +237,7 @@
(def: #export (enclose [left right] content)
{#.doc "Surrounds the given content text with left and right side additions."}
(-> [Text Text] Text Text)
- (let [(^open ".") Monoid<Text>]
+ (let [(^open ".") ..monoid]
($_ "lux text concat" left content right)))
(def: #export (enclose' boundary content)