From 80c727065593a4cadcb1d72c38c8ad5c3bf85acc Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 16 Jul 2020 23:19:57 -0400 Subject: Can get the JS compiler to compile its own source-code. --- stdlib/source/program/compositor.lux | 45 +++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'stdlib/source/program/compositor.lux') diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 63c398bf9..95ad2c771 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -24,7 +24,8 @@ ["." list ("#@." functor fold)]]] [world ["." file (#+ File Path)] - ["." console]] + ## ["." console] + ] [tool [compiler ["." phase] @@ -73,21 +74,33 @@ (def: (package! monad file-system [packager package] static archive context) (All [!] (-> (Monad !) (file.System !) [Packager Path] Static Archive Context (! (Try Any)))) - (do (try.with monad) - [#let [packager (:share [!] {(Monad !) monad} {(Packager !) packager})] - content (packager monad file-system static archive context) - package (:share [!] - {(Monad !) - monad} - {(! (Try (File !))) - (:assume (file.get-file monad file-system package))})] - (!.use (:: (:share [!] - {(Monad !) - monad} - {(File !) - (:assume package)}) - over-write) - [content]))) + (for {@.old + (do (try.with monad) + [#let [packager (:share [!] {(Monad !) monad} {(Packager !) packager})] + content (packager monad file-system static archive context) + package (:share [!] + {(Monad !) + monad} + {(! (Try (File !))) + (:assume (file.get-file monad file-system package))})] + (!.use (:: (:share [!] + {(Monad !) + monad} + {(File !) + (:assume package)}) + over-write) + [content]))} + ## TODO: Fix whatever type-checker bug is forcing me into this compromise... + (:assume + (: (Promise (Try Any)) + (let [monad (:coerce (Monad Promise) monad) + file-system (:coerce (file.System Promise) monad) + packager (:coerce (Packager Promise) packager)] + (do (try.with monad) + [content (packager monad file-system static archive context) + package (: (Promise (Try (File Promise))) + (file.get-file monad file-system package))] + (!.use (:: (: (File Promise) package) over-write) [content]))))))) (with-expansions [ (as-is anchor expression artifact)] (def: #export (compiler static -- cgit v1.2.3