From 8c3a1afab9efeb86e2f53d743551fc689fbad257 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 12 Jun 2022 13:33:48 -0400 Subject: De-sigil-ification: suffix : [Part 4] --- stdlib/source/program/aedifex.lux | 36 +++---- stdlib/source/program/aedifex/artifact.lux | 30 +++--- .../source/program/aedifex/artifact/snapshot.lux | 8 +- .../source/program/aedifex/artifact/time/date.lux | 10 +- stdlib/source/program/aedifex/cli.lux | 8 +- stdlib/source/program/aedifex/command/build.lux | 46 ++++---- stdlib/source/program/aedifex/dependency.lux | 22 ++-- .../source/program/aedifex/dependency/status.lux | 8 +- stdlib/source/program/aedifex/hash.lux | 20 ++-- stdlib/source/program/aedifex/profile.lux | 118 ++++++++++----------- stdlib/source/program/aedifex/project.lux | 12 +-- stdlib/source/program/aedifex/repository/local.lux | 40 +++---- .../source/program/aedifex/repository/remote.lux | 80 +++++++------- 13 files changed, 219 insertions(+), 219 deletions(-) (limited to 'stdlib/source/program') diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index d338fe439..339b1c03c 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -130,25 +130,25 @@ (exception: .public invalid_operation) -(`` (implementation: write_only +(`` (def: write_only (Console IO) - - (~~ (with_template [] - [(def: ( _) - (io.io (exception.except ..invalid_operation [])))] - - [read] - [read_line] - [close] - )) - - (def: (write it) - (<| io.io - {try.#Success} - debug.log! - (if (text.ends_with? text.\n it) - (maybe.trusted (text.clip 0 (-- (text.size it)) it)) - it))))) + (implementation + (~~ (with_template [] + [(def: ( _) + (io.io (exception.except ..invalid_operation [])))] + + [read] + [read_line] + [close] + )) + + (def: (write it) + (<| io.io + {try.#Success} + debug.log! + (if (text.ends_with? text.\n it) + (maybe.trusted (text.clip 0 (-- (text.size it)) it)) + it)))))) (program: [[profiles operation] /cli.command] (do [! io.monad] diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index a6824828a..6b27b55a9 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -43,25 +43,25 @@ (Equivalence Artifact) (at ..hash equivalence)) -(implementation: .public order +(def: .public order (Order Artifact) + (implementation + (def: equivalence + ..equivalence) - (def: equivalence - ..equivalence) - - (def: (< reference subject) - (<| (or (text#< (the #group reference) - (the #group subject))) - - (and (text#= (the #group reference) + (def: (< reference subject) + (<| (or (text#< (the #group reference) (the #group subject))) - (or (text#< (the #name reference) - (the #name subject))) - - (and (text#= (the #name reference) + + (and (text#= (the #group reference) + (the #group subject))) + (or (text#< (the #name reference) (the #name subject))) - (text#< (the #version reference) - (the #version subject))))) + + (and (text#= (the #name reference) + (the #name subject))) + (text#< (the #version reference) + (the #version subject)))))) (with_template [ ] [(def: diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux index 7784faa1f..b9fde212c 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot.lux @@ -21,11 +21,11 @@ {#Local} {#Remote Stamp})) -(implementation: any_equivalence +(def: any_equivalence (Equivalence Any) - - (def: (= _ _) - true)) + (implementation + (def: (= _ _) + true))) (def: .public equivalence (Equivalence Snapshot) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 85dee4278..de20211f2 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -57,12 +57,12 @@ (-> Date date.Date) (|>> representation)) - (implementation: .public equivalence + (def: .public equivalence (Equivalence Date) - - (def: (= reference subject) - (date#= (representation reference) - (representation subject)))) + (implementation + (def: (= reference subject) + (date#= (representation reference) + (representation subject))))) (def: .public (format value) (%.Format Date) diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index e2c7c92e6..25ab8be02 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -21,11 +21,11 @@ {#Build} {#Test})) -(implementation: any_equivalence +(def: any_equivalence (Equivalence Any) - - (def: (= reference subject) - true)) + (implementation + (def: (= reference subject) + true))) (def: compilation_equivalence (Equivalence Compilation) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 98fa73d75..dfb566c11 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -140,30 +140,30 @@ (def: version_separator ".") -(implementation: version_order +(def: version_order (Order Version) - - (def: equivalence - text.equivalence) - - (def: (< left right) - (loop (again [left (text.all_split_by ..version_separator left) - right (text.all_split_by ..version_separator right)]) - (case [left right] - [{.#Item leftH leftT} {.#Item rightH rightT}] - (if (text#= leftH rightH) - (again leftT rightT) - (or (n.< (text.size leftH) (text.size rightH)) - (text#< leftH rightH))) - - [{.#Item leftH leftT} {.#End}] - false - - [{.#End} {.#Item rightH rightT}] - true - - [{.#End} {.#End}] - false)))) + (implementation + (def: equivalence + text.equivalence) + + (def: (< left right) + (loop (again [left (text.all_split_by ..version_separator left) + right (text.all_split_by ..version_separator right)]) + (case [left right] + [{.#Item leftH leftT} {.#Item rightH rightT}] + (if (text#= leftH rightH) + (again leftT rightT) + (or (n.< (text.size leftH) (text.size rightH)) + (text#< leftH rightH))) + + [{.#Item leftH leftT} {.#End}] + false + + [{.#End} {.#Item rightH rightT}] + true + + [{.#End} {.#End}] + false))))) (def: .public (host_dependencies fs home) (All (_ !) (-> (file.System !) Path Resolution (List Path))) diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux index 2b207cbcd..860493d55 100644 --- a/stdlib/source/program/aedifex/dependency.lux +++ b/stdlib/source/program/aedifex/dependency.lux @@ -29,17 +29,17 @@ (Equivalence Dependency) (at hash equivalence)) -(implementation: .public order +(def: .public order (Order Dependency) + (implementation + (def: equivalence + ..equivalence) - (def: equivalence - ..equivalence) - - (def: (< reference subject) - (<| (or (//#< (the #artifact reference) - (the #artifact subject))) - - (and (//#= (the #artifact reference) + (def: (< reference subject) + (<| (or (//#< (the #artifact reference) (the #artifact subject))) - (text#< (the #type reference) - (the #type subject))))) + + (and (//#= (the #artifact reference) + (the #artifact subject))) + (text#< (the #type reference) + (the #type subject)))))) diff --git a/stdlib/source/program/aedifex/dependency/status.lux b/stdlib/source/program/aedifex/dependency/status.lux index 1a76605d0..f36f85fe2 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -17,11 +17,11 @@ (Hash MD5))} {#Verified (Hash SHA-1) (Hash MD5)})) -(implementation: any_equivalence +(def: any_equivalence (Equivalence Any) - - (def: (= _ _) - true)) + (implementation + (def: (= _ _) + true))) (def: .public equivalence (Equivalence Status) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 8a22579b2..310fd421d 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -150,21 +150,21 @@ (exception.except ..not_a_hash [(..encoding_size size) encoded])))) (with_template [ ] - [(implementation: .public + [(def: .public (Codec Text (Hash )) - - (def: encoded (|>> representation ..encoded)) - (def: decoded (..decoded )))] + (implementation + (def: encoded (|>> representation ..encoded)) + (def: decoded (..decoded ))))] [sha-1_codec SHA-1 ..sha-1::size ..as_sha-1] [md5_codec MD5 ..md5::size ..as_md5] ) - (implementation: .public equivalence + (def: .public equivalence (All (_ h) (Equivalence (Hash h))) - - (def: (= reference subject) - (at binary.equivalence = - (representation reference) - (representation subject)))) + (implementation + (def: (= reference subject) + (at binary.equivalence = + (representation reference) + (representation subject))))) ) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 6420d69ac..90e5f3d8d 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -49,19 +49,19 @@ {#Repo} {#Manual})) -(implementation: distribution_equivalence +(def: distribution_equivalence (Equivalence Distribution) + (implementation + (def: (= reference subject) + (case [reference subject] + (^.with_template [] + [[{} {}] + true]) + ([#Repo] + [#Manual]) - (def: (= reference subject) - (case [reference subject] - (^.with_template [] - [[{} {}] - true]) - ([#Repo] - [#Manual]) - - _ - false))) + _ + false)))) (type: .public License [Text @@ -226,55 +226,55 @@ ... #ruby runtime.equivalence)) -(implementation: .public monoid +(def: .public monoid (Monoid Profile) + (implementation + (def: identity + [#parents (list) + #identity {.#None} + #info {.#None} + #repositories (set.empty text.hash) + #dependencies (set.empty dependency.hash) + #lux ..default_lux + #compilers (list) + #sources (set.empty text.hash) + #target ..default_target + #program {.#None} + #test {.#None} + #deploy_repositories (dictionary.empty text.hash) + #configuration plist.empty + #java runtime.default_java + #js runtime.default_js + #python runtime.default_python + #lua runtime.default_lua + #ruby runtime.default_ruby]) - (def: identity - [#parents (list) - #identity {.#None} - #info {.#None} - #repositories (set.empty text.hash) - #dependencies (set.empty dependency.hash) - #lux ..default_lux - #compilers (list) - #sources (set.empty text.hash) - #target ..default_target - #program {.#None} - #test {.#None} - #deploy_repositories (dictionary.empty text.hash) - #configuration plist.empty - #java runtime.default_java - #js runtime.default_js - #python runtime.default_python - #lua runtime.default_lua - #ruby runtime.default_ruby]) - - (def: (composite override baseline) - (template.let [(!runtime ) - [(if (runtime#= (the override)) - (the baseline) - (the override))]] - [#parents (list#composite (the #parents baseline) (the #parents override)) - #identity (maybe#composite (the #identity override) (the #identity baseline)) - #info (maybe#composite (the #info override) (the #info baseline)) - #repositories (set.union (the #repositories baseline) (the #repositories override)) - #dependencies (set.union (the #dependencies baseline) (the #dependencies override)) - #lux (if (dependency#= ..default_lux (the #lux override)) - (the #lux baseline) - (the #lux override)) - #compilers (list#composite (the #compilers baseline) (the #compilers override)) - #sources (set.union (the #sources baseline) (the #sources override)) - #target (if (text#= ..default_target (the #target baseline)) - (the #target override) - (the #target baseline)) - #program (maybe#composite (the #program override) (the #program baseline)) - #test (maybe#composite (the #test override) (the #test baseline)) - #deploy_repositories (dictionary.composite (the #deploy_repositories override) (the #deploy_repositories baseline)) - #configuration (plist#composite (the #configuration override) (the #configuration baseline)) - #java (!runtime #java runtime.default_java) - #js (!runtime #js runtime.default_js) - #python (!runtime #python runtime.default_python) - #lua (!runtime #lua runtime.default_lua) - #ruby (!runtime #ruby runtime.default_ruby)]))) + (def: (composite override baseline) + (template.let [(!runtime ) + [(if (runtime#= (the override)) + (the baseline) + (the override))]] + [#parents (list#composite (the #parents baseline) (the #parents override)) + #identity (maybe#composite (the #identity override) (the #identity baseline)) + #info (maybe#composite (the #info override) (the #info baseline)) + #repositories (set.union (the #repositories baseline) (the #repositories override)) + #dependencies (set.union (the #dependencies baseline) (the #dependencies override)) + #lux (if (dependency#= ..default_lux (the #lux override)) + (the #lux baseline) + (the #lux override)) + #compilers (list#composite (the #compilers baseline) (the #compilers override)) + #sources (set.union (the #sources baseline) (the #sources override)) + #target (if (text#= ..default_target (the #target baseline)) + (the #target override) + (the #target baseline)) + #program (maybe#composite (the #program override) (the #program baseline)) + #test (maybe#composite (the #test override) (the #test baseline)) + #deploy_repositories (dictionary.composite (the #deploy_repositories override) (the #deploy_repositories baseline)) + #configuration (plist#composite (the #configuration override) (the #configuration baseline)) + #java (!runtime #java runtime.default_java) + #js (!runtime #js runtime.default_js) + #python (!runtime #python runtime.default_python) + #lua (!runtime #lua runtime.default_lua) + #ruby (!runtime #ruby runtime.default_ruby)])))) (exception: .public no_identity) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 51288af15..209ee225a 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -32,14 +32,14 @@ (Equivalence Project) (dictionary.equivalence //.equivalence)) -(implementation: .public monoid +(def: .public monoid (Monoid Project) + (implementation + (def: identity + (dictionary.empty text.hash)) - (def: identity - (dictionary.empty text.hash)) - - (def: composite - (dictionary.composite_with (at //.monoid composite)))) + (def: composite + (dictionary.composite_with (at //.monoid composite))))) (exception: .public (unknown_profile [name Name]) (exception.report diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index 6f031ccfd..6e9db2755 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -38,27 +38,27 @@ (..path /) (format (..root program fs) /)))) -(implementation: .public (repository program fs) +(def: .public (repository program fs) (-> (Program Async) (file.System Async) (//.Repository Async)) + (implementation + (def: description + (..root program fs)) - (def: description - (..root program fs)) + (def: download + (|>> (..absolute_path program fs) + (at fs read))) - (def: download - (|>> (..absolute_path program fs) - (at fs read))) + (def: (upload uri content) + (do [! async.monad] + [.let [absolute_path (..absolute_path program fs uri)] + ? (at fs file? absolute_path) + _ (is (Async (Try Any)) + (if ? + (in {try.#Success []}) + (case (file.parent fs absolute_path) + {.#Some parent} + (file.make_directories async.monad fs parent) - (def: (upload uri content) - (do [! async.monad] - [.let [absolute_path (..absolute_path program fs uri)] - ? (at fs file? absolute_path) - _ (is (Async (Try Any)) - (if ? - (in {try.#Success []}) - (case (file.parent fs absolute_path) - {.#Some parent} - (file.make_directories async.monad fs parent) - - _ - (in {try.#Success []}))))] - (at fs write absolute_path content)))) + _ + (in {try.#Success []}))))] + (at fs write absolute_path content))))) diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 29bcbad84..b5fbc6b13 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -54,45 +54,45 @@ (List [Text Text]) (list ["User-Agent" ..user_agent])) -(implementation: .public (repository http identity address) +(def: .public (repository http identity address) (All (_ s) (-> (http.Client IO) (Maybe Identity) Address (//.Repository IO))) + (implementation + (def: description + address) + (def: (download uri) + (do [! (try.with io.monad)] + [[status message] (is (IO (Try (@http.Response IO))) + (http.get (format address uri) + (http.headers ..base_headers) + {.#None} + http))] + (case status + (pattern (static http/status.ok)) + (at ! each product.right ((the @http.#body message) {.#None})) + + _ + (do ! + [_ ((the @http.#body message) {.#Some 0})] + (at io.monad in (exception.except ..download_failure [(format address uri) status])))))) - (def: description - address) - (def: (download uri) - (do [! (try.with io.monad)] - [[status message] (is (IO (Try (@http.Response IO))) - (http.get (format address uri) - (http.headers ..base_headers) - {.#None} - http))] - (case status - (pattern (static http/status.ok)) - (at ! each product.right ((the @http.#body message) {.#None})) - - _ - (do ! - [_ ((the @http.#body message) {.#Some 0})] - (at io.monad in (exception.except ..download_failure [(format address uri) status])))))) - - (def: (upload uri content) - (do (try.with io.monad) - [[status message] (is (IO (Try (@http.Response IO))) - (http.put (format address uri) - (http.headers (case identity - {.#None} - ..base_headers - - {.#Some [user password]} - (partial_list ["Authorization" (//identity.basic_auth user password)] - ..base_headers))) - {.#Some content} - http)) - _ ((the @http.#body message) {.#Some 0})] - (case status - (pattern (static http/status.created)) - (in []) - - _ - (at io.monad in (exception.except ..upload_failure [(format address uri) status]))))) - ) + (def: (upload uri content) + (do (try.with io.monad) + [[status message] (is (IO (Try (@http.Response IO))) + (http.put (format address uri) + (http.headers (case identity + {.#None} + ..base_headers + + {.#Some [user password]} + (partial_list ["Authorization" (//identity.basic_auth user password)] + ..base_headers))) + {.#Some content} + http)) + _ ((the @http.#body message) {.#Some 0})] + (case status + (pattern (static http/status.created)) + (in []) + + _ + (at io.monad in (exception.except ..upload_failure [(format address uri) status]))))) + )) -- cgit v1.2.3