From 891b1cfc82322f8017f0a4f6b707d6fe52024545 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 3 Sep 2021 21:51:30 -0400 Subject: Unified tuple and record syntax. --- stdlib/source/program/aedifex/artifact.lux | 4 +-- .../program/aedifex/artifact/snapshot/stamp.lux | 4 +-- .../program/aedifex/artifact/snapshot/version.lux | 4 +-- .../aedifex/artifact/snapshot/version/value.lux | 4 +-- .../source/program/aedifex/artifact/time/time.lux | 4 +-- .../source/program/aedifex/artifact/versioning.lux | 8 +++--- stdlib/source/program/aedifex/command/deploy.lux | 4 +-- stdlib/source/program/aedifex/command/install.lux | 4 +-- stdlib/source/program/aedifex/dependency.lux | 4 +-- .../program/aedifex/dependency/deployment.lux | 8 +++--- .../program/aedifex/dependency/resolution.lux | 8 +++--- stdlib/source/program/aedifex/format.lux | 33 ++++++++++++---------- .../source/program/aedifex/metadata/artifact.lux | 12 ++++---- .../source/program/aedifex/metadata/snapshot.lux | 22 +++++++-------- stdlib/source/program/aedifex/package.lux | 8 +++--- stdlib/source/program/aedifex/parser.lux | 30 ++++++++++---------- stdlib/source/program/aedifex/pom.lux | 6 ++-- stdlib/source/program/aedifex/profile.lux | 24 ++++++++-------- .../source/program/aedifex/repository/identity.lux | 4 +-- stdlib/source/program/aedifex/runtime.lux | 8 +++--- 20 files changed, 103 insertions(+), 100 deletions(-) (limited to 'stdlib/source/program/aedifex') diff --git a/stdlib/source/program/aedifex/artifact.lux b/stdlib/source/program/aedifex/artifact.lux index 9645ba1f8..a6f506032 100644 --- a/stdlib/source/program/aedifex/artifact.lux +++ b/stdlib/source/program/aedifex/artifact.lux @@ -27,9 +27,9 @@ (type: .public Artifact (Record - {#group Group + [#group Group #name Name - #version Version})) + #version Version])) (def: .public hash (Hash Artifact) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux index d8d1e6bbc..91fcc3de5 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux @@ -18,8 +18,8 @@ (type: .public Stamp (Record - {#time Time - #build Build})) + [#time Time + #build Build])) (def: .public equivalence (Equivalence Stamp) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux index aa2994958..821d3d2c5 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux @@ -19,9 +19,9 @@ (type: .public Version (Record - {#extension Type + [#extension Type #value Text - #updated Time})) + #updated Time])) (def: .public equivalence (Equivalence Version) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux index cfcf3be09..9aacdf6de 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -13,8 +13,8 @@ (type: .public Value (Record - {#version Text - #snapshot Snapshot})) + [#version Text + #snapshot Snapshot])) (def: .public equivalence (Equivalence Value) diff --git a/stdlib/source/program/aedifex/artifact/time/time.lux b/stdlib/source/program/aedifex/artifact/time/time.lux index 0db035d56..6fb329962 100644 --- a/stdlib/source/program/aedifex/artifact/time/time.lux +++ b/stdlib/source/program/aedifex/artifact/time/time.lux @@ -33,7 +33,7 @@ minute (<>.codec n.decimal (.exactly 2 .decimal)) second (<>.codec n.decimal (.exactly 2 .decimal))] (<>.lifted (time.time - {#time.hour hour + [#time.hour hour #time.minute minute #time.second second - #time.milli_second 0})))) + #time.milli_second 0])))) diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux index 38001bfe2..550ae86a3 100644 --- a/stdlib/source/program/aedifex/artifact/versioning.lux +++ b/stdlib/source/program/aedifex/artifact/versioning.lux @@ -31,14 +31,14 @@ (type: .public Versioning (Record - {#snapshot Snapshot + [#snapshot Snapshot #last_updated //time.Time - #versions (List Version)})) + #versions (List Version)])) (def: .public init - {#snapshot #//snapshot.Local + [#snapshot #//snapshot.Local #last_updated //time.epoch - #versions (list)}) + #versions (list)]) (def: .public equivalence (Equivalence Versioning) diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index fc0562699..01e083faf 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -71,10 +71,10 @@ (let [pom_data (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] - {#///package.origin (#///repository/origin.Remote "") + [#///package.origin (#///repository/origin.Remote "") #///package.library [library (///dependency/status.verified library)] #///package.pom [pom pom_data - (///dependency/status.verified pom_data)]}))] + (///dependency/status.verified pom_data)]]))] (console.write_line ..success console))) diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 37a5c77b1..a496b35bc 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -66,12 +66,12 @@ (let [pom_data (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] - {#///package.origin (#///origin.Local "") + [#///package.origin (#///origin.Local "") #///package.library (let [library (binary.result tar.writer package)] [library (///dependency/status.verified library)]) #///package.pom [pom pom_data - (///dependency/status.verified pom_data)]}))] + (///dependency/status.verified pom_data)]]))] (console.write_line ..success console)) _ diff --git a/stdlib/source/program/aedifex/dependency.lux b/stdlib/source/program/aedifex/dependency.lux index e1602990d..b1e1ed875 100644 --- a/stdlib/source/program/aedifex/dependency.lux +++ b/stdlib/source/program/aedifex/dependency.lux @@ -15,8 +15,8 @@ (type: .public Dependency (Record - {#artifact Artifact - #type Type})) + [#artifact Artifact + #type Type])) (def: .public hash (Hash Dependency) diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 92f0b55bf..d63c5a0a2 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -105,11 +105,11 @@ versioning_snapshot (value@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] snapshot)]] (in (|> snapshot (with@ [#///metadata/snapshot.versioning #///artifact/versioning.versions] - (list {#///artifact/snapshot/version.extension type + (list [#///artifact/snapshot/version.extension type #///artifact/snapshot/version.value (///artifact/snapshot/version/value.format - {#///artifact/snapshot/version/value.version version_template - #///artifact/snapshot/version/value.snapshot versioning_snapshot}) - #///artifact/snapshot/version.updated now})) + [#///artifact/snapshot/version/value.version version_template + #///artifact/snapshot/version/value.snapshot versioning_snapshot]) + #///artifact/snapshot/version.updated now])) ... (with@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] ... (list\composite (..artifacts type (product.right (value@ #///package.library package))) ... (..artifacts ///artifact/type.pom (product.right (value@ #///package.pom package))))) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 23a572506..20f4cff71 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -132,8 +132,8 @@ (do (try.with async.monad) [snapshot (///metadata/snapshot.read repository artifact) .let [version_template (value@ [#///metadata/snapshot.artifact #///artifact.version] snapshot) - artifact_version (value.format {#value.version version_template - #value.snapshot (value@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] snapshot)}) + artifact_version (value.format [#value.version version_template + #value.snapshot (value@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] snapshot)]) artifact (with@ #///artifact.version artifact_version artifact)] [pom_data pom_status] (..hashed repository version_template artifact ///artifact/extension.pom) library_&_status (..hashed repository version_template artifact extension)] @@ -142,9 +142,9 @@ [pom (\ utf8.codec decoded pom_data) pom (\ xml.codec decoded pom) profile (.result ///pom.parser (list pom))] - (in {#///package.origin (#///repository/origin.Remote "") + (in [#///package.origin (#///repository/origin.Remote "") #///package.library library_&_status - #///package.pom [pom pom_data pom_status]})))))) + #///package.pom [pom pom_data pom_status]])))))) (type: .public Resolution (Dictionary Dependency Package)) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 1933d2be0..93eca461f 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -5,7 +5,7 @@ ["." text ("#\." equivalence)] [collection ["." dictionary (#+ Dictionary)] - ["." list ("#\." functor)] + ["." list ("#\." monad)] ["." set (#+ Set)]]] [macro ["." code] @@ -23,31 +23,31 @@ (def: (license [name url type]) (Format /.License) - (`' {#name (~ (code.text name)) + (`' [#name (~ (code.text name)) #url (~ (code.text url)) #type (~ (case type #/.Repo (' #repo) #/.Manual - (' #manual)))})) + (' #manual)))])) (def: (organization [name url]) (Format /.Organization) - (`' {#name (~ (code.text name)) - #url (~ (code.text url))})) + (`' [#name (~ (code.text name)) + #url (~ (code.text url))])) (def: (developer [name url organization]) (Format /.Developer) (case organization #.None - (`' {#name (~ (code.text name)) - #url (~ (code.text url))}) + (`' [#name (~ (code.text name)) + #url (~ (code.text url))]) (#.Some value) - (`' {#name (~ (code.text name)) + (`' [#name (~ (code.text name)) #url (~ (code.text url)) - #organization (~ (..organization value))}))) + #organization (~ (..organization value))]))) (def: contributor (Format /.Contributor) @@ -60,8 +60,9 @@ (Format Aggregate) (|>> dictionary.entries (list\each (function (_ [key value]) - [(code.local_tag key) value])) - code.record)) + (list (code.local_tag key) value))) + list\conjoint + code.tuple)) (def: empty Aggregate @@ -101,8 +102,9 @@ (|> value dictionary.entries (list\each (function (_ [key value]) - [(key_format key) (value_format value)])) - code.record) + (list (key_format key) (value_format value)))) + list\conjoint + code.tuple) aggregate))) (def: (info value) @@ -167,5 +169,6 @@ (Format Project) (|>> dictionary.entries (list\each (function (_ [key value]) - [(code.text key) (..profile value)])) - code.record)) + (list (code.text key) (..profile value)))) + list\conjoint + code.tuple)) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 3a6ffb74f..0d6b924b9 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -40,10 +40,10 @@ (type: .public Metadata (Record - {#group Group + [#group Group #name Name #versions (List Version) - #last_updated Instant})) + #last_updated Instant])) (def: (pad value) (-> Nat Text) @@ -129,10 +129,10 @@ minute (<>.codec n.decimal (.exactly 2 .decimal)) second (<>.codec n.decimal (.exactly 2 .decimal))] (<>.lifted (time.time - {#time.hour hour + [#time.hour hour #time.minute minute #time.second second - #time.milli_second 0})))) + #time.milli_second 0])))) (def: last_updated_parser (Parser Instant) @@ -188,10 +188,10 @@ (#try.Failure error) (in (#try.Success (let [(^slots [#///artifact.group #///artifact.name]) artifact] - {#group group + [#group group #name name #versions (list) - #last_updated ..epoch})))))) + #last_updated ..epoch])))))) (def: .public (write repository artifact metadata) (-> (Repository Async) Artifact Metadata (Async (Try Any))) diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index d5e9483bf..61183a932 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -47,8 +47,8 @@ (type: .public Metadata (Record - {#artifact Artifact - #versioning Versioning})) + [#artifact Artifact + #versioning Versioning])) (template [ ] [(def: xml.Tag ["" ])] @@ -91,9 +91,9 @@ [group (.somewhere (..text ..)) name (.somewhere (..text ..)) version (.somewhere (..text ..)) - versioning (with_expansions [ {#///artifact/snapshot/version.extension ///artifact/type.jvm_library + versioning (with_expansions [ [#///artifact/snapshot/version.extension ///artifact/type.jvm_library #///artifact/snapshot/version.value version - #///artifact/snapshot/version.updated ///artifact/time.epoch}] + #///artifact/snapshot/version.updated ///artifact/time.epoch]] (|> (.somewhere ///artifact/versioning.parser) (\ ! each (revised@ #///artifact/versioning.versions @@ -104,13 +104,13 @@ versions versions))))) - (<>.else {#///artifact/versioning.snapshot #///artifact/snapshot.Local + (<>.else [#///artifact/versioning.snapshot #///artifact/snapshot.Local #///artifact/versioning.last_updated ///artifact/time.epoch - #///artifact/versioning.versions (list )})))] - (in {#artifact {#///artifact.group group + #///artifact/versioning.versions (list )])))] + (in [#artifact [#///artifact.group group #///artifact.name name - #///artifact.version version} - #versioning versioning})))) + #///artifact.version version] + #versioning versioning])))) (def: .public equivalence (Equivalence Metadata) @@ -137,8 +137,8 @@ (#try.Failure error) (in (#try.Success - {#artifact artifact - #versioning ///artifact/versioning.init}))))) + [#artifact artifact + #versioning ///artifact/versioning.init]))))) (def: .public (write repository artifact metadata) (-> (Repository Async) Artifact Metadata (Async (Try Any))) diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux index 49aa2867e..54994e50b 100644 --- a/stdlib/source/program/aedifex/package.lux +++ b/stdlib/source/program/aedifex/package.lux @@ -30,9 +30,9 @@ (type: .public Package (Record - {#origin Origin + [#origin Origin #library [Binary Status] - #pom [XML Binary Status]})) + #pom [XML Binary Status]])) (template [ ] [(def: .public ( package) @@ -50,7 +50,7 @@ (def: .public (local pom library) (-> XML Binary Package) - {#origin (#//origin.Local "") + [#origin (#//origin.Local "") #library [library (#//status.Verified (//hash.sha-1 library) (//hash.md5 library))] @@ -58,7 +58,7 @@ [pom binary_pom (#//status.Verified (//hash.sha-1 binary_pom) - (//hash.md5 binary_pom))])}) + (//hash.md5 binary_pom))])]) (def: .public dependencies (-> Package (Try (Set Dependency))) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 21c8ac270..41ada3cc7 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -84,8 +84,8 @@ (do {! <>.monad} [input (\ ! each (dictionary.of_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.tuple (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url) @@ -99,8 +99,8 @@ (do {! <>.monad} [input (\ ! each (dictionary.of_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.tuple (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url)))) @@ -110,8 +110,8 @@ (do {! <>.monad} [input (\ ! each (dictionary.of_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.tuple (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (..singular input "name" ..name) (..singular input "url" ..url) @@ -127,8 +127,8 @@ (do {! <>.monad} [input (\ ! each (dictionary.of_list text.hash) - (.record (<>.some (<>.and .local_tag - .any))))] + (.tuple (<>.some (<>.and .local_tag + .any))))] ($_ <>.and (<>.maybe (..singular input "url" ..url)) (<>.maybe (..singular input "scm" ..scm)) @@ -169,9 +169,9 @@ (def: deploy_repository (Parser (List [Text //repository.Address])) - (.record (<>.some - (<>.and .text - ..repository)))) + (.tuple (<>.some + (<>.and .text + ..repository)))) (def: runtime (Parser Runtime) @@ -183,8 +183,8 @@ (do {! <>.monad} [input (\ ! each (dictionary.of_list text.hash) - (.record (<>.some (<>.and .local_tag - .any)))) + (.tuple (<>.some (<>.and .local_tag + .any)))) .let [^parents (: (Parser (List /.Name)) (<>.else (list) (..plural input "parents" .text))) @@ -267,7 +267,7 @@ multi_profile (: (Parser Project) (\ <>.monad each (dictionary.of_list text.hash) - (.record (<>.many (<>.and .text - ..profile)))))] + (.tuple (<>.many (<>.and .text + ..profile)))))] (<>.either multi_profile default_profile))) diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index a093a4091..99ac54571 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -173,16 +173,16 @@ (do maybe.monad [group (dictionary.value ["" ..group_tag] properties) artifact (dictionary.value ["" ..artifact_tag] properties)] - (in {#//dependency.artifact {#//artifact.group group + (in [#//dependency.artifact [#//artifact.group group #//artifact.name artifact #//artifact.version (|> properties (dictionary.value ["" ..version_tag]) (maybe.else "") (text.replaced "${project.version}" own_version) - (text.replaced "${project.parent.version}" parent_version))} + (text.replaced "${project.parent.version}" parent_version))] #//dependency.type (|> properties (dictionary.value ["" "type"]) - (maybe.else //artifact/type.jvm_library))}))))) + (maybe.else //artifact/type.jvm_library))]))))) (def: (dependencies_parser own_version parent_version) (-> Text Text (Parser (List Dependency))) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index b861e1601..7621f0848 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -34,8 +34,8 @@ (def: .public default_compiler Dependency - {#dependency.artifact ["com.github.luxlang" "lux-jvm" "0.6.0-SNAPSHOT"] - #dependency.type type.jvm_library}) + [#dependency.artifact ["com.github.luxlang" "lux-jvm" "0.6.0-SNAPSHOT"] + #dependency.type type.jvm_library]) (type: .public Distribution (Variant @@ -101,13 +101,13 @@ (type: .public Info (Record - {#url (Maybe URL) + [#url (Maybe URL) #scm (Maybe SCM) #description (Maybe Text) #licenses (List License) #organization (Maybe Organization) #developers (List Developer) - #contributors (List Contributor)})) + #contributors (List Contributor)])) (def: info_equivalence (Equivalence Info) @@ -122,13 +122,13 @@ (def: .public default_info Info - {#url #.None + [#url #.None #scm #.None #description #.None #licenses (list) #organization #.None #developers (list) - #contributors (list)}) + #contributors (list)]) (type: .public Source Path) @@ -157,7 +157,7 @@ (type: .public Profile (Record - {#parents (List Name) + [#parents (List Name) #identity (Maybe Artifact) #info (Maybe Info) #repositories (Set Address) @@ -172,7 +172,7 @@ #js Runtime #python Runtime #lua Runtime - #ruby Runtime})) + #ruby Runtime])) (def: .public equivalence (Equivalence Profile) @@ -214,7 +214,7 @@ (Monoid Profile) (def: identity - {#parents (list) + [#parents (list) #identity #.None #info #.None #repositories (set.empty text.hash) @@ -229,14 +229,14 @@ #js runtime.default_js #python runtime.default_python #lua runtime.default_lua - #ruby runtime.default_ruby}) + #ruby runtime.default_ruby]) (def: (composite override baseline) (template.let [(!runtime ) [(if (runtime\= (value@ override)) (value@ baseline) (value@ override))]] - {#parents (list\composite (value@ #parents baseline) (value@ #parents override)) + [#parents (list\composite (value@ #parents baseline) (value@ #parents override)) #identity (maybe\composite (value@ #identity override) (value@ #identity baseline)) #info (maybe\composite (value@ #info override) (value@ #info baseline)) #repositories (set.union (value@ #repositories baseline) (value@ #repositories override)) @@ -255,6 +255,6 @@ #js (!runtime #js runtime.default_js) #python (!runtime #python runtime.default_python) #lua (!runtime #lua runtime.default_lua) - #ruby (!runtime #ruby runtime.default_ruby)}))) + #ruby (!runtime #ruby runtime.default_ruby)]))) (exception: .public no_identity) diff --git a/stdlib/source/program/aedifex/repository/identity.lux b/stdlib/source/program/aedifex/repository/identity.lux index 59d0fdcba..c4b974664 100644 --- a/stdlib/source/program/aedifex/repository/identity.lux +++ b/stdlib/source/program/aedifex/repository/identity.lux @@ -19,8 +19,8 @@ (type: .public Identity (Record - {#user User - #password Password})) + [#user User + #password Password])) (def: .public equivalence (Equivalence Identity) diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index bdf81da78..b5a9a78e0 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -16,8 +16,8 @@ (type: .public Runtime (Record - {#program Text - #parameters (List Text)})) + [#program Text + #parameters (List Text)])) (def: .public equivalence (Equivalence Runtime) @@ -28,8 +28,8 @@ (template [ ] [(def: .public Runtime - {#program - #parameters (`` (list (~~ (template.spliced ))))})] + [#program + #parameters (`` (list (~~ (template.spliced ))))])] [default_java "java" ["-jar"]] [default_js "node" ["--stack_size=8192"]] -- cgit v1.2.3