aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/lux/control/thread.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/meta/archive.lux2
-rw-r--r--stdlib/source/lux/type.lux9
-rw-r--r--stdlib/source/test/lux/type.lux10
4 files changed, 21 insertions, 2 deletions
diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux
index b83acabc9..c4625d6f5 100644
--- a/stdlib/source/lux/control/thread.lux
+++ b/stdlib/source/lux/control/thread.lux
@@ -7,7 +7,7 @@
[data
[collection
["." array (#+ Array)]]]
- [type (#+ :share)
+ [type
abstract]
[tool
[compiler
diff --git a/stdlib/source/lux/tool/compiler/meta/archive.lux b/stdlib/source/lux/tool/compiler/meta/archive.lux
index e34edf0d4..eb9761ab9 100644
--- a/stdlib/source/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/lux/tool/compiler/meta/archive.lux
@@ -11,7 +11,7 @@
format]
[collection
["." dictionary (#+ Dictionary)]]]
- [type (#+ :share)
+ [type
abstract]
[world
[file (#+ File)]]]
diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux
index 8d0dcad7d..a760180c5 100644
--- a/stdlib/source/lux/type.lux
+++ b/stdlib/source/lux/type.lux
@@ -390,3 +390,12 @@
## TODO: this should use : instead of :assume
(:assume (~ (get@ #expression computation))))))]
(wrap (list (` ((~ shareC) (~ (get@ #expression exemplar)))))))))
+
+(syntax: #export (:extract {type-vars type-parameters}
+ {exemplar typed}
+ {extraction s.any})
+ (wrap (list (` (:of (:share [(~+ (list/map code.local-identifier type-vars))]
+ {(~ (get@ #type exemplar))
+ (~ (get@ #expression exemplar))}
+ {(~ extraction)
+ (:assume [])}))))))
diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux
index b4796911a..c7daced97 100644
--- a/stdlib/source/test/lux/type.lux
+++ b/stdlib/source/test/lux/type.lux
@@ -166,3 +166,13 @@
($_ seq
<quant-tests>
)))))
+
+(def: extraction
+ Test
+ (_.test "Can extract types."
+ (let [example (: (Maybe Nat)
+ #.Nonae)]
+ (type/= (type (List Nat))
+ (:extract [a]
+ {(Maybe a) example}
+ (List a))))))