aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/exception.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/control/exception.lux')
-rw-r--r--stdlib/source/library/lux/control/exception.lux22
1 files changed, 9 insertions, 13 deletions
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index f89611e19..d957188ea 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Pure-Lux exception-handling functionality."}
[library
[lux #*
["." macro]
@@ -33,7 +32,7 @@
(def: .public (match? exception error)
(All [e] (-> (Exception e) Text Bit))
- (text.starts_with? (get@ #label exception) error))
+ (text.starts_with? (value@ #label exception) error))
(def: .public (when exception then try)
(All [e a]
@@ -44,7 +43,7 @@
(#//.Success output)
(#//.Failure error)
- (let [reference (get@ #label exception)]
+ (let [reference (value@ #label exception)]
(if (text.starts_with? reference error)
(#//.Success (|> error
(text.clip' (text.size reference))
@@ -64,7 +63,7 @@
(def: .public (error exception message)
(All [e] (-> (Exception e) e Text))
- ((get@ #..constructor exception) message))
+ ((value@ #..constructor exception) message))
(def: .public (except exception message)
(All [e a] (-> (Exception e) e (Try a)))
@@ -91,9 +90,6 @@
)))
(syntax: .public (exception: [[export_policy t_vars [name inputs] body] ..exception])
- {#.doc (example
- ""
- )}
(macro.with_identifiers [g!descriptor]
(do meta.monad
[current_module meta.current_module_name
@@ -102,10 +98,10 @@
(in (list (` (def: (~ export_policy)
(~ g!self)
(All [(~+ (list\map |type_variable|.format t_vars))]
- (..Exception [(~+ (list\map (get@ #|input|.type) inputs))]))
+ (..Exception [(~+ (list\map (value@ #|input|.type) inputs))]))
(let [(~ g!descriptor) (~ (code.text descriptor))]
{#..label (~ g!descriptor)
- #..constructor (function ((~ g!self) [(~+ (list\map (get@ #|input|.binding) inputs))])
+ #..constructor (function ((~ g!self) [(~+ (list\map (value@ #|input|.binding) inputs))])
((~! text\compose) (~ g!descriptor)
(~ (maybe.else (' "") body))))}))))))))
@@ -119,14 +115,14 @@
on_new_line (|> " "
(list.repeated (n.+ (text.size header_separator)
largest_header_size))
- text.joined
+ text.together
(text\compose text.new_line))
on_entry (: (-> [Text Text] Text)
(function (_ [header message])
(let [padding (|> " "
(list.repeated (n.- (text.size header)
largest_header_size))
- text.joined)]
+ text.together)]
(|> message
(text.replaced text.new_line on_new_line)
($_ text\compose padding header header_separator)))))]
@@ -150,7 +146,7 @@
(-> (-> a Text) (List a) Text))
(|> entries
(list\fold (function (_ entry [index next])
- [(inc index)
+ [(++ index)
(#.Item [(n\encode index) (format entry)]
next)])
[0 #.End])
@@ -160,7 +156,7 @@
(def: separator
(let [gap ($_ "lux text concat" text.new_line text.new_line)
- horizontal_line (|> "-" (list.repeated 64) text.joined)]
+ horizontal_line (|> "-" (list.repeated 64) text.together)]
($_ "lux text concat"
gap
horizontal_line