diff options
Diffstat (limited to 'stdlib/source/library/lux/data/text.lux')
-rw-r--r-- | stdlib/source/library/lux/data/text.lux | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 7823bd333..a95490493 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -53,8 +53,8 @@ (def: .public (char index input) (-> Nat Text (Maybe Char)) (if (n.< ("lux text size" input) index) - {#.Some ("lux text char" index input)} - #.None)) + {.#Some ("lux text char" index input)} + {.#None})) (def: .public (index_since offset pattern input) (-> Nat Text Text (Maybe Nat)) @@ -68,19 +68,19 @@ (-> Text Text (Maybe Nat)) (loop [offset 0 output (: (Maybe Nat) - #.None)] + {.#None})] (let [output' ("lux text index" offset part text)] (case output' - #.None + {.#None} output - {#.Some offset'} + {.#Some offset'} (recur (++ offset') output'))))) (def: .public (starts_with? prefix x) (-> Text Text Bit) (case (index prefix x) - {#.Some 0} + {.#Some 0} true _ @@ -89,7 +89,7 @@ (def: .public (ends_with? postfix x) (-> Text Text Bit) (case (last_index postfix x) - {#.Some n} + {.#Some n} (n.= (size x) (n.+ (size postfix) n)) @@ -104,7 +104,7 @@ (def: .public (contains? sub text) (-> Text Text Bit) (case ("lux text index" 0 sub text) - {#.Some _} + {.#Some _} true _ @@ -133,24 +133,24 @@ (def: .public (clip offset size input) (-> Nat Nat Text (Maybe Text)) (if (|> size (n.+ offset) (n.> ("lux text size" input))) - #.None - {#.Some ("lux text clip" offset size input)})) + {.#None} + {.#Some ("lux text clip" offset size input)})) (def: .public (clip_since offset input) (-> Nat Text (Maybe Text)) (let [size ("lux text size" input)] (if (n.> size offset) - #.None - {#.Some ("lux text clip" offset (n.- offset size) input)}))) + {.#None} + {.#Some ("lux text clip" offset (n.- offset size) input)}))) (def: .public (split_at at x) (-> Nat Text (Maybe [Text Text])) (case [(..clip 0 at x) (..clip_since at x)] - [{#.Some pre} {#.Some post}] - {#.Some [pre post]} + [{.#Some pre} {.#Some post}] + {.#Some [pre post]} _ - #.None)) + {.#None})) (def: .public (split_by token sample) (-> Text Text (Maybe [Text Text])) @@ -165,14 +165,14 @@ (loop [input sample output (: (List Text) (list))] (case (..split_by token input) - {#.Some [pre post]} + {.#Some [pre post]} (|> output - {#.Item pre} + {.#Item pre} (recur post)) - #.None + {.#None} (|> output - {#.Item input} + {.#Item input} list.reversed)))) (def: .public (replaced/1 pattern replacement template) @@ -219,10 +219,10 @@ (loop [left "" right template] (case (..split_by pattern right) - {#.Some [pre post]} + {.#Some [pre post]} (recur ($_ "lux text concat" left pre replacement) post) - #.None + {.#None} ("lux text concat" left right))))) (implementation: .public equivalence |