aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/auto.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-11-28 19:45:56 -0400
committerEduardo Julian2020-11-28 19:45:56 -0400
commita02b7bf8ff358ccfa35b03272d28537aeac723ae (patch)
tree66f27c97f192d31d7cbee6b87be5ac6546640253 /stdlib/source/program/aedifex/command/auto.lux
parent889139602b77e4387a6e8bfbedacc2a08703e976 (diff)
Added "private" macro to lux/debug.
Diffstat (limited to 'stdlib/source/program/aedifex/command/auto.lux')
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux61
1 files changed, 33 insertions, 28 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 80ff8ac8c..aa230daba 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -14,7 +14,9 @@
["." list]
["." set]]]
[world
- ["." file (#+ Path)]]]
+ [environment (#+ Environment)]
+ ["." file (#+ Path)]
+ ["." shell (#+ Shell)]]]
["." // #_
["/#" // #_
["#" profile]
@@ -126,31 +128,34 @@
#.None
(wrap []))))
-(def: #export (do! command fs resolution profile)
+(def: #export (do! command)
(All [a]
- (-> (-> (file.System Promise) Resolution (Command a))
- (-> (file.System Promise) Resolution (Command Any))))
- (do {! ///action.monad}
- [watcher (promise.future
- (java/nio/file/FileSystem::newWatchService
- (java/nio/file/FileSystems::getDefault)))
- targets (|> profile
- (get@ #///.sources)
- set.to-list
- (monad.map ! ..targets)
- (:: ! map list.concat))
- _ (monad.map ! (..watch! watcher) targets)
- _ (command fs resolution profile)]
- (loop [_ []]
- (do !
- [?key (..poll! watcher)
- _ (case ?key
- (#.Some key)
- (do !
- [_ (promise.future (..drain! watcher))
- _ (command fs resolution profile)]
- (wrap []))
-
- #.None
- (wrap []))]
- (recur [])))))
+ (-> (-> Environment (file.System Promise) (Shell Promise) Resolution (Command a))
+ (-> Environment (file.System Promise) (Shell Promise) Resolution (Command Any))))
+ (function (_ environment fs shell resolution)
+ (function (_ profile)
+ (with-expansions [<call> ((command environment fs shell resolution) profile)]
+ (do {! ///action.monad}
+ [watcher (promise.future
+ (java/nio/file/FileSystem::newWatchService
+ (java/nio/file/FileSystems::getDefault)))
+ targets (|> profile
+ (get@ #///.sources)
+ set.to-list
+ (monad.map ! ..targets)
+ (:: ! map list.concat))
+ _ (monad.map ! (..watch! watcher) targets)
+ _ <call>]
+ (loop [_ []]
+ (do !
+ [?key (..poll! watcher)
+ _ (case ?key
+ (#.Some key)
+ (do !
+ [_ (promise.future (..drain! watcher))
+ _ <call>]
+ (wrap []))
+
+ #.None
+ (wrap []))]
+ (recur []))))))))