aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--documentation/bookmark/business/funding/bootstrapping.md5
-rw-r--r--documentation/bookmark/business/innovation.md5
-rw-r--r--documentation/bookmark/business/productivity.md1
-rw-r--r--documentation/bookmark/business/user_story.md5
-rw-r--r--documentation/bookmark/censorship.md5
-rw-r--r--documentation/bookmark/comment.md5
-rw-r--r--documentation/bookmark/communication.md5
-rw-r--r--documentation/bookmark/compilation/target/js__javascript.md1
-rw-r--r--documentation/bookmark/data/structure/bitmap.md2
-rw-r--r--documentation/bookmark/data/structure/succinct.md5
-rw-r--r--documentation/bookmark/database.md1
-rw-r--r--documentation/bookmark/design.md1
-rw-r--r--documentation/bookmark/drone.md5
-rw-r--r--documentation/bookmark/email.md6
-rw-r--r--documentation/bookmark/game/design.md1
-rw-r--r--documentation/bookmark/graphic/3d/rendering/engine.md5
-rw-r--r--documentation/bookmark/memory_management.md1
-rw-r--r--documentation/bookmark/music.md4
-rw-r--r--documentation/bookmark/music/acoustics.md5
-rw-r--r--documentation/bookmark/open_source/funding.md1
-rw-r--r--documentation/bookmark/software/engineering.md1
-rw-r--r--documentation/bookmark/work/async.md5
-rw-r--r--lux-bootstrapper/src/lux/analyser.clj8
-rw-r--r--lux-bootstrapper/src/lux/analyser/lux.clj30
-rw-r--r--lux-bootstrapper/src/lux/analyser/module.clj47
-rw-r--r--lux-bootstrapper/src/lux/compiler/core.clj4
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm.clj2
-rw-r--r--lux-bootstrapper/src/lux/compiler/jvm/lux.clj2
-rw-r--r--stdlib/source/library/lux.lux47
-rw-r--r--stdlib/source/library/lux/control/aspect.lux46
-rw-r--r--stdlib/source/library/lux/data/format/css.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css/font.lux2
-rw-r--r--stdlib/source/library/lux/data/format/css/property.lux7
-rw-r--r--stdlib/source/library/lux/data/format/css/query.lux4
-rw-r--r--stdlib/source/library/lux/data/format/css/selector.lux7
-rw-r--r--stdlib/source/library/lux/data/format/css/style.lux2
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux4
-rw-r--r--stdlib/source/library/lux/data/format/html.lux28
-rw-r--r--stdlib/source/library/lux/documentation.lux2
-rw-r--r--stdlib/source/library/lux/meta.lux127
-rw-r--r--stdlib/source/library/lux/meta/compiler/default/init.lux6
-rw-r--r--stdlib/source/library/lux/meta/compiler/default/platform.lux8
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux.lux7
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux17
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux56
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux91
-rw-r--r--stdlib/source/library/lux/meta/compiler/meta/io/archive.lux11
-rw-r--r--stdlib/source/library/lux/meta/global.lux2
-rw-r--r--stdlib/source/library/lux/meta/macro/context.lux22
-rw-r--r--stdlib/source/library/lux/meta/macro/local.lux8
-rw-r--r--stdlib/source/library/lux/meta/macro/vocabulary.lux2
-rw-r--r--stdlib/source/library/lux/meta/type/implicit.lux8
-rw-r--r--stdlib/source/library/lux/world/net/http.lux10
-rw-r--r--stdlib/source/library/lux/world/net/http/client.lux7
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux12
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux88
-rw-r--r--stdlib/source/test/lux/data/color/named.lux9
-rw-r--r--stdlib/source/test/lux/meta/type/resource.lux2
-rw-r--r--stdlib/source/test/lux/meta/type/row.lux56
-rw-r--r--stdlib/source/test/lux/world/net.lux4
-rw-r--r--stdlib/source/test/lux/world/net/http/client.lux3
-rw-r--r--stdlib/source/test/lux/world/net/http/response.lux189
-rw-r--r--stdlib/source/test/lux/world/net/http/status.lux21
64 files changed, 727 insertions, 374 deletions
diff --git a/documentation/bookmark/business/funding/bootstrapping.md b/documentation/bookmark/business/funding/bootstrapping.md
new file mode 100644
index 000000000..47a570c10
--- /dev/null
+++ b/documentation/bookmark/business/funding/bootstrapping.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [The Bootstrap Movement](https://www.bootstrap.company/)
+
diff --git a/documentation/bookmark/business/innovation.md b/documentation/bookmark/business/innovation.md
new file mode 100644
index 000000000..98226720d
--- /dev/null
+++ b/documentation/bookmark/business/innovation.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [When First Movers Are Rewarded, and When They’re Not](https://hbr.org/2015/08/when-first-movers-are-rewarded-and-when-theyre-not)
+
diff --git a/documentation/bookmark/business/productivity.md b/documentation/bookmark/business/productivity.md
index 76c8acb01..0a14620ad 100644
--- a/documentation/bookmark/business/productivity.md
+++ b/documentation/bookmark/business/productivity.md
@@ -1,6 +1,7 @@
# Reference
0. []()
+0. [Rockstar Developers Are THE WORST Developers](https://www.youtube.com/watch?v=mVY2rFninp8)
0. [Let it slide](https://world.hey.com/dhh/let-it-slide-9e40f11a)
0. [Tips for effective engineering](https://budelewski.com/effective-engineering/)
0. [1. Unfolding the interrelationship diagram](https://world.hey.com/rjs/1-unfolding-the-interrelationship-diagram-5a79e3fc)
diff --git a/documentation/bookmark/business/user_story.md b/documentation/bookmark/business/user_story.md
new file mode 100644
index 000000000..e208a96a1
--- /dev/null
+++ b/documentation/bookmark/business/user_story.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Why user stories belong in the garbage](https://www.browserlondon.com/blog/2022/08/30/why-user-stories-belong-in-the-garbage/)
+
diff --git a/documentation/bookmark/censorship.md b/documentation/bookmark/censorship.md
new file mode 100644
index 000000000..e4457f0d3
--- /dev/null
+++ b/documentation/bookmark/censorship.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Avoid Nightmares — NSFW JS: Client-side indecent content checking for the soul](https://shift.infinite.red/avoid-nightmares-nsfw-js-ab7b176978b1)
+
diff --git a/documentation/bookmark/comment.md b/documentation/bookmark/comment.md
new file mode 100644
index 000000000..b390b0fe7
--- /dev/null
+++ b/documentation/bookmark/comment.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Your syntax highlighter is wrong](https://jameshfisher.com/2014/05/11/your-syntax-highlighter-is-wrong/)
+
diff --git a/documentation/bookmark/communication.md b/documentation/bookmark/communication.md
new file mode 100644
index 000000000..9b1d5b7a1
--- /dev/null
+++ b/documentation/bookmark/communication.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Don’t sound weak. Use negations](https://tips.ariyh.com/p/negations-increase-engagement?triedSigningIn=true)
+
diff --git a/documentation/bookmark/compilation/target/js__javascript.md b/documentation/bookmark/compilation/target/js__javascript.md
index ea50f7f79..147ab0e0e 100644
--- a/documentation/bookmark/compilation/target/js__javascript.md
+++ b/documentation/bookmark/compilation/target/js__javascript.md
@@ -1,6 +1,7 @@
# Reference
0. []()
+0. [The Modern Guide to Packaging your JavaScript library](https://github.com/frehner/modern-guide-to-packaging-js-library)
0. [Optimizing for JavaScript is hard](https://jfmengels.net/optimizing-javascript-is-hard/)
0. [Roll your own JavaScript runtime](https://deno.com/blog/roll-your-own-javascript-runtime)
0. [How JavaScript Array Works Internally?](https://blog.gauravthakur.in/how-javascript-array-works-internally)
diff --git a/documentation/bookmark/data/structure/bitmap.md b/documentation/bookmark/data/structure/bitmap.md
index d7a494752..477224e5f 100644
--- a/documentation/bookmark/data/structure/bitmap.md
+++ b/documentation/bookmark/data/structure/bitmap.md
@@ -1,4 +1,6 @@
# Reference
+0. []()
+0. [A primer on Roaring bitmaps: what they are and how they work](https://vikramoberoi.com/a-primer-on-roaring-bitmaps-what-they-are-and-how-they-work/)
0. [Roaring Bitmaps](https://roaringbitmap.org/)
diff --git a/documentation/bookmark/data/structure/succinct.md b/documentation/bookmark/data/structure/succinct.md
new file mode 100644
index 000000000..fe4549ceb
--- /dev/null
+++ b/documentation/bookmark/data/structure/succinct.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [SDSL - Succinct Data Structure Library](https://github.com/simongog/sdsl-lite)
+
diff --git a/documentation/bookmark/database.md b/documentation/bookmark/database.md
index 83dfd0387..5a352e9b8 100644
--- a/documentation/bookmark/database.md
+++ b/documentation/bookmark/database.md
@@ -148,6 +148,7 @@
## General
0. []()
+0. [Velox: Meta’s Unified Execution Engine](https://research.facebook.com/publications/velox-metas-unified-execution-engine/)
0. [Skytable](https://skytable.io/)
0. https://github.com/Workiva/eva/
0. https://learndb.net/
diff --git a/documentation/bookmark/design.md b/documentation/bookmark/design.md
index 8e441f11b..0f6c09c6d 100644
--- a/documentation/bookmark/design.md
+++ b/documentation/bookmark/design.md
@@ -1,6 +1,7 @@
# Reference
0. []()
+0. [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/guidelines/overview/)
0. [Humanizing Application Building: An Anthropological Perspective](http://melconway.com/Home/pdf/humanize.pdf)
0. [Banner blindness](https://en.wikipedia.org/wiki/Banner_blindness)
diff --git a/documentation/bookmark/drone.md b/documentation/bookmark/drone.md
new file mode 100644
index 000000000..569f53fe7
--- /dev/null
+++ b/documentation/bookmark/drone.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [ArduPilot](https://ardupilot.org/)
+
diff --git a/documentation/bookmark/email.md b/documentation/bookmark/email.md
new file mode 100644
index 000000000..1d19d9187
--- /dev/null
+++ b/documentation/bookmark/email.md
@@ -0,0 +1,6 @@
+# Reference
+
+0. []()
+0. [Falsehoods programmers believe about email](https://beesbuzz.biz/code/439-Falsehoods-programmers-believe-about-email)
+0. [email is bad](https://emailisbad.com/)
+
diff --git a/documentation/bookmark/game/design.md b/documentation/bookmark/game/design.md
index 05d3d9abb..fdb3eb4d3 100644
--- a/documentation/bookmark/game/design.md
+++ b/documentation/bookmark/game/design.md
@@ -1,5 +1,6 @@
# Reference
0. []()
+0. [Creating a system of game play notation](https://lostgarden.home.blog/2006/01/16/creating-a-system-of-game-play-notation/)
0. [How to design an Abstract Strategy Board Game *Top 10 Mechanisms*](https://www.youtube.com/watch?v=fBWDfXE9xsU)
diff --git a/documentation/bookmark/graphic/3d/rendering/engine.md b/documentation/bookmark/graphic/3d/rendering/engine.md
new file mode 100644
index 000000000..6f40ec134
--- /dev/null
+++ b/documentation/bookmark/graphic/3d/rendering/engine.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [babylon.js](https://www.babylonjs.com/)
+
diff --git a/documentation/bookmark/memory_management.md b/documentation/bookmark/memory_management.md
index 84acecd98..b2fc9250e 100644
--- a/documentation/bookmark/memory_management.md
+++ b/documentation/bookmark/memory_management.md
@@ -6,6 +6,7 @@
# Allocation
0. []()
+0. [malloc() and free() are a bad API](https://www.foonathan.net/2022/08/malloc-interface/#content)
0. [How to allocate memory](https://geocar.sdf1.org/alloc.html)
0. [Always Bump Downwards](https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html)
diff --git a/documentation/bookmark/music.md b/documentation/bookmark/music.md
index 5a3489baf..0ed758c70 100644
--- a/documentation/bookmark/music.md
+++ b/documentation/bookmark/music.md
@@ -1,12 +1,16 @@
# Analysis
+0. []()
0. [Three Types of Music Analysis](https://flujoo.github.io/en/three-types-of-music-analysis/)
# Async music
+0. []()
0. [async music](https://async.art/music)
# Reference
+0. []()
+0. [Why 12 notes?](https://github.com/aguaviva/articles/blob/main/why_12_notes.ipynb)
0. [Open Music Theory](http://openmusictheory.com/)
diff --git a/documentation/bookmark/music/acoustics.md b/documentation/bookmark/music/acoustics.md
new file mode 100644
index 000000000..8bf1c91bb
--- /dev/null
+++ b/documentation/bookmark/music/acoustics.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [Why You Hear What You Hear](https://www.whyyouhearwhatyouhear.com/)
+
diff --git a/documentation/bookmark/open_source/funding.md b/documentation/bookmark/open_source/funding.md
index bb9e3e5d2..aa581e75f 100644
--- a/documentation/bookmark/open_source/funding.md
+++ b/documentation/bookmark/open_source/funding.md
@@ -1,6 +1,7 @@
# Reference
0. []()
+0. [OpenFare](https://github.com/openfare/openfare)
0. [Openpod: Investable Tokens for Open Source Projects](https://www.openpod.io/)
0. [The NEO way to finance collaborative and FOSS projects](https://medium.com/@meriteconomy/the-neo-way-to-finance-collaborative-and-foss-projects-7966dfeac0ce)
0. [Comradery](https://comradery.co/)
diff --git a/documentation/bookmark/software/engineering.md b/documentation/bookmark/software/engineering.md
index 8aedec13c..87d4f2c4d 100644
--- a/documentation/bookmark/software/engineering.md
+++ b/documentation/bookmark/software/engineering.md
@@ -1,5 +1,6 @@
# Reference
0. []()
+0. [Evidence-based Software Engineering](http://www.knosof.co.uk/ESEUR/)
0. [Thinking About the Costs of a Software Feature](https://weblogs.asp.net/rweigelt/thinking-about-the-costs-of-a-software-feature)
diff --git a/documentation/bookmark/work/async.md b/documentation/bookmark/work/async.md
new file mode 100644
index 000000000..6a5d35330
--- /dev/null
+++ b/documentation/bookmark/work/async.md
@@ -0,0 +1,5 @@
+# Reference
+
+0. []()
+0. [The next frontier after remote work is async](https://levels.io/async/)
+
diff --git a/lux-bootstrapper/src/lux/analyser.clj b/lux-bootstrapper/src/lux/analyser.clj
index 32d6a0e58..0e7b4b48a 100644
--- a/lux-bootstrapper/src/lux/analyser.clj
+++ b/lux-bootstrapper/src/lux/analyser.clj
@@ -98,14 +98,6 @@
(&/with-location location
(&&lux/analyse-def analyse optimize eval! compile-def ?name ?value exported?)))
- (&/$Identifier "library/lux" "alias#")
- (|let [(&/$Item [_ (&/$Identifier "" ?alias)]
- (&/$Item [_ (&/$Identifier ?original)]
- (&/$End)
- )) parameters]
- (&/with-location location
- (&&lux/analyse-def-alias ?alias ?original)))
-
(&/$Identifier "library/lux" "module#")
(|let [(&/$Item ?imports (&/$End)) parameters]
(&/with-location location
diff --git a/lux-bootstrapper/src/lux/analyser/lux.clj b/lux-bootstrapper/src/lux/analyser/lux.clj
index d28a92051..64238bc62 100644
--- a/lux-bootstrapper/src/lux/analyser/lux.clj
+++ b/lux-bootstrapper/src/lux/analyser/lux.clj
@@ -290,7 +290,7 @@
(analyse-tuple analyse (&/$Right exo-type) ?elems))))
(defn ^:private analyse-global [analyse exo-type quoted_module module name]
- (|do [[[r-module r-name] [exported? endo-type ?value]] (&&module/find-def quoted_module module name)
+ (|do [[[r-module r-name] [exported? [endo-type ?value]]] (&&module/find-def quoted_module module name)
;; This is a small shortcut to optimize analysis of typing code.
_ (if (and (&type/type= &type/Type endo-type)
(&type/type= &type/Type exo-type))
@@ -403,7 +403,7 @@
(defn analyse-apply [analyse location exo-type macro-caller =fn ?args]
(|case =fn
[_ (&&/$def ?module ?name)]
- (|do [[real-name [exported? ?type ?value]] (&&module/find-def! ?module ?name)]
+ (|do [[real-name [exported? [?type ?value]]] (&&module/find-def! ?module ?name)]
(if (&type/type= &type/Macro ?type)
(|do [macro-expansion (fn [state]
(|case (macro-caller ?value ?args state)
@@ -592,27 +592,29 @@
(&/with-expected-type ?expected-type
(&&/analyse-1 analyse ?expected-type ?value))
(&&/analyse-1+ analyse ?value))))
+ :let [aliased (|case =value
+ [_ (&&/$def ?original)]
+ ?original
+
+ _
+ nil)]
==exported? (eval analyse optimize eval! &type/Bit exported?)
- def-value (compile-def ?name (optimize =value) ==exported?)
+ def-value (if aliased
+ (&/without-repl-closure
+ (&&module/define-alias module-name ?name ==exported? aliased))
+ (compile-def ?name (optimize =value) ==exported?))
_ &type/reset-mappings
:let [def-type (&&/expr-type* =value)
- _ (println 'DEF (str module-name &/+name-separator+ ?name
- " : " (&type/show-type def-type)))]]
+ _ (if aliased
+ nil
+ (println 'DEF (str module-name &/+name-separator+ ?name
+ " : " (&type/show-type def-type))))]]
(return (&/T [module-name def-type def-value ==exported?]))))
(defn analyse-def [analyse optimize eval! compile-def ?name ?value exported?]
(|do [_ (analyse-def* analyse optimize eval! compile-def ?name ?value exported?)]
(return &/$End)))
-(defn analyse-def-alias [?alias ?original]
- (|let [[r-module r-name] ?original]
- (|do [module-name &/get-module-name
- _ (ensure-undefined! module-name ?alias)
- _ (&&module/find-def "" r-module r-name)
- _ (&/without-repl-closure
- (&&module/define-alias module-name ?alias ?original))]
- (return &/$End))))
-
(defn ^:private merge-module-states
"(-> Host Host Host)"
[new old]
diff --git a/lux-bootstrapper/src/lux/analyser/module.clj b/lux-bootstrapper/src/lux/analyser/module.clj
index 426d0bfb6..048734766 100644
--- a/lux-bootstrapper/src/lux/analyser/module.clj
+++ b/lux-bootstrapper/src/lux/analyser/module.clj
@@ -103,10 +103,10 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|case $def
- (&/$AliasG [o-module o-name])
+ [exported? (&/$AliasG [o-module o-name])]
((type-def o-module o-name) state)
- (&/$DefinitionG [exported? ?type ?value])
+ [exported? (&/$DefinitionG [?type ?value])]
(if (&type/type= &type/Type ?type)
(return* state (&/T [exported? ?value]))
((&/fail-with-loc (str "[Analyser Error] Not a type: " (&/ident->text (&/T [module name]))))
@@ -165,12 +165,13 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|case $def
- (&/$AliasG [?r-module ?r-name])
+ [exported? (&/$AliasG [?r-module ?r-name])]
((find-def! ?r-module ?r-name)
state)
- (&/$DefinitionG $def*)
- (return* state (&/T [(&/T [module name]) $def*])))
+ [exported? (&/$DefinitionG $def*)]
+ (return* state (&/T [(&/T [module name])
+ (&/T [exported? $def*])])))
((&/fail-with-loc (str "[Analyser Error @ find-def!] Definition does not exist: " (&/ident->text (&/T [module name]))
" at module: " (pr-str current-module)))
state))
@@ -185,23 +186,21 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|case $def
- (&/$AliasG [?r-module ?r-name])
- (if (.equals ^Object current-module module)
- ((find-def! ?r-module ?r-name)
- state)
- ((&/fail-with-loc (str "[Analyser Error @ find-def] Cannot use (private) alias: " (str module &/+name-separator+ name)
- " at module: " current-module))
- state))
-
- (&/$DefinitionG [exported? ?type ?value])
+ [exported? $def*]
(if (or (.equals ^Object current-module module)
(and exported?
(or (.equals ^Object &/prelude module)
(.equals ^Object quoted_module module)
(imports? state module current-module))))
- (return* state (&/T [(&/T [module name])
- (&/T [exported? ?type ?value])]))
- ((&/fail-with-loc (str "[Analyser Error @ find-def] Cannot use private definition: " (str module &/+name-separator+ name)
+ (|case $def*
+ (&/$AliasG [?r-module ?r-name])
+ ((find-def! ?r-module ?r-name)
+ state)
+
+ (&/$DefinitionG [?type ?value])
+ (return* state (&/T [(&/T [module name])
+ (&/T [exported? (&/T [?type ?value])])])))
+ ((&/fail-with-loc (str "[Analyser Error @ find-def] Cannot use private global: " (str module &/+name-separator+ name)
" at module: " current-module))
state)))
((&/fail-with-loc (str "[Analyser Error @ find-def] Definition does not exist: " (str module &/+name-separator+ name)
@@ -217,8 +216,8 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|case $def
- (&/$AliasG [?r-module ?r-name]) (return* state $def)
- (&/$DefinitionG _) (return* state $def))
+ [exported? (&/$AliasG [?r-module ?r-name])] (return* state $def)
+ [exported? (&/$DefinitionG _)] (return* state $def))
((&/fail-with-loc (str "[Analyser Error @ find-def] Global does not exist: " (str module &/+name-separator+ name)
" at module: " current-module))
state))
@@ -269,7 +268,7 @@
(if-let [$module (->> state (&/get$ &/$modules) (&/|get module))]
(if-let [$def (->> $module (&/get$ $defs) (&/|get name))]
(|case $def
- (&/$AliasG [?r-module ?r-name])
+ [exported? (&/$AliasG [?r-module ?r-name])]
(if (.equals ^Object current-module module)
((<find!> ?r-module ?r-name)
state)
@@ -278,7 +277,7 @@
" @ " (quote <find>)))
state))
- (&/$DefinitionG [exported? ?type ?value])
+ [exported? (&/$DefinitionG [?type ?value])]
(if (or (.equals ^Object current-module module)
exported?)
(if (&type/type= <definition_type> ?type)
@@ -355,7 +354,7 @@
(return (&/T [_module _hash]))))
_imports)))
-(defn define-alias [module name de-aliased]
+(defn define-alias [module name exported? de-aliased]
(if_not_defined
module name
(fn [state]
@@ -367,7 +366,7 @@
(&/|update module
(fn [m]
(&/update$ $defs
- #(&/|put name (&/$AliasG de-aliased) %)
+ #(&/|put name (&/T [exported? (&/$AliasG de-aliased)]) %)
m))
ms))))
nil)
@@ -388,7 +387,7 @@
(&/|update module
(fn [m]
(&/update$ $defs
- #(&/|put name (&/$DefinitionG (&/T [exported? def-type def-value])) %)
+ #(&/|put name (&/T [exported? (&/$DefinitionG (&/T [def-type def-value]))]) %)
m))
ms))))
nil)
diff --git a/lux-bootstrapper/src/lux/compiler/core.clj b/lux-bootstrapper/src/lux/compiler/core.clj
index f3fefdc74..07cd8c759 100644
--- a/lux-bootstrapper/src/lux/compiler/core.clj
+++ b/lux-bootstrapper/src/lux/compiler/core.clj
@@ -46,7 +46,7 @@
defs &a-module/defs
imports &a-module/imports
:let [def-entries (&/fold (fn [def-entries _def]
- (|let [[?name _definition] _def]
+ (|let [[?name [exported? _definition]] _def]
(|case _definition
(&/$AliasG [_dmodule _dname])
(str "A"
@@ -55,7 +55,7 @@
;; Next
entry-separator def-entries)
- (&/$DefinitionG [exported? ?def-type ?def-value])
+ (&/$DefinitionG [?def-type ?def-value])
(str "D"
datum-separator ?name
datum-separator (if exported? "1" "0")
diff --git a/lux-bootstrapper/src/lux/compiler/jvm.clj b/lux-bootstrapper/src/lux/compiler/jvm.clj
index fcccfec9e..717f75a16 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm.clj
@@ -251,7 +251,7 @@
&&jvm-cache/uninstall-all-defs-in-module)
_ (compile-module source-dirs &/prelude nil)]
(compile-module source-dirs program-module
- (|do [[de_aliased_symbol [exported? actual-type ?value]] (&a-module/find-def "" program-module program-definition)
+ (|do [[de_aliased_symbol [exported? [actual-type ?value]]] (&a-module/find-def "" program-module program-definition)
_ (&type/check program-type actual-type)
here &/location]
(&&lux/compile-program (partial compile-expression nil)
diff --git a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
index eabda4265..0eedf22bd 100644
--- a/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
+++ b/lux-bootstrapper/src/lux/compiler/jvm/lux.clj
@@ -119,7 +119,7 @@
(defn compile-apply [compile ?fn ?args]
(|case ?fn
[_ (&o/$def ?module ?name)]
- (|do [[_ [_ _ func-obj]] (&a-module/find-def! ?module ?name)
+ (|do [[_ [_ [_ func-obj]]] (&a-module/find-def! ?module ?name)
class-loader &/loader
:let [func-class (class func-obj)
func-arity (.get ^Field (.getDeclaredField func-class &&/arity-field) nil)
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 0be0527c4..d8ef5fd2f 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -489,11 +489,11 @@
#0)
... (type .public Definition
-... [Bit Type Any])
+... [Type Any])
(.def# Definition
(.is# Type
{#Named [..prelude "Definition"]
- {#Product Bit {#Product Type Any}}})
+ {#Product Type Any}})
.public)
... (type .public Default
@@ -692,7 +692,7 @@
... (Record
... [#module_hash Nat
... #module_aliases (List [Text Text])
-... #definitions (List [Text Global])
+... #definitions (List [Text [Bit Global]])
... #imports (List Text)
... #module_state Module_State]))
(.def# Module
@@ -706,7 +706,7 @@
{#Apply {#Product Text Text} List}
{#Product
... definitions
- {#Apply {#Product Text Global} List}
+ {#Apply {#Product Text {#Product Bit Global}} List}
{#Product
... imports
{#Apply Text List}
@@ -1841,7 +1841,7 @@
..#seed seed ..#expected expected ..#location location ..#extensions extensions
..#scope_type_vars scope_type_vars ..#eval _eval] state]
({{#Some [..#module_hash _ ..#module_aliases _ ..#definitions definitions ..#imports _ ..#module_state _]}
- ({{#Some constant}
+ ({{#Some [_ constant]}
({{#Definition _}
{#Right [state full_name]}
@@ -1972,11 +1972,11 @@
({{#None}
{#Left (text#composite "Unknown definition: " (symbol#encoded name))}
- {#Some definition}
+ {#Some [exported? definition]}
({{#Alias real_name}
(definition_value real_name state)
- {#Definition [exported? def_type def_value]}
+ {#Definition [def_type def_value]}
(if (available? expected_module current_module exported?)
{#Right [state [def_type def_value]]}
{#Left (text#composite "Unavailable definition: " (symbol#encoded name))})
@@ -2637,12 +2637,13 @@
($ Maybe Macro))
(do maybe#monad
[$module (property#value module modules)
- gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] (.is# Module $module)]
- (property#value name bindings))]
+ exported?,gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] (.is# Module $module)]
+ (property#value name bindings))
+ .let' [[exported? gdef] exported?,gdef]]
({{#Alias [r_module r_name]}
(named_macro' modules current_module r_module r_name)
- {#Definition [exported? def_type def_value]}
+ {#Definition [def_type def_value]}
(if (macro_type? def_type)
(if exported?
{#Some (.as# Macro def_value)}
@@ -3889,7 +3890,7 @@
..#imports _
..#module_state _] =module]]
(when (property#value name definitions)
- {#Some {#Definition [exported type value]}}
+ {#Some [exported {#Definition [type value]}]}
(meta#in [exported (as Label value)])
_
@@ -3905,13 +3906,13 @@
..#definitions definitions
..#imports _
..#module_state _] module]]
- (in ((is (-> (List [Text Global])
+ (in ((is (-> (List [Text [Bit Global]])
(Maybe (List Symbol)))
(function (again remaining)
(when remaining
{#Item [slot head] tail}
(when head
- {#Definition [exported? type value]}
+ [exported? {#Definition [type value]}]
(if (and (type#= Slot type)
(or exported?
(text#= expected_module actual_module)))
@@ -3954,7 +3955,7 @@
..#imports _
..#module_state _] =module]]
(when (property#value name definitions)
- {#Some {#Definition [exported? type value]}}
+ {#Some [exported? {#Definition [type value]}]}
(if (type#= Type type)
(do meta#monad
[slots (slot_family module (as Type value))]
@@ -4470,14 +4471,16 @@
[current_module modules])]
(when (property#value module modules)
{#Some =module}
- (let [to_alias (list#each (is (-> [Text Global]
+ (let [to_alias (list#each (is (-> [Text [Bit Global]]
(List Text))
- (function (_ [name definition])
+ (function (_ [name [exported? definition]])
(when definition
{#Alias _}
- (list)
+ (if exported?
+ (list name)
+ (list))
- {#Definition [exported? def_type def_value]}
+ {#Definition [def_type def_value]}
(if exported?
(list name)
(list))
@@ -4537,7 +4540,9 @@
(def (alias_definition imported_module def)
(-> Text Text Code)
- (` (.alias# (, (local$ def)) (, (symbol$ [imported_module def])))))
+ (` (.def# (, (local$ def))
+ (, (symbol$ [imported_module def]))
+ .private)))
(def .public only
(macro (_ tokens)
@@ -4609,12 +4614,12 @@
{#None}
{#None}
- {#Some definition}
+ {#Some [exported? definition]}
(when definition
{#Alias real_name}
(definition_type real_name state)
- {#Definition [exported? def_type def_value]}
+ {#Definition [def_type def_value]}
{#Some def_type}
{#Default _}
diff --git a/stdlib/source/library/lux/control/aspect.lux b/stdlib/source/library/lux/control/aspect.lux
index ae08932e3..eda6a78c7 100644
--- a/stdlib/source/library/lux/control/aspect.lux
+++ b/stdlib/source/library/lux/control/aspect.lux
@@ -109,7 +109,7 @@
(def (without_global [module short])
(-> Symbol (analysis.Operation Any))
(function (_ lux)
- (let [without_global (is (-> (property.List .Global) (property.List .Global))
+ (let [without_global (is (-> (property.List [Bit .Global]) (property.List [Bit .Global]))
(property.lacks short))
without_global (is (-> .Module .Module)
(revised .#definitions without_global))
@@ -121,30 +121,30 @@
[]]})))
(def (global_reference name)
- (-> Symbol (Meta .Global))
+ (-> Symbol (Meta [Bit .Global]))
(do meta.monad
[name (meta.normal name)
current_module_name meta.current_module_name
lux meta.compiler_state]
(loop (again [[normal_module normal_short] name])
- (when (is (Maybe .Global)
+ (when (is (Maybe [Bit .Global])
(do maybe.monad
[(open "/[0]") (|> lux
(the .#modules)
(property.value normal_module))]
(property.value normal_short /#definitions)))
- {.#Some it}
+ {.#Some [exported? it]}
(when it
- {.#Definition [exported? type value]}
+ {.#Definition [type value]}
(if (or exported?
(text#= current_module_name normal_module))
- (in it)
+ (in [exported? it])
(meta.failure (%.format "Global is not an export: " (%.symbol name))))
- {.#Default [exported? type value]}
+ {.#Default [type value]}
(if (or exported?
(text#= current_module_name normal_module))
- (in it)
+ (in [exported? it])
(meta.failure (%.format "Global is not an export: " (%.symbol name))))
{.#Alias de_aliased}
@@ -159,9 +159,9 @@
(analysis.Operation of)))
(do phase.monad
[g!cache (macro.symbol "g!cache")
- global (global_reference name)
+ [exported? global] (global_reference name)
.let [cache_name (%.code g!cache)]
- _ (module.define cache_name global)
+ _ (module.define cache_name [exported? global])
it (then [g!cache global])
current_module_name meta.current_module_name
_ (without_global [current_module_name cache_name])]
@@ -174,11 +174,11 @@
(do phase.monad
[g!cache (declaration.lifted_analysis
(macro.symbol "g!cache"))
- global (declaration.lifted_analysis
- (global_reference name))
+ [exported? global] (declaration.lifted_analysis
+ (global_reference name))
.let [cache_name (%.code g!cache)]
_ (declaration.lifted_analysis
- (module.define cache_name global))
+ (module.define cache_name [exported? global]))
it (then [g!cache global])
current_module_name (declaration.lifted_analysis
meta.current_module_name)
@@ -191,10 +191,10 @@
(-> [Symbol .Global] (analysis.Operation of)
(analysis.Operation of)))
(do phase.monad
- [old (global_reference name)
- _ (module.override_definition name new)
+ [[exported? old] (global_reference name)
+ _ (module.override_definition name [exported? new])
it then
- _ (module.override_definition name old)]
+ _ (module.override_definition name [exported? old])]
(in it)))
(def (with_temporary_global' [name new] then)
@@ -202,13 +202,13 @@
(-> [Symbol .Global] (declaration.Operation anchor expression declaration of)
(declaration.Operation anchor expression declaration of)))
(do phase.monad
- [old (declaration.lifted_analysis
- (global_reference name))
+ [[exported? old] (declaration.lifted_analysis
+ (global_reference name))
_ (declaration.lifted_analysis
- (module.override_definition name new))
+ (module.override_definition name [exported? new]))
it then
_ (declaration.lifted_analysis
- (module.override_definition name old))]
+ (module.override_definition name [exported? old]))]
(in it)))
(def (expression type term)
@@ -226,7 +226,7 @@
(do phase.monad
[g!cache (macro.symbol "g!cache")
.let [cache_name (%.code g!cache)]
- _ (module.define cache_name {.#Definition [false Analysis (expression type term)]})
+ _ (module.define cache_name [false {.#Definition [Analysis (expression type term)]}])
it (then g!cache)
current_module_name meta.current_module_name
_ (without_global [current_module_name cache_name])]
@@ -279,7 +279,7 @@
(list#mix (function (_ [original value] then)
(<| (with_cached_analysis original)
(function (_ [g!original original_global]))
- (with_temporary_global [original {.#Definition [true Analysis (value g!original aspect)]}])
+ (with_temporary_global [original {.#Definition [Analysis (value g!original aspect)]}])
then))
(phase archive body)
(list [(symbol .local#) ..local]
@@ -296,7 +296,7 @@
(list#mix (function (_ [original value] then)
(<| (with_cached_analysis' original)
(function (_ [g!original original_global]))
- (with_temporary_global' [original {.#Definition [true Analysis (value g!original aspect)]}])
+ (with_temporary_global' [original {.#Definition [Analysis (value g!original aspect)]}])
then))
(phase archive body)
(list [(symbol .local#) ..local]
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index c754a7d6d..53b9238ec 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -14,7 +14,7 @@
["[0]" nat]]]
[meta
[type
- ["[0]" primitive (.except Frame def pattern)]]]
+ ["[0]" primitive (.except Frame def)]]]
[world
[net (.only URL)]]]]
["[0]" /
@@ -40,7 +40,9 @@
(abstraction ""))
(type .public Style
- (List (Ex (_ brand) [(Property brand) (Value brand)])))
+ (List (Ex (_ brand)
+ [(Property brand)
+ (Value brand)])))
(def .public (rule selector style)
(-> (Selector Any) Style (CSS Common))
diff --git a/stdlib/source/library/lux/data/format/css/font.lux b/stdlib/source/library/lux/data/format/css/font.lux
index 5d97d5382..f69a8f602 100644
--- a/stdlib/source/library/lux/data/format/css/font.lux
+++ b/stdlib/source/library/lux/data/format/css/font.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except #source)
[meta
[code
["s" \\parser]]]
diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux
index 4b4197940..e34b27b1d 100644
--- a/stdlib/source/library/lux/data/format/css/property.lux
+++ b/stdlib/source/library/lux/data/format/css/property.lux
@@ -1,15 +1,14 @@
(.require
[library
- [lux (.except All Location)
+ [lux (.except All Location all left right)
[data
["[0]" text]]
[meta
- [code
+ ["[0]" code (.only)
["s" \\parser]]
[macro
[syntax (.only syntax)]
- ["[0]" template]
- ["[0]" code]]
+ ["[0]" template]]
[type
["[0]" primitive (.except def)]]]]]
[//
diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux
index 6f35f5e43..095d12b40 100644
--- a/stdlib/source/library/lux/data/format/css/query.lux
+++ b/stdlib/source/library/lux/data/format/css/query.lux
@@ -1,11 +1,11 @@
(.require
[library
- [lux (.except and or not)
+ [lux (.except and or not all only except)
[data
["[0]" text (.only)
["%" \\format (.only format)]]]
[meta
- ["[0]" code (.only syntax)
+ ["[0]" code (.only)
["s" \\parser]]
[macro
[syntax (.only syntax)]
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index df2df8fbf..a76428c86 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -1,7 +1,6 @@
(.require
[library
- [lux (.except Label or and for same? not)
- ["[0]" locale (.only Locale)]
+ [lux (.except Label Tag or and for same? not at)
[data
["[0]" text (.only)
["%" \\format (.only format)]]]
@@ -12,7 +11,9 @@
[macro
["[0]" template]]
[type
- ["[0]" primitive (.except def)]]]]]
+ ["[0]" primitive (.except def)]]]
+ [world
+ ["[0]" locale (.only Locale)]]]]
["[0]" //
["[1][0]" id (.only ID)]
["[1][0]" class (.only Class)]])
diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux
index 0d278d714..ddcbbc291 100644
--- a/stdlib/source/library/lux/data/format/css/style.lux
+++ b/stdlib/source/library/lux/data/format/css/style.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except with)
[data
[text
["%" \\format (.only format)]]
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 4fa9266ae..a05cabdf5 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -1,12 +1,12 @@
(.require
[library
- [lux (.except Label All Location and static false true)
+ [lux (.except Label All Location and static false true all)
[control
["[0]" maybe]]
[data
["[0]" color]
["[0]" product]
- ["[0]" text
+ ["[0]" text (.only)
["%" \\format (.only Format format)]]
[collection
["[0]" list (.use "[1]#[0]" functor)]]]
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index e92858dce..0dc8a42b5 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -1,12 +1,12 @@
(.require
[library
- [lux (.except Meta Source comment and template)
+ [lux (.except Tag Meta Source comment and template open parameter)
[control
["[0]" function]
["[0]" maybe (.use "[1]#[0]" functor)]]
[data
["[0]" product]
- ["[0]" text
+ ["[0]" text (.only)
["%" \\format (.only Format format)]]
[collection
["[0]" list (.use "[1]#[0]" functor mix)]]]
@@ -21,18 +21,24 @@
[net (.only URL)]]]]
[//
["[0]" xml (.only XML)]
- [css
+ ["[0]" css
["[0]" selector]
- ["[0]" style (.only Style)]]])
+ ["[0]" style (.only Style)]
+ ["[1]/[0]" id]
+ ["[1]/[0]" class]]])
(type .public Tag selector.Tag)
-(type .public ID selector.ID)
-(type .public Class selector.Class)
+(type .public ID css/id.ID)
+(type .public Class css/class.Class)
... Attributes for an HTML tag.
(type .public Attributes
(List [Text Text]))
+(def .public empty
+ Attributes
+ (list))
+
(type .public Script
js.Statement)
@@ -134,7 +140,7 @@
(format (text.enclosed ["<!--" "-->"] content)
(representation node))))
- (def (empty name attributes)
+ (def (empty_tag name attributes)
(-> Tag Attributes HTML)
(abstraction
(format (..open name attributes)
@@ -302,7 +308,7 @@
for
(when (list#each (product.uncurried ..area) areas)
{.#End}
- (..empty "map" attributes)
+ (..empty_tag "map" attributes)
{.#Item head tail}
(..tag "map" attributes
@@ -311,7 +317,7 @@
(.with_template [<name> <tag> <type>]
[(def .public <name>
(-> Attributes <type>)
- (..empty <tag>))]
+ (..empty_tag <tag>))]
[canvas "canvas" Element]
[progress "progress" Element]
@@ -342,7 +348,7 @@
(def .public label
(-> ID Input)
- (|>> ["for"] list (..empty "label")))
+ (|>> css/id.id ["for"] list (..empty_tag "label")))
(.with_template [<name> <container_tag> <description_tag> <type>]
[(def .public (<name> description attributes content)
@@ -468,7 +474,7 @@
(..description description)))
descriptions)
{.#End}
- (..empty "dl" attributes)
+ (..empty_tag "dl" attributes)
{.#Item head tail}
(..tag "dl" attributes
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index 2d71738d0..da27d4a1a 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -492,7 +492,7 @@
(syntax (_ [[name parameters] ..declaration])
(do meta.monad
[.let [g!module (code.text (product.left name))]
- [[_ def_type def_value]] (meta.export name)
+ [def_type def_value] (meta.export name)
tags (meta.tags_of name)]
(macro.with_symbols [g!type]
(in (list (` (all md.then
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 131e88b0d..cade6f127 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -173,16 +173,16 @@
name name])
(do maybe.monad
[$module (property.value module modules)
- definition (is (Maybe Global)
- (|> $module
- (is Module)
- (the .#definitions)
- (property.value name)))]
+ [exported? definition] (is (Maybe [Bit Global])
+ (|> $module
+ (is Module)
+ (the .#definitions)
+ (property.value name)))]
(when definition
{.#Alias [r_module r_name]}
(again r_module r_name)
- {.#Definition [exported? def_type def_value]}
+ {.#Definition [def_type def_value]}
(if (macro_type? def_type)
{.#Some (as Macro def_value)}
{.#None})
@@ -291,19 +291,19 @@
(with_template [<name> <yes> <no>]
[(def .public (<name> name)
- (-> Symbol (Meta Global))
+ (-> Symbol (Meta [Bit Global]))
(do ..monad
[name (..normal name)
.let [[normal_module normal_short] name]]
(function (_ lux)
- (when (is (Maybe Global)
+ (when (is (Maybe [Bit Global])
(do maybe.monad
[(open "[0]") (|> lux
(the .#modules)
(property.value normal_module))]
(property.value normal_short #definitions)))
- {.#Some definition}
- {try.#Success [lux definition]}
+ {.#Some exported?,definition}
+ {try.#Success [lux exported?,definition]}
_
(let [current_module (|> lux (the .#current_module) (maybe.else "???"))
@@ -321,9 +321,9 @@
(list#each (function (_ [module_name module])
(|> module
(the .#definitions)
- (list.all (function (_ [def_name global])
+ (list.all (function (_ [def_name [exported? global]])
(`` (when global
- {<yes> [exported? _]}
+ {<yes> _}
(if (and exported?
(text#= normal_short def_name))
{.#Some (symbol#encoded [module_name def_name])}
@@ -362,23 +362,21 @@
(-> Symbol (Meta Definition))
(do [! ..monad]
[name (..normal name)
- definition (..definition name)]
+ .let [[expected _] name]
+ [exported? definition] (..definition name)
+ actual ..current_module_name]
(when definition
{.#Definition it}
- (let [[exported? def_type def_value] it]
- (if exported?
- (in it)
- (do !
- [.let [[expected _] name]
- actual ..current_module_name]
- (if (text#= expected actual)
- (in it)
- (failure (all text#composite "Definition is not an export: " (symbol#encoded name)))))))
+ (if (or exported?
+ (text#= expected actual))
+ (in it)
+ (failure (all text#composite "Definition is not an export: " (symbol#encoded name))))
- {.#Alias de_aliased}
- (failure (all text#composite
- "Aliases are not considered exports: "
- (symbol#encoded name)))
+ {.#Alias it}
+ (if (or exported?
+ (text#= expected actual))
+ (export it)
+ (failure (all text#composite "Alias is not an export: " (symbol#encoded name))))
{.#Default _}
(failure (all text#composite
@@ -389,7 +387,7 @@
(-> Symbol (Meta Default))
(do [! ..monad]
[name (..normal name)
- definition (..default' name)]
+ [exported? definition] (..default' name)]
(when definition
{.#Definition _}
(failure (all text#composite
@@ -402,15 +400,14 @@
(symbol#encoded name)))
{.#Default it}
- (let [[exported? def_type def_value] it]
- (if exported?
- (in it)
- (do !
- [.let [[expected _] name]
- actual ..current_module_name]
- (if (text#= expected actual)
- (in it)
- (failure (all text#composite "Default is not an export: " (symbol#encoded name))))))))))
+ (if exported?
+ (in it)
+ (do !
+ [.let [[expected _] name]
+ actual ..current_module_name]
+ (if (text#= expected actual)
+ (in it)
+ (failure (all text#composite "Default is not an export: " (symbol#encoded name)))))))))
(with_template [<name> <slot> <type>]
[(def .public <name>
@@ -430,12 +427,12 @@
(def .public (definition_type name)
(-> Symbol (Meta Type))
(do ..monad
- [definition (definition name)]
+ [[exported? definition] (definition name)]
(when definition
{.#Alias de_aliased}
(definition_type de_aliased)
- {.#Definition [exported? def_type def_value]}
+ {.#Definition [def_type def_value]}
(clean_type def_type)
{.#Default _}
@@ -456,12 +453,12 @@
(def .public (type_definition name)
(-> Symbol (Meta Type))
(do ..monad
- [definition (definition name)]
+ [[exported? definition] (definition name)]
(when definition
{.#Alias de_aliased}
(type_definition de_aliased)
- {.#Definition [exported? def_type def_value]}
+ {.#Definition [def_type def_value]}
(let [type_code (`` (.in_module# (,, (static .prelude)) .type_code))]
(if (or (same? .Type def_type)
(at code.equivalence =
@@ -474,7 +471,7 @@
(..failure (all text#composite "Default is not a type: " (symbol#encoded name))))))
(def .public (globals module)
- (-> Text (Meta (List [Text Global])))
+ (-> Text (Meta (List [Text [Bit Global]])))
(function (_ lux)
(when (property.value module (the .#modules lux))
{.#Some module}
@@ -484,28 +481,54 @@
{try.#Failure (all text#composite "Unknown module: " module)})))
(def .public (definitions module)
- (-> Text (Meta (List [Text Definition])))
+ (-> Text (Meta (List [Text [Bit Definition]])))
(at ..monad each
- (list.all (function (_ [name global])
+ (list.all (function (_ [name [exported? global]])
(when global
{.#Alias de_aliased}
{.#None}
{.#Definition definition}
- {.#Some [name definition]}
+ {.#Some [name [exported? definition]]}
{.#Default _}
{.#None})))
(..globals module)))
+(def .public (resolved_globals module)
+ (-> Text (Meta (List [Text [Bit Definition]])))
+ (do [! ..monad]
+ [it (..globals module)
+ .let [it (list.all (function (_ [name [exported? global]])
+ (when global
+ {.#Alias de_aliased}
+ {.#Some [name exported? {.#Left de_aliased}]}
+
+ {.#Definition definition}
+ {.#Some [name exported? {.#Right definition}]}
+
+ {.#Default _}
+ {.#None}))
+ it)]]
+ (monad.each ! (function (_ [name exported? it])
+ (when it
+ {.#Left de_aliased}
+ (do !
+ [de_aliased (export de_aliased)]
+ (in [name [exported? de_aliased]]))
+
+ {.#Right definition}
+ (in [name [exported? definition]])))
+ it)))
+
(def .public (exports module_name)
(-> Text (Meta (List [Text Definition])))
(do ..monad
[constants (..definitions module_name)]
(in (do list.monad
- [[name [exported? def_type def_value]] constants]
+ [[name [exported? [def_type def_value]]] constants]
(if exported?
- (in [name [exported? def_type def_value]])
+ (in [name [def_type def_value]])
(list))))))
(def .public modules
@@ -527,9 +550,9 @@
(do ..monad
[.let [[module_name name] type_name]
module (..module module_name)]
- (in (list.one (function (_ [short global])
+ (in (list.one (function (_ [short [exported? global]])
(when global
- {.#Definition [exported? type value]}
+ {.#Definition [type value]}
(if (type#= Slot type)
(let [[label type] (as Label value)]
(when type
@@ -592,7 +615,7 @@
=module (..module module)
this_module_name ..current_module_name]
(when (property.value name (the .#definitions =module))
- {.#Some {.#Definition [exported? def_type def_value]}}
+ {.#Some [exported? {.#Definition [def_type def_value]}]}
(if (or (text#= this_module_name module)
exported?)
(if (type#= <type> def_type)
@@ -614,9 +637,9 @@
[=module (..module module)
this_module_name ..current_module_name]
(in (property.values
- (list#mix (function (_ [short global] output)
+ (list#mix (function (_ [short [exported? global]] output)
(when global
- {.#Definition [exported? type value]}
+ {.#Definition [type value]}
(if (and (type#= Slot type)
(or exported?
(text#= this_module_name module)))
@@ -657,7 +680,7 @@
(def .public (de_aliased def_name)
(-> Symbol (Meta Symbol))
(do ..monad
- [constant (..definition def_name)]
+ [[exported? constant] (..definition def_name)]
(in (when constant
{.#Alias real_def_name}
real_def_name
diff --git a/stdlib/source/library/lux/meta/compiler/default/init.lux b/stdlib/source/library/lux/meta/compiler/default/init.lux
index 0daa166c6..ac2f31861 100644
--- a/stdlib/source/library/lux/meta/compiler/default/init.lux
+++ b/stdlib/source/library/lux/meta/compiler/default/init.lux
@@ -108,7 +108,7 @@
(monad.each !
(function (_ [name handler])
(///declaration.lifted_analysis
- (moduleA.override_definition [.prelude name] {.#Default [true .Analysis handler]})))))]
+ (moduleA.override_definition [.prelude name] [true {.#Default [.Analysis handler]}])))))]
(in [])))
(def (with_generation_defaults bundle)
@@ -121,7 +121,7 @@
(monad.each !
(function (_ [name handler])
(///declaration.lifted_analysis
- (moduleA.override_definition [.prelude name] {.#Default [true .Generation handler]})))))]
+ (moduleA.override_definition [.prelude name] [true {.#Default [.Generation handler]}])))))]
(in [])))
(def (with_declaration_defaults bundle)
@@ -135,7 +135,7 @@
(function (_ [name handler])
(do !
[_ (///declaration.lifted_analysis
- (moduleA.override_definition [.prelude name] {.#Default [true .Declaration handler]}))]
+ (moduleA.override_definition [.prelude name] [true {.#Default [.Declaration handler]}]))]
(in [])))))]
(in [])))
diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux
index 6d1974ab8..c6f7c892f 100644
--- a/stdlib/source/library/lux/meta/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux
@@ -780,10 +780,10 @@
meta_state (the [///declaration.#analysis
///declaration.#state]
state)]
- [_ /#type /#value] (|> /#definition
- meta.export
- (meta.result meta_state)
- async#in)]
+ [/#type /#value] (|> /#definition
+ meta.export
+ (meta.result meta_state)
+ async#in)]
(async#in (if (check.subsumes? ..Custom /#type)
{try.#Success [context (the compiler.#parameters it) /#value]}
(exception.except ..invalid_custom_compiler [/#definition /#type]))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux.lux
index d8fd8a22e..58b2833b9 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux.lux
@@ -23,7 +23,7 @@
(def .public format
(Format .Module)
(let [definition (is (Format Definition)
- (all _.and _.bit _.type _.any))
+ (all _.and _.type _.any))
alias (is (Format Alias)
(_.and _.text _.text))
global (is (Format Global)
@@ -37,7 +37,7 @@
... #module_aliases
(_.list alias)
... #definitions
- (_.list (_.and _.text global))
+ (_.list (_.and _.text (_.and _.bit global)))
... #imports
(_.list _.text)
... #module_state
@@ -47,7 +47,6 @@
(Parser .Module)
(let [definition (is (Parser Definition)
(all <>.and
- <binary>.bit
<binary>.type
<binary>.any))
alias (is (Parser Alias)
@@ -65,7 +64,7 @@
... #module_aliases
(<binary>.list alias)
... #definitions
- (<binary>.list (<>.and <binary>.text global))
+ (<binary>.list (<>.and <binary>.text (<>.and <binary>.bit global)))
... #imports
(<binary>.list <binary>.text)
... #module_state
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux
index 6fa95812d..8a47ab3b6 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/module.lux
@@ -95,8 +95,8 @@
[state]
{try.#Success})))
-(def .public (define name definition)
- (-> Text Global (Operation Any))
+(def .public (define name exported?,definition)
+ (-> Text [Bit Global] (Operation Any))
(do ///.monad
[self_name meta.current_module_name
self meta.current_module]
@@ -106,23 +106,24 @@
{try.#Success [(revised .#modules
(property.has self_name
(revised .#definitions
- (is (-> (List [Text Global]) (List [Text Global]))
- (|>> {.#Item [name definition]}))
+ (is (-> (List [Text [Bit Global]])
+ (List [Text [Bit Global]]))
+ (|>> {.#Item [name exported?,definition]}))
self))
state)
[]]}
- {.#Some already_existing}
+ {.#Some [_ already_existing]}
((/.except ..cannot_define_more_than_once [[self_name name] already_existing])
state)))))
-(def .public (override_definition [module short] definition)
- (-> Symbol Global (Operation Any))
+(def .public (override_definition [module short] exported?,definition)
+ (-> Symbol [Bit Global] (Operation Any))
(function (_ state)
{try.#Success [(revised .#modules
(property.revised module
(revised .#definitions
- (property.has short definition)))
+ (property.has short exported?,definition)))
state)
[]]}))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux
index c0ad23cb1..0424495e0 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension.lux
@@ -83,22 +83,22 @@
current_module_name meta.current_module_name
lux meta.compiler_state]
(loop (again [[normal_module normal_short] name])
- (when (is (Maybe Global)
+ (when (is (Maybe [Bit Global])
(do maybe.monad
[(open "/[0]") (|> lux
(the .#modules)
(property.value normal_module))]
(property.value normal_short /#definitions)))
- {.#Some it}
+ {.#Some [exported? it]}
(when it
- {.#Definition [exported? type value]}
+ {.#Definition [type value]}
(if (or validated_global?
exported?
(text#= current_module_name normal_module))
(in it)
(meta.failure (%.format "Global is not an export: " (%.symbol name))))
- {.#Default [exported? type value]}
+ {.#Default [type value]}
(if (or validated_global?
exported?
(text#= current_module_name normal_module))
@@ -116,10 +116,10 @@
(do meta.monad
[global (..global validated_global? name)]
(when global
- {.#Definition [exported? type value]}
+ {.#Definition [type value]}
(in [type {#Normal value}])
- {.#Default [exported? type value]}
+ {.#Default [type value]}
(in [type {#Special value}])
{.#Alias _}
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
index 114928b77..3daa22bc1 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux
@@ -230,32 +230,38 @@
(-> Text Handler)
(..custom
[(<>.and <code>.text <code>.global)
- (function (again extension_name phase archive [quoted_module def_name])
+ (function (_ extension_name phase archive [quoted_module def_name])
(with_expansions [<return> (in (|> def_name reference.constant {analysis.#Reference}))]
- (do [! phase.monad]
- [constant (meta.definition def_name)]
- (when constant
- {.#Alias real_def_name}
- (again extension_name phase archive [quoted_module real_def_name])
-
- {.#Definition [exported? actualT _]}
- (do !
- [_ (typeA.inference actualT)
- (^.let def_name [::module ::name]) (meta.normal def_name)
- current meta.current_module_name]
- (if (text#= current ::module)
- <return>
- (if exported?
- (do !
- [imported! (meta.imported_by? ::module current)]
- (if (or imported!
- (text#= quoted_module ::module))
- <return>
- (analysis.except ..foreign_module_has_not_been_imported [current ::module quoted_module def_name])))
- (analysis.except ..global_has_not_been_exported [def_name]))))
-
- {.#Default _}
- (analysis.except ..defaults_cannot_be_referenced [def_name])))))]))
+ (loop (again [exported_alias? false
+ def_name def_name])
+ (do [! phase.monad]
+ [(^.let def_name [::module ::name]) (meta.normal def_name)
+ current meta.current_module_name
+ [exported? constant] (meta.definition def_name)]
+ (when constant
+ {.#Alias real_def_name}
+ (again (or exported_alias?
+ (text#= current ::module)
+ exported?)
+ real_def_name)
+
+ {.#Definition [actualT _]}
+ (do !
+ [_ (typeA.inference actualT)]
+ (if (or exported_alias?
+ (text#= current ::module))
+ <return>
+ (if exported?
+ (do !
+ [imported! (meta.imported_by? ::module current)]
+ (if (or imported!
+ (text#= quoted_module ::module))
+ <return>
+ (analysis.except ..foreign_module_has_not_been_imported [current ::module quoted_module def_name])))
+ (analysis.except ..global_has_not_been_exported [def_name]))))
+
+ {.#Default _}
+ (analysis.except ..defaults_cannot_be_referenced [def_name]))))))]))
(exception.def .public (unknown_local name)
(Exception Text)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux
index d75f24433..988395df8 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux
@@ -34,7 +34,7 @@
["[1][0]" analysis]
["/[1]" //
["/[1]" //
- ["[1][0]" analysis (.only)
+ ["[0]" analysis (.only)
[macro (.only Expander)]
["[1]/[0]" evaluation]
["[0]A" type]
@@ -227,15 +227,15 @@
(Operation anchor expression declaration Any))
(do [! phase.monad]
[state phase.state
- .let [eval (/////analysis/evaluation.evaluator (the [/////declaration.#analysis /////declaration.#phase] state)
- [(the [/////declaration.#synthesis /////declaration.#state] state)
- (the [/////declaration.#synthesis /////declaration.#phase] state)]
- [(the [/////declaration.#generation /////declaration.#state] state)
- (the [/////declaration.#generation /////declaration.#phase] state)])]
+ .let [eval (analysis/evaluation.evaluator (the [/////declaration.#analysis /////declaration.#phase] state)
+ [(the [/////declaration.#synthesis /////declaration.#state] state)
+ (the [/////declaration.#synthesis /////declaration.#phase] state)]
+ [(the [/////declaration.#generation /////declaration.#state] state)
+ (the [/////declaration.#generation /////declaration.#phase] state)])]
_ (/////declaration.lifted_analysis
(do !
- [_ (moduleA.override_definition [.prelude "is#"] {.#Default [true .Analysis (analysisE.is#_extension eval "is#")]})
- _ (moduleA.override_definition [.prelude "as#"] {.#Default [true .Analysis (analysisE.as#_extension eval "as#")]})]
+ [_ (moduleA.override_definition [.prelude "is#"] [true {.#Default [.Analysis (analysisE.is#_extension eval "is#")]}])
+ _ (moduleA.override_definition [.prelude "as#"] [true {.#Default [.Analysis (analysisE.as#_extension eval "as#")]}])]
(in [])))]
(in [])))
@@ -250,16 +250,38 @@
(..custom
[(all <>.and <code>.local <code>.any <code>.any)
(function (_ phase archive [short_name valueC exported?C])
- (do phase.monad
- [_ ..refresh
- current_module (/////declaration.lifted_analysis meta.current_module_name)
- .let [full_name [current_module short_name]]
- [type valueT value] (..definition archive full_name {.#None} valueC)
- [_ _ exported?] (evaluate! archive Bit exported?C)
- _ (/////declaration.lifted_analysis
- (moduleA.define short_name {.#Definition [(as Bit exported?) type value]}))
- _ (..announce_definition! short_name type)]
- (in /////declaration.no_requirements)))]))
+ (when valueC
+ [_ {.#Symbol original}]
+ (do phase.monad
+ [_ ..refresh
+ state phase.state
+ .let [analysis (the [/////declaration.#analysis /////declaration.#phase] state)]
+ [code//type codeA] (<| /////declaration.lifted_analysis
+ typeA.fresh
+ typeA.inferring
+ (analysis archive valueC))
+ [_ _ exported?] (evaluate! archive Bit exported?C)
+ .let [original (when codeA
+ (analysis.constant original)
+ original
+
+ _
+ (undefined))]
+ _ (/////declaration.lifted_analysis
+ (moduleA.define short_name [(as Bit exported?) {.#Alias original}]))]
+ (in /////declaration.no_requirements))
+
+ _
+ (do phase.monad
+ [_ ..refresh
+ current_module (/////declaration.lifted_analysis meta.current_module_name)
+ .let [full_name [current_module short_name]]
+ [type valueT value] (..definition archive full_name {.#None} valueC)
+ [_ _ exported?] (evaluate! archive Bit exported?C)
+ _ (/////declaration.lifted_analysis
+ (moduleA.define short_name [(as Bit exported?) {.#Definition [type value]}]))
+ _ (..announce_definition! short_name type)]
+ (in /////declaration.no_requirements))))]))
(def imports
(Parser (List Import))
@@ -284,36 +306,6 @@
(in [/////declaration.#imports imports
/////declaration.#referrals (list)])))]))
-(exception.def .public (cannot_alias_an_alias [local foreign target])
- (Exception [Alias Alias Symbol])
- (exception.report
- (list ["Local alias" (%.symbol local)]
- ["Foreign alias" (%.symbol foreign)]
- ["Target definition" (%.symbol target)])))
-
-(def (define_alias alias original)
- (-> Text Symbol (/////analysis.Operation Any))
- (do phase.monad
- [current_module meta.current_module_name
- constant (meta.definition original)]
- (when constant
- {.#Alias de_aliased}
- (phase.except ..cannot_alias_an_alias [[current_module alias] original de_aliased])
-
- {.#Definition _}
- (moduleA.define alias {.#Alias original}))))
-
-(def def_alias
- Handler
- (..custom
- [(all <>.and <code>.local <code>.symbol)
- (function (_ phase archive [alias def_name])
- (do phase.monad
- [_ (phase.sub [(the [/////declaration.#analysis /////declaration.#state])
- (has [/////declaration.#analysis /////declaration.#state])]
- (define_alias alias def_name))]
- (in /////declaration.no_requirements)))]))
-
... TODO: Stop requiring these types and the "swapped" function below to make types line-up.
(with_template [<name> <anonymous>]
[(def <name>
@@ -362,5 +354,4 @@
Bundle
(|> ///.empty
(dictionary.has "def#" lux::def)
- (dictionary.has "module#" def_module)
- (dictionary.has "alias#" def_alias)))
+ (dictionary.has "module#" def_module)))
diff --git a/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux b/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux
index e419e99aa..ae2df0fda 100644
--- a/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/meta/compiler/meta/io/archive.lux
@@ -219,21 +219,22 @@
{.#End}
{try.#Success [definitions bundles output]}))))
content (document.content $.key document)
- definitions (monad.each ! (function (_ [def_name def_global])
+ definitions (monad.each ! (function (_ [def_name [exported? def_global]])
(when def_global
{.#Alias payload}
- (in (list [def_name def_global]))
+ (in (list [def_name [exported? def_global]]))
- {.#Definition [exported? type _]}
+ {.#Definition [type _]}
(|> definitions
(dictionary.value def_name)
try.of_maybe
- (at ! each (|>> [exported? type]
+ (at ! each (|>> [type]
{.#Definition}
+ [exported?]
[def_name]
(list))))
- {.#Default [exported? type _]}
+ {.#Default [type _]}
(in (list))))
(the .#definitions content))]
(in [(document.document $.key (has .#definitions (list#conjoint definitions) content))
diff --git a/stdlib/source/library/lux/meta/global.lux b/stdlib/source/library/lux/meta/global.lux
index e26d50afd..4f86381a7 100644
--- a/stdlib/source/library/lux/meta/global.lux
+++ b/stdlib/source/library/lux/meta/global.lux
@@ -34,7 +34,7 @@
(|> (do maybe.monad
[global (property.value short (the .#definitions module))]
(in (revised .#definitions
- (|>> (property.has short {.#Alias [here local]})
+ (|>> (property.has short [false {.#Alias [here local]}])
(property.has hidden global))
module)))
(maybe.else module))))))
diff --git a/stdlib/source/library/lux/meta/macro/context.lux b/stdlib/source/library/lux/meta/macro/context.lux
index ed4c54849..c39bbd539 100644
--- a/stdlib/source/library/lux/meta/macro/context.lux
+++ b/stdlib/source/library/lux/meta/macro/context.lux
@@ -48,7 +48,7 @@
(do meta.monad
[.let [[@ expected_name] it]
defs (meta.definitions @)]
- (when (list.one (function (_ [actual_name [exported? type value]])
+ (when (list.one (function (_ [actual_name [exported? [type value]]])
(if (text#= expected_name actual_name)
{.#Some value}
{.#None}))
@@ -110,12 +110,12 @@
_
(exception.except ..not_a_definition [definition]))))
- on_globals (is (-> (property.List Global) (Try (property.List Global)))
+ on_globals (is (-> (property.List [Bit Global]) (Try (property.List [Bit Global])))
(function (_ globals)
(when (property.value context globals)
- {.#Some global}
+ {.#Some [exported? global]}
(try#each (function (_ global)
- (property.has context global globals))
+ (property.has context [exported? global] globals))
(on_global global))
{.#None}
@@ -146,12 +146,12 @@
(All (_ value)
(-> value (Stack' value)
(Meta Any)))
- (alter (function (_ _ [exported? type stack])
+ (alter (function (_ _ [type stack])
(|> stack
(as (Stack Any))
{.#Item top}
(is (Stack Any))
- [exported? type]
+ [type]
{try.#Success}))))
(.def .public push
@@ -163,7 +163,7 @@
(All (_ value)
(-> (Maybe (Predicate value)) (-> value value) (Stack' value)
(Meta Any)))
- (alter (function (_ @ [exported? type stack])
+ (alter (function (_ @ [type stack])
(let [stack (sharing [value]
(is (-> value value)
!)
@@ -183,7 +183,7 @@
_
(exception.except ..no_example [@])))]
- (in [exported? type stack]))
+ (in [type stack]))
{.#None}
(when stack
@@ -191,7 +191,7 @@
(|> stack'
(list.partial (! top))
(is (Stack Any))
- [exported? type]
+ [type]
{try.#Success})
_
@@ -207,10 +207,10 @@
(.def .public pop''
(All (_ value) (-> (Stack' value) (Meta Any)))
- (alter (function (_ _ [exported? type value])
+ (alter (function (_ _ [type value])
(|> (let [value (as (Stack Any) value)]
(maybe.else value (list.tail value)))
- [exported? type]
+ [type]
{try.#Success}))))
(.def .public pop'
diff --git a/stdlib/source/library/lux/meta/macro/local.lux b/stdlib/source/library/lux/meta/macro/local.lux
index d1e9c9475..b2367fee8 100644
--- a/stdlib/source/library/lux/meta/macro/local.lux
+++ b/stdlib/source/library/lux/meta/macro/local.lux
@@ -55,9 +55,9 @@
(-> [Symbol Macro] (Meta Any))
(do meta.monad
[[module_name definition_name] (meta.normal name)
- .let [definition (is Global {.#Definition [false .Macro macro]})
- add_macro! (is (-> (property.List Global) (property.List Global))
- (property.has definition_name definition))]]
+ .let [definition (is Global {.#Definition [.Macro macro]})
+ add_macro! (is (-> (property.List [Bit Global]) (property.List [Bit Global]))
+ (property.has definition_name [false definition]))]]
(..with_module module_name
(function (_ module)
(when (|> module (the .#definitions) (property.value definition_name))
@@ -72,7 +72,7 @@
(-> Symbol (Meta Any))
(do meta.monad
[[module_name definition_name] (meta.normal name)
- .let [lacks_macro! (is (-> (property.List Global) (property.List Global))
+ .let [lacks_macro! (is (-> (property.List [Bit Global]) (property.List [Bit Global]))
(property.lacks definition_name))]]
(..with_module module_name
(function (_ module)
diff --git a/stdlib/source/library/lux/meta/macro/vocabulary.lux b/stdlib/source/library/lux/meta/macro/vocabulary.lux
index 2e9297eee..31e0dc1d9 100644
--- a/stdlib/source/library/lux/meta/macro/vocabulary.lux
+++ b/stdlib/source/library/lux/meta/macro/vocabulary.lux
@@ -47,7 +47,7 @@
(` (.def (, public|private@by_name) ((, by_name) (, g!_))
(-> Symbol (Meta Macro))
(do ///.monad
- [[(, g!_) (, g!type) (, g!value)] (///.export (, g!_))]
+ [[(, g!type) (, g!value)] (///.export (, g!_))]
(if (at type.equivalence (,' =) (, type) (, g!type))
((,' in) ((, macro) (as (, type) (, g!value))))
(///.failure (exception.error ..invalid_type [(, type) (, g!type)])))))))))))
diff --git a/stdlib/source/library/lux/meta/type/implicit.lux b/stdlib/source/library/lux/meta/type/implicit.lux
index f265ac780..1e1a93c0d 100644
--- a/stdlib/source/library/lux/meta/type/implicit.lux
+++ b/stdlib/source/library/lux/meta/type/implicit.lux
@@ -143,8 +143,8 @@
<found?>)))
(def (available_definitions sig_type source_module target_module constants aggregate)
- (-> Type Text Text (List [Text Definition]) (-> (List [Symbol Type]) (List [Symbol Type])))
- (list#mix (function (_ [name [exported? def_type def_value]] aggregate)
+ (-> Type Text Text (List [Text [Bit Definition]]) (-> (List [Symbol Type]) (List [Symbol Type])))
+ (list#mix (function (_ [name [exported? [def_type def_value]]] aggregate)
(if (and (or (text#= target_module source_module)
exported?)
(compatible_type? sig_type def_type))
@@ -173,7 +173,7 @@
(-> Type (Meta (List [Symbol Type])))
(do [! ///.monad]
[this_module_name ///.current_module_name
- definitions (///.definitions this_module_name)]
+ definitions (///.resolved_globals this_module_name)]
(in (available_definitions sig_type this_module_name this_module_name definitions {.#End}))))
(def (imported_structs sig_type)
@@ -181,7 +181,7 @@
(do [! ///.monad]
[this_module_name ///.current_module_name
imported_modules (///.imported_modules this_module_name)
- accessible_definitions (monad.each ! ///.definitions imported_modules)]
+ accessible_definitions (monad.each ! ///.resolved_globals imported_modules)]
(in (list#mix (function (_ [imported_module definitions] tail)
(available_definitions sig_type imported_module this_module_name definitions tail))
{.#End}
diff --git a/stdlib/source/library/lux/world/net/http.lux b/stdlib/source/library/lux/world/net/http.lux
index 37d9c0fd4..05cf85509 100644
--- a/stdlib/source/library/lux/world/net/http.lux
+++ b/stdlib/source/library/lux/world/net/http.lux
@@ -50,13 +50,3 @@
(Record
[#headers Headers
#body (Body !)]))
-
-(type .public (Request !)
- [Identification Protocol Resource (Message !)])
-
-(type .public (Response !)
- [Status (Message !)])
-
-(type .public (Server !)
- (-> (Request !)
- (! (Response !))))
diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux
index 49b376ee3..f3851016a 100644
--- a/stdlib/source/library/lux/world/net/http/client.lux
+++ b/stdlib/source/library/lux/world/net/http/client.lux
@@ -28,13 +28,14 @@
[syntax (.only syntax)]
["[0]" template]]]]]
["[0]" // (.only)
+ [response (.only Response)]
["[0]" header (.only Headers)]
[// (.only URL)]])
(type .public (Client !)
(Interface
(is (-> //.Method URL Headers (Maybe Binary)
- (! (Try (//.Response !))))
+ (! (Try (Response !))))
request)))
(def method_function
@@ -46,7 +47,7 @@
(def .public (<name> url headers data client)
(All (_ !)
(-> URL Headers (Maybe Binary) (Client !)
- (! (Try (//.Response !)))))
+ (! (Try (Response !)))))
(at client request {<method>} url headers data)))]
[//.#Post]
@@ -193,7 +194,7 @@
(Client IO)
(implementation
(def (request method url headers data)
- (is (IO (Try (//.Response IO)))
+ (is (IO (Try (Response IO)))
(do [! (try.with io.monad)]
[connection (|> url ffi.as_string java/net/URL::new java/net/URL::openConnection)
.let [connection (as java/net/HttpURLConnection connection)]
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index 26005abe2..477fbf2e3 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -31,6 +31,18 @@
["[1][0]" query]
["[1][0]" cookie]])
+(type .public (Request !)
+ [Identification Protocol Resource (Message !)])
+
+(type .public (Server !)
+ (-> (Request !)
+ (! (Response !))))
+
+(def .public (static response)
+ (-> Response Server)
+ (function (_ request)
+ (async.resolved response)))
+
(def (merge inputs)
(-> (List Binary) Binary)
(let [[_ output] (try.trusted
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index 7b223efed..9c280d019 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -1,74 +1,80 @@
(.require
[library
- [lux (.except static)
+ [lux (.except)
[control
- ["[0]" io]
+ ["[0]" try]
[concurrency
- ["[0]" async]
- ["[0]" frp (.use "[1]#[0]" monad)]]]
+ ["[0]" async (.only Async)]]]
[data
- ["[0]" text
- ["[0]" encoding]]
+ ["[0]" binary (.only Binary)]
+ [text
+ [encoding
+ ["[0]" utf8]]]
[format
["[0]" html]
["[0]" css (.only CSS)]
- ["[0]" context]
- ["[0]" json (.only JSON) (.use "[1]#[0]" codec)]]]
- [world
- ["[0]" binary (.only Binary)]]]]
- ["[0]" // (.only Status Body Response Server)
- ["[0]" status]
- ["[0]" mime (.only MIME)]
+ ["[0]" json (.only JSON) (.use "[1]#[0]" codec)]]]]]
+ ["[0]" // (.only Body Message)
+ ["[0]" status (.only Status)]
["[0]" header]
- [// (.only URL)]])
+ [// (.only URL)
+ ["[0]" mime (.only MIME)]]])
-(def .public (static response)
- (-> Response Server)
- (function (_ request)
- (async.resolved response)))
+(type .public (Response !)
+ (Record
+ [#status Status
+ #message (Message !)]))
(def .public empty
- (-> Status Response)
- (let [body (frp#in (at encoding.utf8 encoded ""))]
+ (-> Status (Response Async))
+ (let [body (is (Body Async)
+ (function (_ _)
+ (async.resolved {try.#Success [0 (at utf8.codec encoded "")]})))]
(function (_ status)
- [status
- [//.#headers (|> context.empty
- (header.content_length 0)
- (header.content_type mime.utf_8))
- //.#body body]])))
+ [#status status
+ #message [//.#headers (|> header.empty
+ (header.has header.content_length 0)
+ (header.has header.content_type mime.utf_8))
+ //.#body body]])))
(def .public (temporary_redirect to)
- (-> URL Response)
- (let [[status message] (..empty status.temporary_redirect)]
- [status (revised //.#headers (header.location to) message)]))
+ (-> URL (Response Async))
+ (|> status.temporary_redirect
+ ..empty
+ (revised [#message //.#headers] (header.has header.location to))))
(def .public not_found
- Response
+ (Response Async)
(..empty status.not_found))
(def .public (content status type data)
- (-> Status MIME Binary Response)
- [status
- [//.#headers (|> context.empty
- (header.content_length (binary.size data))
- (header.content_type type))
- //.#body (frp#in data)]])
+ (-> Status MIME Binary (Response Async))
+ (let [length (binary.size data)]
+ [#status status
+ #message [//.#headers (|> header.empty
+ (header.has header.content_length length)
+ (header.has header.content_type type))
+ //.#body (function (_ _)
+ (async.resolved {try.#Success [length data]}))]]))
(def .public bad_request
- (-> Text Response)
- (|>> (at encoding.utf8 encoded) (content status.bad_request mime.utf_8)))
+ (-> Text (Response Async))
+ (|>> (at utf8.codec encoded)
+ (content status.bad_request mime.utf_8)))
(def .public ok
- (-> MIME Binary Response)
+ (-> MIME Binary (Response Async))
(content status.ok))
(with_template [<name> <type> <mime> <pre>]
[(def .public <name>
- (-> <type> Response)
- (|>> <pre> (at encoding.utf8 encoded) (..ok <mime>)))]
+ (-> <type> (Response Async))
+ (|>> <pre>
+ (at utf8.codec encoded)
+ (..ok <mime>)))]
[text Text mime.utf_8 (<|)]
[html html.Document mime.html html.html]
- [css CSS mime.css css.css]
+ [css (CSS Any) mime.css css.css]
[json JSON mime.json json#encoded]
)
diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux
index 34a5a5a3d..4a9a633c9 100644
--- a/stdlib/source/test/lux/data/color/named.lux
+++ b/stdlib/source/test/lux/data/color/named.lux
@@ -3,6 +3,8 @@
[lux (.except)
[abstract
[monad (.only do)]]
+ [control
+ ["[0]" maybe]]
[data
[collection
["[0]" list]
@@ -214,6 +216,13 @@
(def unique_colors
(set.of_list //.hash ..all_colors))
+ (def .public random
+ (Random //.Color)
+ (do [! random.monad]
+ [choice (at ! each (n.% (set.size ..unique_colors))
+ random.nat)]
+ (in (maybe.trusted (list.item choice ..all_colors)))))
+
(def verdict
(n.= (list.size ..all_colors)
(set.size ..unique_colors)))
diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux
index 33859dd4e..4b134ebbe 100644
--- a/stdlib/source/test/lux/meta/type/resource.lux
+++ b/stdlib/source/test/lux/meta/type/resource.lux
@@ -161,7 +161,7 @@
(syntax (_ [exception <code>.symbol
to_expand <code>.any])
(monad.do meta.monad
- [[_ _ exception] (meta.export exception)]
+ [[_ exception] (meta.export exception)]
(function (_ compiler)
{.#Right [compiler
(list (code.bit (when ((expansion.single to_expand) compiler)
diff --git a/stdlib/source/test/lux/meta/type/row.lux b/stdlib/source/test/lux/meta/type/row.lux
index fb2abf4de..b74441df1 100644
--- a/stdlib/source/test/lux/meta/type/row.lux
+++ b/stdlib/source/test/lux/meta/type/row.lux
@@ -112,7 +112,7 @@
(_.coverage [/.the]
(and (|> (/.row [@birth expected_birth
@life_span expected_life_span])
- (is Mortal)
+ (is (Mortal Any))
(/.the @birth)
(same? expected_birth))
(|> (/.row [@name expected_name
@@ -129,18 +129,48 @@
(/.the @id)
(same? expected_id))))
(_.coverage [/.has]
- (|> (/.row [@birth dummy_birth
- @life_span expected_life_span])
- (is Mortal)
- (/.has @birth expected_birth)
- (/.the @birth)
- (same? expected_birth)))
+ (and (|> (/.row [@birth dummy_birth
+ @life_span expected_life_span])
+ (is (Mortal Any))
+ (/.has @birth expected_birth)
+ (/.the @birth)
+ (same? expected_birth))
+ (|> (/.row [@name dummy_name
+ @birth expected_birth
+ @life_span expected_life_span])
+ (is (Human Any))
+ (/.has @name expected_name)
+ (/.the @name)
+ (same? expected_name))
+ (|> (/.row [@id dummy_id
+ @name expected_name
+ @birth expected_birth
+ @life_span expected_life_span])
+ (is (TransHuman Nat Any))
+ (/.has @id expected_id)
+ (/.the @id)
+ (same? expected_id))))
(_.coverage [/.revised]
- (|> (/.row [@birth dummy_birth
- @life_span expected_life_span])
- (is Mortal)
- (/.revised @birth (function (_ _) expected_birth))
- (/.the @birth)
- (same? expected_birth)))
+ (and (|> (/.row [@birth dummy_birth
+ @life_span expected_life_span])
+ (is (Mortal Any))
+ (/.revised @birth (function (_ _) expected_birth))
+ (/.the @birth)
+ (same? expected_birth))
+ (|> (/.row [@name dummy_name
+ @birth expected_birth
+ @life_span expected_life_span])
+ (is (Human Any))
+ (/.revised @name (function (_ _) expected_name))
+ (/.the @name)
+ (same? expected_name))
+ (|> (/.row [@id dummy_id
+ @name expected_name
+ @birth expected_birth
+ @life_span expected_life_span])
+ (is (TransHuman Nat Any))
+ (/.revised @id (function (_ _) expected_id))
+ (/.the @id)
+ (same? expected_id))))
))
)))
diff --git a/stdlib/source/test/lux/world/net.lux b/stdlib/source/test/lux/world/net.lux
index b2c286fc0..08c56fa4b 100644
--- a/stdlib/source/test/lux/world/net.lux
+++ b/stdlib/source/test/lux/world/net.lux
@@ -16,7 +16,8 @@
["[1]/[0]" cookie]
["[1]/[0]" header]
["[1]/[0]" status]
- ["[1]/[0]" version]]
+ ["[1]/[0]" version]
+ ["[1]/[0]" response]]
["[1][0]" uri
["[1]/[0]" encoding]
["[1]/[0]" scheme]
@@ -45,6 +46,7 @@
/http/header.test
/http/status.test
/http/version.test
+ /http/response.test
/uri/encoding.test
/uri/scheme.test
diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux
index ed3eb915c..3eee7b77a 100644
--- a/stdlib/source/test/lux/world/net/http/client.lux
+++ b/stdlib/source/test/lux/world/net/http/client.lux
@@ -29,12 +29,13 @@
[\\library
["[0]" / (.only)
["/[1]" // (.only)
+ [response (.only Response)]
["[0]" header]
["[1][0]" status]]]])
(def (verification ! expected response)
(All (_ !)
- (-> (Monad !) Nat (! (Try (//.Response !)))
+ (-> (Monad !) Nat (! (Try (Response !)))
(! Bit)))
(do !
[response response]
diff --git a/stdlib/source/test/lux/world/net/http/response.lux b/stdlib/source/test/lux/world/net/http/response.lux
new file mode 100644
index 000000000..28d726a1f
--- /dev/null
+++ b/stdlib/source/test/lux/world/net/http/response.lux
@@ -0,0 +1,189 @@
+(.require
+ [library
+ [lux (.except)
+ [abstract
+ [monad (.only do)]]
+ [control
+ ["[0]" try (.use "[1]#[0]" functor)]
+ [concurrency
+ ["[0]" async]]]
+ [data
+ ["[0]" product]
+ ["[0]" binary (.use "[1]#[0]" equivalence)]
+ ["[0]" color
+ [named
+ ["[1]T" \\test]]]
+ ["[0]" text (.use "[1]#[0]" equivalence)
+ [encoding
+ ["[0]" utf8 (.use "[1]#[0]" codec)]]]
+ [format
+ ["[0]" html]
+ ["[0]" css (.only)
+ ["[0]" selector]
+ ["[0]" property]
+ ["[0]" value]]
+ ["[0]" json (.use "[1]#[0]" codec)
+ ["[1]T" \\test]]]]
+ [math
+ ["[0]" random (.only Random)]
+ [number
+ ["n" nat]]]
+ [test
+ ["_" property (.only Test)]
+ ["[0]" unit]]]]
+ [\\library
+ ["[0]" / (.only)
+ ["/[1]" // (.only)
+ ["[0]" header]
+ ["[0]" status]
+ [//
+ ["[0]" mime (.use "[1]#[0]" equivalence)]]]]]
+ [//
+ ["[0]T" status]
+ [//
+ ["[0]T" mime]]])
+
+(def .public test
+ Test
+ (<| (_.covering /._)
+ (do [! random.monad]
+ [expected_status statusT.random
+ expected_mime mimeT.random
+
+ utf8_length (at ! each (n.% 10) random.nat)
+ utf8 (random.upper_cased utf8_length)
+ .let [utf8_data (utf8#encoded utf8)]
+
+ expected_url (at ! each (text.prefix "http://www.example.com/")
+ (random.upper_cased 1))
+
+ .let [expected_html (html.html/5
+ (html.head (html.title (html.text utf8)))
+ (html.body (html.paragraph (list) (html.text utf8))))]
+ expected_json jsonT.random
+ color colorT.random
+ .let [expected_css (css.rule selector.any
+ (list [property.text_color
+ (value.rgb color)]))]])
+ (_.for [/.Response])
+ (`` (all _.and
+ (,, (with_template [<coverage> <response>
+ <status>
+ <content_length> <content_type>]
+ [(_.coverage [<coverage>]
+ (let [response <response>]
+ (and (same? <status> (the /.#status response))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_length)
+ (try#each (n.= <content_length>))
+ (try.else false))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_type)
+ (try#each (mime#= <content_type>))
+ (try.else false)))))]
+
+ [/.empty (/.empty expected_status) expected_status 0 mime.utf_8]
+ [/.not_found /.not_found status.not_found 0 mime.utf_8]
+ [/.content (/.content expected_status expected_mime utf8_data) expected_status utf8_length expected_mime]
+ [/.bad_request (/.bad_request utf8) status.bad_request utf8_length mime.utf_8]
+ [/.ok (/.ok expected_mime utf8_data) status.ok utf8_length expected_mime]
+ ))
+ (_.coverage [/.temporary_redirect]
+ (let [response (/.temporary_redirect expected_url)]
+ (and (same? status.temporary_redirect (the /.#status response))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.location)
+ (try#each (text#= expected_url))
+ (try.else false)))))
+ (in (do async.monad
+ [.let [response (/.text utf8)]
+ body ((the [/.#message //.#body] response) {.#None})]
+ (unit.coverage [/.text]
+ (and (same? status.ok (the /.#status response))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_length)
+ (try#each (n.= utf8_length))
+ (try.else false))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_type)
+ (try#each (mime#= mime.utf_8))
+ (try.else false))
+ (|> body
+ (try#each (|>> product.right
+ (binary#= utf8_data)))
+ (try.else false))))))
+ (in (do async.monad
+ [.let [response (/.html expected_html)
+ data (|> expected_html
+ html.html
+ utf8#encoded)
+ length (binary.size data)]
+ body ((the [/.#message //.#body] response) {.#None})]
+ (unit.coverage [/.html]
+ (and (same? status.ok (the /.#status response))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_length)
+ (try#each (n.= length))
+ (try.else false))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_type)
+ (try#each (mime#= mime.html))
+ (try.else false))
+ (|> body
+ (try#each (|>> product.right
+ (binary#= data)))
+ (try.else false))))))
+ (in (do async.monad
+ [.let [response (/.json expected_json)
+ data (|> expected_json
+ json#encoded
+ utf8#encoded)
+ length (binary.size data)]
+ body ((the [/.#message //.#body] response) {.#None})]
+ (unit.coverage [/.json]
+ (and (same? status.ok (the /.#status response))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_length)
+ (try#each (n.= length))
+ (try.else false))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_type)
+ (try#each (mime#= mime.json))
+ (try.else false))
+ (|> body
+ (try#each (|>> product.right
+ (binary#= data)))
+ (try.else false))))))
+ (in (do async.monad
+ [.let [response (/.css expected_css)
+ data (|> expected_css
+ css.css
+ utf8#encoded)
+ length (binary.size data)]
+ body ((the [/.#message //.#body] response) {.#None})]
+ (unit.coverage [/.css]
+ (and (same? status.ok (the /.#status response))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_length)
+ (try#each (n.= length))
+ (try.else false))
+ (|> response
+ (the [/.#message //.#headers])
+ (header.one header.content_type)
+ (try#each (mime#= mime.css))
+ (try.else false))
+ (|> body
+ (try#each (|>> product.right
+ (binary#= data)))
+ (try.else false))))))
+ ))))
diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux
index f2522222a..a7cb40039 100644
--- a/stdlib/source/test/lux/world/net/http/status.lux
+++ b/stdlib/source/test/lux/world/net/http/status.lux
@@ -1,11 +1,16 @@
(.require
[library
[lux (.except all)
+ [abstract
+ [monad (.only do)]]
+ [control
+ ["[0]" maybe]]
[data
[collection
["[0]" list]
["[0]" set (.only Set)]]]
[math
+ ["[0]" random (.only Random)]
[number
["n" nat]]]
[meta
@@ -14,8 +19,7 @@
[test
["_" property (.only Test)]]]]
[\\library
- ["[0]" / (.only)
- ["/[1]" //]]])
+ ["[0]" /]])
(with_expansions [<categories> (these [informational
[/.continue
@@ -85,9 +89,9 @@
/.not_extended
/.network_authentication_required]])]
(def all
- (List //.Status)
+ (List /.Status)
(list.together (`` (list (,, (with_template [<category> <status+>]
- [((is (-> Any (List //.Status))
+ [((is (-> Any (List /.Status))
(function (_ _)
(`` (list (,, (template.spliced <status+>))))))
123)]
@@ -95,9 +99,16 @@
<categories>))))))
(def unique
- (Set //.Status)
+ (Set /.Status)
(set.of_list n.hash ..all))
+ (def .public random
+ (Random /.Status)
+ (do [! random.monad]
+ [choice (at ! each (n.% (set.size ..unique))
+ random.nat)]
+ (in (maybe.trusted (list.item choice all)))))
+
(def verdict
(n.= (list.size ..all)
(set.size ..unique)))