aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/type/implicit.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/type/implicit.lux')
-rw-r--r--stdlib/source/test/lux/type/implicit.lux40
1 files changed, 40 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/type/implicit.lux b/stdlib/source/test/lux/type/implicit.lux
new file mode 100644
index 000000000..98b647bf1
--- /dev/null
+++ b/stdlib/source/test/lux/type/implicit.lux
@@ -0,0 +1,40 @@
+(.module:
+ [lux #*
+ [io]
+ [control
+ [equivalence]
+ [functor]
+ [monad (#+ Monad do)]]
+ [data
+ [bit ("bit/." equivalence)]
+ [number]
+ [collection [list]]]
+ [math
+ ["r" random]]
+ [type implicit]]
+ lux/test)
+
+(context: "Automatic structure selection"
+ (<| (times 100)
+ (do @
+ [x r.nat
+ y r.nat]
+ ($_ seq
+ (test "Can automatically select first-order structures."
+ (let [(^open "list/.") (list.equivalence number.equivalence)]
+ (and (bit/= (:: number.equivalence = x y)
+ (::: = x y))
+ (list/= (list.n/range 1 10)
+ (::: map inc (list.n/range 0 9)))
+ )))
+
+ (test "Can automatically select second-order structures."
+ (::: =
+ (list.n/range 1 10)
+ (list.n/range 1 10)))
+
+ (test "Can automatically select third-order structures."
+ (let [lln (::: map (list.n/range 1)
+ (list.n/range 1 10))]
+ (::: = lln lln)))
+ ))))