diff options
author | Eduardo Julian | 2020-07-14 03:55:43 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-07-14 03:55:43 -0400 |
commit | de1d6adc6657feb81332db8620094dd8de150b96 (patch) | |
tree | 372ca3d12277c859b276fd57e1b5ac94c0b5eefd /stdlib/source/lux/tool | |
parent | 6346bc55f8b62b48253369fa1f28b93d6500e885 (diff) |
Mo' fixes, less problems.
Diffstat (limited to 'stdlib/source/lux/tool')
4 files changed, 41 insertions, 25 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/init.lux b/stdlib/source/lux/tool/compiler/default/init.lux index 88bf45304..a1dff7792 100644 --- a/stdlib/source/lux/tool/compiler/default/init.lux +++ b/stdlib/source/lux/tool/compiler/default/init.lux @@ -49,7 +49,7 @@ ["." artifact] ["." document]]]]]) -(def: #export (state target module expander host-analysis host generate generation-bundle host-directive-bundle program extender) +(def: #export (state target module expander host-analysis host generate generation-bundle host-directive-bundle program anchorT,expressionT,directiveT extender) (All [anchor expression directive] (-> Host Module @@ -60,7 +60,7 @@ (///generation.Bundle anchor expression directive) (///directive.Bundle anchor expression directive) (Program expression directive) - Extender + [Type Type Type] Extender (///directive.State+ anchor expression directive))) (let [synthesis-state [synthesisE.bundle ///synthesis.init] generation-state [generation-bundle (///generation.state host module)] @@ -68,7 +68,7 @@ analysis-state [(analysisE.bundle eval host-analysis) (///analysis.state (///analysis.info ///version.version target))]] [(dictionary.merge host-directive-bundle - (luxD.bundle expander host-analysis program extender)) + (luxD.bundle expander host-analysis program anchorT,expressionT,directiveT extender)) {#///directive.analysis {#///directive.state analysis-state #///directive.phase (analysisP.phase expander)} #///directive.synthesis {#///directive.state synthesis-state diff --git a/stdlib/source/lux/tool/compiler/default/platform.lux b/stdlib/source/lux/tool/compiler/default/platform.lux index f162cc157..0580372c1 100644 --- a/stdlib/source/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/lux/tool/compiler/default/platform.lux @@ -179,7 +179,7 @@ (///phase.run' state) (:: try.monad map product.left))) - (def: #export (initialize static module expander host-analysis platform generation-bundle host-directive-bundle program extender + (def: #export (initialize static module expander host-analysis platform generation-bundle host-directive-bundle program anchorT,expressionT,directiveT extender import compilation-sources) (All [<type-vars>] (-> Static @@ -190,7 +190,7 @@ <Bundle> (///directive.Bundle <type-vars>) (Program expression directive) - Extender + [Type Type Type] Extender Import (List Context) (Promise (Try [<State+> Archive])))) (do (try.with promise.monad) @@ -203,6 +203,7 @@ generation-bundle host-directive-bundle program + anchorT,expressionT,directiveT extender)] _ (ioW.enable (get@ #&file-system platform) static) [archive analysis-state bundles] (ioW.thaw (get@ #host platform) (get@ #&file-system platform) static import compilation-sources) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index 59557b6de..090f81842 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -303,10 +303,10 @@ (define-alias alias def-name)))] (wrap /////directive.no-requirements)))])) -(template [<description> <mame> <type> <scope> <definer>] - [(def: (<mame> extender) +(template [<description> <mame> <def-type> <type> <scope> <definer>] + [(def: (<mame> [anchorT expressionT directiveT] extender) (All [anchor expression directive] - (-> Extender + (-> [Type Type Type] Extender (Handler anchor expression directive))) (function (handler extension-name phase archive inputsC+) (case inputsC+ @@ -314,10 +314,7 @@ (do phase.monad [[_ _ name] (evaluate! archive Text nameC) [_ handlerV] (<definer> archive (:coerce Text name) - (:by-example [anchor expression directive] - {(Handler anchor expression directive) - handler} - <type>) + (type <def-type>) valueC) _ (<| <scope> (///.install extender (:coerce Text name)) @@ -333,10 +330,26 @@ _ (phase.throw ///.invalid-syntax [extension-name %.code inputsC+]))))] - ["Analysis" def::analysis /////analysis.Handler /////directive.lift-analysis ..analyser] - ["Synthesis" def::synthesis /////synthesis.Handler /////directive.lift-synthesis ..synthesizer] - ["Generation" def::generation (/////generation.Handler anchor expression directive) /////directive.lift-generation ..generator] - ["Directive" def::directive (/////directive.Handler anchor expression directive) (<|) ..directive] + ["Analysis" + def::analysis + /////analysis.Handler /////analysis.Handler + /////directive.lift-analysis + ..analyser] + ["Synthesis" + def::synthesis + /////synthesis.Handler /////synthesis.Handler + /////directive.lift-synthesis + ..synthesizer] + ["Generation" + def::generation + (/////generation.Handler anchorT expressionT directiveT) (/////generation.Handler anchor expression directive) + /////directive.lift-generation + ..generator] + ["Directive" + def::directive + (/////directive.Handler anchorT expressionT directiveT) (/////directive.Handler anchor expression directive) + (<|) + ..directive] ) ## TODO; Both "prepare-program" and "define-program" exist only @@ -393,11 +406,12 @@ _ (phase.throw ///.invalid-syntax [extension-name %.code inputsC+])))) -(def: (bundle::def expander host-analysis program extender) +(def: (bundle::def expander host-analysis program anchorT,expressionT,directiveT extender) (All [anchor expression directive] (-> Expander /////analysis.Bundle (Program expression directive) + [Type Type Type] Extender (Bundle anchor expression directive))) (<| (///bundle.prefix "def") @@ -405,21 +419,22 @@ (dictionary.put "module" def::module) (dictionary.put "alias" def::alias) (dictionary.put "type tagged" (def::type-tagged expander host-analysis)) - (dictionary.put "analysis" (def::analysis extender)) - (dictionary.put "synthesis" (def::synthesis extender)) - (dictionary.put "generation" (def::generation extender)) - (dictionary.put "directive" (def::directive extender)) + (dictionary.put "analysis" (def::analysis anchorT,expressionT,directiveT extender)) + (dictionary.put "synthesis" (def::synthesis anchorT,expressionT,directiveT extender)) + (dictionary.put "generation" (def::generation anchorT,expressionT,directiveT extender)) + (dictionary.put "directive" (def::directive anchorT,expressionT,directiveT extender)) (dictionary.put "program" (def::program program)) ))) -(def: #export (bundle expander host-analysis program extender) +(def: #export (bundle expander host-analysis program anchorT,expressionT,directiveT extender) (All [anchor expression directive] (-> Expander /////analysis.Bundle (Program expression directive) + [Type Type Type] Extender (Bundle anchor expression directive))) (<| (///bundle.prefix "lux") (|> ///bundle.empty (dictionary.put "def" (lux::def expander host-analysis)) - (dictionary.merge (..bundle::def expander host-analysis program extender))))) + (dictionary.merge (..bundle::def expander host-analysis program anchorT,expressionT,directiveT extender))))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 7c18df1b9..40322f88b 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -155,8 +155,8 @@ (runtime: (lux//try op) (with-vars [ex] - (_.try (_.return (_.apply/1 op ..unit)) - [ex (_.return (|> ex (_.do "toString" (list))))]))) + (_.try (_.return (..right (_.apply/1 op ..unit))) + [ex (_.return (..left (|> ex (_.do "toString" (list)))))]))) (def: length (-> Expression Computation) |