aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/host/js.lux8
-rw-r--r--stdlib/source/lux/tool/compiler/meta/packager/script.lux22
-rw-r--r--stdlib/source/lux/tool/compiler/phase/generation.lux20
-rw-r--r--stdlib/source/program/compositor.lux19
4 files changed, 29 insertions, 40 deletions
diff --git a/stdlib/source/lux/host/js.lux b/stdlib/source/lux/host/js.lux
index 647e21957..45f3d42c6 100644
--- a/stdlib/source/lux/host/js.lux
+++ b/stdlib/source/lux/host/js.lux
@@ -169,16 +169,16 @@
text.new-line
(:representation post))))
- (def: indent
- (-> Text Text)
- (text.replace-all text.new-line (format text.new-line text.tab)))
+ ## (def: indent
+ ## (-> Text Text)
+ ## (text.replace-all text.new-line (format text.new-line text.tab)))
(def: block
(-> Statement Text)
(let [close (format text.new-line "}")]
(|>> :representation
(format text.new-line)
- ..indent
+ ## ..indent
(text.enclose ["{"
close]))))
diff --git a/stdlib/source/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/lux/tool/compiler/meta/packager/script.lux
index e51afe7a2..ac4582346 100644
--- a/stdlib/source/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/lux/tool/compiler/meta/packager/script.lux
@@ -1,13 +1,13 @@
(.module:
[lux #*
[data
+ ["." product]
["." text
format
["." encoding]]
[collection
- ["." dictionary]
["." row]
- ["." list ("#@." functor fold)]]]
+ ["." list ("#@." monad fold)]]]
[host
["_" js]]
[tool
@@ -21,18 +21,16 @@
(All [statements]
(-> (Output statements) Binary))
(|> outputs
- dictionary.entries
+ row.to-list
(list@map (function (_ [module buffer])
(|> buffer
row.to-list
(:coerce (List [Name _.Statement]))
- (list@fold (function (_ [artifact content] pre!)
- (|> content
- (_.comment (%name artifact))
- (_.then pre!)))
- (_.comment module
- _.use-strict))
- (: _.Statement)
- _.code)))
- (text.join-with text.new-line)
+ (list@map product.right))))
+ list@join
+ (list@fold (function (_ post! pre!)
+ (_.then pre! post!))
+ _.use-strict)
+ (: _.Statement)
+ _.code
encoding.to-utf8))
diff --git a/stdlib/source/lux/tool/compiler/phase/generation.lux b/stdlib/source/lux/tool/compiler/phase/generation.lux
index 203c5d4ab..a22077df4 100644
--- a/stdlib/source/lux/tool/compiler/phase/generation.lux
+++ b/stdlib/source/lux/tool/compiler/phase/generation.lux
@@ -1,5 +1,5 @@
(.module:
- [lux #*
+ [lux (#- Module)
[control
[monad (#+ do)]
["." exception (#+ exception:)]]
@@ -11,13 +11,14 @@
format]
[collection
["." row (#+ Row)]
- ["." dictionary (#+ Dictionary)]]]
- [world
- [file (#+ Path)]]]
+ ["." dictionary (#+ Dictionary)]]]]
["." //
["." extension]
[//
- [synthesis (#+ Synthesis)]]])
+ [synthesis (#+ Synthesis)]
+ [meta
+ [archive
+ [descriptor (#+ Module)]]]]])
(exception: #export (cannot-interpret {error Text})
(exception.report
@@ -57,8 +58,7 @@
define!))
(type: #export (Buffer statement) (Row [Name statement]))
-
-(type: #export (Output statement) (Dictionary Path (Buffer statement)))
+(type: #export (Output statement) (Row [Module (Buffer statement)]))
(type: #export (State anchor expression statement)
{#context Context
@@ -89,7 +89,7 @@
#anchor #.None
#host host
#buffer #.None
- #output (dictionary.new text.hash)
+ #output row.empty
#counter 0
#name-cache (dictionary.new name.hash)})
@@ -224,10 +224,10 @@
(def: #export (save-buffer! target)
(All [anchor expression statement]
- (-> Path (Operation anchor expression statement Any)))
+ (-> Module (Operation anchor expression statement Any)))
(do //.monad
[buffer ..buffer]
- (extension.update (update@ #output (dictionary.put target buffer)))))
+ (extension.update (update@ #output (row.add [target buffer])))))
(def: #export (remember lux-name)
(All [anchor expression statement]
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 8262fe841..727941fde 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -21,7 +21,7 @@
[host
["_" js]]
[world
- ["." file]
+ ["." file (#+ File)]
["." console]]
[tool
[compiler
@@ -70,19 +70,10 @@
(statement.lift-generation generation.output)}))]
(case ?outcome
(#error.Success [state output])
- (exec (log! "all buffers | output:")
- (log! (|> output
- dictionary.entries
- (list@map (function (_ [module buffer])
- (|> buffer
- row.to-list
- (list@map (|>> product.left %name (format text.new-line text.tab)))
- (text.join-with "")
- (format module))))
- (text.join-with text.new-line)))
- (do (error.with io.monad)
- [file (!.use (:: system create-file) "program.js")]
- (!.use (:: file over-write) (script.package output))))
+ (do (error.with io.monad)
+ [file (: (IO (Error (File IO)))
+ (file.get-file io.monad system "program.js"))]
+ (!.use (:: file over-write) (script.package output)))
(#error.Failure error)
(:: io.monad wrap (#error.Failure error)))))