aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/format/json.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-02-03 11:53:21 -0400
committerEduardo Julian2019-02-03 11:53:21 -0400
commitcf9e3fa6fef24cc0828ab882661fa96dc6f2570d (patch)
tree082f91e8c84a72ace38a35b30a4acb61b8d27ab6 /stdlib/source/lux/data/format/json.lux
parent700f82c940794684cbce9535274f6d7ea3f9c692 (diff)
Some refactoring around the identity function.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/format/json.lux17
1 files changed, 8 insertions, 9 deletions
diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux
index 7d2e90270..edafe3178 100644
--- a/stdlib/source/lux/data/format/json.lux
+++ b/stdlib/source/lux/data/format/json.lux
@@ -296,7 +296,7 @@
[string Text #String "string"]
)
-(do-template [<test> <check> <type> <eq> <encoder> <tag> <desc> <pre>]
+(do-template [<test> <check> <type> <eq> <encoder> <tag> <desc>]
[(def: #export (<test> test)
{#.doc (code.text ($_ text/compose "Asks whether a JSON value is a " <desc> "."))}
(-> <type> (Reader Bit))
@@ -304,7 +304,7 @@
[head any]
(case head
(<tag> value)
- (wrap (:: <eq> = test (<pre> value)))
+ (wrap (:: <eq> = test value))
_
(fail ($_ text/compose "JSON value is not " <desc> ".")))))
@@ -316,17 +316,16 @@
[head any]
(case head
(<tag> value)
- (let [value (<pre> value)]
- (if (:: <eq> = test value)
- (wrap [])
- (fail ($_ text/compose "Value mismatch: " (<encoder> test) " =/= " (<encoder> value)))))
+ (if (:: <eq> = test value)
+ (wrap [])
+ (fail ($_ text/compose "Value mismatch: " (<encoder> test) " =/= " (<encoder> value))))
_
(fail ($_ text/compose "JSON value is not a " <desc> ".")))))]
- [boolean? boolean! Bit bit.Equivalence<Bit> encode-boolean #Boolean "boolean" id]
- [number? number! Frac number.Equivalence<Frac> (:: number.Codec<Text,Frac> encode) #Number "number" id]
- [string? string! Text text.Equivalence<Text> text.encode #String "string" id]
+ [boolean? boolean! Bit bit.Equivalence<Bit> encode-boolean #Boolean "boolean"]
+ [number? number! Frac number.Equivalence<Frac> (:: number.Codec<Text,Frac> encode) #Number "number"]
+ [string? string! Text text.Equivalence<Text> text.encode #String "string"]
)
(def: #export (nullable parser)