diff options
Diffstat (limited to 'stdlib/source/library/lux/world/file/watch.lux')
-rw-r--r-- | stdlib/source/library/lux/world/file/watch.lux | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index 86620bd7b..de05e5185 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -20,14 +20,14 @@ ["%" format {"+" [format]}]] [collection ["[0]" dictionary {"+" [Dictionary]}] - ["[0]" list ("[1]\[0]" functor monoid mix)] + ["[0]" list ("[1]#[0]" functor monoid mix)] ["[0]" set] ["[0]" array]]] [math [number ["n" nat]]] [time - ["[0]" instant {"+" [Instant]} ("[1]\[0]" equivalence)]] + ["[0]" instant {"+" [Instant]} ("[1]#[0]" equivalence)]] [type [abstract {"+" [abstract: :representation :abstraction]}]]]] ["[0]" //]) @@ -123,11 +123,11 @@ (def: (file_tracker fs directory) (-> (//.System Async) //.Path (Async (Try File_Tracker))) (do [! (try.with async.monad)] - [files (\ fs directory_files directory)] + [files (# fs directory_files directory)] (monad.mix ! (function (_ file tracker) (do ! - [last_modified (\ fs last_modified file)] + [last_modified (# fs last_modified file)] (in (dictionary.has file last_modified tracker)))) (: File_Tracker (dictionary.empty text.hash)) @@ -136,11 +136,11 @@ (def: (available_files fs directory) (-> (//.System Async) //.Path (Async (Try (List [//.Path Instant])))) (do [! (try.with async.monad)] - [files (\ fs directory_files directory)] + [files (# fs directory_files directory)] (monad.each ! (function (_ file) (|> file - (\ fs last_modified) - (\ ! each (|>> [file])))) + (# fs last_modified) + (# ! each (|>> [file])))) files))) (def: (available_directory_changes fs [directory [the_concern file_tracker]]) @@ -156,11 +156,11 @@ current_files) (list)) available (|> current_files - (list\each product.left) + (list#each product.left) (set.of_list text.hash)) deletions (if (..deletion? the_concern) (|> (dictionary.entries file_tracker) - (list\each product.left) + (list#each product.left) (list.only (|>> (set.member? available) not))) (list)) modifications (list.all (function (_ [path current_modification]) @@ -170,12 +170,12 @@ current_files)]] (in [[directory [the_concern - (let [with_deletions (list\mix dictionary.lacks file_tracker deletions) - with_creations (list\mix (function (_ [path last_modified] tracker) + (let [with_deletions (list#mix dictionary.lacks file_tracker deletions) + with_creations (list#mix (function (_ [path last_modified] tracker) (dictionary.has path last_modified tracker)) with_deletions creations) - with_modifications (list\mix (function (_ [path previous_modification current_modification] tracker) + with_modifications (list#mix (function (_ [path previous_modification current_modification] tracker) (dictionary.has path current_modification tracker)) with_creations modifications)] @@ -191,7 +191,7 @@ (implementation (def: (start new_concern path) (do [! async.monad] - [exists? (\ fs directory? path)] + [exists? (# fs directory? path)] (if exists? (do ! [updated? (stm.commit! (..update_watch! new_concern path tracker))] @@ -234,25 +234,25 @@ (monad.each ! (..available_directory_changes fs))) _ (do async.monad [_ (stm.commit! (stm.write (|> changes - (list\each product.left) + (list#each product.left) (dictionary.of_list text.hash)) tracker))] (in {try.#Success []})) .let [[creations modifications deletions] - (list\mix (function (_ [_ [creations modifications deletions]] + (list#mix (function (_ [_ [creations modifications deletions]] [all_creations all_modifications all_deletions]) - [(list\composite creations all_creations) - (list\composite modifications all_modifications) - (list\composite deletions all_deletions)]) + [(list#composite creations all_creations) + (list#composite modifications all_modifications) + (list#composite deletions all_deletions)]) [(list) (list) (list)] changes)]] - (in ($_ list\composite - (list\each (|>> product.left [..creation]) creations) + (in ($_ list#composite + (list#each (|>> product.left [..creation]) creations) (|> modifications (list.only (function (_ [path previous_modification current_modification]) - (not (instant\= previous_modification current_modification)))) - (list\each (|>> product.left [..modification]))) - (list\each (|>> [..deletion]) deletions) + (not (instant#= previous_modification current_modification)))) + (list#each (|>> product.left [..modification]))) + (list#each (|>> [..deletion]) deletions) ))))) ))) @@ -332,9 +332,9 @@ (def: default_key_concern (-> java/nio/file/WatchKey (IO Concern)) (|>> java/nio/file/WatchKey::pollEvents - (\ io.monad each (|>> ..default_list - (list\each default_event_concern) - (list\mix ..also ..none))))) + (# io.monad each (|>> ..default_list + (list#each default_event_concern) + (list#mix ..also ..none))))) (import: java/nio/file/WatchService ["[1]::[0]" @@ -358,7 +358,7 @@ (def: (default_start watch_events watcher path) (-> (List Watch_Event) java/nio/file/WatchService //.Path (Async (Try java/nio/file/WatchKey))) - (let [watch_events' (list\mix (function (_ [index watch_event] watch_events') + (let [watch_events' (list#mix (function (_ [index watch_event] watch_events') (ffi.write! index watch_event watch_events')) (ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object) (list.size watch_events)) @@ -395,7 +395,7 @@ (def: (watch_events concern) (-> Concern (List Watch_Event)) - ($_ list\composite + ($_ list#composite (if (..creation? concern) (list (:as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE))) (list)) |