aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/file
diff options
context:
space:
mode:
authorEduardo Julian2021-09-05 22:52:26 -0400
committerEduardo Julian2021-09-05 22:52:26 -0400
commit132ffdae1add622c8a3c6065d7730a8fe8ea5e78 (patch)
tree540310f190007d192b892db2d0a520d17b73ad48 /stdlib/source/library/lux/world/file
parent09e2747bf8c6dcdc1d7318f2490f0de37d77b39f (diff)
Changed the syntax of do/be's (co)monad bindings.
Diffstat (limited to 'stdlib/source/library/lux/world/file')
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux18
1 files changed, 9 insertions, 9 deletions
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 0bbc4643c..6950e0df9 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -111,7 +111,7 @@
(def: (update_watch! new_concern path tracker)
(-> Concern //.Path (Var Directory_Tracker) (STM Bit))
- (do {! stm.monad}
+ (do [! stm.monad]
[@tracker (stm.read tracker)]
(case (dictionary.value path @tracker)
(#.Some [old_concern last_modified])
@@ -124,7 +124,7 @@
(def: (file_tracker fs directory)
(-> (//.System Async) //.Path (Async (Try File_Tracker)))
- (do {! (try.with async.monad)}
+ (do [! (try.with async.monad)]
[files (\ fs directory_files directory)]
(monad.mix !
(function (_ file tracker)
@@ -137,7 +137,7 @@
(def: (available_files fs directory)
(-> (//.System Async) //.Path (Async (Try (List [//.Path Instant]))))
- (do {! (try.with async.monad)}
+ (do [! (try.with async.monad)]
[files (\ fs directory_files directory)]
(monad.each ! (function (_ file)
(|> file
@@ -151,7 +151,7 @@
[(List [//.Path Instant])
(List [//.Path Instant Instant])
(List //.Path)]])))
- (do {! (try.with async.monad)}
+ (do [! (try.with async.monad)]
[current_files (..available_files fs directory)
.let [creations (if (..creation? concern)
(list.only (|>> product.left (dictionary.key? file_tracker) not)
@@ -192,7 +192,7 @@
(stm.var (dictionary.empty text.hash)))]
(implementation
(def: (start new_concern path)
- (do {! async.monad}
+ (do [! async.monad]
[exists? (\ fs directory? path)]
(if exists?
(do !
@@ -217,7 +217,7 @@
(exception.except ..not_being_watched [path]))))))
(def: (stop path)
(stm.commit!
- (do {! stm.monad}
+ (do [! stm.monad]
[@tracker (stm.read tracker)]
(case (dictionary.value path @tracker)
(#.Some [concern file_tracker])
@@ -230,7 +230,7 @@
(def: (poll _)
(do async.monad
[@tracker (stm.commit! (stm.read tracker))]
- (do {! (try.with async.monad)}
+ (do [! (try.with async.monad)]
[changes (|> @tracker
dictionary.entries
(monad.each ! (..available_directory_changes fs)))
@@ -378,7 +378,7 @@
[?key (java/nio/file/WatchService::poll watcher)]
(case ?key
(#.Some key)
- (do {! io.monad}
+ (do [! io.monad]
[valid? (java/nio/file/WatchKey::reset key)]
(if valid?
(do !
@@ -419,7 +419,7 @@
stop (: (-> //.Path (Async (Try Concern)))
(function (_ path)
- (do {! async.monad}
+ (do [! async.monad]
[@tracker (stm.commit! (stm.read tracker))]
(case (dictionary.value path @tracker)
(#.Some [concern key])