From a02b7bf8ff358ccfa35b03272d28537aeac723ae Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Nov 2020 19:45:56 -0400 Subject: Added "private" macro to lux/debug. --- documentation/bookmark/Package.md | 5 + documentation/bookmark/Pattern.md | 5 + documentation/bookmark/back-end/JavaScript.md | 9 + documentation/bookmark/back-end/native.md | 8 + documentation/bookmark/database.md | 5 + documentation/bookmark/distributed_programming.md | 2 + documentation/bookmark/game_programming.md | 9 +- documentation/bookmark/math.md | 6 + documentation/bookmark/methodology.md | 1 + .../paradigm/Plugin Oriented Programming.md | 4 + documentation/bookmark/web_framework.md | 1 + stdlib/source/lux/control/concatenative.lux | 20 +- stdlib/source/lux/control/concurrency/actor.lux | 16 +- stdlib/source/lux/control/concurrency/frp.lux | 12 +- stdlib/source/lux/control/region.lux | 4 +- stdlib/source/lux/control/security/capability.lux | 4 +- stdlib/source/lux/data/collection/dictionary.lux | 16 +- stdlib/source/lux/data/format/css/style.lux | 7 +- stdlib/source/lux/data/format/json.lux | 216 ++++++++++++-------- stdlib/source/lux/debug.lux | 13 +- stdlib/source/lux/host.jvm.lux | 193 +++++++++--------- stdlib/source/lux/meta/annotation.lux | 5 +- stdlib/source/lux/time/instant.lux | 10 +- .../language/lux/phase/analysis/function.lux | 6 +- .../language/lux/phase/analysis/module.lux | 12 +- .../tool/compiler/language/lux/phase/extension.lux | 6 +- .../language/lux/phase/extension/analysis/jvm.lux | 212 ++++++++++---------- .../language/lux/phase/extension/analysis/lux.lux | 6 +- .../language/lux/phase/extension/directive/jvm.lux | 26 +-- .../language/lux/phase/extension/directive/lux.lux | 2 +- .../lux/phase/extension/generation/js/common.lux | 4 +- .../lux/phase/extension/generation/jvm/common.lux | 14 +- .../lux/phase/extension/generation/jvm/host.lux | 56 +++--- .../tool/compiler/language/lux/phase/synthesis.lux | 12 +- .../lux/tool/compiler/language/lux/synthesis.lux | 68 +++---- stdlib/source/lux/world/shell.lux | 23 ++- stdlib/source/program/aedifex.lux | 22 +- stdlib/source/program/aedifex/artifact.lux | 4 +- stdlib/source/program/aedifex/command/auto.lux | 61 +++--- stdlib/source/program/aedifex/command/build.lux | 114 ++++++----- stdlib/source/program/aedifex/command/deploy.lux | 4 +- stdlib/source/program/aedifex/command/pom.lux | 4 +- stdlib/source/program/aedifex/command/test.lux | 36 ++-- stdlib/source/program/aedifex/format.lux | 14 +- stdlib/source/program/aedifex/package.lux | 4 +- stdlib/source/program/aedifex/pom.lux | 32 +-- stdlib/source/program/aedifex/profile.lux | 16 +- stdlib/source/program/aedifex/project.lux | 4 +- stdlib/source/program/aedifex/repository.lux | 4 +- stdlib/source/program/compositor.lux | 7 +- stdlib/source/program/compositor/export.lux | 2 +- stdlib/source/program/compositor/import.lux | 4 +- stdlib/source/program/scriptum.lux | 72 +++---- stdlib/source/spec/compositor/analysis/type.lux | 4 - stdlib/source/spec/compositor/generation/case.lux | 10 +- .../source/spec/compositor/generation/common.lux | 18 +- .../source/spec/compositor/generation/function.lux | 12 +- .../spec/compositor/generation/primitive.lux | 8 +- .../spec/compositor/generation/structure.lux | 8 +- stdlib/source/spec/lux/world/shell.lux | 7 +- stdlib/source/test/aedifex.lux | 4 +- stdlib/source/test/aedifex/command/build.lux | 147 ++++++++++++++ stdlib/source/test/licentia.lux | 34 ++-- stdlib/source/test/lux/control/concatenative.lux | 2 +- stdlib/source/test/lux/data.lux | 2 +- stdlib/source/test/lux/data/collection/array.lux | 77 ++++--- stdlib/source/test/lux/data/format/json.lux | 222 ++++++++++++++++----- stdlib/source/test/lux/host.js.lux | 16 +- stdlib/source/test/lux/locale.lux | 18 +- stdlib/source/test/lux/macro/code.lux | 52 ++--- stdlib/source/test/lux/macro/syntax/common.lux | 4 +- stdlib/source/test/lux/type.lux | 32 +-- stdlib/source/test/lux/type/check.lux | 42 ++-- stdlib/source/test/lux/type/implicit.lux | 8 +- stdlib/source/test/lux/world/shell.lux | 51 +++-- 75 files changed, 1319 insertions(+), 881 deletions(-) create mode 100644 documentation/bookmark/Package.md create mode 100644 documentation/bookmark/Pattern.md create mode 100644 documentation/bookmark/back-end/JavaScript.md create mode 100644 documentation/bookmark/paradigm/Plugin Oriented Programming.md create mode 100644 stdlib/source/test/aedifex/command/build.lux diff --git a/documentation/bookmark/Package.md b/documentation/bookmark/Package.md new file mode 100644 index 000000000..b58cc3221 --- /dev/null +++ b/documentation/bookmark/Package.md @@ -0,0 +1,5 @@ +# Repository + +1. [WebAssembly Package Manager](https://wapm.io/) +1. [About GitHub Packages](https://docs.github.com/en/free-pro-team@latest/packages/publishing-and-managing-packages/about-github-packages#supported-clients-and-formats) + diff --git a/documentation/bookmark/Pattern.md b/documentation/bookmark/Pattern.md new file mode 100644 index 000000000..0a7569078 --- /dev/null +++ b/documentation/bookmark/Pattern.md @@ -0,0 +1,5 @@ +# Reference + +1. [Patterns of Software: Tales from the Software Community](https://dreamsongs.com/Files/PatternsOfSoftware.pdf) +1. [Gerald Jay Sussman on Flexible Systems, The Power of Generic Operations](https://vimeo.com/151465912) + diff --git a/documentation/bookmark/back-end/JavaScript.md b/documentation/bookmark/back-end/JavaScript.md new file mode 100644 index 000000000..f3c57b57f --- /dev/null +++ b/documentation/bookmark/back-end/JavaScript.md @@ -0,0 +1,9 @@ +# Debugging + +1. [The JavaScript Self-Profiling API](https://addyosmani.com/blog/js-self-profiling/) + +# Number + +1. [BigInt: arbitrary-precision integers in JavaScript](https://v8.dev/features/bigint) +1. [WebAssembly integration with JavaScript BigInt](https://v8.dev/features/wasm-bigint) + diff --git a/documentation/bookmark/back-end/native.md b/documentation/bookmark/back-end/native.md index ec1ba689d..32da388c9 100644 --- a/documentation/bookmark/back-end/native.md +++ b/documentation/bookmark/back-end/native.md @@ -1,3 +1,11 @@ +# Java + +1. [Java Grinder](https://www.mikekohn.net/micro/java_grinder.php) + +# Register allocation + +1. [A Quick Introduction to Register Allocation](https://hassamuddin.com/blog/reg-alloc/) + # Call stack 1. http://stffrdhrn.github.io/software/embedded/openrisc/2018/06/08/gcc_stack_frames.html diff --git a/documentation/bookmark/database.md b/documentation/bookmark/database.md index 2152dd124..765f5ba0f 100644 --- a/documentation/bookmark/database.md +++ b/documentation/bookmark/database.md @@ -1,3 +1,7 @@ +# Pagination + +1. [Pagination with Relative Cursors](https://shopify.engineering/pagination-relative-cursors) + # Reference 1. ["Temporal Databases for Streaming Architectures" by Jeremy Taylor and Jon Pither](https://www.youtube.com/watch?v=ykbYNBE-V3k) @@ -15,6 +19,7 @@ # Query +1. [Reasons why SELECT * is bad for SQL performance](https://tanelpoder.com/posts/reasons-why-select-star-is-bad-for-sql-performance/) 1. [A Short Story About SQL’s Biggest Rival](https://www.holistics.io/blog/quel-vs-sql/) 1. https://calcite.apache.org/ 1. https://juxt.pro/blog/crux-sql diff --git a/documentation/bookmark/distributed_programming.md b/documentation/bookmark/distributed_programming.md index 916bdfcea..57802f081 100644 --- a/documentation/bookmark/distributed_programming.md +++ b/documentation/bookmark/distributed_programming.md @@ -59,6 +59,7 @@ # Programming language +1. [Choral: a choreographic programming language](https://www.choral-lang.org/) 1. ["Unison: a new distributed programming language" by Paul Chiusano](https://www.youtube.com/watch?v=gCWtkvDQ2ZI) 1. http://radicle.xyz/ 1. [Lambda World 2018 - Introduction to the Unison programming language - Rúnar Bjarnason](https://www.youtube.com/watch?v=rp_Eild1aq8) @@ -83,6 +84,7 @@ # Logical clock +1. [Interval Tree Clocks](https://ferd.ca/interval-tree-clocks.html) 1. [Version Vectors are not Vector Clocks](https://haslab.wordpress.com/2011/07/08/version-vectors-are-not-vector-clocks/) 1. [Distributed Systems: Physical, Logical, and Vector Clocks](https://levelup.gitconnected.com/distributed-systems-physical-logical-and-vector-clocks-7ca989f5f780) 1. [The Bloom Clock](https://arxiv.org/pdf/1905.13064.pdf) diff --git a/documentation/bookmark/game_programming.md b/documentation/bookmark/game_programming.md index 03efdc258..bb07c4bc3 100644 --- a/documentation/bookmark/game_programming.md +++ b/documentation/bookmark/game_programming.md @@ -1,3 +1,11 @@ +# Board game + +1. [Ludology](https://ludology.libsyn.com/) + +# Pattern + +1. [Game Programming Patterns](http://gameprogrammingpatterns.com/) + # Path finding 1. [Friday Facts #317 - New pathfinding algorithm](https://factorio.com/blog/post/fff-317) @@ -91,7 +99,6 @@ 1. http://www.jagregory.com/abrash-black-book/ 1. http://docs.godotengine.org/en/3.0/tutorials/math/rotations.html 1. http://www.essentialmath.com/ -1. http://gameprogrammingpatterns.com/ 1. http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/ 1. https://github.com/Dvergar/awesome-haxe-gamedev diff --git a/documentation/bookmark/math.md b/documentation/bookmark/math.md index 36f19a3cf..a91f3d788 100644 --- a/documentation/bookmark/math.md +++ b/documentation/bookmark/math.md @@ -1,3 +1,7 @@ +# Arithmetic + +1. [The Definitive Higher Math Guide on Integer Long Division (and Its Variants)](https://mathvault.ca/long-division/) + # Tensor calculus 1. [Introduction to Tensor Calculus](http://www.ita.uni-heidelberg.de/~dullemond/lectures/tensor/tensor.pdf) @@ -63,6 +67,7 @@ # Quaternions +1. [Maths - Quaternions](http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm) 1. [Dual Quaternions for Mere Mortals](https://www.jeremyong.com/math/2019/08/05/dual-quaternions-for-mere-mortals/) 1. [Stepping into a New Dimension: Using Quaternions to See the Invisible](https://medium.com/@vieyrasoftware/stepping-into-a-new-dimension-using-quaternions-to-see-the-invisible-478087c9ebbf) 1. [How Quaternions Produce 3D Rotation](https://penguinmaths.blogspot.com/2019/06/how-quaternions-produce-3d-rotation.html) @@ -169,6 +174,7 @@ # Geometric Algebra | Clifford Algebra +1. [Geometric Algebra](https://arxiv.org/abs/1205.5935) 1. [A Swift Introduction to Geometric Algebra](https://www.youtube.com/watch?v=60z_hpEAtD8) 1. [Euclidean Geometry and Geometric Algebra](http://geometry.mrao.cam.ac.uk/2020/06/euclidean-geometry-and-geometric-algebra/) 1. [Plane-based Geometric Algebra for Computer Science](https://bivector.net/PGA4CS.html) diff --git a/documentation/bookmark/methodology.md b/documentation/bookmark/methodology.md index 81b7b959b..63e770046 100644 --- a/documentation/bookmark/methodology.md +++ b/documentation/bookmark/methodology.md @@ -1,4 +1,5 @@ # Reference +1. [Managing developer identities in autonomous teams](https://kislayverma.com/organizations/managing-developer-identities-in-autonomous-teams/) 1. [Risk-First](https://riskfirst.org/) diff --git a/documentation/bookmark/paradigm/Plugin Oriented Programming.md b/documentation/bookmark/paradigm/Plugin Oriented Programming.md new file mode 100644 index 000000000..a41e8f102 --- /dev/null +++ b/documentation/bookmark/paradigm/Plugin Oriented Programming.md @@ -0,0 +1,4 @@ +# Reference + +1. [pop](https://gitlab.com/saltstack/pop/pop) + diff --git a/documentation/bookmark/web_framework.md b/documentation/bookmark/web_framework.md index 2e0e54977..741895072 100644 --- a/documentation/bookmark/web_framework.md +++ b/documentation/bookmark/web_framework.md @@ -146,6 +146,7 @@ # Rendering +1. [Incrementally Improving The DOM](https://blog.functorial.com/posts/2018-04-08-Incrementally-Improving-The-DOM.html) 1. https://medium.com/@ryansolid/the-fastest-way-to-render-the-dom-e3b226b15ca3 1. https://github.com/Famous/engine 1. https://redom.js.org/ diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index dabd82b7d..605539376 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -3,11 +3,11 @@ [abstract ["." monad]] [data - ["." maybe ("#@." monad)] + ["." maybe ("#\." monad)] ["." text ["%" format (#+ format)]] [collection - ["." list ("#@." fold functor)]] + ["." list ("#\." fold functor)]] [number ["n" nat] ["i" int] @@ -21,7 +21,7 @@ ["csr" reader] ["csw" writer]]]]] [// - ["<>" parser ("#@." monad) + ["<>" parser ("#\." monad) ["" code (#+ Parser)]]]) (type: Alias [Text Code]) @@ -45,12 +45,12 @@ (Parser Stack) (<>.either (<>.and (<>.maybe bottom^) (.tuple (<>.some .any))) - (<>.and (|> bottom^ (<>@map (|>> #.Some))) - (<>@wrap (list))))) + (<>.and (|> bottom^ (<>\map (|>> #.Some))) + (<>\wrap (list))))) (def: (stack-fold tops bottom) (-> (List Code) Code Code) - (list@fold (function (_ top bottom) + (list\fold (function (_ top bottom) (` [(~ bottom) (~ top)])) bottom tops)) @@ -65,18 +65,18 @@ _ (meta.fail (format "Cannot expand to more than a single AST/Code node:" text.new-line - (|> expansion (list@map %.code) (text.join-with " "))))))) + (|> expansion (list\map %.code) (text.join-with " "))))))) (syntax: #export (=> {aliases aliases^} {inputs stack^} {outputs stack^}) (let [de-alias (function (_ aliased) - (list@fold (function (_ [from to] pre) + (list\fold (function (_ [from to] pre) (code.replace (code.local-identifier from) to pre)) aliased aliases))] - (case [(|> inputs (get@ #bottom) (maybe@map (|>> code.nat (~) #.Parameter (`)))) - (|> outputs (get@ #bottom) (maybe@map (|>> code.nat (~) #.Parameter (`))))] + (case [(|> inputs (get@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`)))) + (|> outputs (get@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))] [(#.Some bottomI) (#.Some bottomO)] (monad.do meta.monad [inputC (singleton (meta.expand-all (stack-fold (get@ #top inputs) bottomI))) diff --git a/stdlib/source/lux/control/concurrency/actor.lux b/stdlib/source/lux/control/concurrency/actor.lux index aa30efa76..97c080273 100644 --- a/stdlib/source/lux/control/concurrency/actor.lux +++ b/stdlib/source/lux/control/concurrency/actor.lux @@ -7,7 +7,7 @@ ["." function] ["." try (#+ Try)] ["." exception (#+ exception:)] - ["." io (#+ IO io) ("#@." monad)] + ["." io (#+ IO io)] ["<>" parser ["" code (#+ Parser)]]] [data @@ -17,7 +17,7 @@ [text ["%" format (#+ format)]] [collection - ["." list ("#@." monoid monad fold)]]] + ["." list ("#\." monoid monad fold)]]] [macro ["." code] [syntax (#+ syntax:) @@ -30,7 +30,7 @@ ["." abstract (#+ abstract: :representation :abstraction)]]] [// ["." atom (#+ Atom atom)] - ["." promise (#+ Promise Resolver) ("#@." monad)] + ["." promise (#+ Promise Resolver) ("#\." monad)] ["." frp (#+ Channel)]]) (exception: #export poisoned) @@ -200,7 +200,7 @@ (def: (default-on-stop cause state) (All [s] (-> Text s (Promise Any))) - (promise@wrap [])) + (promise\wrap [])) (def: #export default (All [s] (Behavior s s)) @@ -312,7 +312,7 @@ (do meta.monad [g!type (meta.gensym (format name "-abstract-type")) #let [g!actor (code.local-identifier name) - g!vars (list@map code.local-identifier vars)]] + g!vars (list\map code.local-identifier vars)]] (wrap (list (` ((~! abstract:) (~+ (csw.export export)) ((~ g!type) (~+ g!vars)) (~ state-type) @@ -376,9 +376,9 @@ #let [g!type (code.local-identifier (get@ #abstract.name actor-scope)) g!message (code.local-identifier (get@ #name signature)) g!actor-vars (get@ #abstract.type-vars actor-scope) - g!all-vars (|> (get@ #vars signature) (list@map code.local-identifier) (list@compose g!actor-vars)) - g!inputsC (|> (get@ #inputs signature) (list@map product.left)) - g!inputsT (|> (get@ #inputs signature) (list@map product.right)) + g!all-vars (|> (get@ #vars signature) (list\map code.local-identifier) (list\compose g!actor-vars)) + g!inputsC (|> (get@ #inputs signature) (list\map product.left)) + g!inputsT (|> (get@ #inputs signature) (list\map product.right)) g!state (|> signature (get@ #state) code.local-identifier) g!self (|> signature (get@ #self) code.local-identifier)]] (wrap (list (` (def: (~+ (csw.export export)) ((~ g!message) (~+ g!inputsC)) diff --git a/stdlib/source/lux/control/concurrency/frp.lux b/stdlib/source/lux/control/concurrency/frp.lux index fdec66a61..f4dbffe81 100644 --- a/stdlib/source/lux/control/concurrency/frp.lux +++ b/stdlib/source/lux/control/concurrency/frp.lux @@ -11,14 +11,12 @@ ["." exception (#+ exception:)] ["." io (#+ IO io)]] [data - ["." maybe ("#@." functor)] - [collection - ["." list ("#@." monoid)]]] + ["." maybe ("#\." functor)]] [type (#+ :share) abstract]] [// ["." atom (#+ Atom)] - ["." promise (#+ Promise) ("#@." functor)]]) + ["." promise (#+ Promise) ("#\." functor)]]) (type: #export (Channel a) {#.doc "An asynchronous channel to distribute values."} @@ -89,8 +87,8 @@ (Functor Channel) (def: (map f) - (promise@map - (maybe@map + (promise\map + (maybe\map (function (_ [head tail]) [(f head) (map f tail)]))))) @@ -185,7 +183,7 @@ (def: #export (from-promise promise) (All [a] (-> (Promise a) (Channel a))) - (promise@map (function (_ value) + (promise\map (function (_ value) (#.Some [value ..empty])) promise)) diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux index 9965aee3e..f1bfd2c21 100644 --- a/stdlib/source/lux/control/region.lux +++ b/stdlib/source/lux/control/region.lux @@ -10,7 +10,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#@." fold)]]]] + ["." list ("#\." fold)]]]] [// ["." exception (#+ Exception exception:)]]) @@ -58,7 +58,7 @@ [[cleaners output] (computation [[] (list)]) results (monad.map ! (function (_ cleaner) (cleaner [])) cleaners)] - (wrap (list@fold combine-outcomes output results)))) + (wrap (list\fold combine-outcomes output results)))) (def: #export (acquire Monad cleaner value) (All [m a] (-> (Monad m) (-> a (m (Try Any))) a diff --git a/stdlib/source/lux/control/security/capability.lux b/stdlib/source/lux/control/security/capability.lux index cd9d7b202..be117d5bf 100644 --- a/stdlib/source/lux/control/security/capability.lux +++ b/stdlib/source/lux/control/security/capability.lux @@ -12,7 +12,7 @@ [text ["%" format (#+ format)]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [type abstract] ["." meta] @@ -56,7 +56,7 @@ (~ (writer.declaration declaration)) (~ capability))) (` (def: (~ (code.local-identifier forge)) - (All [(~+ (list@map code.local-identifier vars))] + (All [(~+ (list\map code.local-identifier vars))] (-> (-> (~ input) (~ output)) (~ capability))) (~! ..forge))) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index f56d314a8..34b1d8217 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -683,17 +683,17 @@ (structure: #export (equivalence (^open ",@.")) (All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v)))) - (def: (= test subject) - (and (n.= (size test) - (size subject)) - (list.every? (function (_ k) - (case [(get k test) (get k subject)] - [(#.Some tk) (#.Some sk)] - (,@= tk sk) + (def: (= reference subject) + (and (n.= (..size reference) + (..size subject)) + (list.every? (function (_ [k rv]) + (case (..get k subject) + (#.Some sv) + (,@= rv sv) _ #0)) - (keys test))))) + (..entries reference))))) (structure: functor' (All [k] (Functor (Node k))) diff --git a/stdlib/source/lux/data/format/css/style.lux b/stdlib/source/lux/data/format/css/style.lux index fbcab6700..487ad5e9d 100644 --- a/stdlib/source/lux/data/format/css/style.lux +++ b/stdlib/source/lux/data/format/css/style.lux @@ -14,9 +14,12 @@ {#.doc "The style associated with a CSS selector."} - (def: #export empty Style (:abstraction "")) + (def: #export empty + Style + (:abstraction "")) - (def: #export separator " ") + (def: #export separator + " ") (def: #export (with [property value]) (All [brand] diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 7fae80334..a5611a7c3 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -1,34 +1,36 @@ (.module: {#.doc (.doc "Functionality for reading and writing values in the JSON format." "For more information, please see: http://www.json.org/")} [lux #* + ["." meta (#+ monad with-gensyms)] [abstract - ["." monad (#+ do)] [equivalence (#+ Equivalence)] - codec] + [codec (#+ Codec)] + [predicate (#+ Predicate)] + ["." monad (#+ do)]] [control pipe ["." try (#+ Try)] ["<>" parser ("#@." monad) - ["" text (#+ Parser)]]] + ["<.>" text (#+ Parser)]]] [data ["." bit] ["." maybe] ["." product] + ["." text ("#@." equivalence monoid)] [number ["n" nat] ["f" frac ("#@." decimal)]] - ["." text ("#@." equivalence monoid)] [collection ["." list ("#@." fold functor)] ["." row (#+ Row row) ("#@." monad)] ["." dictionary (#+ Dictionary)]]] - ["." meta (#+ monad with-gensyms)] [macro [syntax (#+ syntax:)] ["." code]]]) (template [ ] - [(type: #export )] + [(type: #export + )] [Null Any] [Boolean Bit] @@ -45,22 +47,28 @@ (#Object (Dictionary String JSON))) (template [ ] - [(type: #export )] + [(type: #export + )] [Array (Row JSON)] [Object (Dictionary String JSON)] ) +(def: #export null? + (Predicate JSON) + (|>> (case> #Null true + _ false))) + (def: #export object (-> (List [String JSON]) JSON) (|>> (dictionary.from-list text.hash) #..Object)) (syntax: #export (json token) {#.doc (doc "A simple way to produce JSON literals." + (json #null) (json #1) (json +123.456) - (json "Some text") - (json #null) + (json "this is a string") (json ["this" "is" "an" "array"]) (json {"this" "is" "an" "object"}))} @@ -98,7 +106,7 @@ _ (wrap (list token))))) -(def: #export (get-fields json) +(def: #export (fields json) {#.doc "Get all the fields in a JSON object."} (-> JSON (Try (List String))) (case json @@ -198,7 +206,9 @@ ############################################################ ############################################################ -(def: (format-null _) (-> Null Text) "null") +(def: (format-null _) + (-> Null Text) + "null") (def: format-boolean (-> Boolean Text) @@ -209,29 +219,56 @@ (def: format-number (-> Number Text) (|>> (case> - +0.0 "0.0" - -0.0 "0.0" + (^or +0.0 -0.0) "0.0" value (let [raw (:: f.decimal encode value)] (if (f.< +0.0 value) raw (|> raw (text.split 1) maybe.assume product.right)))))) -(def: format-string (-> String Text) text.encode) +(def: escape "\") +(def: escaped-dq (text@compose ..escape text.double-quote)) -(def: (format-array format elems) - (-> (-> JSON Text) (-> Array Text)) - ($_ text@compose "[" - (|> elems (row@map format) row.to-list (text.join-with ",")) - "]")) +(def: format-string + (-> String Text) + (|>> (text.replace-all text.double-quote ..escaped-dq) + (text.enclose [text.double-quote text.double-quote]))) -(def: (format-object format object) +(template [ ] + [(def: + Text + )] + + ["," separator] + [":" entry-separator] + + ["[" open-array] + ["]" close-array] + + ["{" open-object] + ["}" close-object] + ) + +(def: (format-array format) + (-> (-> JSON Text) (-> Array Text)) + (|>> (row@map format) + row.to-list + (text.join-with ..separator) + (text.enclose [..open-array ..close-array]))) + +(def: (format-kv format [key value]) + (-> (-> JSON Text) (-> [String JSON] Text)) + ($_ text@compose + (..format-string key) + ..entry-separator + (format value) + )) + +(def: (format-object format) (-> (-> JSON Text) (-> Object Text)) - ($_ text@compose "{" - (|> object - dictionary.entries - (list@map (function (_ [key value]) ($_ text@compose (format-string key) ":" (format value)))) - (text.join-with ",")) - "}")) + (|>> dictionary.entries + (list@map (..format-kv format)) + (text.join-with ..separator) + (text.enclose [..open-object ..close-object]))) (def: #export (format json) (-> JSON Text) @@ -239,61 +276,66 @@ (^template [ ] [( value) ( value)]) - ([#Null format-null] - [#Boolean format-boolean] - [#Number format-number] - [#String format-string] - [#Array (format-array format)] - [#Object (format-object format)]) + ([#Null ..format-null] + [#Boolean ..format-boolean] + [#Number ..format-number] + [#String ..format-string] + [#Array (..format-array format)] + [#Object (..format-object format)]) )) ############################################################ ############################################################ ############################################################ -(def: space~ +(def: parse-space (Parser Text) - (.some .space)) + (.some .space)) -(def: data-sep +(def: parse-separator (Parser [Text Any Text]) - ($_ <>.and space~ (.this ",") space~)) + ($_ <>.and + ..parse-space + (.this ..separator) + ..parse-space)) -(def: null~ +(def: parse-null (Parser Null) (do <>.monad - [_ (.this "null")] + [_ (.this "null")] (wrap []))) (template [ ] [(def: (Parser Boolean) (do <>.monad - [_ (.this )] + [_ (.this )] (wrap )))] - [true~ "true" #1] - [false~ "false" #0] + [parse-true "true" #1] + [parse-false "false" #0] ) -(def: boolean~ +(def: parse-boolean (Parser Boolean) - (<>.either true~ false~)) + ($_ <>.either + ..parse-true + ..parse-false)) -(def: number~ +(def: parse-number (Parser Number) (do {! <>.monad} - [signed? (<>.parses? (.this "-")) - digits (.many .decimal) + [signed? (<>.parses? (.this "-")) + digits (.many .decimal) decimals (<>.default "0" (do ! - [_ (.this ".")] - (.many .decimal))) + [_ (.this ".")] + (.many .decimal))) exp (<>.default "" (do ! - [mark (.one-of "eE") - signed?' (<>.parses? (.this "-")) - offset (.many .decimal)] + [mark (.one-of "eE") + signed?' (<>.parses? (.this "-")) + offset (.many .decimal)] (wrap ($_ text@compose mark (if signed?' "-" "") offset))))] (case (f@decode ($_ text@compose (if signed? "-" "") digits "." decimals exp)) (#try.Failure message) @@ -302,77 +344,77 @@ (#try.Success value) (wrap value)))) -(def: escaped~ +(def: parse-escaped (Parser Text) ($_ <>.either - (<>.after (.this "\t") + (<>.after (.this "\t") (<>@wrap text.tab)) - (<>.after (.this "\b") + (<>.after (.this "\b") (<>@wrap text.back-space)) - (<>.after (.this "\n") + (<>.after (.this "\n") (<>@wrap text.new-line)) - (<>.after (.this "\r") + (<>.after (.this "\r") (<>@wrap text.carriage-return)) - (<>.after (.this "\f") + (<>.after (.this "\f") (<>@wrap text.form-feed)) - (<>.after (.this (text@compose "\" text.double-quote)) + (<>.after (.this (text@compose "\" text.double-quote)) (<>@wrap text.double-quote)) - (<>.after (.this "\\") + (<>.after (.this "\\") (<>@wrap "\")))) -(def: string~ +(def: parse-string (Parser String) - (<| (.enclosed [text.double-quote text.double-quote]) + (<| (.enclosed [text.double-quote text.double-quote]) (loop [_ []]) (do {! <>.monad} - [chars (.some (.none-of (text@compose "\" text.double-quote))) - stop .peek]) + [chars (.some (.none-of (text@compose "\" text.double-quote))) + stop .peek]) (if (text@= "\" stop) (do ! - [escaped escaped~ + [escaped parse-escaped next-chars (recur [])] (wrap ($_ text@compose chars escaped next-chars))) (wrap chars)))) -(def: (kv~ json~) +(def: (parse-kv parse-json) (-> (Parser JSON) (Parser [String JSON])) (do <>.monad - [key string~ - _ space~ - _ (.this ":") - _ space~ - value json~] + [key ..parse-string + _ ..parse-space + _ (.this ..entry-separator) + _ ..parse-space + value parse-json] (wrap [key value]))) (template [ ] - [(def: ( json~) + [(def: ( parse-json) (-> (Parser JSON) (Parser )) (do <>.monad - [_ (.this ) - _ space~ - elems (<>.sep-by data-sep ) - _ space~ - _ (.this )] + [_ (.this ) + _ parse-space + elems (<>.sep-by ..parse-separator ) + _ parse-space + _ (.this )] (wrap ( elems))))] - [array~ Array "[" "]" json~ row.from-list] - [object~ Object "{" "}" (kv~ json~) (dictionary.from-list text.hash)] + [parse-array Array ..open-array ..close-array parse-json row.from-list] + [parse-object Object ..open-object ..close-object (parse-kv parse-json) (dictionary.from-list text.hash)] ) -(def: json~ +(def: parse-json (Parser JSON) (<>.rec - (function (_ json~) + (function (_ parse-json) ($_ <>.or - null~ - boolean~ - number~ - string~ - (array~ json~) - (object~ json~))))) + parse-null + parse-boolean + parse-number + parse-string + (parse-array parse-json) + (parse-object parse-json))))) (structure: #export codec (Codec Text JSON) (def: encode ..format) - (def: decode (.run json~))) + (def: decode (.run parse-json))) diff --git a/stdlib/source/lux/debug.lux b/stdlib/source/lux/debug.lux index 4ddcd18dd..cb136f810 100644 --- a/stdlib/source/lux/debug.lux +++ b/stdlib/source/lux/debug.lux @@ -10,7 +10,8 @@ ["." try (#+ Try)] ["." exception (#+ exception:)] ["<>" parser - ["<.>" type (#+ Parser)]] + ["<.>" type (#+ Parser)] + ["<.>" code]] pipe] [data ["." text @@ -26,7 +27,9 @@ [duration (#+ Duration)] [date (#+ Date)]] [macro - ["." template]]]) + ["." template] + ["." syntax (#+ syntax:)] + ["." code]]]) (with-expansions [ (as-is (import: java/lang/String) @@ -289,3 +292,9 @@ (#try.Failure _) (exception.throw ..cannot-represent-value type))) + +(syntax: #export (private {definition .identifier}) + (let [[module _] definition] + (wrap (list (` ("lux in-module" + (~ (code.text module)) + (~ (code.identifier definition)))))))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 22fc14b28..7dd6140cc 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -1,6 +1,6 @@ (.module: [lux (#- Type type int char) - ["lux-." type ("#@." equivalence)] + ["lux-." type ("#\." equivalence)] [abstract ["." monad (#+ Monad do)] ["." enum]] @@ -9,19 +9,18 @@ ["." io] ["." try (#+ Try)] ["." exception (#+ Exception exception:)] - ["<>" parser ("#@." monad) + ["<>" parser ("#\." monad) ["" text] ["" code (#+ Parser)]]] [data ["." maybe] ["." product] - ["." bit ("#@." codec)] number - ["." text ("#@." equivalence monoid) + ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection ["." array] - ["." list ("#@." monad fold monoid)] + ["." list ("#\." monad fold monoid)] ["." dictionary (#+ Dictionary)]]] [macro [syntax (#+ syntax:)] @@ -344,7 +343,7 @@ [parser.upper? limit (parameter-type limit)] [parser.class? [name parameters] (` (.primitive (~ (code.text name)) - [(~+ (list@map parameter-type parameters))]))])) + [(~+ (list\map parameter-type parameters))]))])) ## else (undefined) ))) @@ -401,12 +400,12 @@ (case (f input) (^template [] [[meta ( parts)] - [meta ( (list@map (pre-walk-replace f) parts))]]) + [meta ( (list\map (pre-walk-replace f) parts))]]) ([#.Form] [#.Tuple]) [meta (#.Record pairs)] - [meta (#.Record (list@map (: (-> [Code Code] [Code Code]) + [meta (#.Record (list\map (: (-> [Code Code] [Code Code]) (function (_ [key val]) [(pre-walk-replace f key) (pre-walk-replace f val)])) pairs))] @@ -446,8 +445,8 @@ (.tuple (<>.exactly (list.size arguments) .any)))))] (wrap (` ("jvm member invoke constructor" (~ (code.text class-name)) (~+ (|> args - (list.zip/2 (list@map product.right arguments)) - (list@map ..decorate-input)))))))) + (list.zip/2 (list\map product.right arguments)) + (list\map ..decorate-input)))))))) (def: (make-static-method-parser class-name method-name arguments) (-> Text Text (List Argument) (Parser Code)) @@ -458,8 +457,8 @@ (.tuple (<>.exactly (list.size arguments) .any)))))] (wrap (` ("jvm member invoke static" (~ (code.text class-name)) (~ (code.text method-name)) (~+ (|> args - (list.zip/2 (list@map product.right arguments)) - (list@map ..decorate-input)))))))) + (list.zip/2 (list\map product.right arguments)) + (list\map ..decorate-input)))))))) (template [ ] [(def: ( class-name method-name arguments) @@ -472,8 +471,8 @@ (wrap (` ( (~ (code.text class-name)) (~ (code.text method-name)) (~' _jvm_this) (~+ (|> args - (list.zip/2 (list@map product.right arguments)) - (list@map ..decorate-input))))))))] + (list.zip/2 (list\map product.right arguments)) + (list\map ..decorate-input))))))))] [make-special-method-parser "jvm member invoke special"] [make-virtual-method-parser "jvm member invoke virtual"] @@ -537,7 +536,7 @@ (not (text.contains? name.external-separator name)))] (..assert ..class-name-cannot-be-a-type-variable [name type-vars] (not (list.member? text.equivalence - (list@map parser.name type-vars) + (list\map parser.name type-vars) name))))) (def: (valid-class-name type-vars) @@ -554,7 +553,7 @@ [[name parameters] (: (Parser [External (List (Type Parameter))]) ($_ <>.either (<>.and (valid-class-name type-vars) - (<>@wrap (list))) + (<>\wrap (list))) (.form (<>.and .local-identifier (<>.some (parameter^ type-vars))))))] (wrap (type.class (name.sanitize name) parameters)))) @@ -570,7 +569,7 @@ (do <>.monad [name .local-identifier _ (..assert ..unexpected-type-variable [name type-vars] - (list.member? text.equivalence (list@map parser.name type-vars) name))] + (list.member? text.equivalence (list\map parser.name type-vars) name))] (wrap (type.var name)))) (def: wildcard^ @@ -664,7 +663,7 @@ (do <>.monad [[name variables] (: (Parser [External (List (Type Var))]) (<>.either (<>.and (valid-class-name (list)) - (<>@wrap (list))) + (<>\wrap (list))) (.form (<>.and (valid-class-name (list)) (<>.some var^))) ))] @@ -766,7 +765,7 @@ [pm privacy-modifier^ strict-fp? (<>.parses? (.this! (' #strict))) method-vars (<>.default (list) ..vars^) - #let [total-vars (list@compose class-vars method-vars)] + #let [total-vars (list\compose class-vars method-vars)] [_ self-name arguments] (.form ($_ <>.and (.this! (' new)) .local-identifier @@ -787,7 +786,7 @@ strict-fp? (<>.parses? (.this! (' #strict))) final? (<>.parses? (.this! (' #final))) method-vars (<>.default (list) ..vars^) - #let [total-vars (list@compose class-vars method-vars)] + #let [total-vars (list\compose class-vars method-vars)] [name self-name arguments] (.form ($_ <>.and .local-identifier .local-identifier @@ -807,7 +806,7 @@ [strict-fp? (<>.parses? (.this! (' #strict))) owner-class ..declaration^ method-vars (<>.default (list) ..vars^) - #let [total-vars (list@compose (product.right (parser.declaration owner-class)) + #let [total-vars (list\compose (product.right (parser.declaration owner-class)) method-vars)] [name self-name arguments] (.form ($_ <>.and .local-identifier @@ -933,7 +932,7 @@ [tvars (<>.default (list) ..vars^) _ (.identifier! ["" "new"]) ?alias import-member-alias^ - #let [total-vars (list@compose owner-vars tvars)] + #let [total-vars (list\compose owner-vars tvars)] ?prim-mode (<>.maybe primitive-mode^) args (..import-member-args^ total-vars) [io? try? maybe?] import-member-return-flags^] @@ -954,7 +953,7 @@ tvars (<>.default (list) ..vars^) name .local-identifier ?alias import-member-alias^ - #let [total-vars (list@compose owner-vars tvars)] + #let [total-vars (list\compose owner-vars tvars)] ?prim-mode (<>.maybe primitive-mode^) args (..import-member-args^ total-vars) [io? try? maybe?] import-member-return-flags^ @@ -1005,7 +1004,7 @@ (def: (annotation$ [name params]) (-> Annotation Code) - (` ((~ (code.text name)) (~+ (list@map annotation-parameter$ params))))) + (` ((~ (code.text name)) (~+ (list\map annotation-parameter$ params))))) (template [ ] [(def: @@ -1028,10 +1027,10 @@ (-> [Member-Declaration MethodDecl] Code) (let [(^slots [#method-tvars #method-inputs #method-output #method-exs]) method-decl] (` ((~ (code.text name)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ method-tvars))] - [(~+ (list@map class$ method-exs))] - [(~+ (list@map value$ method-inputs))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ method-tvars))] + [(~+ (list\map class$ method-exs))] + [(~+ (list\map value$ method-inputs))] (~ (return$ method-output)))))) (def: (state-modifier$ sm) @@ -1046,7 +1045,7 @@ (case field (#ConstantField class value) (` ("constant" (~ (code.text name)) - [(~+ (list@map annotation$ anns))] + [(~+ (list\map annotation$ anns))] (~ (value$ class)) (~ value) )) @@ -1055,7 +1054,7 @@ (` ("variable" (~ (code.text name)) (~ (privacy-modifier$ pm)) (~ (state-modifier$ sm)) - [(~+ (list@map annotation$ anns))] + [(~+ (list\map annotation$ anns))] (~ (value$ class)) )) )) @@ -1075,12 +1074,12 @@ (` ("init" (~ (privacy-modifier$ pm)) (~ (code.bit strict-fp?)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ type-vars))] - [(~+ (list@map class$ exs))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ type-vars))] + [(~+ (list\map class$ exs))] (~ (code.text self-name)) - [(~+ (list@map argument$ arguments))] - [(~+ (list@map constructor-arg$ constructor-args))] + [(~+ (list\map argument$ arguments))] + [(~+ (list\map constructor-arg$ constructor-args))] (~ (pre-walk-replace replacer body)) )) @@ -1090,12 +1089,12 @@ (~ (privacy-modifier$ pm)) (~ (code.bit final?)) (~ (code.bit strict-fp?)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ type-vars))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ type-vars))] (~ (code.text self-name)) - [(~+ (list@map argument$ arguments))] + [(~+ (list\map argument$ arguments))] (~ (return$ return-type)) - [(~+ (list@map class$ exs))] + [(~+ (list\map class$ exs))] (~ (pre-walk-replace replacer body)))) (#OverridenMethod strict-fp? declaration type-vars self-name arguments return-type body exs) @@ -1107,18 +1106,18 @@ (~ (code.text name)) (~' _jvm_this) (~+ (|> args - (list.zip/2 (list@map product.right arguments)) - (list@map ..decorate-input)))))))))] + (list.zip/2 (list\map product.right arguments)) + (list\map ..decorate-input)))))))))] (` ("override" (~ (declaration$ declaration)) (~ (code.text name)) (~ (code.bit strict-fp?)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ type-vars))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ type-vars))] (~ (code.text self-name)) - [(~+ (list@map argument$ arguments))] + [(~+ (list\map argument$ arguments))] (~ (return$ return-type)) - [(~+ (list@map class$ exs))] + [(~+ (list\map class$ exs))] (~ (|> body (pre-walk-replace replacer) (pre-walk-replace super-replacer))) @@ -1129,10 +1128,10 @@ (~ (code.text name)) (~ (privacy-modifier$ pm)) (~ (code.bit strict-fp?)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ type-vars))] - [(~+ (list@map class$ exs))] - [(~+ (list@map argument$ arguments))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ type-vars))] + [(~+ (list\map class$ exs))] + [(~+ (list\map argument$ arguments))] (~ (return$ return-type)) (~ (pre-walk-replace replacer body)))) @@ -1140,20 +1139,20 @@ (` ("abstract" (~ (code.text name)) (~ (privacy-modifier$ pm)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ type-vars))] - [(~+ (list@map class$ exs))] - [(~+ (list@map argument$ arguments))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ type-vars))] + [(~+ (list\map class$ exs))] + [(~+ (list\map argument$ arguments))] (~ (return$ return-type)))) (#NativeMethod type-vars arguments return-type exs) (` ("native" (~ (code.text name)) (~ (privacy-modifier$ pm)) - [(~+ (list@map annotation$ anns))] - [(~+ (list@map var$ type-vars))] - [(~+ (list@map class$ exs))] - [(~+ (list@map argument$ arguments))] + [(~+ (list\map annotation$ anns))] + [(~+ (list\map var$ type-vars))] + [(~+ (list\map class$ exs))] + [(~+ (list\map argument$ arguments))] (~ (return$ return-type)))) )) @@ -1209,19 +1208,19 @@ (do meta.monad [current-module meta.current-module-name #let [fully-qualified-class-name (name.qualify current-module full-class-name) - field-parsers (list@map (field->parser fully-qualified-class-name) fields) - method-parsers (list@map (method->parser fully-qualified-class-name) methods) - replacer (parser->replacer (list@fold <>.either + field-parsers (list\map (field->parser fully-qualified-class-name) fields) + method-parsers (list\map (method->parser fully-qualified-class-name) methods) + replacer (parser->replacer (list\fold <>.either (<>.fail "") - (list@compose field-parsers method-parsers)))]] + (list\compose field-parsers method-parsers)))]] (wrap (list (` ("jvm class" (~ (declaration$ (type.declaration (name.qualify current-module full-class-name) class-vars))) (~ (class$ super)) - [(~+ (list@map class$ interfaces))] + [(~+ (list\map class$ interfaces))] (~ (inheritance-modifier$ im)) - [(~+ (list@map annotation$ annotations))] - [(~+ (list@map field-decl$ fields))] - [(~+ (list@map (method-def$ replacer super) methods))])))))) + [(~+ (list\map annotation$ annotations))] + [(~+ (list\map field-decl$ fields))] + [(~+ (list\map (method-def$ replacer super) methods))])))))) (syntax: #export (interface: {#let [! <>.monad]} @@ -1237,9 +1236,9 @@ [current-module meta.current-module-name] (wrap (list (` ("jvm class interface" (~ (declaration$ (type.declaration (name.qualify current-module full-class-name) class-vars))) - [(~+ (list@map class$ supers))] - [(~+ (list@map annotation$ annotations))] - (~+ (list@map method-decl$ members)))))))) + [(~+ (list\map class$ supers))] + [(~+ (list\map annotation$ annotations))] + (~+ (list\map method-decl$ members)))))))) (syntax: #export (object {class-vars ..vars^} @@ -1261,11 +1260,11 @@ []))) )} (wrap (list (` ("jvm class anonymous" - [(~+ (list@map var$ class-vars))] + [(~+ (list\map var$ class-vars))] (~ (class$ super)) - [(~+ (list@map class$ interfaces))] - [(~+ (list@map constructor-arg$ constructor-args))] - [(~+ (list@map (method-def$ function.identity super) methods))]))))) + [(~+ (list\map class$ interfaces))] + [(~+ (list\map constructor-arg$ constructor-args))] + [(~+ (list\map (method-def$ function.identity super) methods))]))))) (syntax: #export (null) {#.doc (doc "Null object reference." @@ -1359,14 +1358,14 @@ (ClassName::method2 arg3 arg4 arg5)))} (with-gensyms [g!obj] (wrap (list (` (let [(~ g!obj) (~ obj)] - (exec (~+ (list@map (complete-call$ g!obj) methods)) + (exec (~+ (list\map (complete-call$ g!obj) methods)) (~ g!obj)))))))) (def: (class-import$ declaration) (-> (Type Declaration) Code) (let [[full-name params] (parser.declaration declaration) def-name (..internal full-name) - params' (list@map ..var$' params)] + params' (list\map ..var$' params)] (` (def: (~ (code.identifier ["" def-name])) {#..jvm-class (~ (code.text (..internal full-name)))} .Type @@ -1378,7 +1377,7 @@ (-> (List (Type Var)) Import-Member-Declaration (List (Type Var))) (case member (#ConstructorDecl [commons _]) - (list@compose class-tvars (get@ #import-member-tvars commons)) + (list\compose class-tvars (get@ #import-member-tvars commons)) (#MethodDecl [commons _]) (case (get@ #import-member-kind commons) @@ -1386,7 +1385,7 @@ (get@ #import-member-tvars commons) _ - (list@compose class-tvars (get@ #import-member-tvars commons))) + (list\compose class-tvars (get@ #import-member-tvars commons))) _ class-tvars)) @@ -1403,8 +1402,8 @@ (with-gensyms [arg-name] (wrap [maybe? arg-name])))) import-member-args) - #let [input-jvm-types (list@map product.right import-member-args) - arg-types (list@map (: (-> [Bit (Type Value)] Code) + #let [input-jvm-types (list\map product.right import-member-args) + arg-types (list\map (: (-> [Bit (Type Value)] Code) (function (_ [maybe? arg]) (let [arg-type (value-type (get@ #import-member-mode commons) arg)] (if maybe? @@ -1527,12 +1526,12 @@ (def: (jvm-invoke-inputs mode classes inputs) (-> Primitive-Mode (List (Type Value)) (List [Bit Code]) (List Code)) (|> inputs - (list@map (function (_ [maybe? input]) + (list\map (function (_ [maybe? input]) (if maybe? (` ((~! !!!) (~ (un-quote input)))) (un-quote input)))) (list.zip/2 classes) - (list@map (auto-convert-input mode)))) + (list\map (auto-convert-input mode)))) (def: (member-def-interop vars kind class [arg-function-inputs input-jvm-types arg-types] member method-prefix) (-> (List (Type Var)) Class-Kind (Type Declaration) [(List [Bit Code]) (List (Type Value)) (List Code)] Import-Member-Declaration Text (Meta (List Code))) @@ -1546,7 +1545,7 @@ (` (primitive (~ (code.text full-name)))) _ - (let [=class-tvars (list@map ..var$' class-tvars)] + (let [=class-tvars (list\map ..var$' class-tvars)] (` (All [(~+ =class-tvars)] (primitive (~ (code.text full-name)) [(~+ =class-tvars)])))))) getter-interop (: (-> Text Code) (function (_ name) @@ -1554,7 +1553,7 @@ (` (def: (~ getter-name) (~ enum-type) (~ (get-static-field full-name name)))))))]] - (wrap (list@map getter-interop enum-members))) + (wrap (list\map getter-interop enum-members))) (#ConstructorDecl [commons _]) (do meta.monad @@ -1562,17 +1561,17 @@ def-name (code.identifier ["" (format method-prefix member-separator (get@ #import-member-alias commons))]) jvm-interop (|> [classT (` ("jvm member invoke constructor" - [(~+ (list@map ..var$ class-tvars))] + [(~+ (list\map ..var$ class-tvars))] (~ (code.text full-name)) - [(~+ (list@map ..var$ (get@ #import-member-tvars commons)))] + [(~+ (list\map ..var$ (get@ #import-member-tvars commons)))] (~+ (|> (jvm-invoke-inputs (get@ #import-member-mode commons) input-jvm-types arg-function-inputs) (list.zip/2 input-jvm-types) - (list@map ..decorate-input)))))] + (list\map ..decorate-input)))))] (auto-convert-output (get@ #import-member-mode commons)) (decorate-return-maybe member true classT) (decorate-return-try member) (decorate-return-io member))]] - (wrap (list (` ((~! syntax:) ((~ def-name) (~+ (list@map product.right arg-function-inputs))) + (wrap (list (` ((~! syntax:) ((~ def-name) (~+ (list\map product.right arg-function-inputs))) ((~' wrap) (.list (.` (~ jvm-interop))))))))) (#MethodDecl [commons method]) @@ -1600,17 +1599,17 @@ method-return (get@ #import-method-return method) callC (: Code (` ((~ (code.text jvm-op)) - [(~+ (list@map ..var$ class-tvars))] + [(~+ (list\map ..var$ class-tvars))] (~ (code.text full-name)) (~ (code.text import-method-name)) - [(~+ (list@map ..var$ (get@ #import-member-tvars commons)))] + [(~+ (list\map ..var$ (get@ #import-member-tvars commons)))] (~+ (|> object-ast - (list@map ..un-quote) + (list\map ..un-quote) (list.zip/2 (list (type.class full-name (list)))) - (list@map (auto-convert-input (get@ #import-member-mode commons))))) + (list\map (auto-convert-input (get@ #import-member-mode commons))))) (~+ (|> (jvm-invoke-inputs (get@ #import-member-mode commons) input-jvm-types arg-function-inputs) (list.zip/2 input-jvm-types) - (list@map ..decorate-input)))))) + (list\map ..decorate-input)))))) jvm-interop (: Code (case (type.void? method-return) (#.Left method-return) @@ -1626,7 +1625,7 @@ (|> callC (decorate-return-try member) (decorate-return-io member))))]] - (wrap (list (` ((~! syntax:) ((~ def-name) (~+ (list@map product.right arg-function-inputs)) (~+ object-ast)) + (wrap (list (` ((~! syntax:) ((~ def-name) (~+ (list\map product.right arg-function-inputs)) (~+ object-ast)) ((~' wrap) (.list (.` (~ jvm-interop)))))))))) (#FieldAccessDecl fad) @@ -1759,7 +1758,7 @@ (do {! meta.monad} [kind (class-kind declaration) =members (monad.map ! (member-import$ class-type-vars kind declaration) members)] - (wrap (list& (class-import$ declaration) (list@join =members))))) + (wrap (list& (class-import$ declaration) (list\join =members))))) (syntax: #export (array {type (..type^ (list))} size) @@ -1793,12 +1792,12 @@ (with-expansions [ (as-is (meta.fail (exception.construct ..cannot-convert-to-jvm-type [type])))] (def: (lux-type->jvm-type type) (-> .Type (Meta (Type Value))) - (if (lux-type@= Any type) + (if (lux-type\= Any type) (:: meta.monad wrap $Object) (case type (#.Primitive name params) (`` (cond (~~ (template [] - [(text@= (..reflection ) name) + [(text\= (..reflection ) name) (case params #.Nil (:: meta.monad wrap ) @@ -1816,7 +1815,7 @@ [type.char])) (~~ (template [] - [(text@= (..reflection (type.array )) name) + [(text\= (..reflection (type.array )) name) (case params #.Nil (:: meta.monad wrap (type.array )) @@ -1833,7 +1832,7 @@ [type.double] [type.char])) - (text@= array.type-name name) + (text\= array.type-name name) (case params (#.Cons elementLT #.Nil) (:: meta.monad map type.array diff --git a/stdlib/source/lux/meta/annotation.lux b/stdlib/source/lux/meta/annotation.lux index ea47f6970..17fef0c8f 100644 --- a/stdlib/source/lux/meta/annotation.lux +++ b/stdlib/source/lux/meta/annotation.lux @@ -4,8 +4,7 @@ ["." monad (#+ do)]] [data ["." maybe] - ["." name ("#@." equivalence)] - ["." text ("#@." monoid)]]]) + ["." name ("#\." equivalence)]]]) (type: #export Annotation Code) @@ -19,7 +18,7 @@ (#.Cons [key value] ann') (case key [_ (#.Tag tag')] - (if (name@= tag tag') + (if (name\= tag tag') (#.Some value) (recur ann')) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 252fccc68..0dd2c030b 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -15,12 +15,10 @@ [data ["." maybe] [number - ["n" nat ("#@." decimal)] - ["i" int ("#@." decimal)]] - ["." text ("#@." monoid)] + ["i" int]] + ["." text ("#\." monoid)] [collection - ["." row] - ["." list ("#@." fold)]]] + ["." row]]] [type abstract]] ["." // (#+ Time) @@ -123,7 +121,7 @@ (-> Instant Text) (let [[date time] (..date-time instant) time (..clock-time time)] - ($_ text@compose + ($_ text\compose (:: date.codec encode date) ..date-suffix (:: //.codec encode time) ..time-suffix))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux index 6ad18d63d..8c5b74cff 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -9,7 +9,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#@." fold monoid monad)]]] + ["." list ("#\." fold monoid monad)]]] ["." type ["." check]] ["." meta]] @@ -37,7 +37,7 @@ ["Function" (%.code functionC)] ["Arguments" (|> arguments list.enumeration - (list@map (.function (_ [idx argC]) + (list\map (.function (_ [idx argC]) (format (%.nat idx) " " (%.code argC)))) (text.join-with text.new-line))])) @@ -89,7 +89,7 @@ (#.Function inputT outputT) (<| (:: ! map (.function (_ [scope bodyA]) - (#/.Function (list@map (|>> /.variable) + (#/.Function (list\map (|>> /.variable) (//scope.environment scope)) bodyA))) /.with-scope diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux index 8c1ba3644..582e7d860 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -7,10 +7,10 @@ ["." try] ["." exception (#+ exception:)]] [data - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection - ["." list ("#@." fold functor)] + ["." list ("#\." fold functor)] [dictionary ["." plist]]]] ["." meta]] @@ -102,7 +102,7 @@ (function (_ state) (#try.Success [(update@ #.modules (plist.update self-name (update@ #.imports (function (_ current) - (if (list.any? (text@= module) + (if (list.any? (text\= module) current) current (#.Cons module current))))) @@ -254,16 +254,16 @@ (/.throw cannot-declare-tags-for-unnamed-type [tags type])) _ (ensure-undeclared-tags self-name tags) _ (///.assert cannot-declare-tags-for-foreign-type [tags type] - (text@= self-name type-module))] + (text\= self-name type-module))] (///extension.lift (function (_ state) (case (|> state (get@ #.modules) (plist.get self-name)) (#.Some module) - (let [namespaced-tags (list@map (|>> [self-name]) tags)] + (let [namespaced-tags (list\map (|>> [self-name]) tags)] (#try.Success [(update@ #.modules (plist.update self-name (|>> (update@ #.tags (function (_ tag-bindings) - (list@fold (function (_ [idx tag] table) + (list\fold (function (_ [idx tag] table) (plist.put tag [idx namespaced-tags exported? type] table)) tag-bindings (list.enumeration tags)))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux index 3edad4d3b..f121b78ca 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension.lux @@ -10,10 +10,10 @@ ["." exception (#+ exception:)]] [data ["." product] - ["." text ("#@." order) + ["." text ("#\." order) ["%" format (#+ Format format)]] [collection - ["." list ("#@." functor)] + ["." list] ["." dictionary (#+ Dictionary)]]]] [///// ["//" phase] @@ -75,7 +75,7 @@ ["Extension" (%.text name)] ["Available" (|> bundle dictionary.keys - (list.sort text@<) + (list.sort text\<) (exception.enumerate %.text))])) (type: #export (Extender s i o) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 618fbbfc9..0fdaa8c96 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -6,7 +6,7 @@ ["." monad (#+ do)]] [control pipe - ["." try (#+ Try) ("#@." monad)] + ["." try (#+ Try) ("#\." monad)] ["." exception (#+ exception:)] ["<>" parser ["" code (#+ Parser)] @@ -16,20 +16,20 @@ ["." product] [number ["n" nat]] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection - ["." list ("#@." fold monad monoid)] + ["." list ("#\." fold monad monoid)] ["." array] ["." dictionary (#+ Dictionary)]]] ["." type - ["." check (#+ Check) ("#@." monad)]] + ["." check (#+ Check) ("#\." monad)]] [target ["." jvm #_ [".!" reflection] [encoding [name (#+ External)]] - ["#" type (#+ Type Argument Typed) ("#@." equivalence) + ["#" type (#+ Type Argument Typed) ("#\." equivalence) ["." category (#+ Void Value' Value Return' Return Primitive Object Class Array Var Parameter Method)] ["." box] ["." reflection] @@ -52,7 +52,7 @@ ["#." synthesis] [/// [reference (#+)] - ["." phase ("#@." monad)] + ["." phase ("#\." monad)] [meta [archive (#+ Archive) [descriptor (#+ Module)]]]]]]]]) @@ -146,7 +146,7 @@ ["Class" class] ["Method" method] ["Arguments" (exception.enumerate ..signature inputsJT)] - ["Hints" (exception.enumerate %.type (list@map product.left hints))]))] + ["Hints" (exception.enumerate %.type (list\map product.left hints))]))] [no-candidates] [too-many-candidates] @@ -275,14 +275,14 @@ (/////analysis.throw ..non-jvm-type luxT)) (^ (#.Primitive (static array.type-name) (list elemT))) - (phase@map jvm.array (jvm-type elemT)) + (phase\map jvm.array (jvm-type elemT)) (#.Primitive class parametersT) (case (dictionary.get class ..boxes) (#.Some [_ primitive-type]) (case parametersT #.Nil - (phase@wrap primitive-type) + (phase\wrap primitive-type) _ (/////analysis.throw ..primitives-cannot-have-type-parameters class)) @@ -304,7 +304,7 @@ (wrap (jvm.class class parametersJT)))) (#.Ex _) - (phase@wrap (jvm.class ..object-class (list))) + (phase\wrap (jvm.class ..object-class (list))) _ (/////analysis.throw ..non-jvm-type luxT))) @@ -398,7 +398,7 @@ (#.Primitive name parameters) (`` (cond (or (~~ (template [] - [(text@= (..reflection ) name)] + [(text\= (..reflection ) name)] [jvm.boolean] [jvm.byte] @@ -412,14 +412,14 @@ (/////analysis.throw ..non-parameter objectT) ## else - (phase@wrap (jvm.class name (list))))) + (phase\wrap (jvm.class name (list))))) (#.Named name anonymous) (check-parameter anonymous) (^template [] [( id) - (phase@wrap (jvm.class ..object-class (list)))]) + (phase\wrap (jvm.class ..object-class (list)))]) ([#.Var] [#.Ex]) @@ -445,8 +445,8 @@ (case objectT (#.Primitive name #.Nil) (`` (cond (~~ (template [] - [(text@= (..reflection ) name) - (phase@wrap )] + [(text\= (..reflection ) name) + (phase\wrap )] [jvm.boolean] [jvm.byte] @@ -458,8 +458,8 @@ [jvm.char])) (~~ (template [] - [(text@= (..reflection (jvm.array )) name) - (phase@wrap (jvm.array ))] + [(text\= (..reflection (jvm.array )) name) + (phase\wrap (jvm.array ))] [jvm.boolean] [jvm.byte] @@ -476,18 +476,18 @@ (check-jvm (#.Primitive unprefixed (list))))) ## else - (phase@wrap (jvm.class name (list))))) + (phase\wrap (jvm.class name (list))))) (^ (#.Primitive (static array.type-name) (list elementT))) (|> elementT check-jvm - (phase@map jvm.array)) + (phase\map jvm.array)) (#.Primitive name parameters) (do {! phase.monad} [parameters (monad.map ! check-parameter parameters)] - (phase@wrap (jvm.class name parameters))) + (phase\wrap (jvm.class name parameters))) (#.Named name anonymous) (check-jvm anonymous) @@ -515,12 +515,12 @@ [name (:: ! map ..reflection (check-jvm objectT))] (if (dictionary.contains? name ..boxes) (/////analysis.throw ..primitives-are-not-objects [name]) - (phase@wrap name)))) + (phase\wrap name)))) (def: (check-return type) (-> .Type (Operation (Type Return))) (if (is? .Any type) - (phase@wrap jvm.void) + (phase\wrap jvm.void) (check-jvm type))) (def: (read-primitive-array-handler lux-type jvm-type) @@ -866,11 +866,11 @@ can-cast? (: (Operation Bit) (`` (cond (~~ (template [ ] [(let [=primitive (reflection.reflection )] - (or (and (text@= =primitive from-name) - (or (text@= to-name) - (text@= =primitive to-name))) - (and (text@= from-name) - (text@= =primitive to-name)))) + (or (and (text\= =primitive from-name) + (or (text\= to-name) + (text\= =primitive to-name))) + (and (text\= from-name) + (text\= =primitive to-name)))) (wrap true)] [reflection.boolean box.boolean] @@ -889,23 +889,23 @@ _ (phase.assert ..primitives-are-not-objects [to-name] (not (dictionary.contains? to-name ..boxes))) to-class (phase.lift (reflection!.load to-name)) - _ (if (text@= ..inheritance-relationship-type-name from-name) + _ (if (text\= ..inheritance-relationship-type-name from-name) (wrap []) (do ! [from-class (phase.lift (reflection!.load from-name))] (phase.assert cannot-cast [fromT toT fromC] (java/lang/Class::isAssignableFrom from-class to-class))))] (loop [[current-name currentT] [from-name fromT]] - (if (text@= to-name current-name) + (if (text\= to-name current-name) (wrap true) (do ! [candidate-parents (: (Operation (List [[Text .Type] Bit])) - (if (text@= ..inheritance-relationship-type-name current-name) + (if (text\= ..inheritance-relationship-type-name current-name) (inheritance-candidate-parents currentT to-class toT fromC) (class-candidate-parents current-name currentT to-name to-class)))] (case (|> candidate-parents (list.filter product.right) - (list@map product.left)) + (list\map product.left)) (#.Cons [next-name nextT] _) (recur [next-name nextT]) @@ -1035,7 +1035,7 @@ phase.lift) #let [modifiers (java/lang/reflect/Method::getModifiers method) correct-class? (java/lang/Object::equals class (java/lang/reflect/Method::getDeclaringClass method)) - correct-method? (text@= method-name (java/lang/reflect/Method::getName method)) + correct-method? (text\= method-name (java/lang/reflect/Method::getName method)) static-matches? (case method-style #Static (java/lang/reflect/Modifier::isStatic modifiers) @@ -1050,9 +1050,9 @@ _ true) arity-matches? (n.= (list.size inputsJT) (list.size parameters)) - inputs-match? (list@fold (function (_ [expectedJC actualJC] prev) + inputs-match? (list\fold (function (_ [expectedJC actualJC] prev) (and prev - (jvm@= expectedJC (: (Type Value) + (jvm\= expectedJC (: (Type Value) (case (jvm-parser.var? actualJC) (#.Some name) (|> aliasing @@ -1080,9 +1080,9 @@ phase.lift)] (wrap (and (java/lang/Object::equals class (java/lang/reflect/Constructor::getDeclaringClass constructor)) (n.= (list.size inputsJT) (list.size parameters)) - (list@fold (function (_ [expectedJC actualJC] prev) + (list\fold (function (_ [expectedJC actualJC] prev) (and prev - (jvm@= expectedJC (: (Type Value) + (jvm\= expectedJC (: (Type Value) (case (jvm-parser.var? actualJC) (#.Some name) (|> aliasing @@ -1101,15 +1101,15 @@ (def: (jvm-type-var-mapping owner-tvars method-tvars) (-> (List Text) (List Text) [(List .Type) Mapping]) - (let [jvm-tvars (list@compose owner-tvars method-tvars) + (let [jvm-tvars (list\compose owner-tvars method-tvars) lux-tvars (|> jvm-tvars list.reverse list.enumeration - (list@map (function (_ [idx name]) + (list\map (function (_ [idx name]) [name (idx-to-parameter idx)])) list.reverse) num-owner-tvars (list.size owner-tvars) - owner-tvarsT (|> lux-tvars (list.take num-owner-tvars) (list@map product.right)) + owner-tvarsT (|> lux-tvars (list.take num-owner-tvars) (list\map product.right)) mapping (dictionary.from-list text.hash lux-tvars)] [owner-tvarsT mapping])) @@ -1123,28 +1123,28 @@ _ (|> (java/lang/Class::getTypeParameters owner) array.to-list - (list@map (|>> java/lang/reflect/TypeVariable::getName)))) + (list\map (|>> java/lang/reflect/TypeVariable::getName)))) method-tvars (|> (java/lang/reflect/Method::getTypeParameters method) array.to-list - (list@map (|>> java/lang/reflect/TypeVariable::getName))) + (list\map (|>> java/lang/reflect/TypeVariable::getName))) [owner-tvarsT mapping] (jvm-type-var-mapping owner-tvars method-tvars)] (do {! phase.monad} [inputsT (|> (java/lang/reflect/Method::getGenericParameterTypes method) array.to-list (monad.map ! (|>> reflection!.type phase.lift)) - (phase@map (monad.map ! (..reflection-type mapping))) - phase@join) + (phase\map (monad.map ! (..reflection-type mapping))) + phase\join) outputT (|> method java/lang/reflect/Method::getGenericReturnType reflection!.return phase.lift - (phase@map (..reflection-return mapping)) - phase@join) + (phase\map (..reflection-return mapping)) + phase\join) exceptionsT (|> (java/lang/reflect/Method::getGenericExceptionTypes method) array.to-list (monad.map ! (|>> reflection!.type phase.lift)) - (phase@map (monad.map ! (..reflection-type mapping))) - phase@join) + (phase\map (monad.map ! (..reflection-type mapping))) + phase\join) #let [methodT (<| (type.univ-q (dictionary.size mapping)) (type.function (case method-style #Static @@ -1161,22 +1161,22 @@ (let [owner (java/lang/reflect/Constructor::getDeclaringClass constructor) owner-tvars (|> (java/lang/Class::getTypeParameters owner) array.to-list - (list@map (|>> java/lang/reflect/TypeVariable::getName))) + (list\map (|>> java/lang/reflect/TypeVariable::getName))) method-tvars (|> (java/lang/reflect/Constructor::getTypeParameters constructor) array.to-list - (list@map (|>> java/lang/reflect/TypeVariable::getName))) + (list\map (|>> java/lang/reflect/TypeVariable::getName))) [owner-tvarsT mapping] (jvm-type-var-mapping owner-tvars method-tvars)] (do {! phase.monad} [inputsT (|> (java/lang/reflect/Constructor::getGenericParameterTypes constructor) array.to-list (monad.map ! (|>> reflection!.type phase.lift)) - (phase@map (monad.map ! (reflection-type mapping))) - phase@join) + (phase\map (monad.map ! (reflection-type mapping))) + phase\join) exceptionsT (|> (java/lang/reflect/Constructor::getGenericExceptionTypes constructor) array.to-list (monad.map ! (|>> reflection!.type phase.lift)) - (phase@map (monad.map ! (reflection-type mapping))) - phase@join) + (phase\map (monad.map ! (reflection-type mapping))) + phase\join) #let [objectT (#.Primitive (java/lang/Class::getName owner) owner-tvarsT) constructorT (<| (type.univ-q (dictionary.size mapping)) (type.function inputsT) @@ -1205,7 +1205,7 @@ (-> (List (Type Var))) (|>> array.to-list - (list@map (|>> java/lang/reflect/TypeVariable::getName jvm.var))))] + (list\map (|>> java/lang/reflect/TypeVariable::getName jvm.var))))] [class-type-variables (java/lang/Class java/lang/Object) java/lang/Class::getTypeParameters] [constructor-type-variables (java/lang/reflect/Constructor java/lang/Object) java/lang/reflect/Constructor::getTypeParameters] @@ -1214,8 +1214,8 @@ (def: (aliasing expected actual) (-> (List (Type Var)) (List (Type Var)) Aliasing) - (|> (list.zip/2 (list@map jvm-parser.name actual) - (list@map jvm-parser.name expected)) + (|> (list.zip/2 (list\map jvm-parser.name actual) + (list\map jvm-parser.name expected)) (dictionary.from-list text.hash))) (def: (method-candidate actual-class-tvars class-name actual-method-tvars method-name method-style inputsJT) @@ -1226,7 +1226,7 @@ candidates (|> class java/lang/Class::getDeclaredMethods array.to-list - (list.filter (|>> java/lang/reflect/Method::getName (text@= method-name))) + (list.filter (|>> java/lang/reflect/Method::getName (text\= method-name))) (monad.map ! (: (-> java/lang/reflect/Method (Operation Evaluation)) (function (_ method) (do ! @@ -1295,8 +1295,8 @@ (def: (decorate-inputs typesT inputsA) (-> (List (Type Value)) (List Analysis) (List Analysis)) (|> inputsA - (list.zip/2 (list@map (|>> ..signature /////analysis.text) typesT)) - (list@map (function (_ [type value]) + (list.zip/2 (list\map (|>> ..signature /////analysis.text) typesT)) + (list\map (function (_ [type value]) (/////analysis.tuple (list type value)))))) (def: type-vars (.tuple (<>.some ..var))) @@ -1307,9 +1307,9 @@ [($_ <>.and ..type-vars ..member ..type-vars (<>.some ..input)) (function (_ extension-name analyse archive [class-tvars [class method] method-tvars argsTC]) (do phase.monad - [#let [argsT (list@map product.left argsTC)] + [#let [argsT (list\map product.left argsTC)] [methodT exceptionsT] (method-candidate class-tvars class method-tvars method #Static argsT) - [outputT argsA] (inferenceA.general archive analyse methodT (list@map product.right argsTC)) + [outputT argsA] (inferenceA.general archive analyse methodT (list\map product.right argsTC)) outputJT (check-return outputT)] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text (..signature (jvm.class class (list)))) (/////analysis.text method) @@ -1322,9 +1322,9 @@ [($_ <>.and ..type-vars ..member ..type-vars .any (<>.some ..input)) (function (_ extension-name analyse archive [class-tvars [class method] method-tvars objectC argsTC]) (do phase.monad - [#let [argsT (list@map product.left argsTC)] + [#let [argsT (list\map product.left argsTC)] [methodT exceptionsT] (method-candidate class-tvars class method-tvars method #Virtual argsT) - [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list@map product.right argsTC))) + [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) #let [[objectA argsA] (case allA (#.Cons objectA argsA) [objectA argsA] @@ -1344,9 +1344,9 @@ [($_ <>.and ..type-vars ..member ..type-vars .any (<>.some ..input)) (function (_ extension-name analyse archive [class-tvars [class method] method-tvars objectC argsTC]) (do phase.monad - [#let [argsT (list@map product.left argsTC)] + [#let [argsT (list\map product.left argsTC)] [methodT exceptionsT] (method-candidate class-tvars class method-tvars method #Special argsT) - [outputT argsA] (inferenceA.general archive analyse methodT (list& objectC (list@map product.right argsTC))) + [outputT argsA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) outputJT (check-return outputT)] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text (..signature (jvm.class class (list)))) (/////analysis.text method) @@ -1359,12 +1359,12 @@ [($_ <>.and ..type-vars ..member ..type-vars .any (<>.some ..input)) (function (_ extension-name analyse archive [class-tvars [class-name method] method-tvars objectC argsTC]) (do phase.monad - [#let [argsT (list@map product.left argsTC)] + [#let [argsT (list\map product.left argsTC)] class (phase.lift (reflection!.load class-name)) _ (phase.assert non-interface class-name (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers class))) [methodT exceptionsT] (method-candidate class-tvars class-name method-tvars method #Interface argsT) - [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list@map product.right argsTC))) + [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\map product.right argsTC))) #let [[objectA argsA] (case allA (#.Cons objectA argsA) [objectA argsA] @@ -1384,9 +1384,9 @@ [($_ <>.and ..type-vars .text ..type-vars (<>.some ..input)) (function (_ extension-name analyse archive [class-tvars class method-tvars argsTC]) (do phase.monad - [#let [argsT (list@map product.left argsTC)] + [#let [argsT (list\map product.left argsTC)] [methodT exceptionsT] (constructor-candidate class-tvars class method-tvars argsT) - [outputT argsA] (inferenceA.general archive analyse methodT (list@map product.right argsTC))] + [outputT argsA] (inferenceA.general archive analyse methodT (list\map product.right argsTC))] (wrap (#/////analysis.Extension extension-name (list& (/////analysis.text (..signature (jvm.class class (list)))) (decorate-inputs argsT argsA))))))])) @@ -1437,7 +1437,7 @@ (def: (annotation-analysis [name parameters]) (-> (Annotation Analysis) Analysis) (/////analysis.tuple (list& (/////analysis.text name) - (list@map annotation-parameter-analysis parameters)))) + (list\map annotation-parameter-analysis parameters)))) (template [ ] [(def: @@ -1492,9 +1492,9 @@ [(def: (-> (List (Type Class)) (Try (List [Text (Type Method)]))) (|>> (monad.map try.monad (|>> ..reflection reflection!.load)) - (try@map (monad.map try.monad )) - try@join - (try@map list@join)))] + (try\map (monad.map try.monad )) + try\join + (try\map list\join)))] [all-abstract-methods ..abstract-methods] [all-methods ..methods] @@ -1601,20 +1601,20 @@ [scope bodyA] (|> arguments' (#.Cons [self-name selfT]) list.reverse - (list@fold scope.with-local (analyse archive body)) + (list\fold scope.with-local (analyse archive body)) (typeA.with-type .Any) /////analysis.with-scope)] (wrap (/////analysis.tuple (list (/////analysis.text ..constructor-tag) (visibility-analysis visibility) (/////analysis.bit strict-fp?) - (/////analysis.tuple (list@map annotation-analysis annotationsA)) - (/////analysis.tuple (list@map var-analysis vars)) + (/////analysis.tuple (list\map annotation-analysis annotationsA)) + (/////analysis.tuple (list\map var-analysis vars)) (/////analysis.text self-name) - (/////analysis.tuple (list@map ..argument-analysis arguments)) - (/////analysis.tuple (list@map class-analysis exceptions)) - (/////analysis.tuple (list@map typed-analysis super-arguments)) + (/////analysis.tuple (list\map ..argument-analysis arguments)) + (/////analysis.tuple (list\map class-analysis exceptions)) + (/////analysis.tuple (list\map typed-analysis super-arguments)) (#/////analysis.Function - (list@map (|>> /////analysis.variable) + (list\map (|>> /////analysis.variable) (scope.environment scope)) (/////analysis.tuple (list bodyA))) )))))) @@ -1677,7 +1677,7 @@ [scope bodyA] (|> arguments' (#.Cons [self-name selfT]) list.reverse - (list@fold scope.with-local (analyse archive body)) + (list\fold scope.with-local (analyse archive body)) (typeA.with-type returnT) /////analysis.with-scope)] (wrap (/////analysis.tuple (list (/////analysis.text ..virtual-tag) @@ -1685,14 +1685,14 @@ (visibility-analysis visibility) (/////analysis.bit final?) (/////analysis.bit strict-fp?) - (/////analysis.tuple (list@map annotation-analysis annotationsA)) - (/////analysis.tuple (list@map var-analysis vars)) + (/////analysis.tuple (list\map annotation-analysis annotationsA)) + (/////analysis.tuple (list\map var-analysis vars)) (/////analysis.text self-name) - (/////analysis.tuple (list@map ..argument-analysis arguments)) + (/////analysis.tuple (list\map ..argument-analysis arguments)) (return-analysis return) - (/////analysis.tuple (list@map class-analysis exceptions)) + (/////analysis.tuple (list\map class-analysis exceptions)) (#/////analysis.Function - (list@map (|>> /////analysis.variable) + (list\map (|>> /////analysis.variable) (scope.environment scope)) (/////analysis.tuple (list bodyA))) )))))) @@ -1750,21 +1750,21 @@ arguments) [scope bodyA] (|> arguments' list.reverse - (list@fold scope.with-local (analyse archive body)) + (list\fold scope.with-local (analyse archive body)) (typeA.with-type returnT) /////analysis.with-scope)] (wrap (/////analysis.tuple (list (/////analysis.text ..static-tag) (/////analysis.text method-name) (visibility-analysis visibility) (/////analysis.bit strict-fp?) - (/////analysis.tuple (list@map annotation-analysis annotationsA)) - (/////analysis.tuple (list@map var-analysis vars)) - (/////analysis.tuple (list@map ..argument-analysis arguments)) + (/////analysis.tuple (list\map annotation-analysis annotationsA)) + (/////analysis.tuple (list\map var-analysis vars)) + (/////analysis.tuple (list\map ..argument-analysis arguments)) (return-analysis return) - (/////analysis.tuple (list@map class-analysis + (/////analysis.tuple (list\map class-analysis exceptions)) (#/////analysis.Function - (list@map (|>> /////analysis.variable) + (list\map (|>> /////analysis.variable) (scope.environment scope)) (/////analysis.tuple (list bodyA))) )))))) @@ -1826,22 +1826,22 @@ [scope bodyA] (|> arguments' (#.Cons [self-name selfT]) list.reverse - (list@fold scope.with-local (analyse archive body)) + (list\fold scope.with-local (analyse archive body)) (typeA.with-type returnT) /////analysis.with-scope)] (wrap (/////analysis.tuple (list (/////analysis.text ..overriden-tag) (class-analysis parent-type) (/////analysis.text method-name) (/////analysis.bit strict-fp?) - (/////analysis.tuple (list@map annotation-analysis annotationsA)) - (/////analysis.tuple (list@map var-analysis vars)) + (/////analysis.tuple (list\map annotation-analysis annotationsA)) + (/////analysis.tuple (list\map var-analysis vars)) (/////analysis.text self-name) - (/////analysis.tuple (list@map ..argument-analysis arguments)) + (/////analysis.tuple (list\map ..argument-analysis arguments)) (return-analysis return) - (/////analysis.tuple (list@map class-analysis + (/////analysis.tuple (list\map class-analysis exceptions)) (#/////analysis.Function - (list@map (|>> /////analysis.variable) + (list\map (|>> /////analysis.variable) (scope.environment scope)) (/////analysis.tuple (list bodyA))) )))))) @@ -1864,8 +1864,8 @@ (list.filter (function (_ [sub-name subJT]) (|> super-set (list.filter (function (_ [super-name superJT]) - (and (text@= super-name sub-name) - (jvm@= superJT subJT)))) + (and (text\= super-name sub-name) + (jvm\= superJT subJT)))) list.size (n.= 1) not)) @@ -1886,12 +1886,12 @@ class (phase.lift (reflection!.load name)) #let [expected-parameters (|> (java/lang/Class::getTypeParameters class) array.to-list - (list@map (|>> java/lang/reflect/TypeVariable::getName)))] + (list\map (|>> java/lang/reflect/TypeVariable::getName)))] _ (phase.assert ..class-parameter-mismatch [expected-parameters actual-parameters] (n.= (list.size expected-parameters) (list.size actual-parameters)))] (wrap (|> (list.zip/2 expected-parameters actual-parameters) - (list@fold (function (_ [expected actual] mapping) + (list\fold (function (_ [expected actual] mapping) (case (jvm-parser.var? actual) (#.Some actual) (dictionary.put actual expected mapping) @@ -1923,7 +1923,7 @@ (do {! phase.monad} [parameters (typeA.with-env (..parameter-types parameters)) - #let [mapping (list@fold (function (_ [parameterJ parameterT] mapping) + #let [mapping (list\fold (function (_ [parameterJ parameterT] mapping) (dictionary.put (jvm-parser.name parameterJ) parameterT mapping)) @@ -1958,7 +1958,7 @@ body]) (do ! [aliasing (super-aliasing parent-type)] - (wrap [method-name (|> (jvm.method [(list@map product.right arguments) + (wrap [method-name (|> (jvm.method [(list\map product.right arguments) return exceptions]) (jvm-alias.method aliasing))]))) @@ -1971,8 +1971,8 @@ (list.empty? invalid-overriden-methods))] (wrap (#/////analysis.Extension extension-name (list (class-analysis super-class) - (/////analysis.tuple (list@map class-analysis super-interfaces)) - (/////analysis.tuple (list@map typed-analysis constructor-argsA+)) + (/////analysis.tuple (list\map class-analysis super-interfaces)) + (/////analysis.tuple (list\map typed-analysis constructor-argsA+)) (/////analysis.tuple methodsA))))))])) (def: bundle::class diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 1c50d6eb5..29fb70e63 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -15,7 +15,7 @@ ["." text ["%" format (#+ format)]] [collection - ["." list ("#@." functor)] + ["." list ("#\." functor)] ["." dictionary (#+ Dictionary)]]] [type ["." check]] @@ -113,9 +113,9 @@ else (typeA.with-type expectedT (phase archive else))] (wrap (|> conditionals - (list@map (function (_ [cases branch]) + (list\map (function (_ [cases branch]) (////analysis.tuple - (list (////analysis.tuple (list@map (|>> ////analysis.nat) cases)) + (list (////analysis.tuple (list\map (|>> ////analysis.nat) cases)) branch)))) (list& input else) (#////analysis.Extension extension-name)))))]))) diff --git a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index 8f44551d1..2837d6620 100644 --- a/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -5,7 +5,7 @@ ["." monad (#+ do)]] [control [pipe (#+ case>)] - ["<>" parser ("#@." monad) + ["<>" parser ("#\." monad) ["" code (#+ Parser)] ["" text]]] [data @@ -15,7 +15,7 @@ [text ["%" format (#+ format)]] [collection - ["." list ("#@." functor fold)] + ["." list ("#\." functor fold)] ["." dictionary] ["." row]]] [type @@ -25,7 +25,7 @@ [target [jvm ["_" bytecode (#+ Bytecode)] - ["." modifier (#+ Modifier) ("#@." monoid)] + ["." modifier (#+ Modifier) ("#\." monoid)] ["." attribute] ["." field] ["." version] @@ -75,7 +75,7 @@ (Parser (Modifier field.Field)) (`` ($_ <>.either (~~ (template [