diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/text.lux | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index bf05df201..0fdbb376f 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -1,4 +1,4 @@ -(;module: +(.module: lux (lux (control [monoid #+ Monoid] [eq #+ Eq] @@ -21,7 +21,7 @@ (def: #export (contains? sub text) (-> Text Text Bool) (case ("lux text index" text sub +0) - (#;Some _) + (#.Some _) true _ @@ -59,34 +59,34 @@ (def: (last-index-of'' part part-size since text) (-> Text Nat Nat Text (Maybe Nat)) (case ("lux text index" text part (n/+ part-size since)) - #;None - (#;Some since) + #.None + (#.Some since) - (#;Some since') + (#.Some since') (last-index-of'' part part-size since' text))) (def: #export (last-index-of' part from text) (-> Text Nat Text (Maybe Nat)) (case ("lux text index" text part from) - (#;Some since) + (#.Some since) (last-index-of'' part ("lux text size" part) since text) - #;None - #;None)) + #.None + #.None)) (def: #export (last-index-of part text) (-> Text Text (Maybe Nat)) (case ("lux text index" text part +0) - (#;Some since) + (#.Some since) (last-index-of'' part ("lux text size" part) since text) - #;None - #;None)) + #.None + #.None)) (def: #export (starts-with? prefix x) (-> Text Text Bool) (case (index-of prefix x) - (#;Some +0) + (#.Some +0) true _ @@ -95,7 +95,7 @@ (def: #export (ends-with? postfix x) (-> Text Text Bool) (case (last-index-of postfix x) - (#;Some n) + (#.Some n) (n/= (size x) (n/+ (size postfix) n)) @@ -105,15 +105,15 @@ (def: #export (split at x) (-> Nat Text (Maybe [Text Text])) (case [(clip +0 at x) (clip' at x)] - [(#;Some pre) (#;Some post)] - (#;Some [pre post]) + [(#.Some pre) (#.Some post)] + (#.Some [pre post]) _ - #;None)) + #.None)) (def: #export (split-with token sample) (-> Text Text (Maybe [Text Text])) - (do maybe;Monad<Maybe> + (do maybe.Monad<Maybe> [index (index-of token sample) [pre post'] (split index sample) [_ post] (split (size token) post')] @@ -122,11 +122,11 @@ (def: #export (split-all-with token sample) (-> Text Text (List Text)) (case (split-with token sample) - (#;Some [pre post]) - (#;Cons pre (split-all-with token post)) + (#.Some [pre post]) + (#.Cons pre (split-all-with token post)) - #;None - (#;Cons sample #;Nil))) + #.None + (#.Cons sample #.Nil))) (def: #export split-lines (split-all-with "\n")) @@ -136,7 +136,7 @@ (def: (= test subject) ("lux text =" subject test))) -(struct: #export _ (order;Order Text) +(struct: #export _ (order.Order Text) (def: eq Eq<Text>) (def: (< test subject) @@ -183,13 +183,13 @@ (def: #export concat (-> (List Text) Text) - (let [(^open) list;Fold<List> + (let [(^open) list.Fold<List> (^open) Monoid<Text>] - (|>> list;reverse (fold text/compose identity)))) + (|>> list.reverse (fold text/compose identity)))) (def: #export (join-with sep texts) (-> Text (List Text) Text) - (|> texts (list;interpose sep) concat)) + (|> texts (list.interpose sep) concat)) (def: #export (empty? text) (-> Text Bool) @@ -199,20 +199,20 @@ (def: #export (replace-once pattern value template) (-> Text Text Text Text) - (maybe;default template - (do maybe;Monad<Maybe> + (maybe.default template + (do maybe.Monad<Maybe> [[pre post] (split-with pattern template) #let [(^open) Monoid<Text>]] (wrap ($_ text/compose pre value post))))) (def: #export (enclose [left right] content) - {#;doc "Surrounds the given content text with left and right side additions."} + {#.doc "Surrounds the given content text with left and right side additions."} (-> [Text Text] Text Text) (let [(^open) Monoid<Text>] ($_ text/compose left content right))) (def: #export (enclose' boundary content) - {#;doc "Surrounds the given content text with the same boundary text."} + {#.doc "Surrounds the given content text with the same boundary text."} (-> Text Text Text) (enclose [boundary boundary] content)) @@ -221,7 +221,7 @@ ("lux nat char" code)) (def: #export (space? char) - {#;doc "Checks whether the character is white-space."} + {#.doc "Checks whether the character is white-space."} (-> Nat Bool) (case char (^or (^ (char "\t")) (^ (char "\v")) |