diff options
author | Eduardo Julian | 2022-08-30 19:33:36 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-08-30 19:33:36 -0400 |
commit | d0e4ba8124345ce990de7fdf7497dd903de6c342 (patch) | |
tree | e8cc8f5e41615ca9ca536f71ddec8aca7f882a6c /stdlib/source | |
parent | b135e487e8f705a5fea7b9ef785310572642063a (diff) |
Got rid of the superfluous "lux macro" extension.
Diffstat (limited to '')
25 files changed, 344 insertions, 288 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index df7b4ef66..f35ba4250 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -732,52 +732,54 @@ #0) ("lux def" let'' - ("lux macro" - ([_ tokens] - ({{#Item lhs {#Item rhs {#Item body {#End}}}} - (meta#in {#Item (form$ {#Item (variant$ {#Item lhs {#Item body {#End}}}) - {#Item rhs {#End}}}) - {#End}}) - - _ - (failure "Wrong syntax for let''")} - tokens))) + ("lux type as" Macro + ("lux type check" Macro' + ([_ tokens] + ({{#Item lhs {#Item rhs {#Item body {#End}}}} + (meta#in {#Item (form$ {#Item (variant$ {#Item lhs {#Item body {#End}}}) + {#Item rhs {#End}}}) + {#End}}) + + _ + (failure "Wrong syntax for let''")} + tokens)))) #0) ("lux def" function'' - ("lux macro" - ([_ tokens] - ({{#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}} - (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" ""]}) - {#Item arg {#End}}}}) - {#Item ({{#End} - body - - _ - (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) - {#Item (_ann {#Tuple args'}) - {#Item body {#End}}}}})} - args') - {#End}}}}) - {#End}}) - - {#Item [_ {#Symbol ["" self]}] {#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}}} - (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" self]}) - {#Item arg {#End}}}}) - {#Item ({{#End} - body - - _ - (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) - {#Item (_ann {#Tuple args'}) - {#Item body {#End}}}}})} - args') - {#End}}}}) - {#End}}) - - _ - (failure "Wrong syntax for function''")} - tokens))) + ("lux type as" Macro + ("lux type check" Macro' + ([_ tokens] + ({{#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}} + (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" ""]}) + {#Item arg {#End}}}}) + {#Item ({{#End} + body + + _ + (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) + {#Item (_ann {#Tuple args'}) + {#Item body {#End}}}}})} + args') + {#End}}}}) + {#End}}) + + {#Item [_ {#Symbol ["" self]}] {#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}}} + (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" self]}) + {#Item arg {#End}}}}) + {#Item ({{#End} + body + + _ + (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) + {#Item (_ann {#Tuple args'}) + {#Item body {#End}}}}})} + args') + {#End}}}}) + {#End}}) + + _ + (failure "Wrong syntax for function''")} + tokens)))) #0) ("lux def" as_def @@ -808,42 +810,48 @@ ("lux def" as_macro ("lux type check" {#Function Code Code} (function'' [expression] - (form$ {#Item (text$ "lux macro") - {#Item expression - {#End}}}))) + (form$ {#Item (text$ "lux type as") + {#Item (symbol$ [..prelude "Macro"]) + {#Item (form$ {#Item (text$ "lux type check") + {#Item (symbol$ [..prelude "Macro'"]) + {#Item expression + {#End}}}}) + {#End}}}}))) #0) ("lux def" def' - ("lux macro" - (function'' [tokens] - ({{#Item [export_policy - {#Item [[_ {#Form {#Item [name args]}}] - {#Item [type {#Item [body {#End}]}]}]}]} - (meta#in {#Item [(as_def name - (as_checked type (as_function name args body)) - export_policy) - {#End}]}) - - {#Item [export_policy {#Item [name {#Item [type {#Item [body {#End}]}]}]}]} - (meta#in {#Item [(as_def name (as_checked type body) - export_policy) - {#End}]}) - - _ - (failure "Wrong syntax for def'")} - tokens))) + ("lux type as" Macro + ("lux type check" Macro' + (function'' [tokens] + ({{#Item [export_policy + {#Item [[_ {#Form {#Item [name args]}}] + {#Item [type {#Item [body {#End}]}]}]}]} + (meta#in {#Item [(as_def name + (as_checked type (as_function name args body)) + export_policy) + {#End}]}) + + {#Item [export_policy {#Item [name {#Item [type {#Item [body {#End}]}]}]}]} + (meta#in {#Item [(as_def name (as_checked type body) + export_policy) + {#End}]}) + + _ + (failure "Wrong syntax for def'")} + tokens)))) #0) ("lux def" macro - ("lux macro" - (function'' [tokens] - ({{#Item [_ {#Form {#Item name {#Item head tail}}}] {#Item body {#End}}} - (meta#in {#Item (as_macro (as_function name {#Item head tail} body)) - {#End}}) - - _ - (failure (wrong_syntax_error [..prelude "macro"]))} - tokens))) + ("lux type as" Macro + ("lux type check" Macro' + (function'' [tokens] + ({{#Item [_ {#Form {#Item name {#Item head tail}}}] {#Item body {#End}}} + (meta#in {#Item (as_macro (as_function name {#Item head tail} body)) + {#End}}) + + _ + (failure (wrong_syntax_error [..prelude "macro"]))} + tokens)))) #1) (def' .public comment diff --git a/stdlib/source/library/lux/control/function/polymorphism/predicate.lux b/stdlib/source/library/lux/control/function/polymorphism/predicate.lux index 4ae4ca483..ed0d4097f 100644 --- a/stdlib/source/library/lux/control/function/polymorphism/predicate.lux +++ b/stdlib/source/library/lux/control/function/polymorphism/predicate.lux @@ -98,8 +98,13 @@ (function ((, g!self) (, next) (, name) [(,* parameters)]) (, (quoted default)))) )))] - (function ((, name) (,* parameters)) - ((, (quoted g!mixin)) [(,* parameters)]))))))))) + (, (when (the #parameters signature) + (list _) + (quoted g!mixin) + + _ + (` (function ((, name) (,* parameters)) + ((, (quoted g!mixin)) [(,* parameters)])))))))))))) ))))) (.def .public method diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux index 981d1a7a1..da97565c2 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/extension/analysis/lux.lux @@ -204,35 +204,6 @@ (<| (typeA.expecting input) (phase archive valueC))))])) -(exception.def .public (not_a_type symbol) - (Exception Symbol) - (exception.report - (list ["Symbol" (%.symbol symbol)]))) - -(def lux::macro - Handler - (..custom - [<code>.any - (function (_ extension_name phase archive valueC) - (do [! ////.monad] - [_ (typeA.inference .Macro) - input_type (loop (again [input_name (symbol .Macro')]) - (do ! - [input_type (///.lifted (meta.definition (symbol .Macro')))] - (when input_type - (^.or {.#Definition [exported? def_type def_value]} - {.#Type [exported? def_value labels]}) - (in (as Type def_value)) - - (^.or {.#Tag _} - {.#Slot _}) - (////.failure (exception.error ..not_a_type [(symbol .Macro')])) - - {.#Alias real_name} - (again real_name))))] - (<| (typeA.expecting input_type) - (phase archive valueC))))])) - (def (bundle::lux eval) (-> Eval Bundle) (|> ///bundle.empty @@ -241,7 +212,6 @@ (///bundle.install "try" lux::try) (///bundle.install "type check" (lux::type::check eval)) (///bundle.install "type as" (lux::type::as eval)) - (///bundle.install "macro" ..lux::macro) (///bundle.install "type check type" (..caster .Type .Type)) (///bundle.install "in-module" lux::in_module))) diff --git a/stdlib/source/library/lux/meta/macro/local.lux b/stdlib/source/library/lux/meta/macro/local.lux index 48ca7db43..d1e9c9475 100644 --- a/stdlib/source/library/lux/meta/macro/local.lux +++ b/stdlib/source/library/lux/meta/macro/local.lux @@ -86,18 +86,18 @@ (def (pop_all macros self) (-> (List Symbol) Symbol Macro) - ("lux macro" - (function (_ _) - (do [! meta.monad] - [_ (monad.each ! ..pop_one macros) - _ (..pop_one self) - compiler meta.compiler_state] - (in (when (the .#expected compiler) - {.#Some _} - (list (' [])) - - {.#None} - (list))))))) + (//.macro + (function (_ _) + (do [! meta.monad] + [_ (monad.each ! ..pop_one macros) + _ (..pop_one self) + compiler meta.compiler_state] + (in (when (the .#expected compiler) + {.#Some _} + (list (' [])) + + {.#None} + (list))))))) (def .public (push macros) (-> (List [Symbol Macro]) (Meta Code)) diff --git a/stdlib/source/library/lux/meta/macro/template.lux b/stdlib/source/library/lux/meta/macro/template.lux index 829c971cf..77c26cfd4 100644 --- a/stdlib/source/library/lux/meta/macro/template.lux +++ b/stdlib/source/library/lux/meta/macro/template.lux @@ -135,16 +135,16 @@ (def (macro (open "_[0]")) (-> Local Macro) - ("lux macro" - (function (_ inputs compiler) - (.let [parameters_amount (list.size _#parameters) - inputs_amount (list.size inputs)] - (if (nat.= parameters_amount inputs_amount) - (.let [environment (is Environment - (|> (list.zipped_2 _#parameters inputs) - (dictionary.of_list text.hash)))] - {.#Right [compiler (list#each (..applied environment) _#template)]}) - (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) + (//.macro + (function (_ inputs compiler) + (.let [parameters_amount (list.size _#parameters) + inputs_amount (list.size inputs)] + (if (nat.= parameters_amount inputs_amount) + (.let [environment (is Environment + (|> (list.zipped_2 _#parameters inputs) + (dictionary.of_list text.hash)))] + {.#Right [compiler (list#each (..applied environment) _#template)]}) + (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) (def local (Parser Local) diff --git a/stdlib/source/program/aedifex/artifact/extension.lux b/stdlib/source/program/aedifex/artifact/extension.lux index 42bbc6a4f..e6aaf9e18 100644 --- a/stdlib/source/program/aedifex/artifact/extension.lux +++ b/stdlib/source/program/aedifex/artifact/extension.lux @@ -33,6 +33,6 @@ [jvm_library] [js_library] [pom] - [sha-1] + [sha1] [md5] ) diff --git a/stdlib/source/program/aedifex/artifact/type.lux b/stdlib/source/program/aedifex/artifact/type.lux index 3fad47295..a960c1443 100644 --- a/stdlib/source/program/aedifex/artifact/type.lux +++ b/stdlib/source/program/aedifex/artifact/type.lux @@ -1,6 +1,6 @@ (.require - [library - [lux (.except Type)]]) + [library + [lux (.except Type)]]) ... https://maven.apache.org/ref/3.6.3/maven-core/artifact-handlers.html (type .public Type @@ -15,6 +15,6 @@ ["jar" jvm_library] ["js" js_library] ["pom" pom] - ["sha1" sha-1] + ["sha1" sha1] ["md5" md5] ) diff --git a/stdlib/source/program/aedifex/command/deploy/release.lux b/stdlib/source/program/aedifex/command/deploy/release.lux index 5a2496648..eb0e4d3ec 100644 --- a/stdlib/source/program/aedifex/command/deploy/release.lux +++ b/stdlib/source/program/aedifex/command/deploy/release.lux @@ -97,7 +97,7 @@ [pom ////artifact/extension.pom] [tar ////artifact/extension.lux_library] [jar ////artifact/extension.jvm_library] - [sha-1 ////artifact/extension.sha-1] + [sha1 ////artifact/extension.sha1] [md5 ////artifact/extension.md5] ) @@ -144,10 +144,10 @@ (at utf8.codec encoded) (at remote upload (..md5 artifact))) _ (|> it - ////hash.sha-1 - (at ////hash.sha-1_codec encoded) + ////hash.sha1 + (at ////hash.sha1_codec encoded) (at utf8.codec encoded) - (at remote upload (..sha-1 artifact))) + (at remote upload (..sha1 artifact))) _ (..release_unsigned_artifact! local remote signature)] (in []))) diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index c74eac1ee..998298ae3 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -59,20 +59,20 @@ {///dependency/status.#Partial partial} (when partial - {.#Left sha-1} - (deploy_hash ///hash.sha-1_codec ///artifact/extension.sha-1 sha-1) + {.#Left sha1} + (deploy_hash ///hash.sha1_codec ///artifact/extension.sha1 sha1) {.#Right md5} (deploy_hash ///hash.md5_codec ///artifact/extension.md5 md5)) - {///dependency/status.#Verified sha-1 md5} + {///dependency/status.#Verified sha1 md5} (do ! - [_ (deploy_hash ///hash.sha-1_codec ///artifact/extension.sha-1 sha-1)] + [_ (deploy_hash ///hash.sha1_codec ///artifact/extension.sha1 sha1)] (deploy_hash ///hash.md5_codec ///artifact/extension.md5 md5)))))) (def (artifacts type status) (-> ///artifact/type.Type Status (List ///artifact/type.Type)) - (with_expansions [<sha-1> (format type ///artifact/extension.sha-1) + (with_expansions [<sha1> (format type ///artifact/extension.sha1) <md5> (format type ///artifact/extension.md5)] (list.partial type (when status @@ -81,11 +81,11 @@ {///dependency/status.#Partial partial} (list (when partial - {.#Left _} <sha-1> + {.#Left _} <sha1> {.#Right _} <md5>)) {///dependency/status.#Verified _} - (list <sha-1> <md5>))))) + (list <sha1> <md5>))))) (def (update_snapshot [artifact type] now snapshot) (-> Dependency Instant Metadata (Try Metadata)) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 571d2d966..84879b93d 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -44,7 +44,7 @@ ["[1][0]" status (.only Status)] ["/[1]" // ["/" profile] - ["[1][0]" hash (.only Hash SHA-1 MD5)] + ["[1][0]" hash (.only Hash SHA1 MD5)] ["[1][0]" pom] ["[1][0]" package (.only Package)] ["[1][0]" artifact (.only Version Artifact) @@ -67,7 +67,7 @@ ["Extension" (%.text extension)] ["Hash" (%.text hash)])))] - [sha-1_does_not_match] + [sha1_does_not_match] [md5_does_not_match] ) @@ -104,18 +104,18 @@ (-> (Repository Async) Version Artifact Extension (Async (Try [Binary Status]))) (do (try.with async.monad) [data (at repository download (///repository/remote.uri version_template artifact extension)) - ?sha-1 (..verified_hash data - repository version_template artifact (format extension ///artifact/extension.sha-1) - ///hash.sha-1 ///hash.sha-1_codec ..sha-1_does_not_match) + ?sha1 (..verified_hash data + repository version_template artifact (format extension ///artifact/extension.sha1) + ///hash.sha1 ///hash.sha1_codec ..sha1_does_not_match) ?md5 (..verified_hash data repository version_template artifact (format extension ///artifact/extension.md5) ///hash.md5 ///hash.md5_codec ..md5_does_not_match)] - (in [data (when [?sha-1 ?md5] - [{.#Some sha-1} {.#Some md5}] - {//status.#Verified sha-1 md5} + (in [data (when [?sha1 ?md5] + [{.#Some sha1} {.#Some md5}] + {//status.#Verified sha1 md5} - [{.#Some sha-1} {.#None}] - {//status.#Partial {.#Left sha-1}} + [{.#Some sha1} {.#None}] + {//status.#Partial {.#Left sha1}} [{.#None} {.#Some md5}] {//status.#Partial {.#Right md5}} diff --git a/stdlib/source/program/aedifex/dependency/status.lux b/stdlib/source/program/aedifex/dependency/status.lux index 2ce288eec..19235595d 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -8,14 +8,14 @@ ["[0]" sum] ["[0]" product]]]] ["[0]" /// - ["[1][0]" hash (.only Hash SHA-1 MD5)]]) + ["[1][0]" hash (.only Hash SHA1 MD5)]]) (type .public Status (Variant {#Unverified} - {#Partial (Either (Hash SHA-1) + {#Partial (Either (Hash SHA1) (Hash MD5))} - {#Verified (Hash SHA-1) (Hash MD5)})) + {#Verified (Hash SHA1) (Hash MD5)})) (def any_equivalence (Equivalence Any) @@ -38,5 +38,5 @@ (def .public (verified payload) (-> Binary Status) {#Verified - (///hash.sha-1 payload) + (///hash.sha1 payload) (///hash.md5 payload)}) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index a83752014..d58f2d23e 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -35,7 +35,7 @@ ("static" getInstance [java/lang/String] java/security/MessageDigest) (digest [[byte]] [byte])) -(primitive .public SHA-1 Any) +(primitive .public SHA1 Any) (primitive .public MD5 Any) (primitive .public (Hash h) @@ -52,7 +52,7 @@ (java/security/MessageDigest::digest [value]) abstraction))] - [sha-1 ..SHA-1 "SHA-1"] + [sha1 ..SHA1 "SHA1"] [md5 ..MD5 "MD5"] ) @@ -71,7 +71,7 @@ Nat <factor>)] - [20 sha-1::size] + [20 sha1::size] [16 md5::size] ) @@ -96,7 +96,7 @@ ["Expected size" (%.nat <size>)] ["Actual size" (%.nat (binary.size data))])))] - [not_a_sha-1 ..sha-1::size] + [not_a_sha1 ..sha1::size] [not_a_md5 ..md5::size] ) @@ -107,7 +107,7 @@ {try.#Success (abstraction data)} (exception.except <exception> [data])))] - [as_sha-1 SHA-1 ..sha-1::size ..not_a_sha-1] + [as_sha1 SHA1 ..sha1::size ..not_a_sha1] [as_md5 MD5 ..md5::size ..not_a_md5] ) @@ -158,7 +158,7 @@ (def encoded (|>> representation ..encoded)) (def decoded (..decoded <nat> <constructor>))))] - [sha-1_codec SHA-1 ..sha-1::size ..as_sha-1] + [sha1_codec SHA1 ..sha1::size ..as_sha1] [md5_codec MD5 ..md5::size ..as_md5] ) diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux index 70f925d84..ace318f61 100644 --- a/stdlib/source/program/aedifex/package.lux +++ b/stdlib/source/program/aedifex/package.lux @@ -51,12 +51,12 @@ (-> XML Binary Package) [#origin {//origin.#Local ""} #library [library - {//status.#Verified (//hash.sha-1 library) + {//status.#Verified (//hash.sha1 library) (//hash.md5 library)}] #pom (let [binary_pom (|> pom (at xml.codec encoded) (at utf8.codec encoded))] [pom binary_pom - {//status.#Verified (//hash.sha-1 binary_pom) + {//status.#Verified (//hash.sha1 binary_pom) (//hash.md5 binary_pom)}])]) (def .public dependencies diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux index 17267bdab..b2a2b9586 100644 --- a/stdlib/source/test/aedifex/artifact/extension.lux +++ b/stdlib/source/test/aedifex/artifact/extension.lux @@ -25,8 +25,8 @@ (_.for [/.Extension] (all _.and (_.coverage [/.lux_library /.jvm_library /.pom - /.sha-1 /.md5] - (let [options (list /.lux_library /.jvm_library /.pom /.sha-1 /.md5) + /.sha1 /.md5] + (let [options (list /.lux_library /.jvm_library /.pom /.sha1 /.md5) uniques (set.of_list text.hash options)] (n.= (list.size options) (set.size uniques)))) diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux index 60ec8e199..220212f70 100644 --- a/stdlib/source/test/aedifex/artifact/type.lux +++ b/stdlib/source/test/aedifex/artifact/type.lux @@ -26,7 +26,7 @@ (all random.either (random#in /.pom) (random#in /.md5) - (random#in /.sha-1)) + (random#in /.sha1)) )) (def .public test @@ -35,9 +35,9 @@ (_.for [/.Type] (all _.and (_.coverage [/.lux_library /.jvm_library /.js_library - /.pom /.md5 /.sha-1] + /.pom /.md5 /.sha1] (let [options (list /.lux_library /.jvm_library /.js_library - /.pom /.md5 /.sha-1) + /.pom /.md5 /.sha1) uniques (set.of_list text.hash options)] (n.= (list.size options) (set.size uniques)))) diff --git a/stdlib/source/test/aedifex/command/deploy.lux b/stdlib/source/test/aedifex/command/deploy.lux index 6e8d38d31..88da67576 100644 --- a/stdlib/source/test/aedifex/command/deploy.lux +++ b/stdlib/source/test/aedifex/command/deploy.lux @@ -128,11 +128,11 @@ actual_pom (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.pom)) actual_library (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact ///artifact/extension.lux_library)) - actual_sha-1 (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha-1))) - actual_sha-1 (at async.monad in - (do try.monad - [actual_sha-1 (at utf8.codec decoded actual_sha-1)] - (at ///hash.sha-1_codec decoded actual_sha-1))) + actual_sha1 (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.sha1))) + actual_sha1 (at async.monad in + (do try.monad + [actual_sha1 (at utf8.codec decoded actual_sha1)] + (at ///hash.sha1_codec decoded actual_sha1))) actual_md5 (at remote download (///repository/remote.uri (the ///artifact.#version artifact) artifact (format ///artifact/extension.lux_library ///artifact/extension.md5))) actual_md5 (at async.monad in (do try.monad @@ -151,10 +151,10 @@ (binary#= (|> expected_pom (at xml.codec encoded) (at utf8.codec encoded)) actual_pom) - deployed_sha-1! + deployed_sha1! (at ///hash.equivalence = - (///hash.sha-1 expected_library) - actual_sha-1) + (///hash.sha1 expected_library) + actual_sha1) deployed_md5! (at ///hash.equivalence = @@ -163,7 +163,7 @@ (in (and succeeded! deployed_library! deployed_pom! - deployed_sha-1! + deployed_sha1! deployed_md5!)))] (unit.coverage [/.do! /.success] (try.else false verdict))))))) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index f94ef4421..79b3210ff 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -110,7 +110,7 @@ (dictionary.value library_url) (maybe#each (binary#= expected_library)) (maybe.else false)) - (dictionary.key? cache (format library_url artifact/extension.sha-1)) + (dictionary.key? cache (format library_url artifact/extension.sha1)) (dictionary.key? cache (format library_url artifact/extension.md5))) correct_pom_upload! @@ -118,7 +118,7 @@ (dictionary.value pom_url) (maybe#each (binary#= expected_pom)) (maybe.else false)) - (dictionary.key? cache (format pom_url artifact/extension.sha-1)) + (dictionary.key? cache (format pom_url artifact/extension.sha1)) (dictionary.key? cache (format pom_url artifact/extension.md5))) artifact_metadata_upload! diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index ad9d9033f..c6c14fec4 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -61,26 +61,26 @@ package /.empty)))) -(def lux_sha-1 +(def lux_sha1 Text - (format ///artifact/extension.lux_library ///artifact/extension.sha-1)) + (format ///artifact/extension.lux_library ///artifact/extension.sha1)) (def lux_md5 Text (format ///artifact/extension.lux_library ///artifact/extension.md5)) -(def pom_sha-1 +(def pom_sha1 Text - (format ///artifact/extension.pom ///artifact/extension.sha-1)) + (format ///artifact/extension.pom ///artifact/extension.sha1)) (def pom_md5 Text (format ///artifact/extension.pom ///artifact/extension.md5)) -(def sha-1 +(def sha1 (-> Binary Binary) - (|>> ///hash.sha-1 - (at ///hash.sha-1_codec encoded) + (|>> ///hash.sha1 + (at ///hash.sha1_codec encoded) (at utf8.codec encoded))) (def md5 @@ -120,8 +120,8 @@ (cond (text.ends_with? ///artifact/extension.lux_library uri) {try.#Success [state library]} - (text.ends_with? ..lux_sha-1 uri) - {try.#Success [state (..sha-1 library)]} + (text.ends_with? ..lux_sha1 uri) + {try.#Success [state (..sha1 library)]} (text.ends_with? ..lux_md5 uri) {try.#Success [state (..md5 library)]} @@ -129,8 +129,8 @@ (text.ends_with? ///artifact/extension.pom uri) {try.#Success [state pom]} - (text.ends_with? ..pom_sha-1 uri) - {try.#Success [state (..sha-1 pom)]} + (text.ends_with? ..pom_sha1 uri) + {try.#Success [state (..sha1 pom)]} (text.ends_with? ..pom_md5 uri) {try.#Success [state (..md5 pom)]} @@ -141,11 +141,11 @@ (def (on_upload uri binary state) {try.#Failure "NOPE"})))) -(def (bad_sha-1 expected_artifact expected_package dummy_package) +(def (bad_sha1 expected_artifact expected_package dummy_package) (-> Artifact Package Package (Mock Any)) (implementation (def the_description - "[~SHA-1]") + "[~SHA1]") (def (on_download uri state) (if (text.contains? (///artifact.uri (the ///artifact.#version expected_artifact) expected_artifact) uri) (cond (text.ends_with? ///artifact/extension.lux_library uri) @@ -153,11 +153,11 @@ (the ///package.#library) product.left)]} - (text.ends_with? ..lux_sha-1 uri) + (text.ends_with? ..lux_sha1 uri) {try.#Success [state (|> expected_package (the ///package.#library) product.left - ..sha-1)]} + ..sha1)]} (text.ends_with? ..lux_md5 uri) {try.#Success [state (|> expected_package @@ -172,13 +172,13 @@ (at xml.codec encoded) (at utf8.codec encoded))]} - (text.ends_with? ..pom_sha-1 uri) + (text.ends_with? ..pom_sha1 uri) {try.#Success [state (|> dummy_package (the ///package.#pom) product.left (at xml.codec encoded) (at utf8.codec encoded) - ..sha-1)]} + ..sha1)]} (text.ends_with? ..pom_md5 uri) {try.#Success [state (|> expected_package @@ -206,11 +206,11 @@ (the ///package.#library) product.left)]} - (text.ends_with? ..lux_sha-1 uri) + (text.ends_with? ..lux_sha1 uri) {try.#Success [state (|> expected_package (the ///package.#library) product.left - ..sha-1)]} + ..sha1)]} (text.ends_with? ..lux_md5 uri) {try.#Success [state (|> dummy_package @@ -225,13 +225,13 @@ (at xml.codec encoded) (at utf8.codec encoded))]} - (text.ends_with? ..pom_sha-1 uri) + (text.ends_with? ..pom_sha1 uri) {try.#Success [state (|> expected_package (the ///package.#pom) product.left (at xml.codec encoded) (at utf8.codec encoded) - ..sha-1)]} + ..sha1)]} (text.ends_with? ..pom_md5 uri) {try.#Success [state (|> dummy_package @@ -258,7 +258,7 @@ not) $///package.random) .let [good (..single expected_artifact expected_package) - bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) + bad_sha1 (..bad_sha1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] (`` (.all _.and (in (do async.monad @@ -287,7 +287,7 @@ {try.#Success _} false))))] - [/.sha-1_does_not_match bad_sha-1] + [/.sha1_does_not_match bad_sha1] [/.md5_does_not_match bad_md5] )) )))) @@ -303,13 +303,13 @@ not) $///package.random) .let [good (..single expected_artifact expected_package) - bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) + bad_sha1 (..bad_sha1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] (.all _.and (in (do async.monad [.let [console ($///version.echo "")] actual_package (/.any console - (list (///repository.mock bad_sha-1 []) + (list (///repository.mock bad_sha1 []) (///repository.mock bad_md5 []) (///repository.mock good [])) [///dependency.#artifact expected_artifact @@ -326,7 +326,7 @@ (in (do async.monad [.let [console ($///version.echo "")] actual_package (/.any console - (list (///repository.mock bad_sha-1 []) + (list (///repository.mock bad_sha1 []) (///repository.mock bad_md5 [])) [///dependency.#artifact expected_artifact ///dependency.#type ///artifact/type.lux_library])] diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux index 85edbdbf8..074394b99 100644 --- a/stdlib/source/test/aedifex/dependency/status.lux +++ b/stdlib/source/test/aedifex/dependency/status.lux @@ -23,9 +23,9 @@ (Random /.Status) (all random.or (random#in []) - (random.or ($///hash.random ///hash.sha-1) + (random.or ($///hash.random ///hash.sha1) ($///hash.random ///hash.md5)) - (random.and ($///hash.random ///hash.sha-1) + (random.and ($///hash.random ///hash.sha1) ($///hash.random ///hash.md5)) )) diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index 7271458b9..ea6d6435e 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -37,11 +37,11 @@ (def .public test Test (<| (_.covering /._) - (_.for [/.Hash /.SHA-1 /.MD5]) + (_.for [/.Hash /.SHA1 /.MD5]) (`` (all _.and (_.for [/.equivalence] (all _.and - ($equivalence.spec /.equivalence (..random /.sha-1)) + ($equivalence.spec /.equivalence (..random /.sha1)) ($equivalence.spec /.equivalence (..random /.md5)) )) (_.for [/.data] @@ -65,14 +65,14 @@ {try.#Failure error} (exception.match? <exception> error)))))] - [/.sha-1 /.as_sha-1 /.not_a_sha-1] + [/.sha1 /.as_sha1 /.not_a_sha1] [/.md5 /.as_md5 /.not_a_md5] )))) (,, (with_template [<codec> <hash>] [(_.for [<codec>] ($codec.spec /.equivalence <codec> (..random <hash>)))] - [/.sha-1_codec /.sha-1] + [/.sha1_codec /.sha1] [/.md5_codec /.md5] )) (_.for [/.not_a_hash] @@ -90,7 +90,7 @@ {try.#Failure error} (exception.match? /.not_a_hash error))))] - [/.sha-1_codec /.sha-1] + [/.sha1_codec /.sha1] [/.md5_codec /.md5] )))) )))) diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index dc03b1671..fd8a2c372 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -79,7 +79,7 @@ (and (when (the /.#origin local) {//origin.#Local ""} true _ false) - (let [expected_sha1 (//hash.sha-1 expected_library) + (let [expected_sha1 (//hash.sha1 expected_library) expected_md5 (//hash.md5 expected_library)] (and (same? expected_library actual_library) (when library_status @@ -89,7 +89,7 @@ _ false))) - (let [expected_sha1 (//hash.sha-1 binary_pom) + (let [expected_sha1 (//hash.sha1 binary_pom) expected_md5 (//hash.md5 binary_pom)] (and (same? expected_pom actual_pom) (|> (do try.monad diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index f970099ec..e4dbc056b 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -361,9 +361,9 @@ (_.coverage [/.unquote] (exec (is /.UnQuote - (/.unquote ("lux macro" (/.unquote_macro /.,)))) + (/.unquote (macro.macro (/.unquote_macro /.,)))) (is /.UnQuote - (/.unquote ("lux macro" (/.unquote_macro /.,')))) + (/.unquote (macro.macro (/.unquote_macro /.,')))) true)) (_.coverage [/., /.but] (with_expansions [<nat> (code.nat example_nat)] @@ -426,7 +426,7 @@ (same? macro))) (_.coverage [/.Macro] (|> macro - "lux macro" + macro.macro (is /.Macro) (is Any) (same? (is Any macro)))) diff --git a/stdlib/source/test/lux/meta/macro/context.lux b/stdlib/source/test/lux/meta/macro/context.lux index cbcdf60e0..095fed836 100644 --- a/stdlib/source/test/lux/meta/macro/context.lux +++ b/stdlib/source/test/lux/meta/macro/context.lux @@ -18,7 +18,8 @@ ["<[1]>" \\parser]] [macro [syntax (.only syntax)] - ["[0]" expansion]]] + ["[0]" expansion] + ["[0]" template]]] [test ["_" property (.only Test)]]]] [\\library @@ -34,70 +35,129 @@ {try.#Success _} {try.#Failure "OOPS!"})))) -(/.def [stack expression declaration] Nat) +(template.with_locals [<real_stack>' <real_expression> <real_declaration> + <fake_stack>' <fake_expression> <fake_declaration>] + (these (/.def [<real_stack>' <real_expression> <real_declaration>] Nat) -(with_expansions [<top> (static.random_nat)] - (<| static.expansion - (declaration <top>) - (` (def (,' declaration!) true)))) - -(def .public test - Test - (<| (_.covering /._) - (all _.and - (_.coverage [/.def] - (and declaration! - (with_expansions [<top> (static.random_nat)] - (<| static.expansion - (do meta.monad - [it (expression <top> (` true))] - (in (list it))))))) - (_.coverage [/.peek /.peek' - /.push /.push'] - (with_expansions [<expected> (static.random_nat)] - (n.= <expected> - (<| static.expansion - (do meta.monad - [_ (/.push <expected> ..stack) - actual (/.peek ..stack) - _ (/.pop ..stack)] - (in (list (code.nat actual)))))))) - (_.coverage [/.no_active_context] - (<| (text.contains? (the exception.#label /.no_active_context)) - macro_error - static.expansion - (do meta.monad - [top (/.peek ..stack)] - (in (list (code.nat top)))))) - (_.coverage [/.pop /.pop' /.pop''] - (with_expansions [<dummy> (static.random_nat) - <expected> (static.nat (++ <dummy>))] - (n.= <expected> + (with_expansions [<real_stack> (template.symbol [.._] [<real_stack>']) + <fake_stack> (template.symbol [.._] [<fake_stack>'])] + (these (with_expansions [<top> (static.random_nat)] (<| static.expansion - (do meta.monad - [_ (/.push <dummy> ..stack) - _ (/.pop ..stack) - _ (/.push <expected> ..stack) - actual (/.peek ..stack) - _ (/.pop ..stack)] - (in (list (code.nat actual)))))))) - (_.coverage [/.search /.search'] - (with_expansions [<expected> (static.random_nat)] - (n.= <expected> - (<| static.expansion - (do meta.monad - [_ (/.push <expected> ..stack) - actual (/.search (n.= <expected>) ..stack) - _ (/.pop ..stack)] - (in (list (code.nat actual)))))))) - (_.coverage [/.no_example] - (with_expansions [<expected> (static.random_nat)] - (<| (text.contains? (the exception.#label /.no_example)) - macro_error - static.expansion - (do meta.monad - [_ (/.push <expected> ..stack) - actual (/.search (|>> (n.= <expected>) not) ..stack) - _ (/.pop ..stack)] - (in (list (code.nat actual))))))) - ))) + (<real_declaration> <top>) + (` (def (,' declaration!) true)))) + + (def .public test + Test + (<| (_.covering /._) + (_.for [/.Stack]) + (all _.and + (_.coverage [/.def] + (and declaration! + (with_expansions [<top> (static.random_nat)] + (<| static.expansion + (do meta.monad + [it (<real_expression> <top> (` true))] + (in (list it))))))) + (_.coverage [/.peek /.peek' + /.push /.push'] + (with_expansions [<expected> (static.random_nat)] + (n.= <expected> + (<| static.expansion + (do meta.monad + [_ (/.push <expected> <real_stack>) + actual (/.peek <real_stack>) + _ (/.pop <real_stack>)] + (in (list (code.nat actual)))))))) + (_.coverage [/.no_active_context] + (<| (text.contains? (the exception.#label /.no_active_context)) + macro_error + static.expansion + (do meta.monad + [top (/.peek <real_stack>)] + (in (list (code.nat top)))))) + (_.coverage [/.pop /.pop' /.pop''] + (with_expansions [<dummy> (static.random_nat) + <expected> (static.nat (++ <dummy>))] + (n.= <expected> + (<| static.expansion + (do meta.monad + [_ (/.push <dummy> <real_stack>) + _ (/.pop <real_stack>) + _ (/.push <expected> <real_stack>) + actual (/.peek <real_stack>) + _ (/.pop <real_stack>)] + (in (list (code.nat actual)))))))) + (_.coverage [/.search /.search'] + (with_expansions [<expected> (static.random_nat)] + (n.= <expected> + (<| static.expansion + (do meta.monad + [_ (/.push <expected> <real_stack>) + actual (/.search (n.= <expected>) <real_stack>) + _ (/.pop <real_stack>)] + (in (list (code.nat actual)))))))) + (_.coverage [/.no_example] + (with_expansions [<expected> (static.random_nat)] + (and (<| (text.contains? (the exception.#label /.no_example)) + macro_error + static.expansion + (do meta.monad + [_ (/.push <expected> <real_stack>) + actual (/.search (|>> (n.= <expected>) not) <real_stack>) + _ (/.pop <real_stack>)] + (in (list (code.nat actual))))) + (<| (text.contains? (the exception.#label /.no_example)) + macro_error + static.expansion + (do meta.monad + [_ (/.revised {.#None} ++ <real_stack>)] + (in (list))))))) + (_.coverage [/.not_a_definition] + (and (<| (text.contains? (the exception.#label /.not_a_definition)) + macro_error + static.expansion + (do meta.monad + [actual (/.peek' [<real_stack> (symbol <fake_stack>)])] + (in (list)))) + (with_expansions [<expected> (static.random_nat)] + (<| (text.contains? (the exception.#label /.not_a_definition)) + macro_error + static.expansion + (do meta.monad + [_ (/.push' <expected> [<real_stack> (symbol .#Item)])] + (in (list))))))) + (_.coverage [/.not_a_global] + (with_expansions [<expected> (static.random_nat)] + (<| (text.contains? (the exception.#label /.not_a_global)) + macro_error + static.expansion + (do meta.monad + [_ (/.push' <expected> [<real_stack> (symbol <fake_stack>)])] + (in (list)))))) + (_.coverage [/.not_a_module] + (with_expansions [<expected> (static.random_nat)] + (<| (text.contains? (the exception.#label /.not_a_module)) + macro_error + static.expansion + (do meta.monad + [_ (/.push' <expected> [<real_stack> [(%.nat <expected>) (%.nat <expected>)]])] + (in (list)))))) + (_.coverage [/.revised /.revised'] + (with_expansions [<expected> (static.random_nat)] + (and (n.= (++ <expected>) + (<| static.expansion + (do meta.monad + [_ (/.push <expected> <real_stack>) + _ (/.revised {.#None} ++ <real_stack>) + actual (/.peek <real_stack>) + _ (/.pop <real_stack>)] + (in (list (code.nat actual)))))) + (n.= (++ <expected>) + (<| static.expansion + (do meta.monad + [_ (/.push <expected> <real_stack>) + _ (/.revised {.#Some (n.= <expected>)} ++ <real_stack>) + actual (/.peek <real_stack>) + _ (/.pop <real_stack>)] + (in (list (code.nat actual))))))))) + ))))))) diff --git a/stdlib/source/test/lux/meta/macro/local.lux b/stdlib/source/test/lux/meta/macro/local.lux index 244c8ddd7..8605bc0ff 100644 --- a/stdlib/source/test/lux/meta/macro/local.lux +++ b/stdlib/source/test/lux/meta/macro/local.lux @@ -46,9 +46,9 @@ (def (constant output) (-> Code Macro) - ("lux macro" - (function (_ inputs lux) - {try.#Success [lux (list output)]}))) + (macro.macro + (function (_ inputs lux) + {try.#Success [lux (list output)]}))) (def with (syntax (_ [name (<code>.tuple (<>.and <code>.text <code>.text)) diff --git a/stdlib/source/test/lux/world/time/instant.lux b/stdlib/source/test/lux/world/time/instant.lux index 32b4c71f3..d81a5ad27 100644 --- a/stdlib/source/test/lux/world/time/instant.lux +++ b/stdlib/source/test/lux/world/time/instant.lux @@ -5,14 +5,17 @@ [monad (.only do)] [\\specification ["$[0]" equivalence] + ["$[0]" hash] ["$[0]" order] ["$[0]" enum] ["$[0]" codec]]] [control ["[0]" function] - ["[0]" try] + ["[0]" try (.use "[1]#[0]" functor)] ["[0]" io]] [data + ["[0]" text + ["?[1]" \\parser]] [collection ["[0]" list (.use "[1]#[0]" mix)]]] [math @@ -32,6 +35,8 @@ (all _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence random.instant)) + (_.for [/.hash] + ($hash.spec /.hash random.instant)) (_.for [/.order] ($order.spec /.order random.instant)) (_.for [/.enum] @@ -104,4 +109,12 @@ {try.#Failure _} false)) + (do random.monad + [expected random.instant] + (_.coverage [/.format /.parser] + (|> expected + /.format + (?text.result /.parser) + (try#each (at /.equivalence = expected)) + (try.else false)))) ))) |