diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/exception.lux | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 1edd4bc04..ee5fd753a 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -7,10 +7,10 @@ [abstract [monad (#+ do)]] [control + ["." maybe] ["<>" parser ("#\." monad) ["<.>" code (#+ Parser)]]] [data - ["." maybe] ["." product] ["." text ("#\." monoid)] [collection @@ -33,13 +33,13 @@ #constructor (-> a Text)}) (def: .public (match? exception error) - {#.doc (doc "Is this exception the cause of the error message?")} + {#.doc (example "Is this exception the cause of the error message?")} (All [e] (-> (Exception e) Text Bit)) (text.starts_with? (get@ #label exception) error)) (def: .public (when exception then try) - {#.doc (doc "If a particular exception is detected on a possibly-erroneous value, handle it." - "If no exception was detected, or a different one from the one being checked, then pass along the original value.")} + {#.doc (example "If a particular exception is detected on a possibly-erroneous value, handle it." + "If no exception was detected, or a different one from the one being checked, then pass along the original value.")} (All [e a] (-> (Exception e) (-> Text a) (Try a) (Try a))) @@ -98,16 +98,16 @@ ))) (syntax: .public (exception: {[export_policy t_vars [name inputs] body] ..exception}) - {#.doc (doc "Define a new exception type." - "It mostly just serves as a way to tag error messages for later catching." - "" - "Simple case:" - (exception: .public some_exception) - "" - "Complex case:" - (exception: .public [arbitrary type variables] (some_exception {optional Text} {arguments Int}) - optional_body))} - (macro.with_gensyms [g!descriptor] + {#.doc (example "Define a new exception type." + "It mostly just serves as a way to tag error messages for later catching." + "" + "Simple case:" + (exception: .public some_exception) + "" + "Complex case:" + (exception: .public [arbitrary type variables] (some_exception {optional Text} {arguments Int}) + optional_body))} + (macro.with_identifiers [g!descriptor] (do meta.monad [current_module meta.current_module_name .let [descriptor ($_ text\compose "{" current_module "." name "}" text.new_line) @@ -154,19 +154,19 @@ tail)))) (syntax: .public (report {entries (<>.many (<code>.tuple (<>.and <code>.any <code>.any)))}) - {#.doc (doc "An error report." - (: Text - (report ["Row 0" value/0] - ["Row 1" value/1] - ,,, - ["Row N" value/N])))} + {#.doc (example "An error report." + (: Text + (report ["Row 0" value/0] + ["Row 1" value/1] + ,,, + ["Row N" value/N])))} (in (list (` ((~! report') (list (~+ (|> entries (list\map (function (_ [header message]) (` [(~ header) (~ message)]))))))))))) (def: .public (listing format entries) - {#.doc (doc "A numbered report of the entries on a list." - "NOTE: 0-based numbering.")} + {#.doc (example "A numbered report of the entries on a list." + "NOTE: 0-based numbering.")} (All [a] (-> (-> a Text) (List a) Text)) (|> entries @@ -195,7 +195,7 @@ error)) (def: .public (with exception message computation) - {#.doc (doc "If a computation fails, prepends the exception to the error.")} + {#.doc (example "If a computation fails, prepends the exception to the error.")} (All [e a] (-> (Exception e) e (Try a) (Try a))) (case computation (#//.Failure error) |