From 2b909032e7a0bd10cd7db52067d2fb701bfa95e5 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 6 Jul 2021 21:34:21 -0400 Subject: Simplified the API for file-system operations. --- stdlib/source/program/compositor/export.lux | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'stdlib/source/program/compositor/export.lux') diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index 238034534..24ba3492c 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -38,16 +38,16 @@ {#tar.user commons #tar.group commons})) -(def: #export (library system sources) +(def: #export (library fs sources) (-> (file.System Promise) (List Source) (Promise (Try tar.Tar))) (do (try.with promise.monad) - [files (io.enumerate system sources)] + [files (io.enumerate fs sources)] (|> (dictionary.entries files) (monad.map try.monad (function (_ [path source_code]) (do try.monad [path (|> path - (text.replace_all (\ system separator) .module_separator) + (text.replace_all (\ fs separator) .module_separator) tar.path) source_code (tar.content source_code)] (wrap (#tar.Normal [path @@ -61,13 +61,11 @@ (\ try.monad map row.from_list) (\ promise.monad wrap)))) -(def: #export (export system [sources target]) +(def: #export (export fs [sources target]) (-> (file.System Promise) Export (Promise (Try Any))) - (do (try.with promise.monad) - [tar (..library system sources) - package (: (Promise (Try (file.File Promise))) - (file.get_file promise.monad system - (format target (\ system separator) ..file)))] - (|> tar - (binary.run tar.writer) - (\ package over_write)))) + (do {! (try.with promise.monad)} + [tar (\ ! map (binary.run tar.writer) + (..library fs sources))] + (|> ..file + (format target (\ fs separator)) + (\ fs write tar)))) -- cgit v1.2.3