diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/test/test/lux/data/format/json.lux | 22 | ||||
-rw-r--r-- | stdlib/test/test/lux/macro/poly/eq.lux | 2 |
2 files changed, 19 insertions, 5 deletions
diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index fc533e4c1..eba3b4cf9 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -7,7 +7,7 @@ pipe) (data [text "Text/" Monoid<Text>] text/format - [result] + ["R" result] [bool] [maybe] [number "i/" Number<Int>] @@ -18,7 +18,8 @@ [macro #+ with-gensyms] (macro [code] [syntax #+ syntax:] - [poly #+ derived:]) + [poly #+ derived:] + [poly/eq]) ["r" math/random] test) ) @@ -59,6 +60,10 @@ (#Case1 Int) (#Case2 Real)) +(type: #rec Recursive + (#Number Real) + (#Addition Real Recursive)) + (type: Record {#unit Unit #bool Bool @@ -69,7 +74,16 @@ #list (List Int) #variant Variant #tuple [Int Real Text] - #dict (d;Dict Text Int)}) + #dict (d;Dict Text Int) + #recursive Recursive}) + +(def: gen-recursive + (r;Random Recursive) + (r;rec (function [gen-recursive] + (r;alt r;real + (r;seq r;real gen-recursive))))) + +(derived: (poly/eq;Eq<?> Recursive)) (def: gen-record (r;Random Record) @@ -87,6 +101,7 @@ ($_ r;alt r;bool gen-int r;real) ($_ r;seq gen-int r;real (r;text size)) (r;dict text;Hash<Text> size (r;text size) gen-int) + gen-recursive ))) (derived: (&;Codec<JSON,?> Record)) @@ -119,6 +134,7 @@ (r.= tL1 tR1) (:: text;Eq<Text> = tL2 tR2))) (:: (d;Eq<Dict> i.=) = (get@ #dict recL) (get@ #dict recR)) + (:: Eq<Recursive> = (get@ #recursive recL) (get@ #recursive recR)) )))) (context: "Polytypism" diff --git a/stdlib/test/test/lux/macro/poly/eq.lux b/stdlib/test/test/lux/macro/poly/eq.lux index 9bd6fc5e6..8bd102823 100644 --- a/stdlib/test/test/lux/macro/poly/eq.lux +++ b/stdlib/test/test/lux/macro/poly/eq.lux @@ -41,8 +41,6 @@ (r;alt r;real (r;seq r;real gen-recursive))))) -(derived: (&;Eq<?> Recursive)) - (def: gen-record (r;Random Record) (do r;Monad<Random> |