aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/type/poly.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/meta/type/poly.lux48
1 files changed, 48 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/meta/type/poly.lux b/stdlib/source/test/lux/meta/type/poly.lux
new file mode 100644
index 000000000..e2aa7d03e
--- /dev/null
+++ b/stdlib/source/test/lux/meta/type/poly.lux
@@ -0,0 +1,48 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [control
+ ["?" parser]]
+ [data
+ ["[0]" bit (.use "[1]#[0]" equivalence)]]
+ [math
+ ["[0]" random]
+ [number
+ ["[0]" nat (.use "[1]#[0]" equivalence)]]]
+ [meta
+ ["[0]" static]
+ ["[0]" type
+ ["?[1]" \\parser]]]
+ [test
+ ["_" property (.only Test)]]]]
+ [\\library
+ ["[0]" /]])
+
+(with_expansions [<bit> (static.random_bit)
+ <nat> (static.random_nat)]
+ (def constant
+ (/.polytypic constant
+ (`` (all ?.either
+ (,, (with_template [<type> <constant>]
+ [(do ?.monad
+ [_ (?type.sub <type>)]
+ (in (` (is <type>
+ <constant>))))]
+
+ [Bit <bit>]
+ [Nat <nat>]))
+ ))))
+
+ (def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [])
+ (all _.and
+ (_.coverage [/.polytypic]
+ (and (bit#= <bit> (constant Bit))
+ (nat#= <nat> (constant Nat))))
+ )))
+ )