diff options
Diffstat (limited to 'stdlib/source/library/lux/control/exception.lux')
-rw-r--r-- | stdlib/source/library/lux/control/exception.lux | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 48276683c..81e46e66d 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -16,7 +16,7 @@ ["[0]" list (.open: "[1]#[0]" functor mix)]]] [macro ["[0]" code] - [syntax (.only syntax:) + [syntax (.only syntax) ["|[0]|" input] ["[0]" type ["|[1]_[0]|" variable]]]] @@ -90,21 +90,22 @@ (<>.and (<>#in (` .private)) private) ))) -(syntax: .public (exception: [[export_policy t_vars [name inputs] body] ..exception]) - (macro.with_symbols [g!_ g!descriptor] - (do meta.monad - [current_module meta.current_module_name - .let [descriptor (all text#composite "{" current_module "." name "}" text.new_line) - g!self (code.local name)]] - (in (list (` (def: (~ export_policy) - (~ g!self) - (All ((~ g!_) (~+ (list#each |type_variable|.format t_vars))) - (..Exception [(~+ (list#each (the |input|.#type) inputs))])) - (let [(~ g!descriptor) (~ (code.text descriptor))] - [..#label (~ g!descriptor) - ..#constructor (function ((~ g!self) [(~+ (list#each (the |input|.#binding) inputs))]) - ((~! text#composite) (~ g!descriptor) - (~ (maybe.else (' "") body))))])))))))) +(def: .public exception: + (syntax (_ [[export_policy t_vars [name inputs] body] ..exception]) + (macro.with_symbols [g!_ g!descriptor] + (do meta.monad + [current_module meta.current_module_name + .let [descriptor (all text#composite "{" current_module "." name "}" text.new_line) + g!self (code.local name)]] + (in (list (` (def: (~ export_policy) + (~ g!self) + (All ((~ g!_) (~+ (list#each |type_variable|.format t_vars))) + (..Exception [(~+ (list#each (the |input|.#type) inputs))])) + (let [(~ g!descriptor) (~ (code.text descriptor))] + [..#label (~ g!descriptor) + ..#constructor (function ((~ g!self) [(~+ (list#each (the |input|.#binding) inputs))]) + ((~! text#composite) (~ g!descriptor) + (~ (maybe.else (' "") body))))]))))))))) (def: (report' entries) (-> (List [Text Text]) Text) @@ -137,10 +138,11 @@ (on_entry head) tail)))) -(syntax: .public (report [entries (<>.many (<>.and <code>.any <code>.any))]) - (in (list (` ((~! ..report') (list (~+ (|> entries - (list#each (function (_ [header message]) - (` [(~ header) (~ message)]))))))))))) +(def: .public report + (syntax (_ [entries (<>.many (<>.and <code>.any <code>.any))]) + (in (list (` ((~! ..report') (list (~+ (|> entries + (list#each (function (_ [header message]) + (` [(~ header) (~ message)])))))))))))) (def: .public (listing format entries) (All (_ a) |