aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2022-10-01 20:50:49 -0400
committerEduardo Julian2022-10-01 20:50:49 -0400
commitd82a9b1166902ecca9a9a6eb3e1bb2195c73d9b7 (patch)
treed94337412a0761e37b6a38f435d63e970071f4b6 /stdlib
parent0b2294bc184b1ed3e82dc00096e9971245239e2c (diff)
New format for extensions [part 2]
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/library/lux.lux14
-rw-r--r--stdlib/source/library/lux/math.lux191
-rw-r--r--stdlib/source/library/lux/meta/compiler/default/init.lux12
-rw-r--r--stdlib/source/library/lux/meta/compiler/default/platform.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux3
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/evaluation.lux60
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux73
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/simple.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux90
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/js.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lua.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux39
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/php.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/python.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/r.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/scheme.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/lux.lux33
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux2
-rw-r--r--stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux2
-rw-r--r--stdlib/source/library/lux/meta/extension.lux2
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux2
-rw-r--r--stdlib/source/test/lux/meta/extension.lux52
32 files changed, 313 insertions, 298 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 249e77569..0d3c3c837 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -5878,8 +5878,12 @@
_
(failure (..wrong_syntax_error (symbol ..Rec)))))))
-(def .public Synthesis
- (Primitive "#Synthesis"))
-
-(def .public Generation
- (Primitive "#Generation"))
+(with_template [<type>]
+ [(def .public <type>
+ (let [[_ short] (symbol <type>)]
+ {.#Primitive (text#composite "#" short) (list)}))]
+
+ [Analysis]
+ [Synthesis]
+ [Generation]
+ )
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index a43b14b69..6e864d421 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -1,11 +1,10 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
[abstract
["[0]" monad (.only do)]]
[control
["<>" parser]
- ["[0]" try (.only Try)]
["[0]" exception (.only Exception)]]
[data
[text
@@ -15,11 +14,9 @@
[meta
[extension (.only analysis)]
["@" target]
- ["[0]" static]
["[0]" code
["<[1]>" \\parser]]
[macro
- [syntax (.only syntax)]
["[0]" template]]
[type
["[0]" check]]
@@ -65,55 +62,51 @@
prevs)))))
(for @.old (these)
- (with_expansions [<@> (static.text (let [[@ _] (symbol .._)] @))
- <ratio/0> [ratio.#numerator 0 ratio.#denominator 1]
+ (with_expansions [<ratio/0> [ratio.#numerator 0 ratio.#denominator 1]
<ratio/1> [ratio.#numerator 1 ratio.#denominator 1]
<complex/0> [complex.#real +0.0 complex.#imaginary +0.0]
<complex/1> [complex.#real +1.0 complex.#imaginary +0.0]]
(these (with_template [<name> <scenarios>']
- [(with_expansions [<extension> (static.seed)
- <extension> (template.text [<@> " " <extension>])
- <scenarios> (template.spliced <scenarios>')]
- (these (analysis (<extension> self phase archive [operands (<>.some <code>.any)])
- (<| type.with_var
- (function (_ [$it :it:]))
- (do [! phase.monad]
- [operands (monad.each ! (|>> (phase archive) (type.expecting :it:))
- operands)
- _ (type.inference :it:)
- :it: (type.check (check.identity (list) $it))]
- (when (list.reversed operands)
- (list single)
- (in single)
-
- (list)
- (`` (cond (check.subsumes? .I64 :it:)
- (phase.except ..no_arithmetic_for [:it:])
-
- (,, (with_template [<type> <0> <+>]
- [(check.subsumes? <type> :it:)
- <0>]
-
- <scenarios>))
-
- ... else
- (phase.except ..no_arithmetic_for [:it:])))
-
- (list.partial last prevs)
- (`` (cond (check.subsumes? .I64 :it:)
- (phase.except ..no_arithmetic_for [:it:])
-
- (,, (with_template [<type> <0> <+>]
- [(check.subsumes? <type> :it:)
- (..composite phase archive (` <+>) last prevs)]
-
- <scenarios>))
-
- ... else
- (phase.except ..no_arithmetic_for [:it:])))))))
- (def .public <name>
- (syntax (_ [operands (<>.some <code>.any)])
- (in (list (` (<extension> (,* operands)))))))))]
+ [(with_expansions [<scenarios> (template.spliced <scenarios>')]
+ (these (def .public <name>
+ .Analysis
+ (analysis (_ self phase archive [operands (<>.some <code>.any)])
+ (<| type.with_var
+ (function (_ [$it :it:]))
+ (do [! phase.monad]
+ [operands (monad.each ! (|>> (phase archive) (type.expecting :it:))
+ operands)
+ _ (type.inference :it:)
+ :it: (type.check (check.identity (list) $it))]
+ (when (list.reversed operands)
+ (list single)
+ (in single)
+
+ (list)
+ (`` (cond (check.subsumes? .I64 :it:)
+ (phase.except ..no_arithmetic_for [:it:])
+
+ (,, (with_template [<type> <0> <+>]
+ [(check.subsumes? <type> :it:)
+ <0>]
+
+ <scenarios>))
+
+ ... else
+ (phase.except ..no_arithmetic_for [:it:])))
+
+ (list.partial last prevs)
+ (`` (cond (check.subsumes? .I64 :it:)
+ (phase.except ..no_arithmetic_for [:it:])
+
+ (,, (with_template [<type> <0> <+>]
+ [(check.subsumes? <type> :it:)
+ (..composite phase archive (` <+>) last prevs)]
+
+ <scenarios>))
+
+ ... else
+ (phase.except ..no_arithmetic_for [:it:]))))))))))]
[+ [[.Nat (in (analysis.nat 0)) "lux i64 +"]
[.Int (in (analysis.int +0)) "lux i64 +"]
@@ -141,33 +134,29 @@
[Complex (type.expecting Complex (phase archive (` <complex/1>))) complex./]]]
)
(with_template [<name> <scenarios>']
- [(with_expansions [<extension> (static.seed)
- <extension> (template.text [<@> " " <extension>])
- <scenarios> (template.spliced <scenarios>')]
- (these (analysis (<extension> self phase archive [left <code>.any
- right <code>.any])
- (<| type.with_var
- (function (_ [$it :it:]))
- (do [! phase.monad]
- [left (type.expecting :it: (phase archive left))
- right (type.expecting :it: (phase archive right))
- _ (type.inference .Bit)
- :it: (type.check (check.identity (list) $it))]
- (`` (cond (check.subsumes? .I64 :it:)
- (phase.except ..no_arithmetic_for [:it:])
-
- (,, (with_template [<type> <+>]
- [(check.subsumes? <type> :it:)
- (..composite phase archive (` <+>) right (list left))]
-
- <scenarios>))
-
- ... else
- (phase.except ..no_arithmetic_for [:it:]))))))
- (def .public <name>
- (syntax (_ [left <code>.any
- right <code>.any])
- (in (list (` (<extension> (, left) (, right)))))))))]
+ [(with_expansions [<scenarios> (template.spliced <scenarios>')]
+ (these (def .public <name>
+ .Analysis
+ (analysis (_ self phase archive [left <code>.any
+ right <code>.any])
+ (<| type.with_var
+ (function (_ [$it :it:]))
+ (do [! phase.monad]
+ [left (type.expecting :it: (phase archive left))
+ right (type.expecting :it: (phase archive right))
+ _ (type.inference .Bit)
+ :it: (type.check (check.identity (list) $it))]
+ (`` (cond (check.subsumes? .I64 :it:)
+ (phase.except ..no_arithmetic_for [:it:])
+
+ (,, (with_template [<type> <+>]
+ [(check.subsumes? <type> :it:)
+ (..composite phase archive (` <+>) right (list left))]
+
+ <scenarios>))
+
+ ... else
+ (phase.except ..no_arithmetic_for [:it:])))))))))]
[= [[.Nat "lux i64 ="]
[.Int "lux i64 ="]
@@ -197,33 +186,29 @@
[Ratio ratio.>=]]]
)
(with_template [<name> <scenarios>']
- [(with_expansions [<extension> (static.seed)
- <extension> (template.text [<@> " " <extension>])
- <scenarios> (template.spliced <scenarios>')]
- (these (analysis (<extension> self phase archive [left <code>.any
- right <code>.any])
- (<| type.with_var
- (function (_ [$it :it:]))
- (do [! phase.monad]
- [left (type.expecting :it: (phase archive left))
- right (type.expecting :it: (phase archive right))
- _ (type.inference :it:)
- :it: (type.check (check.identity (list) $it))]
- (`` (cond (check.subsumes? .I64 :it:)
- (phase.except ..no_arithmetic_for [:it:])
-
- (,, (with_template [<type> <+>]
- [(check.subsumes? <type> :it:)
- (..composite phase archive (` <+>) right (list left))]
-
- <scenarios>))
-
- ... else
- (phase.except ..no_arithmetic_for [:it:]))))))
- (def .public <name>
- (syntax (_ [left <code>.any
- right <code>.any])
- (in (list (` (<extension> (, left) (, right)))))))))]
+ [(with_expansions [<scenarios> (template.spliced <scenarios>')]
+ (these (def .public <name>
+ .Analysis
+ (analysis (_ self phase archive [left <code>.any
+ right <code>.any])
+ (<| type.with_var
+ (function (_ [$it :it:]))
+ (do [! phase.monad]
+ [left (type.expecting :it: (phase archive left))
+ right (type.expecting :it: (phase archive right))
+ _ (type.inference :it:)
+ :it: (type.check (check.identity (list) $it))]
+ (`` (cond (check.subsumes? .I64 :it:)
+ (phase.except ..no_arithmetic_for [:it:])
+
+ (,, (with_template [<type> <+>]
+ [(check.subsumes? <type> :it:)
+ (..composite phase archive (` <+>) right (list left))]
+
+ <scenarios>))
+
+ ... else
+ (phase.except ..no_arithmetic_for [:it:])))))))))]
[% [[.Nat nat.%]
[.Int "lux i64 %"]
diff --git a/stdlib/source/library/lux/meta/compiler/default/init.lux b/stdlib/source/library/lux/meta/compiler/default/init.lux
index b496058e6..b749ffdee 100644
--- a/stdlib/source/library/lux/meta/compiler/default/init.lux
+++ b/stdlib/source/library/lux/meta/compiler/default/init.lux
@@ -68,23 +68,23 @@
(let [synthesis_state [synthesisE.bundle ///synthesis.init]
generation_state [generation_bundle (///generation.state host module)]
lux (///analysis.state (///analysis.info version.latest target configuration))
- eval (///analysis/evaluation.evaluator expander
+ analysis_phase (analysisP.phase extender expander)
+ eval (///analysis/evaluation.evaluator analysis_phase
[synthesis_state (synthesisP.phase extender lux)]
[generation_state (generate extender lux)])
analysis_state [(analysisE.bundle eval anchor,expression,declaration host_analysis)
lux]]
[extension.empty
[///declaration.#analysis [///declaration.#state analysis_state
- ///declaration.#phase (analysisP.phase expander)]
+ ///declaration.#phase analysis_phase]
///declaration.#synthesis [///declaration.#state synthesis_state
///declaration.#phase (synthesisP.phase extender)]
///declaration.#generation [///declaration.#state generation_state
///declaration.#phase (generate extender)]]]))
-(def .public (with_default_declarations expander host_analysis program anchorT,expressionT,declarationT extender)
+(def .public (with_default_declarations host_analysis program anchorT,expressionT,declarationT extender)
(All (_ anchor expression declaration)
- (-> Expander
- ///analysis.Bundle
+ (-> ///analysis.Bundle
(Program expression declaration)
[Type Type Type]
Extender
@@ -92,7 +92,7 @@
(///declaration.State+ anchor expression declaration))))
(function (_ [declaration_extensions sub_state])
[(dictionary.composite declaration_extensions
- (luxD.bundle expander host_analysis program anchorT,expressionT,declarationT extender))
+ (luxD.bundle host_analysis program anchorT,expressionT,declarationT extender))
sub_state]))
(type Reader
diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux
index af7fef44e..9b11c3348 100644
--- a/stdlib/source/library/lux/meta/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux
@@ -277,7 +277,7 @@
(initialize_state extender
(as_expected (..complete_extensions host_declaration_bundle (as_expected bundles)))
analysis_state)
- (try#each (//init.with_default_declarations expander host_analysis program anchor,expression,declaration extender))
+ (try#each (//init.with_default_declarations host_analysis program anchor,expression,declaration extender))
async#in)))]]
(if (archive.archived? archive descriptor.runtime)
(do !
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux
index 47fbb877c..f97722a14 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Tuple Variant Pattern #Function #Apply nat int rev when local except)
+ [lux (.except Tuple Variant Pattern Analysis #Function #Apply nat int rev when local except)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]
@@ -255,6 +255,7 @@
[Phase extension.Phase]
[Handler extension.Handler]
[Bundle extension.Bundle]
+ [Extender extension.Extender]
)
(def .public (with_source_code source action)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/evaluation.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/evaluation.lux
index 95fba2a56..c89ce3db1 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/evaluation.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/evaluation.lux
@@ -18,7 +18,6 @@
["[0]" meta (.only)
[type (.only sharing)]]]]
["[0]" // (.only Operation)
- [macro (.only Expander)]
["[1][0]" type]
["[1][0]" scope]
[//
@@ -41,41 +40,40 @@
(Atom (Dictionary module.ID Nat))
(atom.atom (dictionary.empty n.hash)))
-(def .public (evaluator expander
+(def .public (evaluator analysis
[synthesis_state synthesis]
[generation_state generation])
(All (_ anchor expression artifact)
- (-> Expander
+ (-> //.Phase
[synthesis.State+
synthesis.Phase]
[(generation.State+ anchor expression artifact)
(generation.Phase anchor expression artifact)]
Eval))
- (let [analysis (analysisP.phase expander)]
- (function (eval archive type exprC)
- (do phase.monad
- [exprA (<| (//type.expecting type)
- //scope.reset
- (analysis archive exprC))
- module (extensionP.lifted
- meta.current_module_name)]
- (<| phase.lifted
- (do try.monad
- [exprS (|> exprA
- (synthesis archive)
- (phase.result synthesis_state))])
- (phase.result generation_state)
- (do phase.monad
- [@module (sharing [anchor expression artifact]
- (is (generation.Phase anchor expression artifact)
- generation)
- (is (generation.Operation anchor expression artifact module.ID)
- (generation.module_id module archive)))
- .let [[evals _] (io.run! (atom.update! (dictionary.revised' @module 0 ++) ..evals))
- @eval (maybe.else 0 (dictionary.value @module evals))]
- exprO (<| (generation.with_registry_shift (|> @module
- ("lux i64 left-shift" 16)
- ("lux i64 or" @eval)
- ("lux i64 left-shift" 32)))
- (generation archive exprS))]
- (generation.evaluate! [@module @eval] [{.#None} exprO])))))))
+ (function (eval archive type exprC)
+ (do phase.monad
+ [exprA (<| (//type.expecting type)
+ //scope.reset
+ (analysis archive exprC))
+ module (extensionP.lifted
+ meta.current_module_name)]
+ (<| phase.lifted
+ (do try.monad
+ [exprS (|> exprA
+ (synthesis archive)
+ (phase.result synthesis_state))])
+ (phase.result generation_state)
+ (do phase.monad
+ [@module (sharing [anchor expression artifact]
+ (is (generation.Phase anchor expression artifact)
+ generation)
+ (is (generation.Operation anchor expression artifact module.ID)
+ (generation.module_id module archive)))
+ .let [[evals _] (io.run! (atom.update! (dictionary.revised' @module 0 ++) ..evals))
+ @eval (maybe.else 0 (dictionary.value @module evals))]
+ exprO (<| (generation.with_registry_shift (|> @module
+ ("lux i64 left-shift" 16)
+ ("lux i64 or" @eval)
+ ("lux i64 left-shift" 32)))
+ (generation archive exprS))]
+ (generation.evaluate! [@module @eval] [{.#None} exprO]))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux
index 5765aa7a9..cd36aa83f 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/analysis/inference.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
[abstract
["[0]" monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux
index 2775a6787..711ffdba3 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis.lux
@@ -1,9 +1,10 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
[abstract
[monad (.only do)]]
[control
+ ["[0]" try]
["[0]" exception (.only Exception)]]
[data
[text
@@ -17,7 +18,9 @@
["[0]" location]
["[0]" code]
[macro
- ["^" pattern]]]]]
+ ["^" pattern]]
+ [type
+ ["[0]" check]]]]]
["[0]" /
["[1][0]" simple]
["[1][0]" complex]
@@ -27,7 +30,7 @@
["/[1]" //
["[1][0]" extension]
["/[1]" //
- ["/" analysis (.only Analysis Operation Phase)
+ ["/" analysis (.only Analysis Operation Phase Extender)
["[1][0]" macro (.only Expander)]
["[1][0]" type]]
[///
@@ -41,6 +44,7 @@
(exception.report
(list ["Syntax" (%.code syntax)])))
+... TODO: Replace with an inline function.
(def variant_analysis
(template (_ analysis archive tag values)
... (-> Phase Archive Symbol (List Code) (Operation Analysis))
@@ -51,6 +55,7 @@
_
(/complex.variant analysis tag archive (code.tuple values)))]))
+... TODO: Replace with an inline function.
(def sum_analysis
(template (_ analysis archive lefts right? values)
... (-> Phase Archive Nat Bit (List Code) (Operation Analysis))
@@ -61,6 +66,7 @@
_
(/complex.sum analysis lefts right? archive (code.tuple values)))]))
+... TODO: Replace with an inline function.
(def when_analysis
(template (_ analysis archive input branches code)
... (-> Phase Archive Code (List Code) Code (Operation Analysis))
@@ -71,30 +77,53 @@
{.#None}
(//.except ..invalid [code]))]))
+(exception.def .public (not_an_extension [name expected actual])
+ (Exception [Symbol Type Type])
+ (exception.report
+ (list ["Name" (%.symbol name)]
+ ["Expected" (%.type expected)]
+ ["Actual" (%.type actual)])))
+
+(def (extension_application extender
+ phase archive
+ name parameters)
+ (-> Extender
+ Phase Archive
+ Symbol (List Code)
+ (Operation Analysis))
+ (do //.monad
+ [[exported? type value] (//extension.lifted (meta.export name))]
+ (if (check.subsumes? .Analysis type)
+ ((extender value) "" phase archive parameters)
+ (//.except ..not_an_extension [name .Analysis type]))))
+
+... TODO: Replace with an inline function.
(def apply_analysis
- (template (_ expander analysis archive functionC argsC+)
- ... (-> Expander Phase Archive Code (List Code) (Operation Analysis))
+ (template (_ extender expander analysis archive functionC argsC+)
+ ... (-> Extender Expander Phase Archive Code (List Code) (Operation Analysis))
[(do [! //.monad]
- [[functionT functionA] (/type.inferring
- (analysis archive functionC))]
- (when functionA
+ [[function_type function_analysis] (/type.inferring
+ (analysis archive functionC))]
+ (when function_analysis
(/.constant def_name)
- (do !
- [?macro (//extension.lifted (meta.macro def_name))]
- (when ?macro
- {.#Some macro}
- (do !
- [expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
- (analysis archive expansion))
-
- _
- (/function.apply analysis argsC+ functionT functionA archive functionC)))
+ (if (check.subsumes? .Analysis function_type)
+ (extension_application extender analysis archive def_name argsC+)
+ (do !
+ [?macro (//extension.lifted (meta.macro def_name))]
+ (when ?macro
+ {.#Some macro}
+ (do !
+ [expansion (//extension.lifted (/macro.single_expansion expander def_name macro argsC+))]
+ (analysis archive expansion))
+
+ _
+ (/function.apply analysis argsC+ function_type function_analysis archive functionC))))
_
- (/function.apply analysis argsC+ functionT functionA archive functionC)))]))
+ (/function.apply analysis argsC+ function_type function_analysis archive functionC)))]))
-(def .public (phase expander)
- (-> Expander Phase)
+(def .public (phase extender expander)
+ (-> Extender Expander Phase)
(function (analysis archive code)
(<| (let [[location code'] code])
... The location must be set in the state for the sake
@@ -130,7 +159,7 @@
(//extension.apply archive analysis [extension_name extension_args])
(^.` ((^., functionC) (^.,* argsC+)))
- (..apply_analysis expander analysis archive functionC argsC+)
+ (..apply_analysis extender expander analysis archive functionC argsC+)
(^.` {(^., [_ {.#Nat lefts}]) (^., [_ {.#Bit right?}]) (^.,* values)})
(..sum_analysis analysis archive lefts right? values)
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux
index 885f2c364..a7f8bd83b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Tag)
+ [lux (.except Tag Analysis)
[abstract
["[0]" monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux
index 30f87ec84..a6d191510 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/function.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except function)
+ [lux (.except Analysis function)
[abstract
[monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux
index 26831fe0a..6d74996cc 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/reference.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
[abstract
[monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/simple.lux
index c20161ec3..e83cf63bd 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/simple.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/simple.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except nat int rev)
+ [lux (.except Analysis nat int rev)
[abstract
[monad (.only do)]]]]
["[0]" ///
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux
index 3378f2a4c..5a214df20 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Pattern when)
+ [lux (.except Pattern Analysis when)
[abstract
["[0]" monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux
index 4bfc09f26..5da3a891b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/declaration.lux
@@ -80,51 +80,51 @@
(with_expansions [<lux_def_module> (these [|form_location| {.#Form (list.partial [|text_location| {.#Text "lux def module"}] annotations)}])]
(def .public (phase wrapper expander)
(-> //.Wrapper Expander Phase)
- (let [analysis (//analysis.phase expander)]
- (function (again archive code)
- (do [! //.monad]
- [state //.state
- .let [compiler_eval (meta_eval archive
- (the [//extension.#state /.#analysis /.#state //extension.#bundle] state)
- (let [analysis_state (the [//extension.#state /.#analysis /.#state //extension.#state] state)]
- (evaluation.evaluator expander
- [(the [//extension.#state /.#synthesis /.#state] state)
- ((the [//extension.#state /.#synthesis /.#phase] state) analysis_state)]
- [(the [//extension.#state /.#generation /.#state] state)
- ((the [//extension.#state /.#generation /.#phase] state) analysis_state)])))
- extension_eval (as Eval (wrapper (as_expected compiler_eval)))]
- _ (//.with (has [//extension.#state /.#analysis /.#state //extension.#state .#eval] extension_eval state))]
- (when code
- [_ {.#Form (list.partial [_ {.#Text name}] inputs)}]
- (//extension.apply archive again [name inputs])
+ (function (again archive code)
+ (do [! //.monad]
+ [state //.state
+ .let [analysis (the [//extension.#state /.#analysis /.#phase] state)
+ compiler_eval (meta_eval archive
+ (the [//extension.#state /.#analysis /.#state //extension.#bundle] state)
+ (let [analysis_state (the [//extension.#state /.#analysis /.#state //extension.#state] state)]
+ (evaluation.evaluator analysis
+ [(the [//extension.#state /.#synthesis /.#state] state)
+ ((the [//extension.#state /.#synthesis /.#phase] state) analysis_state)]
+ [(the [//extension.#state /.#generation /.#state] state)
+ ((the [//extension.#state /.#generation /.#phase] state) analysis_state)])))
+ extension_eval (as Eval (wrapper (as_expected compiler_eval)))]
+ _ (//.with (has [//extension.#state /.#analysis /.#state //extension.#state .#eval] extension_eval state))]
+ (when code
+ [_ {.#Form (list.partial [_ {.#Text name}] inputs)}]
+ (//extension.apply archive again [name inputs])
- [_ {.#Form (list.partial macro inputs)}]
- (do !
- [expansion (/.lifted_analysis
- (do !
- [macroA (<| (///analysis/type.expecting Macro)
- (analysis archive macro))]
- (when macroA
- (///analysis.constant macro_name)
- (do !
- [?macro (//extension.lifted (meta.macro macro_name))
- macro (when ?macro
- {.#Some macro}
- (in macro)
-
- {.#None}
- (//.except ..macro_was_not_found macro_name))]
- (//extension.lifted (///analysis/macro.expansion expander macro_name macro inputs)))
-
- _
- (//.except ..invalid_macro_call code))))]
- (when expansion
- (list.partial <lux_def_module> referrals)
- (|> (again archive <lux_def_module>)
- (at ! each (revised /.#referrals (list#composite referrals))))
+ [_ {.#Form (list.partial macro inputs)}]
+ (do !
+ [expansion (/.lifted_analysis
+ (do !
+ [macroA (<| (///analysis/type.expecting Macro)
+ (analysis archive macro))]
+ (when macroA
+ (///analysis.constant macro_name)
+ (do !
+ [?macro (//extension.lifted (meta.macro macro_name))
+ macro (when ?macro
+ {.#Some macro}
+ (in macro)
+
+ {.#None}
+ (//.except ..macro_was_not_found macro_name))]
+ (//extension.lifted (///analysis/macro.expansion expander macro_name macro inputs)))
+
+ _
+ (//.except ..invalid_macro_call code))))]
+ (when expansion
+ (list.partial <lux_def_module> referrals)
+ (|> (again archive <lux_def_module>)
+ (at ! each (revised /.#referrals (list#composite referrals))))
- _
- (..requiring again archive expansion)))
+ _
+ (..requiring again archive expansion)))
- _
- (//.except ..not_a_declaration code)))))))
+ _
+ (//.except ..not_a_declaration code))))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/js.lux
index e1fe38771..45289a754 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/js.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/js.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
index 596336ddc..75909c343 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Type Module Primitive char int type)
+ [lux (.except Type Module Primitive Analysis char int type)
["[0]" ffi (.only import)]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lua.lux
index 803e0f40f..df55ed895 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lua.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lua.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
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 edde397d7..e48295d6a 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
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
[abstract
["[0]" monad (.only do)]]
[control
@@ -28,7 +28,7 @@
["[1][0]" bundle]
["/[1]" //
[//
- ["[1][0]" analysis (.only Analysis Operation Phase Handler Bundle)
+ ["[0]" analysis (.only Analysis Operation Phase Handler Bundle)
[evaluation (.only Eval)]
["[0]A" type]]
["[0]" synthesis]
@@ -49,7 +49,7 @@
(handler extension_name analyse archive inputs)
{try.#Failure _}
- (////analysis.except ///.invalid_syntax [extension_name %.code args]))))
+ (analysis.except ///.invalid_syntax [extension_name %.code args]))))
(def (simple inputsT+ outputT)
(-> (List Type) Type Handler)
@@ -64,8 +64,8 @@
(<| (typeA.expecting argT)
(analyse archive argC)))
(list.zipped_2 inputsT+ args))]
- (in {////analysis.#Extension ["" extension_name] argsA}))
- (////analysis.except ///.incorrect_arity [extension_name num_expected num_actual]))))))
+ (in {analysis.#Extension ["" extension_name] argsA}))
+ (analysis.except ///.incorrect_arity [extension_name num_expected num_actual]))))))
(def .public (nullary valueT)
(-> Type Handler)
@@ -120,11 +120,11 @@
(phase archive else))]
(in (|> conditionals
(list#each (function (_ [cases branch])
- (////analysis.tuple
- (list (////analysis.tuple (list#each (|>> ////analysis.nat) cases))
+ (analysis.tuple
+ (list (analysis.tuple (list#each (|>> analysis.nat) cases))
branch))))
(list.partial input else)
- {////analysis.#Extension ["" extension_name]}))))])))
+ {analysis.#Extension ["" extension_name]}))))])))
... "lux is" represents reference/pointer equality.
(def lux::is
@@ -149,21 +149,21 @@
(|> opC
(analyse archive)
(typeA.expecting (type_literal (-> .Any :var:)))
- (at ! each (|>> list {////analysis.#Extension ["" extension_name]})))))
+ (at ! each (|>> list {analysis.#Extension ["" extension_name]})))))
_
- (////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)]))))
+ (analysis.except ///.incorrect_arity [extension_name 1 (list.size args)]))))
(def lux::in_module
Handler
(function (_ extension_name analyse archive argsC+)
(when argsC+
(list [_ {.#Text module_name}] exprC)
- (////analysis.with_current_module module_name
+ (analysis.with_current_module module_name
(analyse archive exprC))
_
- (////analysis.except ///.invalid_syntax [extension_name %.code argsC+]))))
+ (analysis.except ///.invalid_syntax [extension_name %.code argsC+]))))
(def (lux::type::check eval)
(-> Eval Handler)
@@ -178,7 +178,7 @@
(analyse archive valueC)))
_
- (////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)]))))
+ (analysis.except ///.incorrect_arity [extension_name 2 (list.size args)]))))
(def (lux::type::as eval)
(-> Eval Handler)
@@ -194,7 +194,7 @@
(in valueA))
_
- (////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)]))))
+ (analysis.except ///.incorrect_arity [extension_name 2 (list.size args)]))))
(def (caster input output)
(-> Type Type Handler)
@@ -275,15 +275,15 @@
(///bundle.install "clip" (trinary Nat Nat Text Text))
)))
-(def synthesis_extension
- Handler
+(def (simple_extension transparent_type opaque_type)
+ (-> Type Type Handler)
(..custom
[<code>.any
(function (_ extension_name phase archive [it])
(do [! ////.monad]
- [it (<| (typeA.expecting synthesis.Handler)
+ [it (<| (typeA.expecting transparent_type)
(phase archive it))
- _ (typeA.inference .Synthesis)]
+ _ (typeA.inference opaque_type)]
(in it)))]))
(def (generation_extension [anchor expression declaration])
@@ -301,7 +301,8 @@
(-> [Type Type Type] Bundle)
(<| (///bundle.prefix "extension")
(|> ///bundle.empty
- (///bundle.install "synthesis" synthesis_extension)
+ (///bundle.install "analysis" (simple_extension analysis.Handler .Analysis))
+ (///bundle.install "synthesis" (simple_extension synthesis.Handler .Synthesis))
(///bundle.install "generation" (generation_extension anchor,expression,declaration))
)))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/php.lux
index b5a632992..6c760c90b 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/php.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/php.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/python.lux
index 1f7316fbd..823ffe79a 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/python.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/python.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/r.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/r.lux
index 6dc3f4c09..00d7d7a70 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/r.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/r.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux
index 60c77b4e7..cf07042d4 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/ruby.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/scheme.lux
index 089e5ae69..e25f1c682 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/scheme.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/scheme.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except)
+ [lux (.except Analysis)
["[0]" ffi]
[abstract
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
index 8a3f5727d..945dbb3ea 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/declaration/jvm.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Type Definition Primitive Synthesis)
+ [lux (.except Type Definition Primitive Analysis Synthesis)
["[0]" ffi (.only import)]
[abstract
["[0]" monad (.only do)]]
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 d7a42d308..d138f22f2 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
@@ -221,13 +221,14 @@
)
... TODO: Get rid of this function ASAP.
-(def (refresh expander anchor,expression,declaration host_analysis)
+(def (refresh anchor,expression,declaration host_analysis)
(All (_ anchor expression declaration)
- (-> Expander [Type Type Type] /////analysis.Bundle (Operation anchor expression declaration Any)))
+ (-> [Type Type Type] /////analysis.Bundle (Operation anchor expression declaration Any)))
(do phase.monad
[[bundle state] phase.state
.let [analysis_state (the [/////declaration.#analysis /////declaration.#state ///.#state] state)
- eval (/////analysis/evaluation.evaluator expander
+ analysis_phase (the [/////declaration.#analysis /////declaration.#phase] state)
+ eval (/////analysis/evaluation.evaluator analysis_phase
[(the [/////declaration.#synthesis /////declaration.#state] state)
((the [/////declaration.#synthesis /////declaration.#phase] state) analysis_state)]
[(the [/////declaration.#generation /////declaration.#state] state)
@@ -247,8 +248,8 @@
(/////declaration.lifted_generation
(/////generation.log! (format short " : " (%.type type)))))
-(def (lux::def expander anchor,expression,declaration host_analysis)
- (-> Expander [Type Type Type] /////analysis.Bundle Handler)
+(def (lux::def anchor,expression,declaration host_analysis)
+ (-> [Type Type Type] /////analysis.Bundle Handler)
(function (_ extension_name phase archive inputsC+)
(when inputsC+
(list [_ {.#Symbol ["" short_name]}] valueC exported?C)
@@ -260,7 +261,7 @@
[_ _ exported?] (evaluate! archive Bit exported?C)
_ (/////declaration.lifted_analysis
(moduleA.define short_name {.#Definition [(as Bit exported?) type value]}))
- _ (..refresh expander anchor,expression,declaration host_analysis)
+ _ (..refresh anchor,expression,declaration host_analysis)
_ (..announce_definition! short_name type)]
(in /////declaration.no_requirements))
@@ -404,11 +405,6 @@
_
(phase.except ///.invalid_syntax [extension_name %.code inputsC+]))))]
- ["Analysis"
- def_analysis
- /////analysis.Handler /////analysis.Handler
- /////declaration.lifted_analysis
- ..analyser]
["Declaration"
def_declaration
(/////declaration.Handler anchorT expressionT declarationT) (/////declaration.Handler anchor expression declaration)
@@ -416,10 +412,9 @@
..declaration]
)
-(def (bundle::def expander host_analysis program anchor,expression,declaration extender)
+(def (bundle::def host_analysis program anchor,expression,declaration extender)
(All (_ anchor expression declaration)
- (-> Expander
- /////analysis.Bundle
+ (-> /////analysis.Bundle
(Program expression declaration)
[Type Type Type]
Extender
@@ -428,19 +423,17 @@
(|> ///bundle.empty
(dictionary.has "module" def_module)
(dictionary.has "alias" def_alias)
- (dictionary.has "analysis" (def_analysis anchor,expression,declaration extender))
(dictionary.has "declaration" (def_declaration anchor,expression,declaration extender))
)))
-(def .public (bundle expander host_analysis program anchor,expression,declaration extender)
+(def .public (bundle host_analysis program anchor,expression,declaration extender)
(All (_ anchor expression declaration)
- (-> Expander
- /////analysis.Bundle
+ (-> /////analysis.Bundle
(Program expression declaration)
[Type Type Type]
Extender
(Bundle anchor expression declaration)))
(<| (///bundle.prefix "lux")
(|> ///bundle.empty
- (dictionary.has "def" (lux::def expander anchor,expression,declaration host_analysis))
- (dictionary.composite (..bundle::def expander host_analysis program anchor,expression,declaration extender)))))
+ (dictionary.has "def" (lux::def anchor,expression,declaration host_analysis))
+ (dictionary.composite (..bundle::def host_analysis program anchor,expression,declaration extender)))))
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux
index 3208a7b7d..1e5562447 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Synthesis)
+ [lux (.except Synthesis Analysis)
[abstract
["[0]" monad (.only do)]]
[control
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux
index 7d7c30660..7f9b5f218 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/function.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Synthesis)
+ [lux (.except Analysis Synthesis)
[abstract
["[0]" monad (.only do)]
["[0]" enum]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux
index 19ffdf596..10c58a62f 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/synthesis/when.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Pattern Synthesis)
+ [lux (.except Pattern Analysis Synthesis)
[abstract
[equivalence (.only Equivalence)]
["[0]" monad (.only do)]]
diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux
index 22c0e171d..6ef3645d3 100644
--- a/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/meta/compiler/language/lux/synthesis.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except Scope Synthesis #Function #Apply #locals i64)
+ [lux (.except Scope Analysis Synthesis #Function #Apply #locals i64)
[abstract
[monad (.only do)]
[equivalence (.only Equivalence)]
diff --git a/stdlib/source/library/lux/meta/extension.lux b/stdlib/source/library/lux/meta/extension.lux
index ef086411b..18012001c 100644
--- a/stdlib/source/library/lux/meta/extension.lux
+++ b/stdlib/source/library/lux/meta/extension.lux
@@ -63,7 +63,6 @@
(phase.failure (, g!error)))
)))))))))]
- [<c>.any <c>.end <c>.and <c>.result "lux def analysis" analysis]
[<c>.any <c>.end <c>.and <c>.result "lux def declaration" declaration]
)
@@ -95,6 +94,7 @@
(phase.failure (, g!error)))
)))))))))]
+ [<c>.any <c>.end <c>.and <c>.result "lux extension analysis" analysis .Analysis]
[<a>.any <a>.end <a>.and <a>.result "lux extension synthesis" synthesis .Synthesis]
[<s>.any <s>.end <s>.and <s>.result "lux extension generation" generation .Generation]
)
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
index 968085cc4..1a32701c5 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
@@ -1,6 +1,6 @@
(.require
[library
- [lux (.except nat int rev local)
+ [lux (.except Analysis nat int rev local)
[abstract
[monad (.only do)]]
[control
diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux
index 44d884440..a7f585379 100644
--- a/stdlib/source/test/lux/meta/extension.lux
+++ b/stdlib/source/test/lux/meta/extension.lux
@@ -64,16 +64,11 @@
[\\library
["[0]" / (.only analysis synthesis generation declaration)]])))
-(def dummy_generation "dummy generation")
-
(with_template [<name>]
[(def <name>
Text
(`` (%.symbol (symbol (,, (template.symbol [.._ <name>]))))))]
- [my_analysis]
- [my_synthesis]
- [my_generation]
[my_declaration]
)
@@ -90,8 +85,10 @@
(these))
... Analysis
- (analysis (..my_analysis self phase archive [pass_through <code>.any])
- (phase archive pass_through))
+ (def my_analysis
+ Analysis
+ (analysis (_ self phase archive [pass_through <code>.any])
+ (phase archive pass_through)))
... Synthesis
(def my_synthesis|synthesis
@@ -99,11 +96,13 @@
(synthesis (_ self phase archive [pass_through <analysis>.any])
(phase archive pass_through)))
- (analysis (..my_synthesis self phase archive [parameters (<>.some <code>.any)])
- (let [! phase.monad]
- (|> parameters
- (monad.each ! (phase archive))
- (at ! each (|>> {analysis.#Extension (symbol ..my_synthesis|synthesis)})))))
+ (def my_synthesis
+ Analysis
+ (analysis (_ self phase archive [parameters (<>.some <code>.any)])
+ (let [! phase.monad]
+ (|> parameters
+ (monad.each ! (phase archive))
+ (at ! each (|>> {analysis.#Extension (symbol ..my_synthesis|synthesis)}))))))
... Generation
(def my_generation|generation
@@ -119,16 +118,18 @@
(monad.each ! (phase archive))
(at ! each (|>> {synthesis.#Extension (symbol ..my_generation|generation)}))))))
- (analysis (..my_generation self phase archive [parameters (<>.some <code>.any)])
- (let [! phase.monad]
- (|> parameters
- (monad.each ! (phase archive))
- (at ! each (|>> {analysis.#Extension (symbol ..my_generation|synthesis)})))))
+ (def my_generation
+ Analysis
+ (analysis (_ self phase archive [parameters (<>.some <code>.any)])
+ (let [! phase.monad]
+ (|> parameters
+ (monad.each ! (phase archive))
+ (at ! each (|>> {analysis.#Extension (symbol ..my_generation|synthesis)}))))))
(def dummy_generation|generation
Generation
(generation (_ self phase archive [])
- (let [self ..dummy_generation]
+ (let [[_ self] (symbol ..dummy_generation)]
(at phase.monad in
(for @.jvm (jvm.string self)
@.js (js.string self)
@@ -143,8 +144,10 @@
(synthesis (_ self phase archive [])
(at phase.monad in {synthesis.#Extension (symbol ..dummy_generation|generation) (list)})))
- (analysis (..dummy_generation self phase archive [])
- (at phase.monad in {analysis.#Extension (symbol ..dummy_generation|synthesis) (list)}))
+ (def dummy_generation
+ Analysis
+ (analysis (_ self phase archive [])
+ (at phase.monad in {analysis.#Extension (symbol ..dummy_generation|synthesis) (list)})))
... Declaration
(declaration (..my_declaration self phase archive [expression <code>.any])
@@ -208,16 +211,17 @@
[(_.coverage [<macro>]
(for @.old false
(n.= expected
- (`` ((,, (static <extension>)) expected)))))]
+ (<extension> expected))))]
[/.analysis ..my_analysis]
[/.synthesis ..my_synthesis]))
(_.coverage [/.generation]
(for @.old false
(and (n.= expected
- (`` ((,, (static ..my_generation)) expected)))
- (text#= ..dummy_generation
- (`` ((,, (static ..dummy_generation))))))))
+ (..my_generation expected))
+ (let [[_ expected] (symbol ..dummy_generation)]
+ (text#= expected
+ (..dummy_generation))))))
(_.coverage [/.declaration]
true)
)))))