aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/auto.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/aedifex/command/auto.lux
parent5cf4efa861075f8276f43a2516f5beacaf610b44 (diff)
Simplified the API for file-system operations.
Diffstat (limited to 'stdlib/source/program/aedifex/command/auto.lux')
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux45
1 files changed, 19 insertions, 26 deletions
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 5f3d95631..398fb26cf 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -13,32 +13,26 @@
[world
[program (#+ Program)]
[shell (#+ Shell)]
- ["." console (#+ Console)]
- ["." file (#+ Path)
+ [console (#+ Console)]
+ ["." file
["." watch (#+ Watcher)]]]]
["." // #_
["/#" // #_
[command (#+ Command)]
["#" profile]
- ["#." action (#+ Action)]
+ ["#." action]
[dependency
[resolution (#+ Resolution)]]]])
(def: (targets fs path)
- (-> (file.System Promise) Path (Promise (List Path)))
- (do {! promise.monad}
- [?root (\ fs directory [path])]
- (case ?root
- (#try.Success root)
- (loop [root root]
- (do !
- [subs (\ ! map (|>> (try.default (list)))
- (\ root directories []))]
- (\ ! map (|>> list.concat (list& (\ root scope)))
- (monad.map ! recur subs))))
-
- (#try.Failure error)
- (wrap (list)))))
+ (-> (file.System Promise) file.Path (Promise (List file.Path)))
+ (let [! promise.monad]
+ (|> path
+ (\ fs sub_directories)
+ (\ ! map (|>> (try.default (list))
+ (monad.map ! (targets fs))))
+ (\ ! join)
+ (\ ! map (|>> list.concat (list& path))))))
(def: #export delay
Nat
@@ -68,13 +62,12 @@
(loop [_ []]
(do !
[_ (..pause delay)
- events (\ watcher poll [])
- _ (case events
- (#.Cons _)
- (do !
- [_ <call>]
- (wrap []))
+ events (\ watcher poll [])]
+ (case events
+ (#.Cons _)
+ (do !
+ [_ <call>]
+ (recur []))
- #.Nil
- (wrap []))]
- (recur [])))))))))
+ #.Nil
+ (recur []))))))))))