aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/debug.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/debug.lux72
1 files changed, 36 insertions, 36 deletions
diff --git a/stdlib/source/lux/debug.lux b/stdlib/source/lux/debug.lux
index 847cc9225..c537148c8 100644
--- a/stdlib/source/lux/debug.lux
+++ b/stdlib/source/lux/debug.lux
@@ -31,7 +31,7 @@
["." syntax (#+ syntax:)]
["." code]]])
-(with-expansions [<jvm> (as-is (import: java/lang/String)
+(with_expansions [<jvm> (as_is (import: java/lang/String)
(import: (java/lang/Class a)
["#::."
@@ -57,30 +57,30 @@
(longValue [] long)
(doubleValue [] double)]))]
(for {@.old
- (as-is <jvm>)
+ (as_is <jvm>)
@.jvm
- (as-is <jvm>)
+ (as_is <jvm>)
@.js
- (as-is (import: JSON
+ (as_is (import: JSON
(#static stringify [.Any] host.String))
(import: Array
(#static isArray [.Any] host.Boolean)))}))
(def: Inspector (-> Any Text))
-(def: (inspect-tuple inspect)
+(def: (inspect_tuple inspect)
(-> Inspector Inspector)
(|>> (:coerce (array.Array Any))
- array.to-list
+ array.to_list
(list\map inspect)
- (text.join-with " ")
+ (text.join_with " ")
(text.enclose ["[" "]"])))
(def: #export (inspect value)
Inspector
- (with-expansions [<jvm> (let [object (:coerce java/lang/Object value)]
+ (with_expansions [<jvm> (let [object (:coerce java/lang/Object value)]
(`` (<| (~~ (template [<class> <processing>]
[(case (host.check <class> object)
(#.Some value)
@@ -112,7 +112,7 @@
(text.enclose ["(" ")"])))
_
- (inspect-tuple inspect value)))
+ (inspect_tuple inspect value)))
#.None)
(java/lang/Object::toString object))))]
(for {@.old
@@ -122,9 +122,9 @@
<jvm>
@.js
- (case (host.type-of value)
- (^template [<type-of> <then>]
- [<type-of>
+ (case (host.type_of value)
+ (^template [<type_of> <then>]
+ [<type_of>
(`` (|> value (~~ (template.splice <then>))))])
(["boolean" [(:coerce .Bit) %.bit]]
["string" [(:coerce .Text) %.text]]
@@ -132,15 +132,15 @@
["undefined" [JSON::stringify]])
"object"
- (let [variant-tag ("js object get" "_lux_tag" value)
- variant-flag ("js object get" "_lux_flag" value)
- variant-value ("js object get" "_lux_value" value)]
- (cond (not (or ("js object undefined?" variant-tag)
- ("js object undefined?" variant-flag)
- ("js object undefined?" variant-value)))
- (|> (format (JSON::stringify variant-tag)
- " " (%.bit (not ("js object null?" variant-flag)))
- " " (inspect variant-value))
+ (let [variant_tag ("js object get" "_lux_tag" value)
+ variant_flag ("js object get" "_lux_flag" value)
+ variant_value ("js object get" "_lux_value" value)]
+ (cond (not (or ("js object undefined?" variant_tag)
+ ("js object undefined?" variant_flag)
+ ("js object undefined?" variant_value)))
+ (|> (format (JSON::stringify variant_tag)
+ " " (%.bit (not ("js object null?" variant_flag)))
+ " " (inspect variant_value))
(text.enclose ["(" ")"]))
(not (or ("js object undefined?" ("js object get" "_lux_low" value))
@@ -148,7 +148,7 @@
(|> value (:coerce .Int) %.int)
(Array::isArray value)
- (inspect-tuple inspect value)
+ (inspect_tuple inspect value)
## else
(JSON::stringify value)))
@@ -157,13 +157,13 @@
(undefined))
})))
-(exception: #export (cannot-represent-value {type Type})
+(exception: #export (cannot_represent_value {type Type})
(exception.report
["Type" (%.type type)]))
(type: Representation (-> Any Text))
-(def: primitive-representation
+(def: primitive_representation
(Parser Representation)
(`` ($_ <>.either
(do <>.monad
@@ -182,7 +182,7 @@
[Frac %.frac]
[Text %.text])))))
-(def: (special-representation representation)
+(def: (special_representation representation)
(-> (Parser Representation) (Parser Representation))
(`` ($_ <>.either
(~~ (template [<type> <formatter>]
@@ -213,12 +213,12 @@
(#.Some elemV)
(format "(#.Some " (elemR elemV) ")"))))))))
-(def: (variant-representation representation)
+(def: (variant_representation representation)
(-> (Parser Representation) (Parser Representation))
(do <>.monad
[membersR+ (<type>.variant (<>.many representation))]
(wrap (function (_ variantV)
- (let [[lefts right? sub-repr] (loop [lefts 0
+ (let [[lefts right? sub_repr] (loop [lefts 0
representations membersR+
variantV variantV]
(case representations
@@ -237,14 +237,14 @@
_
(undefined)))]
- (format "(" (%.nat lefts) " " (%.bit right?) " " sub-repr ")"))))))
+ (format "(" (%.nat lefts) " " (%.bit right?) " " sub_repr ")"))))))
-(def: (tuple-representation representation)
+(def: (tuple_representation representation)
(-> (Parser Representation) (Parser Representation))
(do <>.monad
[membersR+ (<type>.tuple (<>.many representation))]
(wrap (function (_ tupleV)
- (let [tuple-body (loop [representations membersR+
+ (let [tuple_body (loop [representations membersR+
tupleV tupleV]
(case representations
#.Nil
@@ -256,17 +256,17 @@
(#.Cons headR tailR)
(let [[leftV rightV] (:coerce [Any Any] tupleV)]
(format (headR leftV) " " (recur tailR rightV)))))]
- (format "[" tuple-body "]"))))))
+ (format "[" tuple_body "]"))))))
(def: representation
(Parser Representation)
(<>.rec
(function (_ representation)
($_ <>.either
- primitive-representation
- (special-representation representation)
- (variant-representation representation)
- (tuple-representation representation)
+ primitive_representation
+ (special_representation representation)
+ (variant_representation representation)
+ (tuple_representation representation)
(do <>.monad
[[funcT inputsT+] (<type>.apply (<>.and <type>.any (<>.many <type>.any)))]
@@ -291,7 +291,7 @@
(#try.Success (representation value))
(#try.Failure _)
- (exception.throw ..cannot-represent-value type)))
+ (exception.throw ..cannot_represent_value type)))
(syntax: #export (private {definition <code>.identifier})
(let [[module _] definition]