aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
authorEduardo Julian2021-07-17 22:48:54 -0400
committerEduardo Julian2021-07-17 22:48:54 -0400
commit442d1557b879a8a4bd76f441f72a17bfb71cf05f (patch)
tree7726138a487b3d64081c2cfdf99a564cf2b6ed7b /stdlib/source/library
parent2c99b4515447315d76a8dc203a2dbcafc09506ea (diff)
Now allowing compilers to generate custom-named outputs.
Diffstat (limited to 'stdlib/source/library')
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/init.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/generation.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux18
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux3
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux34
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux52
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux15
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/script.lux21
-rw-r--r--stdlib/source/library/lux/world/shell.lux12
23 files changed, 125 insertions, 99 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux
index 172de25e7..3d49eb706 100644
--- a/stdlib/source/library/lux/tool/compiler/default/init.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/init.lux
@@ -258,8 +258,8 @@
(wrap [state
(#.Right [descriptor
(document.write key analysis_module)
- (row\map (function (_ [artifact_id directive])
- [artifact_id (write_directive directive)])
+ (row\map (function (_ [artifact_id custom directive])
+ [artifact_id custom (write_directive directive)])
final_buffer)])]))
(#.Some [source requirements temporary_payload])
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index 9ebf79b7b..bc0e9b3cc 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -98,8 +98,8 @@
(-> Static <Platform> archive.ID [Descriptor (Document Any) Output]
(Promise (Try Any))))
(let [system (get@ #&file_system platform)
- write_artifact! (: (-> [artifact.ID Binary] (Action Any))
- (function (_ [artifact_id content])
+ write_artifact! (: (-> [artifact.ID (Maybe Text) Binary] (Action Any))
+ (function (_ [artifact_id custom content])
(ioW.write system static module_id artifact_id content)))]
(do {! ..monad}
[_ (ioW.prepare system static module_id)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
index 13d36021f..02adbd2bd 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux
@@ -34,7 +34,7 @@
[archive.ID artifact.ID])
(type: #export (Buffer directive)
- (Row [artifact.ID directive]))
+ (Row [artifact.ID (Maybe Text) directive]))
(exception: #export (cannot_interpret {error Text})
(exception.report
@@ -54,14 +54,14 @@
evaluate!)
(: (-> directive (Try Any))
execute!)
- (: (-> Context expression (Try [Text Any directive]))
+ (: (-> Context (Maybe Text) expression (Try [Text Any directive]))
define!)
(: (-> Context Binary directive)
ingest)
- (: (-> Context directive (Try Any))
+ (: (-> Context (Maybe Text) directive (Try Any))
re_learn)
- (: (-> Context directive (Try Any))
+ (: (-> Context (Maybe Text) directive (Try Any))
re_load))
(type: #export (State anchor expression directive)
@@ -210,20 +210,20 @@
(#try.Failure error)
(exception.throw ..cannot_interpret error))))
-(def: #export (define! context code)
+(def: #export (define! context custom code)
(All [anchor expression directive]
- (-> Context expression (Operation anchor expression directive [Text Any directive])))
+ (-> Context (Maybe Text) expression (Operation anchor expression directive [Text Any directive])))
(function (_ (^@ stateE [bundle state]))
- (case (\ (get@ #host state) define! context code)
+ (case (\ (get@ #host state) define! context custom code)
(#try.Success output)
(#try.Success [stateE output])
(#try.Failure error)
(exception.throw ..cannot_interpret error))))
-(def: #export (save! artifact_id code)
+(def: #export (save! artifact_id custom code)
(All [anchor expression directive]
- (-> artifact.ID directive (Operation anchor expression directive Any)))
+ (-> artifact.ID (Maybe Text) directive (Operation anchor expression directive Any)))
(do {! phase.monad}
[?buffer (extension.read (get@ #buffer))]
(case ?buffer
@@ -231,7 +231,7 @@
## TODO: Optimize by no longer checking for overwrites...
(if (row.any? (|>> product.left (n.= artifact_id)) buffer)
(phase.throw ..cannot_overwrite_output [artifact_id])
- (extension.update (set@ #buffer (#.Some (row.add [artifact_id code] buffer)))))
+ (extension.update (set@ #buffer (#.Some (row.add [artifact_id custom code] buffer)))))
#.None
(phase.throw ..no_buffer_for_saving_code [artifact_id]))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
index dc8272030..8fd5d2416 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux
@@ -114,8 +114,8 @@
[codeG (generate archive codeS)
id (/////generation.learn name)
module_id (phase.lift (archive.id module archive))
- [target_name value directive] (/////generation.define! [module_id id] codeG)
- _ (/////generation.save! id directive)]
+ [target_name value directive] (/////generation.define! [module_id id] #.None codeG)
+ _ (/////generation.save! id #.None directive)]
(wrap [code//type codeG value]))))
(def: (definition archive name expected codeC)
@@ -166,8 +166,8 @@
[codeG (generate archive codeS)
module_id (phase.lift (archive.id current_module archive))
id (<learn> extension)
- [target_name value directive] (/////generation.define! [module_id id] codeG)
- _ (/////generation.save! id directive)]
+ [target_name value directive] (/////generation.define! [module_id id] #.None codeG)
+ _ (/////generation.save! id #.None directive)]
(wrap [codeG value])))))
(def: #export (<full> archive extension codeT codeC)
@@ -393,7 +393,7 @@
(do phase.monad
[programG (generate archive programS)
artifact_id (/////generation.learn /////program.name)]
- (/////generation.save! artifact_id (program [module_id artifact_id] programG))))
+ (/////generation.save! artifact_id #.None (program [module_id artifact_id] programG))))
(def: (def::program program)
(All [anchor expression directive]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
index df13919b0..0f2d9adf6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
@@ -119,5 +119,5 @@
@self))))))))
))]
_ (/////generation.execute! definition)
- _ (/////generation.save! (product.right function_name) definition)]
+ _ (/////generation.save! (product.right function_name) #.None definition)]
(wrap instantiation)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index 2f6370418..65783662a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -775,11 +775,12 @@
(Operation [Registry Output])
(do ///////phase.monad
[_ (/////generation.execute! ..runtime)
- _ (/////generation.save! ..module_id ..runtime)]
+ _ (/////generation.save! ..module_id #.None ..runtime)]
(wrap [(|> artifact.empty
artifact.resource
product.right)
(row.row [..module_id
+ #.None
(|> ..runtime
_.code
(\ utf8.codec encode))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
index 37cda09e1..42d9cf2a4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux
@@ -87,7 +87,7 @@
class.public
class.final))
-(def: this-offset 1)
+(def: this_offset 1)
(def: internal
(All [category]
@@ -98,22 +98,22 @@
(def: #export (abstraction generate archive [environment arity bodyS])
(Generator Abstraction)
(do phase.monad
- [@begin //runtime.forge-label
- [function-context bodyG] (generation.with-new-context archive
- (generation.with-anchor [@begin ..this-offset]
+ [@begin //runtime.forge_label
+ [function_context bodyG] (generation.with_new_context archive
+ (generation.with_anchor [@begin ..this_offset]
(generate archive bodyS)))
- #let [function-class (//runtime.class-name function-context)]
- [fields methods instance] (..with generate archive @begin function-class environment arity bodyG)
+ #let [function_class (//runtime.class_name function_context)]
+ [fields methods instance] (..with generate archive @begin function_class environment arity bodyG)
class (phase.lift (class.class version.v6_0
..modifier
- (name.internal function-class)
+ (name.internal function_class)
(..internal /abstract.class) (list)
fields
methods
(row.row)))
#let [bytecode (format.run class.writer class)]
- _ (generation.execute! [function-class bytecode])
- _ (generation.save! function-class [function-class bytecode])]
+ _ (generation.execute! [function_class bytecode])
+ _ (generation.save! function_class #.None [function_class bytecode])]
(wrap instance)))
(def: #export (apply generate archive [abstractionS inputsS])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
index e445ec2d4..edfa6d78d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux
@@ -537,7 +537,7 @@
(row.row)))]
(do ////.monad
[_ (generation.execute! [class bytecode])]
- (generation.save! ..artifact_id [class bytecode]))))
+ (generation.save! ..artifact_id #.None [class bytecode]))))
(def: generate_function
(Operation Any)
@@ -594,7 +594,7 @@
(row.row)))]
(do ////.monad
[_ (generation.execute! [class bytecode])]
- (generation.save! //function.artifact_id [class bytecode]))))
+ (generation.save! //function.artifact_id #.None [class bytecode]))))
(def: #export generate
(Operation Any)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
index 97a5b1691..789d30fcc 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
@@ -133,5 +133,5 @@
(_.apply/1 @self))))))))
))]
_ (/////generation.execute! definition)
- _ (/////generation.save! (product.right function_name) definition)]
+ _ (/////generation.save! (product.right function_name) #.None definition)]
(wrap instantiation)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux
index a6719856c..18b65c352 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux
@@ -108,7 +108,7 @@
))
(|> @context (_.apply/* foreigns))])))]
_ (/////generation.execute! directive)
- _ (/////generation.save! artifact_id directive)]
+ _ (/////generation.save! artifact_id #.None directive)]
(wrap (|> instantiation (_.apply/* initsO+))))))
(def: #export (recur! statement expression archive argsS+)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index a0266db38..8f1e5b117 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -422,11 +422,12 @@
(Operation [Registry Output])
(do ///////phase.monad
[_ (/////generation.execute! ..runtime)
- _ (/////generation.save! ..module_id ..runtime)]
+ _ (/////generation.save! ..module_id #.None ..runtime)]
(wrap [(|> artifact.empty
artifact.resource
product.right)
(row.row [..module_id
+ #.None
(|> ..runtime
_.code
(\ utf8.codec encode))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
index a4e5e81fc..3a776a2a7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
@@ -330,5 +330,5 @@
directive (_.def @case @dependencies+
pattern_matching!)]
_ (/////generation.execute! directive)
- _ (/////generation.save! case_artifact directive)]
+ _ (/////generation.save! case_artifact #.None directive)]
(wrap (_.apply/* @case @dependencies+))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
index ca18fb0ef..d2e70def2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
@@ -48,7 +48,7 @@
#.Nil
(do ///////phase.monad
[_ (/////generation.execute! function_definition)
- _ (/////generation.save! function_id function_definition)]
+ _ (/////generation.save! function_id #.None function_definition)]
(wrap @function))
_
@@ -60,7 +60,7 @@
function_definition
(_.return @function)))]
_ (/////generation.execute! directive)
- _ (/////generation.save! function_id directive)]
+ _ (/////generation.save! function_id #.None directive)]
(wrap (_.apply/* @function inits)))))
(def: input
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
index 353c890f9..4ec21d754 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
@@ -103,7 +103,7 @@
))
(_.apply/* @loop foreigns)]))]
_ (/////generation.execute! directive)
- _ (/////generation.save! loop_artifact directive)]
+ _ (/////generation.save! loop_artifact #.None directive)]
(wrap (_.apply/* instantiation initsO+)))))
(def: #export (recur! statement expression archive argsS+)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 7a19539df..34009976f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -450,11 +450,12 @@
(/////generation.with_buffer
(do ///////phase.monad
[_ (/////generation.execute! ..runtime)
- _ (/////generation.save! ..module_id ..runtime)]
+ _ (/////generation.save! ..module_id #.None ..runtime)]
(wrap [(|> artifact.empty
artifact.resource
product.right)
(row.row [..module_id
+ #.None
(|> ..runtime
_.code
(\ utf8.codec encode))])]))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
index af7906c9c..c24efad81 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
@@ -108,5 +108,5 @@
(_.do "concat" (list @missing))))))))))))
)))]
_ (/////generation.execute! declaration)
- _ (/////generation.save! function_artifact declaration)]
+ _ (/////generation.save! function_artifact #.None declaration)]
(wrap instatiation)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 2ce60a9a1..3e8e09d8c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -393,11 +393,12 @@
(Operation [Registry Output])
(do ///////phase.monad
[_ (/////generation.execute! ..runtime)
- _ (/////generation.save! ..module_id ..runtime)]
+ _ (/////generation.save! ..module_id #.None ..runtime)]
(wrap [(|> artifact.empty
artifact.resource
product.right)
(row.row [..module_id
+ #.None
(|> ..runtime
_.code
(\ utf8.codec encode))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index 735e315c5..39beec921 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -39,7 +39,7 @@
[version (#+ Version)]]])
(type: #export Output
- (Row [artifact.ID Binary]))
+ (Row [artifact.ID (Maybe Text) Binary]))
(exception: #export (unknown_document {module Module}
{known_modules (List Module)})
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
index 33e09e51a..2c6deeb27 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
@@ -7,7 +7,7 @@
[pipe (#+ case>)]
["." exception (#+ exception:)]
["<>" parser
- ["<b>" binary (#+ Parser)]]]
+ ["<.>" binary (#+ Parser)]]]
[data
["." product]
["." text
@@ -30,7 +30,8 @@
(#Analyser Text)
(#Synthesizer Text)
(#Generator Text)
- (#Directive Text))
+ (#Directive Text)
+ (#Custom Text))
(type: #export Artifact
{#id ID
@@ -90,6 +91,7 @@
[#Synthesizer synthesizer synthesizers]
[#Generator generator generators]
[#Directive directive directives]
+ [#Custom custom customs]
)
(def: #export (remember name registry)
@@ -109,8 +111,9 @@
[1 #Definition binary.text]
[2 #Analyser binary.text]
[3 #Synthesizer binary.text]
- [4 #Generator binary.text]
- [5 #Directive binary.text]))))
+ [4 #Generator binary.text]
+ [5 #Directive binary.text]
+ [6 #Custom binary.text]))))
artifacts (: (Writer (Row Category))
(binary.row/64 category))]
(|>> :representation
@@ -126,16 +129,20 @@
(Parser Registry)
(let [category (: (Parser Category)
(do {! <>.monad}
- [tag <b>.nat]
+ [tag <binary>.nat]
(case tag
- 0 (\ ! map (|>> #Anonymous) <b>.any)
- 1 (\ ! map (|>> #Definition) <b>.text)
- 2 (\ ! map (|>> #Analyser) <b>.text)
- 3 (\ ! map (|>> #Synthesizer) <b>.text)
- 4 (\ ! map (|>> #Generator) <b>.text)
- 5 (\ ! map (|>> #Directive) <b>.text)
+ (^template [<nat> <tag> <parser>]
+ [<nat> (\ ! map (|>> <tag>) <parser>)])
+ ([0 #Anonymous <binary>.any]
+ [1 #Definition <binary>.text]
+ [2 #Analyser <binary>.text]
+ [3 #Synthesizer <binary>.text]
+ [4 #Generator <binary>.text]
+ [5 #Directive <binary>.text]
+ [6 #Custom <binary>.text])
+
_ (<>.fail (exception.construct ..invalid_category [tag])))))]
- (|> (<b>.row/64 category)
+ (|> (<binary>.row/64 category)
(\ <>.monad map (row\fold (function (_ artifact registry)
(product.right
(case artifact
@@ -149,7 +156,8 @@
[#Analyser ..analyser]
[#Synthesizer ..synthesizer]
[#Generator ..generator]
- [#Directive ..directive])
+ [#Directive ..directive]
+ [#Custom ..custom])
)))
..empty)))))
)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
index 0b7a54a34..cd7b7169a 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -227,12 +227,12 @@
(case (do !
[data (try.from_maybe (dictionary.get (format (%.nat artifact_id) extension) actual))
#let [context [module_id artifact_id]
- directive (\ host ingest context data)
- output (row.add [artifact_id data] output)]]
+ directive (\ host ingest context data)]]
(case artifact_category
#artifact.Anonymous
(do !
- [_ (\ host re_learn context directive)]
+ [#let [output (row.add [artifact_id #.None data] output)]
+ _ (\ host re_learn context #.None directive)]
(wrap [definitions
[analysers
synthesizers
@@ -241,25 +241,27 @@
output]))
(#artifact.Definition name)
- (if (text\= $/program.name name)
- (wrap [definitions
- [analysers
- synthesizers
- generators
- directives]
- output])
- (do !
- [value (\ host re_load context directive)]
- (wrap [(dictionary.put name value definitions)
+ (let [output (row.add [artifact_id #.None data] output)]
+ (if (text\= $/program.name name)
+ (wrap [definitions
[analysers
synthesizers
generators
directives]
- output])))
+ output])
+ (do !
+ [value (\ host re_load context #.None directive)]
+ (wrap [(dictionary.put name value definitions)
+ [analysers
+ synthesizers
+ generators
+ directives]
+ output]))))
(#artifact.Analyser extension)
(do !
- [value (\ host re_load context directive)]
+ [#let [output (row.add [artifact_id #.None data] output)]
+ value (\ host re_load context #.None directive)]
(wrap [definitions
[(dictionary.put extension (:as analysis.Handler value) analysers)
synthesizers
@@ -269,7 +271,8 @@
(#artifact.Synthesizer extension)
(do !
- [value (\ host re_load context directive)]
+ [#let [output (row.add [artifact_id #.None data] output)]
+ value (\ host re_load context #.None directive)]
(wrap [definitions
[analysers
(dictionary.put extension (:as synthesis.Handler value) synthesizers)
@@ -279,7 +282,8 @@
(#artifact.Generator extension)
(do !
- [value (\ host re_load context directive)]
+ [#let [output (row.add [artifact_id #.None data] output)]
+ value (\ host re_load context #.None directive)]
(wrap [definitions
[analysers
synthesizers
@@ -289,12 +293,24 @@
(#artifact.Directive extension)
(do !
- [value (\ host re_load context directive)]
+ [#let [output (row.add [artifact_id #.None data] output)]
+ value (\ host re_load context #.None directive)]
(wrap [definitions
[analysers
synthesizers
generators
(dictionary.put extension (:as directive.Handler value) directives)]
+ output]))
+
+ (#artifact.Custom name)
+ (do !
+ [#let [output (row.add [artifact_id (#.Some name) data] output)]
+ value (\ host re_load context (#.Some name) directive)]
+ (wrap [definitions
+ [analysers
+ synthesizers
+ generators
+ directives]
output]))))
(#try.Success [definitions' bundles' output'])
(recur input' definitions' bundles' output')
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
index f5366ab8e..7e79903d5 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -11,6 +11,7 @@
["." promise (#+ Promise)]]]
[data
["." binary (#+ Binary)]
+ ["." maybe ("#\." functor)]
["." text
["%" format (#+ format)]]
[collection
@@ -109,11 +110,13 @@
(java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MANIFEST_VERSION) ..manifest_version))
manifest)))
-(def: (write_class static module artifact content sink)
- (-> Static archive.ID artifact.ID Binary java/util/jar/JarOutputStream
+(def: (write_class static module artifact custom content sink)
+ (-> Static archive.ID artifact.ID (Maybe Text) Binary java/util/jar/JarOutputStream
java/util/jar/JarOutputStream)
- (let [class_path (format (runtime.class_name [module artifact])
- (get@ #static.artifact_extension static))]
+ (let [class_path (|> custom
+ (maybe\map (|>> name.internal name.read))
+ (maybe.default (runtime.class_name [module artifact]))
+ (text.suffix (get@ #static.artifact_extension static)))]
(do_to sink
(java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new class_path))
(java/util/zip/ZipOutputStream::write content +0 (.int (binary.size content)))
@@ -123,8 +126,8 @@
(def: (write_module static [module output] sink)
(-> Static [archive.ID Output] java/util/jar/JarOutputStream
java/util/jar/JarOutputStream)
- (row\fold (function (_ [artifact content] sink)
- (..write_class static module artifact content sink))
+ (row\fold (function (_ [artifact custom content] sink)
+ (..write_class static module artifact custom content sink))
sink
output))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
index ac2b5758c..36b1db690 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
@@ -33,30 +33,25 @@
["$" lux
[generation (#+ Context)]]]]]])
-## TODO: Delete ASAP
-(type: (Action ! a)
- (! (Try a)))
-
(def: (write_module sequence [module output] so_far)
(All [directive]
(-> (-> directive directive directive) [archive.ID Output] directive
(Try directive)))
(|> output
row.to_list
- (list\map product.right)
+ (list\map (|>> product.right product.right))
(monad.fold try.monad
(function (_ content so_far)
(|> content
(\ utf8.codec decode)
(\ try.monad map
- (function (_ content)
- (sequence so_far
- (:share [directive]
- directive
- so_far
-
- directive
- (:assume content)))))))
+ (|>> :assume
+ (:share [directive]
+ directive
+ so_far
+
+ directive)
+ (sequence so_far)))))
so_far)))
(def: #export (package header to_code sequence scope)
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index 52cd3efd4..ddfacbc5e 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -318,8 +318,8 @@
(: (-> s (Try [s Exit]))
on_await))
-(`` (implementation: (mock_process mock state)
- (All [s] (-> (Mock s) (Atom s) (Process IO)))
+(`` (implementation: (mock_process state mock)
+ (All [s] (-> (Atom s) (Mock s) (Process IO)))
(~~ (template [<name> <mock>]
[(def: (<name> _)
@@ -368,7 +368,7 @@
s
(Shell IO)))
- (def: (execute input)
- (io.io (do try.monad
- [mock (mock input)]
- (wrap (..mock_process mock (atom.atom init)))))))
+ (def: execute
+ (|>> mock
+ (\ try.monad map (..mock_process (atom.atom init)))
+ io.io)))