aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/compositor.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-07-06 21:34:21 -0400
committerEduardo Julian2021-07-06 21:34:21 -0400
commit2b909032e7a0bd10cd7db52067d2fb701bfa95e5 (patch)
tree0e2aaef228f80f3336715327f7f34065c309de22 /stdlib/source/program/compositor.lux
parent5cf4efa861075f8276f43a2516f5beacaf610b44 (diff)
Simplified the API for file-system operations.
Diffstat (limited to 'stdlib/source/program/compositor.lux')
-rw-r--r--stdlib/source/program/compositor.lux50
1 files changed, 10 insertions, 40 deletions
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index f443301db..8b577ec09 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -2,7 +2,6 @@
[lux (#- Module)
[type (#+ :share)]
["." debug]
- ["@" target]
[abstract
[monad (#+ Monad do)]]
[control
@@ -21,7 +20,7 @@
[time
["." instant]]
["." world #_
- ["." file (#+ File Path)]
+ ["." file]
["#/." program]
## ["." console]
]
@@ -83,43 +82,14 @@
(format "Duration: ")))]]
(wrap output)))
-(def: (package! monad file_system [packager package] static archive context)
- (All [!] (-> (Monad !) (file.System !) [Packager Path] Static Archive Context (! (Try Any))))
- (for {@.old
- (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)))]
- (\ (: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)]
- (case (packager archive context)
- (#try.Success content)
- (do (try.with monad)
- [package (: (Promise (Try (File Promise)))
- (file.get_file monad file_system package))]
- (\ (: (File Promise) package) over_write content))
-
- (#try.Failure error)
- (\ monad wrap (#try.Failure error))))))))
+(def: (package! monad fs [packager package] static archive context)
+ (All [!] (-> (Monad !) (file.System !) [Packager file.Path] Static Archive Context (! (Try Any))))
+ (case (packager archive context)
+ (#try.Success content)
+ (\ fs write content package)
+
+ (#try.Failure error)
+ (\ monad wrap (#try.Failure error))))
(with_expansions [<parameters> (as_is anchor expression artifact)]
(def: #export (compiler static
@@ -137,7 +107,7 @@
[Type Type Type]
Extender
Service
- [Packager Path]
+ [Packager file.Path]
(Promise Any)))
(do {! promise.monad}
[platform (promise.future platform)]