aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib/source/lux/type/auto.lux16
-rw-r--r--stdlib/test/test/lux/type/auto.lux14
2 files changed, 19 insertions, 11 deletions
diff --git a/stdlib/source/lux/type/auto.lux b/stdlib/source/lux/type/auto.lux
index 31439af3d..aa7074d4a 100644
--- a/stdlib/source/lux/type/auto.lux
+++ b/stdlib/source/lux/type/auto.lux
@@ -235,10 +235,10 @@
(list l r))
(syntax: #export (::: [member s;symbol]
- [args (s;alt (s;some s;symbol)
- (s;some s;any))])
+ [args (s;alt (s;seq (s;some s;symbol) s;end)
+ (s;seq (s;some s;any) s;end))])
(case args
- (#;Left args)
+ (#;Left [args _])
(do @
[[member-idx sig-type] (resolve-member member)
input-types (mapM @ resolve-type args)
@@ -260,11 +260,11 @@
(text;join-with ", ")
)))))
- (#;Right args)
+ (#;Right [args _])
(do @
- [#let [args-to-bind (list;filter (bool;complement var?) args)]
- labels (seqM @ (list;repeat (list;size args-to-bind)
+ [labels (seqM @ (list;repeat (list;size args)
(compiler;gensym "")))
- #let [retry (` (let [(~@ (|> (list;zip2 labels args-to-bind) (List/map join-pair) List/join))]
+ #let [retry (` (let [(~@ (|> (list;zip2 labels args) (List/map join-pair) List/join))]
(;;::: (~ (ast;symbol member)) (~@ labels))))]]
- (wrap (list retry)))))
+ (wrap (list retry)))
+ ))
diff --git a/stdlib/test/test/lux/type/auto.lux b/stdlib/test/test/lux/type/auto.lux
index eb25a2371..cb58514bf 100644
--- a/stdlib/test/test/lux/type/auto.lux
+++ b/stdlib/test/test/lux/type/auto.lux
@@ -7,6 +7,7 @@
lux
(lux (codata [io])
(control monad
+ functor
[eq])
(data [text "Text/" Monoid<Text>]
text/format
@@ -23,6 +24,13 @@
(test: "Automatic structure selection"
[x R;nat
y R;nat]
- (assert "Can automatically select first-order structures."
- (B/= (:: number;Eq<Nat> = x y)
- (::: = x y))))
+ ($_ seq
+ (assert "Can automatically select first-order structures."
+ (let [(^open "L/") (list;Eq<List> number;Eq<Nat>)]
+ (and (B/= (:: number;Eq<Nat> = x y)
+ (::: = x y))
+ (L/= (list;n.range +1 +10)
+ (::: map n.inc (list;n.range +0 +9)))
+ )))
+
+ ))