diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/exception.lux | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index abc729129..9732cd185 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -1,7 +1,7 @@ (;module: {#;doc "Exception-handling functionality built on top of the Error type."} lux (lux (control monad) - (data ["E" error] + (data ["e" error] [maybe] [text "text/" Monoid<Text>]) [meta] @@ -30,41 +30,41 @@ If no exception was detected, or a different one from the one being checked, then pass along the original value."} (All [a] - (-> Exception (-> Text a) (E;Error a) - (E;Error a))) + (-> Exception (-> Text a) (e;Error a) + (e;Error a))) (case try - (#E;Success output) - (#E;Success output) + (#e;Success output) + (#e;Success output) - (#E;Error error) + (#e;Error error) (let [reference (exception "")] (if (text;starts-with? reference error) - (#E;Success (|> error + (#e;Success (|> error (text;clip (text;size reference) (text;size error)) maybe;assume then)) - (#E;Error error))))) + (#e;Error error))))) (def: #export (otherwise to-do try) {#;doc "If no handler could be found to catch the exception, then run a function as a last-resort measure."} (All [a] - (-> (-> Text a) (E;Error a) a)) + (-> (-> Text a) (e;Error a) a)) (case try - (#E;Success output) + (#e;Success output) output - (#E;Error error) + (#e;Error error) (to-do error))) (def: #export (return value) {#;doc "A way to lift normal values into the error-handling context."} - (All [a] (-> a (E;Error a))) - (#E;Success value)) + (All [a] (-> a (e;Error a))) + (#e;Success value)) (def: #export (throw exception message) {#;doc "Decorate an error message with an Exception and lift it into the error-handling context."} - (All [a] (-> Exception Text (E;Error a))) - (#E;Error (exception message))) + (All [a] (-> Exception Text (e;Error a))) + (#e;Error (exception message))) (syntax: #export (exception: [_ex-lev csr;export] [name s;local-symbol]) {#;doc (doc "Define a new exception type." |