From 86df87512966e8038d70624ab654262ce14a915c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 12 Jul 2021 00:03:36 -0400 Subject: Better syntax for parallel-hierarchy imports. --- licentia/source/program/licentia.lux | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'licentia/source/program/licentia.lux') diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux index f1a1503b4..44babb828 100644 --- a/licentia/source/program/licentia.lux +++ b/licentia/source/program/licentia.lux @@ -36,7 +36,7 @@ [format ["." json]]] [world - ["." file (#+ Path File)]]] + ["." file]]] ["." / #_ ["#." input] ["#." output]]) @@ -49,10 +49,11 @@ ["#::." (trim [] java/lang/String)]) -(def: default_output_file "LICENSE") +(def: default_output_file + "LICENSE.txt") (def: (success_message output) - (-> Path Text) + (-> file.Path Text) (format "Your license has been made!" text.new_line "Check the file " output ".")) @@ -62,8 +63,7 @@ (do io.monad [?done (: (IO (Try Any)) (do (try.with io.monad) - [file (!.use (\ file.default file) [input]) - blob (!.use (\ file content) []) + [blob (\ file.default read input) document (io\wrap (do {! try.monad} [raw_json (\ utf8.codec decode blob) json (|> raw_json @@ -71,10 +71,8 @@ (\ json.codec decode))] (|> json (.run /input.license) - (\ ! map /output.license)))) - output_file (: (IO (Try (File IO))) - (file.get_file io.monad file.default output))] - (!.use (\ output_file over_write) (\ utf8.codec encode document))))] + (\ ! map /output.license))))] + (\ file.default write (\ utf8.codec encode document) output)))] (wrap (debug.log! (case ?done (#try.Success _) (success_message output) -- cgit v1.2.3