aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2020-10-31 02:59:48 -0400
committerEduardo Julian2020-10-31 02:59:48 -0400
commiteea741e9b4a47ae09832311d6d61f0bd6024f673 (patch)
tree9d503f609c322c235811856ffa05232991b9c653 /stdlib/source/program/aedifex
parentcb8f2b36352948108446c7e3b270faa97589bf7a (diff)
Easy to use Rev constants.
Diffstat (limited to '')
-rw-r--r--stdlib/source/program/aedifex.lux2
-rw-r--r--stdlib/source/program/aedifex/artifact.lux23
-rw-r--r--stdlib/source/program/aedifex/command/auto.lux20
-rw-r--r--stdlib/source/program/aedifex/command/deploy.lux4
-rw-r--r--stdlib/source/program/aedifex/dependency/resolution.lux12
-rw-r--r--stdlib/source/program/aedifex/local.lux15
-rw-r--r--stdlib/source/program/aedifex/parser.lux28
-rw-r--r--stdlib/source/program/aedifex/pom.lux10
-rw-r--r--stdlib/source/program/aedifex/project.lux4
-rw-r--r--stdlib/source/program/aedifex/shell.lux4
-rw-r--r--stdlib/source/program/aedifex/upload.lux4
11 files changed, 66 insertions, 60 deletions
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index 485277d88..d8d855bd0 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -81,7 +81,7 @@
error))))))
(program: [{[profile operation] /cli.command}]
- (do {@ io.monad}
+ (do {! io.monad}
[?profile (/input.read io.monad file.default profile)]
(case ?profile
(#try.Success profile)
diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux
index dc0892eb1..c29cc7b2d 100644
--- a/stdlib/source/program/aedifex/artifact.lux
+++ b/stdlib/source/program/aedifex/artifact.lux
@@ -9,8 +9,9 @@
[collection
["." list ("#@." monoid)]]]
[world
+ ["." file (#+ Path)]
[net
- ["." uri]]]])
+ ["." uri (#+ URI)]]]])
(type: #export Group
Text)
@@ -64,20 +65,28 @@
..identity-separator
(..identity value)))
-(def: #export (path artifact)
- (-> Artifact Text)
+(def: (address separator artifact)
+ (-> Text Artifact Text)
(let [directory (%.format (|> artifact
(get@ #group)
(text.split-all-with ..group-separator)
- (text.join-with uri.separator))
- uri.separator
+ (text.join-with separator))
+ separator
(get@ #name artifact)
- uri.separator
+ separator
(get@ #version artifact))]
(%.format directory
- uri.separator
+ separator
(..identity artifact))))
+(def: #export uri
+ (-> Artifact URI)
+ (..address uri.separator))
+
+(def: #export (path system)
+ (All [!] (-> (file.System !) Artifact Path))
+ (..address (:: system separator)))
+
(def: #export (local artifact)
(-> Artifact (List Text))
(list@compose (|> artifact
diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux
index 738cae467..8150fa1f6 100644
--- a/stdlib/source/program/aedifex/command/auto.lux
+++ b/stdlib/source/program/aedifex/command/auto.lux
@@ -64,17 +64,17 @@
(promise.future
(loop [path path]
(let [file (java/io/File::new path)]
- (do {@ (try.with io.monad)}
+ (do {! (try.with io.monad)}
[exists? (java/io/File::exists file)
directory? (java/io/File::isDirectory file)]
(if (and exists?
directory?)
- (do @
+ (do !
[children (java/io/File::listFiles file)
children (|> children
array.to-list
- (monad.map @ (|>> java/io/File::getAbsolutePath)))
- descendants (monad.map @ recur children)]
+ (monad.map ! (|>> java/io/File::getAbsolutePath)))
+ descendants (monad.map ! recur children)]
(wrap (#.Cons path (list.concat descendants))))
(wrap (list))))))))
@@ -118,22 +118,22 @@
(def: #export (do! command profile)
(All [a] (-> (Command a) (Command Any)))
- (do {@ ///action.monad}
+ (do {! ///action.monad}
[#let [fs (java/nio/file/FileSystems::getDefault)]
watcher (promise.future (java/nio/file/FileSystem::newWatchService fs))
targets (|> profile
(get@ #///.sources)
set.to-list
- (monad.map @ ..targets)
- (:: @ map list.concat))
- _ (monad.map @ (..watch! watcher) targets)
+ (monad.map ! ..targets)
+ (:: ! map list.concat))
+ _ (monad.map ! (..watch! watcher) targets)
_ (command profile)]
(loop [_ []]
- (do @
+ (do !
[?key (..poll! watcher)
_ (case ?key
(#.Some key)
- (do @
+ (do !
[_ (promise.future (..drain! watcher))
_ (command profile)]
(wrap []))
diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux
index b8ac5c97c..25b1a15aa 100644
--- a/stdlib/source/program/aedifex/command/deploy.lux
+++ b/stdlib/source/program/aedifex/command/deploy.lux
@@ -63,8 +63,8 @@
{#///dependency.artifact identity
#///dependency.type type}
content))))]
- (do {@ ///action.monad}
- [library (:: @ map (binary.run tar.writer)
+ (do {! ///action.monad}
+ [library (:: ! map (binary.run tar.writer)
(export.library (file.async file.default)
(set.to-list (get@ #/.sources profile))))
pom (promise@wrap (///pom.write profile))
diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux
index 57df92d2a..46d32a4f7 100644
--- a/stdlib/source/program/aedifex/dependency/resolution.lux
+++ b/stdlib/source/program/aedifex/dependency/resolution.lux
@@ -56,21 +56,21 @@
(def: (download url)
(-> URL (IO (Try Binary)))
- (do {@ (try.with io.monad)}
+ (do {! (try.with io.monad)}
[input (|> (java/net/URL::new url)
java/net/URL::openStream
- (:: @ map (|>> java/io/BufferedInputStream::new)))
+ (:: ! map (|>> java/io/BufferedInputStream::new)))
#let [buffer (binary.create ..buffer-size)]]
(loop [output (:: binary.monoid identity)]
- (do @
+ (do !
[bytes-read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer-size) input)]
(case bytes-read
- -1 (do @
+ -1 (do !
[_ (java/lang/AutoCloseable::close input)]
(wrap output))
_ (if (n.= ..buffer-size bytes-read)
(recur (:: binary.monoid compose output buffer))
- (do @
+ (do !
[chunk (:: io.monad wrap (binary.slice 0 (.nat bytes-read) buffer))]
(recur (:: binary.monoid compose output chunk)))))))))
@@ -116,7 +116,7 @@
(def: #export (resolve repository dependency)
(-> Repository Dependency (IO (Try Package)))
(let [[artifact type] dependency
- prefix (format repository uri.separator (///artifact.path artifact))]
+ prefix (format repository uri.separator (///artifact.uri artifact))]
(do (try.with io.monad)
[library (..download (format prefix (///artifact/extension.extension type)))
sha1 (..verified-hash dependency library (format prefix ///artifact/extension.sha1) ///hash.sha1 ///hash.sha1-codec ..sha1-does-not-match)
diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux
index 674d99f04..7a4cf070e 100644
--- a/stdlib/source/program/aedifex/local.lux
+++ b/stdlib/source/program/aedifex/local.lux
@@ -14,7 +14,7 @@
["<.>" xml]]]
[data
[binary (#+ Binary)]
- ["." text
+ [text
["%" format (#+ format)]
["." encoding]]
[collection
@@ -26,9 +26,7 @@
["." tar]
["." xml]]]
[world
- ["." file (#+ Path File Directory)]
- [net
- ["." uri]]]]
+ ["." file (#+ Path File Directory)]]]
[program
[compositor
["." export]]]
@@ -42,7 +40,7 @@
["#." dependency (#+ Dependency)
["#/." resolution (#+ Package Resolution)]]])
-(def: (repository system)
+(def: #export (repository system)
(All [a] (-> (file.System a) Path))
(let [/ (:: system separator)]
(format "~" / ".m2" / "repository")))
@@ -51,8 +49,7 @@
(All [a] (-> (file.System a) Artifact Path))
(format (..repository system)
(:: system separator)
- (text.replace-all uri.separator (:: system separator)
- (//artifact.path artifact))))
+ (//artifact.path system artifact)))
(def: (save! system content file)
(-> (file.System Promise) Binary Path (Promise (Try Any)))
@@ -103,8 +100,8 @@
(def: #export (cache-all system resolution)
(-> (file.System Promise) Resolution (Promise (Try Any)))
- (do {@ (try.with promise.monad)}
- [_ (monad.map @ (function (_ [dependency package])
+ (do {! (try.with promise.monad)}
+ [_ (monad.map ! (function (_ [dependency package])
(..cache system dependency package))
(dictionary.entries resolution))]
(wrap [])))
diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux
index 867b3b81f..4fa6612c0 100644
--- a/stdlib/source/program/aedifex/parser.lux
+++ b/stdlib/source/program/aedifex/parser.lux
@@ -77,8 +77,8 @@
(def: license
(Parser /.License)
- (do {@ <>.monad}
- [input (:: @ map
+ (do {! <>.monad}
+ [input (:: ! map
(dictionary.from-list text.hash)
(<c>.record (<>.some (<>.and <c>.local-tag
<c>.any))))]
@@ -92,8 +92,8 @@
(def: organization
(Parser /.Organization)
- (do {@ <>.monad}
- [input (:: @ map
+ (do {! <>.monad}
+ [input (:: ! map
(dictionary.from-list text.hash)
(<c>.record (<>.some (<>.and <c>.local-tag
<c>.any))))]
@@ -103,8 +103,8 @@
(def: developer
(Parser /.Developer)
- (do {@ <>.monad}
- [input (:: @ map
+ (do {! <>.monad}
+ [input (:: ! map
(dictionary.from-list text.hash)
(<c>.record (<>.some (<>.and <c>.local-tag
<c>.any))))]
@@ -120,8 +120,8 @@
(def: info
(Parser /.Info)
- (do {@ <>.monad}
- [input (:: @ map
+ (do {! <>.monad}
+ [input (:: ! map
(dictionary.from-list text.hash)
(<c>.record (<>.some (<>.and <c>.local-tag
<c>.any))))]
@@ -171,8 +171,8 @@
(def: profile
(Parser /.Profile)
- (do {@ <>.monad}
- [input (:: @ map
+ (do {! <>.monad}
+ [input (:: ! map
(dictionary.from-list text.hash)
(<c>.record (<>.some (<>.and <c>.local-tag
<c>.any))))
@@ -187,15 +187,15 @@
(..singular input "info" ..info)))
^repositories (: (Parser (Set //dependency.Repository))
(|> (..plural input "repositories" ..repository)
- (:: @ map (set.from-list text.hash))
+ (:: ! map (set.from-list text.hash))
(<>.default (set.new text.hash))))
^dependencies (: (Parser (Set //dependency.Dependency))
(|> (..plural input "dependencies" ..dependency)
- (:: @ map (set.from-list //dependency.hash))
+ (:: ! map (set.from-list //dependency.hash))
(<>.default (set.new //dependency.hash))))
^sources (: (Parser (Set /.Source))
(|> (..plural input "sources" ..source)
- (:: @ map (set.from-list text.hash))
+ (:: ! map (set.from-list text.hash))
(<>.default (set.from-list text.hash (list /.default-source)))))
^target (: (Parser (Maybe /.Target))
(<>.maybe
@@ -207,7 +207,7 @@
(<>.maybe
(..singular input "test" ..module)))
^deploy-repositories (: (Parser (Dictionary Text //dependency.Repository))
- (<| (:: @ map (dictionary.from-list text.hash))
+ (<| (:: ! map (dictionary.from-list text.hash))
(<>.default (list))
(..singular input "deploy-repositories" ..deploy-repository)))]]
($_ <>.and
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux
index 4f7d8a4fd..259a3f769 100644
--- a/stdlib/source/program/aedifex/pom.lux
+++ b/stdlib/source/program/aedifex/pom.lux
@@ -150,8 +150,8 @@
(def: parse-dependency
(Parser Dependency)
- (do {@ <>.monad}
- [properties (:: @ map (dictionary.from-list name.hash)
+ (do {! <>.monad}
+ [properties (:: ! map (dictionary.from-list name.hash)
(<xml>.children (<>.some ..parse-property)))]
(<| <>.lift
try.from-maybe
@@ -168,16 +168,16 @@
(def: parse-dependencies
(Parser (List Dependency))
- (do {@ <>.monad}
+ (do {! <>.monad}
[_ (<xml>.node ["" ..dependencies-tag])]
(<xml>.children (<>.some ..parse-dependency))))
(def: #export parser
(Parser /.Profile)
- (do {@ <>.monad}
+ (do {! <>.monad}
[_ (<xml>.node ["" ..project-tag])]
(<xml>.children
- (do @
+ (do !
[dependencies (<xml>.somewhere ..parse-dependencies)
_ (<>.some <xml>.ignore)]
(wrap (|> (:: /.monoid identity)
diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux
index 9bc80c462..b084e0a3d 100644
--- a/stdlib/source/program/aedifex/project.lux
+++ b/stdlib/source/program/aedifex/project.lux
@@ -59,8 +59,8 @@
(exception.throw ..circular-dependency [ouroboros name])
#.None
- (do {@ try.monad}
- [parents (monad.map @ (profile' (set.add name lineage) project)
+ (do {! try.monad}
+ [parents (monad.map ! (profile' (set.add name lineage) project)
(get@ #//.parents profile))]
(wrap (list@fold (function (_ parent child)
(:: //.monoid compose child parent))
diff --git a/stdlib/source/program/aedifex/shell.lux b/stdlib/source/program/aedifex/shell.lux
index 72150a016..5ef30cf91 100644
--- a/stdlib/source/program/aedifex/shell.lux
+++ b/stdlib/source/program/aedifex/shell.lux
@@ -82,12 +82,12 @@
(def: #export (execute command working-directory)
(-> Text Path (Action Any))
(promise.future
- (do {@ io.monad}
+ (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 @
+ (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)]
diff --git a/stdlib/source/program/aedifex/upload.lux b/stdlib/source/program/aedifex/upload.lux
index c4572de9d..f5834fa61 100644
--- a/stdlib/source/program/aedifex/upload.lux
+++ b/stdlib/source/program/aedifex/upload.lux
@@ -38,7 +38,7 @@
(-> Repository Dependency URL)
(format repository
uri.separator
- (//artifact.path (get@ #//dependency.artifact dependency))
+ (//artifact.uri (get@ #//dependency.artifact dependency))
"."
(get@ #//dependency.type dependency)))
@@ -82,7 +82,7 @@
(def: #export (upload repository user password dependency content)
(-> Repository User Password Dependency Binary
(Action Any))
- (do {@ ..monad}
+ (do {! ..monad}
[connection (|> (..url repository dependency)
java/net/URL::new
java/net/URL::openConnection)