diff options
Diffstat (limited to 'stdlib/source/program')
31 files changed, 466 insertions, 466 deletions
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 4e78183f1..67c4e89f3 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -62,10 +62,10 @@ (def: repositories (-> /.Profile (List (Repository Promise))) (|>> (get@ #/.repositories) - set.to-list + set.to_list (list\map (|>> (/repository.remote #.None) /repository.async)))) -(def: (with-dependencies program console command profile) +(def: (with_dependencies program console command profile) (All [a] (-> (Program Promise) (Console Promise) (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command a)) @@ -74,7 +74,7 @@ [resolution (/command/deps.do! program console (file.async file.default) (..repositories profile) profile)] ((command console program (file.async file.default) (shell.async shell.default) resolution) profile))) -(exception: (cannot-find-repository {repository Text} +(exception: (cannot_find_repository {repository Text} {options (Dictionary Text Address)}) (exception.report ["Repository" (%.text repository)] @@ -146,7 +146,7 @@ (#/cli.Deploy repository identity) (..command (case [(get@ #/.identity profile) - (dictionary.get repository (get@ #/.deploy-repositories profile))] + (dictionary.get repository (get@ #/.deploy_repositories profile))] [(#.Some artifact) (#.Some repository)] (/command/deploy.do! console (/repository.async (/repository.remote (#.Some identity) repository)) @@ -155,10 +155,10 @@ profile) [#.None _] - (promise\wrap (exception.throw /.no-identity [])) + (promise\wrap (exception.throw /.no_identity [])) [_ #.None] - (promise\wrap (exception.throw ..cannot-find-repository [repository (get@ #/.deploy-repositories profile)])))) + (promise\wrap (exception.throw ..cannot_find_repository [repository (get@ #/.deploy_repositories profile)])))) #/cli.Dependencies (..command @@ -167,9 +167,9 @@ (#/cli.Compilation compilation) (case compilation #/cli.Build (..command - (..with-dependencies program console /command/build.do! profile)) + (..with_dependencies program console /command/build.do! profile)) #/cli.Test (..command - (..with-dependencies program console /command/test.do! profile))) + (..with_dependencies program console /command/test.do! profile))) (#/cli.Auto auto) (do ! @@ -181,6 +181,6 @@ (#try.Success watcher) (..command (case auto - #/cli.Build (..with-dependencies program console (/command/auto.do! watcher /command/build.do!) profile) - #/cli.Test (..with-dependencies program console (/command/auto.do! watcher /command/test.do!) profile))))))) + #/cli.Build (..with_dependencies program console (/command/auto.do! watcher /command/build.do!) profile) + #/cli.Test (..with_dependencies program console (/command/auto.do! watcher /command/test.do!) profile))))))) )))))) diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index e4fe812f1..6ba0a1e48 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -45,28 +45,28 @@ Text <separator>)] - ["." group-separator] - ["-" version-separator] - [":" identity-separator] + ["." group_separator] + ["-" version_separator] + [":" identity_separator] ) (def: #export (identity artifact) (-> Artifact Text) (%.format (get@ #name artifact) - ..version-separator + ..version_separator (get@ #version artifact))) (def: #export (format value) (Format Artifact) (%.format (get@ #group value) - ..identity-separator + ..identity_separator (..identity value))) (def: #export (directory separator group) (-> Text Group Text) (|> group - (text.split-all-with ..group-separator) - (text.join-with separator))) + (text.split_all_with ..group_separator) + (text.join_with separator))) (def: (address separator artifact) (-> Text Artifact Text) @@ -91,6 +91,6 @@ (-> Artifact (List Text)) (list\compose (|> artifact (get@ #group) - (text.split-all-with ..group-separator)) + (text.split_all_with ..group_separator)) (list (get@ #name artifact) (get@ #version artifact)))) diff --git a/stdlib/source/program/aedifex/artifact/extension.lux b/stdlib/source/program/aedifex/artifact/extension.lux index e108a3727..ad0122512 100644 --- a/stdlib/source/program/aedifex/artifact/extension.lux +++ b/stdlib/source/program/aedifex/artifact/extension.lux @@ -20,15 +20,15 @@ (def: #export type (-> Extension //.Type) - (text.replace-all ..separator "")) + (text.replace_all ..separator "")) (template [<name>] [(def: #export <name> Extension (..extension (template.identifier [//._] [<name>])))] - [lux-library] - [jvm-library] + [lux_library] + [jvm_library] [pom] [sha-1] [md5] diff --git a/stdlib/source/program/aedifex/artifact/type.lux b/stdlib/source/program/aedifex/artifact/type.lux index 5e5772ea2..5c9ba8bb2 100644 --- a/stdlib/source/program/aedifex/artifact/type.lux +++ b/stdlib/source/program/aedifex/artifact/type.lux @@ -10,8 +10,8 @@ Type <type>)] - ["tar" lux-library] - ["jar" jvm-library] + ["tar" lux_library] + ["jar" jvm_library] ["pom" pom] ["sha1" sha-1] ["md5" md5] diff --git a/stdlib/source/program/aedifex/cache.lux b/stdlib/source/program/aedifex/cache.lux index ce95f65b7..d36bb8dff 100644 --- a/stdlib/source/program/aedifex/cache.lux +++ b/stdlib/source/program/aedifex/cache.lux @@ -39,10 +39,10 @@ (-> (file.System Promise) Binary Path (Promise (Try Any))) (do (try.with promise.monad) [file (: (Promise (Try (File Promise))) - (file.get-file promise.monad system file))] - (!.use (\ file over-write) [content]))) + (file.get_file promise.monad system file))] + (!.use (\ file over_write) [content]))) -(def: (write-hashed system directory [artifact type] [data status]) +(def: (write_hashed system directory [artifact type] [data status]) (-> (file.System Promise) Path Dependency [Binary Status] (Promise (Try Any))) (let [prefix (format directory (\ system separator) @@ -50,7 +50,7 @@ (//artifact/extension.extension type))] (do {! (try.with promise.monad)} [_ (..write! system data prefix) - #let [write-hash (: (All [h] (-> (Codec Text (Hash h)) Extension (Hash h) (Promise (Try Any)))) + #let [write_hash (: (All [h] (-> (Codec Text (Hash h)) Extension (Hash h) (Promise (Try Any)))) (function (_ codec extension hash) (..write! system (|> hash (\ codec encode) (\ encoding.utf8 encode)) @@ -62,40 +62,40 @@ (#//dependency/status.Partial partial) (case partial (#.Left sha-1) - (write-hash //hash.sha-1-codec //artifact/extension.sha-1 sha-1) + (write_hash //hash.sha-1_codec //artifact/extension.sha-1 sha-1) (#.Right md5) - (write-hash //hash.md5-codec //artifact/extension.md5 md5)) + (write_hash //hash.md5_codec //artifact/extension.md5 md5)) (#//dependency/status.Verified sha-1 md5) (do ! - [_ (write-hash //hash.sha-1-codec //artifact/extension.sha-1 sha-1)] - (write-hash //hash.md5-codec //artifact/extension.md5 md5)))))) + [_ (write_hash //hash.sha-1_codec //artifact/extension.sha-1 sha-1)] + (write_hash //hash.md5_codec //artifact/extension.md5 md5)))))) -(def: #export (write-one program system [artifact type] package) +(def: #export (write_one program system [artifact type] package) (-> (Program Promise) (file.System Promise) Dependency Package (Promise (Try Artifact))) (do promise.monad [home (\ program home [])] (do (try.with promise.monad) [directory (: (Promise (Try Path)) - (file.make-directories promise.monad system (//.path system home artifact))) - _ (write-hashed system directory [artifact type] (get@ #//package.library package)) + (file.make_directories promise.monad system (//.path system home artifact))) + _ (write_hashed system directory [artifact type] (get@ #//package.library package)) _ (let [[pom status] (get@ #//package.pom package)] - (write-hashed system directory + (write_hashed system directory [artifact //artifact/type.pom] [(|> pom (\ xml.codec encode) (\ encoding.utf8 encode)) status]))] (wrap artifact)))) -(def: #export (write-all program system resolution) +(def: #export (write_all program system resolution) (-> (Program Promise) (file.System Promise) Resolution (Promise (Try (Set Artifact)))) (do {! (try.with promise.monad)} [] (|> (dictionary.entries resolution) (list.filter (|>> product.right //package.local? not)) (monad.map ! (function (_ [dependency package]) - (..write-one program system dependency package))) - (\ ! map (set.from-list //artifact.hash))))) + (..write_one program system dependency package))) + (\ ! map (set.from_list //artifact.hash))))) (def: (read! system path) (-> (file.System Promise) Path (Promise (Try Binary))) @@ -112,7 +112,7 @@ (_\map (\ codec decode)) _\join))) -(def: #export (read-one program system [artifact type]) +(def: #export (read_one program system [artifact type]) (-> (Program Promise) (file.System Promise) Dependency (Promise (Try Package))) (do promise.monad [home (\ program home []) @@ -123,18 +123,18 @@ [pom (..read! system (format prefix //artifact/extension.pom)) #let [extension (//artifact/extension.extension type)] library (..read! system (format prefix extension)) - library-sha-1 (..read! system (format prefix extension //artifact/extension.sha-1)) - library-md5 (..read! system (format prefix extension //artifact/extension.md5))] + library_sha-1 (..read! system (format prefix extension //artifact/extension.sha-1)) + library_md5 (..read! system (format prefix extension //artifact/extension.md5))] (\ promise.monad wrap (do try.monad [pom (..decode xml.codec pom) - library-sha-1 (..decode //hash.sha-1-codec library-sha-1) - library-md5 (..decode //hash.md5-codec library-md5)] + library_sha-1 (..decode //hash.sha-1_codec library_sha-1) + library_md5 (..decode //hash.md5_codec library_md5)] (wrap {#//package.origin #//package.Local - #//package.library [library (#//dependency/status.Verified library-sha-1 library-md5)] + #//package.library [library (#//dependency/status.Verified library_sha-1 library_md5)] #//package.pom [pom #//dependency/status.Unverified]})))))) -(def: #export (read-all program system dependencies resolution) +(def: #export (read_all program system dependencies resolution) (-> (Program Promise) (file.System Promise) (List Dependency) Resolution (Promise (Try Resolution))) (case dependencies #.Nil @@ -147,17 +147,17 @@ (wrap (#try.Success package)) #.None - (..read-one program system head))] - (with-expansions [<next> (as-is (read-all program system tail resolution))] + (..read_one program system head))] + (with_expansions [<next> (as_is (read_all program system tail resolution))] (case package (#try.Success package) (do (try.with promise.monad) - [sub-dependencies (|> package + [sub_dependencies (|> package //package.dependencies (\ promise.monad wrap)) resolution (|> resolution (dictionary.put head package) - (read-all program system (set.to-list sub-dependencies)))] + (read_all program system (set.to_list sub_dependencies)))] <next>) (#try.Failure error) diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index 4625136a3..f2f502bac 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -18,16 +18,16 @@ #Build #Test) -(structure: any-equivalence +(structure: any_equivalence (Equivalence Any) (def: (= reference subject) true)) -(def: compilation-equivalence +(def: compilation_equivalence (Equivalence Compilation) - (sum.equivalence ..any-equivalence - ..any-equivalence)) + (sum.equivalence ..any_equivalence + ..any_equivalence)) (def: compilation (Parser Compilation) @@ -48,24 +48,24 @@ (Equivalence Command) ($_ sum.equivalence ## #Version - ..any-equivalence + ..any_equivalence ## #Clean - ..any-equivalence + ..any_equivalence ## #POM - ..any-equivalence + ..any_equivalence ## #Dependencies - ..any-equivalence + ..any_equivalence ## #Install - ..any-equivalence + ..any_equivalence ## #Deploy ($_ product.equivalence text.equivalence text.equivalence text.equivalence) ## #Compilation - ..compilation-equivalence + ..compilation_equivalence ## #Auto - ..compilation-equivalence)) + ..compilation_equivalence)) (def: command' (Parser Command) diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index 4b151861b..afce4d6ff 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -53,11 +53,11 @@ (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any)))) (function (_ console program fs shell resolution) (function (_ profile) - (with-expansions [<call> ((command console program fs shell resolution) profile)] + (with_expansions [<call> ((command console program fs shell resolution) profile)] (do {! promise.monad} [targets (|> profile (get@ #///.sources) - set.to-list + set.to_list (monad.map ! (..targets fs)) (\ ! map list.concat))] (do {! ///action.monad} diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index de8ceb991..cb4465edd 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -42,7 +42,7 @@ (type: Finder (-> Resolution (Maybe Dependency))) -(def: (dependency-finder group name) +(def: (dependency_finder group name) (-> Group Name Finder) (|>> dictionary.entries (list.one (function (_ [dependency package]) @@ -51,60 +51,60 @@ (#.Some dependency) #.None))))) -(def: #export lux-group +(def: #export lux_group Group "com.github.luxlang") -(def: #export jvm-compiler-name +(def: #export jvm_compiler_name Name "lux-jvm") -(def: #export js-compiler-name +(def: #export js_compiler_name Name "lux-js") (template [<finder> <name>] [(def: <finder> Finder - (..dependency-finder ..lux-group <name>))] + (..dependency_finder ..lux_group <name>))] - [jvm-compiler ..jvm-compiler-name] - [js-compiler ..js-compiler-name] + [jvm_compiler ..jvm_compiler_name] + [js_compiler ..js_compiler_name] ) -(exception: #export no-available-compiler) -(exception: #export no-specified-program) -(exception: #export no-specified-target) +(exception: #export no_available_compiler) +(exception: #export no_specified_program) +(exception: #export no_specified_target) (type: #export Compiler (#JVM Artifact) (#JS Artifact)) -(def: (remove-dependency dependency) +(def: (remove_dependency dependency) (-> Dependency (-> Resolution Resolution)) (|>> dictionary.entries (list.filter (|>> product.left (is? dependency) not)) - (dictionary.from-list ///dependency.hash))) + (dictionary.from_list ///dependency.hash))) (def: (compiler resolution) (-> Resolution (Try [Resolution Compiler])) - (case [(..jvm-compiler resolution) - (..js-compiler resolution)] + (case [(..jvm_compiler resolution) + (..js_compiler resolution)] [(#.Some dependency) _] - (#try.Success [(..remove-dependency dependency resolution) + (#try.Success [(..remove_dependency dependency resolution) (#JVM (get@ #///dependency.artifact dependency))]) [_ (#.Some dependency)] - (#try.Success [(..remove-dependency dependency resolution) + (#try.Success [(..remove_dependency dependency resolution) (#JS (get@ #///dependency.artifact dependency))]) _ - (exception.throw ..no-available-compiler []))) + (exception.throw ..no_available_compiler []))) (def: (libraries fs home) (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.filter (|>> (get@ #///dependency.type) (text\= ///artifact/type.lux-library))) + (list.filter (|>> (get@ #///dependency.type) (text\= ///artifact/type.lux_library))) (list\map (|>> (get@ #///dependency.artifact) (///local.path fs home))))) (def: (singular name) @@ -124,16 +124,16 @@ (case [(get@ #///.program profile) (get@ #///.target profile)] [#.None _] - (promise\wrap (exception.throw ..no-specified-program [])) + (promise\wrap (exception.throw ..no_specified_program [])) [_ #.None] - (promise\wrap (exception.throw ..no-specified-target [])) + (promise\wrap (exception.throw ..no_specified_target [])) - [(#.Some program-module) (#.Some target)] + [(#.Some program_module) (#.Some target)] (do promise.monad [environment (\ program environment []) home (\ program home []) - working-directory (\ program directory [])] + working_directory (\ program directory [])] (do ///action.monad [[resolution compiler] (promise\wrap (..compiler resolution)) #let [[command output] (let [[compiler output] (case compiler @@ -143,20 +143,20 @@ "program.js"])] [(format compiler " build") output]) / (\ fs separator) - cache-directory (format working-directory / target)] - _ (console.write-line ..start console) + cache_directory (format working_directory / target)] + _ (console.write_line ..start console) process (!.use (\ shell execute) [environment - working-directory + working_directory command (list.concat (list (..plural "--library" (..libraries fs home resolution)) - (..plural "--source" (set.to-list (get@ #///.sources profile))) - (..singular "--target" cache-directory) - (..singular "--module" program-module)))]) + (..plural "--source" (set.to_list (get@ #///.sources profile))) + (..singular "--target" cache_directory) + (..singular "--module" program_module)))]) exit (!.use (\ process await) []) - _ (console.write-line (if (i.= shell.normal exit) + _ (console.write_line (if (i.= shell.normal exit) ..success ..failure) console)] (wrap [compiler - (format cache-directory / output)]))))) + (format cache_directory / output)]))))) diff --git a/stdlib/source/program/aedifex/command/clean.lux b/stdlib/source/program/aedifex/command/clean.lux index 7f942fc00..900de2cc4 100644 --- a/stdlib/source/program/aedifex/command/clean.lux +++ b/stdlib/source/program/aedifex/command/clean.lux @@ -16,7 +16,7 @@ ["#" profile] ["#." action (#+ Action)]]) -(def: (clean-files! root) +(def: (clean_files! root) (-> (Directory Promise) (Promise (Try Any))) (do {! ///action.monad} [nodes (: (Promise (Try (List (File Promise)))) @@ -41,12 +41,12 @@ (!.use (\ fs directory) target)) _ (loop [root target] (do ! - [_ (..clean-files! root) + [_ (..clean_files! root) subs (: (Promise (Try (List (Directory Promise)))) (!.use (\ root directories) [])) _ (monad.map ! recur subs)] (!.use (\ root discard) [])))] - (console.write-line ..success console)) + (console.write_line ..success console)) #.None - (console.write-line ..failure console))) + (console.write_line ..failure console))) diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index 5763c1ff5..1f84567f0 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -47,7 +47,7 @@ (def: epoch Instant - (instant.from-millis +0)) + (instant.from_millis +0)) (template [<name> <type> <uri> <parser> <default>] [(def: (<name> repository artifact) @@ -65,37 +65,37 @@ (#try.Failure error) (wrap (#try.Success <default>)))))] - [read-project-metadata ///metadata/artifact.Metadata ///metadata.project ///metadata/artifact.parser + [read_project_metadata ///metadata/artifact.Metadata ///metadata.project ///metadata/artifact.parser (let [(^slots [#///artifact.group #///artifact.name #///artifact.version]) artifact] {#///metadata/artifact.group group #///metadata/artifact.name name #///metadata/artifact.versions (list) - #///metadata/artifact.last-updated ..epoch})] - [read-version-metadata ///metadata/snapshot.Metadata ///metadata.version ///metadata/snapshot.parser + #///metadata/artifact.last_updated ..epoch})] + [read_version_metadata ///metadata/snapshot.Metadata ///metadata.version ///metadata/snapshot.parser (let [(^slots [#///artifact.group #///artifact.name #///artifact.version]) artifact] {#///metadata/snapshot.group group #///metadata/snapshot.name name #///metadata/snapshot.version version - #///metadata/snapshot.versioning {#///metadata/snapshot.time-stamp ..epoch + #///metadata/snapshot.versioning {#///metadata/snapshot.time_stamp ..epoch #///metadata/snapshot.build 0 #///metadata/snapshot.snapshot (list)}})] ) -(def: snapshot-artifacts +(def: snapshot_artifacts (List ///artifact/type.Type) (list ///artifact/type.pom (format ///artifact/type.pom ///artifact/extension.sha-1) (format ///artifact/type.pom ///artifact/extension.md5) - ///artifact/type.lux-library - (format ///artifact/type.lux-library ///artifact/extension.sha-1) - (format ///artifact/type.lux-library ///artifact/extension.md5))) + ///artifact/type.lux_library + (format ///artifact/type.lux_library ///artifact/extension.sha-1) + (format ///artifact/type.lux_library ///artifact/extension.md5))) (def: #export (do! console repository fs artifact profile) (-> (Console Promise) (Repository Promise) (file.System Promise) Artifact (Command Any)) (let [deploy! (: (-> Extension Binary (Action Any)) (|>> (///repository.uri artifact) (\ repository upload))) - fully-deploy! (: (-> Extension Binary (Action Any)) + fully_deploy! (: (-> Extension Binary (Action Any)) (function (_ extension payload) (do ///action.monad [_ (deploy! extension payload) @@ -108,31 +108,31 @@ (do promise.monad [now (promise.future instant.now)] (do {! ///action.monad} - [project (..read-project-metadata repository artifact) - snapshot (..read-version-metadata repository artifact) + [project (..read_project_metadata repository artifact) + snapshot (..read_version_metadata repository artifact) pom (\ ! map (|>> (\ xml.codec encode) (\ encoding.utf8 encode)) (promise\wrap (///pom.write profile))) library (|> profile (get@ #/.sources) - set.to-list + set.to_list (export.library fs) (\ ! map (binary.run tar.writer))) - _ (fully-deploy! ///artifact/extension.pom pom) - _ (fully-deploy! ///artifact/extension.lux-library library) + _ (fully_deploy! ///artifact/extension.pom pom) + _ (fully_deploy! ///artifact/extension.lux_library library) _ (|> snapshot - (set@ [#///metadata/snapshot.versioning #///metadata/snapshot.time-stamp] now) + (set@ [#///metadata/snapshot.versioning #///metadata/snapshot.time_stamp] now) (update@ [#///metadata/snapshot.versioning #///metadata/snapshot.build] inc) - (set@ [#///metadata/snapshot.versioning #///metadata/snapshot.snapshot] ..snapshot-artifacts) + (set@ [#///metadata/snapshot.versioning #///metadata/snapshot.snapshot] ..snapshot_artifacts) ///metadata/snapshot.write (\ xml.codec encode) (\ encoding.utf8 encode) (\ repository upload (///metadata.version artifact))) _ (|> project (set@ #///metadata/artifact.versions (list version)) - (set@ #///metadata/artifact.last-updated now) + (set@ #///metadata/artifact.last_updated now) ///metadata/artifact.write (\ xml.codec encode) (\ encoding.utf8 encode) (\ repository upload (///metadata.project artifact)))] - (console.write-line //clean.success console))))) + (console.write_line //clean.success console))))) diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index dbb277948..315c6375c 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -27,9 +27,9 @@ (def: #export (do! program console fs repositories profile) (-> (Program Promise) (Console Promise) (file.System Promise) (List (Repository Promise)) (Command Resolution)) (do ///action.monad - [#let [dependencies (set.to-list (get@ #///.dependencies profile))] - cache (///cache.read-all program fs dependencies ///dependency/resolution.empty) + [#let [dependencies (set.to_list (get@ #///.dependencies profile))] + cache (///cache.read_all program fs dependencies ///dependency/resolution.empty) resolution (///dependency/resolution.all repositories dependencies cache) - cached (///cache.write-all program fs resolution) - _ (console.write-line //clean.success console)] + cached (///cache.write_all program fs resolution) + _ (console.write_line //clean.success console)] (wrap resolution))) diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 67dc242ac..033b41b40 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -42,8 +42,8 @@ (-> (file.System Promise) Binary Path (Promise (Try Any))) (do (try.with promise.monad) [file (: (Promise (Try (File Promise))) - (file.get-file promise.monad system file))] - (!.use (\ file over-write) [content]))) + (file.get_file promise.monad system file))] + (!.use (\ file over_write) [content]))) (def: #export failure "Failure: No 'identity' defined for the project.") @@ -55,16 +55,16 @@ (do promise.monad [home (\ program home [])] (do ///action.monad - [package (export.library system (set.to-list (get@ #/.sources profile))) + [package (export.library system (set.to_list (get@ #/.sources profile))) repository (: (Promise (Try Path)) - (file.make-directories promise.monad system (///local.path system home identity))) - #let [artifact-name (format repository (\ system separator) (///artifact.identity identity))] + (file.make_directories promise.monad system (///local.path system home identity))) + #let [artifact_name (format repository (\ system separator) (///artifact.identity identity))] _ (..save! system (binary.run tar.writer package) - (format artifact-name ///artifact/extension.lux-library)) + (format artifact_name ///artifact/extension.lux_library)) pom (\ promise.monad wrap (///pom.write profile)) _ (..save! system (|> pom (\ xml.codec encode) (\ encoding.utf8 encode)) - (format artifact-name ///artifact/extension.pom))] - (console.write-line //clean.success console))) + (format artifact_name ///artifact/extension.pom))] + (console.write_line //clean.success console))) _ - (console.write-line ..failure console))) + (console.write_line ..failure console))) diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux index 618c6b4b9..390d7d7d2 100644 --- a/stdlib/source/program/aedifex/command/pom.lux +++ b/stdlib/source/program/aedifex/command/pom.lux @@ -29,10 +29,10 @@ (do ///action.monad [pom (promise\wrap (///pom.write profile)) file (: (Promise (Try (File Promise))) - (file.get-file promise.monad fs ///pom.file)) + (file.get_file promise.monad fs ///pom.file)) outcome (|> pom (\ xml.codec encode) (\ encoding.utf8 encode) - (!.use (\ file over-write))) - _ (console.write-line //clean.success console)] + (!.use (\ file over_write))) + _ (console.write_line //clean.success console)] (wrap ///pom.file))) diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 089417b94..2727fc461 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -34,19 +34,19 @@ (-> (Console Promise) (Program Promise) (file.System Promise) (Shell Promise) Resolution (Command Any)) (do promise.monad [environment (\ program environment []) - working-directory (\ program directory [])] + working_directory (\ program directory [])] (do ///action.monad [[compiler program] (//build.do! console program fs shell resolution profile) - _ (console.write-line ..start console) + _ (console.write_line ..start console) process (!.use (\ shell execute) [environment - working-directory + working_directory (case compiler (#//build.JVM artifact) (///runtime.java program) (#//build.JS artifact) (///runtime.node program)) (list)]) exit (!.use (\ process await) []) - _ (console.write-line (if (i.= shell.normal exit) + _ (console.write_line (if (i.= shell.normal exit) ..success ..failure) console)] diff --git a/stdlib/source/program/aedifex/command/version.lux b/stdlib/source/program/aedifex/command/version.lux index 076d2a71d..be40d54eb 100644 --- a/stdlib/source/program/aedifex/command/version.lux +++ b/stdlib/source/program/aedifex/command/version.lux @@ -16,5 +16,5 @@ (def: #export (do! console profile) (-> (Console Promise) (Command Any)) - (console.write-line (version.format language/lux.version) + (console.write_line (version.format language/lux.version) console)) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index f49d1da56..11c3cd057 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -48,11 +48,11 @@ ["Extension" (%.text extension)] ["Hash" (%.text hash)]))] - [sha-1-does-not-match] - [md5-does-not-match] + [sha-1_does_not_match] + [md5_does_not_match] ) -(def: (verified-hash library repository artifact extension hash codec exception) +(def: (verified_hash library repository artifact extension hash codec exception) (All [h] (-> Binary (Repository Promise) Artifact Extension (-> Binary (Hash h)) (Codec Text (Hash h)) @@ -72,12 +72,12 @@ (-> (Repository Promise) Artifact Extension (Promise (Try [Binary Status]))) (do (try.with promise.monad) [data (\ repository download (///repository.uri artifact extension)) - sha-1 (..verified-hash data + sha-1 (..verified_hash data repository artifact (format extension ///artifact/extension.sha-1) - ///hash.sha-1 ///hash.sha-1-codec ..sha-1-does-not-match) - md5 (..verified-hash data + ///hash.sha-1 ///hash.sha-1_codec ..sha-1_does_not_match) + md5 (..verified_hash data repository artifact (format extension ///artifact/extension.md5) - ///hash.md5 ///hash.md5-codec ..md5-does-not-match)] + ///hash.md5 ///hash.md5_codec ..md5_does_not_match)] (wrap [data (#//status.Verified sha-1 md5)]))) (def: #export (one repository dependency) @@ -85,16 +85,16 @@ (let [[artifact type] dependency extension (///artifact/extension.extension type)] (do (try.with promise.monad) - [[pom pom-status] (..hashed repository artifact ///artifact/extension.pom) - library-&-status (..hashed repository artifact extension)] + [[pom pom_status] (..hashed repository artifact ///artifact/extension.pom) + library_&_status (..hashed repository artifact extension)] (\ promise.monad wrap (do try.monad [pom (\ encoding.utf8 decode pom) pom (\ xml.codec decode pom) profile (<xml>.run ///pom.parser pom)] (wrap {#///package.origin #///package.Remote - #///package.library library-&-status - #///package.pom [pom pom-status]})))))) + #///package.library library_&_status + #///package.pom [pom pom_status]})))))) (type: #export Resolution (Dictionary Dependency Package)) @@ -107,7 +107,7 @@ (Equivalence Resolution) (dictionary.equivalence ///package.equivalence)) -(exception: #export (cannot-resolve {dependency Dependency}) +(exception: #export (cannot_resolve {dependency Dependency}) (exception.report ["Artifact" (%.text (///artifact.format (get@ #//.artifact dependency)))] ["Type" (%.text (get@ #//.type dependency))])) @@ -117,7 +117,7 @@ (case repositories #.Nil (|> dependency - (exception.throw ..cannot-resolve) + (exception.throw ..cannot_resolve) (\ promise.monad wrap)) (#.Cons repository alternatives) @@ -144,8 +144,8 @@ #.None (..any repositories head)) - sub-dependencies (\ promise.monad wrap (///package.dependencies package)) + sub_dependencies (\ promise.monad wrap (///package.dependencies package)) resolution (|> resolution (dictionary.put head package) - (all repositories (set.to-list sub-dependencies)))] + (all repositories (set.to_list sub_dependencies)))] (all repositories tail resolution)))) diff --git a/stdlib/source/program/aedifex/dependency/status.lux b/stdlib/source/program/aedifex/dependency/status.lux index fa62f643e..bedaffdb8 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -14,7 +14,7 @@ (Hash MD5))) (#Verified (Hash SHA-1) (Hash MD5))) -(structure: any-equivalence +(structure: any_equivalence (Equivalence Any) (def: (= _ _) @@ -23,7 +23,7 @@ (def: #export equivalence (Equivalence Status) ($_ sum.equivalence - ..any-equivalence + ..any_equivalence ($_ sum.equivalence ///hash.equivalence ///hash.equivalence diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index b5d6571be..d42333fd9 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -57,14 +57,14 @@ (Format Aggregate) (|>> dictionary.entries (list\map (function (_ [key value]) - [(code.local-tag key) value])) + [(code.local_tag key) value])) code.record)) (def: empty Aggregate (dictionary.new text.hash)) -(def: (on-maybe field value format aggregate) +(def: (on_maybe field value format aggregate) (All [a] (-> Text (Maybe a) (Format a) Aggregate Aggregate)) (case value @@ -74,7 +74,7 @@ (#.Some value) (dictionary.put field (format value) aggregate))) -(def: (on-list field value format aggregate) +(def: (on_list field value format aggregate) (All [a] (-> Text (List a) (Format a) Aggregate Aggregate)) (case value @@ -84,12 +84,12 @@ value (dictionary.put field (` [(~+ (list\map format value))]) aggregate))) -(def: (on-set field value format aggregate) +(def: (on_set field value format aggregate) (All [a] (-> Text (Set a) (Format a) Aggregate Aggregate)) - (..on-list field (set.to-list value) format aggregate)) + (..on_list field (set.to_list value) format aggregate)) -(def: (on-dictionary field value key-format value-format aggregate) +(def: (on_dictionary field value key_format value_format aggregate) (All [k v] (-> Text (Dictionary k v) (Format k) (Format v) Aggregate Aggregate)) (if (dictionary.empty? value) @@ -98,20 +98,20 @@ (|> value dictionary.entries (list\map (function (_ [key value]) - [(key-format key) (value-format value)])) + [(key_format key) (value_format value)])) code.record) aggregate))) (def: (info value) (Format /.Info) (|> ..empty - (..on-maybe "url" (get@ #/.url value) code.text) - (..on-maybe "scm" (get@ #/.scm value) code.text) - (..on-maybe "description" (get@ #/.description value) code.text) - (..on-list "licenses" (get@ #/.licenses value) ..license) - (..on-maybe "organization" (get@ #/.organization value) ..organization) - (..on-list "developers" (get@ #/.developers value) ..developer) - (..on-list "contributors" (get@ #/.contributors value) ..contributor) + (..on_maybe "url" (get@ #/.url value) code.text) + (..on_maybe "scm" (get@ #/.scm value) code.text) + (..on_maybe "description" (get@ #/.description value) code.text) + (..on_list "licenses" (get@ #/.licenses value) ..license) + (..on_maybe "organization" (get@ #/.organization value) ..organization) + (..on_list "developers" (get@ #/.developers value) ..developer) + (..on_list "contributors" (get@ #/.contributors value) ..contributor) ..aggregate)) (def: (artifact' [group name version]) @@ -126,7 +126,7 @@ (def: (dependency [artifact type]) (Format Dependency) - (if (text\= //artifact/type.lux-library type) + (if (text\= //artifact/type.lux_library type) (` [(~+ (..artifact' artifact))]) (` [(~+ (..artifact' artifact)) (~ (code.text type))]))) @@ -134,16 +134,16 @@ (def: #export (profile value) (Format /.Profile) (|> ..empty - (..on-list "parents" (get@ #/.parents value) code.text) - (..on-maybe "identity" (get@ #/.identity value) ..artifact) - (..on-maybe "info" (get@ #/.info value) ..info) - (..on-set "repositories" (get@ #/.repositories value) code.text) - (..on-set "dependencies" (get@ #/.dependencies value) ..dependency) - (..on-set "sources" (get@ #/.sources value) code.text) - (..on-maybe "target" (get@ #/.target value) code.text) - (..on-maybe "program" (get@ #/.program value) code.text) - (..on-maybe "test" (get@ #/.test value) code.text) - (..on-dictionary "deploy-repositories" (get@ #/.deploy-repositories value) code.text code.text) + (..on_list "parents" (get@ #/.parents value) code.text) + (..on_maybe "identity" (get@ #/.identity value) ..artifact) + (..on_maybe "info" (get@ #/.info value) ..info) + (..on_set "repositories" (get@ #/.repositories value) code.text) + (..on_set "dependencies" (get@ #/.dependencies value) ..dependency) + (..on_set "sources" (get@ #/.sources value) code.text) + (..on_maybe "target" (get@ #/.target value) code.text) + (..on_maybe "program" (get@ #/.program value) code.text) + (..on_maybe "test" (get@ #/.test value) code.text) + (..on_dictionary "deploy-repositories" (get@ #/.deploy_repositories value) code.text code.text) ..aggregate)) (def: #export project diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 74d965f8c..2c0c6df25 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -69,13 +69,13 @@ [16 md5::size] ) - (def: hex-per-byte + (def: hex_per_byte 2) - (def: hex-per-chunk - (n.* hex-per-byte i64.bytes-per-i64)) + (def: hex_per_chunk + (n.* hex_per_byte i64.bytes_per_i64)) - (exception: #export (not-a-hash {size Nat} {value Text}) + (exception: #export (not_a_hash {size Nat} {value Text}) (exception.report ["Pseudo hash" (%.text value)] ["Expected size" (%.nat size)] @@ -88,8 +88,8 @@ ["Expected size" (%.nat <size>)] ["Actual size" (%.nat (binary.size data))]))] - [not-a-sha-1 ..sha-1::size] - [not-a-md5 ..md5::size] + [not_a_sha-1 ..sha-1::size] + [not_a_md5 ..md5::size] ) (template [<name> <kind> <size> <exception>] @@ -99,29 +99,29 @@ (#try.Success (:abstraction data)) (exception.throw <exception> [data])))] - [as-sha-1 SHA-1 ..sha-1::size ..not-a-sha-1] - [as-md5 MD5 ..md5::size ..not-a-md5] + [as_sha-1 SHA-1 ..sha-1::size ..not_a_sha-1] + [as_md5 MD5 ..md5::size ..not_a_md5] ) - (def: hash-size + (def: hash_size (-> Text Nat) - (|>> text.size (n./ ..hex-per-byte))) + (|>> text.size (n./ ..hex_per_byte))) - (def: encoding-size + (def: encoding_size (-> Nat Nat) - (n.* ..hex-per-byte)) + (n.* ..hex_per_byte)) (def: (decode size constructor encoded) (All [h] (-> Nat (-> Binary (Try (Hash h))) (-> Text (Try (Hash h))))) - (let [hash-size (..hash-size encoded)] - (if (n.= size hash-size) + (let [hash_size (..hash_size encoded)] + (if (n.= size hash_size) (loop [input encoded chunk 0 - output (binary.create hash-size)] - (let [index (n.* chunk i64.bytes-per-i64)] - (case (text.split ..hex-per-chunk input) + output (binary.create hash_size)] + (let [index (n.* chunk i64.bytes_per_i64)] + (case (text.split ..hex_per_chunk input) (#.Some [head tail]) (do try.monad [head (\ n.hex decode head) @@ -129,7 +129,7 @@ (recur tail (inc chunk) output)) #.None - (case (..hash-size input) + (case (..hash_size input) 0 (constructor output) (^template [<size> <write>] [<size> @@ -140,8 +140,8 @@ ([1 binary.write/8] [2 binary.write/16] [4 binary.write/32]) - _ (exception.throw ..not-a-hash [(..encoding-size size) encoded]))))) - (exception.throw ..not-a-hash [(..encoding-size size) encoded])))) + _ (exception.throw ..not_a_hash [(..encoding_size size) encoded]))))) + (exception.throw ..not_a_hash [(..encoding_size size) encoded])))) (template [<codec> <hash> <nat> <constructor>] [(structure: #export <codec> @@ -150,8 +150,8 @@ (def: encode (|>> :representation ..encode)) (def: decode (..decode <nat> <constructor>)))] - [sha-1-codec SHA-1 ..sha-1::size ..as-sha-1] - [md5-codec MD5 ..md5::size ..as-md5] + [sha-1_codec SHA-1 ..sha-1::size ..as_sha-1] + [md5_codec MD5 ..md5::size ..as_md5] ) (structure: #export equivalence diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 623346237..11e648697 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -28,32 +28,32 @@ ["#." project (#+ Project)] ["#." parser]]) -(def: (parse-lux source-code) +(def: (parse_lux source_code) (-> Text (Try Code)) (let [parse (syntax.parse "" - syntax.no-aliases - (text.size source-code))] - (case (parse [location.dummy 0 source-code]) + syntax.no_aliases + (text.size source_code))] + (case (parse [location.dummy 0 source_code]) (#.Left [_ error]) (#try.Failure error) - (#.Right [_ lux-code]) - (#try.Success lux-code)))) + (#.Right [_ lux_code]) + (#try.Success lux_code)))) -(def: parse-project +(def: parse_project (-> Binary (Try Project)) (|>> (do> try.monad [(\ encoding.utf8 decode)] - [..parse-lux] + [..parse_lux] [(list) (<c>.run //parser.project)]))) (def: #export (read monad fs profile) (All [!] (-> (Monad !) (file.System !) Text (! (Try Profile)))) (do (try.with monad) - [project-file (!.use (\ fs file) //project.file) - project-file (!.use (\ project-file content) [])] + [project_file (!.use (\ fs file) //project.file) + project_file (!.use (\ project_file content) [])] (\ monad wrap - (|> project-file + (|> project_file (do> try.monad - [..parse-project] + [..parse_project] [(//project.profile profile)]))))) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index aa7b9abce..cf9a34b58 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -29,7 +29,7 @@ {#group Group #name Name #versions (List Version) - #last-updated Instant}) + #last_updated Instant}) (def: (pad value) (-> Nat Text) @@ -37,23 +37,23 @@ (format "0" (%.nat value)) (%.nat value))) -(def: (date-format value) +(def: (date_format value) (%.Format Date) (format (|> value date.year year.value .nat %.nat) (|> value date.month month.number ..pad) - (|> value date.day-of-month ..pad))) + (|> value date.day_of_month ..pad))) -(def: (time-format value) +(def: (time_format value) (%.Format Time) (let [(^slots [#time.hour #time.minute #time.second]) (time.clock value)] (format (..pad hour) (..pad minute) (..pad second)))) -(def: (instant-format value) +(def: (instant_format value) (%.Format Instant) - (format (..date-format (instant.date value)) - (..time-format (instant.time value)))) + (format (..date_format (instant.date value)) + (..time_format (instant.time value)))) (template [<definition> <tag>] [(def: <definition> xml.Tag ["" <tag>])] @@ -63,7 +63,7 @@ [<version> "version"] [<versioning> "versioning"] [<versions> "versions"] - [<last-updated> "lastUpdated"] + [<last_updated> "lastUpdated"] [<metadata> "metadata"] ) @@ -72,26 +72,26 @@ (-> <type> XML) (|>> <pre> #xml.Text list (#xml.Node <tag> xml.attributes)))] - [write-group Group ..<group> (|>)] - [write-name Name ..<name> (|>)] - [write-version Version ..<version> (|>)] - [write-last-updated Instant ..<last-updated> ..instant-format] + [write_group Group ..<group> (|>)] + [write_name Name ..<name> (|>)] + [write_version Version ..<version> (|>)] + [write_last_updated Instant ..<last_updated> ..instant_format] ) -(def: write-versions +(def: write_versions (-> (List Version) XML) - (|>> (list\map ..write-version) (#xml.Node ..<versions> xml.attributes))) + (|>> (list\map ..write_version) (#xml.Node ..<versions> xml.attributes))) (def: #export (write value) (-> Metadata XML) (#xml.Node ..<metadata> xml.attributes - (list (..write-group (get@ #group value)) - (..write-name (get@ #name value)) + (list (..write_group (get@ #group value)) + (..write_name (get@ #name value)) (#xml.Node ..<versioning> xml.attributes - (list (..write-versions (get@ #versions value)) - (..write-last-updated (get@ #last-updated value))))))) + (list (..write_versions (get@ #versions value)) + (..write_last_updated (get@ #last_updated value))))))) (def: (sub tag parser) (All [a] (-> xml.Tag (Parser a) (Parser a))) @@ -103,17 +103,17 @@ (-> xml.Tag (Parser Text)) (..sub tag <xml>.text)) -(def: date-parser +(def: date_parser (<text>.Parser Date) (do <>.monad [year (<>.codec n.decimal (<text>.exactly 4 <text>.decimal)) year (<>.lift (year.year (.int year))) month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) - month (<>.lift (month.by-number month)) - day-of-month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))] - (<>.lift (date.date year month day-of-month)))) + month (<>.lift (month.by_number month)) + day_of_month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))] + (<>.lift (date.date year month day_of_month)))) -(def: time-parser +(def: time_parser (<text>.Parser Time) (do <>.monad [hour (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) @@ -123,15 +123,15 @@ {#time.hour hour #time.minute minute #time.second second - #time.milli-second 0})))) + #time.milli_second 0})))) -(def: last-updated-parser +(def: last_updated_parser (Parser Instant) (<text>.embed (do <>.monad - [date ..date-parser - time ..time-parser] - (wrap (instant.from-date-time date time))) - (..text ..<last-updated>))) + [date ..date_parser + time ..time_parser] + (wrap (instant.from_date_time date time))) + (..text ..<last_updated>))) (def: #export parser (Parser Metadata) @@ -144,7 +144,7 @@ (<| <xml>.somewhere (..sub ..<versions>) (<>.many (..text ..<version>))) - (<xml>.somewhere ..last-updated-parser) + (<xml>.somewhere ..last_updated_parser) )) ))) diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index 1919d06ca..ea6ce4719 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -30,19 +30,19 @@ (def: snapshot "SNAPSHOT") -(type: #export Time-Stamp +(type: #export Time_Stamp Instant) (type: #export Build Nat) (type: #export Versioning - {#time-stamp Time-Stamp + {#time_stamp Time_Stamp #build Build #snapshot (List Type)}) (type: #export Value - [Version Time-Stamp Build]) + [Version Time_Stamp Build]) (type: #export Metadata {#group Group @@ -56,44 +56,44 @@ (format "0" (%.nat value)) (%.nat value))) -(def: (date-format value) +(def: (date_format value) (%.Format Date) (format (|> value date.year year.value .nat %.nat) (|> value date.month month.number ..pad) - (|> value date.day-of-month ..pad))) + (|> value date.day_of_month ..pad))) -(def: (time-format value) +(def: (time_format value) (%.Format Time) (let [(^slots [#time.hour #time.minute #time.second]) (time.clock value)] (format (..pad hour) (..pad minute) (..pad second)))) -(def: (instant-format value) +(def: (instant_format value) (%.Format Instant) - (format (..date-format (instant.date value)) - (..time-format (instant.time value)))) + (format (..date_format (instant.date value)) + (..time_format (instant.time value)))) (template [<separator> <name>] [(def: <name> <separator>)] - ["." time-stamp-separator] - ["-" value-separator] + ["." time_stamp_separator] + ["-" value_separator] ) -(def: (time-stamp-format value) - (%.Format Time-Stamp) - (format (..date-format (instant.date value)) - ..time-stamp-separator - (..time-format (instant.time value)))) +(def: (time_stamp_format value) + (%.Format Time_Stamp) + (format (..date_format (instant.date value)) + ..time_stamp_separator + (..time_format (instant.time value)))) -(def: (value-format [version time-stamp build]) +(def: (value_format [version time_stamp build]) (%.Format Value) - (format (text.replace-all ..snapshot - (..time-stamp-format time-stamp) + (format (text.replace_all ..snapshot + (..time_stamp_format time_stamp) version) - ..value-separator + ..value_separator (%.nat build))) (template [<definition> <tag>] @@ -102,14 +102,14 @@ [<group> "groupId"] [<name> "artifactId"] [<version> "version"] - [<last-updated> "lastUpdated"] + [<last_updated> "lastUpdated"] [<metadata> "metadata"] [<versioning> "versioning"] [<snapshot> "snapshot"] [<timestamp> "timestamp"] - [<build-number> "buildNumber"] - [<snapshot-versions> "snapshotVersions"] - [<snapshot-version> "snapshotVersion"] + [<build_number> "buildNumber"] + [<snapshot_versions> "snapshotVersions"] + [<snapshot_version> "snapshotVersion"] [<extension> "extension"] [<value> "value"] [<updated> "updated"] @@ -120,44 +120,44 @@ (-> <type> XML) (|>> <pre> #xml.Text list (#xml.Node <tag> xml.attributes)))] - [write-group Group ..<group> (|>)] - [write-name Name ..<name> (|>)] - [write-version Version ..<version> (|>)] - [write-last-updated Instant ..<last-updated> ..instant-format] - [write-time-stamp Instant ..<timestamp> ..time-stamp-format] - [write-build-number Nat ..<build-number> %.nat] - [write-extension Type ..<extension> (|>)] - [write-value Value ..<value> ..value-format] - [write-updated Instant ..<updated> ..instant-format] + [write_group Group ..<group> (|>)] + [write_name Name ..<name> (|>)] + [write_version Version ..<version> (|>)] + [write_last_updated Instant ..<last_updated> ..instant_format] + [write_time_stamp Instant ..<timestamp> ..time_stamp_format] + [write_build_number Nat ..<build_number> %.nat] + [write_extension Type ..<extension> (|>)] + [write_value Value ..<value> ..value_format] + [write_updated Instant ..<updated> ..instant_format] ) -(def: (write-snapshot value type) +(def: (write_snapshot value type) (-> Value Type XML) - (<| (#xml.Node ..<snapshot-version> xml.attributes) - (list (..write-extension type) - (..write-value value) - (let [[version time-stamp build] value] - (..write-updated time-stamp))))) + (<| (#xml.Node ..<snapshot_version> xml.attributes) + (list (..write_extension type) + (..write_value value) + (let [[version time_stamp build] value] + (..write_updated time_stamp))))) -(def: (write-versioning version (^slots [#time-stamp #build #snapshot])) +(def: (write_versioning version (^slots [#time_stamp #build #snapshot])) (-> Version Versioning XML) (<| (#xml.Node ..<versioning> xml.attributes) (list (<| (#xml.Node ..<snapshot> xml.attributes) - (list (..write-time-stamp time-stamp) - (..write-build-number build))) - (..write-last-updated time-stamp) - (<| (#xml.Node ..<snapshot-versions> xml.attributes) - (list\map (..write-snapshot [version time-stamp build]) + (list (..write_time_stamp time_stamp) + (..write_build_number build))) + (..write_last_updated time_stamp) + (<| (#xml.Node ..<snapshot_versions> xml.attributes) + (list\map (..write_snapshot [version time_stamp build]) snapshot))))) (def: #export (write (^slots [#group #name #version #versioning])) (-> Metadata XML) (#xml.Node ..<metadata> xml.attributes - (list (..write-group group) - (..write-name name) - (..write-version version) - (..write-versioning version versioning)))) + (list (..write_group group) + (..write_name name) + (..write_version version) + (..write_versioning version versioning)))) (def: (sub tag parser) (All [a] (-> xml.Tag (Parser a) (Parser a))) @@ -169,17 +169,17 @@ (-> xml.Tag (Parser Text)) (..sub tag <xml>.text)) -(def: date-parser +(def: date_parser (<text>.Parser Date) (do <>.monad [year (<>.codec n.decimal (<text>.exactly 4 <text>.decimal)) year (<>.lift (year.year (.int year))) month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) - month (<>.lift (month.by-number month)) - day-of-month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))] - (<>.lift (date.date year month day-of-month)))) + month (<>.lift (month.by_number month)) + day_of_month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))] + (<>.lift (date.date year month day_of_month)))) -(def: time-parser +(def: time_parser (<text>.Parser Time) (do <>.monad [hour (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) @@ -189,69 +189,69 @@ {#time.hour hour #time.minute minute #time.second second - #time.milli-second 0})))) + #time.milli_second 0})))) -(def: last-updated-parser +(def: last_updated_parser (Parser Instant) (<text>.embed (do <>.monad - [date ..date-parser - time ..time-parser] - (wrap (instant.from-date-time date time))) - (..text ..<last-updated>))) + [date ..date_parser + time ..time_parser] + (wrap (instant.from_date_time date time))) + (..text ..<last_updated>))) -(def: time-stamp-parser - (Parser Time-Stamp) +(def: time_stamp_parser + (Parser Time_Stamp) (<text>.embed (do <>.monad - [date ..date-parser - _ (<text>.this ..time-stamp-separator) - time ..time-parser] - (wrap (instant.from-date-time date time))) + [date ..date_parser + _ (<text>.this ..time_stamp_separator) + time ..time_parser] + (wrap (instant.from_date_time date time))) (..text ..<timestamp>))) -(def: build-parser +(def: build_parser (Parser Build) (<text>.embed (<>.codec n.decimal (<text>.many <text>.decimal)) - (..text ..<build-number>))) + (..text ..<build_number>))) -(exception: #export (time-stamp-mismatch {expected Time-Stamp} {actual Text}) +(exception: #export (time_stamp_mismatch {expected Time_Stamp} {actual Text}) (exception.report - ["Expected time-stamp" (instant-format expected)] + ["Expected time-stamp" (instant_format expected)] ["Actual time-stamp" actual])) -(exception: #export (value-mismatch {expected Value} {actual Text}) +(exception: #export (value_mismatch {expected Value} {actual Text}) (exception.report - ["Expected" (..value-format expected)] + ["Expected" (..value_format expected)] ["Actual" actual])) -(def: (snapshot-parser expected) +(def: (snapshot_parser expected) (-> Value (Parser Type)) - (<| (..sub ..<snapshot-version>) + (<| (..sub ..<snapshot_version>) (do <>.monad - [#let [[version time-stamp build] expected] + [#let [[version time_stamp build] expected] updated (<xml>.somewhere (..text ..<updated>)) - _ (<>.assert (exception.construct ..time-stamp-mismatch [time-stamp updated]) - (\ text.equivalence = (instant-format time-stamp) updated)) + _ (<>.assert (exception.construct ..time_stamp_mismatch [time_stamp updated]) + (\ text.equivalence = (instant_format time_stamp) updated)) actual (<xml>.somewhere (..text ..<value>)) - _ (<>.assert (exception.construct ..value-mismatch [expected actual]) - (\ text.equivalence = (..value-format expected) actual))] + _ (<>.assert (exception.construct ..value_mismatch [expected actual]) + (\ text.equivalence = (..value_format expected) actual))] (<xml>.somewhere (..text ..<extension>))))) -(def: (versioning-parser version) +(def: (versioning_parser version) (-> Version (Parser Versioning)) (<| (..sub ..<versioning>) (do <>.monad - [[time-stamp build] (<| <xml>.somewhere + [[time_stamp build] (<| <xml>.somewhere (..sub ..<snapshot>) - (<>.and (<xml>.somewhere ..time-stamp-parser) - (<xml>.somewhere ..build-parser))) - last-updated (<xml>.somewhere ..last-updated-parser) - _ (<>.assert (exception.construct ..time-stamp-mismatch [time-stamp (instant-format last-updated)]) - (\ instant.equivalence = time-stamp last-updated)) + (<>.and (<xml>.somewhere ..time_stamp_parser) + (<xml>.somewhere ..build_parser))) + last_updated (<xml>.somewhere ..last_updated_parser) + _ (<>.assert (exception.construct ..time_stamp_mismatch [time_stamp (instant_format last_updated)]) + (\ instant.equivalence = time_stamp last_updated)) snapshot (<| <xml>.somewhere - (..sub ..<snapshot-versions>) - (<>.some (..snapshot-parser [version time-stamp build])))] - (wrap {#time-stamp time-stamp + (..sub ..<snapshot_versions>) + (<>.some (..snapshot_parser [version time_stamp build])))] + (wrap {#time_stamp time_stamp #build build #snapshot snapshot})))) @@ -262,13 +262,13 @@ [group (<xml>.somewhere (..text ..<group>)) name (<xml>.somewhere (..text ..<name>)) version (<xml>.somewhere (..text ..<version>)) - versioning (<xml>.somewhere (..versioning-parser version))] + versioning (<xml>.somewhere (..versioning_parser version))] (wrap {#group group #name name #version version #versioning versioning})))) -(def: versioning-equivalence +(def: versioning_equivalence (Equivalence Versioning) ($_ product.equivalence instant.equivalence @@ -282,5 +282,5 @@ text.equivalence text.equivalence text.equivalence - ..versioning-equivalence + ..versioning_equivalence )) diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux index 03f2c3994..b3118a7e0 100644 --- a/stdlib/source/program/aedifex/package.lux +++ b/stdlib/source/program/aedifex/package.lux @@ -25,17 +25,17 @@ #Local #Remote) -(structure: any-equivalence +(structure: any_equivalence (Equivalence Any) (def: (= _ _) true)) -(def: origin-equivalence +(def: origin_equivalence (Equivalence Origin) ($_ sum.equivalence - ..any-equivalence - ..any-equivalence + ..any_equivalence + ..any_equivalence )) (type: #export Package @@ -46,7 +46,7 @@ (template [<name> <tag>] [(def: #export <name> (-> Package Bit) - (|>> (get@ #origin) (\ ..origin-equivalence = <tag>)))] + (|>> (get@ #origin) (\ ..origin_equivalence = <tag>)))] [local? #Local] [remote? #Remote] @@ -68,7 +68,7 @@ (def: #export equivalence (Equivalence Package) ($_ product.equivalence - ..origin-equivalence + ..origin_equivalence (product.equivalence binary.equivalence //status.equivalence) (product.equivalence xml.equivalence //status.equivalence) )) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 9fdc00f3b..8f95cc6a4 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -25,7 +25,7 @@ ["#." artifact (#+ Artifact) ["#/." type]]]) -(def: (as-input input) +(def: (as_input input) (-> (Maybe Code) (List Code)) (case input (#.Some input) @@ -36,12 +36,12 @@ (def: (singular input tag parser) (All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser a))) - (<c>.local (..as-input (dictionary.get tag input)) + (<c>.local (..as_input (dictionary.get tag input)) parser)) (def: (plural input tag parser) (All [a] (-> (Dictionary Text Code) Text (Parser a) (Parser (List a)))) - (<c>.local (..as-input (dictionary.get tag input)) + (<c>.local (..as_input (dictionary.get tag input)) (<c>.tuple (<>.some parser)))) (def: group @@ -80,8 +80,8 @@ (Parser /.License) (do {! <>.monad} [input (\ ! map - (dictionary.from-list text.hash) - (<c>.record (<>.some (<>.and <c>.local-tag + (dictionary.from_list text.hash) + (<c>.record (<>.some (<>.and <c>.local_tag <c>.any))))] ($_ <>.and (..singular input "name" ..name) @@ -95,8 +95,8 @@ (Parser /.Organization) (do {! <>.monad} [input (\ ! map - (dictionary.from-list text.hash) - (<c>.record (<>.some (<>.and <c>.local-tag + (dictionary.from_list text.hash) + (<c>.record (<>.some (<>.and <c>.local_tag <c>.any))))] ($_ <>.and (..singular input "name" ..name) @@ -106,8 +106,8 @@ (Parser /.Developer) (do {! <>.monad} [input (\ ! map - (dictionary.from-list text.hash) - (<c>.record (<>.some (<>.and <c>.local-tag + (dictionary.from_list text.hash) + (<c>.record (<>.some (<>.and <c>.local_tag <c>.any))))] ($_ <>.and (..singular input "name" ..name) @@ -123,8 +123,8 @@ (Parser /.Info) (do {! <>.monad} [input (\ ! map - (dictionary.from-list text.hash) - (<c>.record (<>.some (<>.and <c>.local-tag + (dictionary.from_list text.hash) + (<c>.record (<>.some (<>.and <c>.local_tag <c>.any))))] ($_ <>.and (<>.maybe (..singular input "url" ..url)) @@ -149,7 +149,7 @@ (<c>.tuple ($_ <>.and ..artifact' - (<>.default //artifact/type.lux-library ..type) + (<>.default //artifact/type.lux_library ..type) ))) (def: source @@ -164,7 +164,7 @@ (Parser Module) <c>.text) -(def: deploy-repository +(def: deploy_repository (Parser (List [Text //repository.Address])) (<c>.record (<>.some (<>.and <c>.text @@ -174,8 +174,8 @@ (Parser /.Profile) (do {! <>.monad} [input (\ ! map - (dictionary.from-list text.hash) - (<c>.record (<>.some (<>.and <c>.local-tag + (dictionary.from_list text.hash) + (<c>.record (<>.some (<>.and <c>.local_tag <c>.any)))) #let [^parents (: (Parser (List /.Name)) (<>.default (list) @@ -188,16 +188,16 @@ (..singular input "info" ..info))) ^repositories (: (Parser (Set //repository.Address)) (|> (..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)) - (<>.default (set.from-list text.hash (list /.default-source))))) + (\ ! map (set.from_list text.hash)) + (<>.default (set.from_list text.hash (list /.default_source))))) ^target (: (Parser (Maybe /.Target)) (<>.maybe (..singular input "target" ..target))) @@ -207,10 +207,10 @@ ^test (: (Parser (Maybe Module)) (<>.maybe (..singular input "test" ..module))) - ^deploy-repositories (: (Parser (Dictionary Text //repository.Address)) - (<| (\ ! map (dictionary.from-list text.hash)) + ^deploy_repositories (: (Parser (Dictionary Text //repository.Address)) + (<| (\ ! map (dictionary.from_list text.hash)) (<>.default (list)) - (..singular input "deploy-repositories" ..deploy-repository)))]] + (..singular input "deploy-repositories" ..deploy_repository)))]] ($_ <>.and ^parents ^identity @@ -221,19 +221,19 @@ ^target ^program ^test - ^deploy-repositories + ^deploy_repositories ))) (def: #export project (Parser Project) - (let [default-profile (: (Parser Project) + (let [default_profile (: (Parser Project) (\ <>.monad map - (|>> [/.default] (list) (dictionary.from-list text.hash)) + (|>> [/.default] (list) (dictionary.from_list text.hash)) ..profile)) - multi-profile (: (Parser Project) + multi_profile (: (Parser Project) (\ <>.monad map - (dictionary.from-list text.hash) + (dictionary.from_list text.hash) (<c>.record (<>.many (<>.and <c>.text ..profile)))))] - (<>.either multi-profile - default-profile))) + (<>.either multi_profile + default_profile))) diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index c7d950092..d1787d07c 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -26,11 +26,11 @@ ## https://maven.apache.org/pom.html -(def: project-tag "project") -(def: dependencies-tag "dependencies") -(def: group-tag "groupId") -(def: artifact-tag "artifactId") -(def: version-tag "version") +(def: project_tag "project") +(def: dependencies_tag "dependencies") +(def: group_tag "groupId") +(def: artifact_tag "artifactId") +(def: version_tag "version") (def: #export file "pom.xml") @@ -48,9 +48,9 @@ (def: (artifact value) (-> Artifact (List XML)) - (list (..property ..group-tag (get@ #//artifact.group value)) - (..property ..artifact-tag (get@ #//artifact.name value)) - (..property ..version-tag (get@ #//artifact.version value)))) + (list (..property ..group_tag (get@ #//artifact.group value)) + (..property ..artifact_tag (get@ #//artifact.name value)) + (..property ..version_tag (get@ #//artifact.version value)))) (def: distribution (-> /.Distribution XML) @@ -95,7 +95,7 @@ (..property "url" url)) (#_.Node ["" "organization"] _.attributes))) - (def: (developer-organization [name url]) + (def: (developer_organization [name url]) (-> /.Organization (List XML)) (list (..property "organization" name) (..property "organizationUrl" url))) @@ -104,7 +104,7 @@ (-> /.Developer (List XML)) (list& (..property "name" name) (..property "email" email) - (|> organization (maybe\map ..developer-organization) (maybe.default (list))))) + (|> organization (maybe\map ..developer_organization) (maybe.default (list))))) (template [<name> <type> <tag>] [(def: <name> @@ -118,11 +118,11 @@ (def: (info value) (-> /.Info (List XML)) ($_ list\compose - (|> value (get@ #/.url) (maybe\map (..property "url")) maybe.to-list) - (|> value (get@ #/.description) (maybe\map (..property "description")) maybe.to-list) + (|> value (get@ #/.url) (maybe\map (..property "url")) maybe.to_list) + (|> value (get@ #/.description) (maybe\map (..property "description")) maybe.to_list) (|> value (get@ #/.licenses) (list\map ..license) (..group "licenses") list) - (|> value (get@ #/.scm) (maybe\map ..scm) maybe.to-list) - (|> value (get@ #/.organization) (maybe\map ..organization) maybe.to-list) + (|> value (get@ #/.scm) (maybe\map ..scm) maybe.to_list) + (|> value (get@ #/.organization) (maybe\map ..organization) maybe.to_list) (|> value (get@ #/.developers) (list\map ..developer) (..group "developers") list) (|> value (get@ #/.contributors) (list\map ..contributor) (..group "contributors") list) )) @@ -133,53 +133,53 @@ (case (get@ #/.identity value) (#.Some identity) (#try.Success - (#_.Node ["" ..project-tag] _.attributes + (#_.Node ["" ..project_tag] _.attributes ($_ list\compose (list ..version) (..artifact identity) - (|> value (get@ #/.repositories) set.to-list (list\map ..repository) (..group "repositories") list) - (|> value (get@ #/.dependencies) set.to-list (list\map ..dependency) (..group ..dependencies-tag) list) + (|> value (get@ #/.repositories) set.to_list (list\map ..repository) (..group "repositories") list) + (|> value (get@ #/.dependencies) set.to_list (list\map ..dependency) (..group ..dependencies_tag) list) ))) _ - (exception.throw /.no-identity []))) + (exception.throw /.no_identity []))) -(def: parse-property +(def: parse_property (Parser [Tag Text]) (<>.and <xml>.tag (<xml>.children <xml>.text))) -(def: parse-dependency +(def: parse_dependency (Parser Dependency) (do {! <>.monad} - [properties (\ ! map (dictionary.from-list name.hash) - (<xml>.children (<>.some ..parse-property)))] + [properties (\ ! map (dictionary.from_list name.hash) + (<xml>.children (<>.some ..parse_property)))] (<| <>.lift - try.from-maybe + try.from_maybe (do maybe.monad - [group (dictionary.get ["" ..group-tag] properties) - artifact (dictionary.get ["" ..artifact-tag] properties) - version (dictionary.get ["" ..version-tag] properties)] + [group (dictionary.get ["" ..group_tag] properties) + artifact (dictionary.get ["" ..artifact_tag] properties) + version (dictionary.get ["" ..version_tag] properties)] (wrap {#//dependency.artifact {#//artifact.group group #//artifact.name artifact #//artifact.version version} #//dependency.type (|> properties (dictionary.get ["" "type"]) - (maybe.default //artifact/type.lux-library))}))))) + (maybe.default //artifact/type.lux_library))}))))) -(def: parse-dependencies +(def: parse_dependencies (Parser (List Dependency)) (do {! <>.monad} - [_ (<xml>.node ["" ..dependencies-tag])] - (<xml>.children (<>.some ..parse-dependency)))) + [_ (<xml>.node ["" ..dependencies_tag])] + (<xml>.children (<>.some ..parse_dependency)))) (def: #export parser (Parser /.Profile) (do {! <>.monad} - [_ (<xml>.node ["" ..project-tag])] + [_ (<xml>.node ["" ..project_tag])] (<xml>.children (do ! - [dependencies (<xml>.somewhere ..parse-dependencies) + [dependencies (<xml>.somewhere ..parse_dependencies) _ (<>.some <xml>.ignore)] (wrap (|> (\ /.monoid identity) (update@ #/.dependencies (function (_ empty) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 9729514f2..adf1b049e 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -30,7 +30,7 @@ #Repo #Manual) -(structure: distribution-equivalence +(structure: distribution_equivalence (Equivalence Distribution) (def: (= reference subject) @@ -49,12 +49,12 @@ URL Distribution]) -(def: license-equivalence +(def: license_equivalence (Equivalence License) ($_ product.equivalence text.equivalence text.equivalence - ..distribution-equivalence)) + ..distribution_equivalence)) (type: #export SCM URL) @@ -63,7 +63,7 @@ [Text URL]) -(def: organization-equivalence +(def: organization_equivalence (Equivalence Organization) ($_ product.equivalence text.equivalence @@ -77,12 +77,12 @@ Email (Maybe Organization)]) -(def: developer-equivalence +(def: developer_equivalence (Equivalence Developer) ($_ product.equivalence text.equivalence text.equivalence - (maybe.equivalence ..organization-equivalence))) + (maybe.equivalence ..organization_equivalence))) (type: #export Contributor Developer) @@ -96,18 +96,18 @@ #developers (List Developer) #contributors (List Contributor)}) -(def: info-equivalence +(def: info_equivalence (Equivalence Info) ($_ product.equivalence (maybe.equivalence text.equivalence) (maybe.equivalence text.equivalence) (maybe.equivalence text.equivalence) - (list.equivalence ..license-equivalence) - (maybe.equivalence ..organization-equivalence) - (list.equivalence ..developer-equivalence) - (list.equivalence ..developer-equivalence))) + (list.equivalence ..license_equivalence) + (maybe.equivalence ..organization_equivalence) + (list.equivalence ..developer_equivalence) + (list.equivalence ..developer_equivalence))) -(def: #export default-info +(def: #export default_info Info {#url #.None #scm #.None @@ -120,14 +120,14 @@ (type: #export Source Path) -(def: #export default-source +(def: #export default_source Source "source") (type: #export Target Path) -(def: #export default-target +(def: #export default_target Target "target") @@ -148,7 +148,7 @@ #target (Maybe Target) #program (Maybe Module) #test (Maybe Module) - #deploy-repositories (Dictionary Text repository.Address)}) + #deploy_repositories (Dictionary Text repository.Address)}) (def: #export equivalence (Equivalence Profile) @@ -158,7 +158,7 @@ ## #identity (maybe.equivalence artifact.equivalence) ## #info - (maybe.equivalence ..info-equivalence) + (maybe.equivalence ..info_equivalence) ## #repositories set.equivalence ## #dependencies @@ -171,7 +171,7 @@ (maybe.equivalence text.equivalence) ## #test (maybe.equivalence text.equivalence) - ## #deploy-repositories + ## #deploy_repositories (dictionary.equivalence text.equivalence))) (structure: #export monoid @@ -187,7 +187,7 @@ #target #.None #program #.None #test #.None - #deploy-repositories (dictionary.new text.hash)}) + #deploy_repositories (dictionary.new text.hash)}) (def: (compose override baseline) {#parents (list\compose (get@ #parents baseline) (get@ #parents override)) @@ -199,6 +199,6 @@ #target (maybe\compose (get@ #target override) (get@ #target baseline)) #program (maybe\compose (get@ #program override) (get@ #program baseline)) #test (maybe\compose (get@ #test override) (get@ #test baseline)) - #deploy-repositories (dictionary.merge (get@ #deploy-repositories override) (get@ #deploy-repositories baseline))})) + #deploy_repositories (dictionary.merge (get@ #deploy_repositories override) (get@ #deploy_repositories baseline))})) -(exception: #export no-identity) +(exception: #export no_identity) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index bd191fffb..5dce87e0a 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -25,7 +25,7 @@ (def: #export (project name profile) (-> Name Profile Project) - (dictionary.from-list text.hash (list [name profile]))) + (dictionary.from_list text.hash (list [name profile]))) (def: #export equivalence (Equivalence Project) @@ -38,13 +38,13 @@ (dictionary.new text.hash)) (def: compose - (dictionary.merge-with (\ //.monoid compose)))) + (dictionary.merge_with (\ //.monoid compose)))) -(exception: #export (unknown-profile {name Name}) +(exception: #export (unknown_profile {name Name}) (exception.report ["Name" (%.text name)])) -(exception: #export (circular-dependency {dependee Name} {dependent Name}) +(exception: #export (circular_dependency {dependee Name} {dependent Name}) (exception.report ["Dependent" (%.text dependent)] ["Dependee" (%.text dependee)])) @@ -56,7 +56,7 @@ (case (list.find (set.member? lineage) (get@ #//.parents profile)) (#.Some ouroboros) - (exception.throw ..circular-dependency [ouroboros name]) + (exception.throw ..circular_dependency [ouroboros name]) #.None (do {! try.monad} @@ -68,7 +68,7 @@ parents)))) #.None - (exception.throw ..unknown-profile [name]))) + (exception.throw ..unknown_profile [name]))) (def: #export (profile name project) (-> Name Project (Try Profile)) diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index 351d1c066..582144ad4 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -52,9 +52,9 @@ (signature: #export (Simulation s) (: (-> URI s (Try [s Binary])) - on-download) + on_download) (: (-> URI Binary s (Try s)) - on-upload)) + on_upload)) (def: #export (mock simulation init) (All [s] (-> (Simulation s) s (Repository Promise))) @@ -64,7 +64,7 @@ (stm.commit (do {! stm.monad} [|state| (stm.read state)] - (case (\ simulation on-download uri |state|) + (case (\ simulation on_download uri |state|) (#try.Success [|state| output]) (do ! [_ (stm.write |state| state)] @@ -77,7 +77,7 @@ (stm.commit (do {! stm.monad} [|state| (stm.read state)] - (case (\ simulation on-upload uri content |state|) + (case (\ simulation on_upload uri content |state|) (#try.Success |state|) (do ! [_ (stm.write |state| state)] @@ -122,11 +122,11 @@ (new [java/io/InputStream]) (read [[byte] int int] #io #try int)]) -(exception: #export (no-credentials {address Address}) +(exception: #export (no_credentials {address Address}) (exception.report ["Address" (%.text address)])) -(exception: #export (deployment-failure {code Int}) +(exception: #export (deployment_failure {code Int}) (exception.report ["Code" (%.int code)])) @@ -134,10 +134,10 @@ (-> Artifact Extension URI) (format (//artifact.uri artifact) extension)) -(def: buffer-size +(def: buffer_size (n.* 512 1,024)) -(def: user-agent +(def: user_agent (format "LuxAedifex/" (version.format language/lux.version))) (structure: #export (remote identity address) @@ -150,28 +150,28 @@ java/net/URL::openConnection) #let [connection (:coerce java/net/HttpURLConnection connection)] _ (java/net/HttpURLConnection::setRequestMethod "GET" connection) - _ (java/net/URLConnection::setRequestProperty "User-Agent" ..user-agent connection) + _ (java/net/URLConnection::setRequestProperty "User-Agent" ..user_agent connection) input (|> connection java/net/URLConnection::getInputStream (\ ! map (|>> java/io/BufferedInputStream::new))) - #let [buffer (binary.create ..buffer-size)]] + #let [buffer (binary.create ..buffer_size)]] (loop [output (\ binary.monoid identity)] (do ! - [bytes-read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer-size) input)] - (case bytes-read + [bytes_read (java/io/BufferedInputStream::read buffer +0 (.int ..buffer_size) input)] + (case bytes_read -1 (do ! [_ (java/lang/AutoCloseable::close input)] (wrap output)) - _ (if (n.= ..buffer-size bytes-read) + _ (if (n.= ..buffer_size bytes_read) (recur (\ binary.monoid compose output buffer)) (do ! - [chunk (\ io.monad wrap (binary.slice 0 (.nat bytes-read) buffer))] + [chunk (\ io.monad wrap (binary.slice 0 (.nat bytes_read) buffer))] (recur (\ binary.monoid compose output chunk))))))))) (def: (upload uri content) (case identity #.None - (\ io.monad wrap (exception.throw ..no-credentials [address])) + (\ io.monad wrap (exception.throw ..no_credentials [address])) (#.Some [user password]) (do (try.with io.monad) @@ -181,7 +181,7 @@ #let [connection (:coerce java/net/HttpURLConnection connection)] _ (java/net/HttpURLConnection::setRequestMethod "PUT" connection) _ (java/net/URLConnection::setDoOutput true connection) - _ (java/net/URLConnection::setRequestProperty "Authorization" (/identity.basic-auth user password) connection) + _ (java/net/URLConnection::setRequestProperty "Authorization" (/identity.basic_auth user password) connection) stream (java/net/URLConnection::getOutputStream connection) _ (java/io/OutputStream::write content stream) _ (java/io/OutputStream::flush stream) @@ -189,5 +189,5 @@ code (java/net/HttpURLConnection::getResponseCode connection)] (case code +201 (wrap []) - _ (\ io.monad wrap (exception.throw ..deployment-failure [code])))))) + _ (\ io.monad wrap (exception.throw ..deployment_failure [code])))))) ) diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux index fbc93f367..2de3c6751 100644 --- a/stdlib/source/program/aedifex/repository/identity.lux +++ b/stdlib/source/program/aedifex/repository/identity.lux @@ -34,7 +34,7 @@ ["#::." (#static getEncoder [] java/util/Base64$Encoder)]) -(def: #export (basic-auth user password) +(def: #export (basic_auth user password) (-> User Password Text) (let [credentials (\ encoding.utf8 encode (format user ":" password))] (|> (java/util/Base64::getEncoder) diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index b649f333b..2c764aff9 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -32,11 +32,11 @@ (def: file "library.tar") -(def: no-ownership +(def: no_ownership tar.Ownership (let [commons (: tar.Owner {#tar.name tar.anonymous - #tar.id tar.no-id})] + #tar.id tar.no_id})] {#tar.user commons #tar.group commons})) @@ -46,21 +46,21 @@ [files (io.enumerate system sources)] (|> (dictionary.entries files) (monad.map try.monad - (function (_ [path source-code]) + (function (_ [path source_code]) (do try.monad [path (|> path - (text.replace-all (\ system separator) .module-separator) + (text.replace_all (\ system separator) .module_separator) tar.path) - source-code (tar.content source-code)] + source_code (tar.content source_code)] (wrap (#tar.Normal [path - (instant.from-millis +0) + (instant.from_millis +0) ($_ tar.and - tar.read-by-owner tar.write-by-owner - tar.read-by-group tar.write-by-group - tar.read-by-other) - ..no-ownership - source-code]))))) - (\ try.monad map row.from-list) + tar.read_by_owner tar.write_by_owner + tar.read_by_group tar.write_by_group + tar.read_by_other) + ..no_ownership + source_code]))))) + (\ try.monad map row.from_list) (\ promise.monad wrap)))) (def: #export (export system [sources target]) @@ -68,8 +68,8 @@ (do (try.with promise.monad) [tar (..library system sources) package (: (Promise (Try (file.File Promise))) - (file.get-file promise.monad system + (file.get_file promise.monad system (format target (\ system separator) ..file)))] (|> tar (binary.run tar.writer) - (!.use (\ package over-write))))) + (!.use (\ package over_write))))) diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux index 54227c7f3..7b4a9262e 100644 --- a/stdlib/source/program/compositor/import.lux +++ b/stdlib/source/program/compositor/import.lux @@ -33,7 +33,7 @@ (def: Action (type (All [a] (Promise (Try a))))) -(exception: #export useless-tar-entry) +(exception: #export useless_tar_entry) (exception: #export (duplicate {library Library} {module Module}) (exception.report @@ -43,7 +43,7 @@ (type: #export Import (Dictionary Path Binary)) -(def: (import-library system library import) +(def: (import_library system library import) (-> (file.System Promise) Library Import (Action Import)) (do (try.with promise.monad) [file (: (Action (File Promise)) @@ -55,8 +55,8 @@ (monad.fold ! (function (_ entry import) (case entry (#tar.Normal [path instant mode ownership content]) - (let [path (tar.from-path path)] - (case (dictionary.try-put path (tar.data content) import) + (let [path (tar.from_path path)] + (case (dictionary.try_put path (tar.data content) import) (#try.Success import) (wrap import) @@ -64,14 +64,14 @@ (exception.throw ..duplicate [library path]))) _ - (exception.throw ..useless-tar-entry []))) + (exception.throw ..useless_tar_entry []))) import - (row.to-list tar)))))) + (row.to_list tar)))))) (def: #export (import system libraries) (-> (file.System Promise) (List Library) (Action Import)) (monad.fold (: (Monad Action) (try.with promise.monad)) - (..import-library system) + (..import_library system) (dictionary.new text.hash) libraries)) |