diff options
author | Eduardo Julian | 2020-12-01 09:27:58 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-01 09:27:58 -0400 |
commit | cfa0a075b89a0df4618e7009f05c157393cbba72 (patch) | |
tree | 4bb658a44cfade42e27f9f6bf87d7118c69af6e0 /stdlib/source/program | |
parent | 7444deb1b80d469280fcb0684d91c13f752a86d6 (diff) |
Added specialized root/2 and root/3 functions in lux/math.
Diffstat (limited to 'stdlib/source/program')
-rw-r--r-- | stdlib/source/program/aedifex/cache.lux | 6 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/build.lux | 1 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/test.lux | 1 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/shell.lux | 108 | ||||
-rw-r--r-- | stdlib/source/program/licentia.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/licentia/document.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/licentia/license/black-list.lux | 8 | ||||
-rw-r--r-- | stdlib/source/program/licentia/license/commercial.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/licentia/license/distribution.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/licentia/license/extension.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/licentia/license/notice.lux | 4 | ||||
-rw-r--r-- | stdlib/source/program/licentia/output.lux | 14 |
12 files changed, 24 insertions, 138 deletions
diff --git a/stdlib/source/program/aedifex/cache.lux b/stdlib/source/program/aedifex/cache.lux index dca14b496..1aee65405 100644 --- a/stdlib/source/program/aedifex/cache.lux +++ b/stdlib/source/program/aedifex/cache.lux @@ -86,11 +86,11 @@ (def: (decode codec data) (All [a] (-> (Codec Text a) Binary (Try a))) - (let [(^open "_@.") try.monad] + (let [(^open "_\.") try.monad] (|> data encoding.from-utf8 - (_@map (:: codec decode)) - _@join))) + (_\map (:: codec decode)) + _\join))) (def: #export (read-one system [artifact type]) (-> (file.System Promise) Dependency (Promise (Try Package))) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 94d6760b6..30206095e 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -32,7 +32,6 @@ ["#." local] ["#." cache] ["#." repository] - ["#." shell] ["#." runtime] ["#." dependency (#+ Dependency) ["#/." resolution (#+ Resolution)]] diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 2996a6741..f4da76ac4 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -21,7 +21,6 @@ ["/#" // #_ ["#." action] ["#." command (#+ Command)] - ["#." shell] ["#." runtime] [dependency [resolution (#+ Resolution)]]]]) diff --git a/stdlib/source/program/aedifex/shell.lux b/stdlib/source/program/aedifex/shell.lux deleted file mode 100644 index e70571667..000000000 --- a/stdlib/source/program/aedifex/shell.lux +++ /dev/null @@ -1,108 +0,0 @@ -(.module: - [lux #* - ["." host (#+ import:)] - [abstract - [monad (#+ do)]] - [control - ["." io (#+ IO)] - ["." try (#+ Try)] - ["." exception (#+ exception:)] - [concurrency - ["." promise]]] - [data - [text - ["%" format (#+ format)]] - [number - ["." int]]] - [world - [file (#+ Path)]]] - ["." // #_ - ["#." action (#+ Action)]]) - -(import: java/lang/String) - -(import: java/io/InputStream) - -(import: java/io/Reader) - -(import: java/io/InputStreamReader - ["#::." - (new [java/io/InputStream])]) - -(import: java/io/BufferedReader - ["#::." - (new [java/io/Reader]) - (readLine [] #io #try java/lang/String)]) - -(import: java/lang/Process - ["#::." - (getInputStream [] java/io/InputStream) - (getErrorStream [] java/io/InputStream) - (waitFor [] #io #try int)]) - -(import: java/io/File - ["#::." - (new [java/lang/String])]) - -(import: java/lang/Runtime - ["#::." - (#static getRuntime [] #io java/lang/Runtime) - (exec [java/lang/String #? [java/lang/String] java/io/File] #io #try java/lang/Process)]) - -(template [<exception>] - [(exception: #export (<exception> {working-directory Text} {command Text} {error Text}) - (exception.report - ["Working directory" (%.text working-directory)] - ["Command" (%.text command)] - ["Error" (%.text error)]))] - - [failure-to-execute-command] - [failure-during-command-execution] - ) - -(exception: #export (abnormal-exit {working-directory Text} {command Text} {code Int}) - (exception.report - ["Working Directory" (%.text working-directory)] - ["Command" (%.text command)] - ["Code" (%.int code)])) - -(def: (consume-stream working-directory command stream) - (-> Text Path java/io/InputStream (IO (Try Any))) - (let [reader (|> stream java/io/InputStreamReader::new java/io/BufferedReader::new)] - (loop [_ []] - (do io.monad - [?line (java/io/BufferedReader::readLine reader)] - (case ?line - (#try.Success line) - (exec (log! line) - (recur [])) - - (#try.Failure error) - (wrap (exception.throw ..failure-during-command-execution [working-directory command error]))))))) - -(def: normal-exit - +0) - -(def: #export (execute command working-directory) - (-> Text Path (Action Any)) - (promise.future - (do {! io.monad} - [runtime (java/lang/Runtime::getRuntime) - ?process (java/lang/Runtime::exec command #.None (java/io/File::new working-directory) runtime)] - (case ?process - (#try.Success process) - (do ! - [_ (..consume-stream working-directory command (java/lang/Process::getInputStream process)) - _ (..consume-stream working-directory command (java/lang/Process::getErrorStream process)) - ?exit-code (java/lang/Process::waitFor process)] - (case ?exit-code - (#try.Success exit-code) - (if (int.= ..normal-exit exit-code) - (wrap (#try.Success [])) - (wrap (exception.throw ..abnormal-exit [working-directory command exit-code]))) - - (#try.Failure error) - (wrap (exception.throw ..failure-to-execute-command [working-directory command error])))) - - (#try.Failure error) - (wrap (exception.throw ..failure-to-execute-command [working-directory command error])))))) diff --git a/stdlib/source/program/licentia.lux b/stdlib/source/program/licentia.lux index 244e28223..e9b4f0074 100644 --- a/stdlib/source/program/licentia.lux +++ b/stdlib/source/program/licentia.lux @@ -29,7 +29,7 @@ [format ["." json]]] ["." cli (#+ program:)] - ["." io (#+ IO) ("#;." monad)] + ["." io (#+ IO) ("#\." monad)] [world ["." file (#+ Path File)]] [host (#+ import:)]] @@ -59,7 +59,7 @@ (do (try.with io.monad) [file (!.use (:: file.default file) input) blob (!.use (:: file content) []) - document (io;wrap (do try.monad + document (io\wrap (do try.monad [raw-json (encoding.from-utf8 blob) json (|> raw-json (:coerce java/lang/String) diff --git a/stdlib/source/program/licentia/document.lux b/stdlib/source/program/licentia/document.lux index b3787f2f2..b1bc20cce 100644 --- a/stdlib/source/program/licentia/document.lux +++ b/stdlib/source/program/licentia/document.lux @@ -4,7 +4,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#;." functor)]]]]) + ["." list ("#\." functor)]]]]) (def: #export (quote text) (-> Text Text) @@ -24,7 +24,7 @@ (def: #export paragraph (-> (List Text) Text) - (|>> (list;map ..sentence) + (|>> (list\map ..sentence) (text.join-with text.new-line))) (template [<name> <word>] diff --git a/stdlib/source/program/licentia/license/black-list.lux b/stdlib/source/program/licentia/license/black-list.lux index a71ceda9c..14dcdfe91 100644 --- a/stdlib/source/program/licentia/license/black-list.lux +++ b/stdlib/source/program/licentia/license/black-list.lux @@ -1,11 +1,11 @@ (.module: [lux #* [data - ["." maybe ("#;." functor)] + ["." maybe ("#\." functor)] ["." text ["%" format (#+ format)]] [collection - ["." list ("#;." functor)]]]] + ["." list ("#\." functor)]]]] ["." // (#+ Entity Black-List) ["_" term] [// @@ -21,11 +21,11 @@ effect "shall not be granted to the following entities, or any subsidiary thereof" justification (|> black-list (get@ #//.justification) - (maybe;map (|>> (format ", due to "))) + (maybe\map (|>> (format ", due to "))) (maybe.default "")) entities (|> black-list (get@ #//.entities) - (list;map ..entity) + (list\map ..entity) (text.join-with text.new-line))] (format scope " " effect justification ":" text.new-line entities))) diff --git a/stdlib/source/program/licentia/license/commercial.lux b/stdlib/source/program/licentia/license/commercial.lux index f05bcf470..05b8c3966 100644 --- a/stdlib/source/program/licentia/license/commercial.lux +++ b/stdlib/source/program/licentia/license/commercial.lux @@ -2,9 +2,7 @@ [lux #* [data ["." text - ["%" format (#+ format)]] - [collection - ["." list ("#;." monoid)]]]] + ["%" format (#+ format)]]]] ["." // (#+ Commercial) ["_" term] [// diff --git a/stdlib/source/program/licentia/license/distribution.lux b/stdlib/source/program/licentia/license/distribution.lux index 58eaab22d..f911623a0 100644 --- a/stdlib/source/program/licentia/license/distribution.lux +++ b/stdlib/source/program/licentia/license/distribution.lux @@ -4,7 +4,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#;." monoid)]]]] + ["." list ("#\." monoid)]]]] ["." // (#+ Distribution) ["_" term] [// @@ -103,7 +103,7 @@ (def: #export (extension distribution) (-> Distribution Text) - ($.paragraph ($_ list;compose + ($.paragraph ($_ list\compose (if (get@ #//.can-re-license? distribution) (list allow-re-licensing) (list)) diff --git a/stdlib/source/program/licentia/license/extension.lux b/stdlib/source/program/licentia/license/extension.lux index 68b5f6669..f808a8913 100644 --- a/stdlib/source/program/licentia/license/extension.lux +++ b/stdlib/source/program/licentia/license/extension.lux @@ -2,9 +2,7 @@ [lux #* [data ["." text - ["%" format (#+ format)]] - [collection - ["." list ("#;." monoid)]]]] + ["%" format (#+ format)]]]] ["." // (#+ Extension) ["_" term] ["." grant] diff --git a/stdlib/source/program/licentia/license/notice.lux b/stdlib/source/program/licentia/license/notice.lux index d4df7d166..219af97f4 100644 --- a/stdlib/source/program/licentia/license/notice.lux +++ b/stdlib/source/program/licentia/license/notice.lux @@ -6,7 +6,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#;." functor)]]]] + ["." list ("#\." functor)]]]] ["." // #_ ["#." time] ["#." copyright] @@ -28,5 +28,5 @@ (def: #export copyright (-> (List //copyright.Holder) Text) - (|>> (list;map ..copyright-holder) + (|>> (list\map ..copyright-holder) (text.join-with text.new-line))) diff --git a/stdlib/source/program/licentia/output.lux b/stdlib/source/program/licentia/output.lux index 05d68ff76..5d3899170 100644 --- a/stdlib/source/program/licentia/output.lux +++ b/stdlib/source/program/licentia/output.lux @@ -1,11 +1,11 @@ (.module: [lux (#- Definition) [data - ["." maybe ("#;." functor)] + ["." maybe ("#\." functor)] ["." text ["%" format (#+ format)]] [collection - ["." list ("#;." functor monoid)]]]] + ["." list ("#\." functor monoid)]]]] [// ["." license (#+ Identification Termination @@ -175,7 +175,7 @@ "")] [(get@ #license.same-license? value) "License Retention" - ($.paragraph (list;compose extension.sharing-requirement + ($.paragraph (list\compose extension.sharing-requirement extension.license-conflict-resolution))] [(get@ #license.must-be-distinguishable? value) (format _.extension " Distinctness") @@ -251,7 +251,7 @@ (-> License Text) (let [identification (|> value (get@ #license.identification) - (maybe;map ..identification) + (maybe\map ..identification) (maybe.default "")) identified? (case (get@ #license.identification value) (#.Some _) @@ -269,12 +269,12 @@ black-lists ($.block ($.section {#$.title (format "Denial of " _.license) #$.content (|> black-lists - (list;map black-list.black-list) + (list\map black-list.black-list) (text.join-with ..black-list-spacing))}))) ($.section {#$.title "Definitions" #$.content (|> definition.all - (list;map (|>> ..definition $.block)) + (list\map (|>> ..definition $.block)) (text.join-with ""))}) ($.block ($.section {#$.title (format "Acceptance of " _.license) @@ -294,7 +294,7 @@ (|> value (get@ #license.attribution) - (maybe;map (|>> ..attribution + (maybe\map (|>> ..attribution ["Attribution Information"] $.section $.block)) |