diff options
212 files changed, 1343 insertions, 1106 deletions
diff --git a/documentation/book/the_lux_programming_language/chapter_6.md b/documentation/book/the_lux_programming_language/chapter_6.md index fbd8a8d8d..97f934251 100644 --- a/documentation/book/the_lux_programming_language/chapter_6.md +++ b/documentation/book/the_lux_programming_language/chapter_6.md @@ -312,5 +312,5 @@ However, one of the key features of Lux is that types can be accessed and manipu In the next chapter, you'll get acquainted with one such feature. -See you in the next chapter! +See you in [the next chapter](chapter_7.md)! diff --git a/documentation/book/the_lux_programming_language/chapter_7.md b/documentation/book/the_lux_programming_language/chapter_7.md new file mode 100644 index 000000000..49c204626 --- /dev/null +++ b/documentation/book/the_lux_programming_language/chapter_7.md @@ -0,0 +1,190 @@ +# Chapter 7: Interfaces and Implementations + +_Where types and values collide._ + +--- + +You endured all that tedious talk about types; but it wasn't for nothing. + +Now, you'll see types in action, as they take a new _shape_... and a new _purpose_. + +Many programming languages have some kind of module system or polymorphism system. + +You know what I'm talking about. + +Object-oriented languages have classes with methods that can be overriden by their subclasses. The moment you call one of those methods on an object, the run-time system selects for you the correct implementation, based on the class hierarchy. + +Or maybe you come from Haskell, where they have type-classes, that basically perform the same process, but during compilation. Types are checked, instances get picked, and the proper functions and constants get plugged-in. + +Or may, you come from the world of ML (specially Standard ML), where they have a module system based on signatures and structures. In those systems, the function implementations you want don't get selected for you automatically (you have to pick them yourself), but you tend to have more control when it comes to choosing what to use. + +The origin of Lux's polymorphism system is I... um... _borrowed_ it from the SML guys. I re-named signatures as interfaces and structures as implementations to give them more recognizable names. + +But I also added my own little twist. + +You see, module/polymorphism systems in programming languages tend to live in a mysterious world that is removed from the rest of the language. It's a similar situation as with types. + +Remember Lux's type system? Most languages keep their types separate from their values. Types are just some cute annotations you put in your code to keep the compiler happy. Lux's types, on the other hand, are alive; for they are values. Nothing stops you from using them, transforming them and analyzing them in ways that go beyond the language designer's imagination (_that would be me_). + +Well, there's a similar story to tell about module/polymorphism systems. The run-time/compiler chooses everything for you; and even when you choose for yourself, you're still somewhat limited in what you can do. Implementations are not values, and there is a fundamental division between them and the rest of the language. + +But not in Lux. + +Lux's polymorphism system is actually based on regular types and values. And because types are values, that means it's just ~~turtles~~ values all the way down. + +_But, how does it work?_ + +**Read on!** + +## Interfaces + +They provide a description of the functionality expected of proper implementations. They have a list of expected member values/functions, with their associated types. + +Here's an example: + +``` +(interface: #export (Order a) + (: (Equivalence a) + &equivalence) + + (: (-> a a Bit) + <)) +``` + +That _interface_ definition comes from the `lux/abstract/order` module, and it deals with _ordered_ types; that is, types for which you can compare their values in ways that imply some sort of sequential order. + +It's polymorphic/parameterized because this interface must be able to adapt to any type that fits its requirements. + +Also, you may notice that it has a member called `&equivalence`, of type `(Equivalence a)`. The reason is that interfaces can expand upon (or be based on) other interfaces (such as `Equivalence`). + +_How do interfaces differ from types?_ + +They don't. They're actually implemented as _types_. +Specifically, as record/tuple types. + +You see, if I can create a record type with one field for every expected definition in a interface, then that's all I need. + +## Implementations + +They are the other side of the coin. + +If interfaces are record types, then that means implementations must be actual records. + +Let's take a look at how you make one: + +``` +(implementation: #export order (Order Frac) + (def: &equivalence ..equivalence) + (def: < ..<)) +``` + +This implementation comes from `library/lux/math/number/frac`. + +As you may notice, implementations have names; unlike in object-oriented languages where the "implementation" would just be the implemented methods of a class, or Haskell where _instances_ are anonymous. + +For implementations, the convention is just to name them as lower-cased versions of the interfaces they implement. + +Here is another example, from the `lux/data/collection/list` module: + +``` +(implementation: #export monoid + (All [a] + (Monoid (List a))) + + (def: identity #.End) + (def: (compose xs ys) + (case xs + #.End ys + (#.Item x xs') (#.Item x (compose xs' ys))))) +``` + +The reason why implementations have names (besides the fact that they are definitions like any other), is that you can actually construct multiple valid implementations for the same combination of interfaces and parameter types. That would require you to distinguish each implementation in some way in order to use it. This is one cool advantage over Haskell's +_type-classes_ and _instances_, where you can only have one instance for any combination of type-class and parameter. + + Haskellers often resort to "hacks" such as using newtype to try to get around this limitation. + +The upside of having the run-time/compiler pick the implementation for you is that you can avoid some boilerplate when writing polymorphic code. + +The upside of picking the implementation yourself is that you get more control and predictability over what's happening (which is specially cool when you consider that _implementations_ are first-class values). + +What's the big importance of _implementations_ being first-class values? +Simple: it means you can create your own _implementations_ at run-time based on arbitrary data and logic, and you can combine and transform _implementations_ however you want. + +Standard ML offers something like that by a mechanism they call "functors" (unrelated to a concept of "functor" we'll see in a later chapter), but they are more like _magical functions_ that the compiler uses to combine _structures_ in limited ways. + +In Lux, we dispense with the formalities and just use regular old functions and values to get the job done. + +## How to use implementations + +We've put functions and values inside our implementations. + +It's time to get them out and use them. + +There are 2 main ways to use the stuff inside your implementations: `open:` and `\`. +Let's check them out. + +``` +## Opens an implementation and generates a definition for each of its members (including nested members). +## For example: +(open library/lux/math/number/int.order "i::.") +## Will generate: +(def: i::= (\ library/lux/math/number/int.order =)) +(def: i::< (\ library/lux/math/number/int.order <)) +``` + +The `open:` macro serves as a statement that creates private/un-exported definitions in your module for every member of a particular implementation. +You may also give it an optional prefix for the definitions, in case you want to avoid any name clash. + + You might want to check out [Appendix C](appendix_c.md) to discover a pattern-matching macro version of `open:` called `^open`. + +``` +## Allows accessing the value of a implementation's member. +(: (-> Int Text) + (\ library/lux/math/number/int.decimal encode)) + +## Also allows using that value as a function. +(\ library/lux/math/number/int.decimal encode +123) +## => "+123" +``` + +`\` is for when you want to use individual parts of a implementation immediately in your code, instead of opening them first. + + Psss! Did you notice `\` is _piping enabled_? + +Also, you don't really need to worry about boilerplate related to using implementations. There is a module called `lux/type/implicit` which gives you a macro called `\\` for using implementations without actually specifying which one you need. + +The macro infers everything for you based on the types of the arguments, the expected type of the expression, and the implementations available in the environment. + +For more information about that, head over to [Appendix F](appendix_f.md) to read more about that. + +## Implementations as values + +I can't emphasize enough that _implementations_ are values. And to exemplify it for you, here's a function from the `lux/abstract/monad` module that takes in an implementation (among other things) and uses it within its code: + +``` +(def: #export (map monad f xs) + (All [M a b] + (-> (Monad M) (-> a (M b)) (List a) (M (List b)))) + (case xs + #.End + (\ monad in #.End) + + (#.Item x xs') + (do monad + [y (f x) + ys (map monad f xs')] + (wrap (#.Item y ys))))) +``` + +`Monad` is an interface and the `map` function takes arbitrary `Monad` implementations and can work with any of them without an issue. + +--- + +_Interfaces_ and _implementation_ are the main mechanism for writing polymorphic code in Lux, and they allow flexible and precise control over polymorphism. + +It may be the case that in the future Lux adds new mechanisms for achieving the same goals (I believe in having variety), but the spirit of implementing things in terms of accessible values anybody can manipulate will likely underlie every such mechanism. + +Now that we've discussed _interfaces_ and _implementations_, it's time to talk about a _very special family of interfaces_. + +See you in the next chapter! + diff --git a/documentation/bookmark/computation.md b/documentation/bookmark/computation.md new file mode 100644 index 000000000..526db5e9f --- /dev/null +++ b/documentation/bookmark/computation.md @@ -0,0 +1,6 @@ +# Construct + +1. [Fundamental Constructs in Programming Languages](https://arxiv.org/abs/2107.10545) +1. [Deconstructing Lambdas—An Awkward Guide to Programming Without Functions](https://www.youtube.com/watch?v=xZmPuz9m2t0) +1. [Compiling to categories](http://conal.net/papers/compiling-to-categories/) + diff --git a/documentation/bookmark/database.md b/documentation/bookmark/database.md index 2506f07c4..5b0784c07 100644 --- a/documentation/bookmark/database.md +++ b/documentation/bookmark/database.md @@ -188,6 +188,10 @@ 1. [Noria: data-flow for high-performance web applications](https://github.com/mit-pdos/noria) +## Vector Database + +1. [What is a Vector Database?](https://www.pinecone.io/learn/vector-database/) + ## Graph 1. https://github.com/hugegraph/hugegraph diff --git a/documentation/bookmark/inspiration.md b/documentation/bookmark/inspiration.md index 7ae89147d..3e5841ba7 100644 --- a/documentation/bookmark/inspiration.md +++ b/documentation/bookmark/inspiration.md @@ -16,6 +16,7 @@ # Human-machine interaction +1. [Up and Down the Ladder of Abstraction: A Systematic Approach to Interactive Visualization](http://worrydream.com/LadderOfAbstraction/) 1. [How a computer should talk to people](https://moscow.sci-hub.se/3290/2c0a7f4bb78d9f9521ad2d2e92463d5f/dean1982.pdf) 1. [The Tyranny of the Minimum Viable User](https://old.reddit.com/r/dredmorbius/comments/69wk8y/the_tyranny_of_the_minimum_viable_user/) diff --git a/documentation/bookmark/tool/integrated_development_environment.md b/documentation/bookmark/tool/integrated_development_environment.md index 27a302301..df66dc5c4 100644 --- a/documentation/bookmark/tool/integrated_development_environment.md +++ b/documentation/bookmark/tool/integrated_development_environment.md @@ -1,3 +1,7 @@ +# Error + +1. [Do Developers Read Compiler Error Messages?](https://static.barik.net/barik/publications/icse2017/PID4655707.pdf) + # Tools 1. [Utilso: All-in-one tools for developers](https://utilso.com/) diff --git a/documentation/bookmark/tool/text_editor.md b/documentation/bookmark/tool/text_editor.md index 07d68eecd..49ad18126 100644 --- a/documentation/bookmark/tool/text_editor.md +++ b/documentation/bookmark/tool/text_editor.md @@ -160,6 +160,7 @@ ## General +1. [Slate: A completely customizable framework for building rich text editors.](https://github.com/ianstormtaylor/slate) 1. [Trix: A rich text editor for everyday writing.](https://trix-editor.org/) 1. [Left](https://100r.co/site/left.html) 1. https://howl.io/ diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 2f5d197e7..eba5052cf 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -325,7 +325,7 @@ Called by `imenu--generic-function'." (control//logic (altRE "and" "or")) (control//contract (altRE "pre" "post")) ;; Type - (type//syntax (altRE "|" "&" "->" "All" "Ex" "Rec" "primitive" "type")) + (type//syntax (altRE "Variant" "Or" "Tuple" "And" "->" "All" "Ex" "Rec" "primitive" "type")) (type//checking (altRE ":" ":as" ":let" ":~" ":assume" ":of" ":cast" ":sharing" ":by_example" ":hole")) (type//abstract (altRE "abstract:" ":abstraction" ":representation" ":transmutation" "\\^:representation")) (type//unit (altRE "unit:" "scale:")) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 6f4d8071d..5b7f56b2a 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1140,7 +1140,7 @@ ("lux text concat" "(All [a] (-> a a))" __paragraph) ("lux text concat" ("lux text concat" "## A name can be provided, to specify a recursive type." __paragraph) - "(All List [a] (| Any [a (List a)]))"))))] + "(All List [a] (Variant Any [a (List a)]))"))))] #End) (let'' [self_name tokens] ({(#Item [_ (#Identifier "" self_name)] tokens) [self_name tokens] @@ -1282,12 +1282,12 @@ (failure "Wrong syntax for list&")} (list\reverse xs))) -(macro:' #export (& tokens) +(macro:' #export (Tuple tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Tuple types:" __paragraph) ("lux text concat" - ("lux text concat" "(& Text Int Bit)" __paragraph) + ("lux text concat" "(Tuple Text Int Bit)" __paragraph) ("lux text concat" ("lux text concat" "## Any." __paragraph) "(&)"))))] @@ -1301,15 +1301,15 @@ prevs)))} (list\reverse tokens))) -(macro:' #export (| tokens) +(macro:' #export (Variant tokens) (#Item [(tag$ ["library/lux" "doc"]) (text$ ("lux text concat" ("lux text concat" "## Variant types:" __paragraph) ("lux text concat" - ("lux text concat" "(| Text Int Bit)" __paragraph) + ("lux text concat" "(Variant Text Int Bit)" __paragraph) ("lux text concat" ("lux text concat" "## Nothing." __paragraph) - "(|)"))))] + "(Variant)"))))] #End) ({#End (return (list (identifier$ ["library/lux" "Nothing"]))) @@ -1402,9 +1402,19 @@ (failure "Wrong syntax for def:'''")} tokens)) +(def:''' #export Or + #End + Macro + ..Variant) + +(def:''' #export And + #End + Macro + ..Tuple) + (def:''' (pairs xs) #End - (All [a] (-> ($' List a) ($' List (& a a)))) + (All [a] (-> ($' List a) ($' List (Tuple a a)))) ({(#Item x (#Item y xs')) (#Item [x y] (pairs xs')) @@ -1414,7 +1424,7 @@ (macro:' (let' tokens) ({(#Item [[_ (#Tuple bindings)] (#Item [body #End])]) - (return (list (list\fold ("lux type check" (-> (& Code Code) Code + (return (list (list\fold ("lux type check" (-> (Tuple Code Code) Code Code) (function' [binding body] ({[label value] @@ -1535,10 +1545,10 @@ ("lux def type tagged" Monad (#Named ["library/lux" "Monad"] (All [m] - (& (All [a] (-> a ($' m a))) - (All [a b] (-> (-> a ($' m b)) - ($' m a) - ($' m b)))))) + (Tuple (All [a] (-> a ($' m a))) + (All [a b] (-> (-> a ($' m b)) + ($' m a) + ($' m b)))))) (record$ (list)) ["in" "bind"] #0) @@ -1577,7 +1587,7 @@ ({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End))) (let' [g!in (local_identifier$ "in") g!bind (local_identifier$ " bind ") - body' (list\fold ("lux type check" (-> (& Code Code) Code Code) + body' (list\fold ("lux type check" (-> (Tuple Code Code) Code Code) (function' [binding body'] (let' [[var value] binding] ({[_ (#Tag "" "let")] @@ -1656,7 +1666,7 @@ (def:''' PList #End Type - (All [a] ($' List (& Text a)))) + (All [a] ($' List (Tuple Text a)))) (def:''' (get k plist) #End @@ -1882,7 +1892,7 @@ [_ [_ (#Record fields)]] (do meta_monad [=fields (monad\map meta_monad - ("lux type check" (-> (& Code Code) ($' Meta Code)) + ("lux type check" (-> (Tuple Code Code) ($' Meta Code)) (function' [kv] (let' [[k v] kv] (do meta_monad @@ -2087,7 +2097,7 @@ [meta (#Form (list\map (apply_template env) elems))] [meta (#Record members)] - [meta (#Record (list\map ("lux type check" (-> (& Code Code) (& Code Code)) + [meta (#Record (list\map ("lux type check" (-> (Tuple Code Code) (Tuple Code Code)) (function' [kv] (let' [[slot value] kv] [(apply_template env slot) (apply_template env value)]))) @@ -2296,7 +2306,7 @@ (def:''' (macro' modules current_module module name) #End - (-> ($' List (& Text Module)) + (-> ($' List (Tuple Text Module)) Text Text Text ($' Maybe Macro)) (do maybe_monad @@ -2462,7 +2472,7 @@ (form$ (#Item [(tag$ tag) (list\map walk_type parts)])) [_ (#Tuple members)] - (` (& (~+ (list\map walk_type members)))) + (` (Tuple (~+ (list\map walk_type members)))) [_ (#Form (#Item [_ (#Text "lux in-module")] (#Item [_ (#Text module)] @@ -2536,7 +2546,7 @@ (template [<name> <type> <value>] [(def:''' (<name> xy) #End - (All [a b] (-> (& a b) <type>)) + (All [a b] (-> (Tuple a b) <type>)) (let' [[x y] xy] <value>))] [first a x] @@ -2544,7 +2554,7 @@ (def:''' (unfold_type_def type_codes) #End - (-> ($' List Code) ($' Meta (& Code ($' Maybe ($' List Text))))) + (-> ($' List Code) ($' Meta (Tuple Code ($' Maybe ($' List Text))))) ({(#Item [_ (#Record pairs)] #End) (do meta_monad [members (monad\map meta_monad @@ -2557,7 +2567,7 @@ (failure "Wrong syntax for variant case.")} pair))) pairs)] - (return [(` (& (~+ (list\map second members)))) + (return [(` (Tuple (~+ (list\map second members)))) (#Some (list\map first members))])) (#Item type #End) @@ -2565,7 +2575,7 @@ (return [(` .Any) (#Some (list member_name))]) [_ (#Form (#Item [_ (#Tag "" member_name)] member_types))] - (return [(` (& (~+ member_types))) (#Some (list member_name))]) + (return [(` (Tuple (~+ member_types))) (#Some (list member_name))]) _ (return [type #None])} @@ -2583,13 +2593,13 @@ (return [member_name member_type]) [_ (#Form (#Item [_ (#Tag "" member_name)] member_types))] - (return [member_name (` (& (~+ member_types)))]) + (return [member_name (` (Tuple (~+ member_types)))]) _ (failure "Wrong syntax for variant case.")} case))) (list& case cases))] - (return [(` (| (~+ (list\map second members)))) + (return [(` (..Variant (~+ (list\map second members)))) (#Some (list\map first members))])) _ @@ -4208,7 +4218,7 @@ ($_ text\compose "(" name " " (|> params (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")) (#Sum _) - ($_ text\compose "(| " (|> (flat_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") + ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Product _) ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]") @@ -4950,7 +4960,7 @@ (-> Location Location) [file line (inc column)]) -(def: rejoin_all_pairs +(def: un_paired (-> (List [Code Code]) (List Code)) (|>> (list\map rejoin_pair) list\join)) @@ -4983,9 +4993,9 @@ <open> parts_text <close>)])]) - ([#Form "(" ")" ..function\identity] - [#Tuple "[" "]" ..function\identity] - [#Record "{" "}" rejoin_all_pairs]) + ([#Form "(" ")" |>] + [#Tuple "[" "]" |>] + [#Record "{" "}" ..un_paired]) [new_location (#Rev value)] ("lux io error" "@doc_example_to_text Undefined behavior.") diff --git a/stdlib/source/library/lux/abstract/algebra.lux b/stdlib/source/library/lux/abstract/algebra.lux index 8e611b513..ca126b064 100644 --- a/stdlib/source/library/lux/abstract/algebra.lux +++ b/stdlib/source/library/lux/abstract/algebra.lux @@ -11,7 +11,7 @@ (-> a (f a))) (type: #export (RAlgebra f a) - (-> (f (& (Fix f) a)) a)) + (-> (f (Tuple (Fix f) a)) a)) (type: #export (RCoAlgebra f a) - (-> a (f (| (Fix f) a)))) + (-> a (f (Or (Fix f) a)))) diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index 2c1a731f3..3c2ce81b7 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -59,7 +59,7 @@ (` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))))) )))) body - (list.reverse (list.pairs bindings)))] + (list.reversed (list.pairs bindings)))] (#.Right [state (list (case ?name (#.Some name) (let [name [location.dummy (#.Identifier ["" name])]] diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux index f168eebe0..140376477 100644 --- a/stdlib/source/library/lux/abstract/functor.lux +++ b/stdlib/source/library/lux/abstract/functor.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #*]]) + [lux (#- Or And)]]) (interface: #export (Functor f) (: (All [a b] @@ -12,7 +12,7 @@ (f (Fix f))) (type: #export (Or f g) - (All [a] (| (f a) (g a)))) + (All [a] (.Or (f a) (g a)))) (def: #export (sum (^open "f\.") (^open "g\.")) {#.doc (doc "Co-product (sum) composition for functors.")} @@ -27,7 +27,7 @@ (#.Right (g\map f ga)))))) (type: #export (And f g) - (All [a] (& (f a) (g a)))) + (All [a] (.And (f a) (g a)))) (def: #export (product (^open "f\.") (^open "g\.")) {#.doc (doc "Product composition for functors.")} diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index b1f9847e7..b0e09b794 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -27,7 +27,7 @@ (#.Item _ xs') (recur (inc counter) xs')))) -(def: (reverse xs) +(def: (reversed xs) (All [a] (-> (List a) (List a))) (list\fold (function (_ head tail) (#.Item head tail)) @@ -91,7 +91,7 @@ (` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join))) )))) body - (reverse (pairs bindings)))] + (reversed (pairs bindings)))] (#.Right [state (list (case ?name (#.Some name) (let [name [location.dummy (#.Identifier ["" name])]] diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index 8fbd74b1f..c32aac5eb 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -70,7 +70,7 @@ (~ next)) (~ value))))) expression - (list.reverse context))] + (list.reversed context))] (in (list (case ?name (#.Some name) (let [name (code.local_identifier name)] diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 2a9e61ac7..2cf1c5e10 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -208,19 +208,19 @@ (def: #export && {#.doc (doc "Groups the 2 topmost stack values as a 2-tuple.")} - (All [a b] (=> [a b] [(& a b)])) + (All [a b] (=> [a b] [(Tuple a b)])) (function (_ [[stack l] r]) [stack [l r]])) (def: #export ||L {#.doc (doc "Left-injects the top into sum.")} - (All [a b] (=> [a] [(| a b)])) + (All [a b] (=> [a] [(Or a b)])) (function (_ [stack l]) [stack (0 #0 l)])) (def: #export ||R {#.doc (doc "Right-injects the top into sum.")} - (All [a b] (=> [b] [(| a b)])) + (All [a b] (=> [b] [(Or a b)])) (function (_ [stack r]) [stack (0 #1 r)])) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 4f96b2122..dc95a97e1 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -149,7 +149,7 @@ (def: #export (or left right) {#.doc (doc "Yields the results of whichever async gets resolved first." "You can tell which one was resolved first through pattern-matching.")} - (All [a b] (-> (Async a) (Async b) (Async (| a b)))) + (All [a b] (-> (Async a) (Async b) (Async (Or a b)))) (let [[a|b resolve] (..async [])] (with_expansions [<sides> (template [<async> <tag>] diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index ac913de17..8358da7b3 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -173,7 +173,7 @@ next)]) [0 #.End]) product.right - list.reverse + list.reversed ..report')) (def: separator diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index da293b1f6..9b66afa50 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -51,7 +51,7 @@ (All [i o] (-> (Hash i) (Memo i o) (-> i o))) (let [memo (//.mixin (//.inherit ..memoization (//.of_recursive memo))) - empty (dictionary.new hash)] + empty (dictionary.empty hash)] (|>> memo (state.run empty) product.right))) (def: #export (none hash memo) @@ -60,5 +60,5 @@ (All [i o] (-> (Hash i) (Memo i o) (-> i o))) (let [memo (//.mixin (//.of_recursive memo)) - empty (dictionary.new hash)] + empty (dictionary.empty hash)] (|>> memo (state.run empty) product.right))) diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index b4169e2d5..ad639f00f 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -108,7 +108,7 @@ (def: #export (or left right) {#.doc "Heterogeneous alternative combinator."} (All [s a b] - (-> (Parser s a) (Parser s b) (Parser s (| a b)))) + (-> (Parser s a) (Parser s b) (Parser s (Or a b)))) (function (_ tokens) (case (left tokens) (#try.Success [tokens' output]) diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index b94490a95..19b02e507 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- nat int rev) + [lux (#- Variant Tuple nat int rev) [abstract [monad (#+ do)]] [control diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index 66e2d6e77..ec683489f 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -124,7 +124,7 @@ _ (//.lift (exception.except ..invalid_tag [(~~ (template.amount <case>+)) flag])))))) (def: #export (or left right) - (All [l r] (-> (Parser l) (Parser r) (Parser (| l r)))) + (All [l r] (-> (Parser l) (Parser r) (Parser (Or l r)))) (!variant [[0 #.Left left] [1 #.Right right]])) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index 7dd43ffa4..6edbb9ed1 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -21,11 +21,11 @@ ["." frac]]]]] ["." //]) -(def: (join_pairs pairs) +(def: (un_paired pairs) (All [a] (-> (List [a a]) (List a))) (case pairs #.End #.End - (#.Item [[x y] pairs']) (list& x y (join_pairs pairs')))) + (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) (type: #export Parser {#.doc "A Lux code parser."} @@ -153,7 +153,7 @@ (function (_ tokens) (case tokens (#.Item [[_ (#.Record pairs)] tokens']) - (case (p (join_pairs pairs)) + (case (p (un_paired pairs)) (#try.Success [#.End x]) (#try.Success [tokens' x]) _ (#try.Failure ($_ text\compose "Parser was expected to fully consume record" (remaining_inputs tokens)))) diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux index ea3370c0a..b7d2d8ebf 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -31,7 +31,7 @@ (def: #export empty {#.doc (doc "An empty environment.")} Environment - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: #export (property name) (-> Property (Parser Text)) diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index b902d4b81..d8406d3ec 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- function loop i64) + [lux (#- Variant Tuple function loop i64) [abstract [monad (#+ do)]] [control diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index 767565fc5..345eae8ee 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -92,7 +92,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_code output)]) + (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]) _ (exception.except ..cannot_parse [])))) @@ -134,7 +134,7 @@ {#.doc (doc "Checks that a specific text shows up in the input.")} (-> Text (Parser Any)) (function (_ [offset tape]) - (case (/.index_of' reference offset tape) + (case (/.index_of' offset reference tape) (#.Some where) (if (n.= offset where) (#try.Success [[("lux i64 +" (/.size reference) offset) tape] @@ -158,7 +158,7 @@ (function (_ (^@ input [offset tape])) (case (/.nth offset tape) (#.Some output) - (#try.Success [input (/.of_code output)]) + (#try.Success [input (/.of_char output)]) _ (exception.except ..cannot_parse [])))) @@ -175,7 +175,7 @@ (do //.monad [char any #let [char' (maybe.assume (/.nth 0 char))] - _ (//.assertion ($_ /\compose "Character is not within range: " (/.of_code bottom) "-" (/.of_code top)) + _ (//.assertion ($_ /\compose "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) (.and (n.>= bottom char') (n.<= top char')))] (in char))) @@ -214,7 +214,7 @@ [(exception: #export (<name> {options Text} {character Char}) (exception.report ["Options" (/.format options)] - ["Character" (/.format (/.of_code character))]))] + ["Character" (/.format (/.of_char character))]))] [character_should_be] [character_should_not_be] @@ -227,7 +227,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (let [output' (/.of_code output)] + (let [output' (/.of_char output)] (if (<modifier> (/.contains? output' options)) (#try.Success [[("lux i64 +" 1 offset) tape] output']) (exception.except <exception> [options output]))) @@ -246,7 +246,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (let [output' (/.of_code output)] + (let [output' (/.of_char output)] (if (<modifier> (/.contains? output' options)) (#try.Success [[("lux i64 +" 1 offset) tape] {#basis offset @@ -262,7 +262,7 @@ (exception: #export (character_does_not_satisfy_predicate {character Char}) (exception.report - ["Character" (/.format (/.of_code character))])) + ["Character" (/.format (/.of_char character))])) (def: #export (satisfies parser) {#.doc "Yields characters that satisfy a predicate."} @@ -271,7 +271,7 @@ (case (/.nth offset tape) (#.Some output) (if (parser output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_code output)]) + (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]) (exception.except ..character_does_not_satisfy_predicate [output])) _ diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index c4438fbf8..7933f3a90 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -71,7 +71,7 @@ (def: #export fresh {#.doc (doc "An empty parsing environment.")} Env - (dictionary.new n.hash)) + (dictionary.empty n.hash)) (def: (run' env poly types) (All [a] (-> Env (Parser a) (List Type) (Try a))) @@ -208,7 +208,7 @@ partial_varL (label partial_varI) partialC (` ((~ funcL) (~+ (|> (list.indices num_args) (list\map (|>> (n.* 2) inc (n.+ funcI) label)) - list.reverse))))] + list.reversed))))] (recur (inc current_arg) (|> env' (dictionary.put partialI [.Nothing partialC]) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index 128c8f036..5f40fc055 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -43,15 +43,15 @@ (in (list (` (let [(~ binding) (~ prev)] (~ body)))))) -(def: _reverse_ +(def: _reversed_ (Parser Any) (function (_ tokens) - (#e.Success [(list.reverse tokens) []]))) + (#e.Success [(list.reversed tokens) []]))) -(syntax: #export (cond> {_ _reverse_} +(syntax: #export (cond> {_ _reversed_} prev {else body^} - {_ _reverse_} + {_ _reversed_} {branches (p.some (p.and body^ body^))}) {#.doc (doc "Branching for pipes." "Both the tests and the bodies are piped-code, and must be given inside a tuple." @@ -117,10 +117,10 @@ [(i.+ +4)] [inc])))} (with_gensyms [g!temp] - (case (list.reverse steps) + (case (list.reversed steps) (^ (list& last_step prev_steps)) (let [step_bindings (do list.monad - [step (list.reverse prev_steps)] + [step (list.reversed prev_steps)] (list g!temp (` (|> (~ g!temp) (~+ step)))))] (in (list (` ((~! do) (~ monad) [(~' #let) [(~ g!temp) (~ prev)] diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux index 281c8d19e..a7cda544b 100644 --- a/stdlib/source/library/lux/control/region.lux +++ b/stdlib/source/library/lux/control/region.lux @@ -44,7 +44,7 @@ (format separator error|output)))) -(def: (combine_outcomes clean_up output) +(def: (clean clean_up output) (All [a] (-> (Try Any) (Try a) (Try a))) (case clean_up (#try.Success _) @@ -59,10 +59,10 @@ (-> (Monad !) (All [r] (Region r ! a)) (! (Try a)))) (do {! monad} - [[cleaners output] (computation [[] (list)]) - results (monad.map ! (function (_ cleaner) (cleaner [])) - cleaners)] - (in (list\fold combine_outcomes output results)))) + [[cleaners output] (computation [[] (list)])] + (|> cleaners + (monad.map ! (function (_ cleaner) (cleaner []))) + (\ ! map (list\fold clean output))))) (def: #export (acquire monad cleaner value) {#.doc (doc "Acquire a resource while pairing it a function that knows how to reclaim it.")} diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index 236ded86b..b528d22aa 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -27,7 +27,7 @@ {#.doc (doc "A brand-new box initialized to the given value.")} (All [a] (-> a (All [!] (Thread ! (Box ! a))))) (function (_ !) - (|> (array.new 1) + (|> (array.empty 1) (array.write! 0 init) :abstraction))) diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index deec60d53..1b320f241 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -188,7 +188,7 @@ (..make-bytevector size)} ## Default - (array.new size))) + (array.empty size))) (def: #export (fold f init binary) (All [a] (-> (-> I64 a a) a Binary a)) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 330ea38eb..9c07bef65 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -35,7 +35,7 @@ "jvm conversion long-to-int"))} (as_is)) - (def: #export (new size) + (def: #export (empty size) {#.doc (doc "An empty array of the specified size.")} (All [a] (-> Nat (Array a))) (for {@.old @@ -274,14 +274,14 @@ (#.Some x) (write! idx x ys))) - (new arr_size) + (empty arr_size) (list.indices arr_size)))) (def: #export (of_list xs) (All [a] (-> (List a) (Array a))) (product.right (list\fold (function (_ x [idx arr]) [(inc idx) (write! idx x arr)]) - [0 (new (list.size xs))] + [0 (empty (list.size xs))] xs))) (def: underflow @@ -338,12 +338,12 @@ (implementation: #export monoid (All [a] (Monoid (Array a))) - (def: identity (new 0)) + (def: identity (empty 0)) (def: (compose xs ys) (let [sxs (size xs) sxy (size ys)] - (|> (new (n.+ sxy sxs)) + (|> (empty (n.+ sxy sxs)) (copy! sxs 0 xs 0) (copy! sxy 0 ys sxs))))) @@ -353,7 +353,7 @@ (def: (map f ma) (let [arr_size (size ma)] (if (n.= 0 arr_size) - (new arr_size) + (empty arr_size) (list\fold (function (_ idx mb) (case (read idx ma) #.None @@ -361,7 +361,7 @@ (#.Some x) (write! idx (f x) mb))) - (new arr_size) + (empty arr_size) (list.indices arr_size)) )))) diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index f45916a00..7820cfe4c 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -30,7 +30,7 @@ (def: #export empty Bits - (array.new 0)) + (array.empty 0)) (def: #export (size bits) {#.doc (doc "Measures the size of a bit-map by counting all the 1s in the bit-map.")} @@ -85,7 +85,7 @@ chunk (|> (if (is? ..empty output) - (: Bits (array.new size|output)) + (: Bits (array.empty size|output)) output) (array.write! idx|output (.i64 chunk)) (recur (dec size|output)))) @@ -126,7 +126,7 @@ chunk (if (n.> 0 size|output) (|> (if (is? ..empty output) - (: Bits (array.new size|output)) + (: Bits (array.empty size|output)) output) (array.write! idx (.i64 chunk)) (recur (dec size|output))) @@ -153,7 +153,7 @@ chunk (|> (if (is? ..empty output) - (: Bits (array.new size|output)) + (: Bits (array.empty size|output)) output) (array.write! idx (.i64 chunk)) (recur (dec size|output)))) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 42e421952..923d64c42 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -124,16 +124,16 @@ (i64.left_shifted branching_exponent 1)) ## The cannonical empty node, which is just an empty #Base node. -(def: empty +(def: empty_node Node - (#Base clean_bitmap (array.new 0))) + (#Base clean_bitmap (array.empty 0))) ## Expands a copy of the array, to have 1 extra slot, which is used ## for storing the value. (def: (insert! idx value old_array) (All [a] (-> Index a (Array a) (Array a))) (let [old_size (array.size old_array)] - (|> (array.new (inc old_size)) + (|> (array.empty (inc old_size)) (array.copy! idx 0 old_array 0) (array.write! idx value) (array.copy! (n.- idx old_size) idx old_array (inc idx))))) @@ -152,7 +152,7 @@ (def: (remove! idx array) (All [a] (-> Index (Array a) (Array a))) (let [new_size (dec (array.size array))] - (|> (array.new new_size) + (|> (array.empty new_size) (array.copy! idx 0 array 0) (array.copy! (n.- idx new_size) (inc idx) array idx)))) @@ -232,7 +232,7 @@ ## When #Hierarchy nodes grow too small, they're demoted to #Base ## nodes to save space. -(def: (demote_hierarchy except_idx [h_size h_array]) +(def: (demotion except_idx [h_size h_array]) (All [k v] (-> Index (Hierarchy k v) [Bit_Map (Base k v)])) (product.right (list\fold (function (_ idx [insertion_idx node]) (let [[bitmap base] node] @@ -245,14 +245,16 @@ (array.write! insertion_idx (#.Left sub_node) base)]]) ))) [0 [clean_bitmap - (array.new (dec h_size))]] + (array.empty (dec h_size))]] (list.indices (array.size h_array))))) ## When #Base nodes grow too large, they're promoted to #Hierarchy to ## add some depth to the tree and help keep its balance. -(def: hierarchy_indices (List Index) (list.indices hierarchy_nodes_size)) +(def: hierarchy_indices + (List Index) + (list.indices hierarchy_nodes_size)) -(def: (promote_base put' key_hash level bitmap base) +(def: (promotion put' key_hash level bitmap base) (All [k v] (-> (-> Level Hash_Code k v (Hash k) (Node k v) (Node k v)) (Hash k) Level @@ -268,14 +270,14 @@ (#.Some (#.Right [key' val'])) (array.write! hierarchy_idx - (put' (level_up level) (\ key_hash hash key') key' val' key_hash empty) + (put' (level_up level) (\ key_hash hash key') key' val' key_hash empty_node) h_array) #.None (undefined))] default)) [0 - (array.new hierarchy_nodes_size)] + (array.empty hierarchy_nodes_size)] hierarchy_indices))) ## All empty nodes look the same (a #Base node with clean bitmap is @@ -302,7 +304,7 @@ [_size sub_node] _ - [(inc _size) empty])] + [(inc _size) empty_node])] (#Hierarchy _size' (update! idx (put' (level_up level) hash key val key_hash sub_node) hierarchy))) @@ -333,7 +335,7 @@ ## the same, a new ## #Collisions node ## is added. - (#Collisions hash (|> (array.new 2) + (#Collisions hash (|> (array.empty 2) (array.write! 0 [key' val']) (array.write! 1 [key val]))) ## Otherwise, one can @@ -342,7 +344,7 @@ ## add both KV-pairs ## to the empty one. (let [next_level (level_up level)] - (|> empty + (|> empty_node (put' next_level hash' key' val' key_hash) (put' next_level hash key val key_hash)))))) base))) @@ -356,9 +358,10 @@ ## If so, promote it to a #Hierarchy node, and add the new ## KV-pair as a singleton node to it. (#Hierarchy (inc base_count) - (|> (promote_base put' key_hash level bitmap base) + (|> base + (promotion put' key_hash level bitmap) (array.write! (level_index level hash) - (put' (level_up level) hash key val key_hash empty)))) + (put' (level_up level) hash key val key_hash empty_node)))) ## Otherwise, just resize the #Base node to accommodate the ## new KV-pair. (#Base (set_bit_position bit bitmap) @@ -381,7 +384,7 @@ ## If the hashes are not equal, create a new #Base node that ## contains the old #Collisions node, plus the new KV-pair. (|> (#Base (bit_position level _hash) - (|> (array.new 1) + (|> (array.empty 1) (array.write! 0 (#.Left node)))) (put' level hash key val key_hash))) )) @@ -410,7 +413,7 @@ ## Check if it's due time for a demotion. (if (n.<= demotion_threshold h_size) ## If so, perform it. - (#Base (demote_hierarchy idx [h_size h_array])) + (#Base (demotion idx [h_size h_array])) ## Otherwise, just clear the space. (#Hierarchy (dec h_size) (vacant! idx h_array))) ## But if the sub_removal yielded a non_empty node, then @@ -436,7 +439,7 @@ ### ... figure out whether that's the only position left. (if (only_bit_position? bit bitmap) ## If so, removing it leaves this node empty too. - empty + empty_node ## But if not, then just unset the position and ## remove the node. (#Base (unset_bit_position bit bitmap) @@ -473,7 +476,7 @@ (if (n.= 1 (array.size _colls)) ## If there's only one left, then removing it leaves us with ## an empty node. - empty + empty_node ## Otherwise, just shrink the array by removing the KV-pair. (#Collisions _hash (remove! idx _colls)))) )) @@ -561,11 +564,11 @@ (All [k v] (-> (Dictionary k v) (Hash k))) (get@ #..hash)) -(def: #export (new key_hash) +(def: #export (empty key_hash) {#.doc (doc "An empty dictionary.")} (All [k v] (-> (Hash k) (Dictionary k v))) {#hash key_hash - #root empty}) + #root empty_node}) (def: #export (put key val dict) (All [k v] (-> k v (Dictionary k v) (Dictionary k v))) @@ -632,7 +635,7 @@ (All [k v] (-> (Hash k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [k v] dict) (..put k v dict)) - (new key_hash) + (empty key_hash) kvs)) (template [<side> <name>] @@ -647,7 +650,7 @@ [v values] ) -(def: #export (merge dict2 dict1) +(def: #export (merged dict2 dict1) {#.doc (doc "Merges 2 dictionaries." "If any collisions with keys occur, the values of dict2 will overwrite those of dict1.")} (All [k v] (-> (Dictionary k v) (Dictionary k v) (Dictionary k v))) @@ -655,7 +658,7 @@ dict1 (entries dict2))) -(def: #export (merge_with f dict2 dict1) +(def: #export (merged_with f dict2 dict1) {#.doc (doc "Merges 2 dictionaries." "If any collisions with keys occur, a new value will be computed by applying 'f' to the values of dict2 and dict1.")} (All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v))) @@ -681,7 +684,7 @@ (remove from_key) (put to_key val)))) -(def: #export (select keys dict) +(def: #export (sub keys dict) {#.doc "A sub-dictionary, with only the specified keys."} (All [k v] (-> (List k) (Dictionary k v) (Dictionary k v))) (let [[key_hash _] dict] @@ -689,7 +692,7 @@ (case (get key dict) #.None new_dict (#.Some val) (put key val new_dict))) - (new key_hash) + (empty key_hash) keys))) (implementation: #export (equivalence (^open ",\.")) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 8008cb8b0..ffe34dc92 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -49,7 +49,7 @@ {#&order (Order k) #root (Maybe (Node k v))}) -(def: #export (new order) +(def: #export (empty order) {#.doc (doc "An empty dictionary, employing the given order.")} (All [k v] (-> (Order k) (Dictionary k v))) {#&order order @@ -540,7 +540,7 @@ (All [k v] (-> (Order k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [key value] dict) (put key value dict)) - (new order) + (empty order) list)) (template [<name> <type> <output>] diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index f5d6dcf02..df4b33c2e 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -43,7 +43,7 @@ (#.Item [head tail]) (#.Item [init (folds f (f head init) tail)]))) -(def: #export (reverse xs) +(def: #export (reversed xs) (All [a] (-> (List a) (List a))) (fold (function (_ head tail) (#.Item head tail)) @@ -151,7 +151,7 @@ (All [a] (-> (Predicate a) (List a) [(List a) (List a)])) (let [[ys' xs'] (split_with' predicate #.End xs)] - [(reverse ys') xs'])) + [(reversed ys') xs'])) (def: #export (chunk size list) {#.doc "Segment the list in chunks of the given size."} @@ -221,7 +221,7 @@ #.None tail)) #.End - (reverse xs))} + (reversed xs))} (case xs #.End #.End @@ -372,7 +372,8 @@ (def: (in a) (#.Item a #.End)) - (def: join (|>> reverse (fold compose identity)))) + (def: join + (|>> reversed (fold compose identity)))) (def: #export (sort < xs) {#.doc (doc "A list ordered by a comparison function.")} diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index 8a0b6d08b..0fa870a0c 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -29,7 +29,7 @@ (def: #export (to_list queue) (All [a] (-> (Queue a) (List a))) (let [(^slots [#front #rear]) queue] - (list\compose front (list.reverse rear)))) + (list\compose front (list.reversed rear)))) (def: #export peek {#.doc (doc "Yields the first value in the queue, if any.")} @@ -62,7 +62,7 @@ ## Front has dried up... (^ (list _)) (|> queue - (set@ #front (list.reverse (get@ #rear queue))) + (set@ #front (list.reversed (get@ #rear queue))) (set@ #rear (list))) ## Consume front! diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 7ce9802d6..4e341dfbd 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -74,7 +74,7 @@ (def: (new_hierarchy _) (All [a] (-> Any (Hierarchy a))) - (array.new full_node_size)) + (array.empty full_node_size)) (def: (tail_off row_size) (-> Nat Nat) @@ -94,7 +94,7 @@ (def: (new_tail singleton) (All [a] (-> a (Base a))) - (|> (array.new 1) + (|> (array.empty 1) (array.write! 0 singleton))) (def: (push_tail size level tail parent) @@ -122,7 +122,7 @@ (def: (expand_tail val tail) (All [a] (-> a (Base a) (Base a))) (let [tail_size (array.size tail)] - (|> (array.new (inc tail_size)) + (|> (array.empty (inc tail_size)) (array.copy! tail_size 0 tail 0) (array.write! tail_size val)))) @@ -178,7 +178,7 @@ (#Hierarchy hierarchy) (|> hierarchy array.to_list - list.reverse + list.reversed (list\fold (function (_ sub acc) (list\compose (to_list' sub) acc)) #.End)))) @@ -193,8 +193,8 @@ Row {#level (level_up root_level) #size 0 - #root (array.new full_node_size) - #tail (array.new 0)}) + #root (array.empty full_node_size) + #tail (array.empty 0)}) (def: #export (size row) (All [a] (-> (Row a) Nat)) @@ -314,7 +314,7 @@ new_tail_size (dec (array.size old_tail))] (|> row (update@ #size dec) - (set@ #tail (|> (array.new new_tail_size) + (set@ #tail (|> (array.empty new_tail_size) (array.copy! new_tail_size 0 old_tail 0))))) (maybe.assume (do maybe.monad @@ -465,9 +465,11 @@ (^open ".") ..monoid] (fold (function (_ post pre) (compose pre post)) identity)))) -(def: #export reverse +(def: #export reversed (All [a] (-> (Row a) (Row a))) - (|>> ..to_list list.reverse (list\fold add ..empty))) + (|>> ..to_list + list.reversed + (list\fold add ..empty))) (template [<name> <array> <init> <op>] [(def: #export <name> diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index 6c0c58a65..d6436be3b 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -24,9 +24,9 @@ (All [a] (-> (Set a) (Hash a))) //.key_hash) -(def: #export new +(def: #export empty (All [a] (-> (Hash a) (Set a))) - //.new) + //.empty) (def: #export size (All [a] (-> (Set a) Nat)) @@ -50,7 +50,7 @@ (def: #export union (All [a] (-> (Set a) (Set a) (Set a))) - //.merge) + //.merged) (def: #export (difference sub base) (All [a] (-> (Set a) (Set a) (Set a))) @@ -58,8 +58,8 @@ (def: #export (intersection filter base) (All [a] (-> (Set a) (Set a) (Set a))) - (//.select (//.keys filter) - base)) + (//.sub (//.keys filter) + base)) (implementation: #export equivalence (All [a] (Equivalence (Set a))) @@ -83,7 +83,7 @@ (implementation: #export (monoid hash) (All [a] (-> (Hash a) (Monoid (Set a)))) - (def: identity (..new hash)) + (def: identity (..empty hash)) (def: compose ..union)) (def: #export empty? @@ -92,7 +92,7 @@ (def: #export (of_list hash elements) (All [a] (-> (Hash a) (List a) (Set a))) - (list\fold ..add (..new hash) elements)) + (list\fold ..add (..empty hash) elements)) (def: #export (sub? super sub) (All [a] (-> (Set a) (Set a) Bit)) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index fdbbe7b1b..df4db9a85 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -24,9 +24,9 @@ {#.doc (doc "A set that keeps track of repetition in its entries.")} - (def: #export new + (def: #export empty (All [a] (-> (Hash a) (Set a))) - (|>> dictionary.new :abstraction)) + (|>> dictionary.empty :abstraction)) (def: #export size (All [a] (-> (Set a) Nat)) @@ -70,7 +70,7 @@ (template [<name> <compose>] [(def: #export (<name> parameter subject) (All [a] (-> (Set a) (Set a) (Set a))) - (:abstraction (dictionary.merge_with <compose> (:representation parameter) (:representation subject))))] + (:abstraction (dictionary.merged_with <compose> (:representation parameter) (:representation subject))))] [union n.max] [sum n.+] @@ -83,7 +83,7 @@ multiplicity) elem output)) - (..new (dictionary.key_hash subject)) + (..empty (dictionary.key_hash subject)) (dictionary.entries subject))) (def: #export (difference parameter subject) @@ -150,7 +150,7 @@ (def: #export (of_list hash subject) (All [a] (-> (Hash a) (List a) (Set a))) - (list\fold (..add 1) (..new hash) subject)) + (list\fold (..add 1) (..empty hash) subject)) (def: #export (of_set subject) (All [a] (-> (//.Set a) (Set a))) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index fbe72bada..d0916508f 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -17,9 +17,9 @@ {#.doc (doc "A set with ordered entries.")} - (def: #export new + (def: #export empty (All [a] (-> (Order a) (Set a))) - (|>> /.new :abstraction)) + (|>> /.empty :abstraction)) (def: #export (member? set elem) (All [a] (-> (Set a) a Bit)) @@ -50,7 +50,7 @@ (def: #export (of_list &order list) (All [a] (-> (Order a) (List a) (Set a))) - (list\fold add (..new &order) list)) + (list\fold add (..empty &order) list)) (def: #export (union left right) (All [a] (-> (Set a) (Set a) (Set a))) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index be444ba1a..ae6c21990 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -14,8 +14,8 @@ (abstract: #export (Tree @ t v) {#monoid (Monoid t) #tag t - #root (| v - [(Tree @ t v) (Tree @ t v)])} + #root (Or v + [(Tree @ t v) (Tree @ t v)])} {#.doc (doc "A finger tree.")} diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index 45e3a109e..e47036a56 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -104,12 +104,12 @@ (for {@.old (update@ #node (: (-> (Tree (:parameter 0)) (Tree (:parameter 0))) - (set@ #//.children (list\compose (list.reverse lefts) + (set@ #//.children (list\compose (list.reversed lefts) (#.Item (get@ #node zipper) rights)))) parent)} (set@ [#node #//.children] - (list\compose (list.reverse lefts) + (list\compose (list.reversed lefts) (#.Item (get@ #node zipper) rights)) parent)))))) @@ -146,7 +146,7 @@ #.None (#.Some family) - (case (list.reverse (get@ <side> family)) + (case (list.reversed (get@ <side> family)) #.End #.None diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 482b6435d..ad79c9fd8 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -314,26 +314,26 @@ ## else ratio)) -(def: #export (interpolate ratio end start) +(def: #export (interpolated ratio end start) (-> Frac Color Color Color) (let [dS (..normal ratio) dE (|> +1.0 (f.- dS)) - interpolate' (: (-> Nat Nat Nat) - (function (_ end start) - (|> (|> start .int int.frac (f.* dS)) - (f.+ (|> end .int int.frac (f.* dE))) - f.int - .nat))) + interpolated' (: (-> Nat Nat Nat) + (function (_ end start) + (|> (|> start .int int.frac (f.* dS)) + (f.+ (|> end .int int.frac (f.* dE))) + f.int + .nat))) [redS greenS blueS] (to_rgb start) [redE greenE blueE] (to_rgb end)] - (of_rgb {#red (interpolate' redE redS) - #green (interpolate' greenE greenS) - #blue (interpolate' blueE blueS)}))) + (of_rgb {#red (interpolated' redE redS) + #green (interpolated' greenE greenS) + #blue (interpolated' blueE blueS)}))) (template [<name> <target>] [(def: #export (<name> ratio color) (-> Frac Color Color) - (..interpolate ratio <target> color))] + (..interpolated ratio <target> color))] [darker ..black] [brighter ..white] @@ -349,8 +349,8 @@ (f.min +1.0)) luminance])))] - [f.+ saturate] - [f.- de_saturate] + [f.+ saturated] + [f.- un_saturated] ) (def: #export (gray_scale color) diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index b2464a488..b1279b292 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -87,7 +87,7 @@ ) (def: #export (or left right) - (All [l r] (-> (Writer l) (Writer r) (Writer (| l r)))) + (All [l r] (-> (Writer l) (Writer r) (Writer (Or l r)))) (function (_ altV) (case altV (^template [<number> <tag> <writer>] diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 52e37991b..996bb27f9 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -113,7 +113,7 @@ ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) -(def: verify_small_suffix +(def: small_suffix (Parser Any) (do <>.monad [pre_end <binary>.bits/8 @@ -131,7 +131,7 @@ (do <>.monad [digits (<binary>.segment ..small_size) digits (<>.lift (\ utf8.codec decode digits)) - _ ..verify_small_suffix] + _ ..small_suffix] (<>.lift (do {! try.monad} [value (\ n.octal decode digits)] @@ -198,7 +198,7 @@ (do <>.monad [ascii (<binary>.segment ..small_size) digits (<>.lift (\ utf8.codec decode ascii)) - _ ..verify_small_suffix + _ ..small_suffix value (<>.lift (\ n.octal decode digits))] (in [value @@ -224,7 +224,7 @@ (def: #export name_size Size 31) (def: #export path_size Size 99) -(def: (un_pad string) +(def: (un_padded string) (-> Binary (Try Binary)) (case (binary.size string) 0 (#try.Success string) @@ -281,7 +281,7 @@ (n.= expected end))] (<>.lift (do {! try.monad} - [ascii (..un_pad string) + [ascii (..un_padded string) text (\ utf8.codec decode ascii)] (<in> text))))) diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index b7cf0323d..d065f1def 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -33,7 +33,7 @@ (def: #export attributes {#.doc (doc "An empty set of XML attributes.")} Attrs - (dictionary.new name.hash)) + (dictionary.empty name.hash)) (type: #export #rec XML (#Text Text) @@ -62,7 +62,7 @@ (#.Some _) (<>.codec int.decimal (<text>.many <text>.hexadecimal)))] - (in (|> code .nat text.of_code))) + (in (|> code .nat text.of_char))) (<>.before (<text>.this ";")) (<>.after (<text>.this "&#")))) @@ -162,7 +162,7 @@ (def: null^ (Parser Any) - (<text>.this (text.of_code 0))) + (<text>.this (text.of_char 0))) (def: xml^ (Parser XML) diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux index 6a89a1aa6..cd4b3b67d 100644 --- a/stdlib/source/library/lux/data/name.lux +++ b/stdlib/source/library/lux/data/name.lux @@ -13,13 +13,15 @@ ## (type: Name ## [Text Text]) -(template [<name> <side>] - [(def: #export (<name> [module short]) +(template [<name> <doc>] + [(def: #export (<name> name) + {#.doc (doc <doc>)} (-> Name Text) - <side>)] + (let [[module short] name] + <name>))] - [module module] - [short short] + [module "The module part of a name."] + [short "The short part of a name."] ) (def: #export hash @@ -51,14 +53,12 @@ _ ($_ text\compose module ..separator short))) (def: (decode input) - (if (text\= "" input) - (#.Left (text\compose "Invalid format for Name: " input)) - (case (text.split_all_with ..separator input) - (^ (list short)) - (#.Right ["" short]) + (case (text.split_all_with ..separator input) + (^ (list short)) + (#.Right ["" short]) - (^ (list module short)) - (#.Right [module short]) + (^ (list module short)) + (#.Right [module short]) - _ - (#.Left (text\compose "Invalid format for Name: " input)))))) + _ + (#.Left (text\compose "Invalid format for Name: " input))))) diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux index 6cf05ac83..25e6b02d0 100644 --- a/stdlib/source/library/lux/data/product.lux +++ b/stdlib/source/library/lux/data/product.lux @@ -1,52 +1,59 @@ (.module: - {#.doc "Functionality for working with tuples (particularly 2-tuples)."} + {#.doc "Functionality for working with tuples (particularly 2-tuples/pairs)."} [library [lux #* [abstract [equivalence (#+ Equivalence)] [hash (#+ Hash)]]]]) -(template [<name> <type> <output>] - [(def: #export (<name> xy) - (All [a b] (-> (& a b) <type>)) - (let [[x y] xy] - <output>))] +(template [<name> <doc>] + [(def: #export (<name> pair) + {#.doc (doc <doc>)} + (All [left right] + (-> [left right] <name>)) + (let [[left right] pair] + <name>))] - [left a x] - [right b y] + [left "The left side of a pair."] + [right "The right side of a pair."] ) +## https://en.wikipedia.org/wiki/Currying (def: #export (curry f) + {#.doc (doc "Converts a 2-argument function into nested single-argument functions.")} (All [a b c] - (-> (-> (& a b) c) + (-> (-> [a b] c) (-> a b c))) (function (_ x y) (f [x y]))) (def: #export (uncurry f) + {#.doc (doc "Converts nested single-argument functions into a 2-argument function.")} (All [a b c] (-> (-> a b c) - (-> (& a b) c))) + (-> [a b] c))) (function (_ xy) (let [[x y] xy] (f x y)))) (def: #export (swap xy) - (All [a b] (-> (& a b) (& b a))) + (All [a b] (-> [a b] [b a])) (let [[x y] xy] [y x])) (def: #export (apply f g) + {#.doc (doc "Apply functions to both sides of a pair.")} (All [a b c d] (-> (-> a c) (-> b d) - (-> (& a b) (& c d)))) + (-> [a b] [c d]))) (function (_ [x y]) [(f x) (g y)])) (def: #export (fork f g) + {#.doc (doc "Yields a pair by applying both functions to a single value.")} (All [a l r] (-> (-> a l) (-> a r) - (-> a (& l r)))) + (-> a [l r]))) (function (_ x) [(f x) (g x)])) @@ -58,7 +65,7 @@ (\ right = rr sr)))) (def: #export (hash left right) - (All [l r] (-> (Hash l) (Hash r) (Hash (& l r)))) + (All [l r] (-> (Hash l) (Hash r) (Hash [l r]))) (implementation (def: &equivalence (..equivalence (\ left &equivalence) diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux index 2f0fddee9..224ba3878 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -6,27 +6,33 @@ [equivalence (#+ Equivalence)] [hash (#+ Hash)]]]]) -(template [<name> <type> <right?>] +(template [<right?> <name> <doc>] [(def: #export (<name> value) - (All [a b] (-> <type> (| a b))) + {#.doc (doc <doc>)} + (All [left right] + (-> <name> (Or left right))) (0 <right?> value))] - [left a #0] - [right b #1]) + [#0 left + "Lifts value to the left side of a 2-variant."] + [#1 right + "Lifts value to the right side of a 2-variant."]) (def: #export (either fl fr) + {#.doc (doc "Applies a function to either side of a 2-variant.")} (All [a b c] (-> (-> a c) (-> b c) - (-> (| a b) c))) + (-> (Or a b) c))) (function (_ input) (case input (0 #0 l) (fl l) (0 #1 r) (fr r)))) (def: #export (apply fl fr) + {#.doc (doc "Applies functions to both sides of a 2-variant.")} (All [l l' r r'] (-> (-> l l') (-> r r') - (-> (| l r) (| l' r')))) + (-> (Or l r) (Or l' r')))) (function (_ input) (case input (0 #0 l) (0 #0 (fl l)) @@ -34,7 +40,7 @@ (template [<name> <side> <right?>] [(def: #export (<name> es) - (All [a b] (-> (List (| a b)) (List <side>))) + (All [a b] (-> (List (Or a b)) (List <side>))) (case es #.End #.End @@ -50,7 +56,7 @@ ) (def: #export (partition xs) - (All [a b] (-> (List (| a b)) [(List a) (List b)])) + (All [a b] (-> (List (Or a b)) [(List a) (List b)])) (case xs #.End [#.End #.End] @@ -62,7 +68,7 @@ (0 #1 x') [lefts (#.Item x' rights)])))) (def: #export (equivalence left right) - (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r)))) + (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r)))) (implementation (def: (= reference sample) (case [reference sample] @@ -76,7 +82,7 @@ false)))) (def: #export (hash left right) - (All [l r] (-> (Hash l) (Hash r) (Hash (| l r)))) + (All [l r] (-> (Hash l) (Hash r) (Hash (Or l r)))) (implementation (def: &equivalence (..equivalence (\ left &equivalence) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index b60a1f797..68ce8ec38 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -7,7 +7,7 @@ [monoid (#+ Monoid)] [equivalence (#+ Equivalence)] [order (#+ Order)] - [monad (#+ Monad do)] + [monad (#+ do)] [codec (#+ Codec)]] [data ["." maybe] @@ -19,16 +19,17 @@ ["." i64]]]]]) (type: #export Char + {#.doc (doc "A character code number.")} Nat) ## TODO: Instead of ints, chars should be produced fron nats. ## (The JVM specifies chars as 16-bit unsigned integers) -(def: #export of_code +(def: #export of_char (-> Char Text) (|>> .int "lux i64 char")) (template [<code> <short> <long>] - [(def: #export <long> (..of_code <code>)) + [(def: #export <long> (..of_char <code>)) (def: #export <short> <long>)] [00 \0 null] @@ -42,52 +43,45 @@ [34 \'' double_quote] ) -(def: #export line_feed ..new_line) +(def: #export line_feed + {#.doc (doc "Same as 'new_line'.")} + ..new_line) (def: #export size (-> Text Nat) (|>> "lux text size")) -(def: #export (nth idx input) +(def: #export (nth index input) + {#.doc (doc "Yields the character at the specified index.")} (-> Nat Text (Maybe Char)) - (if (n.< ("lux text size" input) idx) - (#.Some ("lux text char" idx input)) + (if (n.< ("lux text size" input) index) + (#.Some ("lux text char" index input)) #.None)) -(def: #export (index_of' pattern from input) - (-> Text Nat Text (Maybe Nat)) +(def: #export (index_of' from pattern input) + (-> Nat Text Text (Maybe Nat)) ("lux text index" from pattern input)) (def: #export (index_of pattern input) (-> Text Text (Maybe Nat)) - ("lux text index" 0 pattern input)) + (index_of' 0 pattern input)) -(def: (last_index_of'' part since text) - (-> Text Nat Text (Maybe Nat)) - (case ("lux text index" (inc since) part text) - #.None - (#.Some since) +(def: #export (last_index_of' from part text) + (-> Nat Text Text (Maybe Nat)) + (loop [from from + output (: (Maybe Nat) + #.None)] + (let [output' ("lux text index" from part text)] + (case output' + #.None + output - (#.Some since') - (last_index_of'' part since' text))) - -(def: #export (last_index_of' part from text) - (-> Text Nat Text (Maybe Nat)) - (case ("lux text index" from part text) - (#.Some since) - (last_index_of'' part since text) - - #.None - #.None)) + (#.Some from') + (recur (inc from') output'))))) (def: #export (last_index_of part text) (-> Text Text (Maybe Nat)) - (case ("lux text index" 0 part text) - (#.Some since) - (last_index_of'' part since text) - - #.None - #.None)) + (last_index_of' 0 part text)) (def: #export (starts_with? prefix x) (-> Text Text Bit) @@ -144,13 +138,15 @@ (-> Text Text) (..enclosed' ..double_quote)) -(def: #export (clip offset characters input) +(def: #export (clip offset size input) + {#.doc (doc "Clips a chunk of text from the input at the specified offset and of the specified size.")} (-> Nat Nat Text (Maybe Text)) - (if (|> characters (n.+ offset) (n.<= ("lux text size" input))) - (#.Some ("lux text clip" offset characters input)) + (if (|> size (n.+ offset) (n.<= ("lux text size" input))) + (#.Some ("lux text clip" offset size input)) #.None)) (def: #export (clip' offset input) + {#.doc (doc "Clips the remaining text from the input at the specified offset.")} (-> Nat Text (Maybe Text)) (let [size ("lux text size" input)] (if (n.<= size offset) @@ -187,7 +183,7 @@ #.None (|> output (#.Item input) - list.reverse)))) + list.reversed)))) (def: #export (replace_once pattern replacement template) (-> Text Text Text Text) @@ -284,24 +280,25 @@ (:as Nat))} ## Platform-independent default. (let [length ("lux text size" input)] - (loop [idx 0 + (loop [index 0 hash 0] - (if (n.< length idx) - (recur (inc idx) + (if (n.< length index) + (recur (inc index) (|> hash (i64.left_shifted 5) (n.- hash) - (n.+ ("lux text char" idx input)))) + (n.+ ("lux text char" index input)))) hash)))))) (def: #export concat (-> (List Text) Text) (let [(^open ".") ..monoid] - (|>> list.reverse (list\fold compose identity)))) + (|>> list.reversed + (list\fold compose identity)))) -(def: #export (join_with sep texts) +(def: #export (join_with separator texts) (-> Text (List Text) Text) - (|> texts (list.interpose sep) concat)) + (|> texts (list.interpose separator) concat)) (def: #export (empty? text) (-> Text Bit) diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index 166f87a3b..d20dc21b9 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -121,12 +121,12 @@ (for {@.old <jvm> @.jvm <jvm> @.js (let [[capacity transform] (:representation buffer)] - (|> (array.new 0) + (|> (array.empty 0) (:as (JS_Array Text)) transform (JS_Array::join [""]))) @.lua (let [[capacity transform] (:representation buffer)] - (table/concat [(transform (array.new 0)) ""]))} + (table/concat [(transform (array.empty 0)) ""]))} ## default (row\fold (function (_ chunk total) (format total chunk)) diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index 6c78dc7d5..02cb8baaa 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -150,7 +150,7 @@ (exception.report ["In" (%.text text)] ["At" (%.nat offset)] - ["Name" (%.text (//.of_code sigil))])) + ["Name" (%.text (//.of_char sigil))])) (exception: #export (invalid_unicode_escape {text Text} {offset Nat}) (exception.report @@ -184,7 +184,7 @@ (let [limit' (|> limit (n.- offset) (n.- ..unicode_escape_offset))] (#try.Success [(format previous ("lux text clip" 0 offset current) - (//.of_code char)) + (//.of_char char)) ("lux text clip" (n.+ ..unicode_escape_offset offset) limit' current) limit'])) diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 1e2128275..45798b920 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -137,7 +137,7 @@ (def: control^ (Parser Text) (<>.either (<text>.range (hex "0") (hex "1F")) - (<text>.one_of (//.of_code (hex "7F"))))) + (<text>.one_of (//.of_char (hex "7F"))))) (def: punct^ (Parser Text) @@ -151,7 +151,7 @@ (def: print^ (Parser Text) (<>.either graph^ - (<text>.one_of (//.of_code (hex "20"))))) + (<text>.one_of (//.of_char (hex "20"))))) (def: re_system_class^ (Parser Code) @@ -321,8 +321,8 @@ 0) (` ((~! do) (~! <>.monad) [(~ (' #let)) [(~ g!total) ""] - (~+ (|> steps list.reverse list\join))] - ((~ (' in)) [(~ g!total) (~+ (list.reverse names))])))]) + (~+ (|> steps list.reversed list\join))] + ((~ (' in)) [(~ g!total) (~+ (list.reversed names))])))]) )) (def: (unflatten^ lexer) @@ -330,7 +330,7 @@ (<>.and lexer (\ <>.monad in []))) (def: (|||^ left right) - (All [l r] (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (| l r)]))) + (All [l r] (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (Or l r)]))) (function (_ input) (case (left input) (#try.Success [input' [lt lv]]) diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index 5c4d9ec76..955b851d2 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -9,8 +9,6 @@ [control [parser ["<.>" code]]] - [data - ["." text]] [macro [syntax (#+ syntax:)] ["." template] @@ -21,7 +19,7 @@ ["." i64]]] [type abstract]]] - [/// (#+ Char)]) + ["." /// (#+ Char)]) (abstract: #export Block (Interval Char) @@ -83,7 +81,7 @@ (..end value)))) (syntax: (block_name {name <code>.local_identifier}) - (in (list (code.text (text.replace_all "_" " " name))))) + (in (list (code.text (///.replace_all "_" " " name))))) (template [<name> <start> <end>] [(with_expansions [<block_name> (..block_name <name>) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 669bcbad3..bb4292eca 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -450,7 +450,7 @@ variantV variantV] (case representations (#.Item leftR (#.Item rightR extraR+)) - (case (:as (| Any Any) variantV) + (case (:as (Or Any Any) variantV) (#.Left left) [lefts #0 (leftR left)] @@ -567,7 +567,7 @@ list.concat ## The list is reversed to make sure that, when building the dictionary, ## later bindings overshadow earlier ones if they have the same name. - list.reverse + list.reversed (dictionary.of_list text.hash))] targets (: (Meta (List Target)) (case targets diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 1067f8357..27233fb11 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -416,19 +416,19 @@ (~ value) (~ (code.local_identifier self_name))))))) -(def: (pre_walk_replace f input) +(def: (replaced f input) (-> (-> Code Code) Code Code) (case (f input) (^template [<tag>] [[meta (<tag> parts)] - [meta (<tag> (list\map (pre_walk_replace f) parts))]]) + [meta (<tag> (list\map (replaced f) parts))]]) ([#.Form] [#.Tuple]) [meta (#.Record pairs)] [meta (#.Record (list\map (: (-> [Code Code] [Code Code]) (function (_ [key val]) - [(pre_walk_replace f key) (pre_walk_replace f val)])) + [(replaced f key) (replaced f val)])) pairs))] ast' @@ -568,12 +568,11 @@ (-> (-> (List (Type Var)) (Parser (Type Parameter))) (-> (List (Type Var)) (Parser (Type Class)))) (do <>.monad - [[name parameters] (: (Parser [External (List (Type Parameter))]) + [#let [class_name^ (..valid_class_name type_vars)] + [name parameters] (: (Parser [External (List (Type Parameter))]) ($_ <>.either - (<>.and (valid_class_name type_vars) - (<>\in (list))) - (<code>.form (<>.and <code>.local_identifier - (<>.some (parameter^ type_vars))))))] + (<>.and class_name^ (<>\in (list))) + (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] (in (type.class (name.safe name) parameters)))) (exception: #export (unexpected_type_variable {name Text} @@ -1109,7 +1108,7 @@ (~ (code.text self_name)) [(~+ (list\map argument$ arguments))] [(~+ (list\map constructor_arg$ constructor_args))] - (~ (pre_walk_replace replacer body)) + (~ (replaced replacer body)) ))) (#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs) @@ -1127,7 +1126,7 @@ [(~+ (list\map argument$ arguments))] (~ (return$ return_type)) [(~+ (list\map class$ exs))] - (~ (pre_walk_replace replacer body))))) + (~ (replaced replacer body))))) (#OverridenMethod strict_fp? declaration type_vars self_name arguments return_type body exs) (let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields) @@ -1154,8 +1153,8 @@ (~ (return$ return_type)) [(~+ (list\map class$ exs))] (~ (|> body - (pre_walk_replace replacer) - (pre_walk_replace super_replacer))) + (replaced replacer) + (replaced super_replacer))) ))) (#StaticMethod strict_fp? type_vars arguments return_type body exs) @@ -1169,7 +1168,7 @@ [(~+ (list\map argument$ arguments))] (~ (return$ return_type)) [(~+ (list\map class$ exs))] - (~ (pre_walk_replace replacer body))))) + (~ (replaced replacer body))))) (#AbstractMethod type_vars arguments return_type exs) (` ("abstract" @@ -1544,7 +1543,7 @@ [(type.class box.double (list)) (type.class box.double (list)) (list) [(` (.: (.primitive (~ (code.text box.double))))) (` (.:as .Frac))]]]] ) -(def: (un_quote quoted) +(def: (un_quoted quoted) (-> Code Code) (` ((~' ~) (~ quoted)))) @@ -1555,8 +1554,8 @@ (list\map (function (_ [class [maybe? input]]) (|> (if maybe? (` (: (.primitive (~ (code.text (..reflection class)))) - ((~! !!!) (~ (un_quote input))))) - (un_quote input)) + ((~! !!!) (~ (..un_quoted input))))) + (..un_quoted input)) [class] (with_automatic_input_conversion mode)))))) @@ -1637,7 +1636,7 @@ (~ (code.text import_method_name)) [(~+ (list\map ..var$ (get@ #import_member_tvars commons)))] (~+ (|> object_ast - (list\map ..un_quote) + (list\map ..un_quoted) (list.zipped/2 (list (type.class full_name (list)))) (list\map (with_automatic_input_conversion (get@ #import_member_mode commons))))) (~+ (|> (jvm_invoke_inputs (get@ #import_member_mode commons) input_jvm_types arg_function_inputs) @@ -1674,7 +1673,7 @@ [import_field_type (if import_field_static? (get_static_field full_name import_field_name) - (get_virtual_field full_name import_field_name (un_quote g!obj)))]) + (get_virtual_field full_name import_field_name (..un_quoted g!obj)))]) getter_body (if import_field_maybe? (` ((~! ???) (~ getter_body))) getter_body) @@ -1689,7 +1688,7 @@ (let [setter_call (if import_field_static? (` ((~ setter_name) (~ g!value))) (` ((~ setter_name) (~ g!value) (~ g!obj)))) - setter_value (|> [import_field_type (un_quote g!value)] + setter_value (|> [import_field_type (..un_quoted g!value)] (with_automatic_input_conversion import_field_mode)) setter_value (if import_field_maybe? (` ((~! !!!) (~ setter_value))) @@ -1699,7 +1698,7 @@ g!obj+ (: (List Code) (if import_field_static? (list) - (list (un_quote g!obj))))] + (list (..un_quoted g!obj))))] (in (list (` ((~! syntax:) (~ setter_call) ((~' in) (.list (.` ((~! io.io) ((~ (code.text setter_command)) (~+ g!obj+) (~ setter_value)))))))))))) (in (list))))] diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux index cceaf1777..4933a97a6 100644 --- a/stdlib/source/library/lux/locale/language.lux +++ b/stdlib/source/library/lux/locale/language.lux @@ -16,6 +16,8 @@ {#name Text #code Text} + {#.doc (doc "An ISO 639 language.")} + (template [<name> <tag>] [(def: #export <name> (-> Language Text) diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux index f824005b3..15ac79698 100644 --- a/stdlib/source/library/lux/locale/territory.lux +++ b/stdlib/source/library/lux/locale/territory.lux @@ -18,6 +18,8 @@ #long Text #code Nat} + {#.doc (doc "An ISO 3166 territory.")} + (template [<name> <field> <type>] [(def: #export <name> (-> Territory <type>) diff --git a/stdlib/source/library/lux/macro/poly.lux b/stdlib/source/library/lux/macro/poly.lux index 892f23284..a92c9bd96 100644 --- a/stdlib/source/library/lux/macro/poly.lux +++ b/stdlib/source/library/lux/macro/poly.lux @@ -114,8 +114,8 @@ (^template [<macro> <tag> <flattener>] [(<tag> left right) (` (<macro> (~+ (list\map (to_code env) (<flattener> type)))))]) - ([| #.Sum type.flat_variant] - [& #.Product type.flat_tuple]) + ([.Variant #.Sum type.flat_variant] + [.Tuple #.Product type.flat_tuple]) (#.Named name sub_type) (code.identifier name) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 35744c33f..1e80a355f 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -35,11 +35,11 @@ "Failed to parse: " (code.format binding) text.new_line error))))) -(def: (join_pairs pairs) +(def: (un_paired pairs) (All [a] (-> (List [a a]) (List a))) (case pairs #.End #.End - (#.Item [[x y] pairs']) (list& x y (join_pairs pairs')))) + (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) (macro: #export (syntax: tokens) {#.doc (doc "A more advanced way to define macros than 'macro:'." @@ -121,7 +121,7 @@ ((~! </>.run) (: ((~! </>.Parser) (Meta (List Code))) ((~! do) (~! <>.monad) - [(~+ (..join_pairs vars+parsers))] + [(~+ (..un_paired vars+parsers))] ((~' in) (~ body)))) (~ g!tokens))))))))) diff --git a/stdlib/source/library/lux/macro/syntax/annotations.lux b/stdlib/source/library/lux/macro/syntax/annotations.lux index 28f5a233e..73738ebc5 100644 --- a/stdlib/source/library/lux/macro/syntax/annotations.lux +++ b/stdlib/source/library/lux/macro/syntax/annotations.lux @@ -16,6 +16,7 @@ ["." code]]]]) (type: #export Annotations + {#.doc (doc "Definition/module annotations.")} (List [Name Code])) (def: #export equivalence diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux index bd4214eab..2e60ed0cc 100644 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ b/stdlib/source/library/lux/macro/syntax/check.lux @@ -18,6 +18,7 @@ "lux check") (type: #export Check + {#.doc (doc "A type annotation for an expression.")} {#type Code #value Code}) diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index 550c3a4b0..429368764 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -15,6 +15,7 @@ ["." code]]]]) (type: #export Declaration + {#.doc (doc "A declaration for either a constant or a function.")} {#name Text #arguments (List Text)}) diff --git a/stdlib/source/library/lux/macro/syntax/type/variable.lux b/stdlib/source/library/lux/macro/syntax/type/variable.lux index e73020c42..a2e710e4d 100644 --- a/stdlib/source/library/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/library/lux/macro/syntax/type/variable.lux @@ -12,6 +12,7 @@ ["." code]]]]) (type: #export Variable + {#.doc (doc "A variable'S name.")} Text) (def: #export equivalence diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index a0db7975d..4b1a1ef8b 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -65,7 +65,7 @@ )) ))) -(def: (to_prefix infix) +(def: (prefix infix) (-> Infix Code) (case infix (#Const value) @@ -75,11 +75,10 @@ (code.form parts) (#Unary op subject) - (` ((~ op) (~ (to_prefix subject)))) + (` ((~ op) (~ (prefix subject)))) (#Binary left op right) - (` ((~ op) (~ (to_prefix right)) (~ (to_prefix left)))) - )) + (` ((~ op) (~ (prefix right)) (~ (prefix left)))))) (syntax: #export (infix {expr infix^}) {#.doc (doc "Infix math syntax." @@ -94,4 +93,4 @@ "If you want your binary function to work well with it." "Then take the argument to the right (y) as your first argument," "and take the argument to the left (x) as your second argument.")} - (in (list (..to_prefix expr)))) + (in (list (..prefix expr)))) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 6ddd718ec..a5d72f5e7 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -145,7 +145,7 @@ [conjunction ..true ..and] ) -(def: #export reverse +(def: #export reversed (All [a] (-> (I64 a) (I64 a))) (let [swapper (: (-> Nat (All [a] (-> (I64 a) (I64 a)))) (function (_ power) diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index d0c4ac406..66abd7e12 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -290,7 +290,7 @@ (def: (digits _) (-> Any Digits) - (array.new //i64.width)) + (array.empty //i64.width)) (def: (digit idx digits) (-> Nat Digits Nat) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 74857ba27..c2dce8f0a 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -100,7 +100,7 @@ #.None (one check random)))) -(def: #export (refine refiner gen) +(def: #export (refined refiner gen) {#.doc "Retries the generator until the output can be refined."} (All [t r] (-> (Refiner t r) (Random t) (Random (Refined t r)))) (do ..monad @@ -110,7 +110,7 @@ (in refined) #.None - (refine refiner gen)))) + (refined refiner gen)))) (def: #export bit (Random Bit) @@ -169,7 +169,7 @@ (do ..monad [x char_gen xs (text char_gen (dec size))] - (in (text\compose (text.of_code x) xs))))) + (in (text\compose (text.of_char x) xs))))) (template [<name> <set>] [(def: #export <name> @@ -207,7 +207,7 @@ (def: #export (or left right) {#.doc "Heterogeneous alternative combinator."} - (All [a b] (-> (Random a) (Random b) (Random (| a b)))) + (All [a b] (-> (Random a) (Random b) (Random (Or a b)))) (do {! ..monad} [? bit] (if ? @@ -282,7 +282,7 @@ (if (n.= size (set.size xs+)) (in xs+) (recur []))))) - (\ ..monad in (set.new Hash<a>)))) + (\ ..monad in (set.empty Hash<a>)))) (def: #export (dictionary Hash<a> size key_gen value_gen) (All [k v] (-> (Hash k) Nat (Random k) (Random v) (Random (Dictionary k v)))) @@ -297,7 +297,7 @@ (if (n.= size (dictionary.size kv+)) (in kv+) (recur []))))) - (\ ..monad in (dictionary.new Hash<a>)))) + (\ ..monad in (dictionary.empty Hash<a>)))) (def: #export instant (Random Instant) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index f1eea8098..1ef296cdf 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -428,7 +428,7 @@ (list\fold (.function (_ [test then!] next!) (..if test then! next!)) else! - (list.reverse clauses))) + (list.reversed clauses))) (template [<apply> <arg>+ <type>+ <function>+] [(`` (def: #export (<apply> function) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 33df05fbb..539408dfc 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -64,7 +64,7 @@ Tracker {#program_counter /address.start #next 0 - #known (dictionary.new n.hash)}) + #known (dictionary.empty n.hash)}) (type: #export Relative (-> Resolver (Try [(Row Exception) Instruction]))) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index 67d786da5..a1f9d285b 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -97,7 +97,7 @@ (def: #export (new_library _) (-> Any Library) - (atom.atom (dictionary.new text.hash))) + (atom.atom (dictionary.empty text.hash))) (def: #export (memory library) (-> Library java/lang/ClassLoader) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index 365460dc6..e4c4ccca3 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -29,7 +29,7 @@ (def: #export fresh Aliasing - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: (var aliasing) (-> Aliasing (Parser (Type Var))) diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index 79104adaa..86184ebbd 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -40,7 +40,7 @@ (def: #export fresh Mapping - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (exception: #export (unknown_var {var Text}) (exception.report diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index ee245e6f6..0f24e59e4 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -367,7 +367,7 @@ (list\fold (.function (_ [test then!] next!) (..if test then! next!)) else! - (list.reverse clauses))) + (list.reversed clauses))) (syntax: (arity_inputs {arity <code>.nat}) (in (case arity diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 45bf1f33e..150833a70 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -538,7 +538,7 @@ (list\fold (function (_ [test then!] next!) (..if test then! next!)) else! - (list.reverse clauses))) + (list.reversed clauses))) (def: #export command_line_arguments Var diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index cf4917ac5..d507ba886 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -453,7 +453,7 @@ (list\fold (.function (_ [test then!] next!) (..if test then! next!)) else! - (list.reverse clauses))) + (list.reversed clauses))) (syntax: (arity_inputs {arity <code>.nat}) (in (case arity diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index 9028c03f5..9907e7c84 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -265,7 +265,7 @@ (list\fold (.function (_ [test then] next) (if test then next)) else - (list.reverse clauses))) + (list.reversed clauses))) (template [<name> <op>] [(def: #export (<name> param subject) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 9af88a4fc..43f2c0243 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -429,7 +429,7 @@ (list\fold (.function (_ [test then!] next!) (..if test then! next!)) else! - (list.reverse clauses))) + (list.reversed clauses))) (syntax: (arity_inputs {arity <code>.nat}) (in (case arity diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 00ab760d3..59a5a6a12 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -47,7 +47,7 @@ #expected_coverage (Set Name) #actual_coverage (Set Name)}) -(def: (add_tally parameter subject) +(def: (total parameter subject) (-> Tally Tally Tally) {#successes (n.+ (get@ #successes parameter) (get@ #successes subject)) #failures (n.+ (get@ #failures parameter) (get@ #failures subject)) @@ -60,8 +60,8 @@ Tally {#successes 0 #failures 0 - #expected_coverage (set.new name.hash) - #actual_coverage (set.new name.hash)}) + #expected_coverage (set.empty name.hash) + #actual_coverage (set.empty name.hash)}) (template [<name> <category>] [(def: <name> @@ -90,7 +90,7 @@ _ (|> left (async.await (function (_ [l_tally l_documentation]) (async.await (function (_ [r_tally r_documentation]) - (write! [(add_tally l_tally r_tally) + (write! [(..total l_tally r_tally) (format l_documentation ..separator r_documentation)])) right))) io.run)] @@ -296,7 +296,7 @@ (def: coverage_separator Text - (text.of_code 31)) + (text.of_char 31)) (def: encode_coverage (-> (List Text) Text) @@ -395,7 +395,7 @@ async.future async\join)) state (: (Atom (Dictionary Nat [Tally Text])) - (atom.atom (dictionary.new n.order))) + (atom.atom (dictionary.empty n.order))) [read! write!] (: [Assertion (async.Resolver [Tally Text])] (async.async [])) @@ -410,7 +410,7 @@ (list\map product.right))] (write! [(|> assertions (list\map product.left) - (list\fold ..add_tally ..start)) + (list\fold ..total ..start)) (|> assertions (list\map product.right) (text.join_with ..separator))])) diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index 4a65fa4b8..42b850964 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -157,7 +157,7 @@ (def: (adjust_negative space duration) (-> Duration Duration Duration) (if (duration.negative? duration) - (duration.merge space duration) + (duration.merged space duration) duration)) (def: (millis_format millis) @@ -177,9 +177,9 @@ (def: #export (clock time) (-> Time Clock) (let [time (|> time ..to_millis .int duration.of_millis) - [hours time] [(duration.query duration.hour time) (duration.frame duration.hour time)] - [minutes time] [(duration.query duration.minute time) (duration.frame duration.minute time)] - [seconds millis] [(duration.query duration.second time) (duration.frame duration.second time)]] + [hours time] [(duration.query duration.hour time) (duration.framed duration.hour time)] + [minutes time] [(duration.query duration.minute time) (duration.framed duration.minute time)] + [seconds millis] [(duration.query duration.second time) (duration.framed duration.second time)]] {#hour (.nat hours) #minute (.nat minutes) #second (.nat seconds) @@ -190,7 +190,7 @@ (def: #export (time clock) (-> Clock (Try Time)) - (|> ($_ duration.merge + (|> ($_ duration.merged (duration.up (get@ #hour clock) duration.hour) (duration.up (get@ #minute clock) duration.minute) (duration.up (get@ #second clock) duration.second) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index 1db01faf8..c634c8405 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -32,7 +32,7 @@ (Dictionary Nat Month) (list\fold (function (_ month mapping) (dictionary.put (//month.number month) month mapping)) - (dictionary.new n.hash) + (dictionary.empty n.hash) //month.year)) (def: minimum_day diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index 72ee9debc..c133b1045 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -41,8 +41,8 @@ (-> Duration Duration Duration) (:abstraction (<op> (:representation param) (:representation subject))))] - [i.+ merge] - [i.% frame] + [i.+ merged] + [i.% framed] ) (template [<op> <name>] @@ -106,13 +106,13 @@ ) (def: #export leap_year - (..merge ..day ..normal_year)) + (..merged ..day ..normal_year)) (implementation: #export monoid (Monoid Duration) (def: identity ..empty) - (def: compose ..merge)) + (def: compose ..merged)) (template [<value> <definition>] [(def: <definition> <value>)] @@ -134,16 +134,16 @@ (nat\encode 0) ..milli_second_suffix) (let [signed? (negative? duration) - [days time_left] [(query day duration) (frame day duration)] + [days time_left] [(query day duration) (framed day duration)] days (if signed? (i.abs days) days) time_left (if signed? (..inverse time_left) time_left) - [hours time_left] [(query hour time_left) (frame hour time_left)] - [minutes time_left] [(query minute time_left) (frame minute time_left)] - [seconds time_left] [(query second time_left) (frame second time_left)] + [hours time_left] [(query hour time_left) (framed hour time_left)] + [minutes time_left] [(query minute time_left) (framed minute time_left)] + [seconds time_left] [(query second time_left) (framed second time_left)] millis (to_millis time_left)] ($_ text\compose (if signed? ..negative_sign ..positive_sign) @@ -174,11 +174,11 @@ seconds (section ..second_suffix "") millis (section ..milli_second_suffix "") #let [span (|> ..empty - (..merge (..up days ..day)) - (..merge (..up hours ..hour)) - (..merge (..up minutes ..minute)) - (..merge (..up seconds ..second)) - (..merge (..up millis ..milli_second)))]] + (..merged (..up days ..day)) + (..merged (..up hours ..hour)) + (..merged (..up minutes ..minute)) + (..merged (..up seconds ..second)) + (..merged (..up millis ..milli_second)))]] (in (case sign (#.Left _) (..inverse span) (#.Right _) span))))) @@ -191,13 +191,13 @@ (def: #export (difference from to) (-> Duration Duration Duration) - (|> from ..inverse (..merge to))) + (|> from ..inverse (..merged to))) (implementation: #export enum (Enum Duration) (def: &order ..order) (def: succ - (..merge ..milli_second)) + (..merged ..milli_second)) (def: pred - (..merge (..inverse ..milli_second)))) + (..merged (..inverse ..milli_second)))) diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index e734e1bfc..c136a6e15 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -117,7 +117,7 @@ (def: (clock_time duration) (-> Duration Time) (|> (if (\ duration.order < duration.empty duration) - (duration.merge duration.day duration) + (duration.merged duration.day duration) duration) duration.to_millis .nat @@ -144,7 +144,7 @@ (duration.up (.nat (i.* -1 days))) duration.inverse) (duration.up (.nat days) duration.day)) - (duration.merge (duration.up time duration.milli_second)) + (duration.merged (duration.up time duration.milli_second)) ..absolute)))) (implementation: #export codec @@ -210,7 +210,7 @@ (-> Instant Day) (let [offset (..relative instant) days (duration.query duration.day offset) - day_time (duration.frame duration.day offset) + day_time (duration.framed duration.day offset) days (if (and (duration.negative? offset) (not (duration.neutral? day_time))) (dec days) diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 8b668b60f..1a8617f53 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -84,8 +84,8 @@ (-> (///directive.State+ anchor expression directive) (///directive.State+ anchor expression directive)))) (function (_ [directive_extensions sub_state]) - [(dictionary.merge directive_extensions - (luxD.bundle expander host_analysis program anchorT,expressionT,directiveT extender)) + [(dictionary.merged directive_extensions + (luxD.bundle expander host_analysis program anchorT,expressionT,directiveT extender)) sub_state])) (type: Reader diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index c5f2cfb8e..1848c28bc 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -136,13 +136,13 @@ {#descriptor.hash 0 #descriptor.name archive.runtime_module #descriptor.file "" - #descriptor.references (set.new text.hash) + #descriptor.references (set.empty text.hash) #descriptor.state #.Compiled #descriptor.registry registry}) (def: runtime_document (Document .Module) - (document.write $.key (module.new 0))) + (document.write $.key (module.empty 0))) (def: (process_runtime archive platform) (All [<type_vars>] @@ -219,7 +219,7 @@ [analysers synthesizers generators - (dictionary.merge directives (host_directive_bundle phase_wrapper))]) + (dictionary.merged directives (host_directive_bundle phase_wrapper))]) (def: #export (initialize static module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender import compilation_sources) @@ -297,7 +297,7 @@ (def: empty (Set Module) - (set.new text.hash)) + (set.empty text.hash)) (type: Mapping (Dictionary Module (Set Module))) @@ -308,7 +308,7 @@ (def: independence Dependence - (let [empty (dictionary.new text.hash)] + (let [empty (dictionary.empty text.hash)] {#depends_on empty #depended_by empty})) @@ -394,7 +394,7 @@ initial (Var (Dictionary Module <Pending>)) - (:assume (stm.var (dictionary.new text.hash)))) + (:assume (stm.var (dictionary.empty text.hash)))) dependence (: (Var Dependence) (stm.var ..independence))] (function (_ compile) @@ -471,7 +471,7 @@ (#try.Success [resulting_archive resulting_state]) (stm.commit (do stm.monad [[_ [merged_archive _]] (stm.update (function (_ [archive state]) - [(archive.merge resulting_archive archive) + [(archive.merged resulting_archive archive) state]) current)] (in (#try.Success [merged_archive resulting_state]))))) @@ -565,7 +565,7 @@ (monad.seq ..monad)) #let [archive (|> archive,document+ (list\map product.left) - (list\fold archive.merge archive))]] + (list\fold archive.merged archive))]] (in [archive (try.assumed (..updated_state archive state))])))] (case ((get@ #///.process compilation) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index e5c8e654d..f8ddeff8e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -104,4 +104,4 @@ (Key .Module) (key.key {#signature.name (name_of ..compiler) #signature.version /version.version} - (module.new 0))) + (module.empty 0))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index f188f3c7d..02100305d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- nat int rev) + [lux (#- Variant Tuple nat int rev) [abstract [equivalence (#+ Equivalence)] [hash (#+ Hash)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux index b99a93f73..c7b843385 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -220,7 +220,7 @@ (do ! [nextA next] (in [(list) nextA])) - (list.reverse matches))] + (list.reversed matches))] (in [(/.pattern/tuple memberP+) thenA]))) @@ -312,7 +312,7 @@ branchesT) outputHC (|> outputH product.left /coverage.determine) outputTC (monad.map ! (|>> product.left /coverage.determine) outputT) - _ (.case (monad.fold try.monad /coverage.merge outputHC outputTC) + _ (.case (monad.fold try.monad /coverage.merged outputHC outputTC) (#try.Success coverage) (///.assertion non_exhaustive_pattern_matching [inputC branches coverage] (/coverage.exhaustive? coverage)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index 3760c86cc..7799be183 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -121,7 +121,7 @@ ## Tuple patterns can be exhaustive if there is exhaustiveness for all of ## their sub-patterns. (#/.Complex (#/.Tuple membersP+)) - (case (list.reverse membersP+) + (case (list.reversed membersP+) (^or #.End (#.Item _ #.End)) (/.except ..invalid_tuple_pattern []) @@ -151,7 +151,7 @@ (in (#Variant (if right? (#.Some idx) #.None) - (|> (dictionary.new n.hash) + (|> (dictionary.empty n.hash) (dictionary.put idx value_coverage))))))) (def: (xor left right) @@ -217,7 +217,7 @@ ## necessary to merge them all to figure out if the entire ## pattern-matching expression is exhaustive and whether it contains ## redundant patterns. -(def: #export (merge addition so_far) +(def: #export (merged addition so_far) (-> Coverage Coverage (Try Coverage)) (case [addition so_far] [#Partial #Partial] @@ -246,7 +246,7 @@ (case (dictionary.get tagA casesSF') (#.Some coverageSF) (do ! - [coverageM (merge coverageA coverageSF)] + [coverageM (merged coverageA coverageSF)] (in (dictionary.put tagA coverageM casesSF'))) #.None @@ -271,7 +271,7 @@ ## Same prefix [#1 #0] (do try.monad - [rightM (merge rightA rightSF)] + [rightM (merged rightA rightSF)] (if (exhaustive? rightM) ## If all that follows is exhaustive, then it can be safely dropped ## (since only the "left" part would influence whether the @@ -282,7 +282,7 @@ ## Same suffix [#0 #1] (do try.monad - [leftM (merge leftA leftSF)] + [leftM (merged leftA leftSF)] (in (#Seq leftM rightA))) ## The 2 sequences cannot possibly be merged. @@ -332,7 +332,7 @@ (in [#.None (list coverageA)]) (#.Item altSF altsSF') - (case (merge coverageA altSF) + (case (merged coverageA altSF) (#try.Success altMSF) (case altMSF (#Alt _) @@ -356,7 +356,7 @@ (recur successA' possibilitiesSF')) #.None - (case (list.reverse possibilitiesSF) + (case (list.reversed possibilitiesSF) (#.Item last prevs) (in (list\fold (function (_ left right) (#Alt left right)) last diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux index 31ce0998c..e9e68deb3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux @@ -97,7 +97,7 @@ scope) (product.right ref+inner))])) [init_ref #.End] - (list.reverse inner)) + (list.reversed inner)) scopes (list\compose inner' outer)] (#.Right [(set@ #.scopes scopes state) (#.Some [ref_type ref])])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux index f3e9d30a1..4ecca3d1a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -329,7 +329,7 @@ #.None (/.except ..tag_does_not_belong_to_record [key recordT])))) (: (Dictionary Nat Code) - (dictionary.new n.hash)) + (dictionary.empty n.hash)) record) #let [ordered_tuple (list\map (function (_ idx) (maybe.assume (dictionary.get idx idx->val))) tuple_range)]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index d0f8db7c5..aa78e8ade 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -48,7 +48,7 @@ (def: #export empty Bundle - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (type: #export (State s i o) {#bundle (Bundle s i o) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux index 93e1c6d1f..0def3e75d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux @@ -12,5 +12,5 @@ (def: #export (bundle eval host_specific) (-> Eval Bundle Bundle) - (dictionary.merge host_specific - (/lux.bundle eval))) + (dictionary.merged host_specific + (/lux.bundle eval))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index 4f185f810..64a9b36b0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -208,8 +208,8 @@ Bundle (<| (bundle.prefix "js") (|> bundle.empty - (dictionary.merge bundle::array) - (dictionary.merge bundle::object) + (dictionary.merged bundle::array) + (dictionary.merged bundle::object) (bundle.install "constant" js::constant) (bundle.install "apply" js::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index acaf79ae9..0a60511ab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -698,50 +698,50 @@ Bundle (<| (///bundle.prefix "array") (|> ///bundle.empty - (dictionary.merge (<| (///bundle.prefix "length") - (|> ///bundle.empty - (///bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler jvm.boolean)) - (///bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler jvm.byte)) - (///bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler jvm.short)) - (///bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler jvm.int)) - (///bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler jvm.long)) - (///bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler jvm.float)) - (///bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler jvm.double)) - (///bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler jvm.char)) - (///bundle.install "object" array::length::object)))) - (dictionary.merge (<| (///bundle.prefix "new") - (|> ///bundle.empty - (///bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler jvm.boolean)) - (///bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler jvm.byte)) - (///bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler jvm.short)) - (///bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler jvm.int)) - (///bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler jvm.long)) - (///bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler jvm.float)) - (///bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler jvm.double)) - (///bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler jvm.char)) - (///bundle.install "object" array::new::object)))) - (dictionary.merge (<| (///bundle.prefix "read") - (|> ///bundle.empty - (///bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler ..boolean jvm.boolean)) - (///bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler ..byte jvm.byte)) - (///bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler ..short jvm.short)) - (///bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler ..int jvm.int)) - (///bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler ..long jvm.long)) - (///bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler ..float jvm.float)) - (///bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler ..double jvm.double)) - (///bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler ..char jvm.char)) - (///bundle.install "object" array::read::object)))) - (dictionary.merge (<| (///bundle.prefix "write") - (|> ///bundle.empty - (///bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler ..boolean jvm.boolean)) - (///bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler ..byte jvm.byte)) - (///bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler ..short jvm.short)) - (///bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler ..int jvm.int)) - (///bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler ..long jvm.long)) - (///bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler ..float jvm.float)) - (///bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler ..double jvm.double)) - (///bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler ..char jvm.char)) - (///bundle.install "object" array::write::object)))) + (dictionary.merged (<| (///bundle.prefix "length") + (|> ///bundle.empty + (///bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler jvm.boolean)) + (///bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler jvm.byte)) + (///bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler jvm.short)) + (///bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler jvm.int)) + (///bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler jvm.long)) + (///bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler jvm.float)) + (///bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler jvm.double)) + (///bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler jvm.char)) + (///bundle.install "object" array::length::object)))) + (dictionary.merged (<| (///bundle.prefix "new") + (|> ///bundle.empty + (///bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler jvm.boolean)) + (///bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler jvm.byte)) + (///bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler jvm.short)) + (///bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler jvm.int)) + (///bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler jvm.long)) + (///bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler jvm.float)) + (///bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler jvm.double)) + (///bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler jvm.char)) + (///bundle.install "object" array::new::object)))) + (dictionary.merged (<| (///bundle.prefix "read") + (|> ///bundle.empty + (///bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler ..boolean jvm.boolean)) + (///bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler ..byte jvm.byte)) + (///bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler ..short jvm.short)) + (///bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler ..int jvm.int)) + (///bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler ..long jvm.long)) + (///bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler ..float jvm.float)) + (///bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler ..double jvm.double)) + (///bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler ..char jvm.char)) + (///bundle.install "object" array::read::object)))) + (dictionary.merged (<| (///bundle.prefix "write") + (|> ///bundle.empty + (///bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler ..boolean jvm.boolean)) + (///bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler ..byte jvm.byte)) + (///bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler ..short jvm.short)) + (///bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler ..int jvm.int)) + (///bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler ..long jvm.long)) + (///bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler ..float jvm.float)) + (///bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler ..double jvm.double)) + (///bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler ..char jvm.char)) + (///bundle.install "object" array::write::object)))) ))) (def: object::null @@ -1163,11 +1163,11 @@ (-> (List Text) (List Text) [(List .Type) Mapping]) (let [jvm_tvars (list\compose owner_tvars method_tvars) lux_tvars (|> jvm_tvars - list.reverse + list.reversed list.enumeration (list\map (function (_ [idx name]) [name (idx_to_parameter idx)])) - list.reverse) + list.reversed) num_owner_tvars (list.size owner_tvars) owner_tvarsT (|> lux_tvars (list.take num_owner_tvars) (list\map product.right)) mapping (dictionary.of_list text.hash lux_tvars)] @@ -1295,8 +1295,8 @@ (function (_ method) (do ! [#let [expected_method_tvars (method_type_variables method) - aliasing (dictionary.merge (..aliasing expected_class_tvars actual_class_tvars) - (..aliasing expected_method_tvars actual_method_tvars))] + aliasing (dictionary.merged (..aliasing expected_class_tvars actual_class_tvars) + (..aliasing expected_method_tvars actual_method_tvars))] passes? (check_method aliasing class method_name method_style inputsJT method)] (\ ! map (if passes? (|>> #Pass) @@ -1326,8 +1326,8 @@ (monad.map ! (function (_ constructor) (do ! [#let [expected_method_tvars (constructor_type_variables constructor) - aliasing (dictionary.merge (..aliasing expected_class_tvars actual_class_tvars) - (..aliasing expected_method_tvars actual_method_tvars))] + aliasing (dictionary.merged (..aliasing expected_class_tvars actual_class_tvars) + (..aliasing expected_method_tvars actual_method_tvars))] passes? (check_constructor aliasing class inputsJT constructor)] (\ ! map (if passes? (|>> #Pass) (|>> #Hint)) @@ -1476,22 +1476,22 @@ (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "member") (|> ///bundle.empty - (dictionary.merge (<| (///bundle.prefix "get") - (|> ///bundle.empty - (///bundle.install "static" (get::static class_loader)) - (///bundle.install "virtual" (get::virtual class_loader))))) - (dictionary.merge (<| (///bundle.prefix "put") - (|> ///bundle.empty - (///bundle.install "static" (put::static class_loader)) - (///bundle.install "virtual" (put::virtual class_loader))))) - (dictionary.merge (<| (///bundle.prefix "invoke") - (|> ///bundle.empty - (///bundle.install "static" (invoke::static class_loader)) - (///bundle.install "virtual" (invoke::virtual class_loader)) - (///bundle.install "special" (invoke::special class_loader)) - (///bundle.install "interface" (invoke::interface class_loader)) - (///bundle.install "constructor" (invoke::constructor class_loader)) - ))) + (dictionary.merged (<| (///bundle.prefix "get") + (|> ///bundle.empty + (///bundle.install "static" (get::static class_loader)) + (///bundle.install "virtual" (get::virtual class_loader))))) + (dictionary.merged (<| (///bundle.prefix "put") + (|> ///bundle.empty + (///bundle.install "static" (put::static class_loader)) + (///bundle.install "virtual" (put::virtual class_loader))))) + (dictionary.merged (<| (///bundle.prefix "invoke") + (|> ///bundle.empty + (///bundle.install "static" (invoke::static class_loader)) + (///bundle.install "virtual" (invoke::virtual class_loader)) + (///bundle.install "special" (invoke::special class_loader)) + (///bundle.install "interface" (invoke::interface class_loader)) + (///bundle.install "constructor" (invoke::constructor class_loader)) + ))) ))) (type: #export (Annotation_Parameter a) @@ -1686,7 +1686,7 @@ arguments) [scope bodyA] (|> arguments' (#.Item [self_name selfT]) - list.reverse + list.reversed (list\fold scope.with_local (analyse archive body)) (typeA.with_type .Any) /////analysis.with_scope)] @@ -1762,7 +1762,7 @@ arguments) [scope bodyA] (|> arguments' (#.Item [self_name selfT]) - list.reverse + list.reversed (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) /////analysis.with_scope)] @@ -1835,7 +1835,7 @@ (in [name luxT]))) arguments) [scope bodyA] (|> arguments' - list.reverse + list.reversed (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) /////analysis.with_scope)] @@ -2002,7 +2002,7 @@ returnT (boxed_reflection_return mapping return) [scope bodyA] (|> arguments' (#.Item [self_name selfT]) - list.reverse + list.reversed (list\fold scope.with_local (analyse archive body)) (typeA.with_type returnT) /////analysis.with_scope)] @@ -2173,14 +2173,14 @@ (-> java/lang/ClassLoader Bundle) (<| (///bundle.prefix "jvm") (|> ///bundle.empty - (dictionary.merge bundle::conversion) - (dictionary.merge bundle::int) - (dictionary.merge bundle::long) - (dictionary.merge bundle::float) - (dictionary.merge bundle::double) - (dictionary.merge bundle::char) - (dictionary.merge bundle::array) - (dictionary.merge (bundle::object class_loader)) - (dictionary.merge (bundle::member class_loader)) - (dictionary.merge (bundle::class class_loader)) + (dictionary.merged bundle::conversion) + (dictionary.merged bundle::int) + (dictionary.merged bundle::long) + (dictionary.merged bundle::float) + (dictionary.merged bundle::double) + (dictionary.merged bundle::char) + (dictionary.merged bundle::array) + (dictionary.merged (bundle::object class_loader)) + (dictionary.merged (bundle::member class_loader)) + (dictionary.merged (bundle::class class_loader)) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index 9fc9ce902..923880ebd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -239,9 +239,9 @@ Bundle (<| (bundle.prefix "lua") (|> bundle.empty - (dictionary.merge bundle::array) - (dictionary.merge bundle::object) - (dictionary.merge bundle::utf8) + (dictionary.merged bundle::array) + (dictionary.merged bundle::object) + (dictionary.merged bundle::utf8) (bundle.install "constant" lua::constant) (bundle.install "apply" lua::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 78d3b7aac..906b54e23 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -293,9 +293,9 @@ (-> Eval Bundle) (<| (///bundle.prefix "lux") (|> ///bundle.empty - (dictionary.merge (bundle::lux eval)) - (dictionary.merge bundle::i64) - (dictionary.merge bundle::f64) - (dictionary.merge bundle::text) - (dictionary.merge bundle::io) + (dictionary.merged (bundle::lux eval)) + (dictionary.merged bundle::i64) + (dictionary.merged bundle::f64) + (dictionary.merged bundle::text) + (dictionary.merged bundle::io) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux index 40cf1f094..0a7fc2d7d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux @@ -204,8 +204,8 @@ Bundle (<| (bundle.prefix "php") (|> bundle.empty - (dictionary.merge bundle::array) - (dictionary.merge bundle::object) + (dictionary.merged bundle::array) + (dictionary.merged bundle::object) (bundle.install "constant" php::constant) (bundle.install "apply" php::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index 6d5e3290f..b5a81bc65 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -220,8 +220,8 @@ Bundle (<| (bundle.prefix "python") (|> bundle.empty - (dictionary.merge bundle::array) - (dictionary.merge bundle::object) + (dictionary.merged bundle::array) + (dictionary.merged bundle::object) (bundle.install "constant" python::constant) (bundle.install "import" python::import) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index 65650c837..a5328bc54 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -189,8 +189,8 @@ Bundle (<| (bundle.prefix "ruby") (|> bundle.empty - (dictionary.merge bundle::array) - (dictionary.merge bundle::object) + (dictionary.merged bundle::array) + (dictionary.merged bundle::object) (bundle.install "constant" ruby::constant) (bundle.install "apply" ruby::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index 8e309a9de..5a6776b13 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -149,8 +149,8 @@ Bundle (<| (bundle.prefix "scheme") (|> bundle.empty - (dictionary.merge bundle::array) - (dictionary.merge bundle::object) + (dictionary.merged bundle::array) + (dictionary.merged bundle::object) (bundle.install "constant" scheme::constant) (bundle.install "apply" scheme::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux index 95b04daa2..1869c6ff4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/bundle.lux @@ -13,7 +13,7 @@ (def: #export empty Bundle - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: #export (install name anonymous) (All [s i o] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index d70b59aef..d12359d68 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -448,4 +448,4 @@ (<| (///bundle.prefix "lux") (|> ///bundle.empty (dictionary.put "def" (lux::def expander host_analysis)) - (dictionary.merge (..bundle::def expander host_analysis program anchorT,expressionT,directiveT extender))))) + (dictionary.merged (..bundle::def expander host_analysis program anchorT,expressionT,directiveT extender))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux index f42aa31ff..740236dc8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux index 602c40504..4900dea03 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux @@ -172,9 +172,9 @@ Bundle (<| (/.prefix "lux") (|> /.empty - (dictionary.merge lux_procs) - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged lux_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux index ba83e257f..64db8196b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux index da9bbc7f8..33267e376 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux @@ -184,8 +184,8 @@ Bundle (<| (/.prefix "lux") (|> lux_procs - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux index 8e9464e77..6bb747d54 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux @@ -150,8 +150,8 @@ Bundle (<| (/.prefix "js") (|> /.empty - (dictionary.merge ..array) - (dictionary.merge ..object) + (dictionary.merged ..array) + (dictionary.merged ..object) (/.install "constant" js::constant) (/.install "apply" js::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux index 396c3284e..16a34222e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm.lux @@ -14,7 +14,7 @@ (def: #export bundle Bundle - ($_ dictionary.merge + ($_ dictionary.merged /common.bundle /host.bundle )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux index 354537c19..78c75a17b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux @@ -408,7 +408,7 @@ Bundle (<| (/////bundle.prefix "lux") (|> bundle::lux - (dictionary.merge ..bundle::i64) - (dictionary.merge ..bundle::f64) - (dictionary.merge ..bundle::text) - (dictionary.merge ..bundle::io)))) + (dictionary.merged ..bundle::i64) + (dictionary.merged ..bundle::f64) + (dictionary.merged ..bundle::text) + (dictionary.merged ..bundle::io)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index 58ac1efc1..2c78f5988 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -462,50 +462,50 @@ Bundle (<| (/////bundle.prefix "array") (|> /////bundle.empty - (dictionary.merge (<| (/////bundle.prefix "length") - (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler type.boolean)) - (/////bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler type.byte)) - (/////bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler type.short)) - (/////bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler type.int)) - (/////bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler type.long)) - (/////bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler type.float)) - (/////bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler type.double)) - (/////bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler type.char)) - (/////bundle.install "object" array::length::object)))) - (dictionary.merge (<| (/////bundle.prefix "new") - (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler __.t_boolean)) - (/////bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler __.t_byte)) - (/////bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler __.t_short)) - (/////bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler __.t_int)) - (/////bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler __.t_long)) - (/////bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler __.t_float)) - (/////bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler __.t_double)) - (/////bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler __.t_char)) - (/////bundle.install "object" array::new::object)))) - (dictionary.merge (<| (/////bundle.prefix "read") - (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler type.boolean _.baload)) - (/////bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler type.byte _.baload)) - (/////bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler type.short _.saload)) - (/////bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler type.int _.iaload)) - (/////bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler type.long _.laload)) - (/////bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler type.float _.faload)) - (/////bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler type.double _.daload)) - (/////bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler type.char _.caload)) - (/////bundle.install "object" array::read::object)))) - (dictionary.merge (<| (/////bundle.prefix "write") - (|> /////bundle.empty - (/////bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler type.boolean _.bastore)) - (/////bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler type.byte _.bastore)) - (/////bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler type.short _.sastore)) - (/////bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler type.int _.iastore)) - (/////bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler type.long _.lastore)) - (/////bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler type.float _.fastore)) - (/////bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler type.double _.dastore)) - (/////bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler type.char _.castore)) - (/////bundle.install "object" array::write::object)))) + (dictionary.merged (<| (/////bundle.prefix "length") + (|> /////bundle.empty + (/////bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler type.boolean)) + (/////bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler type.byte)) + (/////bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler type.short)) + (/////bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler type.int)) + (/////bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler type.long)) + (/////bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler type.float)) + (/////bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler type.double)) + (/////bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler type.char)) + (/////bundle.install "object" array::length::object)))) + (dictionary.merged (<| (/////bundle.prefix "new") + (|> /////bundle.empty + (/////bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler __.t_boolean)) + (/////bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler __.t_byte)) + (/////bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler __.t_short)) + (/////bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler __.t_int)) + (/////bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler __.t_long)) + (/////bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler __.t_float)) + (/////bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler __.t_double)) + (/////bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler __.t_char)) + (/////bundle.install "object" array::new::object)))) + (dictionary.merged (<| (/////bundle.prefix "read") + (|> /////bundle.empty + (/////bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler type.boolean _.baload)) + (/////bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler type.byte _.baload)) + (/////bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler type.short _.saload)) + (/////bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler type.int _.iaload)) + (/////bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler type.long _.laload)) + (/////bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler type.float _.faload)) + (/////bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler type.double _.daload)) + (/////bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler type.char _.caload)) + (/////bundle.install "object" array::read::object)))) + (dictionary.merged (<| (/////bundle.prefix "write") + (|> /////bundle.empty + (/////bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler type.boolean _.bastore)) + (/////bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler type.byte _.bastore)) + (/////bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler type.short _.sastore)) + (/////bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler type.int _.iastore)) + (/////bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler type.long _.lastore)) + (/////bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler type.float _.fastore)) + (/////bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler type.double _.dastore)) + (/////bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler type.char _.castore)) + (/////bundle.install "object" array::write::object)))) ))) (def: (object::null _) @@ -796,21 +796,21 @@ Bundle (<| (/////bundle.prefix "member") (|> (: Bundle /////bundle.empty) - (dictionary.merge (<| (/////bundle.prefix "get") - (|> (: Bundle /////bundle.empty) - (/////bundle.install "static" get::static) - (/////bundle.install "virtual" get::virtual)))) - (dictionary.merge (<| (/////bundle.prefix "put") - (|> (: Bundle /////bundle.empty) - (/////bundle.install "static" put::static) - (/////bundle.install "virtual" put::virtual)))) - (dictionary.merge (<| (/////bundle.prefix "invoke") - (|> (: Bundle /////bundle.empty) - (/////bundle.install "static" invoke::static) - (/////bundle.install "virtual" invoke::virtual) - (/////bundle.install "special" invoke::special) - (/////bundle.install "interface" invoke::interface) - (/////bundle.install "constructor" invoke::constructor)))) + (dictionary.merged (<| (/////bundle.prefix "get") + (|> (: Bundle /////bundle.empty) + (/////bundle.install "static" get::static) + (/////bundle.install "virtual" get::virtual)))) + (dictionary.merged (<| (/////bundle.prefix "put") + (|> (: Bundle /////bundle.empty) + (/////bundle.install "static" put::static) + (/////bundle.install "virtual" put::virtual)))) + (dictionary.merged (<| (/////bundle.prefix "invoke") + (|> (: Bundle /////bundle.empty) + (/////bundle.install "static" invoke::static) + (/////bundle.install "virtual" invoke::virtual) + (/////bundle.install "special" invoke::special) + (/////bundle.install "interface" invoke::interface) + (/////bundle.install "constructor" invoke::constructor)))) ))) (def: annotation_parameter @@ -1094,13 +1094,13 @@ Bundle (<| (/////bundle.prefix "jvm") (|> ..bundle::conversion - (dictionary.merge ..bundle::int) - (dictionary.merge ..bundle::long) - (dictionary.merge ..bundle::float) - (dictionary.merge ..bundle::double) - (dictionary.merge ..bundle::char) - (dictionary.merge ..bundle::array) - (dictionary.merge ..bundle::object) - (dictionary.merge ..bundle::member) - (dictionary.merge ..bundle::class) + (dictionary.merged ..bundle::int) + (dictionary.merged ..bundle::long) + (dictionary.merged ..bundle::float) + (dictionary.merged ..bundle::double) + (dictionary.merged ..bundle::char) + (dictionary.merged ..bundle::array) + (dictionary.merged ..bundle::object) + (dictionary.merged ..bundle::member) + (dictionary.merged ..bundle::class) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux index 1f1bd7f91..492f43b94 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux index e8022f806..3c8338304 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux @@ -174,8 +174,8 @@ Bundle (<| (/.prefix "lux") (|> lux_procs - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux index 35d895177..a66a198c7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux @@ -187,9 +187,9 @@ Bundle (<| (/.prefix "lua") (|> /.empty - (dictionary.merge ..array) - (dictionary.merge ..object) - (dictionary.merge ..utf8) + (dictionary.merged ..array) + (dictionary.merged ..object) + (dictionary.merged ..utf8) (/.install "constant" lua::constant) (/.install "apply" lua::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux index 751e67a85..6805ccc27 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index 3925bec4b..ca4de50cf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -185,8 +185,8 @@ Bundle (<| (/.prefix "lux") (|> /.empty - (dictionary.merge lux_procs) - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs)))) + (dictionary.merged lux_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux index a8ef44fc8..39ddd3df9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/host.lux @@ -133,8 +133,8 @@ Bundle (<| (/.prefix "php") (|> /.empty - (dictionary.merge ..array) - (dictionary.merge ..object) + (dictionary.merged ..array) + (dictionary.merged ..object) (/.install "constant" php::constant) (/.install "apply" php::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux index 2309732f3..55e2e4756 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux index d9c7fe72f..81107aba9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux @@ -164,8 +164,8 @@ Bundle (<| (/.prefix "lux") (|> lux_procs - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux index a9215898d..56393387f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux @@ -154,8 +154,8 @@ Bundle (<| (/.prefix "python") (|> /.empty - (dictionary.merge ..array) - (dictionary.merge ..object) + (dictionary.merged ..array) + (dictionary.merged ..object) (/.install "constant" python::constant) (/.install "import" python::import) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux index 7ca8195f7..f137406ab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux index 87c1e59cc..8604be023 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux @@ -171,9 +171,9 @@ Bundle (<| (/.prefix "lux") (|> /.empty - ## (dictionary.merge lux_procs) - (dictionary.merge i64_procs) - ## (dictionary.merge f64_procs) - (dictionary.merge text_procs) - ## (dictionary.merge io_procs) + ## (dictionary.merged lux_procs) + (dictionary.merged i64_procs) + ## (dictionary.merged f64_procs) + (dictionary.merged text_procs) + ## (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux index 417ccf847..dfeee165e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux index 970566967..7eb4e2a5b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux @@ -179,8 +179,8 @@ Bundle (<| (/.prefix "lux") (|> lux_procs - (dictionary.merge ..i64_procs) - (dictionary.merge ..f64_procs) - (dictionary.merge ..text_procs) - (dictionary.merge ..io_procs) + (dictionary.merged ..i64_procs) + (dictionary.merged ..f64_procs) + (dictionary.merged ..text_procs) + (dictionary.merged ..io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux index 0d0f94f50..9e6df81c7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux @@ -126,8 +126,8 @@ Bundle (<| (/.prefix "ruby") (|> /.empty - (dictionary.merge ..array) - (dictionary.merge ..object) + (dictionary.merged ..array) + (dictionary.merged ..object) (/.install "constant" ruby::constant) (/.install "apply" ruby::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux index 7245ac4f6..9d74e5fc6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme.lux @@ -14,5 +14,5 @@ (def: #export bundle Bundle - (dictionary.merge /common.bundle - /host.bundle)) + (dictionary.merged /common.bundle + /host.bundle)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux index 3663f845a..e725c9b95 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux @@ -167,9 +167,9 @@ Bundle (<| (/.prefix "lux") (|> /.empty - (dictionary.merge lux_procs) - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged lux_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux index 23f6056ae..0552946f9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/host.lux @@ -100,8 +100,8 @@ Bundle (<| (/.prefix "scheme") (|> /.empty - (dictionary.merge ..array) - (dictionary.merge ..object) + (dictionary.merged ..array) + (dictionary.merged ..object) (/.install "constant" scheme::constant) (/.install "apply" scheme::apply) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux index ee472fe92..f5d416ee1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/extension/common.lux @@ -130,8 +130,8 @@ Bundle (<| (bundle.prefix "lux") (|> lux_procs - (dictionary.merge i64_procs) - (dictionary.merge f64_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged i64_procs) + (dictionary.merged f64_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index 7beef96cb..7758725c1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -85,7 +85,7 @@ [#.Right //runtime.tuple//right]))] (method source))) valueO - (list.reverse pathP))))) + (list.reversed pathP))))) (def: @savepoint (_.var "lux_pm_cursor_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux index de6b0a500..dcb7daa43 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux @@ -38,7 +38,7 @@ (if initial? (_.define variable value) (_.set variable value))))) - list.reverse + list.reversed (list\fold _.then body))) (def: #export (scope! statement expression archive [start initsS+ bodyS]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux index 04d5926a7..bdf4fb89c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux @@ -250,7 +250,7 @@ (..right_projection lefts))] (_.compose so_far next))) recordG - (list.reverse path))))) + (list.reversed path))))) (def: #export (case phase archive [valueS path]) (Generator [Synthesis Path]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux index ba6cb27ef..f8961db37 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/loop.lux @@ -66,7 +66,7 @@ (list\map product.left) (monad.seq _.monad)) (|> updatesG - list.reverse + list.reversed (list\map product.right) (monad.seq _.monad)) (_.goto @begin))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 2114acc89..0e1b681c4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -71,7 +71,7 @@ [#.Right //runtime.tuple//right]))] (method source))) valueO - (list.reverse pathP))))) + (list.reversed pathP))))) (def: #export (if expression archive [testS thenS elseS]) (Generator [Synthesis Synthesis Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index af27eb9fc..5eb23e1a9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -92,7 +92,7 @@ [#.Right //runtime.tuple//right]))] (method source))) valueG - (list.reverse pathP))))) + (list.reversed pathP))))) (def: @savepoint (_.var "lux_pm_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux index 8da358393..08a124e2c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/extension/common.lux @@ -104,9 +104,9 @@ Bundle (<| (bundle.prefix "lux") (|> lux_procs - (dictionary.merge i64_procs) - (dictionary.merge int_procs) - (dictionary.merge frac_procs) - (dictionary.merge text_procs) - (dictionary.merge io_procs) + (dictionary.merged i64_procs) + (dictionary.merged int_procs) + (dictionary.merged frac_procs) + (dictionary.merged text_procs) + (dictionary.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 82fe69b94..630e222e5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -44,7 +44,7 @@ (list\map (function (_ [register value]) (let [variable (//case.register (n.+ offset register))] (_.set! variable value)))) - list.reverse + list.reversed (list\fold _.then body))) (def: #export (scope! statement expression archive [start initsS+ bodyS]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index a3f993150..cdfaf74fe 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -97,7 +97,7 @@ [#.Right //runtime.tuple::right]))] (method source))) valueO - (list.reverse pathP))))) + (list.reversed pathP))))) (def: @savepoint (_.var "lux_pm_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 066925e96..830154cbd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -38,7 +38,7 @@ (list\map (function (_ [register value]) (_.set (list (//case.register (n.+ offset register))) value))) - list.reverse + list.reversed (list\fold _.then body))) (def: #export (set_scope body!) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index 133ce1fa8..8ef713643 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -75,7 +75,7 @@ [#.Right //runtime.tuple::right]))] (method source))) valueO - (list.reverse pathP))))) + (list.reversed pathP))))) (def: $savepoint (_.var "lux_pm_cursor_savepoint")) (def: $cursor (_.var "lux_pm_cursor")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux index b650c7e8d..7de7310d6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux @@ -139,7 +139,7 @@ (def: lux_procs Bundle - (|> (dict.new text.Hash<Text>) + (|> (dict.empty text.Hash<Text>) (install "is" (binary lux//is)) (install "try" (unary lux//try)) (install "if" (trinary lux//if)) @@ -171,7 +171,7 @@ (def: bit_procs Bundle (<| (prefix "bit") - (|> (dict.new text.Hash<Text>) + (|> (dict.empty text.Hash<Text>) (install "and" (binary bit//and)) (install "or" (binary bit//or)) (install "xor" (binary bit//xor)) @@ -243,7 +243,7 @@ (def: int_procs Bundle (<| (prefix "int") - (|> (dict.new text.Hash<Text>) + (|> (dict.empty text.Hash<Text>) (install "+" (binary int//add)) (install "-" (binary int//sub)) (install "*" (binary int//mul)) @@ -261,7 +261,7 @@ (def: frac_procs Bundle (<| (prefix "frac") - (|> (dict.new text.Hash<Text>) + (|> (dict.empty text.Hash<Text>) (install "+" (binary frac//add)) (install "-" (binary frac//sub)) (install "*" (binary frac//mul)) @@ -296,7 +296,7 @@ (def: text_procs Bundle (<| (prefix "text") - (|> (dict.new text.Hash<Text>) + (|> (dict.empty text.Hash<Text>) (install "=" (binary text//=)) (install "<" (binary text//<)) (install "concat" (binary text//concat)) @@ -320,7 +320,7 @@ (def: io_procs Bundle (<| (prefix "io") - (|> (dict.new text.Hash<Text>) + (|> (dict.empty text.Hash<Text>) (install "log" (unary (|>> r.print ..void))) (install "error" (unary r.stop)) (install "exit" (unary io//exit)) @@ -332,9 +332,9 @@ Bundle (<| (prefix "lux") (|> lux_procs - (dict.merge bit_procs) - (dict.merge int_procs) - (dict.merge frac_procs) - (dict.merge text_procs) - (dict.merge io_procs) + (dict.merged bit_procs) + (dict.merged int_procs) + (dict.merged frac_procs) + (dict.merged text_procs) + (dict.merged io_procs) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux index cb0f5e48d..f97ae27e0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux @@ -47,7 +47,7 @@ ## (def: lua_procs ## @.Bundle -## (|> (dict.new text.Hash<Text>) +## (|> (dict.empty text.Hash<Text>) ## (@.install "nil" (@.nullary lua//nil)) ## (@.install "table" (@.nullary lua//table)) ## (@.install "global" lua//global) @@ -76,7 +76,7 @@ ## (def: table_procs ## @.Bundle ## (<| (@.prefix "table") -## (|> (dict.new text.Hash<Text>) +## (|> (dict.empty text.Hash<Text>) ## (@.install "call" table//call) ## (@.install "get" (@.binary table//get)) ## (@.install "set" (@.trinary table//set))))) @@ -84,7 +84,7 @@ (def: #export procedures @.Bundle (<| (@.prefix "lua") - (dict.new text.Hash<Text>) + (dict.empty text.Hash<Text>) ## (|> lua_procs - ## (dict.merge table_procs)) + ## (dict.merged table_procs)) )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index 69df6f104..d1bbfae39 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -99,7 +99,7 @@ [#.Right //runtime.tuple//right]))] (method source))) valueO - (list.reverse pathP))))) + (list.reversed pathP))))) (def: @savepoint (_.local "lux_pm_savepoint")) (def: @cursor (_.local "lux_pm_cursor")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux index ed5370a68..d021df198 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux @@ -38,7 +38,7 @@ (list\map (function (_ [register value]) (_.set (list (//case.register (n.+ offset register))) value))) - list.reverse + list.reversed (list\fold _.then body))) (def: symbol diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux index 79d8950ce..25da6b501 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux @@ -73,7 +73,7 @@ [#.Right //runtime.tuple//right]))] (method source))) valueO - (list.reverse pathP))))) + (list.reversed pathP))))) (def: @savepoint (_.var "lux_pm_cursor_savepoint")) (def: @cursor (_.var "lux_pm_cursor")) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux index a3a598808..28cf31cc1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux @@ -216,8 +216,8 @@ Bundle (<| (bundle.prefix "lux") (|> bundle::lux - (dict.merge bundle::i64) - (dict.merge bundle::f64) - (dict.merge bundle::text) - (dict.merge bundle::io) + (dict.merged bundle::i64) + (dict.merged bundle::f64) + (dict.merged bundle::text) + (dict.merged bundle::io) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index dc22dc355..f6f4d746c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -87,7 +87,7 @@ (when> [(new> (not end?') [])] [(///\map ..clean_up)]) nextC)))) thenC - (list.reverse (list.enumeration tuple)))) + (list.reversed (list.enumeration tuple)))) )) (def: (path archive synthesize pattern bodyA) @@ -322,8 +322,8 @@ (def: empty Storage - {#bindings (set.new n.hash) - #dependencies (set.new ///reference/variable.hash)}) + {#bindings (set.empty n.hash) + #dependencies (set.empty ///reference/variable.hash)}) ## TODO: Use this to declare all local variables at the beginning of ## script functions. diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 80d3eb556..ab798a01b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -172,7 +172,7 @@ (def: initial Redundancy - (dictionary.new n.hash)) + (dictionary.empty n.hash)) (def: redundant! true) (def: necessary! false) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index a54350ccf..d6c43e896 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -103,7 +103,7 @@ (def: #export no_aliases Aliases - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: #export prelude .prelude_module) @@ -230,7 +230,7 @@ (#.Left [source' error]) (if (is? <close> error) (#.Right [source' - [where (<tag> (list.reverse stack))]]) + [where (<tag> (list.reversed stack))]]) (#.Left [source' error])))))] ## Form and tuple syntax is mostly the same, differing only in the @@ -253,7 +253,7 @@ (#.Left [source' error]) (if (is? ..close_record error) (#.Right [source' - [where (#.Record (list.reverse stack))]]) + [where (#.Record (list.reversed stack))]]) (#.Left [source' error]))))) (template: (!guarantee_no_new_lines where offset source_code content body) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index 8559afe35..d5a1e53a4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -44,7 +44,7 @@ (def: #export fresh_resolver Resolver - (dictionary.new variable.hash)) + (dictionary.empty variable.hash)) (def: #export init State @@ -307,10 +307,10 @@ (format "(@ " (%.nat register) ")") (#Alt left right) - (format "(| " (%path' %then left) " " (%path' %then right) ")") + (format "(Variant " (%path' %then left) " " (%path' %then right) ")") (#Seq left right) - (format "(& " (%path' %then left) " " (%path' %then right) ")") + (format "(Tuple " (%path' %then left) " " (%path' %then right) ")") (#Then then) (|> (%then then) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index a5a8826a0..a45c7ad59 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -85,7 +85,7 @@ (def: #export empty Archive (:abstraction {#next 0 - #resolver (dictionary.new text.hash)})) + #resolver (dictionary.empty text.hash)})) (def: #export (id module archive) (-> Module Archive (Try ID)) @@ -189,7 +189,7 @@ (list\map (function (_ [module [id _]]) [module id])))) - (def: #export (merge additions archive) + (def: #export (merged additions archive) (-> Archive Archive Archive) (let [[+next +resolver] (:representation additions)] (|> archive diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux index c7f699f87..7feeac2a0 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -44,7 +44,7 @@ (def: #export empty Registry (:abstraction {#artifacts row.empty - #resolver (dictionary.new text.hash)})) + #resolver (dictionary.empty text.hash)})) (def: #export artifacts (-> Registry (Row Artifact)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux index c51151b68..4d9af7859 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux @@ -27,14 +27,14 @@ (def: fresh Ancestry - (set.new text.hash)) + (set.empty text.hash)) (type: #export Graph (Dictionary Module Ancestry)) (def: empty Graph - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: #export modules (-> Graph (List Module)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index 7290b74a5..c5ebc6bad 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -205,10 +205,10 @@ (def: empty_bundles Bundles - [(dictionary.new text.hash) - (dictionary.new text.hash) - (dictionary.new text.hash) - (dictionary.new text.hash)]) + [(dictionary.empty text.hash) + (dictionary.empty text.hash) + (dictionary.empty text.hash) + (dictionary.empty text.hash)]) (def: (loaded_document extension host module_id expected actual document) (All [expression directive] @@ -218,7 +218,7 @@ [[definitions bundles] (: (Try [Definitions Bundles Output]) (loop [input (row.to_list expected) definitions (: Definitions - (dictionary.new text.hash)) + (dictionary.empty text.hash)) bundles ..empty_bundles output (: Output row.empty)] (let [[analysers synthesizers generators directives] bundles] @@ -452,10 +452,10 @@ analysis_state (list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]] [analysers synthesizers generators directives]) - [(dictionary.merge +analysers analysers) - (dictionary.merge +synthesizers synthesizers) - (dictionary.merge +generators generators) - (dictionary.merge +directives directives)]) + [(dictionary.merged +analysers analysers) + (dictionary.merged +synthesizers synthesizers) + (dictionary.merged +generators generators) + (dictionary.merged +directives directives)]) ..empty_bundles loaded_caches)]))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux index aae528bda..8903ab503 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -165,5 +165,5 @@ (try.with async.monad)) (..enumerate_context fs) (: Enumeration - (dictionary.new text.hash)) + (dictionary.empty text.hash)) contexts)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index b1735f389..3ebdae788 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -256,8 +256,8 @@ [entries duplicates sink] (|> host_dependencies dictionary.values (monad.fold ! ..write_host_dependency - [(set.new text.hash) - (set.new text.hash) + [(set.empty text.hash) + (set.empty text.hash) sink])) #let [_ (do_to sink (java/io/Flushable::flush) diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index ce3b32921..f12adc89b 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -95,11 +95,11 @@ ($_ text\compose <open> (|> (<flat> type) (list\map format) - list.reverse + list.reversed (list.interpose " ") (list\fold text\compose "")) <close>)]) - ([#.Sum "(| " ")" flat_variant] + ([#.Sum "(Or " ")" flat_variant] [#.Product "[" "]" flat_tuple]) (#.Function input output) @@ -107,7 +107,7 @@ ($_ text\compose "(-> " (|> ins (list\map format) - list.reverse + list.reversed (list.interpose " ") (list\fold text\compose "")) " " (format out) ")")) @@ -123,7 +123,7 @@ (#.Apply param fun) (let [[type_func type_args] (flat_application type)] - ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reverse (list.interpose " ") (list\fold text\compose "")) ")")) + ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reversed (list.interpose " ") (list\fold text\compose "")) ")")) (^template [<tag> <desc>] [(<tag> env body) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index 121f1fb2f..882b723ff 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -298,7 +298,7 @@ (def: empty_ring Ring - (set.new n.hash)) + (set.empty n.hash)) ## TODO: Optimize this by not using sets anymore. (def: (ring start) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index 6141cadbb..167c25c0e 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -135,7 +135,7 @@ #let [total_locals (list\fold (function (_ [name type] table) (try.else table (dictionary.try_put name type table))) (: (Dictionary Text Type) - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (list\join local_batches))]] (in (|> total_locals dictionary.entries diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index e68f820d0..2cda92c15 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -7,15 +7,10 @@ [indexed (#+ IxMonad)]]] [control ["." exception (#+ exception:)] - ["." io (#+ IO)] - [concurrency - ["." async (#+ Async)]] ["<>" parser ["<.>" code (#+ Parser)]]] [data - ["." identity (#+ Identity)] ["." maybe] - ["." product] [text ["%" format (#+ format)]] [collection @@ -45,41 +40,31 @@ (All [keys] (Procedure monad [permissions keys] keys value))) -(implementation: (indexed Monad<m>) - (All [m] (-> (Monad m) (IxMonad (Procedure m)))) +(implementation: #export (monad monad) + (All [!] (-> (Monad !) (IxMonad (Procedure !)))) (def: (in value) (function (_ keys) - (\ Monad<m> in [keys value]))) + (\ monad in [keys value]))) (def: (bind f input) (function (_ keysI) - (do Monad<m> + (do monad [[keysT value] (input keysI)] ((f value) keysT))))) -(template [<name> <m> <monad> <execute> <lift>] - [(def: #export <name> - (IxMonad (Procedure <m>)) - (..indexed <monad>)) - - (def: #export (<execute> procedure) - (All [v] (-> (Linear <m> v) (<m> v))) - (do <monad> - [[_ output] (procedure [])] - (in output))) - - (def: #export (<lift> procedure) - (All [v] (-> (<m> v) (Linear <m> v))) - (function (_ keys) - (do <monad> - [output procedure] - (in [keys output]))))] - - [pure Identity identity.monad run_pure lift_pure] - [sync IO io.monad run_sync lift_sync] - [async Async async.monad run_async lift_async] - ) +(def: #export (run monad procedure) + (All [! v] (-> (Monad !) (Linear ! v) (! v))) + (do monad + [[_ output] (procedure [])] + (in output))) + +(def: #export (lifted monad procedure) + (All [! v] (-> (Monad !) (! v) (Linear ! v))) + (function (_ keys) + (do monad + [output procedure] + (in [keys output])))) (abstract: #export Ordered Any) @@ -102,31 +87,22 @@ {#.doc "A value locked by a key."} - (template [<name> <m> <monad> <mode> <key>] - [(def: #export (<name> value) - (All [v] (Ex [k] (-> v (Affine <m> (Key <mode> k) (Res k v))))) + (template [<name> <mode> <key>] + [(def: #export (<name> monad value) + (All [! v] (Ex [k] (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v))))) (function (_ keys) - (\ <monad> in [[(<key> []) keys] (:abstraction value)])))] - - [ordered_pure Identity identity.monad Ordered ordered_key] - [ordered_sync IO io.monad Ordered ordered_key] - [ordered_async Async async.monad Ordered ordered_key] - [commutative_sync IO io.monad Commutative commutative_key] - [commutative_pure Identity identity.monad Commutative commutative_key] - [commutative_async Async async.monad Commutative commutative_key] - ) + (\ monad in [[(<key> []) keys] (:abstraction value)])))] - (template [<name> <m> <monad>] - [(def: #export (<name> resource) - (All [v k m] - (-> (Res k v) (Relevant <m> (Key m k) v))) - (function (_ [key keys]) - (\ <monad> in [keys (:representation resource)])))] + [ordered Ordered ..ordered_key] + [commutative Commutative ..commutative_key] + ) - [read_pure Identity identity.monad] - [read_sync IO io.monad] - [read_async Async async.monad] - )) + (def: #export (read monad resource) + (All [! v k m] + (-> (Monad !) (Res k v) (Relevant ! (Key m k) v))) + (function (_ [key keys]) + (\ monad in [keys (:representation resource)]))) + ) (exception: #export (index_cannot_be_repeated {index Nat}) (exception.report @@ -136,7 +112,7 @@ (def: indices (Parser (List Nat)) - (<code>.tuple (loop [seen (set.new n.hash)] + (<code>.tuple (loop [seen (set.empty n.hash)] (do {! <>.monad} [done? <code>.end?] (if done? @@ -148,45 +124,40 @@ tail (recur (set.add head seen))] (in (list& head tail)))))))) -(def: (no_op Monad<m>) +(def: (no_op monad) (All [m] (-> (Monad m) (Linear m Any))) (function (_ context) - (\ Monad<m> in [context []]))) - -(template [<name> <m> <monad>] - [(syntax: #export (<name> {swaps ..indices}) - (macro.with_gensyms [g!_ g!context] - (case swaps - #.End - (in (list (` ((~! no_op) <monad>)))) - - (#.Item head tail) - (do {! meta.monad} - [#let [max_idx (list\fold n.max head tail)] - g!inputs (<| (monad.seq !) (list.repeat (inc max_idx)) (macro.gensym "input")) - #let [g!outputs (|> (monad.fold maybe.monad - (function (_ from to) - (do maybe.monad - [input (list.nth from g!inputs)] - (in (row.add input to)))) - (: (Row Code) row.empty) - swaps) - maybe.assume - row.to_list) - g!inputsT+ (list\map (|>> (~) (..Key ..Commutative) (`)) g!inputs) - g!outputsT+ (list\map (|>> (~) (..Key ..Commutative) (`)) g!outputs)]] - (in (list (` (: (All [(~+ g!inputs) (~ g!context)] - (Procedure (~! <m>) - [(~+ g!inputsT+) (~ g!context)] - [(~+ g!outputsT+) (~ g!context)] - .Any)) - (function ((~ g!_) [(~+ g!inputs) (~ g!context)]) - (\ (~! <monad>) (~' in) [[(~+ g!outputs) (~ g!context)] []]))))))))))] - - [exchange_pure Identity identity.monad] - [exchange_sync IO io.monad] - [exchange_async Async async.monad] - ) + (\ monad in [context []]))) + +(syntax: #export (exchange {swaps ..indices}) + (macro.with_gensyms [g!_ g!context g!!] + (case swaps + #.End + (in (list (` (~! no_op)))) + + (#.Item head tail) + (do {! meta.monad} + [#let [max_idx (list\fold n.max head tail)] + g!inputs (<| (monad.seq !) (list.repeat (inc max_idx)) (macro.gensym "input")) + #let [g!outputs (|> (monad.fold maybe.monad + (function (_ from to) + (do maybe.monad + [input (list.nth from g!inputs)] + (in (row.add input to)))) + (: (Row Code) row.empty) + swaps) + maybe.assume + row.to_list) + g!inputsT+ (list\map (|>> (~) (..Key ..Commutative) (`)) g!inputs) + g!outputsT+ (list\map (|>> (~) (..Key ..Commutative) (`)) g!outputs)]] + (in (list (` (: (All [(~ g!!) (~+ g!inputs) (~ g!context)] + (-> ((~! monad.Monad) (~ g!!)) + (Procedure (~ g!!) + [(~+ g!inputsT+) (~ g!context)] + [(~+ g!outputsT+) (~ g!context)] + .Any))) + (function ((~ g!_) (~ g!!) [(~+ g!inputs) (~ g!context)]) + (\ (~ g!!) (~' in) [[(~+ g!outputs) (~ g!context)] []])))))))))) (def: amount (Parser Nat) @@ -196,23 +167,22 @@ (n.> 0 raw))] (in raw))) -(template [<name> <m> <monad> <from> <to>] +(template [<name> <from> <to>] [(syntax: #export (<name> {amount ..amount}) - (macro.with_gensyms [g!_ g!context] + (macro.with_gensyms [g!_ g!context g!!] (do {! meta.monad} - [g!keys (<| (monad.seq !) (list.repeat amount) (macro.gensym "keys"))] - (in (list (` (: (All [(~+ g!keys) (~ g!context)] - (Procedure (~! <m>) - [<from> (~ g!context)] - [<to> (~ g!context)] - .Any)) - (function ((~ g!_) [<from> (~ g!context)]) - (\ (~! <monad>) (~' in) [[<to> (~ g!context)] []])))))))))] - - [group_pure Identity identity.monad (~+ g!keys) [(~+ g!keys)]] - [group_sync IO io.monad (~+ g!keys) [(~+ g!keys)]] - [group_async Async async.monad (~+ g!keys) [(~+ g!keys)]] - [un_group_pure Identity identity.monad [(~+ g!keys)] (~+ g!keys)] - [un_group_sync IO io.monad [(~+ g!keys)] (~+ g!keys)] - [un_group_async Async async.monad [(~+ g!keys)] (~+ g!keys)] + [g!keys (|> (macro.gensym "keys") + (list.repeat amount) + (monad.seq !))] + (in (list (` (: (All [(~ g!!) (~+ g!keys) (~ g!context)] + (-> ((~! monad.Monad) (~ g!!)) + (Procedure (~ g!!) + [<from> (~ g!context)] + [<to> (~ g!context)] + .Any))) + (function ((~ g!_) (~ g!!) [<from> (~ g!context)]) + (\ (~ g!!) (~' in) [[<to> (~ g!context)] []])))))))))] + + [group (~+ g!keys) [(~+ g!keys)]] + [un_group [(~+ g!keys)] (~+ g!keys)] ) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 2003b9804..f3ce90305 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -1002,7 +1002,7 @@ (def: empty_mock Mock - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: (retrieve_mock_file! separator path mock) (-> Text Path Mock (Try [Text Mock_File])) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index e1e572023..bfe64cca1 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -128,7 +128,7 @@ [last_modified (\ fs last_modified file)] (in (dictionary.put file last_modified tracker)))) (: File_Tracker - (dictionary.new text.hash)) + (dictionary.empty text.hash)) files))) (def: (poll_files fs directory) @@ -185,7 +185,7 @@ (def: #export (polling fs) (-> (//.System Async) (Watcher Async)) (let [tracker (: (Var Directory_Tracker) - (stm.var (dictionary.new text.hash)))] + (stm.var (dictionary.empty text.hash)))] (implementation (def: (start new_concern path) (do {! async.monad} @@ -411,7 +411,7 @@ [watcher (java/nio/file/FileSystem::newWatchService (java/nio/file/FileSystems::getDefault)) #let [tracker (stm.var (: (Dictionary //.Path [Concern java/nio/file/WatchKey]) - (dictionary.new text.hash))) + (dictionary.empty text.hash))) stop (: (-> //.Path (Async (Try Concern))) (function (_ path) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 8c4614a32..4f389ce78 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -112,8 +112,8 @@ (def: safe_common_command (-> Replacer (Sanitizer Command)) - (let [x0A (text.of_code (hex "0A")) - xFF (text.of_code (hex "FF"))] + (let [x0A (text.of_char (hex "0A")) + xFF (text.of_char (hex "FF"))] (function (_ replacer) (|>> (..replace x0A replacer) (..replace xFF replacer) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 072e6e094..00791f787 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -174,7 +174,7 @@ #.None (dictionary.put identity [version dependency] uniques)))) (: (Dictionary [Group Name] [Version Dependency]) - (dictionary.new (product.hash text.hash text.hash)))) + (dictionary.empty (product.hash text.hash text.hash)))) dictionary.values (list\map (|>> product.right (..path fs home))))) diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index f793bfd1e..a48909375 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -148,7 +148,7 @@ (def: #export empty Resolution - (dictionary.new //.hash)) + (dictionary.empty //.hash)) (def: #export equivalence (Equivalence Resolution) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index f87fcfaae..c2c0849ac 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -65,7 +65,7 @@ (def: empty Aggregate - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: (on_maybe field value format aggregate) (All [a] diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 49384a986..b2e6ab0f9 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -197,12 +197,12 @@ ^repositories (: (Parser (Set //repository.Address)) (|> (..plural input "repositories" ..repository) (\ ! map (set.of_list text.hash)) - (<>.else (set.new text.hash)) + (<>.else (set.empty text.hash)) (\ ! map (set.add /.default_repository)))) ^dependencies (: (Parser (Set //dependency.Dependency)) (|> (..plural input "dependencies" ..dependency) (\ ! map (set.of_list //dependency.hash)) - (<>.else (set.new //dependency.hash)))) + (<>.else (set.empty //dependency.hash)))) ^compiler (|> ..dependency (..singular input "compiler") (<>.else /.default_compiler)) diff --git a/stdlib/source/program/aedifex/profile.lux b/stdlib/source/program/aedifex/profile.lux index 4953032a8..fc9ae2d42 100644 --- a/stdlib/source/program/aedifex/profile.lux +++ b/stdlib/source/program/aedifex/profile.lux @@ -214,14 +214,14 @@ {#parents (list) #identity #.None #info #.None - #repositories (set.new text.hash) - #dependencies (set.new dependency.hash) + #repositories (set.empty text.hash) + #dependencies (set.empty dependency.hash) #compiler default_compiler - #sources (set.new text.hash) + #sources (set.empty text.hash) #target ..default_target #program #.None #test #.None - #deploy_repositories (dictionary.new text.hash) + #deploy_repositories (dictionary.empty text.hash) #java runtime.default_java #js runtime.default_js #python runtime.default_python @@ -247,7 +247,7 @@ (get@ #target baseline)) #program (maybe\compose (get@ #program override) (get@ #program baseline)) #test (maybe\compose (get@ #test override) (get@ #test baseline)) - #deploy_repositories (dictionary.merge (get@ #deploy_repositories override) (get@ #deploy_repositories baseline)) + #deploy_repositories (dictionary.merged (get@ #deploy_repositories override) (get@ #deploy_repositories baseline)) #java (!runtime #java runtime.default_java) #js (!runtime #js runtime.default_js) #python (!runtime #python runtime.default_python) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 9d3574bd1..f8fb0334d 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -36,10 +36,10 @@ (Monoid Project) (def: identity - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: compose - (dictionary.merge_with (\ //.monoid compose)))) + (dictionary.merged_with (\ //.monoid compose)))) (exception: #export (unknown_profile {name Name}) (exception.report @@ -73,4 +73,4 @@ (def: #export (profile name project) (-> Name Project (Try Profile)) - (..profile' (set.new text.hash) project name)) + (..profile' (set.empty text.hash) project name)) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 5976c681a..6d19548fb 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -99,7 +99,7 @@ [] (loop [pending host_dependencies output (: (Dictionary file.Path Binary) - (dictionary.new text.hash))] + (dictionary.empty text.hash))] (case pending #.End (in output) diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux index 1e9145bdb..eec954cd5 100644 --- a/stdlib/source/program/compositor/import.lux +++ b/stdlib/source/program/compositor/import.lux @@ -72,5 +72,5 @@ (monad.fold (: (Monad Action) (try.with async.monad)) (..import_library system) - (dictionary.new text.hash) + (dictionary.empty text.hash) libraries)) diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index a440042c4..da76896eb 100644 --- a/stdlib/source/program/scriptum.lux +++ b/stdlib/source/program/scriptum.lux @@ -43,7 +43,7 @@ (-> Nat Text) (case (text.nth id ..name_options) (#.Some char) - (text.of_code char) + (text.of_char char) #.None (format (parameter_type_name (n./ name_options_count id)) @@ -119,7 +119,7 @@ (let [members (type.flat_variant type)] (case tags #.End - (format "(| " + (format "(Or " (|> members (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) @@ -218,7 +218,7 @@ (#.Sum _) (let [members (type.flat_variant type)] - (format "(| " (|> members (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) + (format "(Or " (|> members (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Product _) (let [members (type.flat_tuple type)] diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 3ca5440bf..117aab697 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -154,9 +154,9 @@ _list_ (: (-> (List Synthesis) Synthesis) (list\fold _item_ _end_))] (let [__tuple__ (: (-> (List Synthesis) Synthesis) - (|>> list.reverse _list_ [9 #0] synthesis.variant _code_)) + (|>> list.reversed _list_ [9 #0] synthesis.variant _code_)) __form__ (: (-> (List Synthesis) Synthesis) - (|>> list.reverse _list_ [8 #0] synthesis.variant _code_)) + (|>> list.reversed _list_ [8 #0] synthesis.variant _code_)) __text__ (: (-> Text Synthesis) (function (_ value) (_code_ (synthesis.variant [5 #0 (synthesis.text value)])))) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 4b7fcc885..614420fde 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -88,7 +88,7 @@ (do ! [pom (random.one (function (_ [identity profile pom]) (|> profile - (set@ #//.dependencies (set.new //dependency.hash)) + (set@ #//.dependencies (set.empty //dependency.hash)) (set@ #//.identity (#.Some (get@ #//dependency.artifact dependency))) //pom.write try.to_maybe)) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index e62e7b2e4..9c575ff53 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -153,7 +153,7 @@ (do {! random.monad} [[dependency expected_artifact package] ..bundle #let [cache (: Cache - (atom.atom (dictionary.new text.hash))) + (atom.atom (dictionary.empty text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] (in (do async.monad @@ -176,7 +176,7 @@ resolution.empty bundles) cache (: Cache - (atom.atom (dictionary.new text.hash))) + (atom.atom (dictionary.empty text.hash))) http (..http cache) repository (repository.async (remote.repository http #.None address))]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index a926db9a7..88efb42fe 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -55,7 +55,7 @@ (def: #export empty Store - (dictionary.new text.hash)) + (dictionary.empty text.hash)) (def: valid_version Version diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 793fd23b3..63d468945 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -423,22 +423,24 @@ (#.Right [lux (list)])))] (do random.monad [expected random.nat] - ($_ _.and - (_.cover [/.Macro'] - (|> macro - (: /.Macro') - (is? macro))) - (_.cover [/.Macro] - (|> macro - "lux macro" - (: /.Macro) - (: Any) - (is? (: Any macro)))) - (_.cover [/.macro:] - (is? expected (..identity_macro expected))) - (_.cover [/.Source] - (..found_crosshair?)) - )))) + (with_expansions [<found_crosshair?> (for {@.old (~~ (as_is))} + (_.cover [/.Source] + (..found_crosshair?)))] + (`` ($_ _.and + (_.cover [/.Macro'] + (|> macro + (: /.Macro') + (is? macro))) + (_.cover [/.Macro] + (|> macro + "lux macro" + (: /.Macro) + (: Any) + (is? (: Any macro)))) + (_.cover [/.macro:] + (is? expected (..identity_macro expected))) + <found_crosshair?> + )))))) (/.type: for_type/variant #Case/0 @@ -484,7 +486,7 @@ (_.cover [/.:let] (let [[actual_left actual_right] (: (/.:let [side /.Nat] - (& side side)) + [side side]) [expected_left expected_right])] (and (is? expected_left actual_left) (is? expected_right actual_right)))) @@ -506,7 +508,7 @@ _ false) - (case (/.type (| expected/0 expected/1)) + (case (/.type (/.Or expected/0 expected/1)) (#.Sum actual/0 actual/1) (and (is? expected/0 actual/0) (is? expected/1 actual/1)) @@ -626,7 +628,7 @@ _ false)) (_.cover [/.char] (|> (`` (/.char (~~ (/.static static_char)))) - text.of_code + text.of_char (text\= static_char))) ))) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index b389a9c8b..6284381d7 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -35,7 +35,7 @@ expected_end? (|> range list.last (maybe\map (n.= end)) (maybe.else false)) can_be_backwards? (\ (list.equivalence n.equivalence) = (/.range n.enum start end) - (list.reverse (/.range n.enum end start))) + (list.reversed (/.range n.enum end start))) every_element_is_a_successor? (case range (#.Item head tail) (|> (list\fold (function (_ next [verdict prev]) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index 67824f3f3..dbdeee0f6 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -81,7 +81,7 @@ (io.run (do io.monad [#let [none (/.none n.hash ..fibonacci) - memory (dictionary.new n.hash) + memory (dictionary.empty n.hash) open (/.open fibonacci)] [none_time none_output] (..time none input) [open_time [memory open_output]] (..time open [memory input]) @@ -114,7 +114,7 @@ (list\map inc) (list\fold n.* 1)) actual (|> (memo input) - (state.run (dictionary.new n.hash)) + (state.run (dictionary.empty n.hash)) product.right)] (n.= expected actual))) ))) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index b3031cc26..c8fa56388 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -75,10 +75,10 @@ [offset (\ ! map (n.% 50) random.nat) range (\ ! map (|>> (n.% 50) (n.+ 10)) random.nat) #let [limit (n.+ offset range)] - expected (\ ! map (|>> (n.% range) (n.+ offset) text.of_code) random.nat) + expected (\ ! map (|>> (n.% range) (n.+ offset) text.of_char) random.nat) out_of_range (case offset - 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.of_code) random.nat) - _ (\ ! map (|>> (n.% offset) text.of_code) random.nat))] + 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.of_char) random.nat) + _ (\ ! map (|>> (n.% offset) text.of_char) random.nat))] (_.cover [/.range] (and (..should_pass expected (/.range offset limit)) (..should_fail out_of_range (/.range offset limit))))) @@ -87,33 +87,33 @@ invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) (random.char unicode.character))] (_.cover [/.upper] - (and (..should_pass (text.of_code expected) /.upper) - (..should_fail (text.of_code invalid) /.upper)))) + (and (..should_pass (text.of_char expected) /.upper) + (..should_fail (text.of_char invalid) /.upper)))) (do {! random.monad} [expected (random.char unicode.ascii/lower) invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) (random.char unicode.character))] (_.cover [/.lower] - (and (..should_pass (text.of_code expected) /.lower) - (..should_fail (text.of_code invalid) /.lower)))) + (and (..should_pass (text.of_char expected) /.lower) + (..should_fail (text.of_char invalid) /.lower)))) (do {! random.monad} [expected (\ ! map (n.% 10) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.decimal] (and (..should_pass (\ n.decimal encode expected) /.decimal) - (..should_fail (text.of_code invalid) /.decimal)))) + (..should_fail (text.of_char invalid) /.decimal)))) (do {! random.monad} [expected (\ ! map (n.% 8) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.octal] (and (..should_pass (\ n.octal encode expected) /.octal) - (..should_fail (text.of_code invalid) /.octal)))) + (..should_fail (text.of_char invalid) /.octal)))) (do {! random.monad} [expected (\ ! map (n.% 16) random.nat) invalid (random.char (unicode.set [unicode/block.number_forms (list)]))] (_.cover [/.hexadecimal] (and (..should_pass (\ n.hex encode expected) /.hexadecimal) - (..should_fail (text.of_code invalid) /.hexadecimal)))) + (..should_fail (text.of_char invalid) /.hexadecimal)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha) invalid (random.only (function (_ char) @@ -121,8 +121,8 @@ (unicode/block.within? unicode/block.basic_latin/lower char)))) (random.char unicode.character))] (_.cover [/.alpha] - (and (..should_pass (text.of_code expected) /.alpha) - (..should_fail (text.of_code invalid) /.alpha)))) + (and (..should_pass (text.of_char expected) /.alpha) + (..should_fail (text.of_char invalid) /.alpha)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha_num) invalid (random.only (function (_ char) @@ -131,8 +131,8 @@ (unicode/block.within? unicode/block.basic_latin/decimal char)))) (random.char unicode.character))] (_.cover [/.alpha_num] - (and (..should_pass (text.of_code expected) /.alpha_num) - (..should_fail (text.of_code invalid) /.alpha_num)))) + (and (..should_pass (text.of_char expected) /.alpha_num) + (..should_fail (text.of_char invalid) /.alpha_num)))) (do {! random.monad} [expected ($_ random.either (in text.tab) @@ -156,7 +156,7 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.of_code) + (list\map text.of_char) (text.join_with "")))) expected (\ ! map (function (_ value) (|> options @@ -164,17 +164,17 @@ maybe.assume)) random.nat) invalid (random.only (function (_ char) - (not (text.contains? (text.of_code char) options))) + (not (text.contains? (text.of_char char) options))) (random.char unicode.character))] (_.cover [/.one_of /.one_of! /.character_should_be] - (and (..should_pass (text.of_code expected) (/.one_of options)) - (..should_fail (text.of_code invalid) (/.one_of options)) - (..should_fail' (text.of_code invalid) (/.one_of options) + (and (..should_pass (text.of_char expected) (/.one_of options)) + (..should_fail (text.of_char invalid) (/.one_of options)) + (..should_fail' (text.of_char invalid) (/.one_of options) /.character_should_be) - (..should_pass! (text.of_code expected) (/.one_of! options)) - (..should_fail (text.of_code invalid) (/.one_of! options)) - (..should_fail' (text.of_code invalid) (/.one_of! options) + (..should_pass! (text.of_char expected) (/.one_of! options)) + (..should_fail (text.of_char invalid) (/.one_of! options)) + (..should_fail' (text.of_char invalid) (/.one_of! options) /.character_should_be) ))) (do {! random.monad} @@ -182,7 +182,7 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.of_code) + (list\map text.of_char) (text.join_with "")))) invalid (\ ! map (function (_ value) (|> options @@ -190,17 +190,17 @@ maybe.assume)) random.nat) expected (random.only (function (_ char) - (not (text.contains? (text.of_code char) options))) + (not (text.contains? (text.of_char char) options))) (random.char unicode.character))] (_.cover [/.none_of /.none_of! /.character_should_not_be] - (and (..should_pass (text.of_code expected) (/.none_of options)) - (..should_fail (text.of_code invalid) (/.none_of options)) - (..should_fail' (text.of_code invalid) (/.none_of options) + (and (..should_pass (text.of_char expected) (/.none_of options)) + (..should_fail (text.of_char invalid) (/.none_of options)) + (..should_fail' (text.of_char invalid) (/.none_of options) /.character_should_not_be) - (..should_pass! (text.of_code expected) (/.none_of! options)) - (..should_fail (text.of_code invalid) (/.none_of! options)) - (..should_fail' (text.of_code invalid) (/.none_of! options) + (..should_pass! (text.of_char expected) (/.none_of! options)) + (..should_fail (text.of_char invalid) (/.none_of! options)) + (..should_fail' (text.of_char invalid) (/.none_of! options) /.character_should_not_be) ))) )) @@ -402,13 +402,13 @@ (random.char unicode.character)) #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] (_.cover [/.not /.not! /.expected_to_fail] - (and (..should_pass (text.of_code expected) (/.not /.upper)) + (and (..should_pass (text.of_char expected) (/.not /.upper)) (|> invalid (/.run (/.not /.upper)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error)))) - (..should_pass! (text.of_code expected) (/.not! upper!)) + (..should_pass! (text.of_char expected) (/.not! upper!)) (|> invalid (/.run (/.not! upper!)) (!expect (^multi (#try.Failure error) @@ -424,12 +424,12 @@ lower! (/.one_of! "abcdefghijklmnopqrstuvwxyz")]] (_.cover [/.and /.and!] (and (..should_pass (format upper lower) (/.and /.upper /.lower)) - (..should_fail (format (text.of_code invalid) lower) (/.and /.upper /.lower)) - (..should_fail (format upper (text.of_code invalid)) (/.and /.upper /.lower)) + (..should_fail (format (text.of_char invalid) lower) (/.and /.upper /.lower)) + (..should_fail (format upper (text.of_char invalid)) (/.and /.upper /.lower)) (..should_pass! (format upper lower) (/.and! upper! lower!)) - (..should_fail (format (text.of_code invalid) lower) (/.and! upper! lower!)) - (..should_fail (format upper (text.of_code invalid)) (/.and! upper! lower!))))) + (..should_fail (format (text.of_char invalid) lower) (/.and! upper! lower!)) + (..should_fail (format upper (text.of_char invalid)) (/.and! upper! lower!))))) (do {! random.monad} [expected (random.unicode 1) invalid (random.unicode 1)] diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index a6e7e7c2e..966da9edd 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -80,17 +80,17 @@ [actual /.tag _ /.ignore] (in (name\= expected actual))) - (list (#xml.Node expected (dictionary.new name.hash) (list)))) + (list (#xml.Node expected (dictionary.empty name.hash) (list)))) (!expect (#try.Success #1))))) (do {! random.monad} [expected ..random_tag] (_.cover [/.node] (|> (/.run (/.node expected (//\in [])) - (list (#xml.Node expected (dictionary.new name.hash) (list)))) + (list (#xml.Node expected (dictionary.empty name.hash) (list)))) (!expect (#try.Success []))))) (!failure /.wrong_tag [[(/.node ["" expected] (//\in [])) - (#xml.Node [expected ""] (dictionary.new name.hash) (list))]]) + (#xml.Node [expected ""] (dictionary.empty name.hash) (list))]]) (do {! random.monad} [expected_tag ..random_tag expected_attribute ..random_attribute @@ -100,14 +100,14 @@ (//.after (/.attribute expected_attribute)) (//\in [])) (list (#xml.Node expected_tag - (|> (dictionary.new name.hash) + (|> (dictionary.empty name.hash) (dictionary.put expected_attribute expected_value)) (list)))) (!expect (#try.Success []))))) (!failure /.unknown_attribute [[(/.attribute ["" expected]) (#xml.Node [expected expected] - (|> (dictionary.new name.hash) + (|> (dictionary.empty name.hash) (dictionary.put [expected ""] expected)) (list))]]) (!failure /.empty_input @@ -124,19 +124,19 @@ (/.node [expected expected] (//\in []))) (#xml.Node [expected expected] - (dictionary.new name.hash) + (dictionary.empty name.hash) (list))] [(do //.monad [_ /.ignore] (/.node [expected expected] (/.attribute [expected expected]))) (#xml.Node [expected expected] - (|> (dictionary.new name.hash) + (|> (dictionary.empty name.hash) (dictionary.put [expected expected] expected)) (list))]]) (!failure /.unexpected_input [[/.text - (#xml.Node [expected expected] (dictionary.new name.hash) (list))] + (#xml.Node [expected expected] (dictionary.empty name.hash) (list))] [(/.node [expected expected] (//\in [])) (#xml.Text expected)] @@ -146,7 +146,7 @@ (do {! random.monad} [#let [node (: (-> xml.Tag (List xml.XML) xml.XML) (function (_ tag children) - (#xml.Node tag (dictionary.new name.hash) children)))] + (#xml.Node tag (dictionary.empty name.hash) children)))] parent ..random_tag right ..random_tag wrong (random.only (|>> (name\= right) not) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 638668ec5..2d1a25092 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -137,7 +137,7 @@ (_.cover [/.drop] (and (\ /.equivalence = sample (/.drop 0 sample)) (\ /.equivalence = (/.create 0) (/.drop size sample)) - (case (list.reverse (..as_list sample)) + (case (list.reversed (..as_list sample)) #.End false diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index 29f0c733a..d5ea9badf 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -103,9 +103,9 @@ ..structures ..search - (_.cover [/.new /.size] + (_.cover [/.empty /.size] (n.= size (/.size (: (Array Nat) - (/.new size))))) + (/.empty size))))) (_.cover [/.type_name] (case /.Array (^ (#.Named _ (#.UnivQ _ (#.Primitive nominal_type (list (#.Parameter 1)))))) @@ -114,7 +114,7 @@ _ false)) (_.cover [/.read /.write!] - (let [the_array (|> (/.new 2) + (let [the_array (|> (/.empty 2) (: (Array Nat)) (/.write! 0 expected))] (case [(/.read 0 the_array) @@ -125,7 +125,7 @@ _ false))) (_.cover [/.delete!] - (let [the_array (|> (/.new 1) + (let [the_array (|> (/.empty 1) (: (Array Nat)) (/.write! 0 expected))] (case [(/.read 0 the_array) @@ -136,14 +136,14 @@ _ false))) (_.cover [/.contains?] - (let [the_array (|> (/.new 2) + (let [the_array (|> (/.empty 2) (: (Array Nat)) (/.write! 0 expected))] (and (/.contains? 0 the_array) (not (/.contains? 1 the_array))))) (_.cover [/.update!] - (let [the_array (|> (/.new 1) + (let [the_array (|> (/.empty 1) (: (Array Nat)) (/.write! 0 base) (/.update! 0 (n.+ shift)))] @@ -154,7 +154,7 @@ _ false))) (_.cover [/.upsert!] - (let [the_array (|> (/.new 2) + (let [the_array (|> (/.empty 2) (: (Array Nat)) (/.write! 0 base) (/.upsert! 0 dummy (n.+ shift)) @@ -171,7 +171,7 @@ [occupancy (\ ! map (n.% (inc size)) random.nat)] (_.cover [/.occupancy /.vacancy] (let [the_array (loop [output (: (Array Nat) - (/.new size)) + (/.empty size)) idx 0] (if (n.< occupancy idx) (recur (/.write! idx expected output) @@ -191,7 +191,7 @@ [amount (\ ! map (n.% (inc size)) random.nat)] (_.cover [/.copy!] (let [copy (: (Array Nat) - (/.new size))] + (/.empty size))] (exec (/.copy! amount 0 the_array 0 copy) (\ (list.equivalence n.equivalence) = (list.take amount (/.to_list the_array)) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 2cec43439..11c4b59cd 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -47,8 +47,8 @@ 0 (/.empty? dict) _ (not (/.empty? dict)))) - (_.cover [/.new] - (let [sample (/.new n.hash)] + (_.cover [/.empty] + (let [sample (/.empty n.hash)] (and (n.= 0 (/.size sample)) (/.empty? sample)))) @@ -60,7 +60,7 @@ (def: (hash _) constant)))]] (_.cover [/.key_hash] - (is? hash (/.key_hash (/.new hash))))) + (is? hash (/.key_hash (/.empty hash))))) (_.cover [/.entries] (let [entries (/.entries dict) @@ -108,21 +108,21 @@ (n.= (/.size dict) (list.size (/.values dict)))) - (_.cover [/.merge] + (_.cover [/.merged] (let [merging_with_oneself (let [(^open ".") (/.equivalence n.equivalence)] - (= dict (/.merge dict dict))) + (= dict (/.merged dict dict))) overwritting_keys (let [dict' (|> dict /.entries (list\map (function (_ [k v]) [k (inc v)])) (/.of_list n.hash)) (^open ".") (/.equivalence n.equivalence)] - (= dict' (/.merge dict' dict)))] + (= dict' (/.merged dict' dict)))] (and merging_with_oneself overwritting_keys))) - (_.cover [/.merge_with] + (_.cover [/.merged_with] (list.every? (function (_ [x x*2]) (n.= (n.* 2 x) x*2)) (list.zipped/2 (/.values dict) - (/.values (/.merge_with n.+ dict dict))))) + (/.values (/.merged_with n.+ dict dict))))) (_.cover [/.of_list] (let [(^open ".") (/.equivalence n.equivalence)] @@ -230,10 +230,10 @@ (and can_upsert_new_key! can_upsert_old_key!))) - (_.cover [/.select] + (_.cover [/.sub] (|> dict (/.put non_key test_val) - (/.select (list non_key)) + (/.sub (list non_key)) /.size (n.= 1))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 8302cdf38..4637d3058 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -27,7 +27,7 @@ (-> (Order k) (Random k) (Random v) Nat (Random (/.Dictionary k v)))) (case size 0 - (random\in (/.new order)) + (random\in (/.empty order)) _ (do random.monad @@ -70,8 +70,8 @@ (_.cover [/.empty?] (bit\= (n.= 0 (/.size sample)) (/.empty? sample))) - (_.cover [/.new] - (/.empty? (/.new n.order))) + (_.cover [/.empty] + (/.empty? (/.empty n.order))) (_.cover [/.min] (case [(/.min sample) (list.head sorted_values)] [#.None #.None] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index a2fc3911d..872c21e2d 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -98,15 +98,15 @@ (n.= 0 (/.size sample)))) (_.cover [/.repeat] (n.= size (/.size (/.repeat size [])))) - (_.cover [/.reverse] + (_.cover [/.reversed] (or (n.< 2 (/.size sample)) (let [not_same! (not (/\= sample - (/.reverse sample))) + (/.reversed sample))) self_symmetry! (/\= sample - (/.reverse (/.reverse sample)))] + (/.reversed (/.reversed sample)))] (and not_same! self_symmetry!)))) (_.cover [/.every? /.any?] @@ -122,7 +122,7 @@ symmetry! (/\= (/.sort <<< sample) - (/.reverse (/.sort (function.flip <<<) sample)))] + (/.reversed (/.sort (function.flip <<<) sample)))] (and size_preservation! symmetry!))) ))) @@ -259,7 +259,7 @@ )] [/.head /.tail |>] - [/.last /.inits /.reverse] + [/.last /.inits /.reversed] )) ))))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 3ac6e8965..902fec0d8 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -61,15 +61,15 @@ (/.empty? /.empty)) (_.cover [/.to_list /.of_list] (|> sample /.to_list /.of_list (/\= sample))) - (_.cover [/.reverse] + (_.cover [/.reversed] (or (n.< 2 (/.size sample)) (let [not_same! (not (/\= sample - (/.reverse sample))) + (/.reversed sample))) self_symmetry! (/\= sample - (/.reverse (/.reverse sample)))] + (/.reversed (/.reversed sample)))] (and not_same! self_symmetry!)))) (_.cover [/.every? /.any?] diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 64556ed63..d092dcf6f 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -49,8 +49,8 @@ non_memberL (random.only (|>> (/.member? setL) not) random.nat)] ($_ _.and - (_.cover [/.new] - (/.empty? (/.new n.hash))) + (_.cover [/.empty] + (/.empty? (/.empty n.hash))) (do ! [hash (\ ! map (function (_ constant) (: (Hash Nat) @@ -61,7 +61,7 @@ constant)))) random.nat)] (_.cover [/.member_hash] - (is? hash (/.member_hash (/.new hash))))) + (is? hash (/.member_hash (/.empty hash))))) (_.cover [/.size] (n.= sizeL (/.size setL))) (_.cover [/.empty?] @@ -106,7 +106,7 @@ union_with_empty_set! (|> setL - (/.union (/.new n.hash)) + (/.union (/.empty n.hash)) (\= setL))] (and sets_are_subs_of_their_unions! union_with_empty_set!))) @@ -119,7 +119,7 @@ intersection_with_empty_set! (|> setL - (/.intersection (/.new n.hash)) + (/.intersection (/.empty n.hash)) /.empty?)] (and sets_are_supers_of_their_intersections! intersection_with_empty_set!))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 197f35e93..7f23bfe3d 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -32,7 +32,7 @@ element_counts (random.list size ..count)] (in (list\fold (function (_ [count element] set) (/.add count element set)) - (/.new hash) + (/.empty hash) (list.zipped/2 element_counts (set.to_list elements)))))) @@ -46,7 +46,7 @@ (_.for [/.hash] (|> random.nat (\ random.monad map (function (_ single) - (/.add 1 single (/.new n.hash)))) + (/.add 1 single (/.empty n.hash)))) ($hash.spec /.hash))) ))) @@ -132,8 +132,8 @@ (_.cover [/.empty?] (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) - (_.cover [/.new] - (/.empty? (/.new n.hash))) + (_.cover [/.empty] + (/.empty? (/.empty n.hash))) (_.cover [/.support] (list.every? (set.member? (/.support sample)) (/.to_list sample))) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 0614a1938..89ce681b0 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -27,7 +27,7 @@ (All [a] (-> Nat (Order a) (Random a) (Random (Set a)))) (case size 0 - (random\in (/.new &order)) + (random\in (/.empty &order)) _ (do random.monad @@ -51,7 +51,7 @@ #let [(^open "/\.") /.equivalence setL (/.of_list n.order listL) setR (/.of_list n.order listR) - empty (/.new n.order)]] + empty (/.empty n.order)]] (`` ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence (..random sizeL n.order random.nat))) @@ -61,8 +61,8 @@ (_.cover [/.empty?] (bit\= (n.= 0 (/.size setL)) (/.empty? setL))) - (_.cover [/.new] - (/.empty? (/.new n.order))) + (_.cover [/.empty] + (/.empty? (/.empty n.order))) (_.cover [/.to_list] (\ (list.equivalence n.equivalence) = (/.to_list (/.of_list n.order listL)) diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index c118a98ad..81c45a8e2 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -106,17 +106,17 @@ (distance/3 (/.darker ratio colorful) /.black)) (f.<= (distance/3 colorful /.white) (distance/3 (/.brighter ratio colorful) /.white)))) - (_.cover [/.interpolate] + (_.cover [/.interpolated] (and (f.<= (distance/3 colorful /.black) - (distance/3 (/.interpolate ratio /.black colorful) /.black)) + (distance/3 (/.interpolated ratio /.black colorful) /.black)) (f.<= (distance/3 colorful /.white) - (distance/3 (/.interpolate ratio /.white colorful) /.white)))) - (_.cover [/.saturate] + (distance/3 (/.interpolated ratio /.white colorful) /.white)))) + (_.cover [/.saturated] (f.> (saturation mediocre) - (saturation (/.saturate ratio mediocre)))) - (_.cover [/.de_saturate] + (saturation (/.saturated ratio mediocre)))) + (_.cover [/.un_saturated] (f.< (saturation mediocre) - (saturation (/.de_saturate ratio mediocre)))) + (saturation (/.un_saturated ratio mediocre)))) (_.cover [/.gray_scale] (let [gray'ed (/.gray_scale mediocre)] (and (f.= +0.0 diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux index 867d8bb84..2f781972d 100644 --- a/stdlib/source/test/lux/data/product.lux +++ b/stdlib/source/test/lux/data/product.lux @@ -17,7 +17,7 @@ (def: #export test Test (<| (_.covering /._) - (_.for [.&]) + (_.for [.Tuple .And]) (do random.monad [expected random.nat shift random.nat diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 05a2746f7..73765d85f 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -23,7 +23,7 @@ (def: #export test Test (<| (_.covering /._) - (_.for [.|]) + (_.for [.Variant .Or]) (do {! random.monad} [expected random.nat shift random.nat] @@ -43,30 +43,30 @@ (_.cover [/.left] (|> (/.left expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (case> (0 #0 actual) (n.= expected actual) _ false))) (_.cover [/.right] (|> (/.right expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (case> (0 #1 actual) (n.= expected actual) _ false))) (_.cover [/.either] (and (|> (/.left expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.either (n.+ shift) (n.- shift)) (n.= (n.+ shift expected))) (|> (/.right expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.either (n.+ shift) (n.- shift)) (n.= (n.- shift expected))))) (_.cover [/.apply] (and (|> (/.left expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.apply (n.+ shift) (n.- shift)) (case> (0 #0 actual) (n.= (n.+ shift expected) actual) _ false)) (|> (/.right expected) - (: (| Nat Nat)) + (: (Or Nat Nat)) (/.apply (n.+ shift) (n.- shift)) (case> (0 #1 actual) (n.= (n.- shift expected) actual) _ false)))) (do ! @@ -74,7 +74,7 @@ expected (random.list size random.nat)] ($_ _.and (_.cover [/.lefts] - (let [actual (: (List (| Nat Nat)) + (let [actual (: (List (Or Nat Nat)) (list\map /.left expected))] (and (\ (list.equivalence n.equivalence) = expected @@ -83,7 +83,7 @@ (list) (/.rights actual))))) (_.cover [/.rights] - (let [actual (: (List (| Nat Nat)) + (let [actual (: (List (Or Nat Nat)) (list\map /.right expected))] (and (\ (list.equivalence n.equivalence) = expected @@ -97,7 +97,7 @@ (if (n.even? value) (/.left value) (/.right value)))) - (: (List (| Nat Nat))) + (: (List (Or Nat Nat))) /.partition)] (and (\ (list.equivalence n.equivalence) = (list.only n.even? expected) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index e1f9c1e4f..82a364120 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -98,20 +98,20 @@ (n.= 1)))) (_.cover [/.index_of'] (let [full (\ /.monoid compose inner outer)] - (and (|> (/.index_of' inner 0 full) + (and (|> (/.index_of' 0 inner full) (maybe.else fake_index) (n.= 0)) - (|> (/.index_of' inner 1 full) + (|> (/.index_of' 1 inner full) (maybe.else fake_index) (n.= fake_index)) - (|> (/.index_of' outer 0 full) + (|> (/.index_of' 0 outer full) (maybe.else fake_index) (n.= 1)) - (|> (/.index_of' outer 1 full) + (|> (/.index_of' 1 outer full) (maybe.else fake_index) (n.= 1)) - (|> (/.index_of' outer 2 full) + (|> (/.index_of' 2 outer full) (maybe.else fake_index) (n.= fake_index))))) (_.cover [/.last_index_of] @@ -124,20 +124,20 @@ (n.= 2))))) (_.cover [/.last_index_of'] (let [full ($_ (\ /.monoid compose) outer inner outer)] - (and (|> (/.last_index_of' inner 0 full) + (and (|> (/.last_index_of' 0 inner full) (maybe.else fake_index) (n.= 1)) - (|> (/.last_index_of' inner 2 full) + (|> (/.last_index_of' 2 inner full) (maybe.else fake_index) (n.= fake_index)) - (|> (/.last_index_of' outer 0 full) + (|> (/.last_index_of' 0 outer full) (maybe.else fake_index) (n.= 2)) - (|> (/.last_index_of' outer 2 full) + (|> (/.last_index_of' 2 outer full) (maybe.else fake_index) (n.= 2)) - (|> (/.last_index_of' outer 3 full) + (|> (/.last_index_of' 3 outer full) (maybe.else fake_index) (n.= fake_index))))) ))) @@ -145,7 +145,7 @@ (def: char Test ($_ _.and - (_.for [/.Char /.of_code] + (_.for [/.Char /.of_char] (`` ($_ _.and (~~ (template [<short> <long>] [(_.cover [<short> <long>] @@ -171,7 +171,7 @@ (_.cover [/.nth] (case (/.nth expected sample) (#.Some char) - (case (/.index_of (/.of_code char) sample) + (case (/.index_of (/.of_char char) sample) (#.Some actual) (n.= expected actual) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 11a68ea33..f5670b35f 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -195,7 +195,7 @@ (def: unique_encodings (list\fold (function (_ encoding set) (set.add (/.name encoding) set)) - (set.new text.hash) + (set.empty text.hash) ..all_encodings)) (def: verdict diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 73f9455d7..6899c6f62 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -100,7 +100,7 @@ [left (random.char unicode.character) right (random.char unicode.character)] (_.cover [/.escape /.un_escape] - (let [expected (format (text.of_code left) (text.of_code right))] + (let [expected (format (text.of_char left) (text.of_char right))] (if (or (/.escapable? left) (/.escapable? right)) (let [escaped (/.escape expected)] @@ -114,7 +114,7 @@ (text\= expected (/.escape expected)))))) (do {! random.monad} [dummy (|> (random.char unicode.character) - (\ ! map text.of_code))] + (\ ! map text.of_char))] (_.cover [/.dangling_escape] (case (/.un_escape (format (/.escape dummy) "\")) (#try.Success _) @@ -125,7 +125,7 @@ (do {! random.monad} [dummy (|> (random.char unicode.character) (random.only (|>> (set.member? ..valid_sigils) not)) - (\ ! map text.of_code))] + (\ ! map text.of_char))] (_.cover [/.invalid_escape] (case (/.un_escape (format "\" dummy)) (#try.Success _) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index ea81e2c77..95f82e502 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -132,9 +132,9 @@ (should_fail (/.regex "\p{Blank}") "."))) (_.test "ASCII." (and (should_pass (/.regex "\p{ASCII}") text.tab) - (should_fail (/.regex "\p{ASCII}") (text.of_code (hex "1234"))))) + (should_fail (/.regex "\p{ASCII}") (text.of_char (hex "1234"))))) (_.test "Control characters." - (and (should_pass (/.regex "\p{Contrl}") (text.of_code (hex "12"))) + (and (should_pass (/.regex "\p{Contrl}") (text.of_char (hex "12"))) (should_fail (/.regex "\p{Contrl}") "a"))) (_.test "Punctuation." (and (should_pass (/.regex "\p{Punct}") "@") @@ -143,8 +143,8 @@ (and (should_pass (/.regex "\p{Graph}") "@") (should_fail (/.regex "\p{Graph}") " "))) (_.test "Print." - (and (should_pass (/.regex "\p{Print}") (text.of_code (hex "20"))) - (should_fail (/.regex "\p{Print}") (text.of_code (hex "1234"))))) + (and (should_pass (/.regex "\p{Print}") (text.of_char (hex "20"))) + (should_fail (/.regex "\p{Print}") (text.of_char (hex "1234"))))) )) (def: custom_character_classes diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 9089e080f..a0900230d 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -87,8 +87,8 @@ false) ## TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants ## (~~ (template [<lefts> <right?> <value> <format>] - ## [(|> (/.representation (type (| Bit Int Frac)) - ## (: (| Bit Int Frac) + ## [(|> (/.representation (type (Or Bit Int Frac)) + ## (: (Or Bit Int Frac) ## (<lefts> <right?> <value>))) ## (try\map (text\= (format "(" (%.nat <lefts>) ## " " (%.bit <right?>) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 96da12763..e2d7e4f4d 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -12,12 +12,14 @@ ["." exception]] [data ["." bit ("#\." equivalence)] - ["." text ("#\." equivalence)] + ["." text ("#\." equivalence) + ["%" format (#+ format)]] [collection ["." array (#+ Array)]]] ["." macro [syntax (#+ syntax:)] - ["." code]] + ["." code] + ["." template]] [math ["." random (#+ Random)] [number @@ -119,7 +121,7 @@ (i.= (:as Int value)))) (_.cover [/.cannot_convert_to_jvm_type] (let [array (:as (Array Nothing) - (array.new 1))] + (array.empty 1))] (|> array /.array_length ..macro_error @@ -571,6 +573,35 @@ example/9!) ))) +(syntax: (expands? expression) + (function (_ lux) + (|> (macro.single_expansion expression) + (meta.run lux) + (case> (#try.Success expansion) + true + + (#try.Failure error) + false) + code.bit + list + [lux] + #try.Success))) + +(def: for_exception + Test + ($_ _.and + (_.cover [/.class_names_cannot_contain_periods] + (with_expansions [<class> (template.identifier ["java.lang.Float"])] + (not (expands? (/.import: <class>))))) + (_.cover [/.class_name_cannot_be_a_type_variable] + (and (not (expands? (/.import: (java/lang/Double a) + ["#::." + (invalid [] (a java/lang/String))]))) + (not (expands? (/.import: java/lang/Double + ["#::." + ([a] invalid [] (a java/lang/String))]))))) + )) + (def: #export test (<| (_.covering /._) ($_ _.and @@ -579,4 +610,5 @@ ..for_miscellaneous ..for_interface ..for_class + ..for_exception ))) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 3bbae852f..ed2e8401d 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -190,13 +190,13 @@ (list\fold (function (_ bundle [amount set]) [(n.+ amount (get@ #amount bundle)) (set.union set (lens bundle))]) - [0 (set.new hash)] + [0 (set.empty hash)] territories)) (def: languages_test Test (|> ..languages - list.reverse + list.reversed (list\map (get@ #test)) (list\fold _.and (`` ($_ _.and diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 10619ea9f..a949e9bf0 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -145,13 +145,13 @@ (list\fold (function (_ bundle [amount set]) [(n.+ amount (get@ #amount bundle)) (set.union set (lens bundle))]) - [0 (set.new hash)] + [0 (set.empty hash)] territories)) (def: territories_test Test (|> ..territories - list.reverse + list.reversed (list\map (get@ #test)) (list\fold _.and (`` ($_ _.and diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index 6682c2375..c14525e7d 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- Variant) ["%" data/text/format (#+ format)] ["_" test (#+ Test)] [abstract diff --git a/stdlib/source/test/lux/macro/poly/json.lux b/stdlib/source/test/lux/macro/poly/json.lux index 4137ad271..d688dab2f 100644 --- a/stdlib/source/test/lux/macro/poly/json.lux +++ b/stdlib/source/test/lux/macro/poly/json.lux @@ -1,6 +1,6 @@ (.module: [library - [lux #* + [lux (#- Variant) ["_" test (#+ Test)] ["." debug] [abstract diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index d6f531613..4024003c9 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -247,14 +247,14 @@ inverse! nullity! futility!))) - (_.cover [/.reverse] - (and (|> pattern /.reverse /.reverse (\= pattern)) - (or (|> pattern /.reverse (\= pattern) not) + (_.cover [/.reversed] + (and (|> pattern /.reversed /.reversed (\= pattern)) + (or (|> pattern /.reversed (\= pattern) not) (let [high (/.and (hex "FFFFFFFF00000000") pattern) low (/.and (hex "00000000FFFFFFFF") pattern)] - (\= (/.reverse high) + (\= (/.reversed high) low))))) ..bit diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index 15c7f2215..c7b4cf98c 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -44,7 +44,7 @@ (let [outcome ((: (-> (List Text) (io.IO Any)) (..actual_program <program>)) inputs)] - (list\= (list.reverse inputs) + (list\= (list.reversed inputs) (:as (List Text) (io.run outcome))))) (with_expansions [<program> (/.program: [{all_arguments (<>.many <cli>.any)}] (io.io all_arguments))] diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index 0aba9b880..5f1f3a74b 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -45,13 +45,13 @@ expected random.duration parameter random.duration] ($_ _.and - (_.cover [/.merge /.difference] - (|> expected (/.merge parameter) (/.difference parameter) (\= expected))) + (_.cover [/.merged /.difference] + (|> expected (/.merged parameter) (/.difference parameter) (\= expected))) (_.cover [/.empty] - (|> expected (/.merge /.empty) (\= expected))) + (|> expected (/.merged /.empty) (\= expected))) (_.cover [/.inverse] (and (|> expected /.inverse /.inverse (\= expected)) - (|> expected (/.merge (/.inverse expected)) (\= /.empty)))) + (|> expected (/.merged (/.inverse expected)) (\= /.empty)))) (_.cover [/.positive? /.negative? /.neutral?] (or (bit\= (/.positive? expected) (/.negative? (/.inverse expected))) @@ -74,8 +74,8 @@ sample positive frame positive] (`` ($_ _.and - (_.cover [/.frame] - (let [sample' (/.frame frame sample)] + (_.cover [/.framed] + (let [sample' (/.framed frame sample)] (and (\< frame sample') (bit\= (\< frame sample) (\= sample sample'))))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index e24fac097..d9dab4854 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -139,7 +139,7 @@ (list\compose (list.repeat (inc lefts) (analysis.pattern/unit)) (list inner))))) (#analysis.Bind @member) - (list.reverse path)) + (list.reversed path)) @member]))) (def: get_test @@ -305,7 +305,7 @@ list.enumeration (list\map (function (_ [lefts' [value body]]) (path lefts' false value body))) - list.reverse)) + list.reversed)) [(branch 0 false value/first body/first) (list\compose (|> (list.zipped/2 value/mid body/mid) list.enumeration diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 4b9b9a9f3..dce97193e 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -60,7 +60,7 @@ (list (#variable.Local 1))) body))) body - (list.reverse (list.indices arity)))) + (list.reversed (list.indices arity)))) (template: (!expect <pattern> <value>) (case <value> diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index e9f9268ac..9c34b539f 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -320,7 +320,7 @@ (def: default Context {#redundants 0 - #necessary (dictionary.new n.hash)}) + #necessary (dictionary.empty n.hash)}) (def: #export test Test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux index 48f1f9817..7a103d60a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -78,7 +78,7 @@ ($_ _.and (_.test "Can parse Lux code." (case (let [source_code (%.code sample)] - (/.parse "" (dictionary.new text.hash) (text.size source_code) + (/.parse "" (dictionary.empty text.hash) (text.size source_code) [location.dummy 0 source_code])) (#.Left error) false @@ -90,13 +90,13 @@ (_.test "Can parse multiple Lux code nodes." (let [source_code (format (%.code sample) " " (%.code other)) source_code//size (text.size source_code)] - (case (/.parse "" (dictionary.new text.hash) source_code//size + (case (/.parse "" (dictionary.empty text.hash) source_code//size [location.dummy 0 source_code]) (#.Left error) false (#.Right [remaining =sample]) - (case (/.parse "" (dictionary.new text.hash) source_code//size + (case (/.parse "" (dictionary.empty text.hash) source_code//size remaining) (#.Left error) false @@ -128,7 +128,7 @@ (_.test "Can handle comments." (case (let [source_code (format comment (%.code sample)) source_code//size (text.size source_code)] - (/.parse "" (dictionary.new text.hash) source_code//size + (/.parse "" (dictionary.empty text.hash) source_code//size [location.dummy 0 source_code])) (#.Left error) false diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 24097be23..45d263509 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -205,8 +205,8 @@ #let [left,right [left right]]] (_.cover [/.:cast] (|> left,right - (/.:cast [l r] (& l r) (| l r)) - (/.:cast [l r] (| l r) (& l r)) + (/.:cast [l r] (And l r) (Or l r)) + (/.:cast [l r] (Or l r) (And l r)) (is? left,right)))) (do random.monad [expected random.nat] diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index f761a0f3f..a281a476b 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -7,14 +7,15 @@ ["." monad [indexed (#+ do)]]] [control - ["." io] + ["." io (#+ IO)] ["." try] ["." exception (#+ Exception)] [concurrency - ["." async]] + ["." async (#+ Async)]] [parser ["<.>" code]]] [data + ["." identity (#+ Identity)] ["." text ("#\." equivalence) ["%" format (#+ format)]]] ["." macro @@ -29,39 +30,41 @@ Test (monad.do {! random.monad} [pre (\ ! map %.nat random.nat) - post (\ ! map %.nat random.nat)] - (_.for [/.Linear /.pure /.run_pure] + post (\ ! map %.nat random.nat) + #let [! identity.monad]] + (_.for [/.Linear /.run] (`` ($_ _.and (~~ (template [<coverage> <bindings>] [(_.cover <coverage> (<| (text\= (format pre post)) - /.run_pure - (do /.pure + (: (Identity Text)) + (/.run !) + (do (/.monad !) <bindings> (in (format left right)))))] - [[/.Affine /.Key /.Res /.Ordered /.ordered_pure - /.Relevant /.read_pure] - [res|left (/.ordered_pure pre) - res|right (/.ordered_pure post) - right (/.read_pure res|right) - left (/.read_pure res|left)]] - [[/.Commutative /.commutative_pure /.exchange_pure] - [res|left (/.commutative_pure pre) - res|right (/.commutative_pure post) - _ (/.exchange_pure [1 0]) - left (/.read_pure res|left) - right (/.read_pure res|right)]] - [[/.group_pure /.un_group_pure] - [res|left (/.commutative_pure pre) - res|right (/.commutative_pure post) - _ (/.group_pure 2) - _ (/.un_group_pure 2) - right (/.read_pure res|right) - left (/.read_pure res|left)]] - [[/.lift_pure] - [left (/.lift_pure pre) - right (/.lift_pure post)]] + [[/.Affine /.Key /.Res /.Ordered /.ordered + /.Relevant /.read] + [res|left (/.ordered ! pre) + res|right (/.ordered ! post) + right (/.read ! res|right) + left (/.read ! res|left)]] + [[/.Commutative /.commutative /.exchange] + [res|left (/.commutative ! pre) + res|right (/.commutative ! post) + _ ((/.exchange [1 0]) !) + left (/.read ! res|left) + right (/.read ! res|right)]] + [[/.group /.un_group] + [res|left (/.commutative ! pre) + res|right (/.commutative ! post) + _ ((/.group 2) !) + _ ((/.un_group 2) !) + right (/.read ! res|right) + left (/.read ! res|left)]] + [[/.lifted] + [left (/.lifted ! pre) + right (/.lifted ! post)]] )) ))))) @@ -69,40 +72,42 @@ Test (monad.do {! random.monad} [pre (\ ! map %.nat random.nat) - post (\ ! map %.nat random.nat)] - (_.for [/.Linear /.sync /.run_sync] + post (\ ! map %.nat random.nat) + #let [! io.monad]] + (_.for [/.Linear /.run] (`` ($_ _.and (~~ (template [<coverage> <bindings>] [(_.cover <coverage> (<| (text\= (format pre post)) io.run - /.run_sync - (do /.sync + (: (IO Text)) + (/.run !) + (do (/.monad !) <bindings> (in (format left right)))))] - [[/.Affine /.Key /.Res /.Ordered /.ordered_sync - /.Relevant /.read_sync] - [res|left (/.ordered_sync pre) - res|right (/.ordered_sync post) - right (/.read_sync res|right) - left (/.read_sync res|left)]] - [[/.Commutative /.commutative_sync /.exchange_sync] - [res|left (/.commutative_sync pre) - res|right (/.commutative_sync post) - _ (/.exchange_sync [1 0]) - left (/.read_sync res|left) - right (/.read_sync res|right)]] - [[/.group_sync /.un_group_sync] - [res|left (/.commutative_sync pre) - res|right (/.commutative_sync post) - _ (/.group_sync 2) - _ (/.un_group_sync 2) - right (/.read_sync res|right) - left (/.read_sync res|left)]] - [[/.lift_sync] - [left (/.lift_sync (io.io pre)) - right (/.lift_sync (io.io post))]] + [[/.Affine /.Key /.Res /.Ordered /.ordered + /.Relevant /.read] + [res|left (/.ordered ! pre) + res|right (/.ordered ! post) + right (/.read ! res|right) + left (/.read ! res|left)]] + [[/.Commutative /.commutative /.exchange] + [res|left (/.commutative ! pre) + res|right (/.commutative ! post) + _ ((/.exchange [1 0]) !) + left (/.read ! res|left) + right (/.read ! res|right)]] + [[/.group /.un_group] + [res|left (/.commutative ! pre) + res|right (/.commutative ! post) + _ ((/.group 2) !) + _ ((/.un_group 2) !) + right (/.read ! res|right) + left (/.read ! res|left)]] + [[/.lifted] + [left (/.lifted ! (io.io pre)) + right (/.lifted ! (io.io post))]] )) ))))) @@ -110,41 +115,43 @@ Test (monad.do {! random.monad} [pre (\ ! map %.nat random.nat) - post (\ ! map %.nat random.nat)] - (_.for [/.Linear /.async /.run_async] + post (\ ! map %.nat random.nat) + #let [! async.monad]] + (_.for [/.Linear /.run] (`` ($_ _.and (~~ (template [<coverage> <bindings>] - [(in (monad.do async.monad - [outcome (/.run_async - (do /.async - <bindings> - (in (format left right))))] + [(in (monad.do ! + [outcome (<| (: (Async Text)) + (/.run !) + (do (/.monad !) + <bindings> + (in (format left right))))] (_.cover' <coverage> (text\= (format pre post) outcome))))] - [[/.Affine /.Key /.Res /.Ordered /.ordered_async - /.Relevant /.read_async] - [res|left (/.ordered_async pre) - res|right (/.ordered_async post) - right (/.read_async res|right) - left (/.read_async res|left)]] - [[/.Commutative /.commutative_async /.exchange_async] - [res|left (/.commutative_async pre) - res|right (/.commutative_async post) - _ (/.exchange_async [1 0]) - left (/.read_async res|left) - right (/.read_async res|right)]] - [[/.group_async /.un_group_async] - [res|left (/.commutative_async pre) - res|right (/.commutative_async post) - _ (/.group_async 2) - _ (/.un_group_async 2) - right (/.read_async res|right) - left (/.read_async res|left)]] - [[/.lift_async] - [left (/.lift_async (async.resolved pre)) - right (/.lift_async (async.resolved post))]] + [[/.Affine /.Key /.Res /.Ordered /.ordered + /.Relevant /.read] + [res|left (/.ordered ! pre) + res|right (/.ordered ! post) + right (/.read ! res|right) + left (/.read ! res|left)]] + [[/.Commutative /.commutative /.exchange] + [res|left (/.commutative ! pre) + res|right (/.commutative ! post) + _ ((/.exchange [1 0]) !) + left (/.read ! res|left) + right (/.read ! res|right)]] + [[/.group /.un_group] + [res|left (/.commutative ! pre) + res|right (/.commutative ! post) + _ ((/.group 2) !) + _ ((/.un_group 2) !) + right (/.read ! res|right) + left (/.read ! res|left)]] + [[/.lifted] + [left (/.lifted ! (async.resolved pre)) + right (/.lifted ! (async.resolved post))]] )) ))))) @@ -174,20 +181,10 @@ [(with_error /.amount_cannot_be_zero (<group|un_group> 0))] - [/.group_pure] - [/.group_sync] - [/.group_async] - [/.un_group_pure] - [/.un_group_sync] - [/.un_group_async] + [/.group] + [/.un_group] ))))) (_.cover [/.index_cannot_be_repeated] - (`` (and (~~ (template [<exchange>] - [(with_error /.index_cannot_be_repeated - (<exchange> [0 0]))] - - [/.exchange_pure] - [/.exchange_sync] - [/.exchange_async] - ))))) + (with_error /.index_cannot_be_repeated + (/.exchange [0 0]))) ))) |