aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/poly.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/macro/poly.lux')
-rw-r--r--stdlib/source/lux/macro/poly.lux29
1 files changed, 10 insertions, 19 deletions
diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux
index b9336139b..f3537d6f0 100644
--- a/stdlib/source/lux/macro/poly.lux
+++ b/stdlib/source/lux/macro/poly.lux
@@ -20,7 +20,7 @@
(syntax ["cs" common]
(common ["csr" reader]
["csw" writer])))
- (lang [type]
+ (lang [type "type/" Eq<Type>]
(type [check]))
))
@@ -117,7 +117,7 @@
(do-template [<combinator> <name> <type>]
[(def: #export <combinator>
- (Poly Unit)
+ (Poly Top)
(do p.Monad<Parser>
[headT any]
(case (type.un-name headT)
@@ -127,8 +127,6 @@
_
(p.fail ($_ text/compose "Not " <name> " type: " (type.to-text headT))))))]
- [void "Void" #.Void]
- [unit "Unit" #.Unit]
[bool "Bool" (#.Primitive "#Bool" #.Nil)]
[nat "Nat" (#.Primitive "#Nat" #.Nil)]
[int "Int" (#.Primitive "#Int" #.Nil)]
@@ -142,8 +140,6 @@
(do p.Monad<Parser>
[headT any]
(case (run headT ($_ p.either
- void
- unit
bool
nat
int
@@ -206,7 +202,7 @@
list.reverse))))]
(recur (n/inc current-arg)
(|> env'
- (dict.put partialI [.Void partialC])
+ (dict.put partialI [.Bottom partialC])
(dict.put partial-varI [(#.Bound partial-varI) partial-varL]))
(#.Cons partial-varL all-varsL))))
[all-varsL env']))]]
@@ -236,10 +232,10 @@
(local (#.Cons funcT paramsT) poly))))
(def: #export (this expected)
- (-> Type (Poly Unit))
+ (-> Type (Poly Top))
(do p.Monad<Parser>
[actual any]
- (if (check.checks? expected actual)
+ (if (type/= expected actual)
(wrap [])
(p.fail ($_ text/compose
"Types do not match." "\n"
@@ -271,7 +267,7 @@
(p.fail ($_ text/compose "Not a bound type: " (type.to-text headT))))))
(def: #export (var id)
- (-> Nat (Poly Unit))
+ (-> Nat (Poly Top))
(do p.Monad<Parser>
[env ..env
headT any]
@@ -316,10 +312,10 @@
(do p.Monad<Parser>
[headT any]
(case (type.un-name headT)
- (#.Apply #.Void (#.UnivQ _ headT'))
+ (#.Apply (#.Named ["lux" "Bottom"] _) (#.UnivQ _ headT'))
(do @
[[recT _ output] (|> poly
- (with-extension #.Void)
+ (with-extension .Bottom)
(with-extension headT)
(local (list headT')))]
(wrap [recT output]))
@@ -333,7 +329,7 @@
[env ..env
headT any]
(case (type.un-name headT)
- (^multi (#.Apply #.Void (#.Bound funcT-idx))
+ (^multi (#.Apply (#.Named ["lux" "Bottom"] _) (#.Bound funcT-idx))
(n/= +0 (adjusted-idx env funcT-idx))
[(dict.get +0 env) (#.Some [self-type self-call])])
(wrap self-call)
@@ -430,11 +426,6 @@
(list (~+ (list/map (to-code env) params)))))
(^template [<tag>]
- <tag>
- (` <tag>))
- ([#.Void] [#.Unit])
-
- (^template [<tag>]
(<tag> idx)
(` (<tag> (~ (code.nat idx)))))
([#.Var] [#.Ex])
@@ -445,7 +436,7 @@
(|> (dict.get idx env) maybe.assume product.left (to-code env))
(` (.$ (~ (code.nat (n/dec idx)))))))
- (#.Apply #.Void (#.Bound idx))
+ (#.Apply (#.Named ["lux" "Bottom"] _) (#.Bound idx))
(let [idx (adjusted-idx env idx)]
(if (n/= +0 idx)
(|> (dict.get idx env) maybe.assume product.left (to-code env))