aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/meta/type/check.lux31
1 files changed, 21 insertions, 10 deletions
diff --git a/stdlib/source/lux/meta/type/check.lux b/stdlib/source/lux/meta/type/check.lux
index bd49a5588..d6589760e 100644
--- a/stdlib/source/lux/meta/type/check.lux
+++ b/stdlib/source/lux/meta/type/check.lux
@@ -144,16 +144,6 @@
(function [context]
(ex;throw exception message)))
-(def: (apply-type! funcT argT)
- (-> Type Type (Check Type))
- (function [context]
- (case (type;apply (list argT) funcT)
- #;None
- (ex;throw Invalid-Type-Application (type;to-text (#;Apply argT funcT)))
-
- (#;Some output)
- (#e;Success [context output]))))
-
(def: #export existential
{#;doc "A producer of existential types."}
(Check [Nat Type])
@@ -296,6 +286,27 @@
(#e;Success [(set@ #;var-bindings value context)
[]])))
+(def: (apply-type! funcT argT)
+ (-> Type Type (Check Type))
+ (case funcT
+ (#;Var func-id)
+ (do Monad<Check>
+ [? (concrete? func-id)]
+ (if ?
+ (do @
+ [funcT' (read func-id)]
+ (apply-type! funcT' argT))
+ (throw Invalid-Type-Application (type;to-text (#;Apply argT funcT)))))
+
+ _
+ (function [context]
+ (case (type;apply (list argT) funcT)
+ #;None
+ (ex;throw Invalid-Type-Application (type;to-text (#;Apply argT funcT)))
+
+ (#;Some output)
+ (#e;Success [context output])))))
+
(type: #export Ring (Set Var))
(def: empty-ring Ring (set;new number;Hash<Nat>))