From 744ee69630de59ca3ba660b0aab6361cd17ce1b4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 30 Jun 2021 23:24:55 -0400 Subject: "signature:" -> "interface:" & "structure:" -> "implementation:" "signature" & "structure" feel like very ML-specific terminology and might not be easy on programmers unfamiliar with it.--- stdlib/source/program/aedifex/command/clean.lux | 29 ++++++++++++++++--------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'stdlib/source/program/aedifex/command/clean.lux') diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index ecb71b59d..b966fe85e 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -4,6 +4,7 @@ ["." monad (#+ do)]] [control ["." try (#+ Try)] + ["." exception] [security ["!" capability]] [concurrency @@ -35,15 +36,23 @@ (def: #export (do! console fs profile) (-> (Console Promise) (file.System Promise) (Command Any)) - (do {! ///action.monad} + (do promise.monad [#let [target (get@ #///.target profile)] root (: (Promise (Try (Directory Promise))) - (!.use (\ fs directory) target)) - _ (loop [root root] - (do ! - [_ (..clean_files! root) - subs (: (Promise (Try (List (Directory Promise)))) - (!.use (\ root directories) [])) - _ (monad.map ! recur subs)] - (!.use (\ root discard) [])))] - (console.write_line (..success target) console))) + (!.use (\ fs directory) target))] + (case root + (#try.Success root) + (do {! ///action.monad} + [_ (loop [root root] + (do ! + [_ (..clean_files! root) + subs (: (Promise (Try (List (Directory Promise)))) + (!.use (\ root directories) [])) + _ (monad.map ! recur subs)] + (!.use (\ root discard) [])))] + (console.write_line (..success target) console)) + + (#try.Failure error) + (if (exception.match? file.cannot_find_directory error) + (console.write_line (..success target) console) + (\ promise.monad wrap (#try.Failure error)))))) -- cgit v1.2.3