aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/auto.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/program/aedifex/command/auto.lux')
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux23
1 files changed, 14 insertions, 9 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 0fc223376..80ff8ac8c 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -7,19 +7,21 @@
["." try (#+ Try)]
["." io (#+ IO)]
[concurrency
- ["." promise]]]
+ ["." promise (#+ Promise)]]]
[data
[collection
["." array]
["." list]
["." set]]]
[world
- [file (#+ Path)]]]
+ ["." file (#+ Path)]]]
["." // #_
["/#" // #_
["#" profile]
["#." action (#+ Action)]
- ["#." command (#+ Command)]]])
+ ["#." command (#+ Command)]
+ [dependency
+ [resolution (#+ Resolution)]]]])
(import: java/nio/file/WatchKey
["#::."
@@ -124,18 +126,21 @@
#.None
(wrap []))))
-(def: #export (do! command profile)
- (All [a] (-> (Command a) (Command Any)))
+(def: #export (do! command fs resolution profile)
+ (All [a]
+ (-> (-> (file.System Promise) Resolution (Command a))
+ (-> (file.System Promise) Resolution (Command Any))))
(do {! ///action.monad}
- [#let [fs (java/nio/file/FileSystems::getDefault)]
- watcher (promise.future (java/nio/file/FileSystem::newWatchService fs))
+ [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 profile)]
+ _ (command fs resolution profile)]
(loop [_ []]
(do !
[?key (..poll! watcher)
@@ -143,7 +148,7 @@
(#.Some key)
(do !
[_ (promise.future (..drain! watcher))
- _ (command profile)]
+ _ (command fs resolution profile)]
(wrap []))
#.None