diff options
Diffstat (limited to 'stdlib/source/library/lux/debug.lux')
-rw-r--r-- | stdlib/source/library/lux/debug.lux | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index d4665f058..987a25120 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -136,7 +136,7 @@ (-> Inspector Inspector) (with_expansions [<adaption> (for @.lua (~~ (as_is ..tuple_array)) (~~ (as_is)))] - (`` (|>> (:as (array.Array Any)) + (`` (|>> (as (array.Array Any)) <adaption> (array.list {.#None}) (list#each inspection) @@ -145,7 +145,7 @@ (def: .public (inspection value) Inspector - (with_expansions [<jvm> (let [object (:as java/lang/Object value)] + (with_expansions [<jvm> (let [object (as java/lang/Object value)] (`` (<| (~~ (template [<class> <processing>] [(case (ffi.check <class> object) {.#Some value} @@ -160,7 +160,7 @@ )) (case (ffi.check [java/lang/Object] object) {.#Some value} - (let [value (:as (array.Array java/lang/Object) value)] + (let [value (as (array.Array java/lang/Object) value)] (case (array.read! 0 value) (^.multi {.#Some tag} [(ffi.check java/lang/Integer tag) @@ -187,9 +187,9 @@ (^.template [<type_of> <then>] [<type_of> (`` (|> value (~~ (template.spliced <then>))))]) - (["boolean" [(:as .Bit) %.bit]] - ["number" [(:as .Frac) %.frac]] - ["string" [(:as .Text) %.text]] + (["boolean" [(as .Bit) %.bit]] + ["number" [(as .Frac) %.frac]] + ["string" [(as .Text) %.text]] ["undefined" [JSON::stringify]]) "object" @@ -206,7 +206,7 @@ (not (or ("js object undefined?" ("js object get" "_lux_low" value)) ("js object undefined?" ("js object get" "_lux_high" value)))) - (|> value (:as .Int) %.int) + (|> value (as .Int) %.int) (Array::isArray value) (tuple_inspection inspection value) @@ -222,17 +222,17 @@ (^.template [<type_of> <class_of> <then>] [(^.or <type_of> <class_of>) (`` (|> value (~~ (template.spliced <then>))))]) - (["<type 'bool'>" "<class 'bool'>" [(:as .Bit) %.bit]] - ["<type 'int'>" "<class 'int'>" [(:as .Int) %.int]] - ["<type 'float'>" "<class 'float'>" [(:as .Frac) %.frac]] - ["<type 'str'>" "<class 'str'>" [(:as .Text) %.text]] - ["<type 'unicode'>" "<class 'unicode'>" [(:as .Text) %.text]]) + (["<type 'bool'>" "<class 'bool'>" [(as .Bit) %.bit]] + ["<type 'int'>" "<class 'int'>" [(as .Int) %.int]] + ["<type 'float'>" "<class 'float'>" [(as .Frac) %.frac]] + ["<type 'str'>" "<class 'str'>" [(as .Text) %.text]] + ["<type 'unicode'>" "<class 'unicode'>" [(as .Text) %.text]]) (^.or "<type 'list'>" "<class 'list'>") (tuple_inspection inspection value) (^.or "<type 'tuple'>" "<class 'tuple'>") - (let [variant (:as (array.Array Any) value)] + (let [variant (as (array.Array Any) value)] (case (array.size variant) 3 (let [variant_tag ("python array read" 0 variant) variant_flag ("python array read" 1 variant) @@ -240,7 +240,7 @@ (if (or ("python object none?" variant_tag) ("python object none?" variant_value)) (..str value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (|> variant_flag "python object none?" not %.bit) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -254,14 +254,14 @@ (^.template [<type_of> <then>] [<type_of> (`` (|> value (~~ (template.spliced <then>))))]) - (["boolean" [(:as .Bit) %.bit]] - ["string" [(:as .Text) %.text]] + (["boolean" [(as .Bit) %.bit]] + ["string" [(as .Text) %.text]] ["nil" [(pipe.new "nil" [])]]) "number" (case (math::type value) - {.#Some "integer"} (|> value (:as .Int) %.int) - {.#Some "float"} (|> value (:as .Frac) %.frac) + {.#Some "integer"} (|> value (as .Int) %.int) + {.#Some "float"} (|> value (as .Frac) %.frac) _ (..tostring value)) @@ -273,7 +273,7 @@ (if (or ("lua object nil?" variant_tag) ("lua object nil?" variant_value)) (tuple_inspection inspection value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("lua object nil?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -284,17 +284,17 @@ @.ruby (template.let [(class_of <literal>) [(|> <literal> - (:as ..Object) + (as ..Object) Object::class)] (to_s <object>) [(|> <object> - (:as ..Object) + (as ..Object) Object::to_s)]] (let [value_class (class_of value)] (`` (cond (~~ (template [<literal> <type> <format>] [(same? (class_of <literal>) value_class) - (|> value (:as <type>) <format>)] + (|> value (as <type>) <format>)] [#0 Bit %.bit] [#1 Bit %.bit] @@ -311,7 +311,7 @@ (if (or ("ruby object nil?" variant_tag) ("ruby object nil?" variant_value)) (tuple_inspection inspection value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("ruby object nil?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -327,10 +327,10 @@ (^.template [<type_of> <then>] [<type_of> (`` (|> value (~~ (template.spliced <then>))))]) - (["boolean" [(:as .Bit) %.bit]] - ["integer" [(:as .Int) %.int]] - ["double" [(:as .Frac) %.frac]] - ["string" [(:as .Text) %.text]] + (["boolean" [(as .Bit) %.bit]] + ["integer" [(as .Int) %.int]] + ["double" [(as .Frac) %.frac]] + ["string" [(as .Text) %.text]] ["NULL" [(pipe.new "null" [])]] ["array" [(tuple_inspection inspection)]]) @@ -341,7 +341,7 @@ (if (or ("php object null?" variant_tag) ("php object null?" variant_value)) (..strval value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("php object null?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -354,10 +354,10 @@ [(<when> value) (`` (|> value (~~ (template.spliced <then>))))] - [..boolean? [(:as .Bit) %.bit]] - [..integer? [(:as .Int) %.int]] - [..real? [(:as .Frac) %.frac]] - [..string? [(:as .Text) %.text]] + [..boolean? [(as .Bit) %.bit]] + [..integer? [(as .Int) %.int]] + [..real? [(as .Frac) %.frac]] + [..string? [(as .Text) %.text]] ["scheme object nil?" [(pipe.new "()" [])]] [..vector? [(tuple_inspection inspection)]])) @@ -365,11 +365,11 @@ (let [variant_tag (..car value) variant_rest (..cdr value)] (if (and (..integer? variant_tag) - (i.> +0 (:as Int variant_tag)) + (i.> +0 (as Int variant_tag)) (..pair? variant_rest)) (let [variant_flag (..car variant_rest) variant_value (..cdr variant_rest)] - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("scheme object nil?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"]))) @@ -397,7 +397,7 @@ (~~ (template [<type> <formatter>] [(do <>.monad [_ (<type>.sub <type>)] - (in (|>> (:as <type>) <formatter>)))] + (in (|>> (as <type>) <formatter>)))] [Bit %.bit] [Nat %.nat] @@ -413,7 +413,7 @@ (~~ (template [<type> <formatter>] [(do <>.monad [_ (<type>.sub <type>)] - (in (|>> (:as <type>) <formatter>)))] + (in (|>> (as <type>) <formatter>)))] [Ratio %.ratio] [Symbol %.symbol] @@ -434,12 +434,12 @@ (do <>.monad [[_ elemT] (<type>.applied (<>.and (<type>.exactly List) <type>.any)) elemR (<type>.local (list elemT) representation)] - (in (|>> (:as (List Any)) (%.list elemR)))) + (in (|>> (as (List Any)) (%.list elemR)))) (do <>.monad [[_ elemT] (<type>.applied (<>.and (<type>.exactly Maybe) <type>.any)) elemR (<type>.local (list elemT) representation)] - (in (|>> (:as (Maybe Any)) + (in (|>> (as (Maybe Any)) (%.maybe elemR))))))) (def: (variant_representation representation) @@ -452,7 +452,7 @@ variantV variantV] (case representations {.#Item leftR {.#Item rightR extraR+}} - (case (:as (Or Any Any) variantV) + (case (as (Or Any Any) variantV) {.#Left left} [lefts #0 (leftR left)] @@ -483,7 +483,7 @@ (lastR tupleV) {.#Item headR tailR} - (let [[leftV rightV] (:as [Any Any] tupleV)] + (let [[leftV rightV] (as [Any Any] tupleV)] (%.format (headR leftV) " " (again tailR rightV)))))] (%.format "[" tuple_body "]")))))) @@ -538,7 +538,7 @@ "Location" (%.location location) "Type" (%.type type))) -(syntax: .public (:hole []) +(syntax: .public (hole []) (do meta.monad [location meta.location expectedT meta.expected_type] @@ -558,10 +558,10 @@ (exception.report "Name" (%.text name))) -(syntax: .public (here [targets (: (<code>.Parser (List Target)) - (|> ..target - <>.some - (<>.else (list))))]) +(syntax: .public (here [targets (is (<code>.Parser (List Target)) + (|> ..target + <>.some + (<>.else (list))))]) (do [! meta.monad] [location meta.location locals meta.locals @@ -571,20 +571,20 @@ ... later bindings overshadow earlier ones if they have the same name. list.reversed (dictionary.of_list text.hash))] - targets (: (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)))] + 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) |