From a02b7bf8ff358ccfa35b03272d28537aeac723ae Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Nov 2020 19:45:56 -0400 Subject: Added "private" macro to lux/debug. --- stdlib/source/program/aedifex/command/auto.lux | 61 ++++++++++++++------------ 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'stdlib/source/program/aedifex/command/auto.lux') 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 [ ((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) + _ ] + (loop [_ []] + (do ! + [?key (..poll! watcher) + _ (case ?key + (#.Some key) + (do ! + [_ (promise.future (..drain! watcher)) + _ ] + (wrap [])) + + #.None + (wrap []))] + (recur [])))))))) -- cgit v1.2.3