diff options
39 files changed, 504 insertions, 555 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2576c20d3..d4e4cd09f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,8 @@ jobs: node-version: '14' - run: cd ./stdlib/ && ../lux.sh with js with bibliotheca test test_stdlib_on_python_3: + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v2 - uses: ./.github/workflows/setup_aedifex # https://github.com/actions/setup-python diff --git a/lux-js/commands.md b/lux-js/commands.md index 2cd22edc7..34b4a750c 100644 --- a/lux-js/commands.md +++ b/lux-js/commands.md @@ -46,10 +46,10 @@ cd ~/lux/stdlib/ \ ``` cd ~/lux/lux-js/ \ -&& mvn install:install-file -Dfile=target/program.js -DgroupId=com.github.luxlang -DartifactId=lux-js -Dversion=0.6.6-SNAPSHOT -Dpackaging=js +&& mvn install:install-file -Dfile=target/program.js -DgroupId=com.github.luxlang -DartifactId=lux-js -Dversion=0.7.0-SNAPSHOT -Dpackaging=js cd ~/lux/lux-js/ && mvn deploy:deploy-file \ --Durl=https://USERNAME:PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \ +-Durl=https://$NEXUS_USERNAME:$NEXUS_PASSWORD@oss.sonatype.org/content/repositories/snapshots/ \ -Dfile=target/program.js \ -DgroupId=com.github.luxlang \ -DartifactId=lux-js \ diff --git a/stdlib/project.lux b/stdlib/project.lux index 370f8c85f..248a90a18 100644 --- a/stdlib/project.lux +++ b/stdlib/project.lux @@ -69,7 +69,7 @@ ] "python" - ["lux" ["com.github.luxlang" "lux-python" "0.6.6-SNAPSHOT" "jar"] + ["lux" ["com.github.luxlang" "lux-python" "0.7.0-SNAPSHOT" "jar"] ... The OS command to use when running Python tests. The default is described below. ... "python" ["python3"] ] diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 5dbef4fac..63fa76177 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -369,27 +369,27 @@ _ {#None})]) -(documentation: /.^or - (format "Or-patterns." - \n "It's a special macro meant to be used with 'case'.") - [(type: Weekday - (Variant - {#Monday} - {#Tuesday} - {#Wednesday} - {#Thursday} - {#Friday} - {#Saturday} - {#Sunday})) - - (def: (weekend? day) - (-> Weekday Bit) - (case day - (^or {#Saturday} {#Sunday}) - #1 - - _ - #0))]) +... (documentation: /.^or +... (format "Or-patterns." +... \n "It's a special macro meant to be used with 'case'.") +... [(type: Weekday +... (Variant +... {#Monday} +... {#Tuesday} +... {#Wednesday} +... {#Thursday} +... {#Friday} +... {#Saturday} +... {#Sunday})) + +... (def: (weekend? day) +... (-> Weekday Bit) +... (case day +... (^or {#Saturday} {#Sunday}) +... #1 + +... _ +... #0))]) (documentation: /.let (format "Creates local bindings." @@ -633,40 +633,40 @@ (let [updater (revised [#foo #bar #baz])] (updater func my_record))]) -(documentation: /.^template - "It's similar to template, but meant to be used during pattern-matching." - [(def: (reduced env type) - (-> (List Type) Type Type) - (case type - {.#Primitive name params} - {.#Primitive name (list#each (reduced env) params)} - - (^template [<tag>] - [{<tag> left right} - {<tag> (reduced env left) (reduced env right)}]) - ([.#Sum] [.#Product]) - - (^template [<tag>] - [{<tag> left right} - {<tag> (reduced env left) (reduced env right)}]) - ([.#Function] [.#Apply]) - - (^template [<tag>] - [{<tag> old_env def} - (case old_env - {.#End} - {<tag> env def} - - _ - type)]) - ([.#UnivQ] [.#ExQ]) - - {.#Parameter idx} - (else type (list.item idx env)) - - _ - type - ))]) +... (documentation: /.^template +... "It's similar to template, but meant to be used during pattern-matching." +... [(def: (reduced env type) +... (-> (List Type) Type Type) +... (case type +... {.#Primitive name params} +... {.#Primitive name (list#each (reduced env) params)} + +... (^template [<tag>] +... [{<tag> left right} +... {<tag> (reduced env left) (reduced env right)}]) +... ([.#Sum] [.#Product]) + +... (^template [<tag>] +... [{<tag> left right} +... {<tag> (reduced env left) (reduced env right)}]) +... ([.#Function] [.#Apply]) + +... (^template [<tag>] +... [{<tag> old_env def} +... (case old_env +... {.#End} +... {<tag> env def} + +... _ +... type)]) +... ([.#UnivQ] [.#ExQ]) + +... {.#Parameter idx} +... (else type (list.item idx env)) + +... _ +... type +... ))]) (.template [<name> <doc>] [(documentation: <name> @@ -738,25 +738,25 @@ _ false))]) -(documentation: /.^multi - (format "Multi-level pattern matching." - \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") - [(case (split (size static) uri) - (^multi {#Some [chunk uri']} - [(text#= static chunk) #1]) - (match_uri endpoint? parts' uri') - - _ - {#Left (format "Static part " (%t static) " does not match URI: " uri)})] - ["Short-cuts can be taken when using bit tests." - "The example above can be rewritten as..." - (case (split (size static) uri) - (^multi {#Some [chunk uri']} - (text#= static chunk)) - (match_uri endpoint? parts' uri') - - _ - {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) +... (documentation: /.^multi +... (format "Multi-level pattern matching." +... \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") +... [(case (split (size static) uri) +... (^multi {#Some [chunk uri']} +... [(text#= static chunk) #1]) +... (match_uri endpoint? parts' uri') + +... _ +... {#Left (format "Static part " (%t static) " does not match URI: " uri)})] +... ["Short-cuts can be taken when using bit tests." +... "The example above can be rewritten as..." +... (case (split (size static) uri) +... (^multi {#Some [chunk uri']} +... (text#= static chunk)) +... (match_uri endpoint? parts' uri') + +... _ +... {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) (documentation: /.symbol "Gives back a 2 tuple with the module and name parts, both as Text." @@ -785,20 +785,20 @@ (same? +5 (+ +2 +3))]) -(documentation: /.^let - "Allows you to simultaneously bind and de-structure a value." - [(def: (hash (^let set [member_hash _])) - (list#mix (function (_ elem acc) - (+ acc - (# member_hash hash elem))) - 0 - (set.list set)))]) - -(documentation: /.^|> - "Pipes the value being pattern-matched against prior to binding it to a variable." - [(case input - (^|> value [++ (% 10) (max 1)]) - (foo value))]) +... (documentation: /.^let +... "Allows you to simultaneously bind and de-structure a value." +... [(def: (hash (^let set [member_hash _])) +... (list#mix (function (_ elem acc) +... (+ acc +... (# member_hash hash elem))) +... 0 +... (set.list set)))]) + +... (documentation: /.^|> +... "Pipes the value being pattern-matched against prior to binding it to a variable." +... [(case input +... (^|> value [++ (% 10) (max 1)]) +... (foo value))]) (documentation: /.as_expected "Coerces the given expression to the type of whatever is expected." @@ -862,15 +862,15 @@ [(`` (some expression (~~ (some macro which may yield 0 or more results))))]) -(documentation: /.^code - "Generates pattern-matching code for Code values in a way that looks like code-templating." - [(is (Maybe Nat) - (case (` (#0 123 +456.789)) - (^code (#0 (~ [_ {.#Nat number}]) +456.789)) - {.#Some number} +... (documentation: /.^code +... "Generates pattern-matching code for Code values in a way that looks like code-templating." +... [(is (Maybe Nat) +... (case (` (#0 123 +456.789)) +... (^code (#0 (~ [_ {.#Nat number}]) +456.789)) +... {.#Some number} - _ - {.#None}))]) +... _ +... {.#None}))]) (documentation: /.false "The boolean FALSE value.") @@ -954,7 +954,7 @@ ..exec ..case ..pattern - ..^or + ... ..^or ..let ..function ..def: @@ -983,18 +983,18 @@ ..# ..has ..revised - ..^template + ... ..^template ..++ ..-- ..loop ..with_expansions ..static - ..^multi + ... ..^multi ..symbol ..parameter ..same? - ..^let - ..^|> + ... ..^let + ... ..^|> ..as_expected ..undefined ..type_of @@ -1003,7 +1003,7 @@ ..char ..for ..`` - ..^code + ... ..^code ..false ..true ..try diff --git a/stdlib/source/documentation/lux/abstract/functor.lux b/stdlib/source/documentation/lux/abstract/functor.lux index a3b945fd7..92c0a61c9 100644 --- a/stdlib/source/documentation/lux/abstract/functor.lux +++ b/stdlib/source/documentation/lux/abstract/functor.lux @@ -1,14 +1,14 @@ (.using - [library - [lux - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]]]] - [\\library - ["[0]" /]] - ["[0]" / "_" - ["[1][0]" contravariant]]) + [library + [lux + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]]]] + [\\library + ["[0]" /]] + ["[0]" / "_" + ["[1][0]" contravariant]]) (documentation: /.sum "Co-product (sum) composition for functors.") @@ -24,7 +24,6 @@ ($.module /._ "" [($.default (/.Functor !)) - ($.default (/.Fix !)) ($.default (/.Or left right)) ($.default (/.And left right)) ($.default (/.Then outer inner)) diff --git a/stdlib/source/documentation/lux/control/function/memo.lux b/stdlib/source/documentation/lux/control/function/memo.lux index f802fa407..9baa0d1a7 100644 --- a/stdlib/source/documentation/lux/control/function/memo.lux +++ b/stdlib/source/documentation/lux/control/function/memo.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" if loop} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" open} + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.open "Memoization where the memoized results can be re-used accross invocations." diff --git a/stdlib/source/documentation/lux/control/parser/cli.lux b/stdlib/source/documentation/lux/control/parser/cli.lux index 52e0864d4..1ef937a0b 100644 --- a/stdlib/source/documentation/lux/control/parser/cli.lux +++ b/stdlib/source/documentation/lux/control/parser/cli.lux @@ -1,14 +1,14 @@ (.using - [library - [lux "*" - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" parameter} + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Parser it) "A command-line interface parser.") diff --git a/stdlib/source/documentation/lux/control/parser/code.lux b/stdlib/source/documentation/lux/control/parser/code.lux index e11fb64b8..552738c03 100644 --- a/stdlib/source/documentation/lux/control/parser/code.lux +++ b/stdlib/source/documentation/lux/control/parser/code.lux @@ -63,9 +63,9 @@ "Executes a parser against a stream of code, and verifies all the inputs are consumed." [(result parser inputs)]) -(documentation: /.local +(documentation: /.locally "Runs parser against the given list of inputs." - [(local inputs parser)]) + [(locally inputs parser)]) (documentation: /.not "Yields the next Code token if the parser fails." @@ -108,7 +108,7 @@ ..end ..end? ..result - ..local + ..locally ..not ..next] [])) diff --git a/stdlib/source/documentation/lux/control/parser/type.lux b/stdlib/source/documentation/lux/control/parser/type.lux index 331f109de..b240b24ad 100644 --- a/stdlib/source/documentation/lux/control/parser/type.lux +++ b/stdlib/source/documentation/lux/control/parser/type.lux @@ -70,9 +70,9 @@ [/.super "Parses a super type."] ) -(documentation: /.adjusted_idx +(documentation: /.argument "" - [(adjusted_idx env idx)]) + [(argument env idx)]) (documentation: /.this_parameter "" @@ -114,7 +114,7 @@ ..sub ..super - ..adjusted_idx + ..argument ..this_parameter ..existential ..named diff --git a/stdlib/source/documentation/lux/data/binary.lux b/stdlib/source/documentation/lux/data/binary.lux index 1bc5e4146..abfdc044d 100644 --- a/stdlib/source/documentation/lux/data/binary.lux +++ b/stdlib/source/documentation/lux/data/binary.lux @@ -21,41 +21,41 @@ "" [(aggregate f init binary)]) -(documentation: /.read_8! +(documentation: /.bits_8 "Read 1 byte (8 bits) at the given index." - [(read_8! index binary)]) + [(bits_8 index binary)]) -(documentation: /.read_16! +(documentation: /.bits_16 "Read 2 bytes (16 bits) at the given index." - [(read_16! index binary)]) + [(bits_16 index binary)]) -(documentation: /.read_32! +(documentation: /.bits_32 "Read 4 bytes (32 bits) at the given index." - [(read_32! index binary)]) + [(bits_32 index binary)]) -(documentation: /.read_64! +(documentation: /.bits_64 "Read 8 bytes (64 bits) at the given index." - [(read_64! index binary)]) + [(bits_64 index binary)]) -(documentation: /.write_8! +(documentation: /.has_8! "Write 1 byte (8 bits) at the given index." - [(write_8! index value binary)]) + [(has_8! index value binary)]) -(documentation: /.write_16! +(documentation: /.has_16! "Write 2 bytes (16 bits) at the given index." - [(write_16! index value binary)]) + [(has_16! index value binary)]) -(documentation: /.write_32! +(documentation: /.has_32! "Write 4 bytes (32 bits) at the given index." - [(write_32! index value binary)]) + [(has_32! index value binary)]) -(documentation: /.write_64! +(documentation: /.has_64! "Write 8 bytes (64 bits) at the given index." - [(write_64! index value binary)]) + [(has_64! index value binary)]) -(documentation: /.copy +(documentation: /.copy! "Mutates the target binary BLOB by copying bytes from the source BLOB to it." - [(copy bytes source_offset source target_offset target)]) + [(copy! bytes source_offset source target_offset target)]) (documentation: /.slice "Yields a subset of the binary BLOB, so long as the specified range is valid." @@ -72,15 +72,15 @@ [..Binary ..empty ..aggregate - ..read_8! - ..read_16! - ..read_32! - ..read_64! - ..write_8! - ..write_16! - ..write_32! - ..write_64! - ..copy + ..bits_8 + ..bits_16 + ..bits_32 + ..bits_64 + ..has_8! + ..has_16! + ..has_32! + ..has_64! + ..copy! ..slice ..after ($.default /.index_out_of_bounds) diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index 56ef85af3..d516f1ec3 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -26,25 +26,25 @@ "" [(size array)]) -(documentation: /.read! +(documentation: /.item "" - [(read! index array)]) + [(item index array)]) -(documentation: /.write! +(documentation: /.has! "Mutate the array by writing a value to the specified index." - [(write! index value array)]) + [(has! index value array)]) -(documentation: /.delete! +(documentation: /.lacks! "Mutate the array by deleting the value at the specified index." - [(delete! index array)]) + [(lacks! index array)]) -(documentation: /.contains? +(documentation: /.has? "" - [(contains? index array)]) + [(has? index array)]) -(documentation: /.update! +(documentation: /.revised! "Mutate the array by updating the value at the specified index." - [(update! index transform array)]) + [(revised! index transform array)]) (documentation: /.upsert! (format "Mutate the array by updating the value at the specified index." @@ -63,17 +63,17 @@ "Finds out how many cells in an array are vacant." [(vacancy array)]) -(documentation: /.filter! +(documentation: /.only! "Delete every item of the array that fails to satisfy the predicate." - [(filter! p xs)]) + [(only! p xs)]) (documentation: /.example "Yields the first item in the array that satisfies the predicate." [(example p xs)]) -(documentation: /.example+ +(documentation: /.example' "Just like 'example', but with access to the index of each value." - [(example+ p xs)]) + [(example' p xs)]) (documentation: /.clone "Yields a shallow clone of the array." @@ -96,18 +96,18 @@ [..Array ..empty ..size - ..read! - ..write! - ..delete! - ..contains? - ..update! + ..item + ..has! + ..lacks! + ..has? + ..revised! ..upsert! ..copy! ..occupancy ..vacancy - ..filter! + ..only! ..example - ..example+ + ..example' ..clone ..of_list ..list diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index 59955b544..72bbc43a8 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]] - [\\library - ["[0]" /]] - ["[0]" / "_" - ["[1][0]" ordered] - ["[1][0]" plist]]) + [library + [lux {"-" has revised} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]] + [\\library + ["[0]" /]] + ["[0]" / "_" + ["[1][0]" ordered] + ["[1][0]" plist]]) (documentation: (/.Dictionary key value) "A dictionary implemented as a Hash-Array Mapped Trie (HAMT).") diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index f98e122ad..e597d73fa 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -1,19 +1,19 @@ (.using - [library - [lux "*" - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" has revised} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Dictionary key value) "A dictionary data-structure with ordered entries.") diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux index fccb11c25..81ca8e29c 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux @@ -1,19 +1,19 @@ (.using - [library - [lux "*" - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" has revised} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.PList it) (format "A property list." diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 3d719ee3e..3f25a8a2b 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" list} + [lux {"-" list has revised} ["$" documentation {"+" documentation:}] [control ["<>" parser diff --git a/stdlib/source/documentation/lux/data/collection/set.lux b/stdlib/source/documentation/lux/data/collection/set.lux index c63ad7af0..afac731cb 100644 --- a/stdlib/source/documentation/lux/data/collection/set.lux +++ b/stdlib/source/documentation/lux/data/collection/set.lux @@ -1,20 +1,20 @@ (.using - [library - [lux {"-" list} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]] - ["[0]" / "_" - ["[1][0]" multi] - ["[1][0]" ordered]]) + [library + [lux {"-" list has} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]] + ["[0]" / "_" + ["[1][0]" multi] + ["[1][0]" ordered]]) (documentation: /.has "" diff --git a/stdlib/source/documentation/lux/data/collection/set/multi.lux b/stdlib/source/documentation/lux/data/collection/set/multi.lux index fd0b0499a..40c11a4d0 100644 --- a/stdlib/source/documentation/lux/data/collection/set/multi.lux +++ b/stdlib/source/documentation/lux/data/collection/set/multi.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" list} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" list has} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Set it) "A set that keeps track of repetition in its entries.") diff --git a/stdlib/source/documentation/lux/data/collection/set/ordered.lux b/stdlib/source/documentation/lux/data/collection/set/ordered.lux index bcc9bfd53..c239a9b35 100644 --- a/stdlib/source/documentation/lux/data/collection/set/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/set/ordered.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" list} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" list has} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Set it) "A set with ordered entries.") diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux index 4d3e89a52..bba416ae1 100644 --- a/stdlib/source/documentation/lux/data/collection/stream.lux +++ b/stdlib/source/documentation/lux/data/collection/stream.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" list} + [lux {"-" list pattern} ["$" documentation {"+" documentation:}] [control ["<>" parser diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index 26a14d886..78e8bd332 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" nat int rev list type or and} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" nat int rev list type or and has} + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.json "A simple way to produce JSON literals." diff --git a/stdlib/source/documentation/lux/data/format/tar.lux b/stdlib/source/documentation/lux/data/format/tar.lux index 059234a73..df4e17788 100644 --- a/stdlib/source/documentation/lux/data/format/tar.lux +++ b/stdlib/source/documentation/lux/data/format/tar.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" nat int rev list type or and} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (.def: .public documentation (.List $.Module) @@ -83,7 +83,6 @@ ($.default /.Tar) ($.default /.writer) ($.default /.wrong_checksum) - ($.default /.wrong_link_flag) ($.default /.invalid_end_of_archive) ($.default /.parser)] [])) diff --git a/stdlib/source/documentation/lux/data/text/regex.lux b/stdlib/source/documentation/lux/data/text/regex.lux index 631195a86..1fb81532e 100644 --- a/stdlib/source/documentation/lux/data/text/regex.lux +++ b/stdlib/source/documentation/lux/data/text/regex.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" pattern} ["$" documentation {"+" documentation:}] [data [text {"+" \n} diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 510636c0f..2ce78b3a2 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" int char type as} + [lux {"-" int char type is as} ["$" documentation {"+" documentation:}] [data ["[0]" text {"+" \n} @@ -154,10 +154,10 @@ [(= "foo" (!!! (??? "foo")))]) -(documentation: /.check +(documentation: /.as (format "Checks whether an object is an instance of a particular class." \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.") - [(case (check String "YOLO") + [(case (as String "YOLO") {.#Some value_as_string} {.#None})]) @@ -248,9 +248,9 @@ [(is Type (type java/lang/String))]) -(documentation: /.as +(documentation: /.is "" - [(as java/lang/Object + [(is java/lang/Object (is java/lang/String ???))]) @@ -312,7 +312,7 @@ ..null? ..??? ..!!! - ..check + ..as ..synchronized ..do_to ..import: @@ -322,13 +322,12 @@ ..write! ..class_for ..type - ..as + ..is ($.default /.Privacy) ($.default /.State) ($.default /.Inheritance) ($.default /.class_names_cannot_contain_periods) ($.default /.class_name_cannot_be_a_type_variable) - ($.default /.unexpected_type_variable) ($.default /.cannot_convert_to_jvm_type) ($.default /.cannot_cast_to_non_object)] [])) diff --git a/stdlib/source/documentation/lux/math.lux b/stdlib/source/documentation/lux/math.lux index 10bd8a1f3..06db95c3a 100644 --- a/stdlib/source/documentation/lux/math.lux +++ b/stdlib/source/documentation/lux/math.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" char} + [lux "*" ["$" documentation {"+" documentation:}] [data [text @@ -17,64 +17,11 @@ [\\library ["[0]" /]]) -(documentation: /.e - "The base of the natural logarithm.") - -(documentation: /.pi - "The ratio of a circle's circumference to its diameter.") - -(documentation: /.tau - "The ratio of a circle's circumference to its radius.") - -(documentation: /.pow - "" - [(pow param subject)]) - -(documentation: /.atan_2 - "" - [(atan_2 x y)]) - -(documentation: /.log_by - "" - [(log_by base it)]) - (.def: .public documentation (.List $.Module) ($.module /._ - "Common mathematical constants and functions." - [..e - ..pi - ..tau - ..pow - ..atan_2 - ..log_by - ($.default /.cos) - ($.default /.sin) - ($.default /.tan) - ($.default /.acos) - ($.default /.asin) - ($.default /.atan) - ($.default /.exp) - ($.default /.log) - ($.default /.ceil) - ($.default /.floor) - ($.default /.root_2) - ($.default /.root_3) - ($.default /.round) - ($.default /.factorial) - ($.default /.hypotenuse) - ($.default /.sinh) - ($.default /.csch) - ($.default /.cosh) - ($.default /.sech) - ($.default /.tanh) - ($.default /.coth) - ($.default /.asinh) - ($.default /.acosh) - ($.default /.atanh) - ($.default /.acoth) - ($.default /.asech) - ($.default /.acsch)] + "" + [] [/infix.documentation /modulus.documentation /modular.documentation diff --git a/stdlib/source/documentation/lux/math/number/frac.lux b/stdlib/source/documentation/lux/math/number/frac.lux index 82023d59b..3378609bb 100644 --- a/stdlib/source/documentation/lux/math/number/frac.lux +++ b/stdlib/source/documentation/lux/math/number/frac.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" private} - ["$" documentation {"+" documentation:}] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" private} + ["$" documentation {"+" documentation:}] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.= "Frac(tion) equivalence." @@ -74,6 +74,27 @@ "" [(mod divisor dividend)]) +(documentation: /.e + "The base of the natural logarithm.") + +(documentation: /.pi + "The ratio of a circle's circumference to its diameter.") + +(documentation: /.tau + "The ratio of a circle's circumference to its radius.") + +(documentation: /.pow + "" + [(pow param subject)]) + +(documentation: /.atan_2 + "" + [(atan_2 x y)]) + +(documentation: /.log_by + "" + [(log_by base it)]) + (.def: .public documentation (.List $.Module) ($.module /._ @@ -121,5 +142,39 @@ ($.default /.binary) ($.default /.octal) ($.default /.hex) - ($.default /.hash)] + ($.default /.hash) + + ..e + ..pi + ..tau + ..pow + ..atan_2 + ..log_by + ($.default /.cos) + ($.default /.sin) + ($.default /.tan) + ($.default /.acos) + ($.default /.asin) + ($.default /.atan) + ($.default /.exp) + ($.default /.log) + ($.default /.ceil) + ($.default /.floor) + ($.default /.root_2) + ($.default /.root_3) + ($.default /.round) + ($.default /.factorial) + ($.default /.hypotenuse) + ($.default /.sinh) + ($.default /.csch) + ($.default /.cosh) + ($.default /.sech) + ($.default /.tanh) + ($.default /.coth) + ($.default /.asinh) + ($.default /.acosh) + ($.default /.atanh) + ($.default /.acoth) + ($.default /.asech) + ($.default /.acsch)] [])) diff --git a/stdlib/source/documentation/lux/target/js.lux b/stdlib/source/documentation/lux/target/js.lux index 5f1a28577..32c800816 100644 --- a/stdlib/source/documentation/lux/target/js.lux +++ b/stdlib/source/documentation/lux/target/js.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" char} + [lux "*" ["$" documentation {"+" documentation:}] [data [text {"+" \n} @@ -93,9 +93,5 @@ ($.default /.--) ($.default /.comment) ($.default /.switch) - ($.default /.cond) - ($.default /.apply_1) - ($.default /.not_a_number?) - ($.default /.apply_2) - ($.default /.apply_3)] + ($.default /.not_a_number?)] [])) diff --git a/stdlib/source/documentation/lux/target/lua.lux b/stdlib/source/documentation/lux/target/lua.lux index d0ce0ef3e..657caf75a 100644 --- a/stdlib/source/documentation/lux/target/lua.lux +++ b/stdlib/source/documentation/lux/target/lua.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" char} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) (.def: .public documentation (.List $.Module) @@ -28,7 +28,7 @@ ($.default /.Access) ($.default /.Label) ($.default /.nil) - ($.default /.bool) + ($.default /.boolean) ($.default /.int) ($.default /.float) ($.default /.string) @@ -38,7 +38,7 @@ ($.default /.item) ($.default /.the) ($.default /.length) - ($.default /.apply_*) + ($.default /.apply) ($.default /.do) ($.default /.=) ($.default /.<) @@ -83,18 +83,10 @@ ($.default /.break) ($.default /.set_label) ($.default /.go_to) - ($.default /.cond) - ($.default /.apply_1) - ($.default /.apply_2) - ($.default /.apply_3) - ($.default /.apply_4) - ($.default /.apply_5) ($.default /.error/1) ($.default /.print/1) ($.default /.require/1) ($.default /.type/1) ($.default /.ipairs/1) - ($.default /.print/2) - ($.default /.error/2) - ($.default /.print/3)] + ($.default /.error/2)] [])) diff --git a/stdlib/source/documentation/lux/target/python.lux b/stdlib/source/documentation/lux/target/python.lux index eeba814ae..4fa9c05e3 100644 --- a/stdlib/source/documentation/lux/target/python.lux +++ b/stdlib/source/documentation/lux/target/python.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" char} + [lux "*" ["$" documentation {"+" documentation:}] [data [text {"+" \n} @@ -27,7 +27,6 @@ ($.default /.Literal) ($.default /.Access) ($.default /.Loop) - ($.default /.Label) ($.default /.SVar) ($.default /.Single) ($.default /.PVar) @@ -49,13 +48,11 @@ ($.default /.slice) ($.default /.slice_from) ($.default /.dict) - ($.default /.apply_*) - ($.default /.apply_poly) - ($.default /.apply_keyword) + ($.default /.apply/*) + ($.default /.splat_poly) + ($.default /.splat_keyword) ($.default /.the) ($.default /.do) - ($.default /.do_poly) - ($.default /.do_keyword) ($.default /.item) ($.default /.?) ($.default /.is) @@ -101,10 +98,6 @@ ($.default /.def) ($.default /.import) ($.default /.comment) - ($.default /.cond) - ($.default /.apply_1) - ($.default /.apply_2) - ($.default /.apply_3) ($.default /.str/1) ($.default /.ord/1) ($.default /.float/1) diff --git a/stdlib/source/documentation/lux/target/ruby.lux b/stdlib/source/documentation/lux/target/ruby.lux index 7d7d5458f..f295a437e 100644 --- a/stdlib/source/documentation/lux/target/ruby.lux +++ b/stdlib/source/documentation/lux/target/ruby.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" char} + [lux "*" ["$" documentation {"+" documentation:}] [data [text {"+" \n} @@ -15,8 +15,8 @@ ($.module /._ "" [($.default /.Code) - ($.default /.code_equivalence) - ($.default /.code_hash) + ($.default /.equivalence) + ($.default /.hash) ($.default /.manual) ($.default /.code) ($.default /.Expression) @@ -40,7 +40,8 @@ ($.default /.splat) ($.default /.variadic_kv) ($.default /.double_splat) - ($.default /.latest_error) + ($.default /.latest_error_message) + ($.default /.latest_error_location) ($.default /.last_string_read) ($.default /.last_line_number_read) ($.default /.last_string_matched) @@ -61,7 +62,7 @@ ($.default /.array_range) ($.default /.array) ($.default /.hash) - ($.default /.apply_*) + ($.default /.apply/*) ($.default /.apply_lambda/*) ($.default /.the) ($.default /.item) @@ -105,13 +106,8 @@ ($.default /.opposite) ($.default /.comment) ($.default /.do) - ($.default /.cond) - ($.default /.apply_1) - ($.default /.apply_2) - ($.default /.apply_3) ($.default /.print/1) ($.default /.require/1) ($.default /.print/2) - ($.default /.print/3) ($.default /.throw/1)] [])) diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux index 153ed2a11..8cda0769a 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/analysis.lux @@ -1,35 +1,25 @@ (.using - [library - [lux {"-" char} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) (.def: .public documentation (.List $.Module) ($.module /._ "" - [($.default /.Primitive) - ($.default /.Tag) - ($.default /.Variant) - ($.default /.tag) - ($.default /.choice) - ($.default /.Tuple) - ($.default /.Composite) - ($.default /.Pattern) - ($.default /.Branch') + [($.default /.Branch') ($.default /.Match') ($.default /.Environment) ($.default /.Analysis) ($.default /.Branch) ($.default /.Match) - ($.default /.composite_equivalence) - ($.default /.composite_hash) ($.default /.equivalence) ($.default /.case) ($.default /.unit) @@ -39,27 +29,13 @@ ($.default /.rev) ($.default /.frac) ($.default /.text) - ($.default /.Abstraction) - ($.default /.Application) ($.default /.no_op) - ($.default /.apply) - ($.default /.application) ($.default /.variable) ($.default /.constant) - ($.default /.variable/local) - ($.default /.variable/foreign) - ($.default /.pattern/variant) - ($.default /.pattern/tuple) + ($.default /.local) + ($.default /.foreign) ($.default /.variant) ($.default /.tuple) - ($.default /.pattern/unit) - ($.default /.pattern/bit) - ($.default /.pattern/nat) - ($.default /.pattern/int) - ($.default /.pattern/rev) - ($.default /.pattern/frac) - ($.default /.pattern/text) - ($.default /.pattern/bind) ($.default /.format) ($.default /.State+) ($.default /.Operation) @@ -67,17 +43,13 @@ ($.default /.Handler) ($.default /.Bundle) ($.default /.with_source_code) - ($.default /.with_scope) - ($.default /.without_scopes) ($.default /.with_current_module) ($.default /.with_location) ($.default /.failure) ($.default /.except) ($.default /.assertion) - ($.default /.failure') - ($.default /.except') - ($.default /.with_stack) - ($.default /.install) + ($.default /.with_exception) + ($.default /.set_state) ($.default /.set_source_code) ($.default /.set_current_module) ($.default /.set_location) diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux index 0f3fb038e..e02893f28 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/generation.lux @@ -1,21 +1,20 @@ (.using - [library - [lux {"-" char} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) (.def: .public documentation (.List $.Module) ($.module /._ "" - [($.default /.Context) - ($.default /.Buffer) + [($.default /.Buffer) ($.default /.cannot_interpret) ($.default /.cannot_overwrite_output) ($.default /.no_buffer_for_saving_code) diff --git a/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux index 8603ace74..ada773fab 100644 --- a/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/documentation/lux/tool/compiler/language/lux/synthesis.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" char} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) (.def: .public documentation (.List $.Module) @@ -18,10 +18,6 @@ ($.default /.State) ($.default /.fresh_resolver) ($.default /.init) - ($.default /.Primitive) - ($.default /.Side) - ($.default /.Member) - ($.default /.Access) ($.default /.Fork) ($.default /.Path') ($.default /.Abstraction') @@ -78,11 +74,7 @@ ($.default /.%path') ($.default /.%synthesis) ($.default /.%path) - ($.default /.primitive_equivalence) - ($.default /.access_equivalence) - ($.default /.path'_equivalence) ($.default /.equivalence) - ($.default /.path_equivalence) ($.default /.hash) ($.default /.!bind_top) ($.default /.!multi_pop) diff --git a/stdlib/source/documentation/lux/world/file.lux b/stdlib/source/documentation/lux/world/file.lux index 7d4bddcc6..33b42c72b 100644 --- a/stdlib/source/documentation/lux/world/file.lux +++ b/stdlib/source/documentation/lux/world/file.lux @@ -71,11 +71,6 @@ ($.default /.cannot_delete) ($.default /.cannot_make_directory) ($.default /.cannot_find_directory) - ($.default /.cannot_read_all_data) - (~~ (for @.jvm (~~ (these ($.default /.cannot_modify_file) - ($.default /.default))) - @.js (~~ (these ($.default /.default))) - @.python (~~ (these ($.default /.default))) - @.ruby (~~ (these ($.default /.default))) - (~~ (these))))] + (~~ (for @.lua (~~ (these)) + (~~ (these ($.default /.default)))))] [/watch.documentation])))) diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 2ac3daa16..9a42e0735 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -251,7 +251,7 @@ text.new_line text.new_line (..description duration tally) text.new_line)] - _ (with_expansions [<else> (in (debug.log! report))] + _ (with_expansions [<else> (in {try.#Success (debug.log! report)})] (.for @.js (case console.default {.#None} <else> diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 9201b9cc2..c93c30c99 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -778,12 +778,13 @@ (do ! [_ (let [report (..module_compilation_log module state)] (with_expansions [<else> (in (debug.log! report))] - (for @.js (case console.default - {.#None} - <else> - - {.#Some console} - (console.write_line report console)) + (for @.js (is (Async (Try Any)) + (case console.default + {.#None} + <else> + + {.#Some console} + (console.write_line report console))) <else>))) .let [entry (has [archive.#module module.#descriptor descriptor.#references] all_dependencies entry)] _ (..cache_module context platform @module $.key $.writer (as (archive.Entry .Module) entry))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index 888c39155..61dc4713e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -9,7 +9,7 @@ ["<[0]>" code {"+" Parser}]]] [data [collection - ["[0]" array {"+" Array}] + ["[0]" array] ["[0]" dictionary] ["[0]" list]]] ["[0]" type @@ -32,11 +32,13 @@ [<code>.any (function (_ extension phase archive lengthC) (<| analysis/type.with_var - (function (_ [@var :var:])) + (function (_ [@read :read:])) + analysis/type.with_var + (function (_ [@write :write:])) (do phase.monad [lengthA (analysis/type.expecting Nat (phase archive lengthC)) - _ (analysis/type.inference (type (Array :var:)))] + _ (analysis/type.inference (type (array.Array' :read: :write:)))] (in {analysis.#Extension extension (list lengthA)}))))])) (def: array::length @@ -45,9 +47,11 @@ [<code>.any (function (_ extension phase archive arrayC) (<| analysis/type.with_var - (function (_ [@var :var:])) + (function (_ [@read :read:])) + analysis/type.with_var + (function (_ [@write :write:])) (do phase.monad - [arrayA (analysis/type.expecting (type (Array :var:)) + [arrayA (analysis/type.expecting (type (array.Array' :read: :write:)) (phase archive arrayC)) _ (analysis/type.inference Nat)] (in {analysis.#Extension extension (list arrayA)}))))])) @@ -58,13 +62,15 @@ [(<>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var - (function (_ [@var :var:])) + (function (_ [@read :read:])) + analysis/type.with_var + (function (_ [@write :write:])) (do phase.monad [indexA (analysis/type.expecting Nat (phase archive indexC)) - arrayA (analysis/type.expecting (type (Array :var:)) + arrayA (analysis/type.expecting (type (array.Array' :read: :write:)) (phase archive arrayC)) - _ (analysis/type.inference :var:)] + _ (analysis/type.inference :read:)] (in {analysis.#Extension extension (list indexA arrayA)}))))])) (def: array::write @@ -73,15 +79,17 @@ [($_ <>.and <code>.any <code>.any <code>.any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var - (function (_ [@var :var:])) + (function (_ [@read :read:])) + analysis/type.with_var + (function (_ [@write :write:])) (do phase.monad [indexA (analysis/type.expecting Nat (phase archive indexC)) - valueA (analysis/type.expecting :var: + valueA (analysis/type.expecting :write: (phase archive valueC)) - arrayA (analysis/type.expecting (type (Array :var:)) + arrayA (analysis/type.expecting (type (array.Array' :read: :write:)) (phase archive arrayC)) - _ (analysis/type.inference (type (Array :var:)))] + _ (analysis/type.inference (type (array.Array' :read: :write:)))] (in {analysis.#Extension extension (list indexA valueA arrayA)}))))])) (def: array::delete @@ -90,13 +98,15 @@ [($_ <>.and <code>.any <code>.any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var - (function (_ [@var :var:])) + (function (_ [@read :read:])) + analysis/type.with_var + (function (_ [@write :write:])) (do phase.monad [indexA (analysis/type.expecting Nat (phase archive indexC)) - arrayA (analysis/type.expecting (type (Array :var:)) + arrayA (analysis/type.expecting (type (array.Array' :read: :write:)) (phase archive arrayC)) - _ (analysis/type.inference (type (Array :var:)))] + _ (analysis/type.inference (type (array.Array' :read: :write:)))] (in {analysis.#Extension extension (list indexA arrayA)}))))])) (def: bundle::array diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index aaf9e27f4..0d59c7dd5 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -68,13 +68,14 @@ failure_description text.new_line error text.new_line)] (do ! - [_ (with_expansions [<else> (in (debug.log! report))] - (for @.js (case console.default - {.#None} - <else> + [_ (with_expansions [<else> (in {try.#Success (debug.log! report)})] + (for @.js (is (Async (Try Any)) + (case console.default + {.#None} + <else> - {.#Some console} - (console.write_line report console)) + {.#Some console} + (console.write_line report console))) <else>))] (io.run! (# world/program.default exit +1)))) diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index a32d5e4f2..f6dced3cb 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -134,6 +134,7 @@ (.|> <it> (.as (array.Array .Frac)) ("js array read" <index>) + (.as .Frac) "lux f64 i64" .i64) @@ -211,7 +212,8 @@ (.|> <value> .int ("lux i64 and" (.int <byte>)) - "lux i64 f64")) + "lux i64 f64" + .as_expected)) (.as ..Binary)) (~~ (.static @.python)) diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux index 7ad2f8a84..3fbd7d0ae 100644 --- a/stdlib/source/unsafe/lux/data/collection/array.lux +++ b/stdlib/source/unsafe/lux/data/collection/array.lux @@ -105,20 +105,19 @@ [((.is (.All (_ r w) (.-> .Nat (..Array' r w) r)) (.function (item index array) - (.for (~~ (.static @.old)) - ("jvm aaload" array index) - - (~~ (.static @.jvm)) - (.|> array - ("jvm array read object" (~~ (jvm_int index))) - .as_expected) + (.as_expected + (.for (~~ (.static @.old)) + ("jvm aaload" array index) - (~~ (.static @.js)) ("js array read" index array) - (~~ (.static @.python)) ("python array read" index array) - (~~ (.static @.lua)) ("lua array read" index array) - (~~ (.static @.ruby)) ("ruby array read" index array) - (~~ (.static @.php)) ("php array read" index array) - (~~ (.static @.scheme)) ("scheme array read" index array)))) + (~~ (.static @.jvm)) + ("jvm array read object" (~~ (jvm_int index)) array) + + (~~ (.static @.js)) ("js array read" index array) + (~~ (.static @.python)) ("python array read" index array) + (~~ (.static @.lua)) ("lua array read" index array) + (~~ (.static @.ruby)) ("ruby array read" index array) + (~~ (.static @.php)) ("php array read" index array) + (~~ (.static @.scheme)) ("scheme array read" index array))))) <index> <array>)])) (`` (template: .public (has! <index> <value> <array>) @@ -133,12 +132,12 @@ ("jvm array write object" (~~ (jvm_int index)) value) .as_expected) - (~~ (.static @.js)) ("js array write" index value array) - (~~ (.static @.python)) ("python array write" index value array) - (~~ (.static @.lua)) ("lua array write" index value array) - (~~ (.static @.ruby)) ("ruby array write" index value array) - (~~ (.static @.php)) ("php array write" index value array) - (~~ (.static @.scheme)) ("scheme array write" index value array)))) + (~~ (.static @.js)) ("js array write" index (.as_expected value) array) + (~~ (.static @.python)) ("python array write" index (.as_expected value) array) + (~~ (.static @.lua)) ("lua array write" index (.as_expected value) array) + (~~ (.static @.ruby)) ("ruby array write" index (.as_expected value) array) + (~~ (.static @.php)) ("php array write" index (.as_expected value) array) + (~~ (.static @.scheme)) ("scheme array write" index (.as_expected value) array)))) <index> <value> <array>)])) (`` (template: .public (lacks! <index> <array>) |