diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/debug.lux | 107 |
1 files changed, 55 insertions, 52 deletions
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 462f7a4bb..64f1cb80f 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -28,7 +28,7 @@ [macro ["^" pattern] ["[0]" template] - ["[0]" syntax (.only syntax:)] + ["[0]" syntax (.only syntax)] ["[0]" code]] [math [number @@ -522,11 +522,12 @@ {try.#Failure _} (exception.except ..cannot_represent_value type))) -(syntax: .public (private [definition <code>.symbol]) - (let [[module _] definition] - (in (list (` ("lux in-module" - (~ (code.text module)) - (~ (code.symbol definition)))))))) +(def: .public private + (syntax (_ [definition <code>.symbol]) + (let [[module _] definition] + (in (list (` ("lux in-module" + (~ (code.text module)) + (~ (code.symbol definition))))))))) (def: .public (log! message) (-> Text Any) @@ -538,11 +539,12 @@ "Location" (%.location location) "Type" (%.type type))) -(syntax: .public (hole []) - (do meta.monad - [location meta.location - expectedT meta.expected_type] - (function.constant (exception.except ..type_hole [location expectedT])))) +(def: .public hole + (syntax (_ []) + (do meta.monad + [location meta.location + expectedT meta.expected_type] + (function.constant (exception.except ..type_hole [location expectedT]))))) (type: Target [Text (Maybe Code)]) @@ -558,44 +560,45 @@ (exception.report "Name" (%.text name))) -(syntax: .public (here [targets (is (<code>.Parser (List Target)) - (|> ..target - <>.some - (<>.else (list))))]) - (do [! meta.monad] - [location meta.location - locals meta.locals - .let [environment (|> locals - list.together - ... The list is reversed to make sure that, when building the dictionary, - ... later bindings overshadow earlier ones if they have the same name. - list.reversed - (dictionary.of_list text.hash))] - targets (is (Meta (List Target)) - (case targets - {.#End} - (|> environment - dictionary.keys - (list#each (function (_ local) [local {.#None}])) - in) - - _ - (monad.each ! (function (_ [name format]) - (if (dictionary.key? environment name) - (in [name format]) - (function.constant (exception.except ..unknown_local_binding [name])))) - targets)))] - (in (list (` (..log! ("lux text concat" - (~ (code.text (%.format (%.location location) text.new_line))) - ((~! exception.report) - (~+ (|> targets - (list#each (function (_ [name format]) - (let [format (case format - {.#None} - (` (~! ..inspection)) - - {.#Some format} - format)] - (list (code.text name) - (` ((~ format) (~ (code.local name)))))))) - list#conjoint)))))))))) +(def: .public here + (syntax (_ [targets (is (<code>.Parser (List Target)) + (|> ..target + <>.some + (<>.else (list))))]) + (do [! meta.monad] + [location meta.location + locals meta.locals + .let [environment (|> locals + list.together + ... The list is reversed to make sure that, when building the dictionary, + ... later bindings overshadow earlier ones if they have the same name. + list.reversed + (dictionary.of_list text.hash))] + targets (is (Meta (List Target)) + (case targets + {.#End} + (|> environment + dictionary.keys + (list#each (function (_ local) [local {.#None}])) + in) + + _ + (monad.each ! (function (_ [name format]) + (if (dictionary.key? environment name) + (in [name format]) + (function.constant (exception.except ..unknown_local_binding [name])))) + targets)))] + (in (list (` (..log! ("lux text concat" + (~ (code.text (%.format (%.location location) text.new_line))) + ((~! exception.report) + (~+ (|> targets + (list#each (function (_ [name format]) + (let [format (case format + {.#None} + (` (~! ..inspection)) + + {.#Some format} + format)] + (list (code.text name) + (` ((~ format) (~ (code.local name)))))))) + list#conjoint))))))))))) |