aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2019-05-22 00:12:24 -0400
committerEduardo Julian2019-05-22 00:12:24 -0400
commit0bc505930accb00f74724f384ee42c9a4dd32beb (patch)
tree7c7358b2090fe4023af854bc4cdd8987deaf382d
parent7406fbf75e7f81b466c02ed07d65e62c86e3230a (diff)
Removed the useless #lux.type? annotation tag.
-rw-r--r--luxc/src/lux/analyser/lux.clj5
-rw-r--r--luxc/src/lux/analyser/meta.clj1
-rw-r--r--luxc/src/lux/analyser/module.clj29
-rw-r--r--luxc/src/lux/compiler/cache/type.clj2
-rw-r--r--luxc/src/lux/compiler/jvm/lux.clj9
-rw-r--r--stdlib/source/lux.lux239
-rw-r--r--stdlib/source/lux/host.jvm.lux3
-rw-r--r--stdlib/source/lux/host.old.lux3
-rw-r--r--stdlib/source/lux/macro.lux1
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension/statement.lux44
-rw-r--r--stdlib/source/program/scriptum.lux2
11 files changed, 122 insertions, 216 deletions
diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj
index 2a4240aa6..91637033e 100644
--- a/luxc/src/lux/analyser/lux.clj
+++ b/luxc/src/lux/analyser/lux.clj
@@ -268,8 +268,8 @@
(defn ^:private analyse-global [analyse exo-type module name]
(|do [[[r-module r-name] [endo-type ?meta ?value]] (&&module/find-def module name)
;; This is a small shortcut to optimize analysis of typing code.
- _ (if (and (clojure.lang.Util/identical &type/Type endo-type)
- (clojure.lang.Util/identical &type/Type exo-type))
+ _ (if (and (&type/type= &type/Type endo-type)
+ (&type/type= &type/Type exo-type))
(return nil)
(&type/check exo-type endo-type))
_cursor &/cursor]
@@ -553,7 +553,6 @@
(&&/analyse-1+ analyse ?value)))
=meta (&&/analyse-1 analyse &type/Code ?meta)
==meta (eval! (optimize =meta))
- _ (&&module/test-type module-name ?name ==meta (&&/expr-type* =value))
_ (compile-def ?name (optimize =value) ==meta)
_ &type/reset-mappings]
(return &/$Nil)))
diff --git a/luxc/src/lux/analyser/meta.clj b/luxc/src/lux/analyser/meta.clj
index d7a68ecb4..ab0de60a4 100644
--- a/luxc/src/lux/analyser/meta.clj
+++ b/luxc/src/lux/analyser/meta.clj
@@ -40,7 +40,6 @@
(do-template [<name> <tag-name>]
(def <name> (&/T [tag-prefix <tag-name>]))
- type?-tag "type?"
alias-tag "alias"
export?-tag "export?"
tags-tag "tags"
diff --git a/luxc/src/lux/analyser/module.clj b/luxc/src/lux/analyser/module.clj
index b749b64e4..5ac6191fa 100644
--- a/luxc/src/lux/analyser/module.clj
+++ b/luxc/src/lux/analyser/module.clj
@@ -147,8 +147,7 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|let [[?type ?meta ?value] $def]
- (|case (&meta/meta-get &meta/type?-tag ?meta)
- (&/$Some _)
+ (if (&type/type= &type/Type ?type)
(return* state (&/T [(|case (&meta/meta-get &meta/export?-tag ?meta)
(&/$Some _)
true
@@ -156,8 +155,6 @@
_
false)
?value]))
-
- _
((&/fail-with-loc (str "[Analyser Error] Not a type: " (&/ident->text (&/T [module name]))
"\nMETA: " (&/show-ast ?meta)))
state)))
@@ -287,17 +284,6 @@
state))
)))
-(defn ensure-type-def
- "(-> DefData (Lux Type))"
- [def-data]
- (|let [[?type ?meta ?value] def-data]
- (|case (&meta/meta-get &meta/type?-tag ?meta)
- (&/$Some _)
- (return ?type)
-
- _
- (&/fail-with-loc (str "[Analyser Error] Not a type definition: " (&/adt->text def-data))))))
-
(defn defined? [module name]
(&/try-all% (&/|list (|do [_ (find-def! module name)]
(return true))
@@ -434,19 +420,6 @@
(&/T [k "" _def-data])
)))))))))
-(do-template [<name> <type> <tag> <desc>]
- (defn <name> [module name meta type]
- (|case (&meta/meta-get <tag> meta)
- (&/$Some [_ (&/$Bit true)])
- (&/try-all% (&/|list (&type/check <type> type)
- (&/fail-with-loc (str "[Analyser Error] Cannot tag as lux;" <desc> "? if it's not a " <desc> ": " (str module &/+name-separator+ name)))))
-
- _
- (return nil)))
-
- test-type &type/Type &meta/type?-tag "type"
- )
-
(defn fetch-imports [meta]
(|case (&meta/meta-get &meta/imports-tag meta)
(&/$Some [_ (&/$Tuple _parts)])
diff --git a/luxc/src/lux/compiler/cache/type.clj b/luxc/src/lux/compiler/cache/type.clj
index bf5e04ec6..7c622d2c4 100644
--- a/luxc/src/lux/compiler/cache/type.clj
+++ b/luxc/src/lux/compiler/cache/type.clj
@@ -20,7 +20,7 @@
(defn serialize-type
"(-> Type Text)"
[type]
- (if (clojure.lang.Util/identical &type/Type type)
+ (if (&type/type= &type/Type type)
"T"
(|case type
(&/$Primitive name params)
diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj
index 4aebc2bbf..6f3257d37 100644
--- a/luxc/src/lux/compiler/jvm/lux.clj
+++ b/luxc/src/lux/compiler/jvm/lux.clj
@@ -254,12 +254,6 @@
(|do [_ (return nil)
:let [def-class (&&/load-class! class-loader (&host-generics/->class-name current-class))
def-type (&a/expr-type* ?body)
- is-type? (|case (&a-meta/meta-get &a-meta/type?-tag ?meta)
- (&/$Some [_ (&/$Bit true)])
- true
-
- _
- false)
def-meta ?meta]
def-value (try (return (-> def-class (.getField &/value-field) (.get nil)))
(catch Throwable t
@@ -268,7 +262,8 @@
(throwable->text t)))))
_ (&/without-repl-closure
(&a-module/define module-name ?name def-type def-meta def-value))]
- (|case (&/T [is-type? (&a-meta/meta-get &a-meta/tags-tag def-meta)])
+ (|case (&/T [(&type/type= &type/Type def-type)
+ (&a-meta/meta-get &a-meta/tags-tag def-meta)])
[true (&/$Some [_ (&/$Tuple tags*)])]
(|do [:let [was-exported? (|case (&a-meta/meta-get &a-meta/export?-tag def-meta)
(&/$Some _)
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 5022eb2d3..ed223ac3d 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -23,15 +23,13 @@
(10 ["lux" "Any"]
(8 (0) (4 1)))
[dummy-cursor
- (10 (1 [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (1 [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (1 [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (1 [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 ("lux text concat"
- ("lux text concat" "The type of things whose type is irrelevant." __paragraph)
- "It can be used to write functions or data-structures that can take, or return, anything."))]]
- (0)))))])
+ (1 [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 ("lux text concat"
+ ("lux text concat" "The type of things whose type is irrelevant." __paragraph)
+ "It can be used to write functions or data-structures that can take, or return, anything."))]]
+ (0))))])
## (type: Nothing
## (All [a] a))
@@ -39,15 +37,13 @@
(10 ["lux" "Nothing"]
(7 (0) (4 1)))
[dummy-cursor
- (10 (1 [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (1 [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (1 [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (1 [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 ("lux text concat"
- ("lux text concat" "The type of things whose type is undefined." __paragraph)
- "Useful for expressions that cause errors or other 'extraordinary' conditions."))]]
- (0)))))])
+ (1 [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 ("lux text concat"
+ ("lux text concat" "The type of things whose type is undefined." __paragraph)
+ "Useful for expressions that cause errors or other 'extraordinary' conditions."))]]
+ (0))))])
## (type: (List a)
## #Nil
@@ -61,118 +57,100 @@
(2 (4 1)
(9 (4 1) (4 0))))))
[dummy-cursor
- (10 (1 [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (1 [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (1 [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (1 [[dummy-cursor (7 ["lux" "tags"])]
- [dummy-cursor (9 (1 [dummy-cursor (5 "Nil")] (1 [dummy-cursor (5 "Cons")] (0))))]]
- (1 [[dummy-cursor (7 ["lux" "type-args"])]
- [dummy-cursor (9 (1 [dummy-cursor (5 "a")] (0)))]]
- (1 [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "A potentially empty list of values.")]]
- (0)))))))])
+ (1 [[dummy-cursor (7 ["lux" "tags"])]
+ [dummy-cursor (9 (1 [dummy-cursor (5 "Nil")] (1 [dummy-cursor (5 "Cons")] (0))))]]
+ (1 [[dummy-cursor (7 ["lux" "type-args"])]
+ [dummy-cursor (9 (1 [dummy-cursor (5 "a")] (0)))]]
+ (1 [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "A potentially empty list of values.")]]
+ (0))))))])
("lux def" Bit
(10 ["lux" "Bit"]
(0 "#Bit" #Nil))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]]
+ #Nil)))])
("lux def" I64
(10 ["lux" "I64"]
(7 (0)
(0 "#I64" (#Cons (4 1) #Nil))))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "64-bit integers without any semantics.")]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "64-bit integers without any semantics.")]]
+ #Nil)))])
("lux def" Nat
(10 ["lux" "Nat"]
(0 "#I64" (#Cons (0 "#Nat" #Nil) #Nil)))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 ("lux text concat"
- ("lux text concat" "Natural numbers (unsigned integers)." __paragraph)
- "They start at zero (0) and extend in the positive direction."))]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 ("lux text concat"
+ ("lux text concat" "Natural numbers (unsigned integers)." __paragraph)
+ "They start at zero (0) and extend in the positive direction."))]]
+ #Nil)))])
("lux def" Int
(10 ["lux" "Int"]
(0 "#I64" (#Cons (0 "#Int" #Nil) #Nil)))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]]
+ #Nil)))])
("lux def" Rev
(10 ["lux" "Rev"]
(0 "#I64" (#Cons (0 "#Rev" #Nil) #Nil)))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 ("lux text concat"
- ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph)
- "Useful for probability, and other domains that work within that interval."))]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 ("lux text concat"
+ ("lux text concat" "Fractional numbers that live in the interval [0,1)." __paragraph)
+ "Useful for probability, and other domains that work within that interval."))]]
+ #Nil)))])
("lux def" Frac
(10 ["lux" "Frac"]
(0 "#Frac" #Nil))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]]
+ #Nil)))])
("lux def" Text
(10 ["lux" "Text"]
(0 "#Text" #Nil))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]]
+ #Nil)))])
("lux def" Name
(10 ["lux" "Name"]
(2 Text Text))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]]
- #Nil))))])
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "A name. It is used as part of Lux syntax to represent identifiers and tags.")]]
+ #Nil)))])
## (type: (Maybe a)
## #None
@@ -185,17 +163,15 @@
## "lux.Some"
(4 1))))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "tags"])]
- [dummy-cursor (9 (#Cons [dummy-cursor (5 "None")] (#Cons [dummy-cursor (5 "Some")] #Nil)))]]
- (#Cons [[dummy-cursor (7 ["lux" "type-args"])]
- [dummy-cursor (9 (#Cons [dummy-cursor (5 "a")] #Nil))]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "A potentially missing value.")]]
- #Nil))))))])
+ (#Cons [[dummy-cursor (7 ["lux" "tags"])]
+ [dummy-cursor (9 (#Cons [dummy-cursor (5 "None")] (#Cons [dummy-cursor (5 "Some")] #Nil)))]]
+ (#Cons [[dummy-cursor (7 ["lux" "type-args"])]
+ [dummy-cursor (9 (#Cons [dummy-cursor (5 "a")] #Nil))]]
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "A potentially missing value.")]]
+ #Nil)))))])
## (type: #rec Type
## (#Primitive Text (List Type))
@@ -243,28 +219,26 @@
("lux check type" (9 Type List)))}
("lux check type" (9 (4 1) (4 0)))))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "tags"])]
- [dummy-cursor (9 (#Cons [dummy-cursor (5 "Primitive")]
- (#Cons [dummy-cursor (5 "Sum")]
- (#Cons [dummy-cursor (5 "Product")]
- (#Cons [dummy-cursor (5 "Function")]
- (#Cons [dummy-cursor (5 "Parameter")]
- (#Cons [dummy-cursor (5 "Var")]
- (#Cons [dummy-cursor (5 "Ex")]
- (#Cons [dummy-cursor (5 "UnivQ")]
- (#Cons [dummy-cursor (5 "ExQ")]
- (#Cons [dummy-cursor (5 "Apply")]
- (#Cons [dummy-cursor (5 "Named")]
- #Nil))))))))))))]]
- (#Cons [[dummy-cursor (7 ["lux" "doc"])]
- [dummy-cursor (5 "This type represents the data-structures that are used to specify types themselves.")]]
- (#Cons [[dummy-cursor (7 ["lux" "type-rec?"])]
- [dummy-cursor (0 #1)]]
- #Nil))))))])
+ (#Cons [[dummy-cursor (7 ["lux" "tags"])]
+ [dummy-cursor (9 (#Cons [dummy-cursor (5 "Primitive")]
+ (#Cons [dummy-cursor (5 "Sum")]
+ (#Cons [dummy-cursor (5 "Product")]
+ (#Cons [dummy-cursor (5 "Function")]
+ (#Cons [dummy-cursor (5 "Parameter")]
+ (#Cons [dummy-cursor (5 "Var")]
+ (#Cons [dummy-cursor (5 "Ex")]
+ (#Cons [dummy-cursor (5 "UnivQ")]
+ (#Cons [dummy-cursor (5 "ExQ")]
+ (#Cons [dummy-cursor (5 "Apply")]
+ (#Cons [dummy-cursor (5 "Named")]
+ #Nil))))))))))))]]
+ (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "This type represents the data-structures that are used to specify types themselves.")]]
+ (#Cons [[dummy-cursor (7 ["lux" "type-rec?"])]
+ [dummy-cursor (0 #1)]]
+ #Nil)))))])
## (type: Cursor
## {#module Text
@@ -281,11 +255,9 @@
#Nil))))]]
(#Cons [[dummy-cursor (7 ["lux" "doc"])]
[dummy-cursor (5 "Cursors are for specifying the location of Code nodes in Lux files during compilation.")]]
- (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- #Nil)))))])
+ #Nil))))])
## (type: (Ann m v)
## {#meta m
@@ -305,11 +277,9 @@
[dummy-cursor (5 "The type of things that can be annotated with meta-data of arbitrary types.")]]
(#Cons [[dummy-cursor (7 ["lux" "type-args"])]
[dummy-cursor (9 (#Cons [dummy-cursor (5 "m")] (#Cons [dummy-cursor (5 "v")] #Nil)))]]
- (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- #Nil))))))])
+ #Nil)))))])
## (type: (Code' w)
## (#Bit Bit)
@@ -372,11 +342,9 @@
#Nil))))))))))))]]
(#Cons [[dummy-cursor (7 ["lux" "type-args"])]
[dummy-cursor (9 (#Cons [dummy-cursor (5 "w")] #Nil))]]
- (#Cons [[dummy-cursor (7 ["lux" "type?"])]
+ (#Cons [[dummy-cursor (7 ["lux" "export?"])]
[dummy-cursor (0 #1)]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- #Nil)))))])
+ #Nil))))])
## (type: Code
## (Ann Cursor (Code' (Ann Cursor))))
@@ -388,11 +356,9 @@
[dummy-cursor
(#Record (#Cons [[dummy-cursor (#Tag ["lux" "doc"])]
[dummy-cursor (#Text "The type of Code nodes for Lux syntax.")]]
- (#Cons [[dummy-cursor (#Tag ["lux" "type?"])]
+ (#Cons [[dummy-cursor (#Tag ["lux" "export?"])]
[dummy-cursor (#Bit #1)]]
- (#Cons [[dummy-cursor (#Tag ["lux" "export?"])]
- [dummy-cursor (#Bit #1)]]
- #Nil))))])
+ #Nil)))])
("lux def" _ann
("lux check" (#Function (#Apply (#Apply Cursor Ann)
@@ -469,16 +435,7 @@
("lux def" default-def-meta-exported
("lux check" (#Apply (#Product Code Code) List)
- (#Cons [(tag$ ["lux" "type?"])
- (bit$ #1)]
- (#Cons [(tag$ ["lux" "export?"])
- (bit$ #1)]
- #Nil)))
- (record$ #Nil))
-
-("lux def" default-def-meta-private
- ("lux check" (#Apply (#Product Code Code) List)
- (#Cons [(tag$ ["lux" "type?"])
+ (#Cons [(tag$ ["lux" "export?"])
(bit$ #1)]
#Nil))
(record$ #Nil))
@@ -545,7 +502,7 @@
("lux def" Code-List
(#Apply Code List)
- (record$ default-def-meta-private))
+ (record$ #Nil))
## (type: (Either l r)
## (#Left l)
@@ -1612,9 +1569,8 @@
## (: (All [a b] (-> (-> a (m b)) (m a) (m b)))
## bind))
(def:''' Monad
- (list& [(tag$ ["lux" "tags"])
- (tuple$ (list (text$ "wrap") (text$ "bind")))]
- default-def-meta-private)
+ (list [(tag$ ["lux" "tags"])
+ (tuple$ (list (text$ "wrap") (text$ "bind")))])
Type
(#Named ["lux" "Monad"]
(All [m]
@@ -3997,11 +3953,10 @@
type-meta (: Code
(case tags??
(#Some tags)
- (` {#.tags [(~+ (list@map text$ tags))]
- #.type? #1})
+ (` {#.tags [(~+ (list@map text$ tags))]})
_
- (` {#.type? #1})))
+ (` {})))
type' (: (Maybe Code)
(if rec?
(if (empty? args)
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index 6daaf4869..3b3d31341 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -1402,8 +1402,7 @@
(short-class-name full-name))
params' (list@map code.local-identifier params)]
(` (def: (~ (code.identifier ["" def-name]))
- {#.type? #1
- #..jvm-class (~ (code.text full-name))}
+ {#..jvm-class (~ (code.text full-name))}
.Type
(All [(~+ params')]
(primitive (~ (code.text (sanitize full-name)))
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux
index 9c866a66a..0c6cfcd9e 100644
--- a/stdlib/source/lux/host.old.lux
+++ b/stdlib/source/lux/host.old.lux
@@ -1510,8 +1510,7 @@
(short-class-name full-name))
params' (list@map (|>> product.left code.local-identifier) params)]
(` (def: (~ (code.identifier ["" def-name]))
- {#.type? #1
- #..jvm-class (~ (code.text full-name))}
+ {#..jvm-class (~ (code.text full-name))}
Type
(All [(~+ params')]
(primitive (~ (code.text (sanitize full-name)))
diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux
index e5ac9a87a..0b0c59623 100644
--- a/stdlib/source/lux/macro.lux
+++ b/stdlib/source/lux/macro.lux
@@ -202,7 +202,6 @@
(flag-set? (name-of <tag>)))]
[export? #.export? "exported"]
- [type? #.type? "a type"]
[structure? #.struct? "a structure"]
[recursive-type? #.type-rec? "a recursive type"]
[signature? #.sig? "a signature"]
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
index 6c2ba872f..7deb93696 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
@@ -17,7 +17,7 @@
["." dictionary]]]
["." macro
["." code]]
- [type (#+ :share :by-example)
+ ["." type (#+ :share :by-example) ("#@." equivalence)
["." check]]]
["." //
["#." bundle]
@@ -27,7 +27,7 @@
["#." generation]
[analysis
["." module]
- ["." type]]
+ [".A" type]]
["#/" // #_
["#." analysis]
["#." synthesis (#+ Synthesis)]
@@ -59,8 +59,8 @@
generate (get@ [#////statement.generation #////statement.phase] state)]
[_ code//type codeA] (////statement.lift-analysis
(////analysis.with-scope
- (type.with-fresh-env
- (type.with-type type
+ (typeA.with-fresh-env
+ (typeA.with-type type
(do @
[codeA (analyse codeC)]
(wrap [type codeA]))))))
@@ -83,9 +83,9 @@
_ (///generation.save! false name statement)]
(wrap [code//type codeT target-name value]))))
-(def: (definition name ?type codeC)
+(def: (definition name codeC)
(All [anchor expression statement]
- (-> Name (Maybe Type) Code
+ (-> Name Code
(Operation anchor expression statement [Type expression Text Any])))
(do ///.monad
[state (//.lift ///.get-state)
@@ -94,20 +94,12 @@
generate (get@ [#////statement.generation #////statement.phase] state)]
[_ code//type codeA] (////statement.lift-analysis
(////analysis.with-scope
- (type.with-fresh-env
- (case ?type
- (#.Some type)
- (type.with-type type
- (do @
- [codeA (analyse codeC)]
- (wrap [type codeA])))
-
- #.None
- (do @
- [[code//type codeA] (type.with-inference (analyse codeC))
- code//type (type.with-env
- (check.clean code//type))]
- (wrap [code//type codeA]))))))
+ (typeA.with-fresh-env
+ (do @
+ [[code//type codeA] (typeA.with-inference (analyse codeC))
+ code//type (typeA.with-env
+ (check.clean code//type))]
+ (wrap [code//type codeA])))))
codeS (////statement.lift-synthesis
(synthesize codeA))]
(definition' generate name code//type codeS)))
@@ -119,7 +111,7 @@
(////statement.lift-analysis
(do ///.monad
[_ (module.define short-name [type annotations value])]
- (if (macro.type? annotations)
+ (if (type@= .Type type)
(case (macro.declared-tags annotations)
#.Nil
(wrap [])
@@ -155,11 +147,7 @@
#let [full-name [current-module short-name]]
[_ annotationsT annotationsV] (evaluate! Code annotationsC)
#let [annotationsV (:coerce Code annotationsV)]
- [value//type valueT valueN valueV] (..definition full-name
- (if (macro.type? annotationsV)
- (#.Some Type)
- #.None)
- valueC)
+ [value//type valueT valueN valueV] (..definition full-name valueC)
_ (..define short-name value//type annotationsV valueV)
#let [_ (log! (format "Definition " (%name full-name)))]
_ (////statement.lift-generation
@@ -282,8 +270,8 @@
(do ///.monad
[[_ programA] (////statement.lift-analysis
(////analysis.with-scope
- (type.with-fresh-env
- (type.with-type (type (-> (List Text) (IO Any)))
+ (typeA.with-fresh-env
+ (typeA.with-type (type (-> (List Text) (IO Any)))
(analyse programC)))))]
(////statement.lift-synthesis
(synthesize programA))))
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index e37d69d1b..1522e8f66 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -274,7 +274,7 @@
(def: (add-definition [name [def-type def-annotations def-value]] organization)
(-> [Text Definition] Organization Organization)
- (cond (macro.type? def-annotations)
+ (cond (type@= .Type def-type)
(update@ #types
(: (Mutation (List Value))
(|>> (#.Cons [name def-annotations (:coerce Type def-value)])))