aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2017-11-13 21:13:00 -0400
committerEduardo Julian2017-11-13 21:13:00 -0400
commitb08f7d83a591be770af64b4c9ccd59f3306689e8 (patch)
tree443c68c07a4b45a5d978347c2747922722242ec4 /stdlib/source
parent2a3946e713821880ecc47580e754315349f2fe73 (diff)
- Improved handling of type variables.
Diffstat (limited to 'stdlib/source')
-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>))