aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux.lux524
-rw-r--r--stdlib/source/lux/control/concurrency/actor.lux2
-rw-r--r--stdlib/source/lux/host.jvm.lux2
-rw-r--r--stdlib/source/lux/host.old.lux2
-rw-r--r--stdlib/source/lux/macro.lux13
-rw-r--r--stdlib/source/lux/tool/compiler/phase/analysis/reference.lux4
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension/statement.lux17
-rw-r--r--stdlib/source/lux/type/abstract.lux24
-rw-r--r--stdlib/source/lux/type/implicit.lux4
-rw-r--r--stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux8
10 files changed, 293 insertions, 307 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index 91ee40db9..9e370f12b 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -1,21 +1,22 @@
("lux def" dummy-cursor
["" 0 0]
- [["" 0 0]
- (10 (1 [[["" 0 0] (7 ["lux" "export?"])]
- [["" 0 0] (0 #1)]]
- (0)))])
+ [["" 0 0] (10 (0))]
+ #1)
("lux def" double-quote
("lux i64 char" +34)
- [dummy-cursor (10 (0))])
+ [dummy-cursor (10 (0))]
+ #0)
("lux def" new-line
("lux i64 char" +10)
- [dummy-cursor (10 (0))])
+ [dummy-cursor (10 (0))]
+ #0)
("lux def" __paragraph
("lux text concat" new-line new-line)
- [dummy-cursor (10 (0))])
+ [dummy-cursor (10 (0))]
+ #0)
## (type: Any
## (Ex [a] a))
@@ -24,13 +25,12 @@
(10 ["lux" "Any"]
(8 (0) (4 1))))
[dummy-cursor
- (10 (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))))])
+ (10 (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)
## (type: Nothing
## (All [a] a))
@@ -39,13 +39,12 @@
(10 ["lux" "Nothing"]
(7 (0) (4 1))))
[dummy-cursor
- (10 (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))))])
+ (10 (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)
## (type: (List a)
## #Nil
@@ -59,25 +58,23 @@
(2 (4 1)
(9 (4 1) (4 0))))))
[dummy-cursor
- (10 (1 [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (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)))))]
- ["Nil" "Cons"])
+ (10 (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))))]
+ ["Nil" "Cons"]
+ #1)
("lux def" Bit
("lux check type"
(10 ["lux" "Bit"]
(0 "#Bit" #Nil)))
[dummy-cursor
- (10 (#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)))])
+ (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill boolean values (as bits).")]]
+ #Nil))]
+ #1)
("lux def" I64
("lux check type"
@@ -85,81 +82,74 @@
(7 (0)
(0 "#I64" (#Cons (4 1) #Nil)))))
[dummy-cursor
- (10 (#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)))])
+ (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "64-bit integers without any semantics.")]]
+ #Nil))]
+ #1)
("lux def" Nat
("lux check type"
(10 ["lux" "Nat"]
(0 "#I64" (#Cons (0 "#Nat" #Nil) #Nil))))
[dummy-cursor
- (10 (#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)))])
+ (10 (#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))]
+ #1)
("lux def" Int
("lux check type"
(10 ["lux" "Int"]
(0 "#I64" (#Cons (0 "#Int" #Nil) #Nil))))
[dummy-cursor
- (10 (#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)))])
+ (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill integer numbers.")]]
+ #Nil))]
+ #1)
("lux def" Rev
("lux check type"
(10 ["lux" "Rev"]
(0 "#I64" (#Cons (0 "#Rev" #Nil) #Nil))))
[dummy-cursor
- (10 (#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)))])
+ (10 (#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))]
+ #1)
("lux def" Frac
("lux check type"
(10 ["lux" "Frac"]
(0 "#Frac" #Nil)))
[dummy-cursor
- (10 (#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)))])
+ (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill floating-point (fractional) numbers.")]]
+ #Nil))]
+ #1)
("lux def" Text
("lux check type"
(10 ["lux" "Text"]
(0 "#Text" #Nil)))
[dummy-cursor
- (10 (#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)))])
+ (10 (#Cons [[dummy-cursor (7 ["lux" "doc"])]
+ [dummy-cursor (5 "Your standard, run-of-the-mill string values.")]]
+ #Nil))]
+ #1)
("lux def" Name
("lux check type"
(10 ["lux" "Name"]
(2 Text Text)))
[dummy-cursor
- (10 (#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)))])
+ (10 (#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))]
+ #1)
## (type: (Maybe a)
## #None
@@ -172,14 +162,13 @@
## "lux.Some"
(4 1))))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#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))))]
- ["None" "Some"])
+ (10 (#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)))]
+ ["None" "Some"]
+ #1)
## (type: #rec Type
## (#Primitive Text (List Type))
@@ -227,14 +216,13 @@
("lux check type" (9 Type List)))}
("lux check type" (9 (4 1) (4 0)))))
[dummy-cursor
- (10 (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- (#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))))]
- ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"])
+ (10 (#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)))]
+ ["Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"]
+ #1)
## (type: Cursor
## {#module Text
@@ -246,10 +234,9 @@
[dummy-cursor
(10 (#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" "export?"])]
- [dummy-cursor (0 #1)]]
- #Nil)))]
- ["module" "line" "column"])
+ #Nil))]
+ ["module" "line" "column"]
+ #1)
## (type: (Ann m v)
## {#meta m
@@ -265,10 +252,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" "export?"])]
- [dummy-cursor (0 #1)]]
- #Nil))))]
- ["meta" "datum"])
+ #Nil)))]
+ ["meta" "datum"]
+ #1)
## (type: (Code' w)
## (#Bit Bit)
@@ -318,10 +304,9 @@
[dummy-cursor
(10 (#Cons [[dummy-cursor (7 ["lux" "type-args"])]
[dummy-cursor (9 (#Cons [dummy-cursor (5 "w")] #Nil))]]
- (#Cons [[dummy-cursor (7 ["lux" "export?"])]
- [dummy-cursor (0 #1)]]
- #Nil)))]
- ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"])
+ #Nil))]
+ ["Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Tuple" "Record"]
+ #1)
## (type: Code
## (Ann Cursor (Code' (Ann Cursor))))
@@ -333,9 +318,8 @@
[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" "export?"])]
- [dummy-cursor (#Bit #1)]]
- #Nil)))])
+ #Nil))]
+ #1)
("lux def" _ann
("lux check" (#Function (#Apply (#Apply Cursor Ann)
@@ -343,89 +327,97 @@
Code)
([_ data]
[dummy-cursor data]))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" bit$
("lux check" (#Function Bit Code)
([_ value] (_ann (#Bit value))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" nat$
("lux check" (#Function Nat Code)
([_ value] (_ann (#Nat value))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" int$
("lux check" (#Function Int Code)
([_ value] (_ann (#Int value))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" rev$
("lux check" (#Function Rev Code)
([_ value] (_ann (#Rev value))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" frac$
("lux check" (#Function Frac Code)
([_ value] (_ann (#Frac value))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" text$
("lux check" (#Function Text Code)
([_ text] (_ann (#Text text))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" identifier$
("lux check" (#Function Name Code)
([_ name] (_ann (#Identifier name))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" local-identifier$
("lux check" (#Function Text Code)
([_ name] (_ann (#Identifier ["" name]))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" tag$
("lux check" (#Function Name Code)
([_ name] (_ann (#Tag name))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" local-tag$
("lux check" (#Function Text Code)
([_ name] (_ann (#Tag ["" name]))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" form$
("lux check" (#Function (#Apply Code List) Code)
([_ tokens] (_ann (#Form tokens))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" tuple$
("lux check" (#Function (#Apply Code List) Code)
([_ tokens] (_ann (#Tuple tokens))))
- [dummy-cursor (#Record #Nil)])
+ [dummy-cursor (#Record #Nil)]
+ #0)
("lux def" record$
("lux check" (#Function (#Apply (#Product Code Code) List) Code)
([_ tokens] (_ann (#Record tokens))))
- [dummy-cursor (#Record #Nil)])
-
-("lux def" default-def-meta-exported
- ("lux check" (#Apply (#Product Code Code) List)
- (#Cons [(tag$ ["lux" "export?"])
- (bit$ #1)]
- #Nil))
- (record$ #Nil))
+ [dummy-cursor (#Record #Nil)]
+ #0)
## (type: Definition
-## [Type Code Any])
+## [Bit Type Code Any])
("lux def" Definition
("lux check type"
(#Named ["lux" "Definition"]
- (#Product Type (#Product Code Any))))
+ (#Product Bit (#Product Type (#Product Code Any)))))
(record$ (#Cons [(tag$ ["lux" "doc"])
(text$ "Represents all the data associated with a definition: its type, its annotations, and its value.")]
- default-def-meta-exported)))
+ #Nil))
+ #1)
## (type: (Bindings k v)
## {#counter Nat
@@ -442,8 +434,9 @@
List)))))
(record$ (#Cons [(tag$ ["lux" "type-args"])
(tuple$ (#Cons (text$ "k") (#Cons (text$ "v") #Nil)))]
- default-def-meta-exported))
- ["counter" "mappings"])
+ #Nil))
+ ["counter" "mappings"]
+ #1)
## (type: #export Ref
## (#Local Nat)
@@ -454,8 +447,9 @@
Nat
## Captured
Nat))
- (record$ default-def-meta-exported)
- ["Local" "Captured"])
+ (record$ #Nil)
+ ["Local" "Captured"]
+ #1)
## (type: Scope
## {#name (List Text)
@@ -472,13 +466,15 @@
(#Apply (#Product Type Nat) (#Apply Text Bindings))
## captured
(#Apply (#Product Type Ref) (#Apply Text Bindings))))))
- (record$ default-def-meta-exported)
- ["name" "inner" "locals" "captured"])
+ (record$ #Nil)
+ ["name" "inner" "locals" "captured"]
+ #1)
("lux def" Code-List
("lux check type"
(#Apply Code List))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
## (type: (Either l r)
## (#Left l)
@@ -495,8 +491,9 @@
(tuple$ (#Cons (text$ "l") (#Cons (text$ "r") #Nil)))]
(#Cons [(tag$ ["lux" "doc"])
(text$ "A choice between two values of different types.")]
- default-def-meta-exported)))
- ["Left" "Right"])
+ #Nil)))
+ ["Left" "Right"]
+ #1)
## (type: Source
## [Cursor Nat Text])
@@ -504,7 +501,8 @@
("lux check type"
(#Named ["lux" "Source"]
(#Product Cursor (#Product Nat Text))))
- (record$ default-def-meta-exported))
+ (record$ #Nil)
+ #1)
## (type: Module-State
## #Active
@@ -520,8 +518,9 @@
Any
## #Cached
Any)))
- (record$ default-def-meta-exported)
- ["Active" "Compiled" "Cached"])
+ (record$ #Nil)
+ ["Active" "Compiled" "Cached"]
+ #1)
## (type: Module
## {#module-hash Nat
@@ -561,8 +560,9 @@
))))))
(record$ (#Cons [(tag$ ["lux" "doc"])
(text$ "All the information contained within a Lux module.")]
- default-def-meta-exported))
- ["module-hash" "module-aliases" "definitions" "imports" "tags" "types" "module-annotations" "module-state"])
+ #Nil))
+ ["module-hash" "module-aliases" "definitions" "imports" "tags" "types" "module-annotations" "module-state"]
+ #1)
## (type: Type-Context
## {#ex-counter Nat
@@ -577,8 +577,9 @@
## var-bindings
(#Apply (#Product Nat (#Apply Type Maybe))
List))))
- (record$ default-def-meta-exported)
- ["ex-counter" "var-counter" "var-bindings"])
+ (record$ #Nil)
+ ["ex-counter" "var-counter" "var-bindings"]
+ #1)
## (type: Mode
## #Build
@@ -594,8 +595,9 @@
Any)))
(record$ (#Cons [(tag$ ["lux" "doc"])
(text$ "A sign that shows the conditions under which the compiler is running.")]
- default-def-meta-exported))
- ["Build" "Eval" "Interpreter"])
+ #Nil))
+ ["Build" "Eval" "Interpreter"]
+ #1)
## (type: Info
## {#target Text
@@ -613,8 +615,9 @@
Mode)))
(record$ (#Cons [(tag$ ["lux" "doc"])
(text$ "Information about the current version and type of compiler that is running.")]
- default-def-meta-exported))
- ["target" "version" "mode"])
+ #Nil))
+ ["target" "version" "mode"]
+ #1)
## (type: Lux
## {#info Info
@@ -661,8 +664,9 @@
("lux text concat"
("lux text concat" "It is provided to macros during their invocation, so they can access compiler data." __paragraph)
"Caveat emptor: Avoid fiddling with it, unless you know what you're doing.")))]
- default-def-meta-exported))
- ["info" "source" "cursor" "current-module" "modules" "scopes" "type-context" "expected" "seed" "scope-type-vars" "extensions" "host"])
+ #Nil))
+ ["info" "source" "cursor" "current-module" "modules" "scopes" "type-context" "expected" "seed" "scope-type-vars" "extensions" "host"]
+ #1)
## (type: (Meta a)
## (-> Lux (Either Text [Lux a])))
@@ -679,7 +683,8 @@
"These computations may fail, or modify the state of the compiler."))]
(#Cons [(tag$ ["lux" "type-args"])
(tuple$ (#Cons (text$ "a") #Nil))]
- default-def-meta-exported))))
+ #Nil)))
+ #1)
## (type: Macro'
## (-> (List Code) (Meta (List Code))))
@@ -687,7 +692,8 @@
("lux check type"
(#Named ["lux" "Macro'"]
(#Function Code-List (#Apply Code-List Meta))))
- (record$ default-def-meta-exported))
+ (record$ #Nil)
+ #1)
## (type: Macro
## (primitive "#Macro"))
@@ -697,7 +703,8 @@
(#Primitive "#Macro" #Nil)))
(record$ (#Cons [(tag$ ["lux" "doc"])
(text$ "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")]
- default-def-meta-exported)))
+ #Nil))
+ #1)
## Base functions & macros
("lux def" return
@@ -710,7 +717,8 @@
([_ val]
([_ state]
(#Right state val))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" fail
("lux check" (#UnivQ #Nil
@@ -722,7 +730,8 @@
([_ msg]
([_ state]
(#Left msg))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" let''
("lux macro"
@@ -734,7 +743,8 @@
_
(fail "Wrong syntax for let''")}
tokens)))
- (record$ #.Nil))
+ (record$ #.Nil)
+ #0)
("lux def" function''
("lux macro"
@@ -770,12 +780,14 @@
_
(fail "Wrong syntax for function''")}
tokens)))
- (record$ #.Nil))
+ (record$ #.Nil)
+ #0)
("lux def" cursor-code
("lux check" Code
(tuple$ (#Cons (text$ "") (#Cons (nat$ 0) (#Cons (nat$ 0) #Nil)))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" meta-code
("lux check" (#Function Name (#Function Code Code))
@@ -784,7 +796,8 @@
(tuple$ (#Cons cursor-code
(#Cons (form$ (#Cons (tag$ tag) (#Cons value #Nil)))
#Nil))))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" flag-meta
("lux check" (#Function Text Code)
@@ -792,42 +805,28 @@
(tuple$ (#Cons [(meta-code ["lux" "Tag"] (tuple$ (#Cons (text$ "lux") (#Cons (text$ tag) #Nil))))
(#Cons [(meta-code ["lux" "Bit"] (bit$ #1))
#Nil])]))))
- (record$ #Nil))
-
-("lux def" export-meta
- ("lux check" (#Product Code Code)
- [(tag$ ["lux" "export?"]) (bit$ #1)])
- (record$ #Nil))
-
-("lux def" export?-meta
- ("lux check" Code
- (flag-meta "export?"))
- (record$ #Nil))
-
-("lux def" with-export-meta
- ("lux check" (#Function Code Code)
- (function'' [tail]
- (form$ (#Cons (tag$ ["lux" "Cons"])
- (#Cons export?-meta
- (#Cons tail #Nil))))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" doc-meta
("lux check" (#Function Text (#Product Code Code))
(function'' [doc] [(tag$ ["lux" "doc"]) (text$ doc)]))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" as-def
- ("lux check" (#Function Code (#Function Code (#Function Code Code)))
- (function'' [name value annotations]
- (form$ (#Cons (text$ "lux def") (#Cons name (#Cons value (#Cons annotations #Nil)))))))
- (record$ #Nil))
+ ("lux check" (#Function Code (#Function Code (#Function Code (#Function Bit Code))))
+ (function'' [name value annotations exported?]
+ (form$ (#Cons (text$ "lux def") (#Cons name (#Cons value (#Cons annotations (#Cons (bit$ exported?) #Nil))))))))
+ (record$ #Nil)
+ #0)
("lux def" as-checked
("lux check" (#Function Code (#Function Code Code))
(function'' [type value]
(form$ (#Cons (text$ "lux check") (#Cons type (#Cons value #Nil))))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" as-function
("lux check" (#Function Code (#Function (#Apply Code List) (#Function Code Code)))
@@ -836,7 +835,8 @@
(#Cons self
(#Cons (tuple$ inputs)
(#Cons output #Nil)))))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" as-macro
("lux check" (#Function Code Code)
@@ -844,7 +844,8 @@
(form$ (#Cons (text$ "lux macro")
(#Cons expression
#Nil)))))
- (record$ #Nil))
+ (record$ #Nil)
+ #0)
("lux def" def:''
("lux macro"
@@ -854,15 +855,17 @@
(#Cons [meta (#Cons [type (#Cons [body #Nil])])])])])
(return (#Cons [(as-def name (as-checked type (as-function name args body))
(form$ (#Cons (identifier$ ["lux" "record$"])
- (#Cons (with-export-meta meta)
- #Nil))))
+ (#Cons meta
+ #Nil)))
+ #1)
#Nil]))
(#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])])
(return (#Cons [(as-def name (as-checked type body)
(form$ (#Cons (identifier$ ["lux" "record$"])
- (#Cons (with-export-meta meta)
- #Nil))))
+ (#Cons meta
+ #Nil)))
+ #1)
#Nil]))
(#Cons [[_ (#Form (#Cons [name args]))]
@@ -870,20 +873,23 @@
(return (#Cons [(as-def name (as-checked type (as-function name args body))
(form$ (#Cons (identifier$ ["lux" "record$"])
(#Cons meta
- #Nil))))
+ #Nil)))
+ #0)
#Nil]))
(#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])
(return (#Cons [(as-def name (as-checked type body)
(form$ (#Cons (identifier$ ["lux" "record$"])
(#Cons meta
- #Nil))))
+ #Nil)))
+ #0)
#Nil]))
_
(fail "Wrong syntax for def''")}
tokens)))
- (record$ #.Nil))
+ (record$ #.Nil)
+ #0)
("lux def" macro:'
("lux macro"
@@ -892,27 +898,31 @@
(return (#Cons (as-def name (as-macro (as-function name args body))
(form$ (#Cons (identifier$ ["lux" "record$"])
(#Cons (tag$ ["lux" "Nil"])
- #Nil))))
+ #Nil)))
+ #0)
#Nil))
(#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil)))
(return (#Cons (as-def name (as-macro (as-function name args body))
(form$ (#Cons (identifier$ ["lux" "record$"])
- (#Cons (with-export-meta (tag$ ["lux" "Nil"]))
- #Nil))))
+ (#Cons (tag$ ["lux" "Nil"])
+ #Nil)))
+ #1)
#Nil))
(#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons meta-data (#Cons body #Nil))))
(return (#Cons (as-def name (as-macro (as-function name args body))
(form$ (#Cons (identifier$ ["lux" "record$"])
- (#Cons (with-export-meta meta-data)
- #Nil))))
+ (#Cons meta-data
+ #Nil)))
+ #1)
#Nil))
_
(fail "Wrong syntax for macro:'")}
tokens)))
- (record$ #.Nil))
+ (record$ #.Nil)
+ #0)
(macro:' #export (comment tokens)
(#Cons [(tag$ ["lux" "doc"])
@@ -1017,24 +1027,18 @@
syntax}
syntax))
-(def:'' (n/+ param subject)
- (#.Cons (doc-meta "Nat(ural) addition.")
- (#.Cons export-meta
- #.Nil))
+(def:'' #export (n/+ param subject)
+ (#.Cons (doc-meta "Nat(ural) addition.") #.Nil)
(#Function Nat (#Function Nat Nat))
("lux i64 +" subject param))
-(def:'' (n/- param subject)
- (#.Cons (doc-meta "Nat(ural) substraction.")
- (#.Cons export-meta
- #.Nil))
+(def:'' #export (n/- param subject)
+ (#.Cons (doc-meta "Nat(ural) substraction.") #.Nil)
(#Function Nat (#Function Nat Nat))
("lux i64 -" param subject))
-(def:'' (n/* param subject)
- (#.Cons (doc-meta "Nat(ural) multiplication.")
- (#.Cons export-meta
- #.Nil))
+(def:'' #export (n/* param subject)
+ (#.Cons (doc-meta "Nat(ural) multiplication.") #.Nil)
(#Function Nat (#Function Nat Nat))
("lux coerce" Nat
("lux i64 *"
@@ -1333,8 +1337,9 @@
(tuple$ args)
body))))
(form$ (#Cons (identifier$ ["lux" "record$"])
- (#Cons (with-export-meta meta)
- #Nil)))))))
+ (#Cons meta
+ #Nil)))
+ (bit$ #1)))))
(#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])])
(return (list (form$ (list (text$ "lux def")
@@ -1343,8 +1348,9 @@
type
body))
(form$ (#Cons (identifier$ ["lux" "record$"])
- (#Cons (with-export-meta meta)
- #Nil)))))))
+ (#Cons meta
+ #Nil)))
+ (bit$ #1)))))
(#Cons [[_ (#Form (#Cons [name args]))]
(#Cons [meta (#Cons [type (#Cons [body #Nil])])])])
@@ -1358,7 +1364,8 @@
body))))
(form$ (#Cons (identifier$ ["lux" "record$"])
(#Cons meta
- #Nil)))))))
+ #Nil)))
+ (bit$ #0)))))
(#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])
(return (list (form$ (list (text$ "lux def")
@@ -1366,7 +1373,8 @@
(form$ (list (text$ "lux check") type body))
(form$ (#Cons (identifier$ ["lux" "record$"])
(#Cons meta
- #Nil)))))))
+ #Nil)))
+ (bit$ #0)))))
_
(fail "Wrong syntax for def:'''")}
@@ -1520,7 +1528,8 @@
($' m a)
($' m b))))))
(record$ (list))
- ["wrap" "bind"])
+ ["wrap" "bind"]
+ #0)
(def:''' maybe-monad
#Nil
@@ -1715,7 +1724,7 @@
#seed seed #expected expected #cursor cursor #extensions extensions
#scope-type-vars scope-type-vars} state]
({(#Some {#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _})
- ({(#Some [def-type def-meta def-value])
+ ({(#Some [exported? def-type def-meta def-value])
({(#Some [_ (#Identifier real-name)])
(#Right [state real-name])
@@ -2518,26 +2527,19 @@
[$module (get module modules)
gdef (let' [{#module-hash _ #module-aliases _ #definitions bindings #imports _ #tags tags #types types #module-annotations _ #module-state _} ("lux check" Module $module)]
(get name bindings))]
- (let' [[def-type def-meta def-value] ("lux check" Definition gdef)]
- ({#1
- ({(#Some [_ (#Bit #1)])
+ (let' [[exported? def-type def-meta def-value] ("lux check" Definition gdef)]
+ (if (macro-type? def-type)
+ (if exported?
(#Some ("lux coerce" Macro def-value))
-
- _
(if (text@= module current-module)
(#Some ("lux coerce" Macro def-value))
- #None)}
- (get-meta ["lux" "export?"] def-meta))
-
- #0
+ #None))
({(#Some [_ (#Identifier [r-module r-name])])
(find-macro' modules current-module r-module r-name)
_
#None}
- (get-meta ["lux" "alias"] def-meta))}
- (macro-type? def-type)))
- ))
+ (get-meta ["lux" "alias"] def-meta))))))
(def:''' (normalize name)
#Nil
@@ -2913,11 +2915,11 @@
#None
body'}
?type)]
- (return (list (` ("lux def" (~ name) (~ body'')
+ (return (list (` ("lux def" (~ name)
+ (~ body'')
[(~ cursor-code)
- (#.Record (~ (if export?
- (with-export-meta (tag$ ["lux" "Nil"]))
- (tag$ ["lux" "Nil"]))))])))))
+ (#.Record #.Nil)]
+ (~ (bit$ export?)))))))
#None
(fail "Wrong syntax for def'")}
@@ -3253,7 +3255,7 @@
"(def: branching-exponent" ..new-line
" Int" ..new-line
" +5)"))])
- (let [[export? tokens'] (export^ tokens)
+ (let [[exported? tokens'] (export^ tokens)
parts (: (Maybe [Code (List Code) (Maybe Code) Code (List [Code Code])])
(case tokens'
(^ (list [_ (#Form (#Cons name args))] [_ (#Record meta-kvs)] type body))
@@ -3300,10 +3302,8 @@
(return (list (` ("lux def" (~ name)
(~ body)
[(~ cursor-code)
- (#.Record (~ (with-func-args args
- (if export?
- (with-export-meta =meta)
- =meta))))])))))
+ (#.Record (~ (with-func-args args =meta)))]
+ (~ (bit$ exported?)))))))
#None
(fail "Wrong syntax for def:"))))
@@ -3370,9 +3370,8 @@
(return (list (` ("lux def" (~ name)
(~ body)
[(~ cursor-code)
- (#Record (~ (if exported?
- (with-export-meta =meta)
- =meta)))])))))
+ (#Record (~ =meta))]
+ (~ (bit$ exported?)))))))
#None
(fail "Wrong syntax for macro:"))))
@@ -3777,7 +3776,7 @@
(: (-> Code (Meta [Code Code]))
(function (_ token)
(case token
- (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag-name)] value meta))])
+ (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag-name)] value meta [_ (#Bit #0)]))])
(case (get tag-name tag-mappings)
(#Some tag)
(wrap [tag value])
@@ -3909,9 +3908,6 @@
_
(#Some (` (.All (~ type-name) [(~+ args)] (~ type)))))))
total-meta (let [meta (process-def-meta meta)
- meta (if exported?
- (with-export-meta meta)
- meta)
meta (if rec?
(` (#.Cons (~ (flag-meta "type-rec?")) (~ meta)))
meta)]
@@ -3927,13 +3923,15 @@
(` ("lux def type tagged" (~ type-name)
(~ typeC)
(~ total-meta)
- [(~+ (list@map text$ tags))]))
+ [(~+ (list@map text$ tags))]
+ (~ (bit$ exported?))))
_
(` ("lux def" (~ type-name)
("lux check type"
(~ typeC))
- (~ total-meta)))))))
+ (~ total-meta)
+ (~ (bit$ exported?))))))))
#None
(fail "Wrong syntax for type:"))))
@@ -4231,12 +4229,9 @@
(#Some =module)
(let [to-alias (list@map (: (-> [Text Definition]
(List Text))
- (function (_ [name [def-type def-meta def-value]])
- (case (get-meta ["lux" "export?"] def-meta)
- (#Some [_ (#Bit #1)])
+ (function (_ [name [exported? def-type def-meta def-value]])
+ (if exported?
(list name)
-
- _
(list))))
(let [{#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _} =module]
definitions))]
@@ -4312,7 +4307,7 @@
#None
#None
- (#Some [def-type def-meta def-value])
+ (#Some [exported? def-type def-meta def-value])
(#Some def-type)))))
(def: (find-def-value name state)
@@ -4331,7 +4326,7 @@
#None
(#Left (text@compose "Unknown definition: " (name@encode name)))
- (#Some [def-type def-meta def-value])
+ (#Some [exported? def-type def-meta def-value])
(#Right [state [def-type def-value]])))))
(def: (find-type-var idx bindings)
@@ -4609,7 +4604,8 @@
_
(return (list (` ("lux def" (~ (local-identifier$ (de-alias "" short alias)))
(~ source+)
- [(~ cursor-code) (#.Record #Nil)])))))))
+ [(~ cursor-code) (#.Record #Nil)]
+ #0)))))))
(macro: #export (open: tokens)
{#.doc (text$ ($_ "lux text concat"
@@ -4647,7 +4643,8 @@
(do meta-monad
[g!struct (gensym "struct")]
(return (list (` ("lux def" (~ g!struct) (~ struct)
- [(~ cursor-code) (#.Record #Nil)]))
+ [(~ cursor-code) (#.Record #Nil)]
+ #0))
(` (..open: (~ (text$ alias)) (~ g!struct)))))))
_
@@ -4689,16 +4686,7 @@
#let [[referral options] referral+options]
openings+options (parse-openings options)
#let [[openings options] openings+options]
- current-module current-module-name
- #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Any)))
- (function (_ module-name all-defs referred-defs)
- (monad@map meta-monad
- (: (-> Text (Meta Any))
- (function (_ _def)
- (if (is-member? all-defs _def)
- (return [])
- (fail ($_ text@compose _def " is not defined in module " module-name " @ " current-module)))))
- referred-defs)))]]
+ current-module current-module-name]
(case options
#Nil
(wrap {#refer-defs referral
diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux
index a6cb52564..6c0d1928e 100644
--- a/stdlib/source/lux/control/concurrency/actor.lux
+++ b/stdlib/source/lux/control/concurrency/actor.lux
@@ -169,7 +169,7 @@
(def: #export (<resolve> name)
(-> Name (Meta Name))
(do macro.monad
- [[_ annotations _] (macro.find-def name)]
+ [[_ _ annotations _] (macro.find-def name)]
(case (macro.get-tag-ann (name-of <tag>) annotations)
(#.Some actor-name)
(wrap actor-name)
diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux
index 1113868e8..362eed4e5 100644
--- a/stdlib/source/lux/host.jvm.lux
+++ b/stdlib/source/lux/host.jvm.lux
@@ -394,7 +394,7 @@
[current-module macro.current-module-name
definitions (macro.definitions current-module)]
(wrap (list@fold (: (-> [Text Definition] Class-Imports Class-Imports)
- (function (_ [short-name [_ meta _]] imports)
+ (function (_ [short-name [_ _ meta _]] imports)
(case (macro.get-text-ann (name-of #..jvm-class) meta)
(#.Some full-class-name)
(add-import [short-name full-class-name] imports)
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux
index 0c6cfcd9e..32bb3887f 100644
--- a/stdlib/source/lux/host.old.lux
+++ b/stdlib/source/lux/host.old.lux
@@ -370,7 +370,7 @@
[current-module macro.current-module-name
definitions (macro.definitions current-module)]
(wrap (list@fold (: (-> [Text Definition] Class-Imports Class-Imports)
- (function (_ [short-name [_ meta _]] imports)
+ (function (_ [short-name [_ _ meta _]] imports)
(case (macro.get-text-ann (name-of #..jvm-class) meta)
(#.Some full-class-name)
(add-import [short-name full-class-name] imports)
diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux
index 833af5656..23d1223e4 100644
--- a/stdlib/source/lux/macro.lux
+++ b/stdlib/source/lux/macro.lux
@@ -201,7 +201,6 @@
(-> Code Bit)
(flag-set? (name-of <tag>)))]
- [export? #.export? "exported"]
[structure? #.struct? "a structure"]
[recursive-type? #.type-rec? "a recursive type"]
[signature? #.sig? "a signature"]
@@ -258,7 +257,7 @@
(Maybe Macro))
(do maybe.monad
[$module (get module modules)
- [def-type def-anns def-value] (: (Maybe Definition) (|> (: Module $module) (get@ #.definitions) (get name)))]
+ [exported? def-type def-anns def-value] (: (Maybe Definition) (|> (: Module $module) (get@ #.definitions) (get name)))]
(if (macro-type? def-type)
(#.Some (:coerce Macro def-value))
(case (get-identifier-ann (name-of #.alias) def-anns)
@@ -534,7 +533,7 @@
{#.doc "Looks-up a definition's type in the available modules (including the current one)."}
(-> Name (Meta Type))
(do ..monad
- [[def-type def-data def-value] (find-def name)]
+ [[exported? def-type def-data def-value] (find-def name)]
(clean-type def-type)))
(def: #export (find-type name)
@@ -554,7 +553,7 @@
{#.doc "Finds the value of a type definition (such as Int, Any or Lux)."}
(-> Name (Meta Type))
(do ..monad
- [[def-type def-data def-value] (find-def name)]
+ [[exported? def-type def-data def-value] (find-def name)]
(wrap (:coerce Type def-value))))
(def: #export (definitions module-name)
@@ -571,8 +570,8 @@
(-> Text (Meta (List [Text Definition])))
(do ..monad
[definitions (definitions module-name)]
- (wrap (list.filter (function (_ [name [def-type def-anns def-value]])
- (export? def-anns))
+ (wrap (list.filter (function (_ [name [exported? def-type def-anns def-value]])
+ exported?)
definitions))))
(def: #export modules
@@ -690,7 +689,7 @@
{#.doc "Given an aliased definition's name, returns the original definition being referenced."}
(-> Name (Meta Name))
(do ..monad
- [[_ def-anns _] (find-def def-name)]
+ [[_ _ def-anns _] (find-def def-name)]
(case (get-identifier-ann (name-of #.alias) def-anns)
(#.Some real-def-name)
(wrap real-def-name)
diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
index 4ffa673fc..a484eaebb 100644
--- a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
+++ b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux
@@ -30,7 +30,7 @@
(-> Name (Operation Analysis))
(with-expansions [<return> (wrap (|> def-name ////reference.constant #/.Reference))]
(do ///.monad
- [[actualT def-anns _] (///extension.lift (macro.find-def def-name))]
+ [[exported? actualT def-anns _] (///extension.lift (macro.find-def def-name))]
(case (macro.get-identifier-ann (name-of #.alias) def-anns)
(#.Some real-def-name)
(definition real-def-name)
@@ -42,7 +42,7 @@
current (///extension.lift macro.current-module-name)]
(if (text@= current ::module)
<return>
- (if (macro.export? def-anns)
+ (if exported?
(do @
[imported! (///extension.lift (macro.imported-by? ::module current))]
(if imported!
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
index 623019971..2b17c9f8a 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
@@ -130,7 +130,7 @@
(-> Expander Handler)
(function (_ extension-name phase inputsC+)
(case inputsC+
- (^ (list [_ (#.Identifier ["" short-name])] valueC annotationsC))
+ (^ (list [_ (#.Identifier ["" short-name])] valueC annotationsC [_ (#.Bit exported?)]))
(do ///.monad
[current-module (////statement.lift-analysis
(//.lift macro.current-module-name))
@@ -139,7 +139,7 @@
#let [annotations (:coerce Code annotations)]
[type valueT valueN value] (..definition full-name #.None valueC)
_ (////statement.lift-analysis
- (module.define short-name [type annotations value]))
+ (module.define short-name [exported? type annotations value]))
#let [_ (log! (format "Definition " (%name full-name)))]
_ (////statement.lift-generation
(///generation.learn full-name valueN))
@@ -168,8 +168,8 @@
(def: (def::type-tagged expander)
(-> Expander Handler)
(..custom
- [($_ p.and s.local-identifier s.any s.any (s.tuple (p.some s.text)))
- (function (_ extension-name phase [short-name valueC annotationsC tags])
+ [($_ p.and s.local-identifier s.any s.any (s.tuple (p.some s.text)) s.bit)
+ (function (_ extension-name phase [short-name valueC annotationsC tags exported?])
(do ///.monad
[current-module (////statement.lift-analysis
(//.lift macro.current-module-name))
@@ -179,8 +179,8 @@
[type valueT valueN value] (..definition full-name (#.Some .Type) valueC)
_ (////statement.lift-analysis
(do ///.monad
- [_ (module.define short-name [type annotations value])]
- (module.declare-tags tags (macro.export? annotations) (:coerce Type value))))
+ [_ (module.define short-name [exported? type annotations value])]
+ (module.declare-tags tags exported? (:coerce Type value))))
#let [_ (log! (format "Definition " (%name full-name)))]
_ (////statement.lift-generation
(///generation.learn full-name valueN))
@@ -223,9 +223,10 @@
(def: (define-alias alias original)
(-> Text Name (////analysis.Operation Any))
(do ///.monad
- [[original-type original-annotations original-value]
+ [[exported? original-type original-annotations original-value]
(//.lift (macro.find-def original))]
- (module.define alias [original-type
+ (module.define alias [false
+ original-type
(alias-annotations original)
original-value])))
diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux
index 7c5804e04..70ec590da 100644
--- a/stdlib/source/lux/type/abstract.lux
+++ b/stdlib/source/lux/type/abstract.lux
@@ -33,7 +33,7 @@
(template: (!peek <source> <reference> <then>)
(loop [entries <source>]
(case entries
- (#.Cons [head-name head-content] tail)
+ (#.Cons [head-name head] tail)
(if (text;= <reference> head-name)
<then>
(recur tail))
@@ -44,13 +44,13 @@
(def: (peek-scopes-definition reference source)
(-> Text (List [Text Definition]) (Stack Scope))
(!peek source reference
- (let [[scope-type scope-anns scope-value] head-content]
+ (let [[exported? scope-type scope-anns scope-value] head]
(:coerce (Stack Scope) scope-value))))
(def: (peek-scopes reference definition-reference source)
(-> Text Text (List [Text Module]) (Stack Scope))
(!peek source reference
- (peek-scopes-definition definition-reference (get@ #.definitions head-content))))
+ (peek-scopes-definition definition-reference (get@ #.definitions head))))
(exception: #export (no-active-scopes)
"")
@@ -77,11 +77,11 @@
(template: (!push <source> <reference> <then>)
(loop [entries <source>]
(case entries
- (#.Cons [head-name head-content] tail)
+ (#.Cons [head-name head] tail)
(if (text;= <reference> head-name)
(#.Cons [head-name <then>]
tail)
- (#.Cons [head-name head-content]
+ (#.Cons [head-name head]
(recur tail)))
#.Nil
@@ -90,15 +90,16 @@
(def: (push-scope-definition reference scope source)
(-> Text Scope (List [Text Definition]) (List [Text Definition]))
(!push source reference
- (let [[scopes-type scopes-anns scopes-value] head-content]
- [scopes-type
+ (let [[exported? scopes-type scopes-anns scopes-value] head]
+ [exported?
+ scopes-type
scopes-anns
(stack.push scope (:coerce (Stack Scope) scopes-value))])))
(def: (push-scope [module-reference definition-reference] scope source)
(-> Name Scope (List [Text Module]) (List [Text Module]))
(!push source module-reference
- (|> head-content (update@ #.definitions (push-scope-definition definition-reference scope)))))
+ (|> head (update@ #.definitions (push-scope-definition definition-reference scope)))))
(def: (push! scope)
(-> Scope (Meta Any))
@@ -111,8 +112,9 @@
(def: (pop-scope-definition reference source)
(-> Text (List [Text Definition]) (List [Text Definition]))
(!push source reference
- (let [[scopes-type scopes-anns scopes-value] head-content]
- [scopes-type
+ (let [[exported? scopes-type scopes-anns scopes-value] head]
+ [exported?
+ scopes-type
scopes-anns
(let [current-scopes (:coerce (Stack Scope) scopes-value)]
(case (stack.pop current-scopes)
@@ -125,7 +127,7 @@
(def: (pop-scope [module-reference definition-reference] source)
(-> Name (List [Text Module]) (List [Text Module]))
(!push source module-reference
- (|> head-content (update@ #.definitions (pop-scope-definition definition-reference)))))
+ (|> head (update@ #.definitions (pop-scope-definition definition-reference)))))
(syntax: (pop!)
(function (_ compiler)
diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux
index 5e72b7a79..90fd32c1c 100644
--- a/stdlib/source/lux/type/implicit.lux
+++ b/stdlib/source/lux/type/implicit.lux
@@ -114,9 +114,9 @@
(def: (prepare-definitions this-module-name definitions)
(-> Text (List [Text Definition]) (List [Name Type]))
(|> definitions
- (list.filter (function (_ [name [def-type def-anns def-value]])
+ (list.filter (function (_ [name [exported? def-type def-anns def-value]])
(macro.structure? def-anns)))
- (list@map (function (_ [name [def-type def-anns def-value]])
+ (list@map (function (_ [name [exported? def-type def-anns def-value]])
[[this-module-name name] def-type]))))
(def: local-env
diff --git a/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux
index 7356b9fad..5d8782a4f 100644
--- a/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux
+++ b/stdlib/source/test/lux/tool/compiler/phase/analysis/reference.lux
@@ -46,11 +46,7 @@
(-> Text [Bit Text] [Bit Text] Check Bit)
(|> (do ///.monad
[_ (//module.with-module 0 def-module
- (//module.define var-name [Any
- (if export?
- (' {#.export? #1})
- (' {}))
- []]))]
+ (//module.define var-name [export? Any (' {}) []]))]
(//module.with-module 0 dependent-module
(do @
[_ (if import?
@@ -86,7 +82,7 @@
(_.test "Can analyse definition (in the same module)."
(let [def-name [def-module var-name]]
(|> (do ///.monad
- [_ (//module.define var-name [expectedT (' {}) []])]
+ [_ (//module.define var-name [false expectedT (' {}) []])]
(//type.with-inference
(_primitive.phase (code.identifier def-name))))
(//module.with-module 0 def-module)