diff options
author | Eduardo Julian | 2019-04-07 00:50:04 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-04-07 00:50:04 -0400 |
commit | a61c3f2e7bc29c3224264317b14254fe93d503fe (patch) | |
tree | 0560c531001a9442e6861a8ff43289ae621beec3 /stdlib/source | |
parent | 2a05d8f3711d2e1b6fcccd9a2869478197386a7f (diff) |
- Upgrade the tuple left-access mechanism to the new style.
- Updated JS compiler.
- Updated Python compiler.
Diffstat (limited to 'stdlib/source')
29 files changed, 81 insertions, 65 deletions
diff --git a/stdlib/source/lux/tool/compiler/default/evaluation.lux b/stdlib/source/lux/tool/compiler/default/evaluation.lux index 5122237a8..55b20805f 100644 --- a/stdlib/source/lux/tool/compiler/default/evaluation.lux +++ b/stdlib/source/lux/tool/compiler/default/evaluation.lux @@ -1,6 +1,6 @@ (.module: [lux #* - [control + [abstract [monad (#+ do)]] [data ["." error] diff --git a/stdlib/source/lux/tool/compiler/default/init.lux b/stdlib/source/lux/tool/compiler/default/init.lux index 10476cfc5..8cea72d0e 100644 --- a/stdlib/source/lux/tool/compiler/default/init.lux +++ b/stdlib/source/lux/tool/compiler/default/init.lux @@ -1,8 +1,9 @@ (.module: [lux (#- Module) [type (#+ :share)] + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data ["." product] diff --git a/stdlib/source/lux/tool/compiler/default/platform.lux b/stdlib/source/lux/tool/compiler/default/platform.lux index 61b27dacf..164a81730 100644 --- a/stdlib/source/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/lux/tool/compiler/default/platform.lux @@ -1,7 +1,7 @@ (.module: [lux (#- Module) [type (#+ :share)] - [control + [abstract ["." monad (#+ Monad do)]] [data ["." bit] diff --git a/stdlib/source/lux/tool/compiler/default/syntax.lux b/stdlib/source/lux/tool/compiler/default/syntax.lux index 512c19246..c15b68f1c 100644 --- a/stdlib/source/lux/tool/compiler/default/syntax.lux +++ b/stdlib/source/lux/tool/compiler/default/syntax.lux @@ -26,8 +26,9 @@ ## location, which is helpful for documentation and debugging. (.module: [lux #* + [abstract + monad] [control - monad ["ex" exception (#+ exception:)]] [data ["." error (#+ Error)] diff --git a/stdlib/source/lux/tool/compiler/meta/io/context.lux b/stdlib/source/lux/tool/compiler/meta/io/context.lux index c9f52cc76..e64a5d7b8 100644 --- a/stdlib/source/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/lux/tool/compiler/meta/io/context.lux @@ -1,7 +1,8 @@ (.module: [lux (#- Module Code) + [abstract + [monad (#+ Monad do)]] [control - [monad (#+ Monad do)] ["ex" exception (#+ Exception exception:)] [security ["!" capability]]] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis.lux b/stdlib/source/lux/tool/compiler/phase/analysis.lux index f12ab301e..d21effc00 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + [monad (#+ do)]] [control - [monad (#+ do)] ["ex" exception (#+ exception:)]] [data ["." error] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/case.lux b/stdlib/source/lux/tool/compiler/phase/analysis/case.lux index a2864e784..2aa4a57ca 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/case.lux @@ -1,7 +1,8 @@ (.module: [lux (#- case) + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data ["." product] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux b/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux index cb7cc07ef..e2d355881 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/case/coverage.lux @@ -1,9 +1,10 @@ (.module: [lux #* + [abstract + equivalence + ["." monad (#+ do)]] [control - ["." monad (#+ do)] - ["ex" exception (#+ exception:)] - equivalence] + ["ex" exception (#+ exception:)]] [data ["." bit ("#;." equivalence)] ["." error (#+ Error) ("#;." monad)] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/function.lux b/stdlib/source/lux/tool/compiler/phase/analysis/function.lux index 690ee2658..15842dcee 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/function.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/function.lux @@ -1,7 +1,8 @@ (.module: [lux (#- function) + [abstract + monad] [control - monad ["ex" exception (#+ exception:)]] [data ["." maybe] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux index 57b9ed357..6f9cc4039 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/inference.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + [monad (#+ do)]] [control - [monad (#+ do)] ["ex" exception (#+ exception:)]] [data ["." maybe] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/module.lux b/stdlib/source/lux/tool/compiler/phase/analysis/module.lux index db02af343..c93d096c8 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/module.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/module.lux @@ -1,9 +1,10 @@ (.module: [lux #* + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] - ["ex" exception (#+ exception:)] - pipe] + pipe + ["ex" exception (#+ exception:)]] [data ["." text ("#@." equivalence) format] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux b/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux index b42065f8f..766dc6616 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/primitive.lux @@ -1,6 +1,6 @@ (.module: [lux (#- nat int rev) - [control + [abstract monad]] ["." // #_ ["#." type] diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux index dd5fd08e6..79d2c9ebd 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/reference.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + monad] [control - monad ["ex" exception (#+ exception:)]] ["." macro] [data diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux b/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux index 8383ae615..abf8f2a04 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/scope.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + monad] [control - monad ["ex" exception (#+ exception:)]] [data ["." text ("#;." equivalence) diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux b/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux index da8f0dee4..3ee1def4d 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/structure.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] ["ex" exception (#+ exception:)] ["." state]] [data diff --git a/stdlib/source/lux/tool/compiler/phase/analysis/type.lux b/stdlib/source/lux/tool/compiler/phase/analysis/type.lux index 5a7db6516..522e3f450 100644 --- a/stdlib/source/lux/tool/compiler/phase/analysis/type.lux +++ b/stdlib/source/lux/tool/compiler/phase/analysis/type.lux @@ -1,10 +1,11 @@ (.module: [lux #* - [control + [abstract [monad (#+ do)]] + [control + ["." function]] [data ["." error]] - ["." function] [type ["." check (#+ Check)]] ["." macro]] diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux index 9940273cc..71ecd5d8a 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux @@ -1,7 +1,9 @@ (.module: [lux #* - [control + [abstract ["." monad (#+ do)]] + [control + [io (#+ IO)]] [data ["." text format] @@ -10,8 +12,7 @@ ["." dictionary (#+ Dictionary)]]] [type ["." check]] - ["." macro] - [io (#+ IO)]] + ["." macro]] ["." /// ["#." bundle] ["#/" // diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux index abace9a94..82df857b9 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/host.jvm.lux @@ -1,7 +1,8 @@ (.module: [lux (#- char int) + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] ["p" parser] ["ex" exception (#+ exception:)] pipe] diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux index ecba5d158..f5c52bfc4 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux @@ -1,8 +1,9 @@ (.module: [lux #* - [io (#+ IO)] + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] + [io (#+ IO)] ["p" parser]] [data ["." error] diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux index 86c7197ec..f426dd6ff 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/case.lux @@ -46,7 +46,7 @@ (wrap (list@fold (function (_ [idx tail?] source) (.let [method (.if tail? //runtime.product//right - //runtime.product//left)] + //runtime.tuple//left)] (method source (_.i32 (.int idx))))) valueO pathP)))) @@ -168,7 +168,7 @@ (^template [<pm> <getter> <prep>] (^ (<pm> idx)) (////@wrap (|> idx <prep> .int _.i32 (<getter> ..peek-cursor) push-cursor!))) - ([/////synthesis.member/left //runtime.product//left (<|)] + ([/////synthesis.member/left //runtime.tuple//left (<|)] [/////synthesis.member/right //runtime.product//right inc]) (^ (/////synthesis.!bind-top register thenP)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux b/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux index 4fba47218..43dcbe716 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/js/runtime.lux @@ -177,19 +177,16 @@ @lux//program-args )) -(runtime: (product//left product index) - (with-vars [index-min-length] +(runtime: (tuple//left tuple lefts) + (with-vars [index-right] ($_ _.then - (_.define index-min-length (_.+ (_.i32 +1) index)) - (_.if (_.< (..length product) - index-min-length) - ## No need for recursion. - (_.return (_.at index product)) - ## Needs recursion. - (_.return (product//left (last-element product) - (_.- (..length product) - index-min-length))) - )))) + (_.define index-right (..last-index tuple)) + (_.if (_.> lefts index-right) + ## No need for recursion + (_.return (_.at lefts tuple)) + ## Needs recursion + (_.return (tuple//left (_.at index-right tuple) + (_.- index-right lefts))))))) (runtime: (product//right product index) (with-vars [index-min-length] @@ -234,7 +231,7 @@ (def: runtime//structure Statement ($_ _.then - @product//left + @tuple//left @product//right @sum//get )) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux b/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux index 359cfdb3b..6e4988b9b 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python/case.lux @@ -50,7 +50,7 @@ (wrap (list@fold (function (_ [idx tail?] source) (.let [method (.if tail? //runtime.product//right - //runtime.product//left)] + //runtime.tuple//left)] (method source (_.int (.int idx))))) valueO pathP)))) @@ -162,7 +162,7 @@ (^template [<pm> <getter> <prep>] (^ (<pm> idx)) (////@wrap (|> idx <prep> .int _.int (<getter> ..peek-cursor) push-cursor!))) - ([/////synthesis.member/left //runtime.product//left (<|)] + ([/////synthesis.member/left //runtime.tuple//left (<|)] [/////synthesis.member/right //runtime.product//right inc]) (^ (/////synthesis.!bind-top register thenP)) diff --git a/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux b/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux index d095e9fe2..c4a1a6da2 100644 --- a/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux +++ b/stdlib/source/lux/tool/compiler/phase/generation/python/runtime.lux @@ -180,19 +180,17 @@ @io//exit! @io//current-time!)) -(runtime: (product//left product index) - (with-vars [index-min-length] +(runtime: (tuple//left tuple lefts) + (with-vars [index-right] ($_ _.then - (_.set (list index-min-length) (_.+ (_.int +1) index)) - (_.if (_.> index-min-length (_.len/1 product)) + (_.set (list index-right) (_.- (_.int +1) + (_.len/1 tuple))) + (_.if (_.> lefts index-right) ## No need for recursion - (_.return (_.nth index product)) + (_.return (_.nth lefts tuple)) ## Needs recursion - (_.return (product//left (_.nth (_.- (_.int +1) - (_.len/1 product)) - product) - (_.- (_.len/1 product) - index-min-length))))))) + (_.return (tuple//left (_.nth index-right tuple) + (_.- index-right lefts))))))) (runtime: (product//right product index) (with-vars [index-min-length] @@ -238,7 +236,7 @@ (def: runtime//adt (Statement Any) ($_ _.then - @product//left + @tuple//left @product//right @sum//get)) diff --git a/stdlib/source/lux/tool/compiler/phase/macro.lux b/stdlib/source/lux/tool/compiler/phase/macro.lux index a8428a1ac..dbc201ca3 100644 --- a/stdlib/source/lux/tool/compiler/phase/macro.lux +++ b/stdlib/source/lux/tool/compiler/phase/macro.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + [monad (#+ do)]] [control - [monad (#+ do)] ["." exception (#+ exception:)]] [data ["." error (#+ Error)] diff --git a/stdlib/source/lux/tool/compiler/phase/statement.lux b/stdlib/source/lux/tool/compiler/phase/statement.lux index 1ab3d41ef..1660fdf01 100644 --- a/stdlib/source/lux/tool/compiler/phase/statement.lux +++ b/stdlib/source/lux/tool/compiler/phase/statement.lux @@ -1,7 +1,8 @@ (.module: [lux #* + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] ["." exception (#+ exception:)]] [data [text diff --git a/stdlib/source/lux/tool/compiler/phase/synthesis.lux b/stdlib/source/lux/tool/compiler/phase/synthesis.lux index 3da088ccf..0e01c0f68 100644 --- a/stdlib/source/lux/tool/compiler/phase/synthesis.lux +++ b/stdlib/source/lux/tool/compiler/phase/synthesis.lux @@ -1,7 +1,8 @@ (.module: [lux (#- primitive) + [abstract + ["." monad (#+ do)]] [control - ["." monad (#+ do)] [pipe (#+ case>)]] [data ["." maybe] diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux index 0e996cb5a..a5a0c7b06 100644 --- a/stdlib/source/lux/world/console.lux +++ b/stdlib/source/lux/world/console.lux @@ -1,8 +1,10 @@ (.module: [lux #* + [abstract + [monad (#+ do)]] [control - [monad (#+ do)] ["ex" exception (#+ exception:)] + ["." io (#+ IO io)] [concurrency ["." promise (#+ Promise)]] [security @@ -11,7 +13,6 @@ ["." error (#+ Error)] ["." text format]] - ["." io (#+ IO io)] [host (#+ import:)] [tool [compiler diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 727941fde..a92aea013 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -1,10 +1,11 @@ (.module: [lux #* [type (#+ :share)] - [cli (#+ program:)] - ["." io (#+ IO io)] + [abstract + [monad (#+ do)]] [control - [monad (#+ do)] + [cli (#+ program:)] + ["." io (#+ IO io)] [security ["!" capability]]] [data diff --git a/stdlib/source/program/compositor/cli.lux b/stdlib/source/program/compositor/cli.lux index 5c8e697a1..8df1cc839 100644 --- a/stdlib/source/program/compositor/cli.lux +++ b/stdlib/source/program/compositor/cli.lux @@ -1,8 +1,8 @@ (.module: [lux #* [control - ["p" parser]] - ["." cli (#+ CLI)] + ["p" parser] + ["." cli (#+ CLI)]] [world [file (#+ Path)]]] ## [/// |