aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program
diff options
context:
space:
mode:
authorEduardo Julian2021-02-12 02:19:43 -0400
committerEduardo Julian2021-02-12 02:19:43 -0400
commitee3240679a7c1c4d216b35e1d2db1544e5c16863 (patch)
treec0f03fe917c77ce5c6413782ba116006bc84ea7c /stdlib/source/program
parenta5e2f99430384fff580646a553b1e8ae27e07acd (diff)
More Lua + optimizations.
Diffstat (limited to '')
-rw-r--r--stdlib/source/program/compositor.lux50
1 files changed, 28 insertions, 22 deletions
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index 63325ff0b..a66022594 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -74,32 +74,38 @@
(def: (package! monad file_system [packager package] static archive context)
(All [!] (-> (Monad !) (file.System !) [Packager Path] Static Archive Context (! (Try Any))))
(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]))}
+ (case (packager archive context)
+ (#try.Success content)
+ (do (try.with monad)
+ [package (:share [!]
+ {(Monad !)
+ monad}
+ {(! (Try (File !)))
+ (:assume (file.get_file monad file_system package))})]
+ (!.use (\ (:share [!]
+ {(Monad !)
+ monad}
+ {(File !)
+ (:assume package)})
+ over_write)
+ [content]))
+
+ (#try.Failure error)
+ (\ monad wrap (#try.Failure error)))}
## 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) file_system)
- 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])))))))
+ file_system (:coerce (file.System Promise) file_system)]
+ (case (packager archive context)
+ (#try.Success content)
+ (do (try.with monad)
+ [package (: (Promise (Try (File Promise)))
+ (file.get_file monad file_system package))]
+ (!.use (\ (: (File Promise) package) over_write) [content]))
+
+ (#try.Failure error)
+ (\ monad wrap (#try.Failure error))))))))
(with_expansions [<parameters> (as_is anchor expression artifact)]
(def: #export (compiler static