diff options
Diffstat (limited to 'stdlib/source')
-rw-r--r-- | stdlib/source/lux/control/exception.lux | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index fc5cf9c64..222d2e094 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 Result type."} lux (lux (control monad) - (data [result #- fail] + (data ["R" result #- fail] [text]) [macro] (macro [code] @@ -26,34 +26,34 @@ (-> Exception (-> Text a) (Result a) (Result a))) (case try - (#;Right output) - (#;Right output) + (#R;Success output) + (#R;Success output) - (#;Left error) + (#R;Error error) (if (text;starts-with? (exception "") error) - (#;Right (then error)) - (#;Left error)))) + (#R;Success (then error)) + (#R;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) (Result a) a)) (case try - (#;Right output) + (#R;Success output) output - (#;Left error) + (#R;Error error) (to-do error))) (def: #export (return value) {#;doc "A way to lift normal values into the result-handling context."} (All [a] (-> a (Result a))) - (#;Right value)) + (#R;Success value)) (def: #export (throw exception message) {#;doc "Decorate an error message with an Exception and lift it into the result-handling context."} (All [a] (-> Exception Text (Result a))) - (#;Left (exception message))) + (#R;Error (exception message))) (syntax: #export (exception: [_ex-lev common;export-level] [name s;local-symbol]) {#;doc (doc "Define a new exception type." |