diff options
Diffstat (limited to '')
279 files changed, 2782 insertions, 2679 deletions
diff --git a/documentation/book/the_lux_programming_language/introduction.md b/documentation/book/the_lux_programming_language/introduction.md new file mode 100644 index 000000000..11ee6b52a --- /dev/null +++ b/documentation/book/the_lux_programming_language/introduction.md @@ -0,0 +1,31 @@ +# Introduction + +The Lux programming language is a functional language belonging to the Lisp family. +It features a flexible and expressive static type-system, and it's meant to run in a variety of different platforms. + +Lux is currently in development. +Some of the features expected of the language have yet to be added (in particular, more compilers to support more platforms). + +Despite this, Lux has already come far enough in its development that it can be used to write a variety of programs that can run on the Java Virtual Machine, the first platform targeted by Lux. + +The semantics of Lux are in no way tied to those of the JVM, and as such, Lux should be understood as a universal language; meant to express programs in a way that is as cross-platform as possible, while at the same time able to tap into the richness that each particular platform has got to offer. + +Besides the focus on targeting multiple platforms, Lux's design also covers several other important topics in computer science and software engineering. + +Lux is committed to the functional style of program design, being a purely-functional programming language, while also adopting eager-evaluation over lazy-evaluation, to promote simpler reasoning over the performance and behavior of programs. + +Lux also offers novel features in the area of meta-programming, with first-class types that can be examined and constructed at compile-time, monadic macros with access to the state of the compiler, and a style of macro definition that promotes composition and easy interaction between different macros. + +While the richness and variety of what Lux has got to offer is much larger than what can be described in this introduction, hopefully I've already mentioned enough to stimulate the curiosity of those interested in advanced concepts in programming languages and computer science, and those engineers seeking powerful tools for both program design and implementation. + +Lux is both a simple and a complex language. +It's design allows you to make effective programs with just a small subset of what it has to offer, but the goal of the language is to provide its users with an arsenal of powerful tools to suit their various needs in their projects. + +Finally, I must note that Lux is a practical language, meant for day-to-day usage by software engineers, instead of just research and experimentation by academics. +It may seem unnecessary to point that out, but both Lisp-like languages and functional languages have earned a reputation for being academic in nature. +While Lux's design does involve a lot of advanced ideas in computer science, it is with the intention of turning Lux into a powerful and effective tool for day-to-day software engineering. + +It is my hope that within these pages the reader will find both a host of new ideas to enrich his/her perspective on programming, and the promise of great power, should they choose to add Lux to their arsenal of programming languages. + +I wish you, my dear reader, good luck on this journey, and much fun! + diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index f36d3edfc..84896f3e5 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -326,7 +326,7 @@ Called by `imenu--generic-function'." (control//contract (altRE "pre" "post")) ;; Type (type//syntax (altRE "|" "&" "->" "All" "Ex" "Rec" "primitive" "\\$" "type")) - (type//checking (altRE ":" ":as" ":let" ":~" ":assume" ":of" ":cast" ":share" ":by_example" ":hole")) + (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:")) (type//poly (altRE "poly:" "derived:")) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 4d3141587..eb2676ee3 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1088,7 +1088,7 @@ code} code)) -(def:'' (parse_quantified_args args next) +(def:'' (quantified_args_parser args next) #Nil ## (-> (List Code) (-> (List Text) (Meta (List Code))) (Meta (List Code))) (#Function ($' List Code) @@ -1099,7 +1099,7 @@ (next #Nil) (#Cons [_ (#Identifier "" arg_name)] args') - (parse_quantified_args args' (function'' [names] (next (#Cons arg_name names)))) + (quantified_args_parser args' (function'' [names] (next (#Cons arg_name names)))) _ (fail "Expected identifier.")} @@ -1149,28 +1149,28 @@ ["" tokens]} tokens) ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) - (parse_quantified_args args - (function'' [names] - (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) - (function'' [name' body'] - (form$ (#Cons (tag$ ["library/lux" "UnivQ"]) - (#Cons (tag$ ["library/lux" "Nil"]) - (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) - (update_parameters body')) #Nil)))))) - body - names) - (return (#Cons ({[#1 _] - body' - - [_ #Nil] - body' - - [#0 _] - (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #Nil) - body')} - [(text\= "" self_name) names]) - #Nil))))) + (quantified_args_parser args + (function'' [names] + (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) + (function'' [name' body'] + (form$ (#Cons (tag$ ["library/lux" "UnivQ"]) + (#Cons (tag$ ["library/lux" "Nil"]) + (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) + (update_parameters body')) #Nil)))))) + body + names) + (return (#Cons ({[#1 _] + body' + + [_ #Nil] + body' + + [#0 _] + (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] + #Nil) + body')} + [(text\= "" self_name) names]) + #Nil))))) _ (fail "Wrong syntax for All")} @@ -1193,28 +1193,28 @@ ["" tokens]} tokens) ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) - (parse_quantified_args args - (function'' [names] - (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) - (function'' [name' body'] - (form$ (#Cons (tag$ ["library/lux" "ExQ"]) - (#Cons (tag$ ["library/lux" "Nil"]) - (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) - (update_parameters body')) #Nil)))))) - body - names) - (return (#Cons ({[#1 _] - body' - - [_ #Nil] - body' - - [#0 _] - (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] - #Nil) - body')} - [(text\= "" self_name) names]) - #Nil))))) + (quantified_args_parser args + (function'' [names] + (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code)) + (function'' [name' body'] + (form$ (#Cons (tag$ ["library/lux" "ExQ"]) + (#Cons (tag$ ["library/lux" "Nil"]) + (#Cons (replace_syntax (#Cons [name' (make_parameter 1)] #Nil) + (update_parameters body')) #Nil)))))) + body + names) + (return (#Cons ({[#1 _] + body' + + [_ #Nil] + body' + + [#0 _] + (replace_syntax (#Cons [self_name (make_parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] + #Nil) + body')} + [(text\= "" self_name) names]) + #Nil))))) _ (fail "Wrong syntax for Ex")} @@ -1750,7 +1750,7 @@ (identifier$ ["library/lux" "List"])))] (form$ (list (text$ "lux type check") type expression)))) -(def:''' (splice replace? untemplate elems) +(def:''' (spliced replace? untemplate elems) #Nil (-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code)) ({#1 @@ -1862,13 +1862,13 @@ [_ [meta (#Form elems)]] (do meta_monad - [output (splice replace? (untemplate replace? subst) elems) + [output (spliced replace? (untemplate replace? subst) elems) #let [[_ output'] (wrap_meta (form$ (list (tag$ ["library/lux" "Form"]) output)))]] (wrap [meta output'])) [_ [meta (#Tuple elems)]] (do meta_monad - [output (splice replace? (untemplate replace? subst) elems) + [output (spliced replace? (untemplate replace? subst) elems) #let [[_ output'] (wrap_meta (form$ (list (tag$ ["library/lux" "Tuple"]) output)))]] (wrap [meta output'])) @@ -3296,17 +3296,18 @@ (#Some x) (nth ("lux i64 -" 1 idx) xs')))) -(def: (beta_reduce env type) +## https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction +(def: (reduced env type) (-> (List Type) Type Type) (case type (#Sum left right) - (#Sum (beta_reduce env left) (beta_reduce env right)) + (#Sum (reduced env left) (reduced env right)) (#Product left right) - (#Product (beta_reduce env left) (beta_reduce env right)) + (#Product (reduced env left) (reduced env right)) (#Apply arg func) - (#Apply (beta_reduce env arg) (beta_reduce env func)) + (#Apply (reduced env arg) (reduced env func)) (#UnivQ ?local_env ?local_def) (case ?local_env @@ -3325,7 +3326,7 @@ type) (#Function ?input ?output) - (#Function (beta_reduce env ?input) (beta_reduce env ?output)) + (#Function (reduced env ?input) (reduced env ?output)) (#Parameter idx) (case (nth idx env) @@ -3336,7 +3337,7 @@ type) (#Named name type) - (beta_reduce env type) + (reduced env type) _ type @@ -3346,10 +3347,10 @@ (-> Type Type (Maybe Type)) (case type_fn (#UnivQ env body) - (#Some (beta_reduce (list& type_fn param env) body)) + (#Some (reduced (list& type_fn param env) body)) (#ExQ env body) - (#Some (beta_reduce (list& type_fn param env) body)) + (#Some (reduced (list& type_fn param env) body)) (#Apply A F) (do maybe_monad @@ -3372,16 +3373,16 @@ _ (list type)))] - [flatten_variant #Sum] - [flatten_tuple #Product] - [flatten_lambda #Function] + [flat_variant #Sum] + [flat_tuple #Product] + [flat_lambda #Function] ) -(def: (flatten_app type) +(def: (flat_app type) (-> Type [Type (List Type)]) (case type (#Apply head func') - (let [[func tail] (flatten_app func')] + (let [[func tail] (flat_app func')] [func (#Cons head tail)]) _ @@ -3391,7 +3392,7 @@ (-> Type (Maybe (List Type))) (case type (#Product _) - (#Some (flatten_tuple type)) + (#Some (flat_tuple type)) (#Apply arg func) (do maybe_monad @@ -3717,7 +3718,7 @@ (fail "#only/#+ and #exclude/#- require identifiers.")))) defs)) -(def: (parse_referrals tokens) +(def: (referrals_parser tokens) (-> (List Code) (Meta [Referrals (List Code)])) (case tokens (^or (^ (list& [_ (#Form (list& [_ (#Tag ["" "+"])] defs))] tokens')) @@ -3743,7 +3744,7 @@ _ (return [#Nothing tokens]))) -(def: (parse_openings parts) +(def: (openings_parser parts) (-> (List Code) (Meta [(List Openings) (List Code)])) (case parts #.Nil @@ -3760,7 +3761,7 @@ _ (fail "Expected all implementations of opening form to be identifiers."))) structs) - next+remainder (parse_openings parts')] + next+remainder (openings_parser parts')] (let [[next remainder] next+remainder] (return [(#.Cons [prefix structs'] next) remainder]))) @@ -3902,7 +3903,7 @@ #import_alias import_alias #import_refer import_refer})) -(def: (parse_imports nested? relative_root context_alias imports) +(def: (imports_parser nested? relative_root context_alias imports) (-> Bit Text Text (List Code) (Meta (List Importation))) (do meta_monad [imports' (monad\map meta_monad @@ -3927,11 +3928,11 @@ #.None (clean_module nested? relative_root m_name)) - referral+extra (parse_referrals extra) + referral+extra (referrals_parser extra) #let [[referral extra] referral+extra] - openings+extra (parse_openings extra) + openings+extra (openings_parser extra) #let [[openings extra] openings+extra] - sub_imports (parse_imports #1 import_name context_alias extra)] + sub_imports (imports_parser #1 import_name context_alias extra)] (wrap (case [referral openings] [#Nothing #Nil] sub_imports @@ -3951,12 +3952,12 @@ #.None (clean_module nested? relative_root m_name)) - referral+extra (parse_referrals extra) + referral+extra (referrals_parser extra) #let [[referral extra] referral+extra] - openings+extra (parse_openings extra) + openings+extra (openings_parser extra) #let [[openings extra] openings+extra de_aliased (de_alias context_alias m_name alias)] - sub_imports (parse_imports #1 import_name de_aliased extra)] + sub_imports (imports_parser #1 import_name de_aliased extra)] (wrap (case [referral openings] [#Ignore #Nil] sub_imports @@ -4019,7 +4020,7 @@ code\encode)))) )) -(def: (filter p xs) +(def: (only p xs) (All [a] (-> (-> a Bit) (List a) (List a))) (case xs #Nil @@ -4027,8 +4028,8 @@ (#Cons x xs') (if (p x) - (#Cons x (filter p xs')) - (filter p xs')))) + (#Cons x (only p xs')) + (only p xs')))) (def: (is_member? cases name) (-> (List Text) Text Bit) @@ -4196,13 +4197,13 @@ ($_ text\compose "(" name " " (|> params (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")) (#Sum _) - ($_ text\compose "(| " (|> (flatten_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") + ($_ text\compose "(| " (|> (flat_variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Product _) - ($_ text\compose "[" (|> (flatten_tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]") + ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]") (#Function _) - ($_ text\compose "(-> " (|> (flatten_lambda type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") + ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Parameter id) (nat\encode id) @@ -4220,7 +4221,7 @@ ($_ text\compose "(Ex " (type\encode body) ")") (#Apply _) - (let [[func args] (flatten_app type)] + (let [[func args] (flat_app type)] ($_ text\compose "(" (type\encode func) " " (|> args (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) @@ -4470,9 +4471,9 @@ (def: (read_refer module_name options) (-> Text (List Code) (Meta Refer)) (do meta_monad - [referral+options (parse_referrals options) + [referral+options (referrals_parser options) #let [[referral options] referral+options] - openings+options (parse_openings options) + openings+options (openings_parser options) #let [[openings options] openings+options] current_module current_module_name] (case options @@ -4514,7 +4515,7 @@ (do meta_monad [*defs (exported_definitions module_name) _ (test_referrals module_name *defs _defs)] - (wrap (filter (|>> (is_member? _defs) not) *defs))) + (wrap (..only (|>> (is_member? _defs) not) *defs))) #Ignore (wrap (list)) @@ -4599,7 +4600,7 @@ _ [(list) tokens]))] current_module current_module_name - imports (parse_imports #0 current_module "" _imports) + imports (imports_parser #0 current_module "" _imports) #let [=imports (|> imports (list\map (: (-> Importation Code) (function (_ [m_name m_alias =refer]) @@ -4798,20 +4799,20 @@ (macro: #export (^template tokens) {#.doc (text$ ($_ "lux text concat" "## It's similar to template, but meant to be used during pattern-matching." ..\n - "(def: (beta_reduce env type)" ..\n + "(def: (reduced env type)" ..\n " (-> (List Type) Type Type)" ..\n " (case type" ..\n " (#.Primitive name params)" ..\n - " (#.Primitive name (list\map (beta_reduce env) params))" + " (#.Primitive name (list\map (reduced env) params))" __paragraph " (^template [<tag>]" ..\n " [(<tag> left right)" ..\n - " (<tag> (beta_reduce env left) (beta_reduce env right))])" ..\n + " (<tag> (reduced env left) (reduced env right))])" ..\n " ([#.Sum] [#.Product])" __paragraph " (^template [<tag>]" ..\n " [(<tag> left right)" ..\n - " (<tag> (beta_reduce env left) (beta_reduce env right))])" ..\n + " (<tag> (reduced env left) (reduced env right))])" ..\n " ([#.Function] [#.Apply])" __paragraph " (^template [<tag>]" ..\n @@ -5241,7 +5242,7 @@ _ (fail "Wrong syntax for with_expansions"))) -(def: (flatten_alias type) +(def: (flat_alias type) (-> Type Type) (case type (^template [<name>] @@ -5255,7 +5256,7 @@ ["Text"]) (#Named _ type') - (flatten_alias type') + (flat_alias type') _ type)) @@ -5265,7 +5266,7 @@ (do meta_monad [type+value (find_def_value name) #let [[type value] type+value]] - (case (flatten_alias type) + (case (flat_alias type) (^template [<name> <type> <wrapper>] [(#Named ["library/lux" <name>] _) (wrap (<wrapper> (:as <type> value)))]) @@ -5330,7 +5331,7 @@ (def: (case_level^ level) (-> Code (Meta [Code Code])) (case level - (^ [_ (#Tuple (list expr binding))]) + (^ [_ (#Record (list [expr binding]))]) (return [expr binding]) _ @@ -5373,7 +5374,8 @@ "Useful in situations where the result of a branch depends on further refinements on the values being matched." "For example:" (case (split (size static) uri) - (^multi (#.Some [chunk uri']) [(text\= static chunk) #1]) + (^multi (#.Some [chunk uri']) + {(text\= static chunk) #1}) (match_uri endpoint? parts' uri') _ @@ -5382,7 +5384,8 @@ "Short-cuts can be taken when using bit tests." "The example above can be rewritten as..." (case (split (size static) uri) - (^multi (#.Some [chunk uri']) (text\= static chunk)) + (^multi (#.Some [chunk uri']) + (text\= static chunk)) (match_uri endpoint? parts' uri') _ @@ -5453,7 +5456,7 @@ (macro: #export ($ tokens) {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." "In the example below, 0 corresponds to the 'a' variable." - (def: #export (from_list list) + (def: #export (of_list list) (All [a] (-> (List a) (Row a))) (list\fold add (: (Row ($ 0)) @@ -5580,7 +5583,7 @@ _ (fail (..wrong_syntax_error (name_of ..:of))))) -(def: (parse_complex_declaration tokens) +(def: (complex_declaration_parser tokens) (-> (List Code) (Meta [[Text (List Text)] (List Code)])) (case tokens (^ (list& [_ (#Form (list& [_ (#Identifier ["" name])] args'))] tokens')) @@ -5600,7 +5603,7 @@ (fail "Could not parse a complex declaration.") )) -(def: (parse_any tokens) +(def: (any_parser tokens) (-> (List Code) (Meta [Code (List Code)])) (case tokens (^ (list& token tokens')) @@ -5610,7 +5613,7 @@ (fail "Could not parse anything.") )) -(def: (parse_many tokens) +(def: (many_parser tokens) (-> (List Code) (Meta [(List Code) (List Code)])) (case tokens (^ (list& head tail)) @@ -5620,7 +5623,7 @@ (fail "Could not parse anything.") )) -(def: (parse_end tokens) +(def: (end_parser tokens) (-> (List Code) (Meta Any)) (case tokens (^ (list)) @@ -5630,7 +5633,7 @@ (fail "Expected input Codes to be empty.") )) -(def: (parse_anns tokens) +(def: (anns_parser tokens) (-> (List Code) (Meta [Code (List Code)])) (case tokens (^ (list& [_ (#Record _anns)] tokens')) @@ -5647,13 +5650,13 @@ (* x x)))} (do meta_monad [#let [[export? tokens] (export^ tokens)] - name+args|tokens (parse_complex_declaration tokens) + name+args|tokens (complex_declaration_parser tokens) #let [[[name args] tokens] name+args|tokens] - anns|tokens (parse_anns tokens) + anns|tokens (anns_parser tokens) #let [[anns tokens] anns|tokens] - input_templates|tokens (parse_many tokens) + input_templates|tokens (many_parser tokens) #let [[input_templates tokens] input_templates|tokens] - _ (parse_end tokens) + _ (end_parser tokens) g!tokens (gensym "tokens") g!compiler (gensym "compiler") g!_ (gensym "_") @@ -5706,7 +5709,7 @@ [identifier (..resolve_global_identifier identifier) type+value (..find_def_value identifier) #let [[type value] type+value]] - (case (..flatten_alias type) + (case (..flat_alias type) (^or (#Primitive "#Text" #Nil) (#Named ["library/lux" "Text"] (#Primitive "#Text" #Nil))) (wrap (:as ..Text value)) diff --git a/stdlib/source/library/lux/abstract/functor/contravariant.lux b/stdlib/source/library/lux/abstract/functor/contravariant.lux index db66f1265..f7df0a73d 100644 --- a/stdlib/source/library/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/library/lux/abstract/functor/contravariant.lux @@ -3,6 +3,8 @@ [lux #*]]) (interface: #export (Functor f) + {#.doc (doc "The contravariant functor.")} + (: (All [a b] (-> (-> b a) (-> (f a) (f b)))) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index a99baf75b..ef7138593 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -148,7 +148,7 @@ (!\map (|>> (#.Cons _x)) (recur xs')))) !\join))))) -(def: #export (filter monad f) +(def: #export (only monad f) {#.doc "Filter the values in a list with a monadic function."} (All [! a b] (-> (Monad !) (-> a (! Bit)) (List a) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 2143a0c97..3ab6c0f05 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -115,7 +115,7 @@ (~ type) (|>> (~+ commands))))))) -(syntax: #export (apply {arity (|> <c>.nat (<>.filter (n.> 0)))}) +(syntax: #export (apply {arity (|> <c>.nat (<>.only (n.> 0)))}) (with_gensyms [g! g!func g!stack g!output] (monad.do {! meta.monad} [g!inputs (|> (macro.gensym "input") (list.repeat arity) (monad.seq !))] diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 78ed99765..355a7885e 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -1,6 +1,7 @@ (.module: {#.doc "The actor model of concurrency."} [library [lux #* + ["." debug] [abstract monad] [control @@ -29,7 +30,7 @@ ["n" nat]]] ["." meta (#+ monad) ["." annotation]] - [type (#+ :share) + [type (#+ :sharing) ["." abstract (#+ abstract: :representation :abstraction)]]]] [// ["." atom (#+ Atom atom)] @@ -67,28 +68,32 @@ (Resolver <Obituary>)] #mailbox (Atom <Mailbox>)} + {#.doc (doc "An entity that can react to messages (mail) sent to it concurrently.")} + (type: #export (Mail s) + {#.doc (doc "A one-way message sent to an actor, without expecting a reply.")} <Mail>) (type: #export (Obituary s) + {#.doc (doc "Details on the death of an actor.")} <Obituary>) (type: #export (Behavior o s) - {#.doc "An actor's behavior when mail is received and when a fatal error occurs."} + {#.doc (doc "An actor's behavior when mail is received and when a fatal error occurs.")} {#on_init (-> o s) #on_mail (-> (Mail s) s (Actor s) (Promise (Try s)))}) (def: #export (spawn! behavior init) - {#.doc "Given a behavior and initial state, spawns an actor and returns it."} + {#.doc (doc "Given a behavior and initial state, spawns an actor and returns it.")} (All [o s] (-> (Behavior o s) o (IO (Actor s)))) (io (let [[on_init on_mail] behavior - self (:share [o s] - (Behavior o s) - behavior - - (Actor s) - (:abstraction {#obituary (promise.promise []) - #mailbox (atom (promise.promise []))})) + self (:sharing [o s] + (Behavior o s) + behavior + + (Actor s) + (:abstraction {#obituary (promise.promise []) + #mailbox (atom (promise.promise []))})) process (loop [state (on_init init) [|mailbox| _] (io.run (atom.read (get@ #mailbox (:representation self))))] (do {! promise.monad} @@ -125,13 +130,14 @@ (promise.poll obituary))) (def: #export await + {#.doc (doc "Await for an actor to end working.")} (All [s] (-> (Actor s) (Promise (Obituary s)))) (|>> :representation (get@ #obituary) product.left)) (def: #export (mail! mail actor) - {#.doc "Send mail to an actor.."} + {#.doc (doc "Send mail to an actor.")} (All [s] (-> (Mail s) (Actor s) (IO (Try Any)))) (do {! io.monad} [alive? (..alive? actor)] @@ -157,17 +163,18 @@ (wrap (exception.throw ..dead []))))) (type: #export (Message s o) + {#.doc (doc "A two-way message sent to an actor, expecting a reply.")} (-> s (Actor s) (Promise (Try [s o])))) (def: (mail message) (All [s o] (-> (Message s o) [(Promise (Try o)) (Mail s)])) - (let [[promise resolve] (:share [s o] - (Message s o) - message - - [(Promise (Try o)) - (Resolver (Try o))] - (promise.promise []))] + (let [[promise resolve] (:sharing [s o] + (Message s o) + message + + [(Promise (Try o)) + (Resolver (Try o))] + (promise.promise []))] [promise (function (_ state self) (do {! promise.monad} @@ -182,7 +189,7 @@ (promise.resolved (#try.Failure error))))))])) (def: #export (tell! message actor) - {#.doc "Communicate with an actor through message passing."} + {#.doc (doc "Communicate with an actor through message-passing.")} (All [s o] (-> (Message s o) (Actor s) (Promise (Try o)))) (let [[promise mail] (..mail message)] (do promise.monad @@ -201,6 +208,7 @@ (mail state self)) (def: #export default + {#.doc (doc "Default actor behavior.")} (All [s] (Behavior s s)) {#on_init function.identity #on_mail ..default_on_mail}) @@ -254,23 +262,26 @@ ((on_mail mail state self) (do (try.with promise.monad) - [#let [_ (log! "BEFORE")] + [#let [_ (debug.log! "BEFORE")] output (mail state self) - #let [_ (log! "AFTER")]] + #let [_ (debug.log! "AFTER")]] (wrap output))) - (message: #export (push {value a} state self (List a)) + (message: #export (push {value a} state self) + (List a) (let [state' (#.Cons value state)] (promise.resolved (#try.Success [state' state']))))) (actor: #export Counter Nat - (message: #export (count! {increment Nat} state self Any) + (message: #export (count! {increment Nat} state self) + Any (let [state' (n.+ increment state)] (promise.resolved (#try.Success [state' state'])))) - (message: #export (read! state self Nat) + (message: #export (read! state self) + Nat (promise.resolved (#try.Success [state state])))))] (syntax: #export (actor: {export |export|.parser} @@ -278,7 +289,7 @@ {annotations (<>.default |annotations|.empty |annotations|.parser)} state_type {[?on_mail messages] behavior^}) - {#.doc (doc "Defines an actor, with its behavior and internal state." + {#.doc (doc "Defines a named actor, with its behavior and internal state." "Messages for the actor must be defined after the on_mail handler." <examples>)} (with_gensyms [g!_] @@ -299,6 +310,12 @@ (syntax: #export (actor {[state_type init] (<code>.record (<>.and <code>.any <code>.any))} {[?on_mail messages] behavior^}) + {#.doc (doc "Defines an anonymous actor, with its behavior and internal state." + "Messages for the actor must be defined after the on_mail handler." + (actor {Nat + 123} + ((on_mail message state self) + (message (inc state) self))))} (with_gensyms [g!_] (wrap (list (` (: ((~! io.IO) (..Actor (~ state_type))) (..spawn! (: (..Behavior (~ state_type) (~ state_type)) @@ -312,8 +329,7 @@ #name Text #inputs (List |input|.Input) #state Text - #self Text - #output Code}) + #self Text}) (def: signature^ (Parser Signature) @@ -322,8 +338,7 @@ <code>.local_identifier (<>.some |input|.parser) <code>.local_identifier - <code>.local_identifier - <code>.any))) + <code>.local_identifier))) (def: reference^ (Parser [Name (List Text)]) @@ -334,6 +349,7 @@ {export |export|.parser} {signature signature^} {annotations (<>.default |annotations|.empty |annotations|.parser)} + output_type body) {#.doc (doc "A message can access the actor's state through the state parameter." "A message can also access the actor itself through the self parameter." @@ -357,24 +373,28 @@ (All [(~+ g!all_vars)] (-> (~+ g!inputsT) (..Message (~ (get@ #abstract.abstraction actor_scope)) - (~ (get@ #output signature))))) + (~ output_type)))) (function ((~ g!_) (~ g!state) (~ g!self)) (let [(~ g!state) (:as (~ (get@ #abstract.representation actor_scope)) (~ g!state))] (|> (~ body) (: ((~! promise.Promise) ((~! try.Try) [(~ (get@ #abstract.representation actor_scope)) - (~ (get@ #output signature))]))) + (~ output_type)]))) (:as ((~! promise.Promise) ((~! try.Try) [(~ (get@ #abstract.abstraction actor_scope)) - (~ (get@ #output signature))])))))))) + (~ output_type)])))))))) )))))) (type: #export Stop + {#.doc (doc "A signal to stop an actor from observing a channel.")} (IO Any)) (def: continue! true) (def: stop! false) (def: #export (observe action channel actor) + {#.doc (doc "Use an actor to observe a channel by transforming each datum" + "flowing through the channel into mail the actor can process." + "Can stop observing the channel by executing the Stop value.")} (All [e s] (-> (-> e Stop (Mail s)) (Channel e) (Actor s) (IO Any))) (let [signal (: (Atom Bit) (atom.atom ..continue!)) @@ -384,8 +404,8 @@ (do {! io.monad} [continue? (atom.read signal)] (if continue? - (do ! - [outcome (..mail! (action event stop) actor)] - (wrap (try.to_maybe outcome))) + (|> actor + (..mail! (action event stop)) + (\ ! map try.maybe)) (wrap #.None)))) channel))) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index 057bfd5b2..ba1d2af55 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -97,6 +97,8 @@ (recur []))))) (def: #export (write value atom) + {#.doc (doc "Writes the given value to an atom." + "If it fails to write it (because some other process wrote to it first), it will retry until it succeeds.")} (All [a] (-> a (Atom a) (IO a))) (|> atom (..update (function.constant value)) diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 416b8c7c4..f69a88369 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -2,7 +2,6 @@ [library [lux #* [abstract - [predicate (#+ Predicate)] [equivalence (#+ Equivalence)] [functor (#+ Functor)] [apply (#+ Apply)] @@ -13,7 +12,7 @@ ["." io (#+ IO io)]] [data ["." maybe ("#\." functor)]] - [type (#+ :share) + [type (#+ :sharing) abstract]]] [// ["." atom (#+ Atom)] @@ -26,6 +25,7 @@ (exception: #export channel_is_already_closed) (interface: #export (Sink a) + {#.doc (doc "The tail-end of a channel, which can be written-to to fee the channel.")} (: (IO (Try Any)) close) (: (-> a (IO (Try Any))) @@ -58,13 +58,13 @@ (loop [_ []] (do {! io.monad} [current (atom.read sink) - #let [[next resolve_next] (:share [a] - (promise.Resolver (Maybe [a (Channel a)])) - current - - [(Promise (Maybe [a (Channel a)])) - (promise.Resolver (Maybe [a (Channel a)]))] - (promise.promise []))] + #let [[next resolve_next] (:sharing [a] + (promise.Resolver (Maybe [a (Channel a)])) + current + + [(Promise (Maybe [a (Channel a)])) + (promise.Resolver (Maybe [a (Channel a)]))] + (promise.promise []))] fed? (current (#.Some [value next]))] (if fed? ## I fed the sink. @@ -81,6 +81,7 @@ (recur [])))))))))) (def: #export (channel _) + {#.doc (doc "Creates a brand-new channel and hands it over, along with the sink to write to it.")} (All [a] (-> Any [(Channel a) (Sink a)])) (let [[promise resolve] (promise.promise [])] [promise (..sink resolve)])) @@ -148,6 +149,7 @@ output)))) (type: #export (Subscriber a) + {#.doc (doc "A function that can receive every value fed into a channel.")} (-> a (IO (Maybe Any)))) (def: #export (subscribe subscriber channel) @@ -169,13 +171,15 @@ (wrap []))))) []))) -(def: #export (filter pass? channel) - (All [a] (-> (Predicate a) (Channel a) (Channel a))) +(def: #export (only pass? channel) + {#.doc (doc "Produces a new channel based on the old one, only with values" + "that pass the test.")} + (All [a] (-> (-> a Bit) (Channel a) (Channel a))) (do promise.monad [cons channel] (case cons (#.Some [head tail]) - (let [tail' (filter pass? tail)] + (let [tail' (only pass? tail)] (if (pass? head) (wrap (#.Some [head tail'])) tail')) @@ -183,7 +187,8 @@ #.None (wrap #.None)))) -(def: #export (from_promise promise) +(def: #export (of_promise promise) + {#.doc (doc "A one-element channel containing the output from a promise.")} (All [a] (-> (Promise a) (Channel a))) (promise\map (function (_ value) (#.Some [value ..empty])) @@ -206,7 +211,6 @@ (fold f init' tail))))) (def: #export (folds f init channel) - {#.doc "A channel of folds."} (All [a b] (-> (-> b a (Promise a)) a (Channel b) (Channel a))) @@ -272,7 +276,6 @@ (wrap #.None)))) (def: #export (consume channel) - {#.doc "Reads the entirety of a channel's content and returns it as a list."} (All [a] (-> (Channel a) (Promise (List a)))) (do {! promise.monad} [cons channel] @@ -285,6 +288,7 @@ (wrap #.Nil)))) (def: #export (sequential milli_seconds values) + {#.doc (doc "Transforms the given list into a channel with the same elements.")} (All [a] (-> Nat (List a) (Channel a))) (case values #.Nil diff --git a/stdlib/source/library/lux/control/concurrency/promise.lux b/stdlib/source/library/lux/control/concurrency/promise.lux index ad94bbff8..24618fa5a 100644 --- a/stdlib/source/library/lux/control/concurrency/promise.lux +++ b/stdlib/source/library/lux/control/concurrency/promise.lux @@ -11,7 +11,7 @@ ["." io (#+ IO io)]] [data ["." product]] - [type (#+ :share) + [type (#+ :sharing) abstract]]] [// ["." thread] @@ -23,10 +23,12 @@ {#.doc "Represents values produced by asynchronous computations (unlike IO, which is synchronous)."} (type: #export (Resolver a) + {#.doc (doc "The function used to give a value to a promise." + "Will signal 'true' if the promise has been resolved for the 1st time, 'false' otherwise.")} (-> a (IO Bit))) (def: (resolver promise) - {#.doc "Sets an promise's value if it has not been done yet."} + {#.doc "Sets a promise's value if it has not been done yet."} (All [a] (-> (Promise a) (Resolver a))) (function (resolve value) (let [promise (:representation promise)] @@ -48,22 +50,25 @@ (resolve value)))))))) (def: #export (resolved value) + {#.doc (doc "Produces a promise that has already been resolved to the given value.")} (All [a] (-> a (Promise a))) (:abstraction (atom [(#.Some value) (list)]))) (def: #export (promise _) + {#.doc (doc "Creates a fresh promise that has not been resolved yet.")} (All [a] (-> Any [(Promise a) (Resolver a)])) (let [promise (:abstraction (atom [#.None (list)]))] [promise (..resolver promise)])) (def: #export poll - {#.doc "Polls a promise's value."} + {#.doc "Polls a promise for its value."} (All [a] (-> (Promise a) (IO (Maybe a)))) (|>> :representation atom.read (\ io.functor map product.left))) (def: #export (await f promise) + {#.doc (doc "Executes the given function as soon as the promise has been resolved.")} (All [a] (-> (-> a (IO Any)) (Promise a) (IO Any))) (do {! io.monad} [#let [promise (:representation promise)] @@ -125,15 +130,15 @@ ma)))) (def: #export (and left right) - {#.doc "Sequencing combinator."} + {#.doc (doc "Combines the results of both promises, in-order.")} (All [a b] (-> (Promise a) (Promise b) (Promise [a b]))) - (let [[read! write!] (:share [a b] - [(Promise a) (Promise b)] - [left right] + (let [[read! write!] (:sharing [a b] + [(Promise a) (Promise b)] + [left right] - [(Promise [a b]) - (Resolver [a b])] - (..promise [])) + [(Promise [a b]) + (Resolver [a b])] + (..promise [])) _ (io.run (..await (function (_ left) (..await (function (_ right) (write! [left right])) @@ -142,7 +147,8 @@ read!)) (def: #export (or left right) - {#.doc "Heterogeneous alternative combinator."} + {#.doc (doc "Yields the results of whichever promise gets resolved first." + "You can tell which one was resolved first through pattern-matching.")} (All [a b] (-> (Promise a) (Promise b) (Promise (| a b)))) (let [[a|b resolve] (..promise [])] (with_expansions @@ -156,7 +162,8 @@ a|b)))) (def: #export (either left right) - {#.doc "Homogeneous alternative combinator."} + {#.doc (doc "Yields the results of whichever promise gets resolved first." + "You cannot tell which one was resolved first.")} (All [a] (-> (Promise a) (Promise a) (Promise a))) (let [[left||right resolve] (..promise [])] (`` (exec (~~ (template [<promise>] @@ -168,7 +175,7 @@ (def: #export (schedule millis_delay computation) {#.doc (doc "Runs an I/O computation on its own thread (after a specified delay)." - "Returns a Promise that will eventually host its result.")} + "Returns a aromise that will eventually host its result.")} (All [a] (-> Nat (IO a) (Promise a))) (let [[!out resolve] (..promise [])] (exec (|> (do io.monad @@ -180,7 +187,7 @@ (def: #export future {#.doc (doc "Runs an I/O computation on its own thread." - "Returns a Promise that will eventually host its result.")} + "Returns a promise that will eventually host its result.")} (All [a] (-> (IO a) (Promise a))) (..schedule 0)) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 597e96306..821250fb3 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -46,6 +46,8 @@ #waiting_list queue.empty})))) (def: #export (wait semaphore) + {#.doc (doc "Wait on a semaphore until there are open positions." + "After finishing your work, you must 'signal' to the semaphore that you're done.")} (Ex [k] (-> Semaphore (Promise Any))) (let [semaphore (:representation semaphore) [signal sink] (: [(Promise Any) (Resolver Any)] @@ -70,6 +72,7 @@ ["Max Positions" (%.nat max_positions)])) (def: #export (signal semaphore) + {#.doc (doc "Signal to a semaphore that you're done with your work, and that there is a new open position.")} (Ex [k] (-> Semaphore (Promise (Try Int)))) (let [semaphore (:representation semaphore)] (promise.future @@ -100,6 +103,7 @@ {#.doc "A mutual-exclusion lock that can only be acquired by one process at a time."} (def: #export (mutex _) + {#.doc (doc "Creates a brand-new mutex.")} (-> Any Mutex) (:abstraction (semaphore 1))) @@ -112,6 +116,7 @@ (|>> :representation ..signal)) (def: #export (synchronize mutex procedure) + {#.doc (doc "Runs the procedure with exclusive control of the mutex.")} (All [a] (-> Mutex (IO (Promise a)) (Promise a))) (do promise.monad [_ (..acquire mutex) @@ -121,9 +126,11 @@ ) (def: #export limit + {#.doc (doc "Produce a limit for a barrier.")} (refinement.refinement (n.> 0))) (type: #export Limit + {#.doc (doc "A limit for barriers.")} (:~ (refinement.type limit))) (abstract: #export Barrier @@ -167,6 +174,7 @@ ) (def: #export (block barrier) + {#.doc (doc "Wait on a barrier until all processes have arrived and met the barrier's limit.")} (-> Barrier (Promise Any)) (do promise.monad [_ (..start barrier)] diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 081d2f3d9..833dff059 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -41,7 +41,7 @@ (All [a] (-> (Sink a) (Var a) (IO Any))) (do io.monad [_ (atom.update (function (_ [value observers]) - [value (list.filter (|>> (is? sink) not) observers)]) + [value (list.only (|>> (is? sink) not) observers)]) (:representation var))] (wrap []))) @@ -131,7 +131,6 @@ (update_tx_value var value tx'))))) (def: #export (write value var) - {#.doc "Writes value to var."} (All [a] (-> a (Var a) (STM Any))) (function (_ tx) (case (find_var_value var tx) @@ -177,7 +176,7 @@ (ma tx'))))) (def: #export (update f var) - {#.doc "Will update a Var's value, and return a tuple with the old and the new values."} + {#.doc "Update a var's value, and return a tuple with the old and the new values."} (All [a] (-> (-> a a) (Var a) (STM [a a]))) (do ..monad [a (..read var) diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index 9c9bf6549..3d288f8a6 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -65,6 +65,7 @@ )) (def: #export parallelism + {#.doc (doc "How many processes can run in parallel.")} Nat (with_expansions [<jvm> (|> (java/lang/Runtime::getRuntime) (java/lang/Runtime::availableProcessors) @@ -101,6 +102,7 @@ [])) (def: #export (schedule milli_seconds action) + {#.doc (doc "Executes an I/O procedure after some milli-seconds.")} (-> Nat (IO Any) (IO Any)) (with_expansions [<jvm> (as_is (let [runnable (ffi.object [] [java/lang/Runnable] [] @@ -141,8 +143,10 @@ ## Default (as_is (exception: #export cannot_continue_running_threads) - + + ## https://en.wikipedia.org/wiki/Event_loop (def: #export run! + {#.doc (doc "Starts the event-loop.")} (IO Any) (loop [_ []] (do {! io.monad} diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index 149053230..414445ac1 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -34,8 +34,9 @@ "Otherwise, an error is raised." (pre (i.= +4 (i.+ +2 +2)) (foo +123 +456 +789)))} - (wrap (list (` (exec ((~! ..assert!) (~ (code.text (exception.construct ..pre_condition_failed test))) - (~ test)) + (wrap (list (` (exec + ((~! ..assert!) (~ (code.text (exception.construct ..pre_condition_failed test))) + (~ test)) (~ expr)))))) (syntax: #export (post test expr) @@ -47,6 +48,7 @@ (i.+ +2 +2)))} (with_gensyms [g!output] (wrap (list (` (let [(~ g!output) (~ expr)] - (exec ((~! ..assert!) (~ (code.text (exception.construct ..post_condition_failed test))) - ((~ test) (~ g!output))) + (exec + ((~! ..assert!) (~ (code.text (exception.construct ..post_condition_failed test))) + ((~ test) (~ g!output))) (~ g!output)))))))) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 4c50a0695..e2b734cae 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -41,7 +41,7 @@ (All [i o] (:let [Memory (Dictionary i o)] (-> (Memo i o) (-> [Memory i] [Memory o])))) - (let [memo (//.mixin (//.inherit ..memoization (//.from_recursive memo)))] + (let [memo (//.mixin (//.inherit ..memoization (//.of_recursive memo)))] (function (_ [memory input]) (|> input memo (state.run memory))))) @@ -50,7 +50,7 @@ "Memoized results will be re-used during recursive invocations, but cannot be accessed after the main invocation has ended.")} (All [i o] (-> (Hash i) (Memo i o) (-> i o))) - (let [memo (//.mixin (//.inherit ..memoization (//.from_recursive memo))) + (let [memo (//.mixin (//.inherit ..memoization (//.of_recursive memo))) empty (dictionary.new hash)] (|>> memo (state.run empty) product.right))) @@ -59,6 +59,6 @@ "This is useful as a test control when measuring the effect of using memoization.")} (All [i o] (-> (Hash i) (Memo i o) (-> i o))) - (let [memo (//.mixin (//.from_recursive memo)) + (let [memo (//.mixin (//.of_recursive memo)) empty (dictionary.new hash)] (|>> memo (state.run empty) product.right))) diff --git a/stdlib/source/library/lux/control/function/mixin.lux b/stdlib/source/library/lux/control/function/mixin.lux index 8c3443339..8248b2055 100644 --- a/stdlib/source/library/lux/control/function/mixin.lux +++ b/stdlib/source/library/lux/control/function/mixin.lux @@ -10,19 +10,23 @@ [monad (#+ Monad do)]]]]) (type: #export (Mixin i o) + {#.doc (doc "A function which can be mixed with others to inherit their behavior.")} (-> (-> i o) (-> i o) (-> i o))) (def: #export (mixin f) + {#.doc (doc "Given a mixin, produces a normal function.")} (All [i o] (-> (Mixin i o) (-> i o))) (function (mix input) ((f mix mix) input))) (def: #export nothing + {#.doc (doc "A mixin that does nothing and just delegates work to the next mixin.")} Mixin (function (_ delegate recur) delegate)) (def: #export (inherit parent child) + {#.doc (doc "Produces a new mixin, where the behavior of the child can make use of the behavior of the parent.")} (All [i o] (-> (Mixin i o) (Mixin i o) (Mixin i o))) (function (_ delegate recur) (parent (child delegate recur) recur))) @@ -34,6 +38,7 @@ (def: compose ..inherit)) (def: #export (advice when then) + {#.doc (doc "Only apply then mixin when the input meets some criterion.")} (All [i o] (-> (Predicate i) (Mixin i o) (Mixin i o))) (function (_ delegate recur input) (if (when input) @@ -41,6 +46,7 @@ (delegate input)))) (def: #export (before monad action) + {#.doc (doc "Executes an action before doing the main work.")} (All [! i o] (-> (Monad !) (-> i (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad @@ -48,6 +54,7 @@ (delegate input)))) (def: #export (after monad action) + {#.doc (doc "Executes an action after doing the main work.")} (All [! i o] (-> (Monad !) (-> i o (! Any)) (Mixin i (! o)))) (function (_ delegate recur input) (do monad @@ -56,9 +63,11 @@ (wrap output)))) (type: #export (Recursive i o) + {#.doc (doc "An indirectly recursive function.")} (-> (-> i o) (-> i o))) -(def: #export (from_recursive recursive) +(def: #export (of_recursive recursive) + {#.doc (doc "Transform an indirectly recursive function into a mixin.")} (All [i o] (-> (Recursive i o) (Mixin i o))) (function (_ delegate recur) (recursive recur))) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index dcc4791e1..4ceaaa61f 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -1,4 +1,5 @@ (.module: + {#.doc (.doc "Macros for implementing mutually-recursive functions.")} [library [lux (#- Definition let def:) ["." meta] @@ -54,6 +55,20 @@ (syntax: #export (let {functions (<code>.tuple (<>.some ..mutual))} body) + {#.doc (doc "Locally-defined mutually-recursive functions." + (let [(even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (dec number))) + + (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (dec number)))] + (and (even? 4) + (odd? 5))))} (case functions #.Nil (wrap (list body)) @@ -105,6 +120,19 @@ ..mutual))) (syntax: #export (def: {functions (<>.many ..definition)}) + {#.doc (doc "Globally-defined mutually-recursive functions." + (def: + [#export (even? number) + (-> Nat Bit) + (case number + 0 true + _ (odd? (dec number)))] + + [#export (odd? number) + (-> Nat Bit) + (case number + 0 false + _ (even? (dec number)))]))} (case functions #.Nil (wrap (list)) diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index fad957e27..3dc90e1d2 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -271,7 +271,7 @@ _ param] (wrap output))) -(def: #export (filter test parser) +(def: #export (only test parser) (All [s a] (-> (-> a Bit) (Parser s a) (Parser s a))) (do ..monad [output parser diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index af28caeae..ec06bec54 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- and or nat int rev list type) - [type (#+ :share)] + [type (#+ :sharing)] [abstract [hash (#+ Hash)] [monad (#+ do)]] @@ -97,7 +97,7 @@ (def: #export frac (Parser Frac) - (//\map frac.from_bits ..bits/64)) + (//\map frac.of_bits ..bits/64)) (exception: #export (invalid_tag {range Nat} {byte Nat}) (exception.report @@ -111,8 +111,8 @@ (`` (case flag (^template [<number> <tag> <parser>] [<number> (\ ! map (|>> <tag>) <parser>)]) - ((~~ (template.splice <case>+))) - _ (//.lift (exception.throw ..invalid_tag [(~~ (template.count <case>+)) flag])))))) + ((~~ (template.spliced <case>+))) + _ (//.lift (exception.throw ..invalid_tag [(~~ (template.amount <case>+)) flag])))))) (def: #export (or left right) (All [l r] (-> (Parser l) (Parser r) (Parser (| l r)))) @@ -185,16 +185,16 @@ [(def: #export (<name> valueP) (All [v] (-> (Parser v) (Parser (Row v)))) (do //.monad - [count (: (Parser Nat) - <bits>)] + [amount (: (Parser Nat) + <bits>)] (loop [index 0 - output (:share [v] - (Parser v) - valueP - - (Row v) - row.empty)] - (if (n.< count index) + output (:sharing [v] + (Parser v) + valueP + + (Row v) + row.empty)] + (if (n.< amount index) (do //.monad [value valueP] (recur (.inc index) @@ -223,7 +223,7 @@ (All [a] (-> (Hash a) (Parser a) (Parser (Set a)))) (do //.monad [raw (..list value) - #let [output (set.from_list hash raw)] + #let [output (set.of_list hash raw)] _ (//.assert (exception.construct ..set_elements_are_not_unique []) (n.= (list.size raw) (set.size output)))] diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index 34b061afc..7cacdd086 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -56,7 +56,7 @@ [[remaining raw] (any inputs)] (if (text\= reference raw) (wrap [remaining []]) - (try.fail (format "Missing token: '" reference "'")))))) + (#try.Failure (format "Missing token: '" reference "'")))))) (def: #export (somewhere cli) {#.doc "Given a parser, tries to parse it somewhere in the inputs (i.e. not necessarily parsing the immediate inputs)."} diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 12fb90dd3..0c53041b9 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -204,4 +204,4 @@ (|>> (//.and ..string) //.some ..object - (//\map (dictionary.from_list text.hash)))) + (//\map (dictionary.of_list text.hash)))) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index cfd1ab891..6d4998419 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -82,7 +82,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.from_code output)]) + (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_code output)]) _ (exception.throw ..cannot_parse [])))) @@ -148,7 +148,7 @@ (function (_ (^@ input [offset tape])) (case (/.nth offset tape) (#.Some output) - (#try.Success [input (/.from_code output)]) + (#try.Success [input (/.of_code output)]) _ (exception.throw ..cannot_parse [])))) @@ -165,7 +165,7 @@ (do //.monad [char any #let [char' (maybe.assume (/.nth 0 char))] - _ (//.assert ($_ /\compose "Character is not within range: " (/.from_code bottom) "-" (/.from_code top)) + _ (//.assert ($_ /\compose "Character is not within range: " (/.of_code bottom) "-" (/.of_code top)) (.and (n.>= bottom char') (n.<= top char')))] (wrap char))) @@ -204,7 +204,7 @@ [(exception: #export (<name> {options Text} {character Char}) (exception.report ["Options" (/.format options)] - ["Character" (/.format (/.from_code character))]))] + ["Character" (/.format (/.of_code character))]))] [character_should_be] [character_should_not_be] @@ -217,7 +217,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (let [output' (/.from_code output)] + (let [output' (/.of_code output)] (if (<modifier> (/.contains? output' options)) (#try.Success [[("lux i64 +" 1 offset) tape] output']) (exception.throw <exception> [options output]))) @@ -236,7 +236,7 @@ (function (_ [offset tape]) (case (/.nth offset tape) (#.Some output) - (let [output' (/.from_code output)] + (let [output' (/.of_code output)] (if (<modifier> (/.contains? output' options)) (#try.Success [[("lux i64 +" 1 offset) tape] {#basis offset @@ -252,7 +252,7 @@ (exception: #export (character_does_not_satisfy_predicate {character Char}) (exception.report - ["Character" (/.format (/.from_code character))])) + ["Character" (/.format (/.of_code character))])) (def: #export (satisfies p) {#.doc "Only lex characters that satisfy a predicate."} @@ -261,7 +261,7 @@ (case (/.nth offset tape) (#.Some output) (if (p output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.from_code output)]) + (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_code output)]) (exception.throw ..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 1e2c037d5..73a4a9e4e 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -153,20 +153,20 @@ (All [a] (-> (Parser a) (Parser a))) (do //.monad [headT ..any] - (let [members (<flattener> (type.un_name headT))] + (let [members (<flattener> (type.anonymous headT))] (if (n.> 1 (list.size members)) (local members poly) (//.fail (exception.construct <exception> headT))))))] - [variant type.flatten_variant #.Sum ..not_variant] - [tuple type.flatten_tuple #.Product ..not_tuple] + [variant type.flat_variant #.Sum ..not_variant] + [tuple type.flat_tuple #.Product ..not_tuple] ) (def: polymorphic' (Parser [Nat Type]) (do //.monad [headT any - #let [[num_arg bodyT] (type.flatten_univ_q (type.un_name headT))]] + #let [[num_arg bodyT] (type.flat_univ_q (type.anonymous headT))]] (if (n.= 0 num_arg) (//.fail (exception.construct ..not_polymorphic headT)) (wrap [num_arg bodyT])))) @@ -212,17 +212,17 @@ (All [i o] (-> (Parser i) (Parser o) (Parser [i o]))) (do //.monad [headT any - #let [[inputsT outputT] (type.flatten_function (type.un_name headT))]] + #let [[inputsT outputT] (type.flat_function (type.anonymous headT))]] (if (n.> 0 (list.size inputsT)) (//.and (local inputsT in_poly) (local (list outputT) out_poly)) (//.fail (exception.construct ..not_function headT))))) -(def: #export (apply poly) +(def: #export (applied poly) (All [a] (-> (Parser a) (Parser a))) (do //.monad [headT any - #let [[funcT paramsT] (type.flatten_application (type.un_name headT))]] + #let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] (if (n.= 0 (list.size paramsT)) (//.fail (exception.construct ..not_application headT)) (..local (#.Cons funcT paramsT) poly)))) @@ -310,7 +310,7 @@ (All [a] (-> (Parser a) (Parser [Code a]))) (do {! //.monad} [headT any] - (case (type.un_name headT) + (case (type.anonymous headT) (^ (#.Apply (|nothing|) (#.UnivQ _ headT'))) (do ! [[recT _ output] (|> poly @@ -327,10 +327,10 @@ (do //.monad [env ..env headT any] - (case (type.un_name headT) + (case (type.anonymous headT) (^multi (^ (#.Apply (|nothing|) (#.Parameter funcT_idx))) (n.= 0 (adjusted_idx env funcT_idx)) - [(dictionary.get 0 env) (#.Some [self_type self_call])]) + {(dictionary.get 0 env) (#.Some [self_type self_call])}) (wrap self_call) _ @@ -340,7 +340,7 @@ (Parser Code) (do {! //.monad} [env ..env - [funcT argsT] (..apply (//.and any (//.many any))) + [funcT argsT] (..applied (//.and any (//.many any))) _ (local (list funcT) (..parameter! 0)) allC (let [allT (list& funcT argsT)] (|> allT diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 86f9cb7a1..f004f109e 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -35,7 +35,7 @@ (def: deadline (Parser Date) ($_ <>.either - (<>\map (|>> instant.from_millis instant.date) + (<>\map (|>> instant.of_millis instant.date) <c>.int) (do <>.monad [raw <c>.text] diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 013553b04..77adf79f0 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -40,8 +40,7 @@ (#Failure msg)) (#Failure msg) - (#Failure msg)) - )) + (#Failure msg)))) (implementation: #export monad (Monad Try) @@ -77,7 +76,7 @@ (#Success Mea) Mea)))) -(def: #export (lift monad) +(def: #export (lifted monad) (All [M a] (-> (Monad M) (-> (M a) (M (Try a))))) (\ monad map (\ ..monad wrap))) @@ -96,15 +95,7 @@ false ))) -(def: #export (succeed value) - (All [a] (-> a (Try a))) - (#Success value)) - -(def: #export (fail message) - (-> Text Try) - (#Failure message)) - -(def: #export (assume try) +(def: #export (assumed try) (All [a] (-> (Try a) a)) (case try (#Success value) @@ -113,7 +104,7 @@ (#Failure message) (error! message))) -(def: #export (to_maybe try) +(def: #export (maybe try) (All [a] (-> (Try a) (Maybe a))) (case try (#Success value) @@ -122,7 +113,7 @@ (#Failure message) #.None)) -(def: #export (from_maybe maybe) +(def: #export (of_maybe maybe) (All [a] (-> (Maybe a) (Try a))) (case maybe (#.Some value) @@ -130,7 +121,7 @@ #.None (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode) - (name_of ..from_maybe)))))) + (name_of ..of_maybe)))))) (macro: #export (default tokens compiler) {#.doc (doc "Allows you to provide a default value that will be used" diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 66a3abb6e..ac34275aa 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -267,7 +267,7 @@ (new arr_size) (list.indices arr_size)))) -(def: #export (from_list xs) +(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)]) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 6768d2155..5c740b072 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -627,7 +627,7 @@ (All [k v] (-> (Dictionary k v) (List [k v]))) (|>> product.right ..entries')) -(def: #export (from_list Hash<k> kvs) +(def: #export (of_list Hash<k> kvs) (All [k v] (-> (Hash k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [k v] dict) (..put k v dict)) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 5c8b82ebd..15d7f8077 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -158,7 +158,7 @@ #Red (case (get@ #left self) (^multi (#.Some left) - [(get@ #color left) #Red]) + {(get@ #color left) #Red}) (red (get@ #key self) (get@ #value self) (#.Some (blacken left)) @@ -170,7 +170,7 @@ _ (case (get@ #right self) (^multi (#.Some right) - [(get@ #color right) #Red]) + {(get@ #color right) #Red}) (red (get@ #key right) (get@ #value right) (#.Some (black (get@ #key self) @@ -200,7 +200,7 @@ #Red (case (get@ #right self) (^multi (#.Some right) - [(get@ #color right) #Red]) + {(get@ #color right) #Red}) (red (get@ #key self) (get@ #value self) (#.Some (black (get@ #key parent) @@ -212,7 +212,7 @@ _ (case (get@ #left self) (^multi (#.Some left) - [(get@ #color left) #Red]) + {(get@ #color left) #Red}) (red (get@ #key left) (get@ #value left) (#.Some (black (get@ #key parent) @@ -284,18 +284,18 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^multi (#.Some left) - [(get@ #color left) #Red] - [(get@ #left left) (#.Some left>>left)] - [(get@ #color left>>left) #Red]) + {(get@ #color left) #Red} + {(get@ #left left) (#.Some left>>left)} + {(get@ #color left>>left) #Red}) (red (get@ #key left) (get@ #value left) (#.Some (blacken left>>left)) (#.Some (black key value (get@ #right left) ?right))) (^multi (#.Some left) - [(get@ #color left) #Red] - [(get@ #right left) (#.Some left>>right)] - [(get@ #color left>>right) #Red]) + {(get@ #color left) #Red} + {(get@ #right left) (#.Some left>>right)} + {(get@ #color left>>right) #Red}) (red (get@ #key left>>right) (get@ #value left>>right) (#.Some (black (get@ #key left) @@ -313,18 +313,18 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^multi (#.Some right) - [(get@ #color right) #Red] - [(get@ #right right) (#.Some right>>right)] - [(get@ #color right>>right) #Red]) + {(get@ #color right) #Red} + {(get@ #right right) (#.Some right>>right)} + {(get@ #color right>>right) #Red}) (red (get@ #key right) (get@ #value right) (#.Some (black key value ?left (get@ #left right))) (#.Some (blacken right>>right))) (^multi (#.Some right) - [(get@ #color right) #Red] - [(get@ #left right) (#.Some right>>left)] - [(get@ #color right>>left) #Red]) + {(get@ #color right) #Red} + {(get@ #left right) (#.Some right>>left)} + {(get@ #color right>>left) #Red}) (red (get@ #key right>>left) (get@ #value right>>left) (#.Some (black key value ?left (get@ #left right>>left))) @@ -340,19 +340,19 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left (^multi (#.Some left) - [(get@ #color left) #Red]) + {(get@ #color left) #Red}) (red key value (#.Some (blacken left)) ?right) _ (case ?right (^multi (#.Some right) - [(get@ #color right) #Black]) + {(get@ #color right) #Black}) (right_balance key value ?left (#.Some (redden right))) (^multi (#.Some right) - [(get@ #color right) #Red] - [(get@ #left right) (#.Some right>>left)] - [(get@ #color right>>left) #Black]) + {(get@ #color right) #Red} + {(get@ #left right) (#.Some right>>left)} + {(get@ #color right>>left) #Black}) (red (get@ #key right>>left) (get@ #value right>>left) (#.Some (black key value ?left (get@ #left right>>left))) @@ -369,19 +369,19 @@ (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right (^multi (#.Some right) - [(get@ #color right) #Red]) + {(get@ #color right) #Red}) (red key value ?left (#.Some (blacken right))) _ (case ?left (^multi (#.Some left) - [(get@ #color left) #Black]) + {(get@ #color left) #Black}) (left_balance key value (#.Some (redden left)) ?right) (^multi (#.Some left) - [(get@ #color left) #Red] - [(get@ #right left) (#.Some left>>right)] - [(get@ #color left>>right) #Black]) + {(get@ #color left) #Red} + {(get@ #right left) (#.Some left>>right)} + {(get@ #color left>>right) #Black}) (red (get@ #key left>>right) (get@ #value left>>right) (#.Some (left_balance (get@ #key left) @@ -500,7 +500,7 @@ (if go_left? (case (get@ #left root) (^multi (#.Some left) - [(get@ #color left) #Black]) + {(get@ #color left) #Black}) [(#.Some (balance_left_remove root_key root_val side_outcome (get@ #right root))) #0] @@ -509,7 +509,7 @@ #0]) (case (get@ #right root) (^multi (#.Some right) - [(get@ #color right) #Black]) + {(get@ #color right) #Black}) [(#.Some (balance_right_remove root_key root_val (get@ #left root) side_outcome)) #0] @@ -538,7 +538,7 @@ #.None dict)) -(def: #export (from_list Order<l> list) +(def: #export (of_list Order<l> list) (All [k v] (-> (Order k) (List [k v]) (Dictionary k v))) (list\fold (function (_ [key value] dict) (put key value dict)) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 166b4c87b..7ef0d0e31 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -50,7 +50,7 @@ #.Nil xs)) -(def: #export (filter keep? xs) +(def: #export (only keep? xs) (All [a] (-> (Predicate a) (List a) (List a))) (case xs @@ -59,8 +59,8 @@ (#.Cons x xs') (if (keep? x) - (#.Cons x (filter keep? xs')) - (filter keep? xs')))) + (#.Cons x (only keep? xs')) + (only keep? xs')))) (def: #export (partition satisfies? list) {#.doc "Divide the list into all elements that satisfy a predicate, and all elements that do not."} diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index cb4d9106f..e107fd98d 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -20,7 +20,7 @@ {#front (list) #rear (list)}) -(def: #export (from_list entries) +(def: #export (of_list entries) (All [a] (-> (List a) (Queue a))) {#front entries #rear (list)}) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index d044a5023..0b25c11fe 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -42,8 +42,8 @@ (All [a] (-> (Queue a) (Maybe a))) (do maybe.monad [tree (:representation queue)] - (tree.search (n.= (tree.tag tree)) - tree))) + (tree.one (n.= (tree.tag tree)) + tree))) (def: #export (size queue) (All [a] (-> (Queue a) Nat)) diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 0bb304c35..69be85a21 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -344,7 +344,7 @@ (list\compose (to_list' (#Hierarchy (get@ #root row))) (to_list' (#Base (get@ #tail row))))) -(def: #export from_list +(def: #export of_list (All [a] (-> (List a) (Row a))) (list\fold ..add ..empty)) @@ -359,7 +359,7 @@ (syntax: #export (row {elems (p.some s.any)}) {#.doc (doc "Row literals." (row +10 +20 +30 +40))} - (wrap (list (` (..from_list (list (~+ elems))))))) + (wrap (list (` (..of_list (list (~+ elems))))))) (implementation: (node_equivalence Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Node a)))) diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index a7fa5cb75..10bbfa9d0 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -103,19 +103,20 @@ (let [[next x] (step init)] (//.pending [x (unfold step next)]))) -(def: #export (filter predicate sequence) +(def: #export (only predicate sequence) (All [a] (-> (-> a Bit) (Sequence a) (Sequence a))) (let [[head tail] (//.run sequence)] (if (predicate head) - (//.pending [head (filter predicate tail)]) - (filter predicate tail)))) + (//.pending [head (only predicate tail)]) + (only predicate tail)))) (def: #export (partition left? xs) {#.doc (doc "Split a sequence in two based on a predicate." "The left side contains all entries for which the predicate is #1." "The right side contains all entries for which the predicate is #0.")} (All [a] (-> (-> a Bit) (Sequence a) [(Sequence a) (Sequence a)])) - [(filter left? xs) (filter (bit.complement left?) xs)]) + [(..only left? xs) + (..only (bit.complement left?) xs)]) (implementation: #export functor (Functor Sequence) diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux index 0ae6cee25..27049802d 100644 --- a/stdlib/source/library/lux/data/collection/set.lux +++ b/stdlib/source/library/lux/data/collection/set.lux @@ -88,7 +88,7 @@ (All [a] (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: #export (from_list hash elements) +(def: #export (of_list hash elements) (All [a] (-> (Hash a) (List a) (Set a))) (list\fold ..add (..new hash) elements)) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index efd266c18..c078c4df1 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -108,7 +108,7 @@ (let [(^@ set [hash _]) (:representation set)] (|> set dictionary.keys - (//.from_list hash)))) + (//.of_list hash)))) (implementation: #export equivalence (All [a] (Equivalence (Set a))) @@ -144,14 +144,14 @@ (All [a] (-> (Set a) Bit)) (|>> ..size (n.= 0))) -(def: #export (from_list hash subject) +(def: #export (of_list hash subject) (All [a] (-> (Hash a) (List a) (Set a))) (list\fold (..add 1) (..new hash) subject)) -(def: #export (from_set subject) +(def: #export (of_set subject) (All [a] (-> (//.Set a) (Set a))) - (..from_list (//.member_hash subject) - (//.to_list subject))) + (..of_list (//.member_hash subject) + (//.to_list subject))) (def: #export super? (All [a] (-> (Set a) (Set a) Bit)) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index b61bfb546..e53e3398e 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -46,7 +46,7 @@ (All [a] (-> (Set a) (List a))) (|>> :representation /.keys)) - (def: #export (from_list &order list) + (def: #export (of_list &order list) (All [a] (-> (Order a) (List a) (Set a))) (list\fold add (..new &order) list)) @@ -57,14 +57,14 @@ (def: #export (intersection left right) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..to_list right) - (list.filter (..member? left)) - (..from_list (get@ #/.&order (:representation right))))) + (list.only (..member? left)) + (..of_list (get@ #/.&order (:representation right))))) (def: #export (difference param subject) (All [a] (-> (Set a) (Set a) (Set a))) (|> (..to_list subject) - (list.filter (|>> (..member? param) not)) - (..from_list (get@ #/.&order (:representation subject))))) + (list.only (|>> (..member? param) not)) + (..of_list (get@ #/.&order (:representation subject))))) (implementation: #export equivalence (All [a] (Equivalence (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 a3b1be634..1e986da40 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -79,7 +79,7 @@ (list\compose (values left) (values right)))) - (def: #export (search predicate tree) + (def: #export (one predicate tree) (All [@ t v] (-> (Predicate t) (Tree @ t v) (Maybe v))) (let [[monoid tag root] (:representation tree)] (if (predicate tag) @@ -98,9 +98,9 @@ #.None))) ) -(def: #export (found? predicate tree) +(def: #export (exists? predicate tree) (All [@ t v] (-> (Predicate t) (Tree @ t v) Bit)) - (case (..search predicate tree) + (case (..one predicate tree) (#.Some _) true diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 72847c91d..5e6f20eb6 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -51,7 +51,7 @@ (abstract: #export Color RGB - (def: #export (from_rgb [red green blue]) + (def: #export (of_rgb [red green blue]) (-> RGB Color) (:abstraction {#red (n.% ..rgb red) #green (n.% ..rgb green) @@ -84,14 +84,14 @@ b)))) (def: #export black - (..from_rgb {#red 0 - #green 0 - #blue 0})) + (..of_rgb {#red 0 + #green 0 + #blue 0})) (def: #export white - (..from_rgb {#red ..top - #green ..top - #blue ..top})) + (..of_rgb {#red ..top + #green ..top + #blue ..top})) (implementation: #export addition (Monoid Color) @@ -183,23 +183,23 @@ ## else p))) -(def: #export (from_hsl [hue saturation luminance]) +(def: #export (of_hsl [hue saturation luminance]) (-> HSL Color) (if (f.= +0.0 saturation) ## Achromatic (let [intensity (..up luminance)] - (from_rgb {#red intensity - #green intensity - #blue intensity})) + (of_rgb {#red intensity + #green intensity + #blue intensity})) ## Chromatic (let [q (if (f.< +0.5 luminance) (|> saturation (f.+ +1.0) (f.* luminance)) (|> luminance (f.+ saturation) (f.- (f.* saturation luminance)))) p (|> luminance (f.* +2.0) (f.- q)) third (|> +1.0 (f./ +3.0))] - (from_rgb {#red (..up (|> hue (f.+ third) (hue_to_rgb p q))) - #green (..up (|> hue (hue_to_rgb p q))) - #blue (..up (|> hue (f.- third) (hue_to_rgb p q)))})))) + (of_rgb {#red (..up (|> hue (f.+ third) (hue_to_rgb p q))) + #green (..up (|> hue (hue_to_rgb p q))) + #blue (..up (|> hue (f.- third) (hue_to_rgb p q)))})))) (def: #export (to_hsb color) (-> Color HSB) @@ -233,7 +233,7 @@ saturation brightness])))) -(def: #export (from_hsb [hue saturation brightness]) +(def: #export (of_hsb [hue saturation brightness]) (-> HSB Color) (let [hue (|> hue (f.* +6.0)) i (math.floor hue) @@ -246,9 +246,9 @@ red (case mod 0 v 1 q 2 p 3 p 4 t 5 v _ (undefined)) green (case mod 0 t 1 v 2 v 3 q 4 p 5 p _ (undefined)) blue (case mod 0 p 1 p 2 t 3 v 4 v 5 q _ (undefined))] - (from_rgb {#red (..up red) - #green (..up green) - #blue (..up blue)}))) + (of_rgb {#red (..up red) + #green (..up green) + #blue (..up blue)}))) (def: #export (to_cmyk color) (-> Color CMYK) @@ -268,21 +268,21 @@ #yellow yellow #key key})) -(def: #export (from_cmyk [cyan magenta yellow key]) +(def: #export (of_cmyk [cyan magenta yellow key]) (-> CMYK Color) (if (f.= +1.0 key) - (from_rgb {#red 0 - #green 0 - #blue 0}) + (of_rgb {#red 0 + #green 0 + #blue 0}) (let [red (|> (|> +1.0 (f.- cyan)) (f.* (|> +1.0 (f.- key)))) green (|> (|> +1.0 (f.- magenta)) (f.* (|> +1.0 (f.- key)))) blue (|> (|> +1.0 (f.- yellow)) (f.* (|> +1.0 (f.- key))))] - (from_rgb {#red (..up red) - #green (..up green) - #blue (..up blue)})))) + (of_rgb {#red (..up red) + #green (..up green) + #blue (..up blue)})))) (def: (normalize ratio) (-> Frac Frac) @@ -307,9 +307,9 @@ .nat))) [redS greenS blueS] (to_rgb start) [redE greenE blueE] (to_rgb end)] - (from_rgb {#red (interpolate' redE redS) - #green (interpolate' greenE greenS) - #blue (interpolate' blueE blueS)}))) + (of_rgb {#red (interpolate' redE redS) + #green (interpolate' greenE greenS) + #blue (interpolate' blueE blueS)}))) (template [<name> <target>] [(def: #export (<name> ratio color) @@ -324,11 +324,11 @@ [(def: #export (<name> ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (to_hsl color)] - (from_hsl [hue - (|> saturation - (f.* (|> +1.0 (<op> (..normalize ratio)))) - (f.min +1.0)) - luminance])))] + (of_hsl [hue + (|> saturation + (f.* (|> +1.0 (<op> (..normalize ratio)))) + (f.min +1.0)) + luminance])))] [saturate f.+] [de_saturate f.-] @@ -337,21 +337,21 @@ (def: #export (gray_scale color) (-> Color Color) (let [[_ _ luminance] (to_hsl color)] - (from_hsl [+0.0 - +0.0 - luminance]))) + (of_hsl [+0.0 + +0.0 + luminance]))) (template [<name> <1> <2>] [(def: #export (<name> color) (-> Color [Color Color Color]) (let [[hue saturation luminance] (to_hsl color)] [color - (from_hsl [(|> hue (f.+ <1>) ..normalize) - saturation - luminance]) - (from_hsl [(|> hue (f.+ <2>) ..normalize) - saturation - luminance])]))] + (of_hsl [(|> hue (f.+ <1>) ..normalize) + saturation + luminance]) + (of_hsl [(|> hue (f.+ <2>) ..normalize) + saturation + luminance])]))] [triad (|> +1.0 (f./ +3.0)) (|> +2.0 (f./ +3.0))] [clash (|> +1.0 (f./ +4.0)) (|> +3.0 (f./ +4.0))] @@ -363,15 +363,15 @@ (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (to_hsb color)] [color - (from_hsb [(|> hue (f.+ <1>) ..normalize) - saturation - luminance]) - (from_hsb [(|> hue (f.+ <2>) ..normalize) - saturation - luminance]) - (from_hsb [(|> hue (f.+ <3>) ..normalize) - saturation - luminance])]))] + (of_hsb [(|> hue (f.+ <1>) ..normalize) + saturation + luminance]) + (of_hsb [(|> hue (f.+ <2>) ..normalize) + saturation + luminance]) + (of_hsb [(|> hue (f.+ <3>) ..normalize) + saturation + luminance])]))] [square (|> +1.0 (f./ +4.0)) (|> +2.0 (f./ +4.0)) (|> +3.0 (f./ +4.0))] [tetradic (|> +2.0 (f./ +12.0)) (|> +6.0 (f./ +12.0)) (|> +8.0 (f./ +12.0))] @@ -388,9 +388,9 @@ (let [[hue saturation brightness] (to_hsb color) spread (..normalize spread)] (list\map (function (_ idx) - (from_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normalize) - saturation - brightness])) + (of_hsb [(|> idx inc .int int.frac (f.* spread) (f.+ hue) ..normalize) + saturation + brightness])) (list.indices variations)))) (def: #export (monochromatic spread variations color) @@ -403,7 +403,7 @@ (f.+ brightness) ..normalize [hue saturation] - from_hsb))))) + of_hsb))))) (type: #export Alpha Rev) diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux index a9a9ab4ab..8eb01d331 100644 --- a/stdlib/source/library/lux/data/color/named.lux +++ b/stdlib/source/library/lux/data/color/named.lux @@ -8,9 +8,9 @@ (template [<red> <green> <blue> <name>] [(def: #export <name> Color - (//.from_rgb {#//.red (hex <red>) - #//.green (hex <green>) - #//.blue (hex <blue>)}))] + (//.of_rgb {#//.red (hex <red>) + #//.green (hex <green>) + #//.blue (hex <blue>)}))] ["F0" "F8" "FF" alice_blue] ["FA" "EB" "D7" antique_white] diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 7103f7d9d..c7bd7da94 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -1,7 +1,6 @@ (.module: [library [lux (#- and or nat int rev list type) - [type (#+ :share)] [abstract [monoid (#+ Monoid)] [monad (#+ Monad do)] @@ -73,7 +72,7 @@ [(n.+ <size> offset) (|> binary (<write> offset value) - try.assume)])]))] + try.assumed)])]))] [bits/8 /.size/8 binary.write/8] [bits/16 /.size/16 binary.write/16] @@ -92,7 +91,7 @@ (function (_ [offset binary]) (|> binary (binary.write/8 offset <number>) - try.assume + try.assumed [(.inc offset)] caseT))])]) ([0 #.Left left] @@ -135,7 +134,7 @@ [size (function (_ [offset binary]) [(n.+ size offset) - (try.assume + (try.assumed (binary.copy (n.min size (binary.size value)) 0 value @@ -152,7 +151,7 @@ [size' (function (_ [offset binary]) [(n.+ size' offset) - (try.assume + (try.assumed (do try.monad [_ (<write> offset size binary)] (binary.copy size 0 value (n.+ <size> offset) binary)))])]))))] @@ -185,7 +184,7 @@ original_count) value (if (n.= original_count capped_count) value - (|> value row.to_list (list.take capped_count) row.from_list)) + (|> value row.to_list (list.take capped_count) row.of_list)) (^open "specification\.") ..monoid [size mutation] (|> value (row\map valueW) @@ -195,7 +194,7 @@ specification\identity))] [(n.+ <size> size) (function (_ [offset binary]) - (try.assume + (try.assumed (do try.monad [_ (<write> offset capped_count binary)] (wrap (mutation [(n.+ <size> offset) binary])))))])))] @@ -240,7 +239,7 @@ (function (_ [offset binary]) (|> binary (binary.write/8 offset <number>) - try.assume + try.assumed [(.inc offset)] caseT))])]) ([0 #.Primitive (..and ..text (..list recur))] @@ -275,7 +274,7 @@ (function (_ [offset binary]) (|> binary (binary.write/8 offset <number>) - try.assume + try.assumed [(.inc offset)] caseT))])]) ([0 #.Bit ..bit] diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index 273ab75b8..132aea2e2 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -68,15 +68,15 @@ (Property <brand>) (:abstraction <property>))] - (~~ (template.splice <alias>+)))) - - (with-expansions [<rows> (template.splice <property>+)] - (template [<property>] - [(`` (def: #export (~~ (text-identifier <property>)) - (Property <brand>) - (:abstraction <property>)))] - - <rows>))] + (~~ (template.spliced <alias>+)))) + + (with-expansions [<rows> (template.spliced <property>+)] + (template [<property>] + [(`` (def: #export (~~ (text-identifier <property>)) + (Property <brand>) + (:abstraction <property>)))] + + <rows>))] [All [] diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index 2a0210f7a..36f9b7796 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -65,7 +65,7 @@ <combinator> (:representation right))))] - (~~ (template.splice <combinator>+))))] + (~~ (template.spliced <combinator>+))))] [Can-Chain (Generic Any) Can-Chain [["" and]]] @@ -107,7 +107,7 @@ (Selector Can-Chain) (:abstraction <pseudo>))] - (~~ (template.splice <pseudo>+))))] + (~~ (template.spliced <pseudo>+))))] [Can-Chain [[active ":active"] diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index f85272a04..5c6e575ed 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -28,8 +28,8 @@ [// [selector (#+ Label)]]) -(syntax: (text-identifier {identifier s.text}) - (wrap (list (code.local-identifier identifier)))) +(syntax: (text_identifier {identifier s.text}) + (wrap (list (code.local_identifier (text.replace_all "-" "_" identifier))))) (template: (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+) (abstract: #export <abstraction> @@ -42,10 +42,10 @@ (`` (template [<name> <value>] [(def: #export <name> <abstraction> (:abstraction <value>))] - (~~ (template.splice <sample>+)) + (~~ (template.spliced <sample>+)) )) - (template.splice <definition>+))) + (template.spliced <definition>+))) (template: (multi: <multi> <type> <separator>) (def: #export (<multi> pre post) @@ -84,11 +84,11 @@ (Value <brand>) (:abstraction <value>))] - (~~ (template.splice <alias>+)))) + (~~ (template.spliced <alias>+)))) - (with-expansions [<rows> (template.splice <value>+)] + (with_expansions [<rows> (template.spliced <value>+)] (template [<value>] - [(`` (def: #export (~~ (text-identifier <value>)) + [(`` (def: #export (~~ (..text_identifier <value>)) (Value <brand>) (:abstraction <value>)))] @@ -117,11 +117,11 @@ ["thick"]]] [Slice - [[full-slice "fill"]] + [[full_slice "fill"]] []] [Alignment - [[auto-alignment "auto"]] + [[auto_alignment "auto"]] [["stretch"] ["center"] ["flex-start"] @@ -134,24 +134,24 @@ [] []] - [Animation-Direction - [[normal-direction "normal"]] + [Animation_Direction + [[normal_direction "normal"]] [["reverse"] ["alternate"] ["alternate-reverse"]]] - [Animation-Fill - [[fill-forwards "forwards"] - [fill-backwards "backwards"] - [fill-both "both"]] + [Animation_Fill + [[fill_forwards "forwards"] + [fill_backwards "backwards"] + [fill_both "both"]] []] - [Column-Fill + [Column_Fill [] [["balance"] ["auto"]]] - [Column-Span + [Column_Span [] [["all"]]] @@ -180,17 +180,17 @@ [Visibility [[invisible "hidden"] - [collapse-visibility "collapse"]] + [collapse_visibility "collapse"]] [["visible"]]] [Attachment - [[scroll-attachment "scroll"] - [fixed-attachment "fixed"] - [local-attachment "local"]] + [[scroll_attachment "scroll"] + [fixed_attachment "fixed"] + [local_attachment "local"]] []] [Blend - [[normal-blend "normal"]] + [[normal_blend "normal"]] [["multiply"] ["screen"] ["overlay"] @@ -212,11 +212,11 @@ ["content-box"]]] [Image - [[no-image "none"]] + [[no_image "none"]] []] [Repeat - [[stretch-repeat "stretch"]] + [[stretch_repeat "stretch"]] [["repeat"] ["repeat-x"] ["repeat-y"] @@ -225,19 +225,19 @@ ["round"]]] [Location - [[left-top "left top"] - [left-center "left center"] - [left-bottom "left bottom"] - [right-top "right top"] - [right-center "right center"] - [right-bottom "right bottom"] - [center-top "center top"] - [center-center "center center"] - [center-bottom "center bottom"]] + [[left_top "left top"] + [left_center "left center"] + [left_bottom "left bottom"] + [right_top "right top"] + [right_center "right center"] + [right_bottom "right bottom"] + [center_top "center top"] + [center_center "center center"] + [center_bottom "center bottom"]] []] [Fit - [[no-fit "none"]] + [[no_fit "none"]] [["fill"] ["cover"] ["contain"] @@ -260,7 +260,7 @@ [["separate"] ["collapse"]]] - [Box-Decoration-Break + [Box_Decoration_Break [] [["slice"] ["clone"]]] @@ -271,14 +271,14 @@ ["bottom"]]] [Float - [[float-left "left"] - [float-right "right"]] + [[float_left "left"] + [float_right "right"]] []] [Clear - [[clear-left "left"] - [clear-right "right"] - [clear-both "both"]] + [[clear_left "left"] + [clear_right "right"] + [clear_both "both"]] []] [Counter @@ -293,8 +293,8 @@ ["no-close-quote"]]] [Cursor - [[horizontal-text "text"] - [no-cursor "none"]] + [[horizontal_text "text"] + [no_cursor "none"]] [["alias"] ["all-scroll"] ["cell"] @@ -337,14 +337,14 @@ [] []] - [Text-Direction - [[left-to-right "ltr"] - [right-to-left "rtl"]] + [Text_Direction + [[left_to_right "ltr"] + [right_to_left "rtl"]] []] [Display - [[grid-display "grid"] - [no-display "none"]] + [[grid_display "grid"] + [no_display "none"]] [["inline"] ["block"] ["contents"] @@ -374,38 +374,38 @@ [] []] - [Flex-Direction + [Flex_Direction [] [["row"] ["row-reverse"] ["column"] ["column-reverse"]]] - [Flex-Wrap - [[no-wrap "nowrap"]] + [Flex_Wrap + [[no_wrap "nowrap"]] [["wrap"] - ["wrap-reverse"]]] + ["wrap_reverse"]]] - [Font-Kerning - [[auto-kerning "auto"] - [normal-kerning "normal"] - [no-kerning "none"]] + [Font_Kerning + [[auto_kerning "auto"] + [normal_kerning "normal"] + [no_kerning "none"]] []] - [Font-Size - [[medium-size "medium"] - [xx-small-size "xx-small"] - [x-small-size "x-small"] - [small-size "small"] - [large-size "large"] - [x-large-size "x-large"] - [xx-large-size "xx-large"] - [smaller-size "smaller"] - [larger-size "larger"]] + [Font_Size + [[medium_size "medium"] + [xx_small_size "xx-small"] + [x_small_size "x-small"] + [small_size "small"] + [large_size "large"] + [x_large_size "x-large"] + [xx_large_size "xx-large"] + [smaller_size "smaller"] + [larger_size "larger"]] []] - [Font-Stretch - [[normal-stretch "normal"]] + [Font_Stretch + [[normal_stretch "normal"]] [["condensed"] ["ultra-condensed"] ["extra-condensed"] @@ -415,64 +415,64 @@ ["extra-expanded"] ["ultra-expanded"]]] - [Font-Style - [[normal-style "normal"]] + [Font_Style + [[normal_style "normal"]] [["italic"] ["oblique"]]] - [Font-Weight - [[normal-weight "normal"] - [weight-100 "100"] - [weight-200 "200"] - [weight-300 "300"] - [weight-400 "400"] - [weight-500 "500"] - [weight-600 "600"] - [weight-700 "700"] - [weight-800 "800"] - [weight-900 "900"]] + [Font_Weight + [[normal_weight "normal"] + [weight_100 "100"] + [weight_200 "200"] + [weight_300 "300"] + [weight_400 "400"] + [weight_500 "500"] + [weight_600 "600"] + [weight_700 "700"] + [weight_800 "800"] + [weight_900 "900"]] [["bold"]]] - [Font-Variant - [[normal-font "normal"]] + [Font_Variant + [[normal_font "normal"]] [["small-caps"]]] [Grid [] []] - [Grid-Content - [[auto-content "auto"]] + [Grid_Content + [[auto_content "auto"]] [["max-content"] ["min-content"]]] - [Grid-Flow - [[row-flow "row"] - [column-flow "column"] - [dense-flow "dense"] - [row-dense-flow "row dense"] - [column-dense-flow "column dense"]] + [Grid_Flow + [[row_flow "row"] + [column_flow "column"] + [dense_flow "dense"] + [row_dense_flow "row dense"] + [column_dense_flow "column dense"]] []] - [Grid-Span - [[auto-span "auto"]] + [Grid_Span + [[auto_span "auto"]] []] - [Grid-Template + [Grid_Template [] []] - [Hanging-Punctuation - [[no-hanging-punctuation "none"]] + [Hanging_Punctuation + [[no_hanging_punctuation "none"]] [["first"] ["last"] ["allow-end"] ["force-end"]]] [Hyphens - [[no-hyphens "none"] - [manual-hyphens "manual"] - [auto-hyphens "auto"]] + [[no_hyphens "none"] + [manual_hyphens "manual"] + [auto_hyphens "auto"]] []] [Orientation @@ -495,55 +495,55 @@ []] [Update - [[no-update "none"] - [slow-update "slow"] - [fast-update "fast"]] + [[no_update "none"] + [slow_update "slow"] + [fast_update "fast"]] []] - [Block-Overflow - [[no-block-overflow "none"] - [scroll-block-overflow "scroll"] - [optional-paged-block-overflow "optional-paged"] - [paged-block-overflow "paged"]] + [Block_Overflow + [[no_block_overflow "none"] + [scroll_block_overflow "scroll"] + [optional_paged_block_overflow "optional-paged"] + [paged_block_overflow "paged"]] []] - [Inline-Overflow - [[no-inline-overflow "none"] - [scroll-inline-overflow "scroll"]] + [Inline_Overflow + [[no_inline_overflow "none"] + [scroll_inline_overflow "scroll"]] []] - [Display-Mode + [Display_Mode [] [["fullscreen"] ["standalone"] ["minimal-ui"] ["browser"]]] - [Color-Gamut + [Color_Gamut [] [["srgb"] ["p3"] ["rec2020"]]] - [Inverted-Colors - [[no-inverted-colors "none"] - [inverted-colors "inverted"]] + [Inverted_Colors + [[no_inverted_colors "none"] + [inverted_colors "inverted"]] []] [Pointer - [[no-pointer "none"] - [coarse-pointer "coarse"] - [fine-pointer "fine"]] + [[no_pointer "none"] + [coarse_pointer "coarse"] + [fine_pointer "fine"]] []] [Hover - [[no-hover "none"]] + [[no_hover "none"]] [["hover"]]] [Light - [[dim-light "dim"] - [normal-light "normal"] - [washed-light "washed"]] + [[dim_light "dim"] + [normal_light "normal"] + [washed_light "washed"]] []] [Ratio @@ -551,33 +551,33 @@ []] [Scripting - [[no-scripting "none"] - [initial-scripting-only "initial-only"] - [scripting-enabled "enabled"]] + [[no_scripting "none"] + [initial_scripting_only "initial-only"] + [scripting_enabled "enabled"]] []] [Motion - [[no-motion-preference "no-preference"] - [reduced-motion "reduce"]] + [[no_motion_preference "no-preference"] + [reduced_motion "reduce"]] []] - [Color-Scheme - [[no-color-scheme-preference "no-preference"] - [light-color-scheme "light"] - [dark-color-scheme "dark"]] + [Color_Scheme + [[no_color_scheme_preference "no-preference"] + [light_color_scheme "light"] + [dark_color_scheme "dark"]] []] [Isolation - [[auto-isolation "auto"]] + [[auto_isolation "auto"]] [["isolate"]]] - [List-Style-Position + [List_Style_Position [] [["inside"] ["outside"]]] - [List-Style-Type - [[no-list-style "none"]] + [List_Style_Type + [[no_list_style "none"]] [["disc"] ["armenian"] ["circle"] @@ -605,23 +605,23 @@ []] [Overflow - [[visible-overflow "visible"] - [hidden-overflow "hidden"] - [scroll-overflow "scroll"] - [auto-overflow "auto"]] + [[visible_overflow "visible"] + [hidden_overflow "hidden"] + [scroll_overflow "scroll"] + [auto_overflow "auto"]] []] - [Page-Break - [[auto-page-break "auto"] - [always-page-break "always"] - [avoid-page-break "avoid"] - [left-page-break "left"] - [right-page-break "right"]] + [Page_Break + [[auto_page_break "auto"] + [always_page_break "always"] + [avoid_page_break "avoid"] + [left_page_break "left"] + [right_page_break "right"]] []] - [Pointer-Events - [[auto-pointer-events "auto"] - [no-pointer-events "none"]] + [Pointer_Events + [[auto_pointer_events "auto"] + [no_pointer_events "none"]] []] [Position @@ -633,156 +633,156 @@ ["sticky"]]] [Quotes - [[no-quotes "none"]] + [[no_quotes "none"]] []] [Resize - [[resize-none "none"] - [resize-both "both"] - [resize-horizontal "horizontal"] - [resize-vertical "vertical"]] + [[resize_none "none"] + [resize_both "both"] + [resize_horizontal "horizontal"] + [resize_vertical "vertical"]] []] - [Scroll-Behavior - [[auto-scroll-behavior "auto"] - [smooth-scroll-behavior "smooth"]] + [Scroll_Behavior + [[auto_scroll_behavior "auto"] + [smooth_scroll_behavior "smooth"]] []] - [Table-Layout - [[auto-table-layout "auto"] - [fixed-table-layout "fixed"]] + [Table_Layout + [[auto_table_layout "auto"] + [fixed_table_layout "fixed"]] []] - [Text-Align - [[left-text-align "left"] - [right-text-align "right"] - [center-text-align "center"] - [justify-text-align "justify"]] + [Text_Align + [[left_text_align "left"] + [right_text_align "right"] + [center_text_align "center"] + [justify_text_align "justify"]] []] - [Text-Align-Last - [[auto-text-align-last "auto"] - [left-text-align-last "left"] - [right-text-align-last "right"] - [center-text-align-last "center"] - [justify-text-align-last "justify"] - [start-text-align-last "start"] - [end-text-align-last "end"]] + [Text_Align_Last + [[auto_text_align_last "auto"] + [left_text_align_last "left"] + [right_text_align_last "right"] + [center_text_align_last "center"] + [justify_text_align_last "justify"] + [start_text_align_last "start"] + [end_text_align_last "end"]] []] - [Text-Decoration-Line - [[no-text-decoration-line "none"] - [underline-text-decoration-line "underline"] - [overline-text-decoration-line "overline"] - [line-through-text-decoration-line "line-through"]] + [Text_Decoration_Line + [[no_text_decoration_line "none"] + [underline_text_decoration_line "underline"] + [overline_text_decoration_line "overline"] + [line_through_text_decoration_line "line-through"]] []] - [Text-Decoration-Style - [[solid-text-decoration-style "solid"] - [double-text-decoration-style "double"] - [dotted-text-decoration-style "dotted"] - [dashed-text-decoration-style "dashed"] - [wavy-text-decoration-style "wavy"]] + [Text_Decoration_Style + [[solid_text_decoration_style "solid"] + [double_text_decoration_style "double"] + [dotted_text_decoration_style "dotted"] + [dashed_text_decoration_style "dashed"] + [wavy_text_decoration_style "wavy"]] []] - [Text-Justification - [[auto-text-justification "auto"] - [inter-word-text-justification "inter-word"] - [inter-character-text-justification "inter-character"] - [no-text-justification "none"]] + [Text_Justification + [[auto_text_justification "auto"] + [inter_word_text_justification "inter-word"] + [inter_character_text_justification "inter-character"] + [no_text_justification "none"]] []] - [Text-Overflow - [[clip-text-overflow "clip"] - [ellipsis-text-overflow "ellipsis"]] + [Text_Overflow + [[clip_text_overflow "clip"] + [ellipsis_text_overflow "ellipsis"]] []] - [Text-Transform - [[no-text-transform "none"]] + [Text_Transform + [[no_text_transform "none"]] [["capitalize"] ["uppercase"] ["lowercase"]]] [Transform - [[no-transform "none"]] + [[no_transform "none"]] []] - [Transform-Origin + [Transform_Origin [] []] - [Transform-Style + [Transform_Style [] [["flat"] - ["preserve-3d"]]] + ["preserve_3d"]]] [Transition - [[transition-none "none"] - [transition-all "all"]] + [[transition_none "none"] + [transition_all "all"]] []] [Bidi - [[bidi-normal "normal"] - [bidi-embed "embed"] - [bidi-isolate "isolate"] - [bidi-isolate-override "isolate-override"] - [bidi-plaintext "plaintext"]] + [[bidi_normal "normal"] + [bidi_embed "embed"] + [bidi_isolate "isolate"] + [bidi_isolate_override "isolate-override"] + [bidi_plaintext "plaintext"]] [["bidi-override"]]] - [User-Select - [[user-select-auto "auto"] - [user-select-none "none"] - [user-select-text "text"] - [user-select-all "all"]] + [User_Select + [[user_select_auto "auto"] + [user_select_none "none"] + [user_select_text "text"] + [user_select_all "all"]] []] - [Vertical-Align - [[vertical-align-baseline "baseline"] - [vertical-align-sub "sub"] - [vertical-align-super "super"] - [vertical-align-top "top"] - [vertical-align-text-top "text-top"] - [vertical-align-middle "middle"] - [vertical-align-bottom "bottom"] - [vertical-align-text-bottom "text-bottom"]] + [Vertical_Align + [[vertical_align_baseline "baseline"] + [vertical_align_sub "sub"] + [vertical_align_super "super"] + [vertical_align_top "top"] + [vertical_align_text_top "text-top"] + [vertical_align_middle "middle"] + [vertical_align_bottom "bottom"] + [vertical_align_text_bottom "text-bottom"]] []] - [White-Space - [[normal-white-space "normal"] - [no-wrap-white-space "nowrap"] - [pre-white-space "pre"] - [pre-line-white-space "pre-line"] - [pre-wrap-white-space "pre-wrap"]] + [White_Space + [[normal_white_space "normal"] + [no_wrap_white_space "nowrap"] + [pre_white_space "pre"] + [pre_line_white_space "pre-line"] + [pre_wrap_white_space "pre-wrap"]] []] - [Word-Break - [[normal-word-break "normal"]] + [Word_Break + [[normal_word_break "normal"]] [["break-all"] ["keep-all"] ["break-word"]]] - [Word-Wrap - [[normal-word-wrap "normal"] - [break-word-word-wrap "break-word"]] + [Word_Wrap + [[normal_word_wrap "normal"] + [break_word_word_wrap "break-word"]] []] - [Writing-Mode - [[top-to-bottom-writing-mode "horizontal-tb"] - [left-to-right-writing-mode "vertical-rl"] - [right-to-left-writing-mode "vertical-lr"]] + [Writing_Mode + [[top_to_bottom_writing_mode "horizontal-tb"] + [left_to_right_writing_mode "vertical-rl"] + [right_to_left_writing_mode "vertical-lr"]] []] - [Z-Index + [Z_Index [] []] ) - (def: value-separator ",") + (def: value_separator ",") (def: (apply name inputs) (-> Text (List Text) Value) (|> inputs - (text.join-with ..value-separator) + (text.join_with ..value_separator) (text.enclose ["(" ")"]) (format name) :abstraction)) @@ -797,7 +797,7 @@ (-> Nat Step (Value Timing)) (..apply "steps" (list (%.nat intervals) (..step step)))) - (def: #export (cubic-bezier p0 p1 p2 p3) + (def: #export (cubic_bezier p0 p1 p2 p3) (-> Frac Frac Frac Frac (Value Timing)) (|> (list p0 p1 p2 p3) (list\map %number) @@ -810,8 +810,8 @@ [iteration Iteration] [count Count] - [slice-number/1 Slice] - [span-line Grid-Span] + [slice_number/1 Slice] + [span_line Grid_Span] ) (def: #export animation @@ -820,7 +820,7 @@ (def: #export (rgb color) (-> color.Color (Value Color)) - (let [[red green blue] (color.to-rgb color)] + (let [[red green blue] (color.to_rgb color)] (..apply "rgb" (list (%.nat red) (%.nat green) (%.nat blue))))) @@ -828,7 +828,7 @@ (def: #export (rgba pigment) (-> color.Pigment (Value Color)) (let [(^slots [#color.color #color.alpha]) pigment - [red green blue] (color.to-rgb color)] + [red green blue] (color.to_rgb color)] (..apply "rgba" (list (%.nat red) (%.nat green) (%.nat blue) @@ -875,18 +875,18 @@ [seconds "s"] - [milli-seconds "ms"] + [milli_seconds "ms"] ) (def: #export thickness (-> (Value Length) (Value Thickness)) (|>> :transmutation)) - (def: slice-separator " ") + (def: slice_separator " ") - (def: #export (slice-number/2 horizontal vertical) + (def: #export (slice_number/2 horizontal vertical) (-> Nat Nat (Value Slice)) - (:abstraction (format (%.nat horizontal) ..slice-separator + (:abstraction (format (%.nat horizontal) ..slice_separator (%.nat vertical)))) (abstract: #export Stop @@ -896,17 +896,17 @@ (-> (Value Color) Stop) (|>> (:representation Value) (:abstraction Stop))) - (def: stop-separator " ") + (def: stop_separator " ") - (def: #export (single-stop length color) + (def: #export (single_stop length color) (-> (Value Length) (Value Color) Stop) - (:abstraction (format (:representation Value color) ..stop-separator + (:abstraction (format (:representation Value color) ..stop_separator (:representation Value length)))) - (def: #export (double-stop start end color) + (def: #export (double_stop start end color) (-> (Value Length) (Value Length) (Value Color) Stop) - (:abstraction (format (:representation Value color) ..stop-separator - (:representation Value start) ..stop-separator + (:abstraction (format (:representation Value color) ..stop_separator + (:representation Value start) ..stop_separator (:representation Value end)))) (abstract: #export Hint @@ -916,14 +916,14 @@ (-> (Value Length) Hint) (|>> (:representation Value) (:abstraction Hint))) - (def: (with-hint [hint stop]) + (def: (with_hint [hint stop]) (-> [(Maybe Hint) Stop] Text) (case hint #.None (:representation Stop stop) (#.Some hint) - (format (:representation Hint hint) ..value-separator (:representation Stop stop)))))) + (format (:representation Hint hint) ..value_separator (:representation Stop stop)))))) (type: #export (List/1 a) [a (List a)]) @@ -939,19 +939,19 @@ (-> Rev Angle) (:abstraction (format (%.rev value) "turn"))) - (def: degree-limit Nat 360) + (def: degree_limit Nat 360) (def: #export (degree value) (-> Nat Angle) - (:abstraction (format (%.nat (n.% ..degree-limit value)) "deg"))) + (:abstraction (format (%.nat (n.% ..degree_limit value)) "deg"))) (template [<degree> <name>] [(def: #export <name> Angle (..degree <degree>))] - [000 to-top] - [090 to-right] - [180 to-bottom] - [270 to-left] + [000 to_top] + [090 to_right] + [180 to_bottom] + [270 to_left] ) (template [<name> <function>] @@ -959,11 +959,11 @@ (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] (..apply <function> (list& (:representation Angle angle) - (with-hint now) - (list\map with-hint after)))))] + (with_hint now) + (list\map with_hint after)))))] - [linear-gradient "linear-gradient"] - [repeating-linear-gradient "repeating-linear-gradient"] + [linear_gradient "linear-gradient"] + [repeating_linear_gradient "repeating-linear-gradient"] ) ) @@ -974,19 +974,19 @@ (-> Percentage Text) (|>> :representation)) - (def: percentage-limit Nat (.inc 100)) + (def: percentage_limit Nat (.inc 100)) (def: #export (%% value) (-> Nat Percentage) - (:abstraction (format (%.nat (n.% percentage-limit value)) "%"))) + (:abstraction (format (%.nat (n.% percentage_limit value)) "%"))) - (def: #export slice-percent/1 + (def: #export slice_percent/1 (-> Percentage (Value Slice)) (|>> :representation (:abstraction Value))) - (def: #export (slice-percent/2 horizontal vertical) + (def: #export (slice_percent/2 horizontal vertical) (-> Percentage Percentage (Value Slice)) - (:abstraction Value (format (:representation horizontal) ..slice-separator + (:abstraction Value (format (:representation horizontal) ..slice_separator (:representation vertical)))) (template [<input> <pre> <function>+] @@ -995,12 +995,12 @@ (-> <input> (Value Filter)) (|>> <pre> (list) (..apply <function>)))] - (~~ (template.splice <function>+))))] + (~~ (template.spliced <function>+))))] [Nat (<| (:representation Value) ..px n.frac) [[blur "blur"]]] [Nat (<| ..angle ..degree) - [[hue-rotate "hue-rotate"]]] + [[hue_rotate "hue-rotate"]]] [Percentage (:representation Percentage) [[brightness "brightness"] [contrast "contrast"] @@ -1012,33 +1012,33 @@ ) ) - (def: #export svg-filter + (def: #export svg_filter (-> URL (Value Filter)) (|>> (list) (..apply "url"))) - (def: default-shadow-length (px +0.0)) + (def: default_shadow_length (px +0.0)) - (def: #export (drop-shadow horizontal vertical blur spread color) + (def: #export (drop_shadow horizontal vertical blur spread color) (-> (Value Length) (Value Length) (Maybe (Value Length)) (Maybe (Value Length)) (Value Color) (Value Filter)) (|> (list (:representation horizontal) (:representation vertical) - (|> blur (maybe.default ..default-shadow-length) :representation) - (|> spread (maybe.default ..default-shadow-length) :representation) + (|> blur (maybe.default ..default_shadow_length) :representation) + (|> spread (maybe.default ..default_shadow_length) :representation) (:representation color)) - (text.join-with " ") + (text.join_with " ") (list) (..apply "drop-shadow"))) - (def: length-separator " ") + (def: length_separator " ") (template [<name> <type>] [(def: #export (<name> horizontal vertical) (-> (Value Length) (Value Length) (Value <type>)) (:abstraction (format (:representation horizontal) - ..length-separator + ..length_separator (:representation vertical))))] [location Location] @@ -1057,16 +1057,16 @@ (enumeration: Shape Text shape - [[ellipse-shape "ellipse"] - [circle-shape "circle"]] + [[ellipse_shape "ellipse"] + [circle_shape "circle"]] []) (enumeration: Extent Text extent - [[closest-side "closest-side"] - [closest-corner "closest-corner"] - [farthest-side "farthest-side"] - [farthest-corner "farthest-corner"]] + [[closest_side "closest-side"] + [closest_corner "closest-corner"] + [farthest_side "farthest-side"] + [farthest_corner "farthest-corner"]] []) (template [<name> <function>] @@ -1074,21 +1074,21 @@ (-> Shape (Maybe Extent) (Value Location) Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) - (let [after-extent (format "at " (:representation location)) - with-extent (case extent + (let [after_extent (format "at " (:representation location)) + with_extent (case extent (#.Some extent) - (format (..extent extent) " " after-extent) + (format (..extent extent) " " after_extent) #.None - after-extent) - where (format (..shape shape) " " with-extent) + after_extent) + where (format (..shape shape) " " with_extent) [now after] next] (..apply <function> (list& (..shape shape) - (with-hint now) - (list\map with-hint after)))))] + (with_hint now) + (list\map with_hint after)))))] - [radial-gradient "radial-gradient"] - [repeating-radial-gradient "repeating-radial-gradient"] + [radial_gradient "radial-gradient"] + [repeating_radial_gradient "repeating-radial-gradient"] ) (def: #export (shadow horizontal vertical blur spread color inset?) @@ -1096,16 +1096,16 @@ (Maybe (Value Length)) (Maybe (Value Length)) (Value Color) Bit (Value Shadow)) - (let [with-inset (if inset? + (let [with_inset (if inset? (list "inset") (list))] (|> (list& (:representation horizontal) (:representation vertical) - (|> blur (maybe.default ..default-shadow-length) :representation) - (|> spread (maybe.default ..default-shadow-length) :representation) + (|> blur (maybe.default ..default_shadow_length) :representation) + (|> spread (maybe.default ..default_shadow_length) :representation) (:representation color) - with-inset) - (text.join-with " ") + with_inset) + (text.join_with " ") :abstraction))) (type: #export Rectangle @@ -1125,7 +1125,7 @@ (-> Label (Value Counter)) (|>> :abstraction)) - (def: #export current-count + (def: #export current_count (-> (Value Counter) (Value Content)) (|>> :representation (list) (..apply "counter"))) @@ -1142,9 +1142,9 @@ (|>> (list) (..apply "url"))) (enumeration: Font Text - font-name + font_name [[serif "serif"] - [sans-serif "sans-serif"] + [sans_serif "sans-serif"] [cursive "cursive"] [fantasy "fantasy"] [monospace "monospace"]] @@ -1152,20 +1152,20 @@ (-> Text Font) (|>> %.text :abstraction)) - (def: #export (font-family options) + (def: #export (font_family options) (-> (List Font) (Value Font)) (case options (#.Cons _) (|> options - (list\map ..font-name) - (text.join-with ",") + (list\map ..font_name) + (text.join_with ",") (:abstraction Value)) #.Nil ..initial))]) - (def: #export font-size - (-> (Value Length) (Value Font-Size)) + (def: #export font_size + (-> (Value Length) (Value Font_Size)) (|>> :transmutation)) (def: #export number @@ -1176,31 +1176,31 @@ (-> Label (Value Grid)) (|>> :abstraction)) - (def: #export fit-content - (-> (Value Length) (Value Grid-Content)) + (def: #export fit_content + (-> (Value Length) (Value Grid_Content)) (|>> :representation (list) (..apply "fit-content"))) - (def: #export (min-max min max) - (-> (Value Grid-Content) (Value Grid-Content) (Value Grid-Content)) + (def: #export (min_max min max) + (-> (Value Grid_Content) (Value Grid_Content) (Value Grid_Content)) (..apply "minmax" (list (:representation min) (:representation max)))) - (def: #export grid-span - (-> Nat (Value Grid-Span)) + (def: #export grid_span + (-> Nat (Value Grid_Span)) (|>> %.nat (format "span ") :abstraction)) - (def: grid-column-separator " ") - (def: grid-row-separator " ") + (def: grid_column_separator " ") + (def: grid_row_separator " ") - (def: #export grid-template - (-> (List (List (Maybe (Value Grid)))) (Value Grid-Template)) + (def: #export grid_template + (-> (List (List (Maybe (Value Grid)))) (Value Grid_Template)) (let [empty (: (Value Grid) (:abstraction "."))] (|>> (list\map (|>> (list\map (|>> (maybe.default empty) :representation)) - (text.join-with ..grid-column-separator) + (text.join_with ..grid_column_separator) (text.enclose ["'" "'"]))) - (text.join-with ..grid-row-separator) + (text.join_with ..grid_row_separator) :abstraction))) (def: #export (resolution dpi) @@ -1212,32 +1212,32 @@ (:abstraction (format (%.nat numerator) "/" (%.nat denominator)))) (enumeration: Quote Text - quote-text - [[double-quote "\0022"] - [single-quote "\0027"] - [single-left-angle-quote "\2039"] - [single-right-angle-quote "\203A"] - [double-left-angle-quote "\00AB"] - [double-right-angle-quote "\00BB"] - [single-left-quote "\2018"] - [single-right-quote "\2019"] - [double-left-quote "\201C"] - [double-right-quote "\201D"] - [low-double-quote "\201E"]] + quote_text + [[double_quote "\0022"] + [single_quote "\0027"] + [single_left_angle_quote "\2039"] + [single_right_angle_quote "\203A"] + [double_left_angle_quote "\00AB"] + [double_right_angle_quote "\00BB"] + [single_left_quote "\2018"] + [single_right_quote "\2019"] + [double_left_quote "\201C"] + [double_right_quote "\201D"] + [low_double_quote "\201E"]] [(def: #export quote (-> Text Quote) (|>> :abstraction))]) - (def: quote-separator " ") + (def: quote_separator " ") (def: #export (quotes [left0 right0] [left1 right1]) (-> [Quote Quote] [Quote Quote] (Value Quotes)) (|> (list left0 right0 left1 right1) - (list\map (|>> ..quote-text %.text)) - (text.join-with ..quote-separator) + (list\map (|>> ..quote_text %.text)) + (text.join_with ..quote_separator) :abstraction)) - (def: #export (matrix-2d [a b] [c d] [tx ty]) + (def: #export (matrix_2d [a b] [c d] [tx ty]) (-> [Frac Frac] [Frac Frac] [Frac Frac] @@ -1246,7 +1246,7 @@ (list\map %number) (..apply "matrix"))) - (def: #export (matrix-3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3]) + (def: #export (matrix_3d [a0 b0 c0 d0] [a1 b1 c1 d1] [a2 b2 c2 d2] [a3 b3 c3 d3]) (-> [Frac Frac Frac Frac] [Frac Frac Frac Frac] [Frac Frac Frac Frac] @@ -1256,74 +1256,74 @@ (list\map %number) (..apply "matrix3d"))) - (template [<name> <function> <input-types> <input-values>] - [(`` (def: #export (<name> [(~~ (template.splice <input-values>))]) - (-> [(~~ (template.splice <input-types>))] (Value Transform)) - (|> (list (~~ (template.splice <input-values>))) + (template [<name> <function> <input_types> <input_values>] + [(`` (def: #export (<name> [(~~ (template.spliced <input_values>))]) + (-> [(~~ (template.spliced <input_types>))] (Value Transform)) + (|> (list (~~ (template.spliced <input_values>))) (list\map %number) (..apply <function>))))] - [translate-2d "translate" [Frac Frac] [x y]] - [translate-3d "translate3d" [Frac Frac Frac] [x y z]] - [translate-x "translateX" [Frac] [value]] - [translate-y "translateY" [Frac] [value]] - [translate-z "translateZ" [Frac] [value]] + [translate_2d "translate" [Frac Frac] [x y]] + [translate_3d "translate3d" [Frac Frac Frac] [x y z]] + [translate_x "translateX" [Frac] [value]] + [translate_y "translateY" [Frac] [value]] + [translate_z "translateZ" [Frac] [value]] - [scale-2d "scale" [Frac Frac] [x y]] - [scale-3d "scale3d" [Frac Frac Frac] [x y z]] - [scale-x "scaleX" [Frac] [value]] - [scale-y "scaleY" [Frac] [value]] - [scale-z "scaleZ" [Frac] [value]] + [scale_2d "scale" [Frac Frac] [x y]] + [scale_3d "scale3d" [Frac Frac Frac] [x y z]] + [scale_x "scaleX" [Frac] [value]] + [scale_y "scaleY" [Frac] [value]] + [scale_z "scaleZ" [Frac] [value]] [perspective "perspective" [Frac] [value]] ) - (template [<name> <function> <input-types> <input-values>] - [(`` (def: #export (<name> [(~~ (template.splice <input-values>))]) - (-> [(~~ (template.splice <input-types>))] (Value Transform)) - (|> (list (~~ (template.splice <input-values>))) + (template [<name> <function> <input_types> <input_values>] + [(`` (def: #export (<name> [(~~ (template.spliced <input_values>))]) + (-> [(~~ (template.spliced <input_types>))] (Value Transform)) + (|> (list (~~ (template.spliced <input_values>))) (list\map ..angle) (..apply <function>))))] - [rotate-2d "rotate" [Angle] [angle]] - [rotate-x "rotateX" [Angle] [angle]] - [rotate-y "rotateY" [Angle] [angle]] - [rotate-z "rotateZ" [Angle] [angle]] + [rotate_2d "rotate" [Angle] [angle]] + [rotate_x "rotateX" [Angle] [angle]] + [rotate_y "rotateY" [Angle] [angle]] + [rotate_z "rotateZ" [Angle] [angle]] - [skew "skew" [Angle Angle] [x-angle y-angle]] - [skew-x "skewX" [Angle] [angle]] - [skew-y "skewY" [Angle] [angle]] + [skew "skew" [Angle Angle] [x_angle y_angle]] + [skew_x "skewX" [Angle] [angle]] + [skew_y "skewY" [Angle] [angle]] ) - (def: #export (rotate-3d [x y z angle]) + (def: #export (rotate_3d [x y z angle]) (-> [Frac Frac Frac Angle] (Value Transform)) (..apply "rotate3d" (list (%number x) (%number y) (%number z) (..angle angle)))) - (def: origin-separator " ") + (def: origin_separator " ") - (def: #export (origin-2d x y) - (-> (Value Length) (Value Length) (Value Transform-Origin)) - (:abstraction (format (:representation x) ..origin-separator + (def: #export (origin_2d x y) + (-> (Value Length) (Value Length) (Value Transform_Origin)) + (:abstraction (format (:representation x) ..origin_separator (:representation y)))) - (def: #export (origin-3d x y z) - (-> (Value Length) (Value Length) (Value Length) (Value Transform-Origin)) - (:abstraction (format (:representation x) ..origin-separator - (:representation y) ..origin-separator + (def: #export (origin_3d x y z) + (-> (Value Length) (Value Length) (Value Length) (Value Transform_Origin)) + (:abstraction (format (:representation x) ..origin_separator + (:representation y) ..origin_separator (:representation z)))) - (def: #export vertical-align - (-> (Value Length) (Value Vertical-Align)) + (def: #export vertical_align + (-> (Value Length) (Value Vertical_Align)) (|>> :transmutation)) - (def: #export (z-index index) - (-> Int (Value Z-Index)) + (def: #export (z_index index) + (-> Int (Value Z_Index)) (:abstraction (if (i.< +0 index) (%.int index) (%.nat (.nat index))))) - (multi: multi-image Image ",") - (multi: multi-shadow Shadow ",") - (multi: multi-content Content " ") + (multi: multi_image Image ",") + (multi: multi_shadow Shadow ",") + (multi: multi_content Content " ") ) diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 6a8e0b24f..7cbf607ce 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -105,7 +105,7 @@ [(abstract: #export <sub-raw> Any) (type: #export <sub> (HTML (<super-raw> <sub-raw>)))] - (~~ (template.splice <sub>+))))] + (~~ (template.spliced <sub>+))))] [Element Element' [[Content Content'] diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 142a15610..638048599 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -63,7 +63,7 @@ (def: #export object (-> (List [String JSON]) JSON) - (|>> (dictionary.from_list text.hash) #..Object)) + (|>> (dictionary.of_list text.hash) #..Object)) (syntax: #export (json token) {#.doc (doc "A simple way to produce JSON literals." @@ -101,7 +101,7 @@ _ (meta.fail "Wrong syntax for JSON object."))) pairs)] - (wrap (list (` (: JSON (#..Object ((~! dictionary.from_list) + (wrap (list (` (: JSON (#..Object ((~! dictionary.of_list) (~! text.hash) (list (~+ pairs'))))))))) @@ -290,18 +290,18 @@ ############################################################ ############################################################ -(def: parse_space +(def: space_parser (Parser Text) (<text>.some <text>.space)) -(def: parse_separator +(def: separator_parser (Parser [Text Any Text]) ($_ <>.and - ..parse_space + ..space_parser (<text>.this ..separator) - ..parse_space)) + ..space_parser)) -(def: parse_null +(def: null_parser (Parser Null) (do <>.monad [_ (<text>.this "null")] @@ -314,17 +314,17 @@ [_ (<text>.this <token>)] (wrap <value>)))] - [parse_true "true" #1] - [parse_false "false" #0] + [true_parser "true" #1] + [false_parser "false" #0] ) -(def: parse_boolean +(def: boolean_parser (Parser Boolean) ($_ <>.either - ..parse_true - ..parse_false)) + ..true_parser + ..false_parser)) -(def: parse_number +(def: number_parser (Parser Number) (do {! <>.monad} [signed? (<>.parses? (<text>.this "-")) @@ -346,7 +346,7 @@ (#try.Success value) (wrap value)))) -(def: parse_escaped +(def: escaped_parser (Parser Text) ($_ <>.either (<>.after (<text>.this "\t") @@ -364,7 +364,7 @@ (<>.after (<text>.this "\\") (<>\wrap "\")))) -(def: parse_string +(def: string_parser (Parser String) (<| (<text>.enclosed [text.double_quote text.double_quote]) (loop [_ []]) @@ -373,50 +373,50 @@ stop <text>.peek]) (if (text\= "\" stop) (do ! - [escaped parse_escaped + [escaped escaped_parser next_chars (recur [])] (wrap ($_ text\compose chars escaped next_chars))) (wrap chars)))) -(def: (parse_kv parse_json) +(def: (kv_parser json_parser) (-> (Parser JSON) (Parser [String JSON])) (do <>.monad - [key ..parse_string - _ ..parse_space + [key ..string_parser + _ ..space_parser _ (<text>.this ..entry_separator) - _ ..parse_space - value parse_json] + _ ..space_parser + value json_parser] (wrap [key value]))) (template [<name> <type> <open> <close> <elem_parser> <prep>] - [(def: (<name> parse_json) + [(def: (<name> json_parser) (-> (Parser JSON) (Parser <type>)) (do <>.monad [_ (<text>.this <open>) - _ parse_space - elems (<>.separated_by ..parse_separator <elem_parser>) - _ parse_space + _ space_parser + elems (<>.separated_by ..separator_parser <elem_parser>) + _ space_parser _ (<text>.this <close>)] (wrap (<prep> elems))))] - [parse_array Array ..open_array ..close_array parse_json row.from_list] - [parse_object Object ..open_object ..close_object (parse_kv parse_json) (dictionary.from_list text.hash)] + [array_parser Array ..open_array ..close_array json_parser row.of_list] + [object_parser Object ..open_object ..close_object (kv_parser json_parser) (dictionary.of_list text.hash)] ) -(def: parse_json +(def: json_parser (Parser JSON) (<>.rec - (function (_ parse_json) + (function (_ json_parser) ($_ <>.or - parse_null - parse_boolean - parse_number - parse_string - (parse_array parse_json) - (parse_object parse_json))))) + null_parser + boolean_parser + number_parser + string_parser + (array_parser json_parser) + (object_parser json_parser))))) (implementation: #export codec (Codec Text JSON) (def: encode ..format) - (def: decode (<text>.run parse_json))) + (def: decode (<text>.run json_parser))) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index f95b29334..b4ae34e8a 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -286,7 +286,7 @@ (def: #export <none> <type> - (try.assume (<in> ""))) + (try.assumed (<in> ""))) )] [Name Text ..name_size name_is_too_long name from_name name_writer name_parser anonymous] @@ -446,7 +446,7 @@ (Writer Mode) (|>> :representation ..small - try.assume + try.assumed ..small_writer)) (exception: #export (invalid_mode {value Nat}) @@ -569,7 +569,7 @@ (def: no_device Device - (try.assume (..small 0))) + (try.assumed (..small 0))) (type: #export Tar (Row Entry)) @@ -809,7 +809,7 @@ (get@ #modification_time) ..from_big .int - duration.from_millis + duration.of_millis (duration.up (|> duration.second duration.to_millis .nat)) instant.absolute) (get@ #mode header) @@ -867,5 +867,5 @@ (def: #export parser (Parser Tar) (|> (<>.some entry_parser) - (\ <>.monad map row.from_list) + (\ <>.monad map row.of_list) (<>.before ..end_of_archive_parser))) diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 56d394490..867b24cb6 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -61,7 +61,7 @@ (#.Some _) (<>.codec int.decimal (<text>.many <text>.hexadecimal)))] - (wrap (|> code .nat text.from_code))) + (wrap (|> code .nat text.of_code))) (<>.before (<text>.this ";")) (<>.after (<text>.this "&#")))) @@ -113,7 +113,7 @@ (def: attrs^ (Parser Attrs) - (<| (\ <>.monad map (dictionary.from_list name.hash)) + (<| (\ <>.monad map (dictionary.of_list name.hash)) <>.some (<>.and (..spaced^ attr_name^)) (<>.after (<text>.this "=")) @@ -161,7 +161,7 @@ (def: null^ (Parser Any) - (<text>.this (text.from_code 0))) + (<text>.this (text.of_code 0))) (def: xml^ (Parser XML) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 6acc3233c..7dfebd734 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -23,12 +23,12 @@ ## TODO: Instead of ints, chars should be produced fron nats. ## (The JVM specifies chars as 16-bit unsigned integers) -(def: #export from_code +(def: #export of_code (-> Char Text) (|>> .int "lux i64 char")) (template [<code> <short> <long>] - [(def: #export <long> (from_code <code>)) + [(def: #export <long> (..of_code <code>)) (def: #export <short> <long>)] [00 \0 null] diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index 2e9883c78..1002859cc 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -149,7 +149,7 @@ (exception.report ["In" (%.text text)] ["At" (%.nat offset)] - ["Name" (%.text (//.from_code sigil))])) + ["Name" (%.text (//.of_code sigil))])) (exception: #export (invalid_unicode_escape {text Text} {offset Nat}) (exception.report @@ -183,7 +183,7 @@ (let [limit' (|> limit (n.- offset) (n.- ..unicode_escape_offset))] (#try.Success [(format previous ("lux text clip" 0 offset current) - (//.from_code char)) + (//.of_code char)) ("lux text clip" (n.+ ..unicode_escape_offset offset) limit' current) limit'])) diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux index a80503d36..c1a1478b6 100644 --- a/stdlib/source/library/lux/data/text/format.lux +++ b/stdlib/source/library/lux/data/text/format.lux @@ -89,7 +89,7 @@ (Format <type>) (\ <codec> encode))] - (~~ (template.splice <format>,<codec>))))] + (~~ (template.spliced <format>,<codec>))))] [Nat [[nat/2 nat.binary] diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 38f4155ab..506dca6ab 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -136,7 +136,7 @@ (def: control^ (Parser Text) (<>.either (<t>.range (hex "0") (hex "1F")) - (<t>.one_of (//.from_code (hex "7F"))))) + (<t>.one_of (//.of_code (hex "7F"))))) (def: punct^ (Parser Text) @@ -150,7 +150,7 @@ (def: print^ (Parser Text) (<>.either graph^ - (<t>.one_of (//.from_code (hex "20"))))) + (<t>.one_of (//.of_code (hex "20"))))) (def: re_system_class^ (Parser Code) @@ -489,7 +489,7 @@ do_something_else))} (with_gensyms [g!temp] (wrap (list& (` (^multi (~ g!temp) - [((~! <t>.run) (..regex (~ (code.text pattern))) (~ g!temp)) - (#try.Success (~ (maybe.default g!temp bindings)))])) + {((~! <t>.run) (..regex (~ (code.text pattern))) (~ g!temp)) + (#try.Success (~ (maybe.default g!temp bindings)))})) body branches)))) diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index 2c48aed41..1f2d411f9 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -223,8 +223,8 @@ (Equivalence Set) (def: (= reference subject) - (set\= (set.from_list //block.hash (tree.tags (:representation reference))) - (set.from_list //block.hash (tree.tags (:representation subject)))))) + (set\= (set.of_list //block.hash (tree.tags (:representation reference))) + (set.of_list //block.hash (tree.tags (:representation subject)))))) ) (template [<name> <blocks>] diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index b73b92035..93506c541 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -121,7 +121,7 @@ (for {@.lua (def: (tuple_array tuple) (-> (array.Array Any) (array.Array Any)) - (array.from_list + (array.of_list (loop [idx 0] (let [member ("lua array read" idx tuple)] (if ("lua object nil?" member) @@ -146,7 +146,7 @@ (`` (<| (~~ (template [<class> <processing>] [(case (ffi.check <class> object) (#.Some value) - (`` (|> value (~~ (template.splice <processing>)))) + (`` (|> value (~~ (template.spliced <processing>)))) #.None)] [java/lang/Boolean [(:as .Bit) %.bit]] @@ -159,12 +159,12 @@ (let [value (:as (array.Array java/lang/Object) value)] (case (array.read 0 value) (^multi (#.Some tag) - [(ffi.check java/lang/Integer tag) - (#.Some tag)] - [[(array.read 1 value) + {(ffi.check java/lang/Integer tag) + (#.Some tag)} + {[(array.read 1 value) (array.read 2 value)] [last? - (#.Some choice)]]) + (#.Some choice)]}) (let [last? (case last? (#.Some _) #1 #.None #0)] @@ -184,7 +184,7 @@ (case (ffi.type_of value) (^template [<type_of> <then>] [<type_of> - (`` (|> value (~~ (template.splice <then>))))]) + (`` (|> value (~~ (template.spliced <then>))))]) (["boolean" [(:as .Bit) %.bit]] ["number" [(:as .Frac) %.frac]] ["string" [(:as .Text) %.text]] @@ -219,7 +219,7 @@ (case (..str (..type value)) (^template [<type_of> <class_of> <then>] [(^or <type_of> <class_of>) - (`` (|> value (~~ (template.splice <then>))))]) + (`` (|> value (~~ (template.spliced <then>))))]) (["<type 'bool'>" "<class 'bool'>" [(:as .Bit) %.bit]] ["<type 'int'>" "<class 'int'>" [(:as .Int) %.int]] ["<type 'float'>" "<class 'float'>" [(:as .Frac) %.frac]] @@ -251,7 +251,7 @@ (case (..type value) (^template [<type_of> <then>] [<type_of> - (`` (|> value (~~ (template.splice <then>))))]) + (`` (|> value (~~ (template.spliced <then>))))]) (["boolean" [(:as .Bit) %.bit]] ["string" [(:as .Text) %.text]] ["nil" [(new> "nil" [])]]) @@ -324,7 +324,7 @@ (case (..gettype value) (^template [<type_of> <then>] [<type_of> - (`` (|> value (~~ (template.splice <then>))))]) + (`` (|> value (~~ (template.spliced <then>))))]) (["boolean" [(:as .Bit) %.bit]] ["integer" [(:as .Int) %.int]] ["double" [(:as .Frac) %.frac]] @@ -350,7 +350,7 @@ @.scheme (`` (cond (~~ (template [<when> <then>] [(<when> value) - (`` (|> value (~~ (template.splice <then>))))] + (`` (|> value (~~ (template.spliced <then>))))] [..boolean? [(:as .Bit) %.bit]] [..integer? [(:as .Int) %.int]] @@ -430,12 +430,12 @@ [XML %.xml])) (do <>.monad - [[_ elemT] (<type>.apply (<>.and (<type>.exactly List) <type>.any)) + [[_ elemT] (<type>.applied (<>.and (<type>.exactly List) <type>.any)) elemR (<type>.local (list elemT) representation)] (wrap (|>> (:as (List Any)) (%.list elemR)))) (do <>.monad - [[_ elemT] (<type>.apply (<>.and (<type>.exactly Maybe) <type>.any)) + [[_ elemT] (<type>.applied (<>.and (<type>.exactly Maybe) <type>.any)) elemR (<type>.local (list elemT) representation)] (wrap (|>> (:as (Maybe Any)) (%.maybe elemR))))))) @@ -496,8 +496,8 @@ (..tuple_representation representation) (do <>.monad - [[funcT inputsT+] (<type>.apply (<>.and <type>.any (<>.many <type>.any)))] - (case (type.apply inputsT+ funcT) + [[funcT inputsT+] (<type>.applied (<>.and <type>.any (<>.many <type>.any)))] + (case (type.applied inputsT+ funcT) (#.Some outputT) (<type>.local (list outputT) representation) @@ -568,7 +568,7 @@ ## 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 - (dictionary.from_list text.hash))] + (dictionary.of_list text.hash))] targets (: (Meta (List Target)) (case targets #.Nil diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux index 8d092aa02..852ed2b11 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -382,6 +382,6 @@ (template: #export (closure <inputs> <output>) (.:as ..Function (`` ("js function" - (~~ (template.count <inputs>)) + (~~ (template.amount <inputs>)) (.function (_ [<inputs>]) <output>))))) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index c05a2afe2..6b45f2fbe 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -108,7 +108,7 @@ [type.float box.float] [type.double box.double] [type.char box.char]) - (dictionary.from_list type.hash))) + (dictionary.of_list type.hash))) (template [<name> <pre> <post>] [(def: (<name> unboxed boxed raw) @@ -1489,10 +1489,10 @@ [unboxed raw (list)] #AutoPrM - (with_expansions [<special+>' (template.splice <special+>) + (with_expansions [<special+>' (template.spliced <special+>) <cond_cases> (template [<old> <new> <pre> <post>] [(\ type.equivalence = <old> unboxed) - (with_expansions [<post>' (template.splice <post>)] + (with_expansions [<post>' (template.spliced <post>)] [<new> (` (.|> (~ raw) (~+ <pre>))) (list <post>')])] @@ -1911,7 +1911,7 @@ params))))) (#.Apply A F) - (case (lux_type.apply (list A) F) + (case (lux_type.applied (list A) F) #.None <failure> diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux index bb224c575..1eb32b3bf 100644 --- a/stdlib/source/library/lux/ffi.lua.lux +++ b/stdlib/source/library/lux/ffi.lua.lux @@ -305,6 +305,6 @@ (template: #export (closure <inputs> <output>) (.:as ..Function (`` ("lua function" - (~~ (template.count <inputs>)) + (~~ (template.amount <inputs>)) (.function (_ [<inputs>]) <output>))))) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 832d3907f..5b4d49084 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -275,11 +275,11 @@ Code) (case [name+params mode in_array?] (^multi [[prim #.Nil] #ManualPrM #0] - [(manual_primitive_to_type prim) (#.Some output)]) + {(manual_primitive_to_type prim) (#.Some output)}) output (^multi [[prim #.Nil] #AutoPrM #0] - [(auto_primitive_to_type prim) (#.Some output)]) + {(auto_primitive_to_type prim) (#.Some output)}) output [[name params] _ _] @@ -1497,7 +1497,7 @@ (let [[full_name class_tvars] class full_name (sanitize full_name) all_params (|> (member_type_vars class_tvars member) - (list.filter free_type_param?) + (list.only free_type_param?) (list\map type_param_to_type_arg))] (case member (#EnumDecl enum_members) @@ -1509,7 +1509,7 @@ _ (let [=class_tvars (|> class_tvars - (list.filter free_type_param?) + (list.only free_type_param?) (list\map type_param_to_type_arg))] (` (All [(~+ =class_tvars)] (primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) getter_interop (: (-> Text Code) @@ -1575,7 +1575,7 @@ base_gtype) tvar_asts (: (List Code) (|> class_tvars - (list.filter free_type_param?) + (list.only free_type_param?) (list\map type_param_to_type_arg))) getter_name (code.identifier ["" (..import_name import_format method_prefix import_field_name)]) setter_name (code.identifier ["" (..import_name import_format method_prefix (format import_field_name "!"))])] @@ -1749,7 +1749,7 @@ (\ meta.monad wrap name) (#.Apply A F) - (case (type.apply (list A) F) + (case (type.applied (list A) F) #.None (meta.fail (format "Cannot apply type: " (type.format F) " to " (type.format A))) diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux index 737cfefd8..36196c8dc 100644 --- a/stdlib/source/library/lux/ffi.py.lux +++ b/stdlib/source/library/lux/ffi.py.lux @@ -310,6 +310,6 @@ (template: #export (lambda <inputs> <output>) (.:as ..Function (`` ("python function" - (~~ (template.count <inputs>)) + (~~ (template.amount <inputs>)) (.function (_ [<inputs>]) <output>))))) diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux index 554606609..cceaf1777 100644 --- a/stdlib/source/library/lux/locale/language.lux +++ b/stdlib/source/library/lux/locale/language.lux @@ -26,7 +26,7 @@ ) (template [<bundle>] - [(with_expansions [<bundle>' (template.splice <bundle>)] + [(with_expansions [<bundle>' (template.spliced <bundle>)] (template [<code> <name> <definition> <alias>+] [(def: #export <definition> Language @@ -37,7 +37,7 @@ Language <definition>)] - (~~ (template.splice <alias>+))))] + (~~ (template.spliced <alias>+))))] <bundle>' ))] diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux index be60b6734..f824005b3 100644 --- a/stdlib/source/library/lux/locale/territory.lux +++ b/stdlib/source/library/lux/locale/territory.lux @@ -41,7 +41,7 @@ (`` (template [<neighbor>] [(def: #export <neighbor> Territory <main>)] - (~~ (template.splice <neighbor>+))))] + (~~ (template.spliced <neighbor>+))))] ["AF" "AFG" 004 "Afghanistan" afghanistan []] ["AX" "ALA" 248 "Åland Islands" aland_islands []] diff --git a/stdlib/source/library/lux/macro/poly.lux b/stdlib/source/library/lux/macro/poly.lux index 5ce420e7a..b40f29a8c 100644 --- a/stdlib/source/library/lux/macro/poly.lux +++ b/stdlib/source/library/lux/macro/poly.lux @@ -6,9 +6,9 @@ [abstract ["." monad (#+ do)]] [control - ["p" parser + ["<>" parser ["<.>" type (#+ Env)] - ["s" code]]] + ["<.>" code]]] [data ["." product] ["." maybe] @@ -25,15 +25,15 @@ ["n" nat]]]]]) (syntax: #export (poly: {export |export|.parser} - {name s.local_identifier} + {name <code>.local_identifier} body) (with_gensyms [g!_ g!type g!output] (let [g!name (code.identifier ["" name])] - (wrap (.list (` ((~! syntax:) (~+ (|export|.format export)) ((~ g!name) {(~ g!type) (~! s.identifier)}) + (wrap (.list (` ((~! syntax:) (~+ (|export|.format export)) ((~ g!name) {(~ g!type) (~! <code>.identifier)}) ((~! do) (~! meta.monad) [(~ g!type) ((~! meta.find_type_def) (~ g!type))] (case (: (.Either .Text .Code) - ((~! <type>.run) ((~! p.rec) + ((~! <type>.run) ((~! <>.rec) (function ((~ g!_) (~ g!name)) (~ body))) (~ g!type))) @@ -54,9 +54,9 @@ #.None)) (syntax: #export (derived: {export |export|.parser} - {?name (p.maybe s.local_identifier)} - {[poly_func poly_args] (s.form (p.and s.identifier (p.many s.identifier)))} - {?custom_impl (p.maybe s.any)}) + {?name (<>.maybe <code>.local_identifier)} + {[poly_func poly_args] (<code>.form (<>.and <code>.identifier (<>.many <code>.identifier)))} + {?custom_impl (<>.maybe <code>.any)}) (do {! meta.monad} [poly_args (monad.map ! meta.normalize poly_args) name (case ?name @@ -64,12 +64,12 @@ (wrap name) (^multi #.None - [(derivation_name (product.right poly_func) (list\map product.right poly_args)) - (#.Some derived_name)]) + {(derivation_name (product.right poly_func) (list\map product.right poly_args)) + (#.Some derived_name)}) (wrap derived_name) _ - (p.fail "derived: was given no explicit name, and cannot generate one from given information.")) + (<>.fail "derived: was given no explicit name, and cannot generate one from given information.")) #let [impl (case ?custom_impl (#.Some custom_impl) custom_impl @@ -114,8 +114,8 @@ (^template [<macro> <tag> <flattener>] [(<tag> left right) (` (<macro> (~+ (list\map (to_code env) (<flattener> type)))))]) - ([| #.Sum type.flatten_variant] - [& #.Product type.flatten_tuple]) + ([| #.Sum type.flat_variant] + [& #.Product type.flat_tuple]) (#.Named name sub_type) (code.identifier name) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index c489703fc..36edd6a1e 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -26,10 +26,10 @@ ["." code] ["." local]]) -(syntax: #export (splice {parts (<code>.tuple (<>.some <code>.any))}) +(syntax: #export (spliced {parts (<code>.tuple (<>.some <code>.any))}) (wrap parts)) -(syntax: #export (count {parts (<code>.tuple (<>.some <code>.any))}) +(syntax: #export (amount {parts (<code>.tuple (<>.some <code>.any))}) (wrap (list (code.nat (list.size parts))))) (syntax: #export (with_locals {locals (<code>.tuple (<>.some <code>.local_identifier))} @@ -100,7 +100,7 @@ (type: Environment (Dictionary Text Code)) -(def: (apply env template) +(def: (applied env template) (-> Environment Code Code) (case template [_ (#.Identifier "" name)] @@ -113,15 +113,15 @@ (^template [<tag>] [[meta (<tag> elems)] - [meta (<tag> (list\map (apply env) elems))]]) + [meta (<tag> (list\map (applied env) elems))]]) ([#.Tuple] [#.Form]) [meta (#.Record members)] [meta (#.Record (list\map (: (-> [Code Code] [Code Code]) (function (_ [key value]) - [(apply env key) - (apply env value)])) + [(applied env key) + (applied env value)])) members))] _ @@ -141,14 +141,14 @@ (-> Local Macro) ("lux macro" (function (_ inputs compiler) - (.let [parameters_count (list.size parameters) - inputs_count (list.size inputs)] - (if (nat.= parameters_count inputs_count) + (.let [parameters_amount (list.size parameters) + inputs_amount (list.size inputs)] + (if (nat.= parameters_amount inputs_amount) (.let [environment (: Environment (|> (list.zip/2 parameters inputs) - (dictionary.from_list text.hash)))] - (#.Right [compiler (list\map (..apply environment) template)])) - (exception.throw ..irregular_arguments [parameters_count inputs_count])))))) + (dictionary.of_list text.hash)))] + (#.Right [compiler (list\map (..applied environment) template)])) + (exception.throw ..irregular_arguments [parameters_amount inputs_amount])))))) (def: local (Parser Local) diff --git a/stdlib/source/library/lux/math/logic/fuzzy.lux b/stdlib/source/library/lux/math/logic/fuzzy.lux index c1815f3db..c00f63c43 100644 --- a/stdlib/source/library/lux/math/logic/fuzzy.lux +++ b/stdlib/source/library/lux/math/logic/fuzzy.lux @@ -57,7 +57,7 @@ (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy a))) (..intersection (..complement sub) base)) -(def: #export (from_predicate predicate) +(def: #export (of_predicate predicate) (All [a] (-> (Predicate a) (Fuzzy a))) (function (_ elem) (if (predicate elem) @@ -69,9 +69,9 @@ (function (_ elem) (/.> treshold (set elem)))) -(def: #export from_set +(def: #export of_set (All [a] (-> (Set a) (Fuzzy a))) - (|>> set.member? ..from_predicate)) + (|>> set.member? ..of_predicate)) (def: (ascending from to) (-> Rev Rev (Fuzzy Rev)) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index fa654a408..b607b6e6a 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -53,4 +53,4 @@ (meta.lift (do try.monad [_ (..modulus divisor)] - (wrap (list (` ((~! try.assume) (..modulus (~ (code.int divisor)))))))))) + (wrap (list (` ((~! try.assumed) (..modulus (~ (code.int divisor)))))))))) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 506fde750..dd03f37b3 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -13,7 +13,7 @@ ["#." rev] ["#." frac]]) -(macro: (encoding_doc tokens state) +(macro: (documentation tokens state) (case tokens (^ (list [location (#.Text encoding)] example_1 example_2)) (let [encoding ($_ "lux text concat" @@ -27,7 +27,7 @@ (~ example_2))))])) _ - (#try.Failure "Wrong syntax for 'encoding_doc'."))) + (#try.Failure "Wrong syntax for 'documentation'."))) (def: separator ",") @@ -41,7 +41,7 @@ _ #0)) -(def: clean_separators +(def: without_separators (-> Text Text) (text.replace_all ..separator "")) @@ -52,21 +52,21 @@ (#.Cons [meta (#.Text repr')] #.Nil) (if (..separator_prefixed? repr') (#try.Failure <error>) - (let [repr (..clean_separators repr')] + (let [repr (..without_separators repr')] (case (\ <nat> decode repr) (#try.Success value) (#try.Success [state (list [meta (#.Nat value)])]) (^multi (#try.Failure _) - [(\ <int> decode repr) (#try.Success value)]) + {(\ <int> decode repr) (#try.Success value)}) (#try.Success [state (list [meta (#.Int value)])]) (^multi (#try.Failure _) - [(\ <rev> decode repr) (#try.Success value)]) + {(\ <rev> decode repr) (#try.Success value)}) (#try.Success [state (list [meta (#.Rev value)])]) (^multi (#try.Failure _) - [(\ <frac> decode repr) (#try.Success value)]) + {(\ <frac> decode repr) (#try.Success value)}) (#try.Success [state (list [meta (#.Frac value)])]) _ @@ -77,11 +77,11 @@ [bin /nat.binary /int.binary /rev.binary /frac.binary "Invalid binary syntax." - (encoding_doc "binary" (bin "11001001") (bin "11,00,10,01"))] + (..documentation "binary" (bin "11001001") (bin "11,00,10,01"))] [oct /nat.octal /int.octal /rev.octal /frac.octal "Invalid octal syntax." - (encoding_doc "octal" (oct "615243") (oct "615,243"))] + (..documentation "octal" (oct "615243") (oct "615,243"))] [hex /nat.hex /int.hex /rev.hex /frac.hex "Invalid hexadecimal syntax." - (encoding_doc "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))] + (..documentation "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))] ) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index f6f01192e..1b0e1e52a 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -230,7 +230,11 @@ (def: sign_offset (//nat.+ ..exponent_size ..exponent_offset)) (template [<cast> <hex> <name>] - [(def: <name> (|> <hex> (\ //nat.hex decode) try.assume <cast>))] + [(def: <name> + (|> <hex> + (\ //nat.hex decode) + try.assumed + <cast>))] [.i64 "FFF8000000000000" not_a_number_bits] [.i64 "7FF0000000000000" positive_infinity_bits] @@ -306,7 +310,7 @@ [sign 1 ..sign_offset] ) -(def: #export (from_bits input) +(def: #export (of_bits input) (-> I64 Frac) (case [(: Nat (..exponent input)) (: Nat (..mantissa input)) @@ -411,7 +415,7 @@ 0 whole _ ("lux text concat" whole (\ <nat> encode decimal)))) #let [sign (if negative? 1 0)]] - (wrap (..from_bits + (wrap (..of_bits ($_ //i64.or (//i64.left_shift ..sign_offset (.i64 sign)) (//i64.left_shift ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent))) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 357b36557..f11eee2f4 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -163,7 +163,7 @@ (repetitions size "1") (repetitions size "0"))) - high (try.assume (\ n.binary decode pattern)) + high (try.assumed (\ n.binary decode pattern)) low (..rotate_right size high)] (function (_ value) (..or (..right_shift size (..and high value)) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 8b555e21d..3c3cf9448 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -78,14 +78,14 @@ (let [[state' fa] (ffa state)] (fa state'))))) -(def: #export (filter pred gen) +(def: #export (only pred gen) {#.doc "Retries the generator until the output satisfies a predicate."} (All [a] (-> (-> a Bit) (Random a) (Random a))) (do ..monad [sample gen] (if (pred sample) (wrap sample) - (filter pred gen)))) + (only pred gen)))) (def: #export (one check random) (All [a b] @@ -138,7 +138,7 @@ (def: #export frac (Random Frac) - (\ ..monad map (|>> .i64 f.from_bits) ..nat)) + (\ ..monad map (|>> .i64 f.of_bits) ..nat)) (def: #export safe_frac (Random Frac) @@ -158,7 +158,7 @@ (|>> (n.% size) (n.+ start)))] (|> ..nat (\ ..monad map in_range) - (..filter (unicode.member? set))))) + (..only (unicode.member? set))))) (def: #export (text char_gen size) (-> (Random Char) Nat (Random Text)) @@ -167,7 +167,7 @@ (do ..monad [x char_gen xs (text char_gen (dec size))] - (wrap (text\compose (text.from_code x) xs))))) + (wrap (text\compose (text.of_code x) xs))))) (template [<name> <set>] [(def: #export <name> @@ -263,8 +263,8 @@ [values (list size value_gen)] (wrap (|> values <ctor>))))] - [array Array array.from_list] - [queue Queue queue.from_list] + [array Array array.of_list] + [queue Queue queue.of_list] [stack Stack (list\fold stack.push stack.empty)] ) @@ -299,7 +299,7 @@ (def: #export instant (Random Instant) - (\ ..monad map instant.from_millis ..int)) + (\ ..monad map instant.of_millis ..int)) (def: #export date (Random Date) @@ -311,7 +311,7 @@ (def: #export duration (Random Duration) - (\ ..monad map duration.from_millis ..int)) + (\ ..monad map duration.of_millis ..int)) (def: #export month (Random Month) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index b86100325..5415b7c9e 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -514,9 +514,9 @@ [=module (..find_module module) this_module_name ..current_module_name] (wrap (|> (get@ #.types =module) - (list.filter (function (_ [type_name [tag_list exported? type]]) - (or exported? - (text\= this_module_name module)))) + (list.only (function (_ [type_name [tag_list exported? type]]) + (or exported? + (text\= this_module_name module)))) (list\map (function (_ [type_name [tag_list exported? type]]) [tag_list type])))))) @@ -535,7 +535,7 @@ [name type]))) scopes)])))) -(def: #export (un_alias def_name) +(def: #export (de_aliased def_name) {#.doc "Given an aliased definition's name, returns the original definition being referenced."} (-> Name (Meta Name)) (do ..monad diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux index 1b7ee480b..14f55f106 100644 --- a/stdlib/source/library/lux/meta/annotation.lux +++ b/stdlib/source/library/lux/meta/annotation.lux @@ -73,7 +73,7 @@ [signature? #.sig?] ) -(def: (parse_text input) +(def: (text_parser input) (-> Code (Maybe Text)) (case input [_ (#.Text actual_value)] @@ -88,7 +88,7 @@ (maybe.default (list) (do {! maybe.monad} [args (..tuple (name_of <tag>) ann)] - (monad.map ! ..parse_text args))))] + (monad.map ! ..text_parser args))))] [function_arguments #.func-args] [type_arguments #.type-args] diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index 2ec6746c2..2ebcb6a8e 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -199,16 +199,16 @@ body))) (template [<call> <input_var>+ <input_type>+ <function>+] - [(`` (def: #export (<call> [(~~ (template.splice <input_var>+))] function) - (-> [(~~ (template.splice <input_type>+))] (Expression Any) (Computation Any)) - (..call/* function (list (~~ (template.splice <input_var>+)))))) + [(`` (def: #export (<call> [(~~ (template.spliced <input_var>+))] function) + (-> [(~~ (template.spliced <input_type>+))] (Expression Any) (Computation Any)) + (..call/* function (list (~~ (template.spliced <input_var>+)))))) (`` (template [<lux_name> <host_name>] [(def: #export (<lux_name> args) - (-> [(~~ (template.splice <input_type>+))] (Computation Any)) + (-> [(~~ (template.spliced <input_type>+))] (Computation Any)) (<call> args (..var <host_name>)))] - (~~ (template.splice <function>+))))] + (~~ (template.spliced <function>+))))] [call/0 [] [] [[get-universal-time/0 "get-universal-time"] @@ -263,10 +263,10 @@ (template [<call> <input_type>+ <function>+] [(`` (template [<lux_name> <host_name>] [(def: #export (<lux_name> args) - (-> [(~~ (template.splice <input_type>+))] (Access Any)) + (-> [(~~ (template.spliced <input_type>+))] (Access Any)) (:transmutation (<call> args (..var <host_name>))))] - (~~ (template.splice <function>+))))] + (~~ (template.spliced <function>+))))] [call/1 [(Expression Any)] [[car/1 "car"] diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index d7b42280c..26c2e7b41 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -35,7 +35,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -46,7 +46,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Var [Location' Computation' Expression' Code]] [Access [Location' Computation' Expression' Code]] @@ -429,14 +429,14 @@ (template [<apply> <arg>+ <type>+ <function>+] [(`` (def: #export (<apply> function) - (-> Expression (~~ (template.splice <type>+)) Computation) - (.function (_ (~~ (template.splice <arg>+))) - (..apply/* function (list (~~ (template.splice <arg>+))))))) + (-> Expression (~~ (template.spliced <type>+)) Computation) + (.function (_ (~~ (template.spliced <arg>+))) + (..apply/* function (list (~~ (template.spliced <arg>+))))))) (`` (template [<definition> <function>] [(def: #export <definition> (<apply> (..var <function>)))] - (~~ (template.splice <function>+))))] + (~~ (template.spliced <function>+))))] [apply/1 [_0] [Expression] [[not_a_number? "isNaN"]]] diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 9869a6f8b..d7d3cd36c 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -87,7 +87,7 @@ (def: (constant' @name index) (-> (Index UTF8) (Constant Any) Attribute) (#Constant {#name @name - #length (|> /constant.length //unsigned.u4 try.assume) + #length (|> /constant.length //unsigned.u4 try.assumed) #info index})) (def: #export (constant index) @@ -104,7 +104,7 @@ #length (|> specification (/code.length ..length) //unsigned.u4 - try.assume) + try.assumed) #info specification})) (def: #export (code specification) diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux index 80cc7a6ad..2f80d96d2 100644 --- a/stdlib/source/library/lux/target/jvm/attribute/code.lux +++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux @@ -1,7 +1,6 @@ (.module: [library [lux (#- Code) - [type (#+ :share)] [abstract [equivalence (#+ Equivalence)]] [data diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 82b2d30db..0d94ae9f1 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -198,7 +198,7 @@ []]])))) (template [<name> <frames>] - [(def: <name> U2 (|> <frames> //unsigned.u2 try.assume))] + [(def: <name> U2 (|> <frames> //unsigned.u2 try.assumed))] [$0 0] [$1 1] @@ -210,7 +210,7 @@ ) (template [<name> <registry>] - [(def: <name> Registry (|> <registry> //unsigned.u2 try.assume /registry.registry))] + [(def: <name> Registry (|> <registry> //unsigned.u2 try.assumed /registry.registry))] [@_ 0] [@0 1] @@ -589,7 +589,7 @@ (template [<for> <size> <name> <general> <specials>] [(def: #export (<name> local) (-> Nat (Bytecode Any)) - (with_expansions [<specials>' (template.splice <specials>)] + (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local (~~ (template [<case> <instruction> <registry>] [<case> (..bytecode $0 <size> <registry> <instruction> [])] @@ -629,7 +629,7 @@ (template [<for> <size> <name> <general> <specials>] [(def: #export (<name> local) (-> Nat (Bytecode Any)) - (with_expansions [<specials>' (template.splice <specials>)] + (with_expansions [<specials>' (template.spliced <specials>)] (`` (case local (~~ (template [<case> <instruction> <registry>] [<case> (..bytecode <size> $0 <registry> <instruction> [])] @@ -977,8 +977,8 @@ (list\map ..type_size) (list\fold n.+ (if <static?> 0 1)) //unsigned.u1 - try.assume) - production (|> output ..type_size //unsigned.u1 try.assume)]] + try.assumed) + production (|> output ..type_size //unsigned.u1 try.assumed)]] (..bytecode (//unsigned.lift/2 consumption) (//unsigned.lift/2 production) @_ diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index 8d51a8597..8a42afb41 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -32,7 +32,7 @@ (def: #export start Address - (|> 0 ///unsigned.u2 try.assume :abstraction)) + (|> 0 ///unsigned.u2 try.assumed :abstraction)) (def: #export (move distance) (-> U2 (-> Address (Try Address))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 090fc64fe..3773b4333 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -76,10 +76,10 @@ (template [<name> <extra>] [(def: #export <name> (-> Register Registry) - (let [extra (|> <extra> /////unsigned.u2 try.assume)] + (let [extra (|> <extra> /////unsigned.u2 try.assumed)] (|>> /////unsigned.lift/2 (/////unsigned.+/2 extra) - try.assume + try.assumed :abstraction)))] [for ..normal] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 65e36875f..d4f4ba688 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -59,7 +59,7 @@ (type: Opcode Nat) (template [<name> <size>] - [(def: <name> Size (|> <size> ///unsigned.u2 try.assume))] + [(def: <name> Size (|> <size> ///unsigned.u2 try.assumed))] [opcode_size 1] [register_size 1] @@ -74,7 +74,7 @@ (function (_ [offset binary]) [(n.+ (///unsigned.value ..opcode_size) offset) - (try.assume + (try.assumed (binary.write/8 offset opcode binary))])) (def: nullary @@ -89,7 +89,8 @@ [(def: <name> Size (|> ..opcode_size - (///unsigned.+/2 <size>) try.assume))] + (///unsigned.+/2 <size>) + try.assumed))] [size/1 ..register_size] [size/2 ..index_size] @@ -102,7 +103,7 @@ (-> Opcode <inputT> Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value <shift>) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary)] (<writer> (n.+ (///unsigned.value ..opcode_size) offset) @@ -128,7 +129,7 @@ (-> Opcode <inputT> Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value <shift>) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary)] (<writer> (n.+ (///unsigned.value ..opcode_size) offset) @@ -149,14 +150,14 @@ (def: size/11 Size (|> ..opcode_size - (///unsigned.+/2 ..register_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume)) + (///unsigned.+/2 ..register_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed)) (def: (binary/11' opcode input0 input1) (-> Opcode U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/11) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary) _ (binary.write/8 (n.+ (///unsigned.value ..opcode_size) offset) @@ -176,14 +177,14 @@ (def: size/21 Size (|> ..opcode_size - (///unsigned.+/2 ..index_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume)) + (///unsigned.+/2 ..index_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed)) (def: (binary/21' opcode input0 input1) (-> Opcode U2 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/21) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary) _ (binary.write/16 (n.+ (///unsigned.value ..opcode_size) offset) @@ -203,15 +204,15 @@ (def: size/211 Size (|> ..opcode_size - (///unsigned.+/2 ..index_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume - (///unsigned.+/2 ..byte_size) try.assume)) + (///unsigned.+/2 ..index_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed + (///unsigned.+/2 ..byte_size) try.assumed)) (def: (trinary/211' opcode input0 input1 input2) (-> Opcode U2 U1 U1 Mutation) (function (_ [offset binary]) [(n.+ (///unsigned.value ..size/211) offset) - (try.assume + (try.assumed (do try.monad [_ (binary.write/8 offset opcode binary) _ (binary.write/16 (n.+ (///unsigned.value ..opcode_size) offset) @@ -239,7 +240,7 @@ (|>> :representation)) (template [<code> <name>] - [(def: #export <name> (|> <code> ///unsigned.u1 try.assume :abstraction))] + [(def: #export <name> (|> <code> ///unsigned.u1 try.assumed :abstraction))] [04 t_boolean] [05 t_char] @@ -479,9 +480,9 @@ ["B4" getfield/1] ["B4" getfield/2] ["B5" putfield/1] ["B5" putfield/2])] (template [<arity> <definitions>] - [(with_expansions [<definitions>' (template.splice <definitions>)] + [(with_expansions [<definitions>' (template.spliced <definitions>)] (template [<code> <name> <instruction_inputs> <arity_inputs>] - [(with_expansions [<inputs>' (template.splice <instruction_inputs>) + [(with_expansions [<inputs>' (template.spliced <instruction_inputs>) <input_types> (template [<input_name> <input_type>] [<input_type>] @@ -495,7 +496,7 @@ (let [[estimator <arity>'] <arity>] [estimator (function (_ [<input_names>]) - (`` (<arity>' (hex <code>) (~~ (template.splice <arity_inputs>)))))])))] + (`` (<arity>' (hex <code>) (~~ (template.spliced <arity_inputs>)))))])))] <definitions>' ))] @@ -570,7 +571,7 @@ [["C5" multianewarray [[index (Index Class)] [count U1]] [(///index.value index) count]]]] [..trinary/211 - [["B9" invokeinterface [[index (Index (Reference Method))] [count U1] [output_count U1]] [(///index.value index) count (try.assume (///unsigned.u1 0))]]]] + [["B9" invokeinterface [[index (Index (Reference Method))] [count U1] [output_count U1]] [(///index.value index) count (try.assumed (///unsigned.u1 0))]]]] )) (def: (switch_padding offset) @@ -595,14 +596,14 @@ (n.* (///unsigned.value ..big_jump_size) (inc amount_of_afterwards))) ///unsigned.u2 - try.assume)))] + try.assumed)))] [estimator (function (_ minimum default [at_minimum afterwards]) (let [amount_of_afterwards (list.size afterwards) estimator (estimator amount_of_afterwards)] (function (_ [size mutation]) (let [padding (switch_padding size) - tableswitch_size (try.assume + tableswitch_size (try.assumed (do {! try.monad} [size (///unsigned.u2 size)] (\ ! map (|>> estimator ///unsigned.value) @@ -610,7 +611,7 @@ tableswitch_mutation (: Mutation (function (_ [offset binary]) [(n.+ tableswitch_size offset) - (try.assume + (try.assumed (do {! try.monad} [amount_of_afterwards (|> amount_of_afterwards .int ///signed.s4) maximum (///signed.+/4 minimum amount_of_afterwards) @@ -659,14 +660,14 @@ (///unsigned.value ..integer_size) (n.* amount_of_cases case_size)) ///unsigned.u2 - try.assume)))] + try.assumed)))] [estimator (function (_ default cases) (let [amount_of_cases (list.size cases) estimator (estimator amount_of_cases)] (function (_ [size mutation]) (let [padding (switch_padding size) - lookupswitch_size (try.assume + lookupswitch_size (try.assumed (do {! try.monad} [size (///unsigned.u2 size)] (\ ! map (|>> estimator ///unsigned.value) @@ -674,7 +675,7 @@ lookupswitch_mutation (: Mutation (function (_ [offset binary]) [(n.+ lookupswitch_size offset) - (try.assume + (try.assumed (do {! try.monad} [_ (binary.write/8 offset (hex "AB") binary) #let [offset (n.+ (///unsigned.value ..opcode_size) offset)] diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 7f6705de8..165f9a33f 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -106,8 +106,8 @@ #this @this #super @super #interfaces @interfaces - #fields (row.from_list =fields) - #methods (row.from_list =methods) + #fields (row.of_list =fields) + #methods (row.of_list =methods) #attributes attributes}))) (def: #export (writer class) diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 663dc472f..7f2a7aa26 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -115,8 +115,8 @@ [(def: <writer_name> (Writer <type>) (`` (|>> :representation - (~~ (template.splice <write>)) - (~~ (template.splice <writer>)))))] + (~~ (template.spliced <write>)) + (~~ (template.spliced <writer>)))))] [integer_writer Integer [] [binaryF.bits/32]] [float_writer Float [java/lang/Float::floatToRawIntBits ffi.int_to_long (:as I64)] [i32.i32 binaryF.bits/32]] diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index e7fa465d8..b4697768a 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -154,5 +154,5 @@ (def: #export empty Pool - [(|> 1 //unsigned.u2 try.assume //index.index) + [(|> 1 //unsigned.u2 try.assumed //index.index) row.empty]) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 414de077b..0eba9788e 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -26,7 +26,7 @@ (template [<code> <name>] [(def: #export <name> Tag - (|> <code> ///unsigned.u1 try.assume :abstraction))] + (|> <code> ///unsigned.u1 try.assumed :abstraction))] [01 utf8] [03 integer] diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index 49beb0a66..5cc5e9310 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -80,19 +80,19 @@ (def: #export (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) - (let [signature (array.from_list (list (:as java/lang/Object - class_name) - (:as java/lang/Object - bytecode) - (:as java/lang/Object - (|> 0 - (:as (primitive "java.lang.Long")) - ffi.long_to_int)) - (:as java/lang/Object - (|> bytecode - binary.size - (:as (primitive "java.lang.Long")) - ffi.long_to_int))))] + (let [signature (array.of_list (list (:as java/lang/Object + class_name) + (:as java/lang/Object + bytecode) + (:as java/lang/Object + (|> 0 + (:as (primitive "java.lang.Long")) + ffi.long_to_int)) + (:as java/lang/Object + (|> bytecode + binary.size + (:as (primitive "java.lang.Long")) + ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) (def: #export (new_library _) diff --git a/stdlib/source/library/lux/target/jvm/magic.lux b/stdlib/source/library/lux/target/jvm/magic.lux index 70859362b..fee2c425a 100644 --- a/stdlib/source/library/lux/target/jvm/magic.lux +++ b/stdlib/source/library/lux/target/jvm/magic.lux @@ -14,7 +14,7 @@ (def: #export code Magic - (|> (hex "CAFEBABE") //unsigned.u4 try.assume)) + (|> (hex "CAFEBABE") //unsigned.u4 try.assumed)) (def: #export writer //unsigned.writer/4) diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index e832b1667..3dcc4d7a2 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -55,7 +55,7 @@ @descriptor (//constant/pool.descriptor (//type.descriptor type)) attributes (|> attributes (monad.seq !) - (\ ! map row.from_list)) + (\ ! map row.of_list)) attributes (case code (#.Some code) (do ! diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 109486231..80db613de 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -41,7 +41,7 @@ (template: (!wrap value) (|> value //unsigned.u2 - try.assume + try.assumed :abstraction)) (template: (!unwrap value) diff --git a/stdlib/source/library/lux/target/jvm/type/alias.lux b/stdlib/source/library/lux/target/jvm/type/alias.lux index 594a75562..315dff281 100644 --- a/stdlib/source/library/lux/target/jvm/type/alias.lux +++ b/stdlib/source/library/lux/target/jvm/type/alias.lux @@ -128,4 +128,4 @@ return (..return aliasing) exceptions (<>.some (..exception aliasing))] (wrap (//.method [type_variables inputs return exceptions])))) - try.assume)) + try.assumed)) diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index f6c17a280..7f492290d 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -25,7 +25,7 @@ [(with_expansions [<raw> (template.identifier [<child> "'"])] (abstract: #export <raw> Any) (type: #export <child> - (`` (<| Return' Value' (~~ (template.splice <parents>)) <raw>))))] + (`` (<| Return' Value' (~~ (template.spliced <parents>)) <raw>))))] [[] Primitive] [[Object' Parameter'] Var] diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index eac2f5fcb..5c8f218b9 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -91,14 +91,14 @@ (|>> //.signature //signature.signature (<text>.run ..var') - try.to_maybe)) + try.maybe)) (def: #export name (-> (Type Var) Text) (|>> //.signature //signature.signature (<text>.run ..var') - try.assume)) + try.assumed)) (template [<name> <prefix> <constructor>] [(def: <name> @@ -155,7 +155,7 @@ (|>> //.signature //signature.signature (<text>.run (<>.after (<text>.this <prefix>) ..class)) - try.to_maybe))] + try.maybe))] [lower? //signature.lower_prefix //.lower] [upper? //signature.upper_prefix //.upper] @@ -166,7 +166,7 @@ (|>> //.signature //signature.signature (<text>.run (..class'' ..parameter)) - try.assume)) + try.assumed)) (def: #export value (Parser (Type Value)) @@ -224,7 +224,7 @@ (|>> //.signature //signature.signature (<text>.run parser) - try.assume))) + try.assumed))) (template [<name> <category> <parser>] [(def: #export <name> @@ -232,7 +232,7 @@ (|>> //.signature //signature.signature (<text>.run <parser>) - try.to_maybe))] + try.maybe))] [array? (Type Value) (do <>.monad @@ -262,4 +262,4 @@ (|>> //.signature //signature.signature (<text>.run ..declaration') - try.assume)) + try.assumed)) diff --git a/stdlib/source/library/lux/target/jvm/version.lux b/stdlib/source/library/lux/target/jvm/version.lux index 0aaf297de..d22ca84e2 100644 --- a/stdlib/source/library/lux/target/jvm/version.lux +++ b/stdlib/source/library/lux/target/jvm/version.lux @@ -13,12 +13,12 @@ (def: #export default_minor Minor - (|> 0 //unsigned.u2 try.assume)) + (|> 0 //unsigned.u2 try.assumed)) (template [<number> <name>] [(def: #export <name> Major - (|> <number> //unsigned.u2 try.assume))] + (|> <number> //unsigned.u2 try.assumed))] [45 v1_1] [46 v1_2] diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index 7e0202481..11f2c285e 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -61,7 +61,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -72,7 +72,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] [Var [Location' Computation' Expression' Code]] @@ -383,7 +383,7 @@ [(with_expansions [<apply> (template.identifier ["apply/" <arity>]) <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) - <definitions> (template.splice <function>+)] + <definitions> (template.spliced <function>+)] (def: #export (<apply> function <inputs>) (-> Expression <types> Computation) (..apply/* (.list <inputs>) function)) diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 6a3e01fbb..5008eae43 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -69,7 +69,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -80,7 +80,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] [Var [Location' Computation' Expression' Code]] @@ -239,7 +239,7 @@ [(with_expansions [<apply> (template.identifier ["apply/" <arity>]) <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) - <definitions> (template.splice <function>+)] + <definitions> (template.spliced <function>+)] (def: #export (<apply> function [<inputs>]) (-> Expression [<types>] Computation) (..apply/* (.list <inputs>) function)) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 49c3d8612..0cf6d2c27 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -469,7 +469,7 @@ [(with_expansions [<apply> (template.identifier ["apply/" <arity>]) <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) - <definitions> (template.splice <function>+)] + <definitions> (template.spliced <function>+)] (def: #export (<apply> function <inputs>) (-> (Expression Any) <types> (Computation Any)) (..apply/* function (.list <inputs>))) diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index fee2e206b..06f516e75 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -30,7 +30,7 @@ (template [<type> <super>+] [(with_expansions [<kind> (template.identifier [<type> "'"])] (abstract: #export (<kind> kind) Any) - (`` (type: #export <type> (|> Any <kind> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> Any <kind> (~~ (template.spliced <super>+))))))] [Expression [Code]] ) @@ -38,7 +38,7 @@ (template [<type> <super>+] [(with_expansions [<kind> (template.identifier [<type> "'"])] (abstract: #export (<kind> kind) Any) - (`` (type: #export (<type> <brand>) (|> <brand> <kind> (~~ (template.splice <super>+))))))] + (`` (type: #export (<type> <brand>) (|> <brand> <kind> (~~ (template.spliced <super>+))))))] [Var [Expression' Code]] ) @@ -217,7 +217,7 @@ [(with_expansions [<apply> (template.identifier ["apply/" <arity>]) <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) - <definitions> (template.splice <function>+)] + <definitions> (template.spliced <function>+)] (def: #export (<apply> function [<inputs>]) (-> Expression [<types>] Expression) (..apply (.list <inputs>) function)) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 3eb4f07b9..a7dd6907f 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -61,7 +61,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+))))))] [Expression [Code]] [Computation [Expression' Code]] @@ -74,7 +74,7 @@ (template [<type> <super>+] [(with_expansions [<brand> (template.identifier [<type> "'"])] (abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+))))))] + (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+))))))] [Literal [Computation' Expression' Code]] [Access [Location' Computation' Expression' Code]] @@ -445,7 +445,7 @@ [(with_expansions [<apply> (template.identifier ["apply/" <arity>]) <inputs> (arity_inputs <arity>) <types> (arity_types <arity>) - <definitions> (template.splice <function>+)] + <definitions> (template.spliced <function>+)] (def: #export (<apply> function <inputs>) (-> Expression <types> Computation) (..apply/* (.list <inputs>) function)) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 8e1308e04..43b94d459 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -43,14 +43,14 @@ (template [<type> <brand> <super>+] [(abstract: #export (<brand> brand) Any) - (`` (type: #export <type> (|> Any <brand> (~~ (template.splice <super>+)))))] + (`` (type: #export <type> (|> Any <brand> (~~ (template.spliced <super>+)))))] [Expression Expression' [Code]] ) (template [<type> <brand> <super>+] [(abstract: #export <brand> Any) - (`` (type: #export <type> (|> <brand> (~~ (template.splice <super>+)))))] + (`` (type: #export <type> (|> <brand> (~~ (template.spliced <super>+)))))] [Var Var' [Expression' Code]] [Computation Computation' [Expression' Code]] @@ -192,14 +192,14 @@ (template [<apply> <arg>+ <type>+ <function>+] [(`` (def: #export (<apply> procedure) - (-> Expression (~~ (template.splice <type>+)) Computation) - (function (_ (~~ (template.splice <arg>+))) - (..apply/* (list (~~ (template.splice <arg>+))) procedure)))) + (-> Expression (~~ (template.spliced <type>+)) Computation) + (function (_ (~~ (template.spliced <arg>+))) + (..apply/* (list (~~ (template.spliced <arg>+))) procedure)))) (`` (template [<definition> <function>] [(def: #export <definition> (<apply> (..var <function>)))] - (~~ (template.splice <function>+))))] + (~~ (template.spliced <function>+))))] [apply/1 [_0] [Expression] [[exact/1 "exact"] diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 6e28624ce..e14505e13 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -261,7 +261,7 @@ (let [message (|> coverage (list\map %.name) (text.join_with " & ")) - coverage (set.from_list name.hash coverage)] + coverage (set.of_list name.hash coverage)] (|> (..assert message condition) (promise\map (function (_ [tally documentation]) [(update@ #actual_coverage (set.union coverage) tally) @@ -277,7 +277,7 @@ (let [context (|> coverage (list\map %.name) (text.join_with " & ")) - coverage (set.from_list name.hash coverage)] + coverage (set.of_list name.hash coverage)] (random\map (promise\map (function (_ [tally documentation]) [(update@ #actual_coverage (set.union coverage) tally) documentation])) @@ -295,7 +295,7 @@ (def: coverage_separator Text - (text.from_code 31)) + (text.of_code 31)) (def: encode_coverage (-> (List Text) Text) @@ -308,7 +308,7 @@ (def: (decode_coverage module encoding) (-> Text Text (Set Name)) (loop [remaining encoding - output (set.from_list name.hash (list))] + output (set.of_list name.hash (list))] (case (text.split_with ..coverage_separator remaining) (#.Some [head tail]) (recur tail (set.add [module head] output)) diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index 5c043f696..cf1f340c0 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -45,11 +45,11 @@ (def: separator ":") -(def: parse_section +(def: section_parser (Parser Nat) (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))) -(def: parse_millis +(def: millis_parser (Parser Nat) (<>.either (|> (<text>.at_most 3 <text>.decimal) (<>.codec n.decimal) @@ -71,9 +71,9 @@ (wrap value) (<>.lift (exception.throw <exception> [value])))))] - [..hours parse_hour invalid_hour ..parse_section] - [..minutes parse_minute invalid_minute ..parse_section] - [..seconds parse_second invalid_second ..parse_section] + [..hours hour_parser invalid_hour ..section_parser] + [..minutes minute_parser invalid_minute ..section_parser] + [..seconds second_parser invalid_second ..section_parser] ) (abstract: #export Time @@ -86,7 +86,7 @@ Time (:abstraction 0)) - (def: #export (from_millis milli_seconds) + (def: #export (of_millis milli_seconds) (-> Nat (Try Time)) (if (n.< ..limit milli_seconds) (#try.Success (:abstraction milli_seconds)) @@ -134,12 +134,12 @@ second (to_millis duration.second) millis (to_millis duration.milli_second)] (do {! <>.monad} - [utc_hour ..parse_hour + [utc_hour ..hour_parser _ (<text>.this ..separator) - utc_minute ..parse_minute + utc_minute ..minute_parser _ (<text>.this ..separator) - utc_second ..parse_second - utc_millis ..parse_millis] + utc_second ..second_parser + utc_millis ..millis_parser] (wrap (:abstraction ($_ n.+ (n.* utc_hour hour) @@ -176,7 +176,7 @@ (def: #export (clock time) (-> Time Clock) - (let [time (|> time ..to_millis .int duration.from_millis) + (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)]] @@ -194,10 +194,10 @@ (duration.up (get@ #hour clock) duration.hour) (duration.up (get@ #minute clock) duration.minute) (duration.up (get@ #second clock) duration.second) - (duration.from_millis (.int (get@ #milli_second clock)))) + (duration.of_millis (.int (get@ #milli_second clock)))) duration.to_millis .nat - ..from_millis)) + ..of_millis)) (def: (encode time) (-> Time Text) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index e8de6d99e..c2ad8d025 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -84,9 +84,10 @@ (def: #export epoch Date - (try.assume (..date //year.epoch - #//month.January - ..minimum_day))) + (try.assumed + (..date //year.epoch + #//month.January + ..minimum_day))) (template [<name> <type> <field>] [(def: #export <name> @@ -137,11 +138,11 @@ (get@ #day sample))))))))) ) -(def: parse_section +(def: section_parser (Parser Nat) (<>.codec n.decimal (<text>.exactly 2 <text>.decimal))) -(def: parse_millis +(def: millis_parser (Parser Nat) (<>.either (|> (<text>.at_most 3 <text>.decimal) (<>.codec n.decimal) @@ -158,13 +159,13 @@ (def: <parser> (Parser Nat) (do <>.monad - [value ..parse_section] + [value ..section_parser] (if (and (n.>= <minimum> value) (n.<= <maximum> value)) (wrap value) (<>.lift (exception.throw <exception> [value])))))] - [1 12 parse_month invalid_month] + [1 12 month_parser invalid_month] ) (def: #export parser @@ -172,10 +173,10 @@ (do <>.monad [utc_year //year.parser _ (<text>.this ..separator) - utc_month ..parse_month + utc_month ..month_parser _ (<text>.this ..separator) #let [month (maybe.assume (dictionary.get utc_month ..month_by_number))] - utc_day ..parse_section] + utc_day ..section_parser] (<>.lift (..date utc_year month utc_day)))) (def: (encode value) @@ -305,7 +306,7 @@ (i.- (.int ..days_since_epoch))))) ## http://howardhinnant.github.io/date_algorithms.html -(def: #export (from_days days) +(def: #export (of_days days) (-> Int Date) (let [days (i.+ (.int ..days_since_epoch) days) era (|> (if (i.< +0 days) @@ -333,9 +334,10 @@ (inc year) year)] ## Coercing, because the year is already in internal form. - (try.assume (..date (:as Year year) - (maybe.assume (dictionary.get month ..month_by_number)) - day)))) + (try.assumed + (..date (:as Year year) + (maybe.assume (dictionary.get month ..month_by_number)) + day)))) (implementation: #export enum (Enum Date) @@ -343,7 +345,7 @@ (def: &order ..order) (def: succ - (|>> ..to_days inc ..from_days)) + (|>> ..to_days inc ..of_days)) (def: pred - (|>> ..to_days dec ..from_days))) + (|>> ..to_days dec ..of_days))) diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index 1de5dab4f..bcc65a0d3 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -28,7 +28,7 @@ {#.doc "Durations have a resolution of milli-seconds."} - (def: #export from_millis + (def: #export of_millis (-> Int Duration) (|>> :abstraction)) @@ -87,10 +87,10 @@ ) (def: #export empty - (..from_millis +0)) + (..of_millis +0)) (def: #export milli_second - (..from_millis +1)) + (..of_millis +1)) (template [<name> <scale> <base>] [(def: #export <name> diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index ecefe3491..a73a603ba 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -37,7 +37,7 @@ {#.doc "Instant is defined as milliseconds since the epoch."} - (def: #export from_millis + (def: #export of_millis (-> Int Instant) (|>> :abstraction)) @@ -47,7 +47,7 @@ (def: #export (span from to) (-> Instant Instant Duration) - (duration.from_millis (i.- (:representation from) (:representation to)))) + (duration.of_millis (i.- (:representation from) (:representation to)))) (def: #export (shift duration instant) (-> Duration Instant Instant) @@ -55,7 +55,7 @@ (def: #export (relative instant) (-> Instant Duration) - (|> instant :representation duration.from_millis)) + (|> instant :representation duration.of_millis)) (def: #export (absolute offset) (-> Duration Instant) @@ -89,7 +89,7 @@ (def: #export epoch {#.doc "The instant corresponding to 1970-01-01T00:00:00Z"} Instant - (..from_millis +0)) + (..of_millis +0)) (def: millis_per_day (duration.query duration.milli_second duration.day)) @@ -104,8 +104,8 @@ +0 [days millis] _ [(dec days) (i.+ ..millis_per_day millis)])) (i./% ..millis_per_day offset))] - [(date.from_days days) - (duration.from_millis day_time)])) + [(date.of_days days) + (duration.of_millis day_time)])) (template [<value> <definition>] [(def: <definition> Text <value>)] @@ -116,10 +116,13 @@ (def: (clock_time duration) (-> Duration Time) - (let [time (if (\ duration.order < duration.empty duration) - (duration.merge duration.day duration) - duration)] - (|> time duration.to_millis .nat //.from_millis try.assume))) + (|> (if (\ duration.order < duration.empty duration) + (duration.merge duration.day duration) + duration) + duration.to_millis + .nat + //.of_millis + try.assumed)) (def: (encode instant) (-> Instant Text) @@ -154,44 +157,44 @@ (def: #export now (IO Instant) - (io (..from_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") - @.jvm (|> ("jvm member invoke static" [] "java.lang.System" "currentTimeMillis" []) - ("jvm object cast") - (: (primitive "java.lang.Long")) - (:as Int)) - @.js (let [date ("js object new" ("js constant" "Date") [])] - (|> ("js object do" "getTime" date []) - (:as Frac) - "lux f64 i64")) - @.python (let [time ("python import" "time")] - (|> ("python object do" "time" time) - (:as Frac) - (f.* +1,000.0) - "lux f64 i64")) - @.lua (|> ("lua constant" "os.time") - "lua apply" - (:as Int) - (i.* +1,000)) - @.ruby (let [% ("ruby constant" "Time") - % ("ruby object do" "now" %)] - (|> ("ruby object do" "to_f" %) + (io (..of_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") + @.jvm (|> ("jvm member invoke static" [] "java.lang.System" "currentTimeMillis" []) + ("jvm object cast") + (: (primitive "java.lang.Long")) + (:as Int)) + @.js (let [date ("js object new" ("js constant" "Date") [])] + (|> ("js object do" "getTime" date []) + (:as Frac) + "lux f64 i64")) + @.python (let [time ("python import" "time")] + (|> ("python object do" "time" time) (:as Frac) (f.* +1,000.0) "lux f64 i64")) - @.php (|> ("php constant" "time") - "php apply" - (:as Int) - (i.* +1,000)) - @.scheme (|> ("scheme constant" "current-second") - (:as Int) - (i.* +1,000) - ("scheme apply" ("scheme constant" "exact")) - ("scheme apply" ("scheme constant" "truncate"))) - @.common_lisp (|> ("common_lisp constant" "get-universal-time") - "common_lisp apply" - (:as Int) - (i.* +1,000)) - })))) + @.lua (|> ("lua constant" "os.time") + "lua apply" + (:as Int) + (i.* +1,000)) + @.ruby (let [% ("ruby constant" "Time") + % ("ruby object do" "now" %)] + (|> ("ruby object do" "to_f" %) + (:as Frac) + (f.* +1,000.0) + "lux f64 i64")) + @.php (|> ("php constant" "time") + "php apply" + (:as Int) + (i.* +1,000)) + @.scheme (|> ("scheme constant" "current-second") + (:as Int) + (i.* +1,000) + ("scheme apply" ("scheme constant" "exact")) + ("scheme apply" ("scheme constant" "truncate"))) + @.common_lisp (|> ("common_lisp constant" "get-universal-time") + "common_lisp apply" + (:as Int) + (i.* +1,000)) + })))) (template [<field> <type> <post_processing>] [(def: #export (<field> instant) @@ -227,9 +230,9 @@ +6 #day.Saturday _ (undefined)))) -(def: #export (from_date_time date time) +(def: #export (of_date_time date time) (-> Date Time Instant) (|> (date.to_days date) (i.* (duration.to_millis duration.day)) (i.+ (.int (//.to_millis time))) - ..from_millis)) + ..of_millis)) diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 3d49eb706..7fcbb94eb 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -225,7 +225,7 @@ (def: module_aliases (-> .Module Aliases) - (|>> (get@ #.module_aliases) (dictionary.from_list text.hash))) + (|>> (get@ #.module_aliases) (dictionary.of_list text.hash))) (def: #export (compiler expander prelude write_directive) (All [anchor expression directive] @@ -252,7 +252,7 @@ #let [descriptor {#descriptor.hash hash #descriptor.name module #descriptor.file (get@ #///.file input) - #descriptor.references (set.from_list text.hash dependencies) + #descriptor.references (set.of_list text.hash dependencies) #descriptor.state #.Compiled #descriptor.registry final_registry}]] (wrap [state diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index 3d3f4cde0..2e5fb6fed 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- Module) - [type (#+ :share)] + [type (#+ :sharing)] ["." debug] ["@" target] [abstract @@ -176,22 +176,22 @@ .Lux <State+> (Try <State+>))) - (|> (:share [<type_vars>] - <State+> - state - - (///directive.Operation <type_vars> Any) - (do ///phase.monad - [_ (///directive.lift_analysis - (///analysis.install analysis_state)) - _ (///directive.lift_analysis - (extension.with extender analysers)) - _ (///directive.lift_synthesis - (extension.with extender synthesizers)) - _ (///directive.lift_generation - (extension.with extender (:assume generators))) - _ (extension.with extender (:assume directives))] - (wrap []))) + (|> (:sharing [<type_vars>] + <State+> + state + + (///directive.Operation <type_vars> Any) + (do ///phase.monad + [_ (///directive.lift_analysis + (///analysis.install analysis_state)) + _ (///directive.lift_analysis + (extension.with extender analysers)) + _ (///directive.lift_synthesis + (extension.with extender synthesizers)) + _ (///directive.lift_generation + (extension.with extender (:assume generators))) + _ (extension.with extender (:assume directives))] + (wrap []))) (///phase.run' state) (\ try.monad map product.left))) @@ -389,74 +389,74 @@ (-> <Context> (-> <Compiler> <Importer>))) (let [current (stm.var initial) - pending (:share [<type_vars>] - <Context> - initial - - (Var (Dictionary Module <Pending>)) - (:assume (stm.var (dictionary.new text.hash)))) + pending (:sharing [<type_vars>] + <Context> + initial + + (Var (Dictionary Module <Pending>)) + (:assume (stm.var (dictionary.new text.hash)))) dependence (: (Var Dependence) (stm.var ..independence))] (function (_ compile) (function (import! importer module) (do {! promise.monad} - [[return signal] (:share [<type_vars>] - <Context> - initial - - (Promise [<Return> (Maybe [<Context> - archive.ID - <Signal>])]) - (:assume - (stm.commit - (do {! stm.monad} - [dependence (if (text\= archive.runtime_module importer) - (stm.read dependence) - (do ! - [[_ dependence] (stm.update (..depend importer module) dependence)] - (wrap dependence)))] - (case (..verify_dependencies importer module dependence) - (#try.Failure error) - (wrap [(promise.resolved (#try.Failure error)) - #.None]) - - (#try.Success _) - (do ! - [[archive state] (stm.read current)] - (if (archive.archived? archive module) - (wrap [(promise\wrap (#try.Success [archive state])) - #.None]) - (do ! - [@pending (stm.read pending)] - (case (dictionary.get module @pending) - (#.Some [return signal]) - (wrap [return - #.None]) - - #.None - (case (if (archive.reserved? archive module) - (do try.monad - [module_id (archive.id module archive)] - (wrap [module_id archive])) - (archive.reserve module archive)) - (#try.Success [module_id archive]) - (do ! - [_ (stm.write [archive state] current) - #let [[return signal] (:share [<type_vars>] - <Context> - initial - - <Pending> - (promise.promise []))] - _ (stm.update (dictionary.put module [return signal]) pending)] - (wrap [return - (#.Some [[archive state] - module_id - signal])])) + [[return signal] (:sharing [<type_vars>] + <Context> + initial + + (Promise [<Return> (Maybe [<Context> + archive.ID + <Signal>])]) + (:assume + (stm.commit + (do {! stm.monad} + [dependence (if (text\= archive.runtime_module importer) + (stm.read dependence) + (do ! + [[_ dependence] (stm.update (..depend importer module) dependence)] + (wrap dependence)))] + (case (..verify_dependencies importer module dependence) + (#try.Failure error) + (wrap [(promise.resolved (#try.Failure error)) + #.None]) + + (#try.Success _) + (do ! + [[archive state] (stm.read current)] + (if (archive.archived? archive module) + (wrap [(promise\wrap (#try.Success [archive state])) + #.None]) + (do ! + [@pending (stm.read pending)] + (case (dictionary.get module @pending) + (#.Some [return signal]) + (wrap [return + #.None]) - (#try.Failure error) - (wrap [(promise\wrap (#try.Failure error)) - #.None]))))))))))) + #.None + (case (if (archive.reserved? archive module) + (do try.monad + [module_id (archive.id module archive)] + (wrap [module_id archive])) + (archive.reserve module archive)) + (#try.Success [module_id archive]) + (do ! + [_ (stm.write [archive state] current) + #let [[return signal] (:sharing [<type_vars>] + <Context> + initial + + <Pending> + (promise.promise []))] + _ (stm.update (dictionary.put module [return signal]) pending)] + (wrap [return + (#.Some [[archive state] + module_id + signal])])) + + (#try.Failure error) + (wrap [(promise\wrap (#try.Failure error)) + #.None]))))))))))) _ (case signal #.None (wrap []) @@ -492,7 +492,7 @@ (archive.archived archive)) #let [additions (|> modules (list\map product.left) - (set.from_list text.hash))]] + (set.of_list text.hash))]] (wrap (update@ [#extension.state #///directive.analysis #///directive.state @@ -501,10 +501,10 @@ (|> analysis_state (:as .Lux) (update@ #.modules (function (_ current) - (list\compose (list.filter (|>> product.left - (set.member? additions) - not) - current) + (list\compose (list.only (|>> product.left + (set.member? additions) + not) + current) modules))) :assume)) state)))) @@ -514,20 +514,20 @@ (-> Module <State+> <State+>)) (|> (///directive.set_current_module module) (///phase.run' state) - try.assume + try.assumed product.left)) (def: #export (compile import static expander platform compilation context) (All [<type_vars>] (-> Import Static Expander <Platform> Compilation <Context> <Return>)) (let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation - base_compiler (:share [<type_vars>] - <Context> - context - - (///.Compiler <State+> .Module Any) - (:assume - ((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list)))) + base_compiler (:sharing [<type_vars>] + <Context> + context + + (///.Compiler <State+> .Module Any) + (:assume + ((//init.compiler expander syntax.prelude (get@ #write platform)) $.key (list)))) compiler (..parallel context (function (_ importer import! module_id [archive state] module) @@ -545,14 +545,14 @@ (list))] (let [new_dependencies (get@ #///.dependencies compilation) all_dependencies (list\compose new_dependencies all_dependencies) - continue! (:share [<type_vars>] - <Platform> - platform - - (-> <Context> (///.Compilation <State+> .Module Any) (List Module) - (Action [Archive <State+>])) - (:assume - recur))] + continue! (:sharing [<type_vars>] + <Platform> + platform + + (-> <Context> (///.Compilation <State+> .Module Any) (List Module) + (Action [Archive <State+>])) + (:assume + recur))] (do ! [[archive state] (case new_dependencies #.Nil @@ -566,14 +566,14 @@ #let [archive (|> archive,document+ (list\map product.left) (list\fold archive.merge archive))]] - (wrap [archive (try.assume + (wrap [archive (try.assumed (..updated_state archive state))])))] (case ((get@ #///.process compilation) ## TODO: The "///directive.set_current_module" below shouldn't be necessary. Remove it ASAP. ## TODO: The context shouldn't need to be re-set either. (|> (///directive.set_current_module module) (///phase.run' state) - try.assume + try.assumed product.left) archive) (#try.Success [state more|done]) @@ -584,7 +584,7 @@ (#.Right [descriptor document output]) (do ! [#let [_ (debug.log! (..module_compilation_log module state)) - descriptor (set@ #descriptor.references (set.from_list text.hash all_dependencies) descriptor)] + descriptor (set@ #descriptor.references (set.of_list text.hash all_dependencies) descriptor)] _ (..cache_module static platform module_id [descriptor document output])] (case (archive.add module [descriptor document output] archive) (#try.Success archive) 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 d447b8d1d..327488817 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 @@ -129,7 +129,7 @@ (#.Product _) (|> caseT - type.flatten_tuple + type.flat_tuple (list\map (re_quantify envs)) type.tuple (\ ///.monad wrap)) @@ -193,7 +193,7 @@ [inputT' (simplify_case inputT)] (.case inputT' (#.Product _) - (let [subs (type.flatten_tuple inputT') + (let [subs (type.flat_tuple inputT') num_subs (maybe.default (list.size subs) num_tags) num_sub_patterns (list.size sub_patterns) @@ -251,7 +251,7 @@ [inputT' (simplify_case inputT)] (.case inputT' (#.Sum _) - (let [flat_sum (type.flatten_variant inputT') + (let [flat_sum (type.flat_variant inputT') size_sum (list.size flat_sum) num_cases (maybe.default size_sum num_tags) idx (/.tag lefts right?)] 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 df92858ec..bc4fad3d3 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 @@ -169,11 +169,11 @@ (ex.report ["Coverage so-far" (%coverage so_far)] ["Coverage addition" (%coverage addition)])) -(def: (flatten_alt coverage) +(def: (flat_alt coverage) (-> Coverage (List Coverage)) (case coverage (#Alt left right) - (list& left (flatten_alt right)) + (list& left (flat_alt right)) _ (list coverage))) @@ -197,8 +197,8 @@ (= rightR rightS)) [(#Alt _) (#Alt _)] - (let [flatR (flatten_alt reference) - flatS (flatten_alt sample)] + (let [flatR (flat_alt reference) + flatS (flat_alt sample)] (and (n.= (list.size flatR) (list.size flatS)) (list.every? (function (_ [coverageR coverageS]) (= coverageR coverageS)) @@ -346,7 +346,7 @@ (#try.Failure error) (try.fail error)) ))))] - [successA possibilitiesSF] (fuse_once addition (flatten_alt so_far))] + [successA possibilitiesSF] (fuse_once addition (flat_alt so_far))] (loop [successA successA possibilitiesSF possibilitiesSF] (case successA diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux index 9ad503709..ace669fbe 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux @@ -228,7 +228,7 @@ (#.Product _) (///\wrap (|> inferT - (type.function (type.flatten_tuple inferT)) + (type.function (type.flat_tuple inferT)) (substitute_bound target originalT))) _ @@ -258,7 +258,7 @@ [#.ExQ]) (#.Sum _) - (let [cases (type.flatten_variant currentT) + (let [cases (type.flat_variant currentT) actual_size (list.size cases) boundary (dec expected_size)] (cond (or (n.= expected_size actual_size) 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 0f8106a7d..c49e936ec 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 @@ -101,7 +101,7 @@ (/.with_stack ..cannot_analyse_variant [expectedT' tag valueC] (case expectedT (#.Sum _) - (let [flat (type.flatten_variant expectedT)] + (let [flat (type.flat_variant expectedT)] (case (list.nth tag flat) (#.Some variant_type) (do ! @@ -170,7 +170,7 @@ (do {! ///.monad} [expectedT (///extension.lift meta.expected_type) membersA+ (: (Operation (List Analysis)) - (loop [membersT+ (type.flatten_tuple expectedT) + (loop [membersT+ (type.flat_tuple expectedT) membersC+ members] (case [membersT+ membersC+] [(#.Cons memberT #.Nil) _] @@ -315,7 +315,7 @@ (wrap []) (/.throw ..record_size_mismatch [size_ts size_record recordT record])) #let [tuple_range (list.indices size_ts) - tag->idx (dictionary.from_list name.hash (list.zip/2 tag_set tuple_range))] + tag->idx (dictionary.of_list name.hash (list.zip/2 tag_set tuple_range))] idx->val (monad.fold ! (function (_ [key val] idx->val) (do ! 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 e5af044c3..f47ca7aea 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 @@ -343,7 +343,7 @@ [(reflection.reflection reflection.float) [box.float jvm.float]] [(reflection.reflection reflection.double) [box.double jvm.double]] [(reflection.reflection reflection.char) [box.char jvm.char]]) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) (def: (jvm_type luxT) (-> .Type (Operation (Type Value))) @@ -950,7 +950,7 @@ (inheritance_candidate_parents class_loader currentT to_class toT fromC) (class_candidate_parents class_loader current_name currentT to_name to_class)))] (case (|> candidate_parents - (list.filter product.right) + (list.only product.right) (list\map product.left)) (#.Cons [next_name nextT] _) (recur [next_name nextT]) @@ -1170,7 +1170,7 @@ list.reverse) num_owner_tvars (list.size owner_tvars) owner_tvarsT (|> lux_tvars (list.take num_owner_tvars) (list\map product.right)) - mapping (dictionary.from_list text.hash lux_tvars)] + mapping (dictionary.of_list text.hash lux_tvars)] [owner_tvarsT mapping])) (def: (method_signature method_style method) @@ -1280,7 +1280,7 @@ (-> (List (Type Var)) (List (Type Var)) Aliasing) (|> (list.zip/2 (list\map jvm_parser.name actual) (list\map jvm_parser.name expected)) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) (def: (method_candidate class_loader actual_class_tvars class_name actual_method_tvars method_name method_style inputsJT) (-> java/lang/ClassLoader (List (Type Var)) External (List (Type Var)) Text Method_Style (List (Type Value)) (Operation Method_Signature)) @@ -1290,7 +1290,7 @@ candidates (|> class java/lang/Class::getDeclaredMethods array.to_list - (list.filter (|>> java/lang/reflect/Method::getName (text\= method_name))) + (list.only (|>> java/lang/reflect/Method::getName (text\= method_name))) (monad.map ! (: (-> java/lang/reflect/Method (Operation Evaluation)) (function (_ method) (do ! @@ -1542,13 +1542,13 @@ (list (/////analysis.text argument) (value_analysis argumentJT)))) -(template [<name> <filter>] +(template [<name> <only>] [(def: <name> (-> (java/lang/Class java/lang/Object) (Try (List [Text (Type Method)]))) (|>> java/lang/Class::getDeclaredMethods array.to_list - <filter> + <only> (monad.map try.monad (function (_ method) (do {! try.monad} @@ -1568,7 +1568,7 @@ (wrap [(java/lang/reflect/Method::getName method) (jvm.method [type_variables inputs return exceptions])]))))))] - [abstract_methods (list.filter (|>> java/lang/reflect/Method::getModifiers java/lang/reflect/Modifier::isAbstract))] + [abstract_methods (list.only (|>> java/lang/reflect/Method::getModifiers java/lang/reflect/Modifier::isAbstract))] [methods (<|)] ) @@ -1913,7 +1913,7 @@ (do {! phase.monad} [parent_parameters (|> parent_parameters (monad.map maybe.monad jvm_parser.var?) - try.from_maybe + try.of_maybe phase.lift)] (|> super_parameters (monad.map ! (..reflection_type mapping)) @@ -2038,15 +2038,15 @@ (-> (List [Text (Type Method)]) (List [Text (Type Method)]) (List [Text (Type Method)])) - (list.filter (function (_ [sub_name subJT]) - (|> super_set - (list.filter (function (_ [super_name superJT]) - (and (text\= super_name sub_name) - (jvm\= superJT subJT)))) - list.size - (n.= 1) - not)) - sub_set)) + (list.only (function (_ [sub_name subJT]) + (|> super_set + (list.only (function (_ [super_name superJT]) + (and (text\= super_name sub_name) + (jvm\= superJT subJT)))) + list.size + (n.= 1) + not)) + sub_set)) (exception: #export (class_parameter_mismatch {expected (List Text)} {actual (List (Type Parameter))}) 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 3fb0c967e..95b04daa2 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 @@ -26,4 +26,4 @@ (-> Text (-> (Bundle s i o) (Bundle s i o)))) (|>> dictionary.entries (list\map (function (_ [key val]) [(format prefix " " key) val])) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index 8678c6269..d11c6cb49 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -191,7 +191,7 @@ (^template [<tag> <type> <constant>] [[_ (<tag> value)] (do pool.monad - [constant (`` (|> value (~~ (template.splice <constant>)))) + [constant (`` (|> value (~~ (template.spliced <constant>)))) attribute (attribute.constant constant)] (field.field ..constant::modifier name <type> (row.row attribute)))]) ([#.Bit type.boolean [(case> #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] 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 8fd5d2416..b67f9287b 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 @@ -22,7 +22,7 @@ [math [number ["n" nat]]] - ["." type (#+ :share) + ["." type (#+ :sharing) ["." check]]]] ["." /// (#+ Extender) ["#." bundle] @@ -328,12 +328,12 @@ valueC) _ (<| <scope> (///.install extender (:as Text name)) - (:share [anchor expression directive] - (Handler anchor expression directive) - handler - - <type> - (:assume handlerV))) + (:sharing [anchor expression directive] + (Handler anchor expression directive) + handler + + <type> + (:assume handlerV))) _ (/////directive.lift_generation (/////generation.log! (format <description> " " (%.text (:as Text name)))))] (wrap /////directive.no_requirements)) 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 a74c72d38..9cc6c1dbc 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 @@ -156,7 +156,7 @@ (/.install "%" (binary (product.uncurry _.%))) (/.install "=" (binary (product.uncurry _.=))) (/.install "<" (binary (product.uncurry _.<))) - (/.install "i64" (unary //runtime.i64//from_number)) + (/.install "i64" (unary //runtime.i64//of_number)) (/.install "encode" (unary (_.do "toString" (list)))) (/.install "decode" (unary f64//decode))))) @@ -168,7 +168,7 @@ (/.install "<" (binary (product.uncurry _.<))) (/.install "concat" (binary text//concat)) (/.install "index" (trinary text//index)) - (/.install "size" (unary (|>> (_.the "length") //runtime.i64//from_number))) + (/.install "size" (unary (|>> (_.the "length") //runtime.i64//of_number))) (/.install "char" (binary (product.uncurry //runtime.text//char))) (/.install "clip" (trinary text//clip)) ))) 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 edc4e2321..67966efe8 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 @@ -36,7 +36,7 @@ (def: array::length (Unary Expression) - (|>> (_.the "length") //runtime.i64//from_number)) + (|>> (_.the "length") //runtime.i64//of_number)) (def: (array::read [indexG arrayG]) (Binary Expression) 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 da55a6c32..d71b9dbcc 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 @@ -116,7 +116,7 @@ [branchG (phase archive branch) @branch ///runtime.forge-label] (wrap [(list\map (function (_ char) - [(try.assume (signed.s4 (.int char))) @branch]) + [(try.assumed (signed.s4 (.int char))) @branch]) chars) ($_ _.compose (_.set-label @branch) 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 2d31a6b71..aa07cbe9f 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 @@ -85,7 +85,7 @@ (list\map (|>> product.right synthesis.path/then //case.dependencies)) (list& (//case.dependencies (synthesis.path/then else))) list.concat - (set.from_list _.hash) + (set.of_list _.hash) set.to_list) @expression (_.constant (reference.artifact [context_module context_artifact])) directive (_.define_function @expression (list& (_.parameter @input) (list\map _.reference foreigns)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 65783662a..bfd952cc9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -391,7 +391,7 @@ (runtime: i64//-one (i64//negate i64//one)) -(runtime: (i64//from_number value) +(runtime: (i64//of_number value) (_.return (<| (_.? (_.not_a_number? value) i64//zero) (_.? (_.<= (_.negate i64//2^63) value) @@ -399,7 +399,7 @@ (_.? (|> value (_.+ (_.i32 +1)) (_.>= i64//2^63)) i64//max) (_.? (|> value (_.< (_.i32 +0))) - (|> value _.negate i64//from_number i64//negate)) + (|> value _.negate i64//of_number i64//negate)) (..i64 (|> value (_./ i64//2^32) _.to_i32) (|> value (_.% i64//2^32) _.to_i32))))) @@ -590,7 +590,7 @@ (_.define remainder subject) (_.while (i64//<= remainder parameter) (with_vars [approximate approximate_result approximate_remainder log2 delta] - (let [approximate_result' (i64//from_number approximate) + (let [approximate_result' (i64//of_number approximate) approx_remainder (i64//* parameter approximate_result)] ($_ _.then (_.define approximate (|> (i64//to_number remainder) @@ -647,7 +647,7 @@ @i64//+ @i64//negate @i64//to_number - @i64//from_number + @i64//of_number @i64//- @i64//* @i64//< @@ -662,7 +662,7 @@ (_.define idx (|> text (_.do "indexOf" (list part (i64//to_number start))))) (_.return (_.? (_.= (_.i32 -1) idx) ..none - (..some (i64//from_number idx))))))) + (..some (i64//of_number idx))))))) (runtime: (text//clip offset length text) (_.return (|> text (_.do "substring" (list (_.the ..i64_low_field offset) @@ -675,7 +675,7 @@ (_.define result (|> text (_.do "charCodeAt" (list (_.the ..i64_low_field idx))))) (_.if (_.not_a_number? result) (_.throw (_.string "[Lux Error] Cannot get char from text.")) - (_.return (i64//from_number result)))))) + (_.return (i64//of_number result)))))) (def: runtime//text Statement diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux index 5497cc094..a3e4fc738 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/field/variable/partial/count.lux @@ -18,7 +18,7 @@ (def: #export initial (Bytecode Any) - (|> +0 signed.s1 try.assume _.bipush)) + (|> +0 signed.s1 try.assumed _.bipush)) (def: this _.aload_0) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index e42804d63..da80cbfdd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -153,5 +153,5 @@ (monad.seq _.monad))]] ($_ _.compose ///partial/count.value - (_.tableswitch (try.assume (signed.s4 +0)) @default [@labelsH @labelsT]) + (_.tableswitch (try.assumed (signed.s4 +0)) @default [@labelsH @labelsT]) cases))))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index 3785f9a40..ef5717521 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -56,7 +56,7 @@ type.void (list)])) -(def: no-partials (|> 0 unsigned.u1 try.assume _.bipush)) +(def: no-partials (|> 0 unsigned.u1 try.assumed _.bipush)) (def: #export (super environment-size arity) (-> Nat Arity (Bytecode Any)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux index 0441f3b00..67a384781 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux @@ -133,7 +133,7 @@ _.return)))] [..class (<| (format.run class.writer) - try.assume + try.assumed (class.class version.v6_0 ..program::modifier (name.internal ..class) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux index 28d9b81cd..86a980c95 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -516,7 +516,7 @@ class.public class.final)) bytecode (<| (format.run class.writer) - try.assume + try.assumed (class.class jvm/version.v6_0 modifier (name.internal class) @@ -584,7 +584,7 @@ //function/count.type (row.row))) bytecode (<| (format.run class.writer) - try.assume + try.assumed (class.class jvm/version.v6_0 modifier (name.internal class) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 18b65c352..6004e31a8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -90,8 +90,8 @@ [directive instantiation] (: [Statement Expression] (case (|> (synthesis.path/then bodyS) //case.dependencies - (set.from_list _.hash) - (set.difference (set.from_list _.hash locals)) + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) set.to_list) #.Nil [(_.function @loop locals 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 9dc7e9e78..8b99967a2 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 @@ -82,11 +82,11 @@ list.enumeration (list\map (|>> product.left (n.+ start) //case.register _.parameter))) @loop (_.constant (///reference.artifact [loop_module loop_artifact])) - loop_variables (set.from_list _.hash (list\map product.right locals)) + loop_variables (set.of_list _.hash (list\map product.right locals)) referenced_variables (: (-> Synthesis (Set Var)) (|>> synthesis.path/then //case.dependencies - (set.from_list _.hash))) + (set.of_list _.hash))) [directive instantiation] (: [Statement Expression] (case (|> (list\map referenced_variables initsS+) (list\fold set.union (referenced_variables bodyS)) 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 4ec21d754..96c1d1ce1 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 @@ -88,8 +88,8 @@ [directive instantiation] (: [(Statement Any) (Expression Any)] (case (|> (synthesis.path/then bodyS) //case.dependencies - (set.from_list _.hash) - (set.difference (set.from_list _.hash locals)) + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) set.to_list) #.Nil [actual_loop diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index 4682a593d..40ef044f6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -303,7 +303,7 @@ ..i64_high (_.< (_.int +0)))))))) -(runtime: (i64::from_float input) +(runtime: (i64::of_float input) (_.cond (list [(_.apply (list input) (_.var "is.nan")) i64::zero] [(|> input (_.<= (_.negate f2^63))) @@ -311,7 +311,7 @@ [(|> input (_.+ (_.float +1.0)) (_.>= f2^63)) i64::max] [(|> input (_.< (_.float +0.0))) - (|> input _.negate i64::from_float i64::negate)]) + (|> input _.negate i64::of_float i64::negate)]) (i64::new (|> input (_./ f2^32)) (|> input (_.%% f2^32))))) @@ -483,7 +483,7 @@ (_.or (|> remainder (i64::= param)))) (let [calc_rough_estimate (_.apply (list (|> (i64::to_float remainder) (_./ (i64::to_float param)))) (_.var "floor")) - calc_approximate_result (i64::from_float approximate) + calc_approximate_result (i64::of_float approximate) calc_approximate_remainder (|> approximate_result (i64::* param)) delta (_.if (|> (_.float +48.0) (_.<= log2)) (_.float +1.0) @@ -551,7 +551,7 @@ (runtime: (io::current_time! _) (|> current_time_float (_.* (_.float +1,000.0)) - i64::from_float)) + i64::of_float)) (def: runtime::io Expression @@ -676,7 +676,7 @@ @f2^63 @i64::new - @i64::from_float + @i64::of_float @i64::and @i64::or @@ -758,7 +758,7 @@ (_.nth (_.int +1)))) (_.if (|> idx (_.= (_.int -1))) ..none - (..some (i64::from_float (|> idx (_.+ startF)))))) + (..some (i64::of_float (|> idx (_.+ startF)))))) ..none)))) (runtime: (text::clip text from to) @@ -780,7 +780,7 @@ (_.if (|> idx (within? (_.length text))) ($_ _.then (_.set! idx (inc idx)) - (..some (i64::from_float (char_at idx text)))) + (..some (i64::of_float (char_at idx text)))) ..none)) (def: runtime::text 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 02938eb7a..e0f9ea89e 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 @@ -414,7 +414,7 @@ (update@ #bindings (set.union (|> initsS+ list.enumeration (list\map (|>> product.left (n.+ start))) - (set.from_list n.hash)))) + (set.of_list n.hash)))) (for_synthesis iterationS) (get@ #dependencies))) (list\fold for_synthesis synthesis_storage initsS+)) 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 07e7a54b9..9e292c485 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 @@ -297,18 +297,18 @@ (do try.monad [#let [baseline (|> redundancy dictionary.keys - (set.from_list n.hash))] + (set.of_list n.hash))] [redundancy pre] (recur [redundancy pre]) #let [bindings (|> redundancy dictionary.keys - (set.from_list n.hash) + (set.of_list n.hash) (set.difference baseline))] [redundancy post] (recur [redundancy post]) #let [redundants (|> redundancy dictionary.entries - (list.filter (function (_ [register redundant?]) - (and (set.member? bindings register) - redundant?))) + (list.only (function (_ [register redundant?]) + (and (set.member? bindings register) + redundant?))) (list\map product.left))]] (wrap [(list\fold dictionary.remove redundancy (set.to_list bindings)) (|> redundants 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 de266d0ad..e5329f36a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -236,11 +236,11 @@ ## Form and tuple syntax is mostly the same, differing only in the ## delimiters involved. ## They may have an arbitrary number of arbitrary Code nodes as elements. - [parse_form ..close_form #.Form] - [parse_tuple ..close_tuple #.Tuple] + [form_parser ..close_form #.Form] + [tuple_parser ..close_tuple #.Tuple] ) -(inline: (parse_record parse where offset source_code) +(inline: (record_parser parse where offset source_code) (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) (loop [source (: Source [(!forward 1 where) offset source_code]) @@ -265,7 +265,7 @@ (#.Left [[where offset source_code] (exception.construct ..text_cannot_contain_new_lines content)]))) -(def: (parse_text where offset source_code) +(def: (text_parser where offset source_code) (-> Location Offset Text (Either [Source Text] [Source Code])) (case ("lux text index" offset (static ..text_delimiter) source_code) (#.Some g!end) @@ -279,7 +279,7 @@ (#.Text g!content)]])) _ - (!failure ..parse_text where offset source_code))) + (!failure ..text_parser where offset source_code))) (with_expansions [<digits> (as_is "0" "1" "2" "3" "4" "5" "6" "7" "8" "9") <non_name_chars> (template [<char>] @@ -307,7 +307,7 @@ [[<digits> <digit_separator>] @then - (~~ (template.splice @else_options))] + (~~ (template.spliced @else_options))] ## else @else))) @@ -349,14 +349,14 @@ (with_expansions [<int_output> (as_is (!number_output source_code start end int.decimal #.Int)) <frac_output> (as_is (!number_output source_code start end frac.decimal #.Frac)) - <failure> (!failure ..parse_frac where offset source_code) + <failure> (!failure ..frac_parser where offset source_code) <frac_separator> (static ..frac_separator) <signs> (template [<sign>] [(~~ (static <sign>))] [..positive_sign] [..negative_sign])] - (inline: (parse_frac source_code//size start where offset source_code) + (inline: (frac_parser source_code//size start where offset source_code) (-> Nat Nat Location Offset Text (Either [Source Text] [Source Code])) (loop [end offset @@ -381,7 +381,7 @@ <frac_output>)))) - (inline: (parse_signed source_code//size start where offset source_code) + (inline: (signed_parser source_code//size start where offset source_code) (-> Nat Nat Location Offset Text (Either [Source Text] [Source Code])) (loop [end offset] @@ -390,7 +390,7 @@ (recur (!inc end)) [[<frac_separator>] - (parse_frac source_code//size start where (!inc end) source_code)] + (frac_parser source_code//size start where (!inc end) source_code)] <int_output>)))) ) @@ -406,22 +406,22 @@ [] (!number_output source_code start g!end <codec> <tag>)))))] - [parse_nat n.decimal #.Nat] - [parse_rev rev.decimal #.Rev] + [nat_parser n.decimal #.Nat] + [rev_parser rev.decimal #.Rev] ) -(template: (!parse_signed source_code//size offset where source_code @aliases @end) +(template: (!signed_parser source_code//size offset where source_code @aliases @end) (<| (let [g!offset/1 (!inc offset)]) (!with_char+ source_code//size source_code g!offset/1 g!char/1 @end) (!if_digit? g!char/1 - (parse_signed source_code//size offset where (!inc/2 offset) source_code) - (!parse_full_name offset [where (!inc offset) source_code] where @aliases #.Identifier)))) + (signed_parser source_code//size offset where (!inc/2 offset) source_code) + (!full_name_parser offset [where (!inc offset) source_code] where @aliases #.Identifier)))) (with_expansions [<output> (#.Right [[(update@ #.column (|>> (!n/+ (!n/- start end))) where) end source_code] (!clip start end source_code)])] - (inline: (parse_name_part start where offset source_code) + (inline: (name_part_parser start where offset source_code) (-> Nat Location Offset Text (Either [Source Text] [Source Text])) (let [source_code//size ("lux text size" source_code)] @@ -431,13 +431,13 @@ (recur (!inc end)) <output>)))))) -(template: (!parse_half_name @offset @char @module) +(template: (!half_name_parser @offset @char @module) (!if_name_char?|head @char - (!letE [source' name] (..parse_name_part @offset where (!inc @offset) source_code) + (!letE [source' name] (..name_part_parser @offset where (!inc @offset) source_code) (#.Right [source' [@module name]])) - (!failure ..!parse_half_name where @offset source_code))) + (!failure ..!half_name_parser where @offset source_code))) -(`` (def: (parse_short_name source_code//size current_module [where offset/0 source_code]) +(`` (def: (short_name_parser source_code//size current_module [where offset/0 source_code]) (-> Nat Text (Parser Name)) (<| (!with_char+ source_code//size source_code offset/0 char/0 (!end_of_file where offset/0 source_code current_module)) @@ -445,34 +445,34 @@ (<| (let [offset/1 (!inc offset/0)]) (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) - (!parse_half_name offset/1 char/1 current_module)) - (!parse_half_name offset/0 char/0 (static ..prelude)))))) + (!half_name_parser offset/1 char/1 current_module)) + (!half_name_parser offset/0 char/0 (static ..prelude)))))) -(template: (!parse_short_name source_code//size @current_module @source @where @tag) - (!letE [source' name] (..parse_short_name source_code//size @current_module @source) +(template: (!short_name_parser source_code//size @current_module @source @where @tag) + (!letE [source' name] (..short_name_parser source_code//size @current_module @source) (#.Right [source' [@where (@tag name)]]))) (with_expansions [<simple> (as_is (#.Right [source' ["" simple]]))] - (`` (def: (parse_full_name aliases start source) + (`` (def: (full_name_parser aliases start source) (-> Aliases Offset (Parser Name)) (<| (!letE [source' simple] (let [[where offset source_code] source] - (..parse_name_part start where offset source_code))) + (..name_part_parser start where offset source_code))) (let [[where' offset' source_code'] source']) (!with_char source_code' offset' char/separator <simple>) (if (!n/= (char (~~ (static ..name_separator))) char/separator) (<| (let [offset'' (!inc offset')]) - (!letE [source'' complex] (..parse_name_part offset'' (!forward 1 where') offset'' source_code')) + (!letE [source'' complex] (..name_part_parser offset'' (!forward 1 where') offset'' source_code')) (if ("lux text =" "" complex) (let [[where offset source_code] source] - (!failure ..parse_full_name where offset source_code)) + (!failure ..full_name_parser where offset source_code)) (#.Right [source'' [(|> aliases (dictionary.get simple) (maybe.default simple)) complex]]))) <simple>))))) -(template: (!parse_full_name @offset @source @where @aliases @tag) - (!letE [source' full_name] (..parse_full_name @aliases @offset @source) +(template: (!full_name_parser @offset @source @where @aliases @tag) + (!letE [source' full_name] (..full_name_parser @aliases @offset @source) (#.Right [source' [@where (@tag full_name)]]))) ## TODO: Grammar macro for specifying syntax. @@ -511,9 +511,9 @@ [(~~ (static <close>))] (!close <close>)] - [..open_form ..close_form parse_form] - [..open_tuple ..close_tuple parse_tuple] - [..open_record ..close_record parse_record] + [..open_form ..close_form form_parser] + [..open_tuple ..close_tuple tuple_parser] + [..open_record ..close_record record_parser] )] (`` ("lux syntax char case!" char/0 [[(~~ (static text.space)) @@ -528,7 +528,7 @@ ## Text [(~~ (static ..text_delimiter))] - (parse_text where (!inc offset/0) source_code) + (text_parser where (!inc offset/0) source_code) ## Special code [(~~ (static ..sigil))] @@ -537,7 +537,7 @@ (!end_of_file where offset/1 source_code current_module)) ("lux syntax char case!" char/1 [[(~~ (static ..name_separator))] - (!parse_short_name source_code//size current_module <move_2> where #.Tag) + (!short_name_parser source_code//size current_module <move_2> where #.Tag) ## Single_line comment [(~~ (static ..sigil))] @@ -558,7 +558,7 @@ ## else (!if_name_char?|head char/1 ## Tag - (!parse_full_name offset/1 <move_2> where aliases #.Tag) + (!full_name_parser offset/1 <move_2> where aliases #.Tag) (!failure ..parse where offset/0 source_code)))) ## Coincidentally (= ..name_separator ..frac_separator) @@ -569,20 +569,20 @@ (!with_char+ source_code//size source_code offset/1 char/1 (!end_of_file where offset/1 source_code current_module)) (!if_digit? char/1 - (parse_rev source_code//size offset/0 where (!inc offset/1) source_code) - (!parse_short_name source_code//size current_module [where offset/1 source_code] where #.Identifier))) + (rev_parser source_code//size offset/0 where (!inc offset/1) source_code) + (!short_name_parser source_code//size current_module [where offset/1 source_code] where #.Identifier))) [(~~ (static ..positive_sign)) (~~ (static ..negative_sign))] - (!parse_signed source_code//size offset/0 where source_code aliases - (!end_of_file where offset/0 source_code current_module))] + (!signed_parser source_code//size offset/0 where source_code aliases + (!end_of_file where offset/0 source_code current_module))] ## else (!if_digit? char/0 ## Natural number - (parse_nat source_code//size offset/0 where (!inc offset/0) source_code) + (nat_parser source_code//size offset/0 where (!inc offset/0) source_code) ## Identifier - (!parse_full_name offset/0 [<consume_1>] where aliases #.Identifier)) + (!full_name_parser offset/0 [<consume_1>] where aliases #.Identifier)) ))) ))) )) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index 39beec921..4442bd5f3 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -251,7 +251,7 @@ (n.= (list.size reservations) (|> reservations (list\map product.left) - (set.from_list text.hash) + (set.of_list text.hash) set.size))) (def: (correct_ids? reservations) @@ -259,7 +259,7 @@ (n.= (list.size reservations) (|> reservations (list\map product.right) - (set.from_list n.hash) + (set.of_list n.hash) set.size))) (def: (correct_reservations? reservations) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux index 39edd668e..3e2e86663 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -13,7 +13,7 @@ ["." dictionary (#+ Dictionary)]] [format ["." binary (#+ Writer)]]] - [type (#+ :share) + [type (#+ :sharing) abstract]]] [// ["." signature (#+ Signature)] @@ -35,12 +35,12 @@ (if (\ signature.equivalence = (key.signature key) document//signature) - (#try.Success (:share [e] - (Key e) - key - - e - (:assume document//content))) + (#try.Success (:sharing [e] + (Key e) + key + + e + (:assume document//content))) (exception.throw ..invalid_signature [(key.signature key) document//signature])))) 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 b41b272f5..cb52004f4 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -183,12 +183,12 @@ (\ fs directory_files) (\ ! map (|>> (list\map (function (_ file) [(file.name fs file) file])) - (list.filter (|>> product.left (text\= ..module_descriptor_file) not)) + (list.only (|>> product.left (text\= ..module_descriptor_file) not)) (monad.map ! (function (_ [name path]) (|> path (\ fs read) (\ ! map (|>> [name]))))) - (\ ! map (dictionary.from_list text.hash)))) + (\ ! map (dictionary.of_list text.hash)))) (\ ! join)))) (type: Definitions (Dictionary Text Any)) @@ -225,7 +225,7 @@ (case input (#.Cons [[artifact_id artifact_category] input']) (case (do ! - [data (try.from_maybe (dictionary.get (format (%.nat artifact_id) extension) actual)) + [data (try.of_maybe (dictionary.get (format (%.nat artifact_id) extension) actual)) #let [context [module_id artifact_id] directive (\ host ingest context data)]] (case artifact_category @@ -329,7 +329,7 @@ (#.Definition [exported? type annotations _]) (|> definitions (dictionary.get def_name) - try.from_maybe + try.of_maybe (\ ! map (|>> [exported? type annotations] #.Definition [def_name]))))) @@ -378,7 +378,7 @@ (if valid_cache? #.None (#.Some [module_name module_id])))) - (dictionary.from_list text.hash))) + (dictionary.of_list text.hash))) (def: (full_purge caches load_order) (-> (List [Bit [Module [archive.ID [Descriptor (Document .Module)]]]]) @@ -434,7 +434,7 @@ dictionary.entries (monad.map ! (..purge! fs static))) loaded_caches (|> load_order - (list.filter (|>> product.left (dictionary.key? purge) not)) + (list.only (|>> product.left (dictionary.key? purge) not)) (monad.map ! (function (_ [module_name [module_id [descriptor document _]]]) (do ! [[descriptor,document,output bundles] (..load_definitions fs static module_id host_environment descriptor document)] 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 7794d3f5e..60c50db11 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -1,7 +1,6 @@ (.module: [library [lux (#- Module Definition) - [type (#+ :share)] ["." ffi (#+ import: do_to)] [abstract ["." monad (#+ Monad do)]] diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index 514de6852..e69755445 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- Module) - [type (#+ :share)] + [type (#+ :sharing)] [abstract ["." monad (#+ Monad do)]] [control @@ -64,11 +64,11 @@ (\ encoding.utf8 decode) (\ try.monad map (|>> :assume - (:share [directive] - directive - so_far - - directive) + (:sharing [directive] + directive + so_far + + directive) (..then so_far))))) (: _.Expression (_.manual ""))))) @@ -124,9 +124,9 @@ #let [mapping (|> order (list\map (function (_ [module [module_id [descriptor document output]]]) [module module_id])) - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (: (Dictionary Module archive.ID)))] entries (monad.map ! (..write_module now mapping) order)] (wrap (|> entries - row.from_list + row.of_list (binary.run tar.writer)))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux index 404b3d800..080765231 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -1,7 +1,7 @@ (.module: [library [lux #* - [type (#+ :share)] + [type (#+ :sharing)] [abstract ["." monad (#+ Monad do)]] [control @@ -46,11 +46,11 @@ (\ utf8.codec decode) (\ try.monad map (|>> :assume - (:share [directive] - directive - so_far - - directive) + (:sharing [directive] + directive + so_far + + directive) (sequence so_far))))) so_far))) diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index d69098f92..f7e3ddf03 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -70,7 +70,7 @@ (def: #export fail (-> Text Operation) - (|>> try.fail (state.lift try.monad))) + (|>> #try.Failure (state.lift try.monad))) (def: #export (throw exception parameters) (All [e] (-> (Exception e) e Operation)) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index df48eb420..8008dea25 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -8,7 +8,7 @@ [data ["." text ("#\." equivalence) ["%" format (#+ format)]]] - [type (#+ :share) + [type (#+ :sharing) ["." check]] [compiler ["." phase @@ -84,65 +84,65 @@ (wrap state))) (with-expansions [<Interpretation> (as-is (Operation anchor expression directive [Type Any]))] - - (def: (interpret-directive code) - (All [anchor expression directive] - (-> Code <Interpretation>)) - (do phase.monad - [_ (total.phase code) - _ init.refresh] - (wrap [Any []]))) - - (def: (interpret-expression code) - (All [anchor expression directive] - (-> Code <Interpretation>)) - (do {! phase.monad} - [state (extension.lift phase.get-state) - #let [analyse (get@ [#directive.analysis #directive.phase] state) - synthesize (get@ [#directive.synthesis #directive.phase] state) - generate (get@ [#directive.generation #directive.phase] state)] - [_ codeT codeA] (directive.lift-analysis - (analysis.with-scope - (type.with-fresh-env - (do ! - [[codeT codeA] (type.with-inference - (analyse code)) - codeT (type.with-env - (check.clean codeT))] - (wrap [codeT codeA]))))) - codeS (directive.lift-synthesis - (synthesize codeA))] - (directive.lift-generation - (generation.with-buffer - (do ! - [codeH (generate codeS) - count generation.next - codeV (generation.evaluate! (format "interpretation_" (%.nat count)) codeH)] - (wrap [codeT codeV])))))) - - (def: (interpret configuration code) - (All [anchor expression directive] - (-> Configuration Code <Interpretation>)) - (function (_ state) - (case (<| (phase.run' state) - (:share [anchor expression directive] - {(State+ anchor expression directive) - state} - {<Interpretation> - (interpret-directive code)})) - (#try.Success [state' output]) - (#try.Success [state' output]) - - (#try.Failure error) - (if (ex.match? total.not-a-directive error) - (<| (phase.run' state) - (:share [anchor expression directive] - {(State+ anchor expression directive) - state} - {<Interpretation> - (interpret-expression code)})) - (#try.Failure error))))) - ) + + (def: (interpret-directive code) + (All [anchor expression directive] + (-> Code <Interpretation>)) + (do phase.monad + [_ (total.phase code) + _ init.refresh] + (wrap [Any []]))) + + (def: (interpret-expression code) + (All [anchor expression directive] + (-> Code <Interpretation>)) + (do {! phase.monad} + [state (extension.lift phase.get-state) + #let [analyse (get@ [#directive.analysis #directive.phase] state) + synthesize (get@ [#directive.synthesis #directive.phase] state) + generate (get@ [#directive.generation #directive.phase] state)] + [_ codeT codeA] (directive.lift-analysis + (analysis.with-scope + (type.with-fresh-env + (do ! + [[codeT codeA] (type.with-inference + (analyse code)) + codeT (type.with-env + (check.clean codeT))] + (wrap [codeT codeA]))))) + codeS (directive.lift-synthesis + (synthesize codeA))] + (directive.lift-generation + (generation.with-buffer + (do ! + [codeH (generate codeS) + count generation.next + codeV (generation.evaluate! (format "interpretation_" (%.nat count)) codeH)] + (wrap [codeT codeV])))))) + + (def: (interpret configuration code) + (All [anchor expression directive] + (-> Configuration Code <Interpretation>)) + (function (_ state) + (case (<| (phase.run' state) + (:sharing [anchor expression directive] + {(State+ anchor expression directive) + state} + {<Interpretation> + (interpret-directive code)})) + (#try.Success [state' output]) + (#try.Success [state' output]) + + (#try.Failure error) + (if (ex.match? total.not-a-directive error) + (<| (phase.run' state) + (:sharing [anchor expression directive] + {(State+ anchor expression directive) + state} + {<Interpretation> + (interpret-expression code)})) + (#try.Failure error))))) + ) (def: (execute configuration code) (All [anchor expression directive] @@ -163,29 +163,29 @@ #source Source}) (with-expansions [<Context> (as-is (Context anchor expression directive))] - (def: (read-eval-print context) - (All [anchor expression directive] - (-> <Context> (Try [<Context> Text]))) - (do try.monad - [#let [[_where _offset _code] (get@ #source context)] - [source' input] (syntax.parse ..module syntax.no-aliases (text.size _code) (get@ #source context)) - [state' representation] (let [## TODO: Simplify ASAP - state (:share [anchor expression directive] - {<Context> - context} - {(State+ anchor expression directive) - (get@ #state context)})] - (<| (phase.run' state) - ## TODO: Simplify ASAP - (:share [anchor expression directive] - {<Context> - context} - {(Operation anchor expression directive Text) - (execute (get@ #configuration context) input)})))] - (wrap [(|> context - (set@ #state state') - (set@ #source source')) - representation])))) + (def: (read-eval-print context) + (All [anchor expression directive] + (-> <Context> (Try [<Context> Text]))) + (do try.monad + [#let [[_where _offset _code] (get@ #source context)] + [source' input] (syntax.parse ..module syntax.no-aliases (text.size _code) (get@ #source context)) + [state' representation] (let [## TODO: Simplify ASAP + state (:sharing [anchor expression directive] + {<Context> + context} + {(State+ anchor expression directive) + (get@ #state context)})] + (<| (phase.run' state) + ## TODO: Simplify ASAP + (:sharing [anchor expression directive] + {<Context> + context} + {(Operation anchor expression directive Text) + (execute (get@ #configuration context) input)})))] + (wrap [(|> context + (set@ #state state') + (set@ #source source')) + representation])))) (def: #export (run Monad<!> Console<!> platform configuration generation-bundle) (All [! anchor expression directive] diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index 751645cc4..60ef3a4a2 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -39,25 +39,25 @@ _ [num_args type])))] - [flatten_univ_q #.UnivQ] - [flatten_ex_q #.ExQ] + [flat_univ_q #.UnivQ] + [flat_ex_q #.ExQ] ) -(def: #export (flatten_function type) +(def: #export (flat_function type) (-> Type [(List Type) Type]) (case type (#.Function in out') - (let [[ins out] (flatten_function out')] + (let [[ins out] (flat_function out')] [(list& in ins) out]) _ [(list) type])) -(def: #export (flatten_application type) +(def: #export (flat_application type) (-> Type [Type (List Type)]) (case type (#.Apply arg func') - (let [[func args] (flatten_application func')] + (let [[func args] (flat_application func')] [func (list\compose args (list arg))]) _ @@ -73,8 +73,8 @@ _ (list type)))] - [flatten_variant #.Sum] - [flatten_tuple #.Product] + [flat_variant #.Sum] + [flat_tuple #.Product] ) (def: #export (format type) @@ -98,11 +98,11 @@ (list.interpose " ") (list\fold text\compose "")) <close>)]) - ([#.Sum "(| " ")" flatten_variant] - [#.Product "[" "]" flatten_tuple]) + ([#.Sum "(| " ")" flat_variant] + [#.Product "[" "]" flat_tuple]) (#.Function input output) - (let [[ins out] (flatten_function type)] + (let [[ins out] (flat_function type)] ($_ text\compose "(-> " (|> ins (list\map format) @@ -121,7 +121,7 @@ ($_ text\compose "⟨e:" (n\encode id) "⟩") (#.Apply param fun) - (let [[type_func type_args] (flatten_application type)] + (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 "")) ")")) (^template [<tag> <desc>] @@ -134,15 +134,16 @@ ($_ text\compose module "." name) )) -(def: (beta_reduce env type) +## https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction +(def: (reduced env type) (-> (List Type) Type Type) (case type (#.Primitive name params) - (#.Primitive name (list\map (beta_reduce env) params)) + (#.Primitive name (list\map (reduced env) params)) (^template [<tag>] [(<tag> left right) - (<tag> (beta_reduce env left) (beta_reduce env right))]) + (<tag> (reduced env left) (reduced env right))]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) @@ -153,7 +154,7 @@ (<tag> env def) _ - (<tag> (list\map (beta_reduce env) old_env) def))]) + (<tag> (list\map (reduced env) old_env) def))]) ([#.UnivQ] [#.ExQ]) @@ -219,7 +220,7 @@ #0 )))) -(def: #export (apply params func) +(def: #export (applied params func) (-> (List Type) Type (Maybe Type)) (case params #.Nil @@ -230,15 +231,15 @@ (^template [<tag>] [(<tag> env body) (|> body - (beta_reduce (list& func param env)) - (apply params'))]) + (reduced (list& func param env)) + (applied params'))]) ([#.UnivQ] [#.ExQ]) (#.Apply A F) - (apply (list& A params) F) + (applied (list& A params) F) (#.Named name unnamed) - (apply params unnamed) + (applied params unnamed) _ #.None))) @@ -271,20 +272,20 @@ ([#.UnivQ] [#.ExQ]) )) -(def: #export (un_alias type) +(def: #export (de_aliased type) (-> Type Type) (case type (#.Named _ (#.Named name type')) - (un_alias (#.Named name type')) + (de_aliased (#.Named name type')) _ type)) -(def: #export (un_name type) +(def: #export (anonymous type) (-> Type Type) (case type (#.Named name type') - (un_name type') + (anonymous type') _ type)) @@ -342,10 +343,9 @@ (quantified? _type) (#.Apply A F) - (maybe.default #0 - (do maybe.monad - [applied (apply (list A) F)] - (wrap (quantified? applied)))) + (|> (..applied (list A) F) + (\ maybe.monad map quantified?) + (maybe.default #0)) (^or (#.UnivQ _) (#.ExQ _)) #1 @@ -362,12 +362,12 @@ (list) (#.Primitive array.type_name)))) -(def: #export (flatten_array type) +(def: #export (flat_array type) (-> Type [Nat Type]) (case type (^multi (^ (#.Primitive name (list element_type))) (text\= array.type_name name)) - (let [[depth element_type] (flatten_array element_type)] + (let [[depth element_type] (flat_array element_type)] [(inc depth) element_type]) _ @@ -375,7 +375,7 @@ (def: #export array? (-> Type Bit) - (|>> ..flatten_array + (|>> ..flat_array product.left (n.> 0))) @@ -439,9 +439,9 @@ (<>.and <code>.any <code>.any)) ## TODO: Make sure the generated code always gets optimized away. -(syntax: #export (:share {type_vars ..type_parameters} - {exemplar ..typed} - {computation ..typed}) +(syntax: #export (:sharing {type_vars ..type_parameters} + {exemplar ..typed} + {computation ..typed}) (macro.with_gensyms [g!_] (let [shareC (` (: (All [(~+ (list\map code.local_identifier type_vars))] (-> (~ (get@ #type exemplar)) @@ -453,7 +453,7 @@ (syntax: #export (:by_example {type_vars ..type_parameters} {exemplar ..typed} {extraction <code>.any}) - (wrap (list (` (:of ((~! :share) + (wrap (list (` (:of ((~! :sharing) [(~+ (list\map code.local_identifier type_vars))] (~ (get@ #type exemplar)) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index a8b447338..24335b7bb 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -285,7 +285,7 @@ (apply_type! funcT'' argT)) _ - (case (//.apply (list argT) funcT) + (case (//.applied (list argT) funcT) (#.Some output) (check\wrap output) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index a308b99a8..fb2598ab8 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -3,7 +3,7 @@ [lux #* [abstract ["." monad (#+ Monad do)] - ["eq" equivalence]] + ["." equivalence]] [control ["." try] ["p" parser @@ -65,7 +65,7 @@ (find_member_type idx sig_type') (#.Apply arg func) - (case (type.apply (list arg) func) + (case (type.applied (list arg) func) #.None (check.fail (format "Cannot apply type " (%.type func) " to type " (%.type arg))) @@ -95,8 +95,8 @@ imp_mods (meta.imported_modules this_module_name) tag_lists (monad.map ! meta.tag_lists imp_mods) #let [tag_lists (|> tag_lists list\join (list\map product.left) list\join) - candidates (list.filter (|>> product.right (text\= simple_name)) - tag_lists)]] + candidates (list.only (|>> product.right (text\= simple_name)) + tag_lists)]] (case candidates #.Nil (meta.fail (format "Unknown tag: " (%.name member))) @@ -168,7 +168,7 @@ (#.UnivQ _) (do check.monad [[id var] check.var] - (apply_function_type (maybe.assume (type.apply (list var) func)) + (apply_function_type (maybe.assume (type.applied (list var) func)) arg)) (#.Function input output) @@ -185,7 +185,7 @@ (#.UnivQ _) (do check.monad [[id var] check.var - [ids final_output] (concrete_type (maybe.assume (type.apply (list var) type)))] + [ids final_output] (concrete_type (maybe.assume (type.applied (list var) type)))] (wrap [(#.Cons id ids) final_output])) @@ -217,7 +217,7 @@ (case (check.run context (do {! check.monad} [[tvars alt_type] (concrete_type alt_type) - #let [[deps alt_type] (type.flatten_function alt_type)] + #let [[deps alt_type] (type.flat_function alt_type)] _ (check.check dep alt_type) context' check.context =deps (monad.map ! (provision compiler context') deps)] @@ -266,7 +266,7 @@ (case (check.run context (do {! check.monad} [[tvars alt_type] (concrete_type alt_type) - #let [[deps alt_type] (type.flatten_function alt_type)] + #let [[deps alt_type] (type.flat_function alt_type)] _ (check.check alt_type sig_type) member_type (find_member_type member_idx alt_type) _ (check_apply member_type input_types output_type) @@ -333,7 +333,7 @@ (\ number.equivalence = x y) (\\ = x y) "Can optionally add the prefix of the module where the signature was defined." - (\\ eq.= x y) + (\\ equivalence.= x y) "(List Nat) equivalence" (\\ = (list.indices 10) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index a3e49104d..950a884ae 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -49,7 +49,7 @@ #.None)))) ) -(def: #export (filter refiner values) +(def: #export (only refiner values) (All [t %] (-> (Refiner t %) (List t) (List (Refined t %)))) (case values #.Nil @@ -58,10 +58,10 @@ (#.Cons head tail) (case (refiner head) (#.Some refined) - (#.Cons refined (filter refiner tail)) + (#.Cons refined (only refiner tail)) #.None - (filter refiner tail)))) + (only refiner tail)))) (def: #export (partition refiner values) (All [t %] (-> (Refiner t %) (List t) [(List (Refined t %)) (List t)])) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index d59faa1c1..ac2912f16 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -229,7 +229,7 @@ (#.Some children) (|> children array.to_list - (monad.filter ! (|>> <method>)) + (monad.only ! (|>> <method>)) (\ ! map (monad.map ! (|>> java/io/File::getAbsolutePath))) (\ ! join)) @@ -248,7 +248,7 @@ (def: last_modified (|>> java/io/File::new (java/io/File::lastModified) - (\ (try.with io.monad) map (|>> duration.from_millis instant.absolute)))) + (\ (try.with io.monad) map (|>> duration.of_millis instant.absolute)))) (def: can_execute? (|>> java/io/File::new @@ -453,7 +453,7 @@ (\ ! map (|>> (<method> []) [sub]) (with_promise write! (Try Stats) (Fs::stat [sub (..value_callback write!)] node_fs))))) - (\ ! map (|>> (list.filter product.right) + (\ ! map (|>> (list.only product.right) (list\map product.left))))))] [directory_files Stats::isFile] @@ -477,7 +477,7 @@ (wrap (|> stats Stats::mtimeMs f.int - duration.from_millis + duration.of_millis instant.absolute)))) (def: (can_execute? path) @@ -598,7 +598,7 @@ (list\map (|>> (format path ..python_separator))) (monad.map ! (function (_ sub) (\ ! map (|>> [sub]) (<method> [sub])))) - (\ ! map (|>> (list.filter product.right) + (\ ! map (|>> (list.only product.right) (list\map product.left))))) (\ ! join))))] @@ -614,7 +614,7 @@ (|>> os/path::getmtime (\ (try.with io.monad) map (|>> f.int (i.* +1,000) - duration.from_millis + duration.of_millis instant.absolute)))) (def: (can_execute? path) @@ -746,14 +746,14 @@ [(def: <name> (let [! (try.with io.monad)] (|>> RubyFile::stat - (\ ! map (`` (|>> (~~ (template.splice <pipeline>))))))))] + (\ ! map (`` (|>> (~~ (template.spliced <pipeline>))))))))] [file_size [RubyStat::size .nat]] [last_modified [(RubyStat::mtime []) (RubyTime::to_f []) (f.* +1,000.0) f.int - duration.from_millis + duration.of_millis instant.absolute]] [can_execute? [(RubyStat::executable? [])]] )) @@ -872,10 +872,10 @@ ## [value (<ffi> [path])] ## (if (bit\= false (:as Bit value)) ## (\ io.monad wrap (exception.throw ..cannot_find_file [path])) - ## (wrap (`` (|> value (~~ (template.splice <pipeline>))))))))] + ## (wrap (`` (|> value (~~ (template.spliced <pipeline>))))))))] ## [size ..filesize [.nat]] - ## [last_modified ..filemtime [(i.* +1,000) duration.from_millis instant.absolute]] + ## [last_modified ..filemtime [(i.* +1,000) duration.of_millis instant.absolute]] ## )) ## (def: (can_execute? _) @@ -915,7 +915,7 @@ ## [children (..scandir [path])] ## (loop [input (|> children ## array.to_list - ## (list.filter (function (_ child) + ## (list.only (function (_ child) ## (not (or (text\= "." child) ## (text\= ".." child)))))) ## output (: (List (<capability> IO)) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index df655ed9c..721e9b059 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -150,16 +150,16 @@ (do {! (try.with promise.monad)} [current_files (..poll_files fs directory) #let [creations (if (..creation? concern) - (list.filter (|>> product.left (dictionary.key? file_tracker) not) - current_files) + (list.only (|>> product.left (dictionary.key? file_tracker) not) + current_files) (list)) available (|> current_files (list\map product.left) - (set.from_list text.hash)) + (set.of_list text.hash)) deletions (if (..deletion? concern) (|> (dictionary.entries file_tracker) (list\map product.left) - (list.filter (|>> (set.member? available) not))) + (list.only (|>> (set.member? available) not))) (list)) modifications (list.all (function (_ [path current_modification]) (do maybe.monad @@ -233,7 +233,7 @@ _ (do promise.monad [_ (stm.commit (stm.write (|> changes (list\map product.left) - (dictionary.from_list text.hash)) + (dictionary.of_list text.hash)) tracker))] (wrap (#try.Success []))) #let [[creations modifications deletions] @@ -247,8 +247,8 @@ (wrap ($_ list\compose (list\map (|>> product.left [..creation]) creations) (|> modifications - (list.filter (function (_ [path previous_modification current_modification]) - (not (instant\= previous_modification current_modification)))) + (list.only (function (_ [path previous_modification current_modification]) + (not (instant\= previous_modification current_modification)))) (list\map (|>> product.left [..modification]))) (list\map (|>> [..deletion]) deletions) ))))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 5a7a93e31..95dbde0dc 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -224,4 +224,4 @@ (def: #export headers (-> (List [Text Text]) //.Headers) - (dictionary.from_list text.hash)) + (dictionary.of_list text.hash)) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 4a6911798..80ce2bbf5 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -31,7 +31,7 @@ (def: (merge inputs) (-> (List Binary) Binary) - (let [[_ output] (try.assume + (let [[_ output] (try.assumed (monad.fold try.monad (function (_ input [offset output]) (let [amount (binary.size input)] diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 8c8a0ac05..1607e14c3 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -66,7 +66,7 @@ (#try.Failure _) #.None))) - (dictionary.from_list text.hash))))) + (dictionary.of_list text.hash))))) (`` (implementation: #export (async program) (-> (Program IO) (Program Promise)) @@ -334,7 +334,7 @@ ## array.to_list ## (list\map (function (_ variable) ## [variable ("php array read" (:as Nat variable) environment)])) - ## (dictionary.from_list text.hash)))) + ## (dictionary.of_list text.hash)))) ## @.scheme (do io.monad ## [input (..get-environment-variables [])] ## (loop [input input diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index ddfacbc5e..00cba51fe 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -112,8 +112,8 @@ (def: sanitize_common_command (-> Replacer (Sanitizer Command)) - (let [x0A (text.from_code (hex "0A")) - xFF (text.from_code (hex "FF"))] + (let [x0A (text.of_code (hex "0A")) + xFF (text.of_code (hex "FF"))] (function (_ replacer) (|>> (..replace x0A replacer) (..replace xFF replacer) diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index 080e64af0..15795ffcf 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -4,9 +4,8 @@ [abstract [monad (#+ Monad do)]] [control - ["p" parser - ["<.>" type] - ["s" code (#+ Parser)]]] + ["<>" parser + ["<.>" type]]] [data ["." product] ["." bit] @@ -43,14 +42,14 @@ ["." /]]) (poly: #export equivalence - (`` (do {! p.monad} + (`` (do {! <>.monad} [#let [g!_ (code.local_identifier "_____________")] *env* <type>.env inputT <type>.peek #let [@Equivalence (: (-> Type Code) (function (_ type) (` ((~! /.Equivalence) (~ (poly.to_code *env* type))))))]] - ($_ p.either + ($_ <>.either ## Basic types (~~ (template [<matcher> <eq>] [(do ! @@ -68,8 +67,8 @@ ## Composite types (~~ (template [<name> <eq>] [(do ! - [[_ argC] (<type>.apply (p.and (<type>.exactly <name>) - equivalence))] + [[_ argC] (<type>.applied (<>.and (<type>.exactly <name>) + equivalence))] (wrap (` (: (~ (@Equivalence inputT)) (<eq> (~ argC))))))] @@ -82,10 +81,10 @@ [tree.Tree (~! tree.equivalence)] )) (do ! - [[_ _ valC] (<type>.apply ($_ p.and - (<type>.exactly dictionary.Dictionary) - <type>.any - equivalence))] + [[_ _ valC] (<type>.applied ($_ <>.and + (<type>.exactly dictionary.Dictionary) + <type>.any + equivalence))] (wrap (` (: (~ (@Equivalence inputT)) ((~! dictionary.equivalence) (~ valC)))))) ## Models @@ -102,13 +101,13 @@ [month.Month month.equivalence] )) (do ! - [_ (<type>.apply (p.and (<type>.exactly unit.Qty) - <type>.any))] + [_ (<type>.applied (<>.and (<type>.exactly unit.Qty) + <type>.any))] (wrap (` (: (~ (@Equivalence inputT)) unit.equivalence)))) ## Variants (do ! - [members (<type>.variant (p.many equivalence)) + [members (<type>.variant (<>.many equivalence)) #let [last (dec (list.size members)) g!_ (code.local_identifier "_____________") g!left (code.local_identifier "_____________left") @@ -129,7 +128,7 @@ #0)))))) ## Tuples (do ! - [g!eqs (<type>.tuple (p.many equivalence)) + [g!eqs (<type>.tuple (<>.many equivalence)) #let [g!_ (code.local_identifier "_____________") indices (list.indices (list.size g!eqs)) g!lefts (list\map (|>> nat\encode (text\compose "left") code.local_identifier) indices) @@ -149,7 +148,7 @@ <type>.recursive_self ## Type applications (do ! - [[funcC argsC] (<type>.apply (p.and equivalence (p.many equivalence)))] + [[funcC argsC] (<type>.applied (<>.and equivalence (<>.many equivalence)))] (wrap (` ((~ funcC) (~+ argsC))))) ## Parameters <type>.parameter @@ -164,6 +163,6 @@ <type>.recursive_call ## If all else fails... (|> <type>.any - (\ ! map (|>> %.type (format "Cannot create Equivalence for: ") p.fail)) + (\ ! map (|>> %.type (format "Cannot create Equivalence for: ") <>.fail)) (\ ! join)) )))) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index d7409df9f..5c63c58e1 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -135,36 +135,36 @@ <basic> <time> (do ! - [unitT (<type>.apply (<>.after (<type>.exactly unit.Qty) - <type>.any))] + [unitT (<type>.applied (<>.after (<type>.exactly unit.Qty) + <type>.any))] (wrap (` (: (~ (@JSON\encode inputT)) (\ (~! qty_codec) (~' encode)))))) (do ! [#let [g!_ (code.local_identifier "_______") g!key (code.local_identifier "_______key") g!val (code.local_identifier "_______val")] - [_ _ =val=] (<type>.apply ($_ <>.and - (<type>.exactly d.Dictionary) - (<type>.exactly .Text) - encode))] + [_ _ =val=] (<type>.applied ($_ <>.and + (<type>.exactly d.Dictionary) + (<type>.exactly .Text) + encode))] (wrap (` (: (~ (@JSON\encode inputT)) (|>> ((~! d.entries)) ((~! list\map) (function ((~ g!_) [(~ g!key) (~ g!val)]) [(~ g!key) ((~ =val=) (~ g!val))])) - ((~! d.from_list) (~! text.hash)) + ((~! d.of_list) (~! text.hash)) #/.Object))))) (do ! - [[_ =sub=] (<type>.apply ($_ <>.and - (<type>.exactly .Maybe) - encode))] + [[_ =sub=] (<type>.applied ($_ <>.and + (<type>.exactly .Maybe) + encode))] (wrap (` (: (~ (@JSON\encode inputT)) ((~! ..nullable) (~ =sub=)))))) (do ! - [[_ =sub=] (<type>.apply ($_ <>.and - (<type>.exactly .List) - encode))] + [[_ =sub=] (<type>.applied ($_ <>.and + (<type>.exactly .List) + encode))] (wrap (` (: (~ (@JSON\encode inputT)) - (|>> ((~! list\map) (~ =sub=)) ((~! row.from_list)) #/.Array))))) + (|>> ((~! list\map) (~ =sub=)) ((~! row.of_list)) #/.Array))))) (do ! [#let [g!_ (code.local_identifier "_______") g!input (code.local_identifier "_______input")] @@ -205,7 +205,7 @@ <type>.recursive_self ## Type applications (do ! - [partsC (<type>.apply (<>.many encode))] + [partsC (<type>.applied (<>.many encode))] (wrap (` ((~+ partsC))))) ## Polymorphism (do ! @@ -258,25 +258,25 @@ <basic> <time> (do ! - [unitT (<type>.apply (<>.after (<type>.exactly unit.Qty) - <type>.any))] + [unitT (<type>.applied (<>.after (<type>.exactly unit.Qty) + <type>.any))] (wrap (` (: (~ (@JSON\decode inputT)) ((~! <>.codec) (~! qty_codec) (~! </>.any)))))) (do ! - [[_ _ valC] (<type>.apply ($_ <>.and - (<type>.exactly d.Dictionary) - (<type>.exactly .Text) - decode))] + [[_ _ valC] (<type>.applied ($_ <>.and + (<type>.exactly d.Dictionary) + (<type>.exactly .Text) + decode))] (wrap (` (: (~ (@JSON\decode inputT)) ((~! </>.dictionary) (~ valC)))))) (do ! - [[_ subC] (<type>.apply (<>.and (<type>.exactly .Maybe) - decode))] + [[_ subC] (<type>.applied (<>.and (<type>.exactly .Maybe) + decode))] (wrap (` (: (~ (@JSON\decode inputT)) ((~! </>.nullable) (~ subC)))))) (do ! - [[_ subC] (<type>.apply (<>.and (<type>.exactly .List) - decode))] + [[_ subC] (<type>.applied (<>.and (<type>.exactly .List) + decode))] (wrap (` (: (~ (@JSON\decode inputT)) ((~! </>.array) ((~! <>.some) (~ subC))))))) (do ! @@ -309,7 +309,7 @@ <type>.recursive_self ## Type applications (do ! - [[funcC argsC] (<type>.apply (<>.and decode (<>.many decode)))] + [[funcC argsC] (<type>.applied (<>.and decode (<>.many decode)))] (wrap (` ((~ funcC) (~+ argsC))))) ## Polymorphism (do ! diff --git a/stdlib/source/program/aedifex/artifact/time.lux b/stdlib/source/program/aedifex/artifact/time.lux index ec7ddc4a9..524b68bb1 100644 --- a/stdlib/source/program/aedifex/artifact/time.lux +++ b/stdlib/source/program/aedifex/artifact/time.lux @@ -29,10 +29,10 @@ (def: #export (instant time) (-> Time Instant) (let [[date time] time] - (instant.from_date_time (/date.value date) - time))) + (instant.of_date_time (/date.value date) + time))) -(def: #export (from_instant instant) +(def: #export (of_instant instant) (-> Instant (Try Time)) (do try.monad [date (/date.date (instant.date instant))] diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 17301333a..52804be43 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -84,8 +84,8 @@ (def: (remove_dependency dependency) (-> Dependency (-> Resolution Resolution)) (|>> dictionary.entries - (list.filter (|>> product.left (is? dependency) not)) - (dictionary.from_list ///dependency.hash))) + (list.only (|>> product.left (is? dependency) not)) + (dictionary.of_list ///dependency.hash))) (def: (compiler resolution compiler_dependency) (-> Resolution Dependency (Try [Resolution Compiler])) @@ -122,8 +122,8 @@ (def: (libraries fs home) (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.filter (|>> (get@ #///dependency.type) - (text\= ///artifact/type.lux_library))) + (list.only (|>> (get@ #///dependency.type) + (text\= ///artifact/type.lux_library))) (list\map (..path fs home)))) (def: version_separator @@ -157,9 +157,9 @@ (def: #export (host_dependencies fs home) (All [!] (-> (file.System !) Path Resolution (List Path))) (|>> dictionary.keys - (list.filter (|>> (get@ #///dependency.type) - (text\= ///artifact/type.lux_library) - not)) + (list.only (|>> (get@ #///dependency.type) + (text\= ///artifact/type.lux_library) + not)) (list\fold (function (_ dependency uniques) (let [artifact (get@ #///dependency.artifact dependency) identity [(get@ #///artifact.group artifact) diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index c2344ea80..a7db4af20 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -65,8 +65,8 @@ (list.sort (\ ///dependency.order <)) (exception.enumerate ..format))] ["Remote successes" (|> remote_successes - (set.from_list ///dependency.hash) - (set.difference (set.from_list ///dependency.hash local_successes)) + (set.of_list ///dependency.hash) + (set.difference (set.of_list ///dependency.hash local_successes)) set.to_list (list.sort (\ ///dependency.order <)) (exception.enumerate ..format))] diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index 7939173dd..150055cf3 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -90,7 +90,7 @@ (-> Dependency Instant Metadata (Try Metadata)) (do try.monad [now (: (Try ///artifact/time.Time) - (///artifact/time.from_instant now)) + (///artifact/time.of_instant now)) #let [version_template (get@ #///artifact.version artifact) snapshot (|> snapshot (update@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] @@ -146,4 +146,4 @@ (|> (dictionary.entries resolution) (monad.map ! (function (_ [dependency package]) (..one repository dependency package))) - (\ ! map (set.from_list ///artifact.hash))))) + (\ ! map (set.of_list ///artifact.hash))))) diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 1ece2cf17..73b3c383b 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -27,7 +27,7 @@ ["#." project (#+ Project)] ["#." parser]]) -(def: (parse_lux source_code) +(def: (lux_parser source_code) (-> Text (Try Code)) (let [parse (syntax.parse "" syntax.no_aliases @@ -39,11 +39,11 @@ (#.Right [_ lux_code]) (#try.Success lux_code)))) -(def: parse_project +(def: project_parser (-> Binary (Try Project)) (|>> (do> try.monad [(\ utf8.codec decode)] - [..parse_lux] + [..lux_parser] [(list) (<code>.run //parser.project)]))) (def: #export (read monad fs profile) @@ -52,5 +52,5 @@ (\ fs read) (\ monad map (|>> (do> try.monad [] - [..parse_project] + [..project_parser] [(//project.profile profile)]))))) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 0f8a5737c..524272559 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -138,7 +138,7 @@ (<text>.embed (do <>.monad [date ..date_parser time ..time_parser] - (wrap (instant.from_date_time date time))) + (wrap (instant.of_date_time date time))) (..text ..<last_updated>))) (def: #export parser @@ -170,7 +170,7 @@ (def: epoch Instant - (instant.from_millis +0)) + (instant.of_millis +0)) (def: #export (read repository artifact) (-> (Repository Promise) Artifact (Promise (Try Metadata))) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index d0dd59133..ca5fe3be3 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -83,7 +83,7 @@ (Parser /.License) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (<code>.record (<>.some (<>.and <code>.local_tag <code>.any))))] ($_ <>.and @@ -98,7 +98,7 @@ (Parser /.Organization) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (<code>.record (<>.some (<>.and <code>.local_tag <code>.any))))] ($_ <>.and @@ -109,7 +109,7 @@ (Parser /.Developer) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (<code>.record (<>.some (<>.and <code>.local_tag <code>.any))))] ($_ <>.and @@ -126,7 +126,7 @@ (Parser /.Info) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (<code>.record (<>.some (<>.and <code>.local_tag <code>.any))))] ($_ <>.and @@ -182,7 +182,7 @@ (Parser /.Profile) (do {! <>.monad} [input (\ ! map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (<code>.record (<>.some (<>.and <code>.local_tag <code>.any)))) #let [^parents (: (Parser (List /.Name)) @@ -196,20 +196,20 @@ (..singular input "info" ..info))) ^repositories (: (Parser (Set //repository.Address)) (|> (..plural input "repositories" ..repository) - (\ ! map (set.from_list text.hash)) + (\ ! map (set.of_list text.hash)) (<>.default (set.new text.hash)) (\ ! map (set.add /.default_repository)))) ^dependencies (: (Parser (Set //dependency.Dependency)) (|> (..plural input "dependencies" ..dependency) - (\ ! map (set.from_list //dependency.hash)) + (\ ! map (set.of_list //dependency.hash)) (<>.default (set.new //dependency.hash)))) ^compiler (|> ..dependency (..singular input "compiler") (<>.default /.default_compiler)) ^sources (: (Parser (Set /.Source)) (|> (..plural input "sources" ..source) - (\ ! map (set.from_list text.hash)) - (<>.default (set.from_list text.hash (list /.default_source))))) + (\ ! map (set.of_list text.hash)) + (<>.default (set.of_list text.hash (list /.default_source))))) ^target (: (Parser /.Target) (|> ..target (..singular input "target") @@ -221,7 +221,7 @@ (<>.maybe (..singular input "test" ..module))) ^deploy_repositories (: (Parser (Dictionary Text //repository.Address)) - (<| (\ ! map (dictionary.from_list text.hash)) + (<| (\ ! map (dictionary.of_list text.hash)) (<>.default (list)) (..singular input "deploy_repositories" ..deploy_repository))) ^java (|> ..runtime @@ -262,11 +262,11 @@ (Parser Project) (let [default_profile (: (Parser Project) (\ <>.monad map - (|>> [/.default] (list) (dictionary.from_list text.hash)) + (|>> [/.default] (list) (dictionary.of_list text.hash)) ..profile)) multi_profile (: (Parser Project) (\ <>.monad map - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (<code>.record (<>.many (<>.and <code>.text ..profile)))))] (<>.either multi_profile diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index be03d36f5..b458c7a21 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -154,7 +154,7 @@ _ (exception.throw /.no_identity []))) -(def: parse_property +(def: property_parser (Parser [Tag Text]) (do {! <>.monad} [tag <xml>.tag] @@ -162,14 +162,14 @@ (\ ! map (|>> [tag])) <xml>.text))) -(def: (parse_dependency own_version parent_version) +(def: (dependency_parser own_version parent_version) (-> Text Text (Parser Dependency)) (do {! <>.monad} - [properties (\ ! map (dictionary.from_list name.hash) + [properties (\ ! map (dictionary.of_list name.hash) (<| (<xml>.node ["" ..dependency_tag]) - (<>.some ..parse_property)))] + (<>.some ..property_parser)))] (<| <>.lift - try.from_maybe + try.of_maybe (do maybe.monad [group (dictionary.get ["" ..group_tag] properties) artifact (dictionary.get ["" ..artifact_tag] properties)] @@ -184,21 +184,21 @@ (dictionary.get ["" "type"]) (maybe.default //artifact/type.jvm_library))}))))) -(def: (parse_dependencies own_version parent_version) +(def: (dependencies_parser own_version parent_version) (-> Text Text (Parser (List Dependency))) (<| (<xml>.node ["" ..dependencies_tag]) - (<>.some (..parse_dependency own_version parent_version)))) + (<>.some (..dependency_parser own_version parent_version)))) -(def: parse_repository +(def: repository_parser (Parser Address) (<| (<xml>.node ["" ..repository_tag]) (<xml>.node ["" ..url_tag]) <xml>.text)) -(def: parse_repositories +(def: repositories_parser (Parser (List Address)) (<| (<xml>.node ["" ..repositories_tag]) - (<>.some ..parse_repository))) + (<>.some ..repository_parser))) (def: own_version (Parser Text) @@ -217,10 +217,10 @@ parent_version (<>.default "" (<xml>.somewhere ..parent_version))] (<| (<xml>.node ["" ..project_tag]) (do ! - [dependencies (|> (..parse_dependencies own_version parent_version) + [dependencies (|> (..dependencies_parser own_version parent_version) <xml>.somewhere (<>.default (list))) - repositories (|> ..parse_repositories + repositories (|> ..repositories_parser <xml>.somewhere (<>.default (list))) _ (<>.some <xml>.ignore)] diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 321e86661..d845ed689 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -26,7 +26,7 @@ (def: #export (project name profile) (-> Name Profile Project) - (dictionary.from_list text.hash (list [name profile]))) + (dictionary.of_list text.hash (list [name profile]))) (def: #export equivalence (Equivalence Project) diff --git a/stdlib/source/program/aedifex/runtime.lux b/stdlib/source/program/aedifex/runtime.lux index e6b61d360..ea34fc0fe 100644 --- a/stdlib/source/program/aedifex/runtime.lux +++ b/stdlib/source/program/aedifex/runtime.lux @@ -28,7 +28,7 @@ [(def: #export <name> Runtime {#program <command> - #parameters (`` (list (~~ (template.splice <parameters>))))})] + #parameters (`` (list (~~ (template.spliced <parameters>))))})] [default_java "java" ["-jar"]] [default_js "node" ["--stack_size=8192"]] diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index aa3239de2..bb102224d 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -1,7 +1,7 @@ (.module: [library [lux (#- Module) - [type (#+ :share)] + [type (#+ :sharing)] ["@" target] ["." debug] [abstract @@ -137,20 +137,20 @@ (do (try.with promise.monad) [#let [[compilation_sources compilation_host_dependencies compilation_libraries compilation_target compilation_module] compilation] import (/import.import (get@ #platform.&file_system platform) compilation_libraries) - [state archive] (:share [<parameters>] - (Platform <parameters>) - platform - - (Promise (Try [(directive.State+ <parameters>) - Archive])) - (:assume (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender - import compilation_sources))) - [archive state] (:share [<parameters>] - (Platform <parameters>) - platform - - (Promise (Try [Archive (directive.State+ <parameters>)])) - (:assume (platform.compile import static expander platform compilation [archive state]))) + [state archive] (:sharing [<parameters>] + (Platform <parameters>) + platform + + (Promise (Try [(directive.State+ <parameters>) + Archive])) + (:assume (platform.initialize static compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender + import compilation_sources))) + [archive state] (:sharing [<parameters>] + (Platform <parameters>) + platform + + (Promise (Try [Archive (directive.State+ <parameters>)])) + (:assume (platform.compile import static expander platform compilation [archive state]))) _ (ioW.freeze (get@ #platform.&file_system platform) static archive) program_context (promise\wrap ($/program.context archive)) host_dependencies (..load_host_dependencies (get@ #platform.&file_system platform) compilation_host_dependencies) @@ -178,6 +178,6 @@ ## (do {! promise.monad} ## [console (|> console.default ## promise.future - ## (\ ! map (|>> try.assume console.async)))] + ## (\ ! map (|>> try.assumed console.async)))] ## (interpreter.run (try.with promise.monad) console platform interpretation generation_bundle))) )))) diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index 9c2bdef52..9fe95684e 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -52,14 +52,14 @@ tar.path) source_code (tar.content source_code)] (wrap (#tar.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) ($_ tar.and tar.read_by_owner tar.write_by_owner tar.read_by_group tar.write_by_group tar.read_by_other) ..no_ownership source_code]))))) - (\ try.monad map row.from_list) + (\ try.monad map row.of_list) (\ promise.monad wrap)))) (def: #export (export fs [sources target]) diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux index cdbdb0569..708db73dd 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.from_code char) + (text.of_code char) #.None (format (parameter_type_name (n./ name_options_count id)) @@ -76,8 +76,8 @@ _ (|> type_var_names - (sequence.filter (function (_ var_name) - (not (list.member? text.equivalence type_function_arguments var_name)))) + (sequence.only (function (_ var_name) + (not (list.member? text.equivalence type_function_arguments var_name)))) (sequence.nth arg_id)))) type_func_name)) @@ -116,7 +116,7 @@ (format "(primitive " (%.text name) " " (|> params (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) ")")) [_ (#.Sum _)] - (let [members (type.flatten_variant type)] + (let [members (type.flat_variant type)] (case tags #.Nil (format "(| " @@ -131,7 +131,7 @@ (list\map (function (_ [[_ t_name] type]) (case type (#.Product _) - (let [types (type.flatten_tuple type)] + (let [types (type.flat_tuple type)] (format "(#" t_name " " (|> types (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) @@ -143,7 +143,7 @@ (text.join_with text.new_line)))) [_ (#.Product _)] - (let [members (type.flatten_tuple type)] + (let [members (type.flat_tuple type)] (case tags #.Nil (format "[" (|> members (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) "]") @@ -161,7 +161,7 @@ (format "{" member_docs "}"))))) [_ (#.Function input output)] - (let [[ins out] (type.flatten_function type)] + (let [[ins out] (type.flat_function type)] (format "(-> " (|> ins (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) " " (pprint_type_definition level type_func_info #.None module signature? recursive_type? out) @@ -189,14 +189,14 @@ _ (format text.new_line (prefix_lines " " body_doc))) ")"))]) - ([#.UnivQ "All" type.flatten_univ_q] - [#.ExQ "Ex" type.flatten_ex_q]) + ([#.UnivQ "All" type.flat_univ_q] + [#.ExQ "Ex" type.flat_ex_q]) [true (#.Apply (#.Parameter 1) (#.Parameter 0))] (product.left type_func_info) [_ (#.Apply param fun)] - (let [[type_func type_arguments] (type.flatten_application type)] + (let [[type_func type_arguments] (type.flat_application type)] (format "(" (pprint_type_definition level type_func_info tags module signature? recursive_type? type_func) " " (|> type_arguments (list\map (pprint_type_definition level type_func_info #.None module signature? recursive_type?)) (text.join_with " ")) ")")) [_ (#.Named [_module _name] type)] @@ -217,15 +217,15 @@ (format "(primitive " (%.text name) " " (|> params (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Sum _) - (let [members (type.flatten_variant type)] + (let [members (type.flat_variant type)] (format "(| " (|> members (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Product _) - (let [members (type.flatten_tuple type)] + (let [members (type.flat_tuple type)] (format "[" (|> members (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) "]")) (#.Function input output) - (let [[ins out] (type.flatten_function type)] + (let [[ins out] (type.flat_function type)] (format "(-> " (|> ins (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) " " @@ -249,11 +249,11 @@ (format "(" <name> " " "[" (|> args (list.interpose " ") (text.join_with "")) "]" (format " " body_doc) ")"))]) - ([#.UnivQ "All" type.flatten_univ_q] - [#.ExQ "Ex" type.flatten_ex_q]) + ([#.UnivQ "All" type.flat_univ_q] + [#.ExQ "Ex" type.flat_ex_q]) (#.Apply param fun) - (let [[type_func type_arguments] (type.flatten_application type)] + (let [[type_func type_arguments] (type.flat_application type)] (format "(" (pprint_type level type_func_name module type_func) " " (|> type_arguments (list\map (pprint_type level type_func_name module)) (list.interpose " ") (text.join_with "")) ")")) (#.Named [_module _name] type) @@ -505,7 +505,7 @@ (do {! meta.monad} [all_modules meta.modules #let [lux_modules (|> all_modules - (list.filter (function.compose lux_module? product.left)) + (list.only (function.compose lux_module? product.left)) (list.sort name_sort))] lux_exports (monad.map ! (function.compose meta.exports product.left) lux_modules) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 2424aa330..81e6f5988 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -111,7 +111,7 @@ (-> Runner Test) (do r.monad [on-true r.safe-frac - on-false (|> r.safe-frac (r.filter (|>> (f.= on-true) not))) + on-false (|> r.safe-frac (r.only (|>> (f.= on-true) not))) verdict r.bit] (_.test (%.name (name-of synthesis.branch/if)) (|> (synthesis.branch/if [(synthesis.bit verdict) @@ -125,7 +125,7 @@ (do r.monad [[inputS pathS] ..case on-success r.safe-frac - on-failure (|> r.safe-frac (r.filter (|>> (f.= on-success) not)))] + on-failure (|> r.safe-frac (r.only (|>> (f.= on-success) not)))] (_.test (%.name (name-of synthesis.branch/case)) (|> (synthesis.branch/case [inputS @@ -231,7 +231,7 @@ (def: special-pattern-path Path ($_ synthesis.path/alt - (<| try.assume + (<| try.assumed (phase.run [extension/synthesis.bundle synthesis.init]) (case.path phase/synthesis.phase diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 3d377b7ca..e14aa8e52 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -75,7 +75,7 @@ (def: (i64 run) (-> Runner Test) (do r.monad - [param (|> r.i64 (r.filter (|>> ("lux i64 =" 0) not))) + [param (|> r.i64 (r.only (|>> ("lux i64 =" 0) not))) subject r.i64] (`` ($_ _.and (~~ (template [<extension> <type> <prepare> <comp> <subject-expr>] @@ -123,7 +123,7 @@ (def: (f64 run) (-> Runner Test) (do r.monad - [param (|> ..simple-frac (r.filter (|>> (f.= +0.0) not))) + [param (|> ..simple-frac (r.only (|>> (f.= +0.0) not))) subject ..simple-frac] (`` ($_ _.and (~~ (template [<extension> <reference> <comp>] @@ -179,7 +179,7 @@ sample-lower (r.ascii/lower-alpha sample-size) sample-upper (r.ascii/upper-alpha sample-size) sample-alpha (|> (r.ascii/alpha sample-size) - (r.filter (|>> (text\= sample-upper) not))) + (r.only (|>> (text\= sample-upper) not))) char-idx (|> r.nat (\ ! map (n.% sample-size))) #let [sample-lowerS (synthesis.text sample-lower) sample-upperS (synthesis.text sample-upper) @@ -235,7 +235,7 @@ (synthesis.i64 +0))) (run (..sanitize "lux text index")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Nat) valueV) (#.Some valueV)]) + {(:as (Maybe Nat) valueV) (#.Some valueV)}) (n.= 0 valueV) _ @@ -245,7 +245,7 @@ (synthesis.i64 +0))) (run (..sanitize "lux text index")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Nat) valueV) (#.Some valueV)]) + {(:as (Maybe Nat) valueV) (#.Some valueV)}) (n.= sample-size valueV) _ @@ -258,7 +258,7 @@ (synthesis.i64 length))) (run (..sanitize "lux text clip")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Text) valueV) (#.Some valueV)]) + {(:as (Maybe Text) valueV) (#.Some valueV)}) (text\= expected valueV) _ @@ -272,7 +272,7 @@ (synthesis.i64 char-idx))) (run (..sanitize "lux text char")) (case> (^multi (#try.Success valueV) - [(:as (Maybe Int) valueV) (#.Some valueV)]) + {(:as (Maybe Int) valueV) (#.Some valueV)}) (text.contains? ("lux i64 char" valueV) sample-lower) @@ -303,7 +303,7 @@ (list (synthesis.text message)))}))) (run (..sanitize "lux try")) (case> (^multi (#try.Success valueV) - [(:as (Try Text) valueV) (#try.Failure error)]) + {(:as (Try Text) valueV) (#try.Failure error)}) (text.contains? message error) _ @@ -315,7 +315,7 @@ #synthesis.body (synthesis.text message)}))) (run (..sanitize "lux try")) (case> (^multi (#try.Success valueV) - [(:as (Try Text) valueV) (#try.Success valueV)]) + {(:as (Try Text) valueV) (#try.Success valueV)}) (text\= message valueV) _ diff --git a/stdlib/source/specification/lux/abstract/order.lux b/stdlib/source/specification/lux/abstract/order.lux index 61fc22611..e620fd520 100644 --- a/stdlib/source/specification/lux/abstract/order.lux +++ b/stdlib/source/specification/lux/abstract/order.lux @@ -28,12 +28,12 @@ (@//= parameter subject)))) (do random.monad [parameter generator - subject (random.filter (|>> (@//= parameter) not) - generator) - extra (random.filter (function (_ value) - (not (or (@//= parameter value) - (@//= subject value)))) - generator)] + subject (random.only (|>> (@//= parameter) not) + generator) + extra (random.only (function (_ value) + (not (or (@//= parameter value) + (@//= subject value)))) + generator)] (_.test "Transitive property." (if (@//< parameter subject) (let [greater? (and (@//< subject extra) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index 7bdefb173..c70e23441 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -178,12 +178,12 @@ (<| (do {! random.monad} [parent (random.ascii/numeric 2) child (random.ascii/numeric 2) - sub_dir (random.filter (|>> (text\= child) not) - (random.ascii/numeric 2)) - alternate_child (random.filter (predicate.intersect - (|>> (text\= child) not) - (|>> (text\= sub_dir) not)) - (random.ascii/numeric 2)) + sub_dir (random.only (|>> (text\= child) not) + (random.ascii/numeric 2)) + alternate_child (random.only (predicate.intersect + (|>> (text\= child) not) + (|>> (text\= sub_dir) not)) + (random.ascii/numeric 2)) expected_file_size (\ ! map (|>> (n.% 10) inc) random.nat) content ($binary.random expected_file_size) appendix ($binary.random expected_file_size) @@ -305,8 +305,8 @@ (-> (IO (/.System Promise)) Test) (<| (do {! random.monad} [file (random.ascii/numeric 2) - dir (random.filter (|>> (text\= file) not) - (random.ascii/numeric 2))]) + dir (random.only (|>> (text\= file) not) + (random.ascii/numeric 2))]) wrap (do {! promise.monad} [fs (promise.future fs) diff --git a/stdlib/source/test/aedifex/artifact/extension.lux b/stdlib/source/test/aedifex/artifact/extension.lux index b8a2144aa..132293d4f 100644 --- a/stdlib/source/test/aedifex/artifact/extension.lux +++ b/stdlib/source/test/aedifex/artifact/extension.lux @@ -26,7 +26,7 @@ (_.cover [/.lux_library /.jvm_library /.pom /.sha-1 /.md5] (let [options (list /.lux_library /.jvm_library /.pom /.sha-1 /.md5) - uniques (set.from_list text.hash options)] + uniques (set.of_list text.hash options)] (n.= (list.size options) (set.size uniques)))) (_.cover [/.extension /.type] diff --git a/stdlib/source/test/aedifex/artifact/time.lux b/stdlib/source/test/aedifex/artifact/time.lux index 131155500..8873a7f1d 100644 --- a/stdlib/source/test/aedifex/artifact/time.lux +++ b/stdlib/source/test/aedifex/artifact/time.lux @@ -47,10 +47,10 @@ (try.default false)))) (do random.monad [expected ..random] - (_.cover [/.instant /.from_instant] + (_.cover [/.instant /.of_instant] (|> expected /.instant - /.from_instant + /.of_instant (try\map (\ /.equivalence = expected)) (try.default false)))) (_.cover [/.epoch] diff --git a/stdlib/source/test/aedifex/artifact/type.lux b/stdlib/source/test/aedifex/artifact/type.lux index 93a13e26a..017e417cb 100644 --- a/stdlib/source/test/aedifex/artifact/type.lux +++ b/stdlib/source/test/aedifex/artifact/type.lux @@ -37,7 +37,7 @@ /.pom /.md5 /.sha-1] (let [options (list /.lux_library /.jvm_library /.js_library /.pom /.md5 /.sha-1) - uniques (set.from_list text.hash options)] + uniques (set.of_list text.hash options)] (n.= (list.size options) (set.size uniques)))) )))) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 20dcf506d..2f52b1d7b 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -57,7 +57,7 @@ (try.to_maybe (do try.monad [pom (//pom.write profile) - identity (try.from_maybe (get@ #//.identity profile))] + identity (try.of_maybe (get@ #//.identity profile))] (wrap [identity profile pom])))) @profile.random)) @@ -96,7 +96,7 @@ content ..content] (wrap [dependency (set@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))])))))] - (wrap (dictionary.from_list //dependency.hash (list& [main_dependency main_package] dependencies))))) + (wrap (dictionary.of_list //dependency.hash (list& [main_dependency main_package] dependencies))))) (def: singular Test diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 71ea72b8c..4239644aa 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -48,7 +48,7 @@ ## #Auto ..compilation)) -(def: (format-compilation value) +(def: (format_compilation value) (-> /.Compilation (List Text)) (case value #/.Build (list "build") @@ -63,10 +63,10 @@ #/.Dependencies (list "deps") #/.Install (list "install") (#/.Deploy repository [user password]) (list "deploy" repository user password) - (#/.Compilation compilation) (..format-compilation compilation) - (#/.Auto compilation) (list& "auto" (..format-compilation compilation)))) + (#/.Compilation compilation) (..format_compilation compilation) + (#/.Auto compilation) (list& "auto" (..format_compilation compilation)))) -(def: without-profile +(def: without_profile Test (do random.monad [expected ..command] @@ -81,19 +81,19 @@ (#try.Failure error) false))))) -(def: with-profile +(def: with_profile Test (do random.monad - [expected-profile (random.ascii/alpha 1) - expected-command ..command] + [expected_profile (random.ascii/alpha 1) + expected_command ..command] (_.test "With profile." - (|> expected-command + (|> expected_command ..format - (list& "with" expected-profile) + (list& "with" expected_profile) (cli.run /.command) - (case> (#try.Success [actual-profile actual-command]) - (and (text\= expected-profile actual-profile) - (\ /.equivalence = expected-command actual-command)) + (case> (#try.Success [actual_profile actual_command]) + (and (text\= expected_profile actual_profile) + (\ /.equivalence = expected_command actual_command)) (#try.Failure error) false))))) @@ -108,6 +108,6 @@ (_.for [/.command] ($_ _.and - ..without-profile - ..with-profile + ..without_profile + ..with_profile )))))) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index a7ea2795b..474a8dd1f 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -59,7 +59,7 @@ (do (try.with !) [_ (\ fs write (\ utf8.codec encode (%.nat actual_runs)) dummy_file) _ (\ fs modify - (|> actual_runs .int instant.from_millis) + (|> actual_runs .int instant.of_millis) dummy_file)] (wrap [shell.normal []])))))])) @@ -84,7 +84,7 @@ profile (|> empty_profile with_program with_target - (set@ #///.sources (set.from_list text.hash (list source))))] + (set@ #///.sources (set.of_list text.hash (list source))))] home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 738cd5090..40645b731 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -60,9 +60,9 @@ working_directory (random.ascii/alpha 5) dependee_artifact $///artifact.random - depender_artifact (random.filter (predicate.complement - (\ ///artifact.equivalence = dependee_artifact)) - $///artifact.random) + depender_artifact (random.only (predicate.complement + (\ ///artifact.equivalence = dependee_artifact)) + $///artifact.random) [_ dependee_package] $///package.random [_ depender_package] $///package.random @@ -75,12 +75,12 @@ dependee_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some dependee_artifact)) ///pom.write - try.assume) + try.assumed) depender_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some depender_artifact)) - (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee))) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) ///pom.write - try.assume) + try.assumed) dependee_package (|> dependee_package (set@ #///package.origin (#///repository/origin.Remote "")) @@ -103,7 +103,7 @@ (dictionary.put dependee dependee_package) (///dependency/deployment.all local)) post (|> (\ ///.monoid identity) - (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee depender))) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee depender))) (/.do! console local (list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package) [])) diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 4a8ccc1be..d0d172a7a 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -35,7 +35,7 @@ (def: (on_read [open? state]) (if open? - (try.from_maybe + (try.of_maybe (do maybe.monad [head (text.nth 0 state) [_ tail] (text.split 1 state)] @@ -43,7 +43,7 @@ (exception.throw ..console_is_closed! []))) (def: (on_read_line [open? state]) (if open? - (try.from_maybe + (try.of_maybe (do maybe.monad [[output state] (text.split_with text.new_line state)] (wrap [[open? state] output]))) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index deb74abcd..9d1f287c6 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -249,11 +249,11 @@ (do {! random.monad} [expected_artifact $///artifact.random [_ expected_package] $///package.random - [_ dummy_package] (random.filter (|>> product.right - (set@ #///package.pom (get@ #///package.pom expected_package)) - (\ ///package.equivalence = expected_package) - not) - $///package.random) + [_ dummy_package] (random.only (|>> product.right + (set@ #///package.pom (get@ #///package.pom expected_package)) + (\ ///package.equivalence = expected_package) + not) + $///package.random) #let [good (..single expected_artifact expected_package) bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] @@ -296,11 +296,11 @@ (do {! random.monad} [expected_artifact $///artifact.random [_ expected_package] $///package.random - [_ dummy_package] (random.filter (|>> product.right - (set@ #///package.pom (get@ #///package.pom expected_package)) - (\ ///package.equivalence = expected_package) - not) - $///package.random) + [_ dummy_package] (random.only (|>> product.right + (set@ #///package.pom (get@ #///package.pom expected_package)) + (\ ///package.equivalence = expected_package) + not) + $///package.random) #let [good (..single expected_artifact expected_package) bad_sha-1 (..bad_sha-1 expected_artifact expected_package dummy_package) bad_md5 (..bad_md5 expected_artifact expected_package dummy_package)]] @@ -344,13 +344,13 @@ (Random [Artifact Artifact Artifact]) (do random.monad [dependee_artifact $///artifact.random - depender_artifact (random.filter (predicate.complement - (\ ///artifact.equivalence = dependee_artifact)) - $///artifact.random) - ignored_artifact (random.filter (predicate.complement - (predicate.unite (\ ///artifact.equivalence = dependee_artifact) - (\ ///artifact.equivalence = depender_artifact))) - $///artifact.random)] + depender_artifact (random.only (predicate.complement + (\ ///artifact.equivalence = dependee_artifact)) + $///artifact.random) + ignored_artifact (random.only (predicate.complement + (predicate.unite (\ ///artifact.equivalence = dependee_artifact) + (\ ///artifact.equivalence = depender_artifact))) + $///artifact.random)] (wrap [dependee_artifact depender_artifact ignored_artifact]))) (def: (packages [dependee_artifact depender_artifact ignored_artifact]) @@ -372,16 +372,16 @@ dependee_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some dependee_artifact)) ///pom.write - try.assume) + try.assumed) depender_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some depender_artifact)) - (set@ #///.dependencies (set.from_list ///dependency.hash (list dependee))) + (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) ///pom.write - try.assume) + try.assumed) ignored_pom (|> (\ ///.monoid identity) (set@ #///.identity (#.Some ignored_artifact)) ///pom.write - try.assume) + try.assumed) dependee_package (set@ #///package.pom [dependee_pom diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 5ba4bdbe4..cc2d78db7 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -54,7 +54,7 @@ hour (\ ! map (n.% 24) random.nat) minute (\ ! map (n.% 60) random.nat) second (\ ! map (n.% 60) random.nat)] - (wrap (try.assume + (wrap (try.assumed (do try.monad [year (year.year year) month (month.by_number month) @@ -64,7 +64,7 @@ #time.minute minute #time.second second #time.milli_second 0})] - (wrap (instant.from_date_time date time)))))))) + (wrap (instant.of_date_time date time)))))))) (def: #export test Test diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 431370048..48738522a 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -58,7 +58,7 @@ hour (\ ! map (n.% 24) random.nat) minute (\ ! map (n.% 60) random.nat) second (\ ! map (n.% 60) random.nat)] - (wrap (try.assume + (wrap (try.assumed (do try.monad [year (year.year year) month (month.by_number month) @@ -68,7 +68,7 @@ #time.minute minute #time.second second #time.milli_second 0})] - (wrap (instant.from_date_time date time))))))) + (wrap (instant.of_date_time date time))))))) (def: random_versioning (Random Versioning) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 33beaa7f9..360c30a4a 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -46,7 +46,7 @@ (def: (dictionary_of key_hash key_random value_random) (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor map - (dictionary.from_list key_hash) + (dictionary.of_list key_hash) (..list_of (random.and key_random value_random)))) (def: random @@ -59,7 +59,7 @@ (: (-> (Set //.Source) (Set //.Source)) (function (_ sources) (if (set.empty? sources) - (set.from_list text.hash (list //.default_source)) + (set.of_list text.hash (list //.default_source)) sources))))) (def: with_default_repository @@ -108,7 +108,7 @@ [name (|> profile ..with_default_sources ..with_default_repository)])) - (dictionary.from_list text.hash) + (dictionary.of_list text.hash) (\ //project.equivalence = actual)) (#try.Failure error) diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 7163ac780..f29ae7087 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -80,13 +80,13 @@ (def: (set_of hash random) (All [a] (-> (Hash a) (Random a) (Random (Set a)))) (\ random.functor map - (set.from_list hash) + (set.of_list hash) (..list_of random))) (def: (dictionary_of key_hash key_random value_random) (All [k v] (-> (Hash k) (Random k) (Random v) (Random (Dictionary k v)))) (\ random.functor map - (dictionary.from_list key_hash) + (dictionary.of_list key_hash) (..list_of (random.and key_random value_random)))) (def: info diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 5b6de5403..d76d4afb3 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -52,17 +52,17 @@ not)) (do random.monad [[super_name super_profile] ..profile - [dummy_name dummy_profile] (random.filter (|>> product.left (text\= super_name) not) - ..profile) - [sub_name sub_profile] (random.filter (function (_ [name profile]) - (and (not (text\= super_name name)) - (not (text\= dummy_name name)))) - ..profile) - fake_name (random.filter (function (_ name) - (and (not (text\= super_name name)) - (not (text\= dummy_name name)) - (not (text\= sub_name name)))) - (random.ascii/alpha 1)) + [dummy_name dummy_profile] (random.only (|>> product.left (text\= super_name) not) + ..profile) + [sub_name sub_profile] (random.only (function (_ [name profile]) + (and (not (text\= super_name name)) + (not (text\= dummy_name name)))) + ..profile) + fake_name (random.only (function (_ name) + (and (not (text\= super_name name)) + (not (text\= dummy_name name)) + (not (text\= sub_name name)))) + (random.ascii/alpha 1)) #let [project ($_ (\ /.monoid compose) (/.project super_name super_profile) (/.project dummy_name dummy_profile) diff --git a/stdlib/source/test/aedifex/runtime.lux b/stdlib/source/test/aedifex/runtime.lux index 7d6d3f98b..f9749c968 100644 --- a/stdlib/source/test/aedifex/runtime.lux +++ b/stdlib/source/test/aedifex/runtime.lux @@ -44,7 +44,7 @@ [(_.cover [/.default_java /.default_js /.default_python /.default_lua /.default_ruby] (let [listing (|> (list /.default_java /.default_js /.default_python /.default_lua /.default_ruby) (list\map (get@ #/.program))) - unique (set.from_list text.hash listing)] + unique (set.of_list text.hash listing)] (n.= (list.size listing) (set.size unique))))] diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index d482d75d5..8cd7a7695 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -570,7 +570,7 @@ _ false)) (_.cover [/.char] (|> (`` (/.char (~~ (/.static static_char)))) - text.from_code + text.of_code (text\= static_char))) ))) @@ -871,16 +871,14 @@ (let [expected_pair (: (Pair Nat Int) {#left expected_nat #right expected_int})] (and (/.case expected_pair - (/.^multi (/.^ (!pair actual_left actual_right)) - [actual_left 0] - [actual_right +0]) + (/.^multi (/.^ (!pair 0 actual_right)) + {actual_right +0}) true _ false) (/.case expected_pair - (/.^multi (/.^ (!pair actual_left actual_right)) - (n.= 0 actual_left) + (/.^multi (/.^ (!pair 0 actual_right)) (i.= +0 actual_right)) true diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 753494f48..007382e60 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -25,7 +25,7 @@ leftI random.int rightI random.int sample random.nat - different (|> random.nat (random.filter (|>> (n.= sample) not))) + different (|> random.nat (random.only (|>> (n.= sample) not))) #let [equivalence (: (Equivalence (Equivalence Nat)) (implementation (def: (= left right) diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index f5dd14646..deab85fe1 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -25,8 +25,8 @@ (Random (Interval Nat)) (do random.monad [bottom random.nat - top (random.filter (|>> (n.= bottom) not) - random.nat)] + top (random.only (|>> (n.= bottom) not) + random.nat)] (if (<cmp> top bottom) (wrap (/.between n.enum bottom top)) (wrap (/.between n.enum top bottom)))))] diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index cc4642e13..2c6fb3ac7 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -46,11 +46,11 @@ (|> poly (/.map identity.monad (|>> inc (\ identity.monad wrap))) (: (Identity (List Nat)))))) - (_.cover [/.filter] + (_.cover [/.only] (\ (list.equivalence n.equivalence) = - (list.filter n.even? poly) + (list.only n.even? poly) (|> poly - (/.filter identity.monad (|>> n.even? (\ identity.monad wrap))) + (/.only identity.monad (|>> n.even? (\ identity.monad wrap))) (: (Identity (List Nat)))))) (_.cover [/.fold] (n.= (list\fold n.+ 0 poly) diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index e9ced25ce..2974a8c88 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -23,7 +23,7 @@ (<| (_.covering /._) (do random.monad [left random.nat - right (|> random.nat (random.filter (|>> (n.= left) not))) + right (|> random.nat (random.only (|>> (n.= left) not))) #let [equivalence (: (Equivalence (/.Order Nat)) (implementation (def: (= leftO rightO) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index 197953c49..d66513b63 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -45,7 +45,7 @@ ($contravariant.spec equivalence (multiple? 2) /.functor)) (let [generator (: (Random (/.Predicate Nat)) (|> random.nat - (random.filter (|>> (n.= 0) not)) + (random.only (|>> (n.= 0) not)) (\ ! map multiple?)))] ($_ _.and (_.for [/.union] @@ -76,7 +76,7 @@ ((/.difference /3? /2?) sample)))) (_.cover [/.rec] (let [even? (multiple? 2) - any-even? (: (/.Predicate (List Nat)) + any_even? (: (/.Predicate (List Nat)) (/.rec (function (_ recur) (function (_ values) (case values @@ -87,5 +87,5 @@ (or (even? head) (recur tail)))))))] (bit\= (list.any? even? samples) - (any-even? samples)))) + (any_even? samples)))) ))) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 39265aafe..678a8aa99 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -92,12 +92,12 @@ /.drop /.drop))) )))) -(template: (!numerical <=> <generator> <filter> <arithmetic> <order>) +(template: (!numerical <=> <generator> <only> <arithmetic> <order>) (: Test - (with_expansions [<arithmetic>' (template.splice <arithmetic>) - <order>' (template.splice <order>)] + (with_expansions [<arithmetic>' (template.spliced <arithmetic>) + <order>' (template.spliced <order>)] (do random.monad - [parameter (|> <generator> (random.filter <filter>)) + [parameter (|> <generator> (random.only <only>)) subject <generator>] (`` ($_ _.and (~~ (template [<concatenative> <functional>] diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index f229909bd..3ceac0c4b 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -33,7 +33,8 @@ ((on_mail message state self) (message state self)) - (message: (count! {increment Nat} state self Nat) + (message: (count! {increment Nat} state self) + Nat (let [state' (n.+ increment state)] (promise\wrap (#try.Success [state' state'])))) ) diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index 674e7dd3f..567f1c40a 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -27,7 +27,7 @@ (wrap (is? expected actual)))))) (do random.monad [target random.nat - unknown (random.filter (|>> (is? target) not) random.nat) + unknown (random.only (|>> (is? target) not) random.nat) expected random.nat #let [box (/.atom target)]] (_.cover [/.compare_and_swap] diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index c23428089..813ceb7ed 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -29,7 +29,7 @@ (def: injection (Injection /.Channel) (|>> promise.resolved - /.from_promise)) + /.of_promise)) (def: comparison (Comparison /.Channel) @@ -70,10 +70,10 @@ [inputs (random.list 5 random.nat) sample random.nat distint/0 random.nat - distint/1 (|> random.nat (random.filter (|>> (n.= distint/0) not))) - distint/2 (|> random.nat (random.filter (function (_ value) - (not (or (n.= distint/0 value) - (n.= distint/1 value)))))) + distint/1 (|> random.nat (random.only (|>> (n.= distint/0) not))) + distint/2 (|> random.nat (random.only (function (_ value) + (not (or (n.= distint/0 value) + (n.= distint/1 value)))))) shift random.nat] ($_ _.and (_.for [/.functor] @@ -117,9 +117,9 @@ (wrap (do promise.monad [output (|> sample promise.resolved - /.from_promise + /.of_promise /.consume)] - (_.cover' [/.from_promise /.consume] + (_.cover' [/.of_promise /.consume] (list\= (list sample) output)))) (wrap (do promise.monad @@ -132,10 +132,10 @@ (wrap (do promise.monad [output (|> inputs (/.sequential 0) - (/.filter n.even?) + (/.only n.even?) /.consume)] - (_.cover' [/.filter] - (list\= (list.filter n.even? inputs) + (_.cover' [/.only] + (list\= (list.only n.even? inputs) output)))) (wrap (do {! promise.monad} [#let [[?signal !signal] (: [(promise.Promise Any) (promise.Resolver Any)] diff --git a/stdlib/source/test/lux/control/concurrency/promise.lux b/stdlib/source/test/lux/control/concurrency/promise.lux index be2655334..3cc1a42c9 100644 --- a/stdlib/source/test/lux/control/concurrency/promise.lux +++ b/stdlib/source/test/lux/control/concurrency/promise.lux @@ -57,7 +57,7 @@ [to_wait (|> random.nat (\ ! map (|>> (n.% ..delay) (n.+ ..delay)))) expected random.nat dummy random.nat - #let [not_dummy (|> random.nat (random.filter (|>> (n.= dummy) not)))] + #let [not_dummy (|> random.nat (random.only (|>> (n.= dummy) not)))] leftE not_dummy rightE not_dummy] ($_ _.and diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 534d03252..21d81f014 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -27,7 +27,7 @@ Test (do {! random.monad} [expected random.nat - wrong (|> random.nat (random.filter (|>> (n.= expected) not))) + wrong (|> random.nat (random.only (|>> (n.= expected) not))) assertion_succeeded? random.bit #let [report_element (\ ! map %.nat random.nat)] field0 report_element diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux index 46836db21..def4945cb 100644 --- a/stdlib/source/test/lux/control/function.lux +++ b/stdlib/source/test/lux/control/function.lux @@ -28,7 +28,7 @@ f0 (\ ! map n.+ random.nat) f1 (\ ! map n.* random.nat) dummy random.nat - extra (|> random.nat (random.filter (|>> (n.= expected) not)))] + extra (|> random.nat (random.only (|>> (n.= expected) not)))] (<| (_.covering /._) ($_ _.and (let [equivalence (: (Equivalence (-> Nat Nat)) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 31b1e338d..38ed0f982 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -27,7 +27,7 @@ (do {! random.monad} [input (|> random.nat (\ ! map (|>> (n.% 6) (n.+ 20)))) dummy random.nat - shift (|> random.nat (random.filter (|>> (n.= dummy) not))) + shift (|> random.nat (random.only (|>> (n.= dummy) not))) #let [equivalence (: (Equivalence (/.Mixin Nat Nat)) (implementation (def: (= left right) @@ -123,9 +123,9 @@ (|> input function (state.run dummy) product.right)))) )) (_.for [/.Recursive] - (_.cover [/.from_recursive] + (_.cover [/.of_recursive] (let [factorial (/.mixin - (/.from_recursive + (/.of_recursive (function (_ recur input) (case input (^or 0 1) 1 diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index e9696fef8..003024197 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -90,8 +90,8 @@ [expected0 random.nat variadic (\ ! map (|>> (n.max 1) (n.min 20)) random.nat) expected+ (random.list variadic random.nat) - even0 (random.filter n.even? random.nat) - odd0 (random.filter n.odd? random.nat) + even0 (random.only n.even? random.nat) + odd0 (random.only n.odd? random.nat) not0 random.bit] ($_ _.and (_.cover [/.maybe] @@ -124,16 +124,16 @@ (|> (list\map (|>> .int code.int) expected+) (/.run (/.many <code>.nat)) fails?))) - (_.cover [/.filter] + (_.cover [/.only] (and (|> (list (code.nat even0)) - (/.run (/.filter n.even? <code>.nat)) + (/.run (/.only n.even? <code>.nat)) (match actual (n.= even0 actual))) (|> (list (code.nat odd0)) - (/.run (/.filter n.even? <code>.nat)) + (/.run (/.only n.even? <code>.nat)) fails?))) (_.cover [/.and] - (let [even (/.filter n.even? <code>.nat) - odd (/.filter n.odd? <code>.nat)] + (let [even (/.only n.even? <code>.nat) + odd (/.only n.odd? <code>.nat)] (and (|> (list (code.nat even0) (code.nat odd0)) (/.run (/.and even odd)) (match [left right] @@ -143,8 +143,8 @@ (/.run (/.and even odd)) fails?)))) (_.cover [/.or] - (let [even (/.filter n.even? <code>.nat) - odd (/.filter n.odd? <code>.nat)] + (let [even (/.only n.even? <code>.nat) + odd (/.only n.odd? <code>.nat)] (and (|> (list (code.nat even0)) (/.run (/.or even odd)) (match (#.Left actual) (n.= even0 actual))) @@ -155,8 +155,8 @@ (/.run (/.or even odd)) fails?)))) (_.cover [/.either] - (let [even (/.filter n.even? <code>.nat) - odd (/.filter n.odd? <code>.nat)] + (let [even (/.only n.even? <code>.nat) + odd (/.only n.odd? <code>.nat)] (and (|> (list (code.nat even0)) (/.run (/.either even odd)) (match actual (n.= even0 actual))) @@ -181,7 +181,7 @@ [variadic (\ ! map (|>> (n.max 1) (n.min 20)) random.nat) times (\ ! map (n.% variadic) random.nat) expected random.nat - wrong (|> random.nat (random.filter (|>> (n.= expected) not))) + wrong (|> random.nat (random.only (|>> (n.= expected) not))) expected+ (random.list variadic random.nat) separator (random.ascii 1)] ($_ _.and @@ -259,11 +259,11 @@ Test (do random.monad [expected random.nat - even (random.filter n.even? random.nat) - odd (random.filter n.odd? random.nat) + even (random.only n.even? random.nat) + odd (random.only n.odd? random.nat) #let [nat^ <code>.nat - even^ (/.filter n.even? <code>.nat) - odd^ (/.filter n.odd? <code>.nat)]] + even^ (/.only n.even? <code>.nat) + odd^ (/.only n.odd? <code>.nat)]] ($_ _.and (_.cover [/.rec] (let [parser (/.rec (function (_ self) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 972078a43..d49640f37 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -9,9 +9,9 @@ [monad (#+ do)]] [control [pipe (#+ case>)] + ["<>" parser] ["." try] - ["." exception] - ["<>" parser]] + ["." exception]] [data ["." binary] ["." sum] @@ -64,8 +64,8 @@ (def: random_text (Random Text) - (random.filter ..utf8_conversion_does_not_alter? - (random.unicode ..segment_size))) + (random.only ..utf8_conversion_does_not_alter? + (random.unicode ..segment_size))) (def: random_name (Random Name) diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index fbf0a810f..608ee9675 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -32,13 +32,13 @@ (_.for [/.Parser]) (do {! random.monad} [expected (\ ! map n\encode random.nat) - #let [random-dummy (random.filter (|>> (text\= expected) not) - (random.unicode 5))] - dummy random-dummy + #let [random_dummy (random.only (|>> (text\= expected) not) + (random.unicode 5))] + dummy random_dummy short (random.unicode 1) long (random.unicode 2) - pre-ignore (random.list 5 random-dummy) - post-ignore (random.list 5 random-dummy)] + pre_ignore (random.list 5 random_dummy) + post_ignore (random.list 5 random_dummy)] ($_ _.and (_.cover [/.run /.any] (|> (/.run /.any (list expected)) @@ -57,7 +57,7 @@ (_.cover [/.somewhere] (|> (/.run (|> (/.somewhere (/.this expected)) (<>.before (<>.some /.any))) - (list.concat (list pre-ignore (list expected) post-ignore))) + (list.concat (list pre_ignore (list expected) post_ignore))) (!expect (#try.Success _)))) (_.cover [/.end] (and (|> (/.run /.end (list)) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index 7bb5d1ddb..38d915243 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -54,7 +54,7 @@ (~~ (template [<query> <check> <random> <code> <equivalence>] [(do {! random.monad} [expected <random> - dummy (|> <random> (random.filter (|>> (\ <equivalence> = expected) not)))] + dummy (|> <random> (random.only (|>> (\ <equivalence> = expected) not)))] ($_ _.and (_.cover [<query>] (|> (/.run <query> (list (<code> expected))) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 6b6511e15..142e0cd42 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -38,7 +38,7 @@ (def: safe_frac (Random Frac) - (random.filter (|>> frac.not_a_number? not) random.frac)) + (random.only (|>> frac.not_a_number? not) random.frac)) (def: #export test Test @@ -57,7 +57,7 @@ (~~ (template [<query> <test> <check> <random> <json> <equivalence>] [(do {! random.monad} [expected <random> - dummy (|> <random> (random.filter (|>> (\ <equivalence> = expected) not)))] + dummy (|> <random> (random.only (|>> (\ <equivalence> = expected) not)))] ($_ _.and (_.cover [<query>] (|> (/.run <query> (<json> expected)) @@ -87,7 +87,7 @@ (exception.match? /.unexpected_value error)))))) (do {! random.monad} [expected (random.unicode 1) - dummy (|> (random.unicode 1) (random.filter (|>> (\ text.equivalence = expected) not)))] + dummy (|> (random.unicode 1) (random.only (|>> (\ text.equivalence = expected) not)))] (_.cover [/.value_mismatch] (|> (/.run (/.string! expected) (#json.String dummy)) (!expect (^multi (#try.Failure error) @@ -105,12 +105,12 @@ [size (\ ! map (n.% 10) random.nat) expected (|> (random.unicode 1) (random.list size) - (\ ! map row.from_list))] + (\ ! map row.of_list))] (_.cover [/.array] (|> (/.run (/.array (<>.some /.string)) (#json.Array (row\map (|>> #json.String) expected))) (!expect (^multi (#try.Success actual) - (\ (row.equivalence text.equivalence) = expected (row.from_list actual))))))) + (\ (row.equivalence text.equivalence) = expected (row.of_list actual))))))) (do {! random.monad} [expected (\ ! map (|>> #json.String) (random.unicode 1))] (_.cover [/.unconsumed_input] @@ -138,10 +138,10 @@ (/.field number_field /.number) (/.field string_field /.string))) (#json.Object - (dictionary.from_list text.hash - (list [boolean_field (#json.Boolean expected_boolean)] - [number_field (#json.Number expected_number)] - [string_field (#json.String expected_string)])))) + (dictionary.of_list text.hash + (list [boolean_field (#json.Boolean expected_boolean)] + [number_field (#json.Number expected_number)] + [string_field (#json.String expected_string)])))) (!expect (^multi (#try.Success [actual_boolean actual_number actual_string]) (and (\ bit.equivalence = expected_boolean actual_boolean) (\ frac.equivalence = expected_number actual_number) @@ -150,14 +150,14 @@ [size (\ ! map (n.% 10) random.nat) keys (random.list size (random.unicode 1)) values (random.list size (random.unicode 1)) - #let [expected (dictionary.from_list text.hash (list.zip/2 keys values))]] + #let [expected (dictionary.of_list text.hash (list.zip/2 keys values))]] (_.cover [/.dictionary] (|> (/.run (/.dictionary /.string) (#json.Object (|> values (list\map (|>> #json.String)) (list.zip/2 keys) - (dictionary.from_list text.hash)))) + (dictionary.of_list text.hash)))) (!expect (^multi (#try.Success actual) (\ (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 83211a95f..cd617ff8d 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -64,7 +64,7 @@ (~~ (template [<query> <check> <random> <synthesis> <equivalence>] [(do {! random.monad} [expected <random> - dummy (|> <random> (random.filter (|>> (\ <equivalence> = expected) not)))] + dummy (|> <random> (random.only (|>> (\ <equivalence> = expected) not)))] ($_ _.and (_.cover [<query>] (|> (/.run <query> (list (<synthesis> expected))) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index d00a21d90..46e0d4bda 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -75,64 +75,64 @@ [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.from_code) random.nat) + expected (\ ! map (|>> (n.% range) (n.+ offset) text.of_code) random.nat) out_of_range (case offset - 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.from_code) random.nat) - _ (\ ! map (|>> (n.% offset) text.from_code) random.nat))] + 0 (\ ! map (|>> (n.% 10) inc (n.+ limit) text.of_code) random.nat) + _ (\ ! map (|>> (n.% offset) text.of_code) random.nat))] (_.cover [/.range] (and (..should_pass expected (/.range offset limit)) (..should_fail out_of_range (/.range offset limit))))) (do {! random.monad} [expected (random.char unicode.ascii/upper) - invalid (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) - (random.char unicode.character))] + invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) not) + (random.char unicode.character))] (_.cover [/.upper] - (and (..should_pass (text.from_code expected) /.upper) - (..should_fail (text.from_code invalid) /.upper)))) + (and (..should_pass (text.of_code expected) /.upper) + (..should_fail (text.of_code invalid) /.upper)))) (do {! random.monad} [expected (random.char unicode.ascii/lower) - invalid (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) - (random.char unicode.character))] + invalid (random.only (|>> (unicode/block.within? unicode/block.basic_latin/lower) not) + (random.char unicode.character))] (_.cover [/.lower] - (and (..should_pass (text.from_code expected) /.lower) - (..should_fail (text.from_code invalid) /.lower)))) + (and (..should_pass (text.of_code expected) /.lower) + (..should_fail (text.of_code 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.from_code invalid) /.decimal)))) + (..should_fail (text.of_code 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.from_code invalid) /.octal)))) + (..should_fail (text.of_code 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.from_code invalid) /.hexadecimal)))) + (..should_fail (text.of_code invalid) /.hexadecimal)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char)))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char)))) + (random.char unicode.character))] (_.cover [/.alpha] - (and (..should_pass (text.from_code expected) /.alpha) - (..should_fail (text.from_code invalid) /.alpha)))) + (and (..should_pass (text.of_code expected) /.alpha) + (..should_fail (text.of_code invalid) /.alpha)))) (do {! random.monad} [expected (random.char unicode.ascii/alpha_num) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char) - (unicode/block.within? unicode/block.basic_latin/decimal char)))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char) + (unicode/block.within? unicode/block.basic_latin/decimal char)))) + (random.char unicode.character))] (_.cover [/.alpha_num] - (and (..should_pass (text.from_code expected) /.alpha_num) - (..should_fail (text.from_code invalid) /.alpha_num)))) + (and (..should_pass (text.of_code expected) /.alpha_num) + (..should_fail (text.of_code invalid) /.alpha_num)))) (do {! random.monad} [expected ($_ random.either (wrap text.tab) @@ -141,13 +141,13 @@ (wrap text.new_line) (wrap text.carriage_return) (wrap text.form_feed)) - invalid (|> (random.unicode 1) (random.filter (function (_ char) - (not (or (text\= text.tab char) - (text\= text.vertical_tab char) - (text\= text.space char) - (text\= text.new_line char) - (text\= text.carriage_return char) - (text\= text.form_feed char))))))] + invalid (|> (random.unicode 1) (random.only (function (_ char) + (not (or (text\= text.tab char) + (text\= text.vertical_tab char) + (text\= text.space char) + (text\= text.new_line char) + (text\= text.carriage_return char) + (text\= text.form_feed char))))))] (_.cover [/.space] (and (..should_pass expected /.space) (..should_fail invalid /.space)))) @@ -156,25 +156,25 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.from_code) + (list\map text.of_code) (text.join_with "")))) expected (\ ! map (function (_ value) (|> options (text.nth (n.% num_options value)) maybe.assume)) random.nat) - invalid (random.filter (function (_ char) - (not (text.contains? (text.from_code char) options))) - (random.char unicode.character))] + invalid (random.only (function (_ char) + (not (text.contains? (text.of_code char) options))) + (random.char unicode.character))] (_.cover [/.one_of /.one_of! /.character_should_be] - (and (..should_pass (text.from_code expected) (/.one_of options)) - (..should_fail (text.from_code invalid) (/.one_of options)) - (..should_fail' (text.from_code invalid) (/.one_of options) + (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) /.character_should_be) - (..should_pass! (text.from_code expected) (/.one_of! options)) - (..should_fail (text.from_code invalid) (/.one_of! options)) - (..should_fail' (text.from_code invalid) (/.one_of! options) + (..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) /.character_should_be) ))) (do {! random.monad} @@ -182,25 +182,25 @@ options (|> (random.char unicode.character) (random.set n.hash num_options) (\ ! map (|>> set.to_list - (list\map text.from_code) + (list\map text.of_code) (text.join_with "")))) invalid (\ ! map (function (_ value) (|> options (text.nth (n.% num_options value)) maybe.assume)) random.nat) - expected (random.filter (function (_ char) - (not (text.contains? (text.from_code char) options))) - (random.char unicode.character))] + expected (random.only (function (_ char) + (not (text.contains? (text.of_code char) options))) + (random.char unicode.character))] (_.cover [/.none_of /.none_of! /.character_should_not_be] - (and (..should_pass (text.from_code expected) (/.none_of options)) - (..should_fail (text.from_code invalid) (/.none_of options)) - (..should_fail' (text.from_code invalid) (/.none_of options) + (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) /.character_should_not_be) - (..should_pass! (text.from_code expected) (/.none_of! options)) - (..should_fail (text.from_code invalid) (/.none_of! options)) - (..should_fail' (text.from_code invalid) (/.none_of! options) + (..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) /.character_should_not_be) ))) )) @@ -215,7 +215,7 @@ #let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) - (random.filter (n.>= 8)) + (random.only (n.>= 8)) (\ ! map (\ n.hex encode)))] (_.cover [/.many /.many!] (and (..should_pass expected (/.many /.octal)) @@ -228,7 +228,7 @@ #let [expected (format left right)] invalid (|> random.nat (\ ! map (n.% 16)) - (random.filter (n.>= 8)) + (random.only (n.>= 8)) (\ ! map (\ n.hex encode)))] (_.cover [/.some /.some!] (and (..should_pass expected (/.some /.octal)) @@ -309,7 +309,7 @@ [#let [size 10] expected (random.unicode size) dummy (|> (random.unicode size) - (random.filter (|>> (text\= expected) not)))] + (random.only (|>> (text\= expected) not)))] (_.cover [/.this /.cannot_match] (and (|> (/.run (/.this expected) expected) @@ -373,8 +373,8 @@ (do {! random.monad} [left (random.unicode 1) right (random.unicode 1) - expected (random.filter (|>> (text\= right) not) - (random.unicode 1))] + expected (random.only (|>> (text\= right) not) + (random.unicode 1))] (_.cover [/.enclosed] (|> (format left expected right) (/.run (/.enclosed [left right] (/.this expected))) @@ -397,18 +397,18 @@ (text\= expected actual)))))) (do {! random.monad} [invalid (random.ascii/upper 1) - expected (random.filter (|>> (unicode/block.within? unicode/block.basic_latin/upper) - not) - (random.char unicode.character)) + expected (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) + not) + (random.char unicode.character)) #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ")]] (_.cover [/.not /.not! /.expected_to_fail] - (and (..should_pass (text.from_code expected) (/.not /.upper)) + (and (..should_pass (text.of_code expected) (/.not /.upper)) (|> invalid (/.run (/.not /.upper)) (!expect (^multi (#try.Failure error) (exception.match? /.expected_to_fail error)))) - (..should_pass! (text.from_code expected) (/.not! upper!)) + (..should_pass! (text.of_code expected) (/.not! upper!)) (|> invalid (/.run (/.not! upper!)) (!expect (^multi (#try.Failure error) @@ -416,20 +416,20 @@ (do {! random.monad} [upper (random.ascii/upper 1) lower (random.ascii/lower 1) - invalid (random.filter (function (_ char) - (not (or (unicode/block.within? unicode/block.basic_latin/upper char) - (unicode/block.within? unicode/block.basic_latin/lower char)))) - (random.char unicode.character)) + invalid (random.only (function (_ char) + (not (or (unicode/block.within? unicode/block.basic_latin/upper char) + (unicode/block.within? unicode/block.basic_latin/lower char)))) + (random.char unicode.character)) #let [upper! (/.one_of! "ABCDEFGHIJKLMNOPQRSTUVWXYZ") lower! (/.one_of! "abcdefghijklmnopqrstuvwxyz")]] (_.cover [/.and /.and!] (and (..should_pass (format upper lower) (/.and /.upper /.lower)) - (..should_fail (format (text.from_code invalid) lower) (/.and /.upper /.lower)) - (..should_fail (format upper (text.from_code invalid)) (/.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_pass! (format upper lower) (/.and! upper! lower!)) - (..should_fail (format (text.from_code invalid) lower) (/.and! upper! lower!)) - (..should_fail (format upper (text.from_code invalid)) (/.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!))))) (do {! random.monad} [expected (random.unicode 1) invalid (random.unicode 1)] diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index e330464b4..4b3bf2cad 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -30,7 +30,7 @@ (template: (!cover <coverage> <parser> <sample>) (do {! random.monad} [dummy random.nat - expected (|> random.nat (random.filter (|>> (n.= dummy) not)))] + expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover <coverage> (|> (/.run <parser> <sample>) @@ -40,7 +40,7 @@ (template: (!cover/2 <coverage> <parser> <sample0> <sample1>) (do {! random.monad} [dummy random.nat - expected (|> random.nat (random.filter (|>> (n.= dummy) not)))] + expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover <coverage> (and (|> (/.run <parser> <sample0>) (!expect (^multi (#try.Success actual) diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 7a8feca69..37be6989c 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -39,8 +39,8 @@ (<| (_.for [/.types_do_not_match]) (do {! random.monad} [expected ..primitive - dummy (random.filter (|>> (type\= expected) not) - ..primitive)]) + dummy (random.only (|>> (type\= expected) not) + ..primitive)]) ($_ _.and (_.cover [/.exactly] (and (|> (/.run (/.exactly expected) expected) @@ -105,14 +105,14 @@ (type.variant (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? /.not_function error)))))) - (_.cover [/.apply /.not_application] - (and (|> (/.run (/.apply ($_ //.and /.any /.any /.any)) + (_.cover [/.applied /.not_application] + (and (|> (/.run (/.applied ($_ //.and /.any /.any /.any)) (type.application (list expected_middle expected_right) expected_left)) (!expect (^multi (#try.Success [actual_left actual_middle actual_right]) (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) - (|> (/.run (/.apply ($_ //.and /.any /.any /.any)) + (|> (/.run (/.applied ($_ //.and /.any /.any /.any)) (type.variant (list expected_left expected_middle expected_right))) (!expect (^multi (#try.Failure error) (exception.match? /.not_application error)))))) @@ -235,8 +235,8 @@ (is? /.fresh environment)))))) (do {! random.monad} [expected ..primitive - dummy (random.filter (|>> (type\= expected) not) - ..primitive)] + dummy (random.only (|>> (type\= expected) not) + ..primitive)] (_.cover [/.local] (|> (/.run (do //.monad [_ /.any] diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index aab371fa9..46d80dcc3 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -35,7 +35,7 @@ false)) (template: (!failure <exception> <cases>) - (with_expansions [<<cases>> (template.splice <cases>)] + (with_expansions [<<cases>> (template.spliced <cases>)] (do {! random.monad} [expected (random.ascii/alpha 1)] (_.cover [<exception>] @@ -149,8 +149,8 @@ (#xml.Node tag (dictionary.new name.hash) children)))] parent ..random_tag right ..random_tag - wrong (random.filter (|>> (name\= right) not) - ..random_tag) + wrong (random.only (|>> (name\= right) not) + ..random_tag) #let [parser (<| (/.node parent) (do //.monad [_ (<| /.somewhere diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index fceb62bc7..bd6351ded 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -1,7 +1,7 @@ (.module: [library [lux #* - [type (#+ :share)] + [type (#+ :sharing)] ["_" test (#+ Test)] [abstract [equivalence (#+ Equivalence)] @@ -58,18 +58,18 @@ (def: comparison (Comparison (All [a] (All [! r] (Region r (Thread !) a)))) (function (_ == left right) - (case [(:share [a] - (Equivalence a) - == - - (Try a) - (thread.run (:assume (/.run thread.monad left)))) - (:share [a] - (Equivalence a) - == - - (Try a) - (thread.run (:assume (/.run thread.monad right))))] + (case [(:sharing [a] + (Equivalence a) + == + + (Try a) + (thread.run (:assume (/.run thread.monad left)))) + (:sharing [a] + (Equivalence a) + == + + (Try a) + (thread.run (:assume (/.run thread.monad right))))] [(#try.Success left) (#try.Success right)] (== left right) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 0872db2da..882864ffd 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -42,7 +42,7 @@ (_.for [/.Try]) (do random.monad [expected random.nat - alternative (|> random.nat (random.filter (|>> (n.= expected) not))) + alternative (|> random.nat (random.only (|>> (n.= expected) not))) error (random.unicode 1) #let [(^open "io\.") io.monad]]) ($_ _.and @@ -55,34 +55,20 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.succeed] - (case (/.succeed expected) - (#/.Success actual) - (n.= expected actual) - - _ - false)) - (_.cover [/.fail] - (case (/.fail error) - (#/.Failure message) - (text\= error message) - - _ - false)) - (_.cover [/.assume] + (_.cover [/.assumed] (n.= expected - (/.assume (/.succeed expected)))) - (_.cover [/.from_maybe] - (case [(/.from_maybe (#.Some expected)) - (/.from_maybe #.None)] + (/.assumed (#/.Success expected)))) + (_.cover [/.of_maybe] + (case [(/.of_maybe (#.Some expected)) + (/.of_maybe #.None)] [(#/.Success actual) (#/.Failure _)] (n.= expected actual) _ false)) - (_.cover [/.to_maybe] - (case [(/.to_maybe (/.succeed expected)) - (/.to_maybe (/.fail error))] + (_.cover [/.maybe] + (case [(/.maybe (#/.Success expected)) + (/.maybe (: (/.Try Nat) (#/.Failure error)))] [(#.Some actual) #.None] (n.= expected actual) @@ -90,14 +76,13 @@ false)) (_.cover [/.default] (and (n.= expected - (/.default alternative (/.succeed expected))) + (/.default alternative (#/.Success expected))) (n.= alternative - (/.default alternative (: (Try Nat) - (/.fail error)))))) - (_.cover [/.with /.lift] - (let [lift (/.lift io.monad)] + (/.default alternative (: (Try Nat) (#/.Failure error)))))) + (_.cover [/.with /.lifted] + (let [lifted (/.lifted io.monad)] (|> (do (/.with io.monad) - [a (lift (io\wrap expected)) + [a (lifted (io\wrap expected)) b (wrap alternative)] (wrap (n.+ a b))) io.run diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 879c0c722..2a8f519fa 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -38,7 +38,7 @@ (if (n.< size idx) (do random.monad [byte random.nat] - (exec (try.assume (/.write/8 idx byte output)) + (exec (try.assumed (/.write/8 idx byte output)) (recur (inc idx)))) (\ random.monad wrap output))))) @@ -113,7 +113,7 @@ (_.cover [/.read/64 /.write/64] (..binary_io 3 /.read/64 /.write/64 value)))) (_.cover [/.slice] - (let [random_slice (try.assume (/.slice offset length sample)) + (let [random_slice (try.assumed (/.slice offset length sample)) idxs (: (List Nat) (case length 0 (list) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index ccf1d3484..29f0c733a 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -24,7 +24,7 @@ (def: injection (Injection Array) - (|>> list /.from_list)) + (|>> list /.of_list)) (def: bounded_size (Random Nat) @@ -96,7 +96,7 @@ [size ..bounded_size base random.nat shift random.nat - dummy (random.filter (|>> (n.= base) not) random.nat) + dummy (random.only (|>> (n.= base) not) random.nat) #let [expected (n.+ base shift)] the_array (random.array size random.nat)] ($_ _.and @@ -182,10 +182,10 @@ (/.vacancy the_array))))))) (do ! [the_list (random.list size random.nat)] - (_.cover [/.from_list /.to_list] - (and (|> the_list /.from_list /.to_list + (_.cover [/.of_list /.to_list] + (and (|> the_list /.of_list /.to_list (\ (list.equivalence n.equivalence) = the_list)) - (|> the_array /.to_list /.from_list + (|> the_array /.to_list /.of_list (\ (/.equivalence n.equivalence) = the_array))))) (do ! [amount (\ ! map (n.% (inc size)) random.nat)] @@ -201,8 +201,8 @@ (and (not (is? the_array clone)) (\ (/.equivalence n.equivalence) = the_array clone)))) (let [the_array (/.clone the_array) - evens (|> the_array /.to_list (list.filter n.even?)) - odds (|> the_array /.to_list (list.filter n.odd?))] + evens (|> the_array /.to_list (list.only n.even?)) + odds (|> the_array /.to_list (list.only n.odd?))] (_.cover [/.filter!] (exec (/.filter! n.even? the_array) (and (n.= (list.size evens) (/.occupancy the_array)) @@ -210,11 +210,11 @@ (|> the_array /.to_list (\ (list.equivalence n.equivalence) = evens)))))) (do ! [#let [the_array (/.clone the_array) - members (|> the_array /.to_list (set.from_list n.hash))] - default (random.filter (function (_ value) - (not (or (n.even? value) - (set.member? members value)))) - random.nat)] + members (|> the_array /.to_list (set.of_list n.hash))] + default (random.only (function (_ value) + (not (or (n.even? value) + (set.member? members value)))) + random.nat)] (_.cover [/.to_list'] (exec (/.filter! n.even? the_array) (list.every? (function (_ value) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 541092b4e..fb82ed6c9 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -26,7 +26,7 @@ (def: injection (Injection (/.Dictionary Nat)) - (|>> [0] list (/.from_list n.hash))) + (|>> [0] list (/.of_list n.hash))) (def: for_dictionaries Test @@ -34,10 +34,10 @@ [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] size capped_nat dict (random.dictionary n.hash size random.nat capped_nat) - non_key (random.filter (|>> (/.key? dict) not) - random.nat) - test_val (random.filter (|>> (list.member? n.equivalence (/.values dict)) not) - random.nat)] + non_key (random.only (|>> (/.key? dict) not) + random.nat) + test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not) + random.nat)] ($_ _.and (_.cover [/.size] (n.= size (/.size dict))) @@ -72,7 +72,7 @@ unique_keys! (|> entries (list\map product.left) - (set.from_list n.hash) + (set.of_list n.hash) set.size (n.= (/.size dict))) @@ -95,7 +95,7 @@ unique_keys! (|> keys - (set.from_list n.hash) + (set.of_list n.hash) set.size (n.= (/.size dict))) @@ -113,7 +113,7 @@ (= dict (/.merge dict dict))) overwritting_keys (let [dict' (|> dict /.entries (list\map (function (_ [k v]) [k (inc v)])) - (/.from_list n.hash)) + (/.of_list n.hash)) (^open ".") (/.equivalence n.equivalence)] (= dict' (/.merge dict' dict)))] (and merging_with_oneself @@ -124,10 +124,10 @@ (list.zip/2 (/.values dict) (/.values (/.merge_with n.+ dict dict))))) - (_.cover [/.from_list] + (_.cover [/.of_list] (let [(^open ".") (/.equivalence n.equivalence)] (and (= dict dict) - (|> dict /.entries (/.from_list n.hash) (= dict))))) + (|> dict /.entries (/.of_list n.hash) (= dict))))) ))) (def: for_entries @@ -136,10 +136,10 @@ [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] size capped_nat dict (random.dictionary n.hash size random.nat capped_nat) - non_key (random.filter (|>> (/.key? dict) not) - random.nat) - test_val (random.filter (|>> (list.member? n.equivalence (/.values dict)) not) - random.nat)] + non_key (random.only (|>> (/.key? dict) not) + random.nat) + test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not) + random.nat)] ($_ _.and (_.cover [/.key?] (list.every? (/.key? dict) @@ -256,10 +256,10 @@ [#let [capped_nat (\ random.monad map (n.% 100) random.nat)] size capped_nat dict (random.dictionary n.hash size random.nat capped_nat) - non_key (random.filter (|>> (/.key? dict) not) - random.nat) - test_val (random.filter (|>> (list.member? n.equivalence (/.values dict)) not) - random.nat)] + non_key (random.only (|>> (/.key? dict) not) + random.nat) + test_val (random.only (|>> (list.member? n.equivalence (/.values dict)) not) + random.nat)] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index bfa0175bb..6884c0e28 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -32,8 +32,8 @@ _ (do random.monad [partial (dictionary order gen_key gen_value (dec size)) - key (random.filter (|>> (/.key? partial) not) - gen_key) + key (random.only (|>> (/.key? partial) not) + gen_key) value gen_value] (wrap (/.put key value partial))))) @@ -45,13 +45,13 @@ [size (\ ! map (n.% 100) random.nat) keys (random.set n.hash size random.nat) values (random.set n.hash size random.nat) - extra_key (random.filter (|>> (set.member? keys) not) - random.nat) + extra_key (random.only (|>> (set.member? keys) not) + random.nat) extra_value random.nat shift random.nat #let [pairs (list.zip/2 (set.to_list keys) (set.to_list values)) - sample (/.from_list n.order pairs) + sample (/.of_list n.order pairs) sorted_pairs (list.sort (function (_ [left _] [right _]) (n.< left right)) pairs) @@ -98,9 +98,9 @@ (_.cover [/.keys /.values] (list\= (/.entries sample) (list.zip/2 (/.keys sample) (/.values sample)))) - (_.cover [/.from_list] + (_.cover [/.of_list] (|> sample - /.entries (/.from_list n.order) + /.entries (/.of_list n.order) (/\= sample))) (_.cover [/.key?] (and (list.every? (/.key? sample) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index 450d3b733..f86f4c13c 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -37,9 +37,9 @@ size (\ ! map (n.% 100) random.nat) sample (..random size gen_key random.nat) - #let [keys (|> sample /.keys (set.from_list text.hash))] - extra_key (random.filter (|>> (set.member? keys) not) - gen_key) + #let [keys (|> sample /.keys (set.of_list text.hash))] + extra_key (random.only (|>> (set.member? keys) not) + gen_key) extra_value random.nat shift random.nat] ($_ _.and diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 5f1befd45..a19738802 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -181,15 +181,15 @@ (let [(^open "/\.") (/.equivalence n.equivalence) (^open "/\.") /.monoid] (do {! random.monad} - [sample (random.filter (|>> /.size (n.> 0)) - ..random) + [sample (random.only (|>> /.size (n.> 0)) + ..random) #let [size (/.size sample)] idx (\ ! map (n.% size) random.nat) chunk_size (\ ! map (|>> (n.% size) inc) random.nat)] ($_ _.and - (_.cover [/.filter] - (let [positives (/.filter n.even? sample) - negatives (/.filter (bit.complement n.even?) sample)] + (_.cover [/.only] + (let [positives (/.only n.even? sample) + negatives (/.only (bit.complement n.even?) sample)] (and (/.every? n.even? positives) (not (/.any? n.even? negatives)) @@ -198,9 +198,9 @@ (/.size negatives)))))) (_.cover [/.partition] (let [[positives negatives] (/.partition n.even? sample)] - (and (/\= (/.filter n.even? sample) + (and (/\= (/.only n.even? sample) positives) - (/\= (/.filter (bit.complement n.even?) sample) + (/\= (/.only (bit.complement n.even?) sample) negatives)))) (_.cover [/.split] (let [[left right] (/.split idx sample)] @@ -362,7 +362,7 @@ ($_ _.and (_.cover [/.one] (case [(|> sample - (/.filter n.even?) + (/.only n.even?) (/\map (\ n.decimal encode)) /.head) (/.one choose sample)] @@ -377,7 +377,7 @@ (_.cover [/.all] (\ (/.equivalence text.equivalence) = (|> sample - (/.filter n.even?) + (/.only n.even?) (/\map (\ n.decimal encode))) (/.all choose sample))) (_.cover [/.find] diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index 3181c9bcc..3bc695aca 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -21,7 +21,7 @@ (def: injection (Injection /.Queue) - (|>> list /.from_list)) + (|>> list /.of_list)) (def: #export test Test @@ -30,18 +30,18 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) members (random.set n.hash size random.nat) - non_member (random.filter (|>> (set.member? members) not) - random.nat) + non_member (random.only (|>> (set.member? members) not) + random.nat) #let [members (set.to_list members) - sample (/.from_list members)]] + sample (/.of_list members)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (random.queue size random.nat))) (_.for [/.functor] ($functor.spec ..injection /.equivalence /.functor)) - (_.cover [/.from_list /.to_list] - (|> members /.from_list /.to_list + (_.cover [/.of_list /.to_list] + (|> members /.of_list /.to_list (\ (list.equivalence n.equivalence) = members))) (_.cover [/.size] (n.= size (/.size sample))) diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 55d643aa8..a43b0e278 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -32,12 +32,12 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) sample (..random size) - non-member-priority random.nat - non-member (random.filter (|>> (/.member? n.equivalence sample) not) - random.nat) + non_member_priority random.nat + non_member (random.only (|>> (/.member? n.equivalence sample) not) + random.nat) - max-member random.nat - min-member random.nat] + max_member random.nat + min_member random.nat] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) @@ -61,11 +61,11 @@ #.None (/.empty? sample))) (_.cover [/.push] - (let [sample+ (/.push non-member-priority non-member sample)] - (and (not (/.member? n.equivalence sample non-member)) + (let [sample+ (/.push non_member_priority non_member sample)] + (and (not (/.member? n.equivalence sample non_member)) (n.= (inc (/.size sample)) (/.size sample+)) - (/.member? n.equivalence sample+ non-member)))) + (/.member? n.equivalence sample+ non_member)))) (_.cover [/.pop] (let [sample- (/.pop sample)] (or (and (/.empty? sample) @@ -76,18 +76,18 @@ ($_ _.and (_.cover [/.max] (|> /.empty - (/.push /.min min-member) - (/.push /.max max-member) + (/.push /.min min_member) + (/.push /.max max_member) /.peek - (maybe\map (n.= max-member)) + (maybe\map (n.= max_member)) (maybe.default false))) (_.cover [/.min] (|> /.empty - (/.push /.max max-member) - (/.push /.min min-member) + (/.push /.max max_member) + (/.push /.min min_member) /.pop /.peek - (maybe\map (n.= min-member)) + (maybe\map (n.= min_member)) (maybe.default false))) )) )))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 6b7b09fdc..fdd2c6276 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -50,7 +50,7 @@ (do {! random.monad} [size (\ ! map (n.% 100) random.nat) sample (random.set n.hash size random.nat) - #let [sample (|> sample set.to_list /.from_list)] + #let [sample (|> sample set.to_list /.of_list)] #let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (_.cover [/.size] @@ -59,8 +59,8 @@ (bit\= (/.empty? sample) (n.= 0 (/.size sample)))) (_.cover [/.empty] (/.empty? /.empty)) - (_.cover [/.to_list /.from_list] - (|> sample /.to_list /.from_list (/\= sample))) + (_.cover [/.to_list /.of_list] + (|> sample /.to_list /.of_list (/\= sample))) (_.cover [/.reverse] (or (n.< 2 (/.size sample)) (let [not_same! @@ -87,9 +87,9 @@ [good_index (|> random.nat (\ ! map (n.% size))) #let [bad_index (n.+ size good_index)] sample (random.set n.hash size random.nat) - non_member (random.filter (|>> (set.member? sample) not) - random.nat) - #let [sample (|> sample set.to_list /.from_list)]] + non_member (random.only (|>> (set.member? sample) not) + random.nat) + #let [sample (|> sample set.to_list /.of_list)]] ($_ _.and (_.cover [/.nth] (case (/.nth good_index sample) @@ -142,9 +142,9 @@ (do ! [sample (random.set n.hash size random.nat) - non_member (random.filter (|>> (set.member? sample) not) - random.nat) - #let [sample (|> sample set.to_list /.from_list)] + non_member (random.only (|>> (set.member? sample) not) + random.nat) + #let [sample (|> sample set.to_list /.of_list)] #let [(^open "/\.") (/.equivalence n.equivalence)]] ($_ _.and (do ! @@ -152,7 +152,7 @@ value/1 random.nat value/2 random.nat] (_.cover [/.row] - (/\= (/.from_list (list value/0 value/1 value/2)) + (/\= (/.of_list (list value/0 value/1 value/2)) (/.row value/0 value/1 value/2)))) (_.cover [/.member?] (and (list.every? (/.member? n.equivalence sample) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 8a8adf0a0..5058fae08 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -84,9 +84,9 @@ (_.cover [/.tail] (list\= (enum.range n.enum (inc offset) (n.+ size offset)) (/.take size (/.tail (/.iterate inc offset))))) - (_.cover [/.filter] + (_.cover [/.only] (list\= (list\map (n.* 2) (enum.range n.enum 0 (dec size))) - (/.take size (/.filter n.even? (/.iterate inc 0))))) + (/.take size (/.only n.even? (/.iterate inc 0))))) (_.cover [/.partition] (let [[evens odds] (/.partition n.even? (/.iterate inc 0))] (and (n.= (n.* 2 offset) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 021df152d..64556ed63 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -36,7 +36,7 @@ ($equivalence.spec /.equivalence (random.set n.hash size random.nat))) (_.for [/.hash] (|> random.nat - (\ random.monad map (|>> list (/.from_list n.hash))) + (\ random.monad map (|>> list (/.of_list n.hash))) ($hash.spec /.hash))) (_.for [/.monoid] ($monoid.spec /.equivalence (/.monoid n.hash) (random.set n.hash size random.nat))) @@ -46,8 +46,8 @@ sizeR ..gen_nat setL (random.set n.hash sizeL random.nat) setR (random.set n.hash sizeR random.nat) - non_memberL (random.filter (|>> (/.member? setL) not) - random.nat)] + non_memberL (random.only (|>> (/.member? setL) not) + random.nat)] ($_ _.and (_.cover [/.new] (/.empty? (/.new n.hash))) @@ -67,8 +67,8 @@ (_.cover [/.empty?] (bit\= (/.empty? setL) (n.= 0 (/.size setL)))) - (_.cover [/.to_list /.from_list] - (|> setL /.to_list (/.from_list n.hash) (\= setL))) + (_.cover [/.to_list /.of_list] + (|> setL /.to_list (/.of_list n.hash) (\= setL))) (_.cover [/.member?] (and (list.every? (/.member? setL) (/.to_list setL)) (not (/.member? setL non_memberL)))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 1fd15a14f..aa85116f6 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -115,16 +115,16 @@ (do {! random.monad} [diversity (\ ! map (n.% 10) random.nat) sample (..random diversity n.hash ..count random.nat) - non_member (random.filter (predicate.complement (set.member? (/.support sample))) - random.nat) + non_member (random.only (predicate.complement (set.member? (/.support sample))) + random.nat) addition_count ..count partial_removal_count (\ ! map (n.% addition_count) random.nat) another (..random diversity n.hash ..count random.nat)] ($_ _.and - (_.cover [/.to_list /.from_list] + (_.cover [/.to_list /.of_list] (|> sample /.to_list - (/.from_list n.hash) + (/.of_list n.hash) (\ /.equivalence = sample))) (_.cover [/.size] (n.= (list.size (/.to_list sample)) @@ -194,17 +194,17 @@ (and null_scenario! partial_scenario! total_scenario!))) - (_.cover [/.from_set] - (let [unary (|> sample /.support /.from_set)] + (_.cover [/.of_set] + (let [unary (|> sample /.support /.of_set)] (list.every? (|>> (/.multiplicity unary) (n.= 1)) (/.to_list unary)))) (_.cover [/.sub?] - (let [unary (|> sample /.support /.from_set)] + (let [unary (|> sample /.support /.of_set)] (and (/.sub? sample unary) (or (not (/.sub? unary sample)) (\ /.equivalence = sample unary))))) (_.cover [/.super?] - (let [unary (|> sample /.support /.from_set)] + (let [unary (|> sample /.support /.of_set)] (and (/.super? unary sample) (or (not (/.super? sample unary)) (\ /.equivalence = sample unary))))) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index dd3ba8802..260ab946f 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -32,8 +32,8 @@ _ (do random.monad [partial (random (dec size) &order gen_value) - value (random.filter (|>> (/.member? partial) not) - gen_value)] + value (random.only (|>> (/.member? partial) not) + gen_value)] (wrap (/.add value partial))))) (def: #export test @@ -44,13 +44,13 @@ [sizeL ..size sizeR ..size usetL (random.set n.hash sizeL random.nat) - non_memberL (random.filter (|>> (//.member? usetL) not) - random.nat) + non_memberL (random.only (|>> (//.member? usetL) not) + random.nat) #let [listL (//.to_list usetL)] listR (|> (random.set n.hash sizeR random.nat) (\ ! map //.to_list)) #let [(^open "/\.") /.equivalence - setL (/.from_list n.order listL) - setR (/.from_list n.order listR) + setL (/.of_list n.order listL) + setR (/.of_list n.order listR) empty (/.new n.order)]] (`` ($_ _.and (_.for [/.equivalence] @@ -65,11 +65,11 @@ (/.empty? (/.new n.order))) (_.cover [/.to_list] (\ (list.equivalence n.equivalence) = - (/.to_list (/.from_list n.order listL)) + (/.to_list (/.of_list n.order listL)) (list.sort (\ n.order <) listL))) - (_.cover [/.from_list] + (_.cover [/.of_list] (|> setL - /.to_list (/.from_list n.order) + /.to_list (/.of_list n.order) (/\= setL))) (~~ (template [<coverage> <comparison>] [(_.cover [<coverage>] diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index c007ee050..6340c6fbd 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -28,7 +28,7 @@ (do random.monad [size (\ random.monad map (n.% 100) random.nat) sample (random.stack size random.nat) - expected-top random.nat] + expected_top random.nat] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (random.stack size random.nat))) @@ -59,10 +59,10 @@ sample (/.push top remaining)))) (_.cover [/.push] - (case (/.pop (/.push expected-top sample)) - (#.Some [actual-top actual-sample]) - (and (is? expected-top actual-top) - (is? sample actual-sample)) + (case (/.pop (/.push expected_top sample)) + (#.Some [actual_top actual_sample]) + (and (is? expected_top actual_top) + (is? sample actual_sample)) #.None false)) diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index c34449027..f92d75440 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -33,8 +33,8 @@ (_.for [/.Tree]) (do {! random.monad} [tag_left (random.ascii/alpha_num 1) - tag_right (random.filter (|>> (text\= tag_left) not) - (random.ascii/alpha_num 1)) + tag_right (random.only (|>> (text\= tag_left) not) + (random.ascii/alpha_num 1)) expected_left random.nat expected_right random.nat] ($_ _.and @@ -91,16 +91,16 @@ (list.zip/2 tags/T values/T))] (and (\ tags_equivalence = (list& tags/H tags/T) (/.tags tree)) (\ values_equivalence = (list& values/H values/T) (/.values tree)))))) - (_.cover [/.search] + (_.cover [/.one] (let [can_find_correct_one! (|> (\ ..builder leaf tag_left expected_left) - (/.search (text.contains? tag_left)) + (/.one (text.contains? tag_left)) (maybe\map (n.= expected_left)) (maybe.default false)) cannot_find_incorrect_one! (|> (\ ..builder leaf tag_right expected_right) - (/.search (text.contains? tag_left)) + (/.one (text.contains? tag_left)) (maybe\map (n.= expected_left)) (maybe.default false) not) @@ -109,7 +109,7 @@ (|> (\ ..builder branch (\ ..builder leaf tag_left expected_left) (\ ..builder leaf tag_right expected_right)) - (/.search (text.contains? tag_left)) + (/.one (text.contains? tag_left)) (maybe\map (n.= expected_left)) (maybe.default false)) @@ -117,33 +117,33 @@ (|> (\ ..builder branch (\ ..builder leaf tag_left expected_left) (\ ..builder leaf tag_right expected_right)) - (/.search (text.contains? tag_right)) + (/.one (text.contains? tag_right)) (maybe\map (n.= expected_right)) (maybe.default false))] (and can_find_correct_one! cannot_find_incorrect_one! can_find_left! can_find_right!))) - (_.cover [/.found?] + (_.cover [/.exists?] (let [can_find_correct_one! - (/.found? (text.contains? tag_left) - (\ ..builder leaf tag_left expected_left)) + (/.exists? (text.contains? tag_left) + (\ ..builder leaf tag_left expected_left)) cannot_find_incorrect_one! - (not (/.found? (text.contains? tag_left) - (\ ..builder leaf tag_right expected_right))) + (not (/.exists? (text.contains? tag_left) + (\ ..builder leaf tag_right expected_right))) can_find_left! - (/.found? (text.contains? tag_left) - (\ ..builder branch - (\ ..builder leaf tag_left expected_left) - (\ ..builder leaf tag_right expected_right))) + (/.exists? (text.contains? tag_left) + (\ ..builder branch + (\ ..builder leaf tag_left expected_left) + (\ ..builder leaf tag_right expected_right))) can_find_right! - (/.found? (text.contains? tag_right) - (\ ..builder branch - (\ ..builder leaf tag_left expected_left) - (\ ..builder leaf tag_right expected_right)))] + (/.exists? (text.contains? tag_right) + (\ ..builder branch + (\ ..builder leaf tag_left expected_left) + (\ ..builder leaf tag_right expected_right)))] (and can_find_correct_one! cannot_find_incorrect_one! can_find_left! diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index d04b3b8e9..6487e5685 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -29,7 +29,7 @@ Test (do random.monad [expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat)] + dummy (random.only (|>> (n.= expected) not) random.nat)] ($_ _.and (_.cover [/.down] (|> (tree.branch dummy (list (tree.leaf expected))) @@ -158,7 +158,7 @@ (do {! random.monad} [[size sample] (//.tree random.nat) expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) #let [(^open "tree\.") (tree.equivalence n.equivalence) (^open "list\.") (list.equivalence n.equivalence)]] ($_ _.and diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 578771b59..c118a98ad 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -26,7 +26,7 @@ (def: #export random (Random /.Color) (|> ($_ random.and random.nat random.nat random.nat) - (\ random.monad map /.from_rgb))) + (\ random.monad map /.of_rgb))) (def: scale (-> Nat Frac) @@ -71,19 +71,19 @@ (def: (encoding expected) (-> /.Color Test) ($_ _.and - (_.cover [/.RGB /.to_rgb /.from_rgb] - (|> expected /.to_rgb /.from_rgb + (_.cover [/.RGB /.to_rgb /.of_rgb] + (|> expected /.to_rgb /.of_rgb (\ /.equivalence = expected))) - (_.cover [/.HSL /.to_hsl /.from_hsl] - (|> expected /.to_hsl /.from_hsl + (_.cover [/.HSL /.to_hsl /.of_hsl] + (|> expected /.to_hsl /.of_hsl (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.HSB /.to_hsb /.from_hsb] - (|> expected /.to_hsb /.from_hsb + (_.cover [/.HSB /.to_hsb /.of_hsb] + (|> expected /.to_hsb /.of_hsb (distance/3 expected) (f.<= ..rgb_error_margin))) - (_.cover [/.CMYK /.to_cmyk /.from_cmyk] - (|> expected /.to_cmyk /.from_cmyk + (_.cover [/.CMYK /.to_cmyk /.of_cmyk] + (|> expected /.to_cmyk /.of_cmyk (distance/3 expected) (f.<= ..rgb_error_margin))) )) @@ -92,14 +92,14 @@ Test (do random.monad [colorful (|> ..random - (random.filter (function (_ color) (|> (distance/3 color /.black) (f.>= +100.0)))) - (random.filter (function (_ color) (|> (distance/3 color /.white) (f.>= +100.0))))) + (random.only (function (_ color) (|> (distance/3 color /.black) (f.>= +100.0)))) + (random.only (function (_ color) (|> (distance/3 color /.white) (f.>= +100.0))))) mediocre (|> ..random - (random.filter (|>> saturation - ((function (_ saturation) - (and (f.>= +0.25 saturation) - (f.<= +0.75 saturation))))))) - ratio (|> random.safe_frac (random.filter (f.>= +0.5)))] + (random.only (|>> saturation + ((function (_ saturation) + (and (f.>= +0.25 saturation) + (f.<= +0.75 saturation))))))) + ratio (|> random.safe_frac (random.only (f.>= +0.5)))] ($_ _.and (_.cover [/.darker /.brighter] (and (f.<= (distance/3 colorful /.black) @@ -145,7 +145,7 @@ (~~ (template [<brightness> <palette>] [(_.cover [<palette>] (let [eB <brightness> - expected (/.from_hsb [eH eS eB]) + expected (/.of_hsb [eH eS eB]) palette (<palette> spread variations expected)] (and (n.= variations (list.size palette)) (not (list.any? (\ /.equivalence = expected) palette)))))] @@ -154,7 +154,7 @@ )) (~~ (template [<palette>] [(_.cover [<palette>] - (let [expected (/.from_hsb [eH eS +0.5]) + (let [expected (/.of_hsb [eH eS +0.5]) [c0 c1 c2] (<palette> expected)] (and (\ /.equivalence = expected c0) (not (\ /.equivalence = expected c1)) @@ -165,7 +165,7 @@ [/.split_complement])) (~~ (template [<palette>] [(_.cover [<palette>] - (let [expected (/.from_hsb [eH eS +0.5]) + (let [expected (/.of_hsb [eH eS +0.5]) [c0 c1 c2 c3] (<palette> expected)] (and (\ /.equivalence = expected c0) (not (\ /.equivalence = expected c1)) diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 9e027d74d..11c699932 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -204,13 +204,13 @@ (list.concat (`` (list (~~ (template [<definition> <by_letter>] [((: (-> Any (List //.Color)) (function (_ _) - (`` (list (~~ (template.splice <by_letter>)))))) + (`` (list (~~ (template.spliced <by_letter>)))))) 123)] <colors>)))))) (def: unique_colors - (set.from_list //.hash ..all_colors)) + (set.of_list //.hash ..all_colors)) (def: verdict (n.= (list.size ..all_colors) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 9bd1c09b5..2fe36607d 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -112,8 +112,8 @@ )) (do random.monad [key (random.ascii/alpha 1) - unknown (random.filter (|>> (\ text.equivalence = key) not) - (random.ascii/alpha 1)) + unknown (random.only (|>> (\ text.equivalence = key) not) + (random.ascii/alpha 1)) expected random.safe_frac] (_.cover [/.set] (<| (try.default false) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 8b0655555..fedcdd251 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -158,7 +158,7 @@ Test (do {! random.monad} [expected_path (random.ascii/lower (dec /.path_size)) - expected_moment (\ ! map (|>> (n.% 1,0,00,00,00,00,000) .int instant.from_millis) + expected_moment (\ ! map (|>> (n.% 1,0,00,00,00,00,000) .int instant.of_millis) random.nat) chunk (random.ascii/lower chunk_size) chunks (\ ! map (n.% 100) random.nat) @@ -252,7 +252,7 @@ [path (/.path path) content (/.content (binary.create 0)) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) expected_mode {#/.user {#/.name /.anonymous #/.id /.no_id} @@ -275,7 +275,7 @@ [path (/.path path) content (/.content (binary.create 0)) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) <expected_mode> {#/.user {#/.name /.anonymous #/.id /.no_id} @@ -342,7 +342,7 @@ content (/.content (binary.create 0)) expected (/.name expected) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) /.none {#/.user {#/.name expected #/.id /.no_id} @@ -366,7 +366,7 @@ [path (/.path path) content (/.content (binary.create 0)) tar (|> (row.row (#/.Normal [path - (instant.from_millis +0) + (instant.of_millis +0) /.none {#/.user {#/.name /.anonymous #/.id /.no_id} diff --git a/stdlib/source/test/lux/data/product.lux b/stdlib/source/test/lux/data/product.lux index fd361c2f6..867d8bb84 100644 --- a/stdlib/source/test/lux/data/product.lux +++ b/stdlib/source/test/lux/data/product.lux @@ -21,8 +21,8 @@ (do random.monad [expected random.nat shift random.nat - dummy (random.filter (|>> (n.= expected) not) - random.nat)] + dummy (random.only (|>> (n.= expected) not) + random.nat)] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence i.equivalence) diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index cff19b801..05a2746f7 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -100,10 +100,10 @@ (: (List (| Nat Nat))) /.partition)] (and (\ (list.equivalence n.equivalence) = - (list.filter n.even? expected) + (list.only n.even? expected) lefts) (\ (list.equivalence n.equivalence) = - (list.filter (|>> n.even? not) expected) + (list.only (|>> n.even? not) expected) rights)))) )) )))) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 73696ae46..7223497d1 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -52,8 +52,8 @@ Test (do {! random.monad} [inner (random.unicode 1) - outer (random.filter (|>> (\ /.equivalence = inner) not) - (random.unicode 1)) + outer (random.only (|>> (\ /.equivalence = inner) not) + (random.unicode 1)) left (random.unicode 1) right (random.unicode 1) #let [full (\ /.monoid compose inner outer) @@ -81,8 +81,8 @@ Test (do {! random.monad} [inner (random.unicode 1) - outer (random.filter (|>> (\ /.equivalence = inner) not) - (random.unicode 1)) + outer (random.only (|>> (\ /.equivalence = inner) not) + (random.unicode 1)) #let [fake_index (dec 0)]] ($_ _.and (_.cover [/.contains?] @@ -145,7 +145,7 @@ (def: char Test ($_ _.and - (_.for [/.Char /.from_code] + (_.for [/.Char /.of_code] (`` ($_ _.and (~~ (template [<short> <long>] [(_.cover [<short> <long>] @@ -171,7 +171,7 @@ (_.cover [/.nth] (case (/.nth expected sample) (#.Some char) - (case (/.index_of (/.from_code char) sample) + (case (/.index_of (/.of_code char) sample) (#.Some actual) (n.= expected actual) @@ -198,12 +198,12 @@ (do {! random.monad} [size (\ ! map (|>> (n.% 10) (n.+ 2)) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) - separator (random.filter (|>> (set.member? characters) not) - (random.ascii/alpha 1)) + separator (random.only (|>> (set.member? characters) not) + (random.ascii/alpha 1)) #let [with_no_separator (|> characters set.to_list /.concat)] static (random.ascii/alpha 1) - #let [dynamic (random.filter (|>> (\ /.equivalence = static) not) - (random.ascii/alpha 1))] + #let [dynamic (random.only (|>> (\ /.equivalence = static) not) + (random.ascii/alpha 1))] pre dynamic post dynamic @@ -217,7 +217,7 @@ (and (|> (set.to_list characters) (/.join_with separator) (/.split_all_with separator) - (set.from_list /.hash) + (set.of_list /.hash) (\ set.equivalence = characters)) (\ /.equivalence = (/.concat (set.to_list characters)) @@ -339,7 +339,7 @@ sep1 (random.text normal_char_gen 1) sep2 (random.text normal_char_gen 1) #let [part_gen (|> (random.text normal_char_gen sizeP) - (random.filter (|>> (/.contains? sep1) not)))] + (random.only (|>> (/.contains? sep1) not)))] parts (random.list sizeL part_gen) #let [sample1 (/.concat (list.interpose sep1 parts)) sample2 (/.concat (list.interpose sep2 parts)) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index ea8605b82..3b7f83b72 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -185,7 +185,7 @@ <named> (template [<definition> <by_letter>] [((: (-> Any (List /.Encoding)) (function (_ _) - (`` (list (~~ (template.splice <by_letter>)))))) + (`` (list (~~ (template.spliced <by_letter>)))))) [])] <encodings>)] @@ -205,7 +205,7 @@ (template [<definition> <by_letter>] [(def: <definition> Test - (`` (_.cover [/.name (~~ (template.splice <by_letter>))] + (`` (_.cover [/.name (~~ (template.spliced <by_letter>))] ..verdict)))] <encodings>) diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index bee4a7560..203cf9b81 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -56,18 +56,18 @@ (def: valid_sigils (Set Char) - (set.from_list n.hash - (list (debug.private /.\0_sigil) - (debug.private /.\a_sigil) - (debug.private /.\b_sigil) - (debug.private /.\t_sigil) - (debug.private /.\n_sigil) - (debug.private /.\v_sigil) - (debug.private /.\f_sigil) - (debug.private /.\r_sigil) - (debug.private /.\''_sigil) - (debug.private /.\\_sigil) - (debug.private /.\u_sigil)))) + (set.of_list n.hash + (list (debug.private /.\0_sigil) + (debug.private /.\a_sigil) + (debug.private /.\b_sigil) + (debug.private /.\t_sigil) + (debug.private /.\n_sigil) + (debug.private /.\v_sigil) + (debug.private /.\f_sigil) + (debug.private /.\r_sigil) + (debug.private /.\''_sigil) + (debug.private /.\\_sigil) + (debug.private /.\u_sigil)))) (syntax: (static_sample) (do meta.monad @@ -100,7 +100,7 @@ [left (random.char unicode.character) right (random.char unicode.character)] (_.cover [/.escape /.un_escape] - (let [expected (format (text.from_code left) (text.from_code right))] + (let [expected (format (text.of_code left) (text.of_code 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.from_code))] + (\ ! map text.of_code))] (_.cover [/.dangling_escape] (case (/.un_escape (format (/.escape dummy) "\")) (#try.Success _) @@ -124,8 +124,8 @@ (exception.match? /.dangling_escape error)))) (do {! random.monad} [dummy (|> (random.char unicode.character) - (random.filter (|>> (set.member? ..valid_sigils) not)) - (\ ! map text.from_code))] + (random.only (|>> (set.member? ..valid_sigils) not)) + (\ ! map text.of_code))] (_.cover [/.invalid_escape] (case (/.un_escape (format "\" dummy)) (#try.Success _) @@ -137,10 +137,10 @@ [too_short (|> (random.char unicode.character) (\ ! map (n.% (hex "1000")))) code (|> (random.unicode 4) - (random.filter (function (_ code) - (case (\ n.hex decode code) - (#try.Failure error) true - (#try.Success _) false))))] + (random.only (function (_ code) + (case (\ n.hex decode code) + (#try.Failure error) true + (#try.Success _) false))))] (_.cover [/.invalid_unicode_escape] (template.let [(!invalid <code>) [(case (/.un_escape (format "\u" <code>)) diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index e7a34a90c..d339e0717 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -175,7 +175,7 @@ (/.maybe /.nat sample))))) (do {! random.monad} [modulus (random.one (|>> modulus.modulus - try.to_maybe) + try.maybe) random.int) sample (\ ! map (modular.modular modulus) random.int)] diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index cb481b97a..50498f396 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.from_code (hex "1234"))))) + (should_fail (/.regex "\p{ASCII}") (text.of_code (hex "1234"))))) (_.test "Control characters." - (and (should_pass (/.regex "\p{Contrl}") (text.from_code (hex "12"))) + (and (should_pass (/.regex "\p{Contrl}") (text.of_code (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.from_code (hex "20"))) - (should_fail (/.regex "\p{Print}") (text.from_code (hex "1234"))))) + (and (should_pass (/.regex "\p{Print}") (text.of_code (hex "20"))) + (should_fail (/.regex "\p{Print}") (text.of_code (hex "1234"))))) )) (def: custom_character_classes diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 3b1f3866c..b895df0de 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -149,16 +149,16 @@ <named> (template [<definition> <part>] [((: (-> Any (List /.Block)) (function (_ _) - (`` (list (~~ (template.splice <part>)))))) + (`` (list (~~ (template.spliced <part>)))))) [])] <blocks>)] (template [<definition> <part>] [(def: <definition> Test - (`` (_.cover [(~~ (template.splice <part>))] + (`` (_.cover [(~~ (template.spliced <part>))] (let [all (list.concat (list <named>)) - unique (set.from_list /.hash all)] + unique (set.of_list /.hash all)] (n.= (list.size all) (set.size unique))))))] diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 1396e1646..4eb815ff7 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -72,7 +72,7 @@ byte (\ ! map (|>> (:as /.Long) /.long_to_byte) random.int) short (\ ! map (|>> (:as /.Long) /.long_to_short) random.int) float (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> (:as /.Double) /.double_to_float)))] (`` ($_ _.and (~~ (template [<sample> <=> <to> <from>] @@ -136,10 +136,10 @@ integer (\ ! map (|>> (:as /.Long) /.long_to_int) random.int) long (\ ! map (|>> (:as /.Long)) random.int) float (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> (:as /.Double) /.double_to_float))) double (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> (:as /.Double)))) character (\ ! map (|>> (:as /.Long) /.long_to_int /.int_to_char) random.int) string (\ ! map (|>> (:as java/lang/String)) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index aa4b73548..0aa631ab8 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -92,9 +92,9 @@ int (\ ! map (|>> /.long_to_int) random.int) char (\ ! map (|>> /.long_to_int /.int_to_char) random.int) double (|> random.frac - (random.filter (|>> f.not_a_number? not))) + (random.only (|>> f.not_a_number? not))) float (|> random.frac - (random.filter (|>> f.not_a_number? not)) + (random.only (|>> f.not_a_number? not)) (\ ! map (|>> /.double_to_float)))] (`` ($_ _.and (~~ (template [<=> <sample> <to> <from>] diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 19bdd5f25..df8f798c6 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -23,7 +23,7 @@ ["." /]]) (type: Bundle - {#count Nat + {#amount Nat #names (Set Text) #codes (Set Text) #languages (Set /.Language) @@ -32,13 +32,13 @@ (template [<bundle> <languages>] [(def: <bundle> Bundle - (let [count (template.count <languages>) + (let [amount (template.amount <languages>) languages (: (List /.Language) - (`` (list (~~ (template.splice <languages>)))))] - {#count count - #names (|> languages (list\map /.name) (set.from_list text.hash)) - #codes (|> languages (list\map /.code) (set.from_list text.hash)) - #languages (set.from_list /.hash languages) + (`` (list (~~ (template.spliced <languages>)))))] + {#amount amount + #names (|> languages (list\map /.name) (set.of_list text.hash)) + #codes (|> languages (list\map /.code) (set.of_list text.hash)) + #languages (set.of_list /.hash languages) #test (_.cover <languages> true)}))] @@ -187,8 +187,8 @@ (Hash a) (List Bundle) [Nat (Set a)])) - (list\fold (function (_ bundle [count set]) - [(n.+ count (get@ #count bundle)) + (list\fold (function (_ bundle [amount set]) + [(n.+ amount (get@ #amount bundle)) (set.union set (lens bundle))]) [0 (set.new hash)] territories)) @@ -201,9 +201,9 @@ (list\fold _.and (`` ($_ _.and (~~ (template [<lens> <tag> <hash>] - [(let [[count set] (..aggregate (get@ <tag>) <hash> ..languages)] + [(let [[amount set] (..aggregate (get@ <tag>) <hash> ..languages)] (_.cover [<lens>] - (n.= count (set.size set))))] + (n.= amount (set.size set))))] [/.name #names text.hash] [/.code #codes text.hash] @@ -214,7 +214,7 @@ (template: (!aliases <reference> <aliases>) (_.cover <aliases> (list.every? (\ /.equivalence = <reference>) - (`` (list (~~ (template.splice <aliases>))))))) + (`` (list (~~ (template.spliced <aliases>))))))) (def: aliases_test/0 Test diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 0d2b463c6..381c8f673 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -23,7 +23,7 @@ ["." /]]) (type: Bundle - {#count Nat + {#amount Nat #names (Set Text) #shorts (Set Text) #longs (Set Text) @@ -34,14 +34,14 @@ (template [<bundle> <territories>] [(def: <bundle> Bundle - (let [count (template.count <territories>) - territories (`` (list (~~ (template.splice <territories>))))] - {#count count - #names (|> territories (list\map /.name) (set.from_list text.hash)) - #shorts (|> territories (list\map /.short_code) (set.from_list text.hash)) - #longs (|> territories (list\map /.long_code) (set.from_list text.hash)) - #numbers (|> territories (list\map /.numeric_code) (set.from_list n.hash)) - #territories (|> territories (set.from_list /.hash)) + (let [amount (template.amount <territories>) + territories (`` (list (~~ (template.spliced <territories>))))] + {#amount amount + #names (|> territories (list\map /.name) (set.of_list text.hash)) + #shorts (|> territories (list\map /.short_code) (set.of_list text.hash)) + #longs (|> territories (list\map /.long_code) (set.of_list text.hash)) + #numbers (|> territories (list\map /.numeric_code) (set.of_list n.hash)) + #territories (|> territories (set.of_list /.hash)) #test (_.cover <territories> true)}))] @@ -142,8 +142,8 @@ (Hash a) (List Bundle) [Nat (Set a)])) - (list\fold (function (_ bundle [count set]) - [(n.+ count (get@ #count bundle)) + (list\fold (function (_ bundle [amount set]) + [(n.+ amount (get@ #amount bundle)) (set.union set (lens bundle))]) [0 (set.new hash)] territories)) @@ -156,9 +156,9 @@ (list\fold _.and (`` ($_ _.and (~~ (template [<lens> <tag> <hash>] - [(let [[count set] (..aggregate (get@ <tag>) <hash> ..territories)] + [(let [[amount set] (..aggregate (get@ <tag>) <hash> ..territories)] (_.cover [<lens>] - (n.= count (set.size set))))] + (n.= amount (set.size set))))] [/.name #names text.hash] [/.short_code #shorts text.hash] @@ -171,7 +171,7 @@ (template: (!aliases <reference> <aliases>) (_.cover <aliases> (list.every? (\ /.equivalence = <reference>) - (`` (list (~~ (template.splice <aliases>))))))) + (`` (list (~~ (template.spliced <aliases>))))))) (def: aliases_test Test diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index f0764fda7..2ce231e61 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -92,16 +92,16 @@ ($_ random.either (random\wrap [original substitute]) (do {! random.monad} - [sample (random.filter (|>> (\ /.equivalence = original) not) - ($_ random.either - (random\map /.bit random.bit) - (random\map /.nat random.nat) - (random\map /.int random.int) - (random\map /.rev random.rev) - (random\map /.frac random.safe_frac) - (random\map /.text ..random_text) - (random\map /.identifier ..random_name) - (random\map /.tag ..random_name)))] + [sample (random.only (|>> (\ /.equivalence = original) not) + ($_ random.either + (random\map /.bit random.bit) + (random\map /.nat random.nat) + (random\map /.int random.int) + (random\map /.rev random.rev) + (random\map /.frac random.safe_frac) + (random\map /.text ..random_text) + (random\map /.identifier ..random_name) + (random\map /.tag ..random_name)))] (wrap [sample sample])) (for_sequence /.form) (for_sequence /.tuple) @@ -175,12 +175,12 @@ ..for_format) (do {! random.monad} - [[original substitute] (random.filter (function (_ [original substitute]) - (not (\ /.equivalence = original substitute))) - (random.and ..random ..random)) - [sample expected] (random.filter (function (_ [sample expected]) - (not (\ /.equivalence = sample expected))) - (..replace_simulation [original substitute]))] + [[original substitute] (random.only (function (_ [original substitute]) + (not (\ /.equivalence = original substitute))) + (random.and ..random ..random)) + [sample expected] (random.only (function (_ [sample expected]) + (not (\ /.equivalence = sample expected))) + (..replace_simulation [original substitute]))] (_.cover [/.replace] (\ /.equivalence = expected diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux index fc1d62f11..c46bb5b8c 100644 --- a/stdlib/source/test/lux/macro/template.lux +++ b/stdlib/source/test/lux/macro/template.lux @@ -47,12 +47,12 @@ <short> (as_is ["a" b #c #0 #1 2 +3 -4 .5]) <short>' "abc#0#12+3-4.5"] ($_ _.and - (_.cover [/.splice] + (_.cover [/.spliced] (\ (list.equivalence nat.equivalence) = (list left mid right) - (`` (list (~~ (/.splice [left mid right])))))) - (_.cover [/.count] - (case (/.count [left mid right]) + (`` (list (~~ (/.spliced [left mid right])))))) + (_.cover [/.amount] + (case (/.amount [left mid right]) 3 true _ false)) (_.cover [/.text] diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 657285025..9c7cca0ee 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -292,15 +292,15 @@ (do random.monad [threshold random.nat #let [under? (n.< threshold) - set (set.from_list n.hash (list threshold))] + set (set.of_list n.hash (list threshold))] sample random.nat] ($_ _.and - (_.cover [/.from_predicate] - (bit\= (r.= //.true (/.membership (/.from_predicate under?) sample)) + (_.cover [/.of_predicate] + (bit\= (r.= //.true (/.membership (/.of_predicate under?) sample)) (under? sample))) - (_.cover [/.from_set] - (and (r.= //.true (/.membership (/.from_set set) threshold)) - (bit\= (r.= //.true (/.membership (/.from_set set) sample)) + (_.cover [/.of_set] + (and (r.= //.true (/.membership (/.of_set set) threshold)) + (bit\= (r.= //.true (/.membership (/.of_set set) sample)) (set.member? set sample)))) ))) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 40a091008..3f313bd12 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -42,9 +42,9 @@ [param\\% ($//.random +1,000,000) param (..random param\\%) - subject\\% (random.filter (predicate.intersect (|>> //.divisor (i.> +2)) - (|>> (//.= param\\%) not)) - ($//.random +1,000,000)) + subject\\% (random.only (predicate.intersect (|>> //.divisor (i.> +2)) + (|>> (//.= param\\%) not)) + ($//.random +1,000,000)) subject (..random subject\\%) another (..random subject\\%)] (`` ($_ _.and diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index af040b645..8679cdb70 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -29,7 +29,7 @@ (Ex [%] (-> Int (Random (/.Modulus %)))) (|> random.int (\ random.monad map (i.% range)) - (random.one (|>> /.modulus try.to_maybe)))) + (random.one (|>> /.modulus try.maybe)))) (def: #export test Test diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index cd4f1146c..a1ebf331d 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -29,7 +29,7 @@ (Random Frac) (do {! random.monad} [factor (|> random.nat (\ ! map (|>> (n.% 1000) (n.max 1)))) - measure (|> random.safe_frac (random.filter (f.> +0.0)))] + measure (|> random.safe_frac (random.only (f.> +0.0)))] (wrap (f.* (|> factor .int int.frac) measure)))) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 9a5133a97..23ede5834 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -161,8 +161,8 @@ (/.* (/.signum sample) sample))) )) (do random.monad - [left (random.filter (|>> (/.= +0.0) not) - ..random) + [left (random.only (|>> (/.= +0.0) not) + ..random) right ..random] ($_ _.and (_.cover [/.%] @@ -203,9 +203,9 @@ (test /.negative_infinity))))) (do random.monad [sample random.i64] - (_.cover [/.from_bits] + (_.cover [/.of_bits] (let [expected (java/lang/Double::longBitsToDouble sample) - actual (/.from_bits sample)] + actual (/.of_bits sample)] (or (/.= expected actual) (and (/.not_a_number? expected) (/.not_a_number? actual)))))) @@ -214,13 +214,13 @@ @.jvm <jvm>} (let [test (: (-> Frac Bit) (function (_ expected) - (let [actual (|> expected /.to_bits /.from_bits)] + (let [actual (|> expected /.to_bits /.of_bits)] (or (/.= expected actual) (and (/.not_a_number? expected) (/.not_a_number? actual))))))] (do random.monad [sample random.frac] - (_.cover [/.to_bits /.from_bits] + (_.cover [/.to_bits /.of_bits] (and (test sample) (test /.biggest) (test /.smallest) diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index 1d95a10e5..99738824a 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -108,8 +108,8 @@ (/.>= right left))) )) (do random.monad - [left (random.filter (|>> (/.= +0) not) - random.int) + [left (random.only (|>> (/.= +0) not) + random.int) right random.int] ($_ _.and (_.cover [/.%] @@ -137,7 +137,7 @@ (do {! random.monad} [#let [random (|> random.int (\ ! map (/.% +1,000)) - (random.filter (|>> (/.= +0) not)))] + (random.only (|>> (/.= +0) not)))] left random right random] ($_ _.and diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux index c9bb2102b..3d553e167 100644 --- a/stdlib/source/test/lux/math/number/nat.lux +++ b/stdlib/source/test/lux/math/number/nat.lux @@ -89,8 +89,8 @@ (/.>= right left))) )) (do random.monad - [left (random.filter (|>> (/.= 0) not) - random.nat) + [left (random.only (|>> (/.= 0) not) + random.nat) right random.nat] ($_ _.and (_.cover [/.%] diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 0d67d6f69..c78db2b86 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -29,8 +29,8 @@ (Random /.Ratio) (do random.monad [numerator ..part - denominator (random.filter (|>> (n.= 0) not) - ..part)] + denominator (random.only (|>> (n.= 0) not) + ..part)] (wrap (/.ratio numerator denominator)))) (def: #export test @@ -61,8 +61,8 @@ (/.ratio 0 denom/1)))) (do random.monad [numerator ..part - denominator (random.filter (|>> (n\= 1) not) - ..part)] + denominator (random.only (|>> (n\= 1) not) + ..part)] (_.cover [/.nat] (let [only_numerator! (|> (/.ratio numerator) @@ -101,8 +101,8 @@ (/.* sample (/.reciprocal sample)))) )) (do random.monad - [left (random.filter (|>> (/.= (/.ratio 0)) not) - ..random) + [left (random.only (|>> (/.= (/.ratio 0)) not) + ..random) right ..random] (_.cover [/.%] (let [rem (/.% left right) diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux index 1a2eb29e5..a302b2fc3 100644 --- a/stdlib/source/test/lux/math/number/rev.lux +++ b/stdlib/source/test/lux/math/number/rev.lux @@ -95,10 +95,10 @@ (i64.rotate_right 8) .rev) random.nat)] - dividend (random.filter (/.> .0) dividend) + dividend (random.only (/.> .0) dividend) divisor/0 divisor - divisor/1 (random.filter (|>> (/.= divisor/0) not) - divisor) + divisor/1 (random.only (|>> (/.= divisor/0) not) + divisor) scale (\ ! map (|>> (n.% 10) inc) random.nat)] ($_ _.and @@ -132,8 +132,8 @@ )) (do {! random.monad} [dividend random.rev - divisor (random.filter (|>> (/.= .0) not) - random.rev)] + divisor (random.only (|>> (/.= .0) not) + random.rev)] (_.cover [/./%] (let [[quotient remainder] (/./% divisor dividend)] (and (/.= (/./ divisor dividend) quotient) diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 9276f4a18..67529dcca 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -49,7 +49,7 @@ primitive_type (random.ascii/upper 1) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) #let [expected_lux {#.info {#.target target #.version version #.mode #.Build} @@ -95,7 +95,7 @@ primitive_type (random.ascii/upper 1) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_error (random.ascii/upper 1) #let [expected_lux {#.info {#.target target #.version version @@ -166,17 +166,17 @@ version (random.ascii/upper 1) source_code (random.ascii/upper 1) expected_current_module (random.ascii/upper 1) - imported_module_name (random.filter (|>> (text\= expected_current_module) not) - (random.ascii/upper 1)) + imported_module_name (random.only (|>> (text\= expected_current_module) not) + (random.ascii/upper 1)) primitive_type (random.ascii/upper 1) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_short (random.ascii/upper 1) - dummy_module (random.filter (function (_ module) - (not (or (text\= expected_current_module module) - (text\= imported_module_name module)))) - (random.ascii/upper 1)) + dummy_module (random.only (function (_ module) + (not (or (text\= expected_current_module module) + (text\= imported_module_name module)))) + (random.ascii/upper 1)) #let [imported_module {#.module_hash 0 #.module_aliases (list) #.definitions (list) @@ -213,65 +213,66 @@ #.scope_type_vars (list) #.extensions [] #.host []}]] - ($_ _.and - (_.cover [/.current_module_name] - (|> /.current_module_name - (/.run expected_lux) - (!expect (^multi (#try.Success actual_current_module) - (text\= expected_current_module actual_current_module))))) - (_.cover [/.current_module] - (|> /.current_module - (/.run expected_lux) - (!expect (^multi (#try.Success actual_module) - (is? expected_module actual_module))))) - (_.cover [/.find_module] - (|> (/.find_module expected_current_module) - (/.run expected_lux) - (!expect (^multi (#try.Success actual_module) - (is? expected_module actual_module))))) - (_.cover [/.module_exists?] - (and (|> (/.module_exists? expected_current_module) - (/.run expected_lux) - (!expect (#try.Success #1))) - (|> (/.module_exists? dummy_module) - (/.run expected_lux) - (!expect (#try.Success #0))))) - (_.cover [/.modules] - (|> /.modules - (/.run expected_lux) - (!expect (^multi (#try.Success actual_modules) - (is? expected_modules actual_modules))))) - (_.cover [/.imported_modules] - (and (|> (/.imported_modules expected_current_module) - (/.run expected_lux) - (try\map (\ (list.equivalence text.equivalence) = - (list imported_module_name))) - (try.default false)) - (|> (/.imported_modules imported_module_name) - (/.run expected_lux) - (try\map (\ (list.equivalence text.equivalence) = - (list))) - (try.default false)))) - (_.cover [/.imported_by?] - (|> (/.imported_by? imported_module_name expected_current_module) - (/.run expected_lux) - (try.default false))) - (_.cover [/.imported?] - (|> (/.imported? imported_module_name) - (/.run expected_lux) - (try.default false))) - (_.cover [/.normalize] - (and (|> (/.normalize ["" expected_short]) - (/.run expected_lux) - (!expect (^multi (#try.Success [actual_module actual_short]) - (and (text\= expected_current_module actual_module) - (is? expected_short actual_short))))) - (|> (/.normalize [dummy_module expected_short]) - (/.run expected_lux) - (!expect (^multi (#try.Success [actual_module actual_short]) - (and (text\= dummy_module actual_module) - (is? expected_short actual_short))))))) - ))) + (<| (_.for [.Module]) + ($_ _.and + (_.cover [/.current_module_name] + (|> /.current_module_name + (/.run expected_lux) + (!expect (^multi (#try.Success actual_current_module) + (text\= expected_current_module actual_current_module))))) + (_.cover [/.current_module] + (|> /.current_module + (/.run expected_lux) + (!expect (^multi (#try.Success actual_module) + (is? expected_module actual_module))))) + (_.cover [/.find_module] + (|> (/.find_module expected_current_module) + (/.run expected_lux) + (!expect (^multi (#try.Success actual_module) + (is? expected_module actual_module))))) + (_.cover [/.module_exists?] + (and (|> (/.module_exists? expected_current_module) + (/.run expected_lux) + (!expect (#try.Success #1))) + (|> (/.module_exists? dummy_module) + (/.run expected_lux) + (!expect (#try.Success #0))))) + (_.cover [/.modules] + (|> /.modules + (/.run expected_lux) + (!expect (^multi (#try.Success actual_modules) + (is? expected_modules actual_modules))))) + (_.cover [/.imported_modules] + (and (|> (/.imported_modules expected_current_module) + (/.run expected_lux) + (try\map (\ (list.equivalence text.equivalence) = + (list imported_module_name))) + (try.default false)) + (|> (/.imported_modules imported_module_name) + (/.run expected_lux) + (try\map (\ (list.equivalence text.equivalence) = + (list))) + (try.default false)))) + (_.cover [/.imported_by?] + (|> (/.imported_by? imported_module_name expected_current_module) + (/.run expected_lux) + (try.default false))) + (_.cover [/.imported?] + (|> (/.imported? imported_module_name) + (/.run expected_lux) + (try.default false))) + (_.cover [/.normalize] + (and (|> (/.normalize ["" expected_short]) + (/.run expected_lux) + (!expect (^multi (#try.Success [actual_module actual_short]) + (and (text\= expected_current_module actual_module) + (is? expected_short actual_short))))) + (|> (/.normalize [dummy_module expected_short]) + (/.run expected_lux) + (!expect (^multi (#try.Success [actual_module actual_short]) + (and (text\= dummy_module actual_module) + (is? expected_short actual_short))))))) + )))) (def: random_location (Random Location) @@ -291,7 +292,7 @@ (random.ascii/upper 1)) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location #let [type_context {#.ex_counter 0 #.var_counter 0 @@ -330,7 +331,7 @@ (/.run expected_lux) (!expect (^multi (#try.Success actual_type) (is? expected_type actual_type))))) - (_.cover [/.type_context] + (_.cover [.Type_Context /.type_context] (|> /.type_context (/.run expected_lux) (try\map (is? type_context)) @@ -341,8 +342,8 @@ Test (do {! random.monad} [expected_current_module (random.ascii/upper 1) - expected_macro_module (random.filter (|>> (text\= expected_current_module) not) - (random.ascii/upper 1)) + expected_macro_module (random.only (|>> (text\= expected_current_module) not) + (random.ascii/upper 1)) expected_short (random.ascii/upper 1) expected_type (\ ! map (function (_ name) (#.Primitive name (list))) @@ -402,7 +403,7 @@ #.extensions [] #.host []}])))]] ($_ _.and - (_.cover [/.globals] + (_.cover [.Global .Alias /.globals] (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro)) @@ -419,7 +420,7 @@ (is? macro_globals actual_globals))))] (and current_globals! macro_globals!))) - (_.cover [/.definitions] + (_.cover [.Definition /.definitions] (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] (and (|> (/.definitions expected_current_module) @@ -461,8 +462,8 @@ (do {! random.monad} [expected_exported? random.bit expected_current_module (random.ascii/upper 1) - expected_macro_module (random.filter (|>> (text\= expected_current_module) not) - (random.ascii/upper 1)) + expected_macro_module (random.only (|>> (text\= expected_current_module) not) + (random.ascii/upper 1)) expected_short (random.ascii/upper 1) expected_type (\ ! map (function (_ name) (#.Primitive name (list))) @@ -568,14 +569,14 @@ not_macro! not_found! aliasing!))) - (_.cover [/.un_alias] + (_.cover [/.de_aliased] (let [[current_globals macro_globals expected_lux] (expected_lux true (#.Some .Macro))] - (and (|> (/.un_alias [expected_macro_module expected_short]) + (and (|> (/.de_aliased [expected_macro_module expected_short]) (/.run expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.default false)) - (|> (/.un_alias [expected_current_module expected_short]) + (|> (/.de_aliased [expected_current_module expected_short]) (/.run expected_lux) (try\map (name\= [expected_macro_module expected_short])) (try.default false))))) @@ -640,12 +641,12 @@ Test (do {! random.monad} [current_module (random.ascii/upper 1) - tag_module (random.filter (|>> (text\= current_module) not) - (random.ascii/upper 1)) + tag_module (random.only (|>> (text\= current_module) not) + (random.ascii/upper 1)) name_0 (random.ascii/upper 1) - name_1 (random.filter (|>> (text\= name_0) not) - (random.ascii/upper 1)) + name_1 (random.only (|>> (text\= name_0) not) + (random.ascii/upper 1)) #let [random_tag (\ ! map (|>> [tag_module]) (random.ascii/upper 1))] @@ -813,7 +814,7 @@ #.extensions [] #.host []})]] ($_ _.and - (_.cover [/.locals] + (_.cover [.Scope /.locals] (let [equivalence (: (Equivalence (List (List [Text Type]))) (list.equivalence (list.equivalence @@ -888,6 +889,7 @@ (def: #export test Test (<| (_.covering /._) + (_.for [.Meta .Lux]) ($_ _.and (do {! random.monad} [target (random.ascii/upper 1) @@ -899,7 +901,7 @@ (random.ascii/upper 1)) expected_seed random.nat expected random.nat - dummy (random.filter (|>> (n.= expected) not) random.nat) + dummy (random.only (|>> (n.= expected) not) random.nat) expected_location ..random_location #let [expected_lux {#.info {#.target target #.version version diff --git a/stdlib/source/test/lux/meta/annotation.lux b/stdlib/source/test/lux/meta/annotation.lux index 88ffb18d0..f080ee0c6 100644 --- a/stdlib/source/test/lux/meta/annotation.lux +++ b/stdlib/source/test/lux/meta/annotation.lux @@ -90,8 +90,8 @@ [key ..random_key] (`` ($_ _.and (do ! - [dummy (random.filter (|>> (name\= key) not) - ..random_key) + [dummy (random.only (|>> (name\= key) not) + ..random_key) expected random.bit] (_.cover [/.flagged?] (and (|> expected code.bit diff --git a/stdlib/source/test/lux/target.lux b/stdlib/source/test/lux/target.lux index e9c2594fc..c59dc9025 100644 --- a/stdlib/source/test/lux/target.lux +++ b/stdlib/source/test/lux/target.lux @@ -29,7 +29,7 @@ (def: unique (Set /.Target) - (set.from_list text.hash ..all)) + (set.of_list text.hash ..all)) (def: verdict (n.= (list.size ..all) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index d7d9030df..5e96a2e02 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -236,8 +236,8 @@ (def: $Float::literal /.float) (def: valid_float (Random java/lang/Float) - (random.filter (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) - ..$Float::random)) + (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) + ..$Float::random)) (def: $Float::primitive (Primitive java/lang/Float) {#unboxed /type.float @@ -254,8 +254,8 @@ /.double) (def: valid_double (Random java/lang/Double) - (random.filter (|>> (:as Frac) f.not_a_number? not) - ..$Double::random)) + (random.only (|>> (:as Frac) f.not_a_number? not) + ..$Double::random)) (def: $Double::primitive (Primitive java/lang/Double) {#unboxed /type.double @@ -312,7 +312,7 @@ @.jvm (|>> (:as <type>) <to_long> "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected))))})) (do /.monad - [_ (<push> (|> expected .int <signed> try.assume))] + [_ (<push> (|> expected .int <signed> try.assumed))] <wrap>))))] [byte 7 java/lang/Byte /.bipush ..$Byte::wrap "BIPUSH" ffi.byte_to_long /signed.s1] @@ -590,8 +590,8 @@ comparison (: (-> (Bytecode Any) (-> java/lang/Float java/lang/Float Bit) (Random Bit)) (function (_ instruction standard) (do random.monad - [#let [valid_float (random.filter (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) - ..$Float::random)] + [#let [valid_float (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) + ..$Float::random)] reference valid_float subject valid_float #let [expected (if (for {@.old @@ -787,8 +787,8 @@ ($_ _.and (<| (_.lift "INVOKESTATIC") (do random.monad - [expected (random.filter (|>> (:as Frac) f.not_a_number? not) - ..$Double::random)]) + [expected (random.only (|>> (:as Frac) f.not_a_number? not) + ..$Double::random)]) (..bytecode (for {@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @@ -808,8 +808,8 @@ ..$Boolean::wrap)) (<| (_.lift "INVOKESPECIAL") (do random.monad - [expected (random.filter (|>> (:as Frac) f.not_a_number? not) - ..$Double::random)]) + [expected (random.only (|>> (:as Frac) f.not_a_number? not) + ..$Double::random)]) (..bytecode (for {@.old (|>> (:as java/lang/Double) ("jvm deq" expected)) @@ -886,7 +886,7 @@ _ ..$Long::wrap] /.areturn)))) (row.row)) - try.assume + try.assumed (format.run /class.writer)) loader (/loader.memory (/loader.new_library []))]] (_.test "PUTSTATIC & PUTFIELD & GETFIELD & GETSTATIC" @@ -1031,7 +1031,7 @@ (do {! /.monad} [_ (monad.map ! (|>> (:as java/lang/Long) ffi.long_to_int ..$Integer::literal) (#.Cons sizesH sizesT)) - _ (/.multianewarray type (|> dimensions /unsigned.u1 try.assume)) + _ (/.multianewarray type (|> dimensions /unsigned.u1 try.assumed)) _ ?length] $Long::wrap)))) ))) @@ -1152,7 +1152,7 @@ (_.lift "IINC" (do {! random.monad} [base ..$Byte::random - increment (\ ! map (|>> (n.% 100) /unsigned.u1 try.assume) + increment (\ ! map (|>> (n.% 100) /unsigned.u1 try.assumed) random.nat) #let [expected (: java/lang/Long (for {@.old @@ -1323,7 +1323,7 @@ primitive_method_name (random.ascii/upper 10) #let [primitive_method_type (/type.method [(list) (list) (get@ #unboxed primitive) (list)])] object_method_name (|> (random.ascii/upper 10) - (random.filter (|>> (text\= primitive_method_name) not))) + (random.only (|>> (text\= primitive_method_name) not))) expected (get@ #random primitive) #let [$Self (/type.class class_name (list))]] (wrap (case (do try.monad @@ -1414,7 +1414,7 @@ (_.lift "IFNONNULL" (if! /.ifnonnull (/.string ""))))] reference ..$Integer::random subject (|> ..$Integer::random - (random.filter (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) + (random.only (|>> ((!::= java/lang/Integer "jvm ieq" "jvm int =") reference) not))) #let [[lesser greater] (if (for {@.old ("jvm ilt" reference subject) @@ -1476,7 +1476,7 @@ (do {! random.monad} [expected ..$Long::random dummy ..$Long::random - minimum (\ ! map (|>> (n.% 100) .int /signed.s4 try.assume) + minimum (\ ! map (|>> (n.% 100) .int /signed.s4 try.assumed) random.nat) afterwards (\ ! map (n.% 10) random.nat)]) (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) @@ -1484,7 +1484,7 @@ [@right /.new_label @wrong /.new_label @return /.new_label - _ (/.bipush (|> minimum /signed.value .int /signed.s1 try.assume)) + _ (/.bipush (|> minimum /signed.value .int /signed.s1 try.assumed)) _ (/.tableswitch minimum @wrong [@right (list.repeat afterwards @wrong)]) _ (/.set_label @wrong) _ (..$Long::literal dummy) @@ -1512,7 +1512,7 @@ @return /.new_label _ (..$Integer::literal (ffi.long_to_int (:as java/lang/Long choice))) _ (/.lookupswitch @wrong (list\map (function (_ option) - [(|> option /signed.s4 try.assume) + [(|> option /signed.s4 try.assumed) (if (i.= choice option) @right @wrong)]) options)) _ (/.set_label @wrong) @@ -1585,11 +1585,11 @@ (do random.monad [abstract_class ..class_name interface_class (|> ..class_name - (random.filter (|>> (text\= abstract_class) not))) + (random.only (|>> (text\= abstract_class) not))) concrete_class (|> ..class_name - (random.filter (function (_ class) - (not (or (text\= abstract_class class) - (text\= interface_class class)))))) + (random.only (function (_ class) + (not (or (text\= abstract_class class) + (text\= interface_class class)))))) part0 ..$Long::random part1 ..$Long::random part2 ..$Long::random @@ -1634,7 +1634,7 @@ (list (/method.method ($_ /modifier\compose /method.public /method.abstract) interface_method method::type (list) #.None)) (row.row)) - try.assume + try.assumed (format.run /class.writer)) abstract_bytecode (|> (/class.class /version.v6_0 ($_ /modifier\compose /class.public /class.abstract) (/name.internal abstract_class) @@ -1654,7 +1654,7 @@ (/method.method ($_ /modifier\compose /method.public /method.abstract) abstract_method method::type (list) #.None)) (row.row)) - try.assume + try.assumed (format.run /class.writer)) invoke (: (-> (Type Class) Text (Bytecode Any)) (function (_ class method) @@ -1701,7 +1701,7 @@ _ ..$Long::wrap] /.areturn)))) (row.row)) - try.assume + try.assumed (format.run /class.writer)) loader (/loader.memory (/loader.new_library []))]] (_.test "Class & interface inheritance" diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index d7c05641c..45dc68c97 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -32,8 +32,8 @@ /.Test (do {! random.monad} [expected_message/0 (random.ascii/lower 5) - expected_message/1 (random.filter (|>> (text\= expected_message/0) not) - (random.ascii/lower 5))] + expected_message/1 (random.only (|>> (text\= expected_message/0) not) + (random.ascii/lower 5))] ($_ /.and (wrap (do promise.monad [[success_tally success_message] (/.assert expected_message/0 true) @@ -221,10 +221,10 @@ (/.for [/.Test]) (do {! random.monad} [expected_context (random.ascii/lower 5) - expected_message/0 (random.filter (|>> (text\= expected_context) not) - (random.ascii/lower 5)) - expected_message/1 (random.filter (|>> (text\= expected_message/0) not) - (random.ascii/lower 5))] + expected_message/0 (random.only (|>> (text\= expected_context) not) + (random.ascii/lower 5)) + expected_message/1 (random.only (|>> (text\= expected_message/0) not) + (random.ascii/lower 5))] ($_ /.and (/.for [/.Assertion] ..assertion) diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 77933544c..86e8ddc45 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -119,14 +119,14 @@ (`` ($_ _.and ..for_implementation - (_.cover [/.to_millis /.from_millis] + (_.cover [/.to_millis /.of_millis] (|> expected /.to_millis - /.from_millis + /.of_millis (try\map (\ /.equivalence = expected)) (try.default false))) (_.cover [/.time_exceeds_a_day] - (case (/.from_millis out_of_bounds) + (case (/.of_millis out_of_bounds) (#try.Success _) false diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index cb8ab50c8..6f9832198 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -60,10 +60,10 @@ false))) (do random.monad [expected random.date] - (_.cover [/.to_days /.from_days] + (_.cover [/.to_days /.of_days] (|> expected /.to_days - /.from_days + /.of_days (\ /.equivalence = expected)))) (_.cover [/.epoch] (|> /.epoch diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index 1d2fa1ce7..0aba9b880 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -38,8 +38,8 @@ (do random.monad [duration random.duration] - (_.cover [/.from_millis /.to_millis] - (|> duration /.to_millis /.from_millis (\ /.equivalence = duration)))) + (_.cover [/.of_millis /.to_millis] + (|> duration /.to_millis /.of_millis (\ /.equivalence = duration)))) (do random.monad [#let [(^open "\.") /.equivalence] expected random.duration @@ -66,7 +66,7 @@ (do {! random.monad} [#let [(^open "\.") /.order positive (|> random.duration - (random.filter (|>> (\= /.empty) not)) + (random.only (|>> (\= /.empty) not)) (\ ! map (function (_ duration) (if (/.positive? duration) duration diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index 377a47db1..c36097fe1 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -42,14 +42,14 @@ [#let [(^open "\.") /.equivalence] expected random.instant] ($_ _.and - (_.cover [/.to_millis /.from_millis] - (|> expected /.to_millis /.from_millis (\= expected))) + (_.cover [/.to_millis /.of_millis] + (|> expected /.to_millis /.of_millis (\= expected))) (_.cover [/.relative /.absolute] (|> expected /.relative /.absolute (\= expected))) - (_.cover [/.date /.time /.from_date_time] + (_.cover [/.date /.time /.of_date_time] (\= expected - (/.from_date_time (/.date expected) - (/.time expected)))) + (/.of_date_time (/.date expected) + (/.time expected)))) )) (do random.monad [#let [(^open "\.") /.equivalence diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index d6f124244..317783047 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -32,7 +32,7 @@ (let [december (/.number #/.December)] (|> random.nat (\ random.monad map (|>> (n.% december) inc)) - (random.one (|>> /.by_number try.to_maybe))))) + (random.one (|>> /.by_number try.maybe))))) (def: #export test Test @@ -52,9 +52,9 @@ (do random.monad [expected ..random - invalid (random.filter (predicate.unite (n.< (/.number #/.January)) - (n.> (/.number #/.December))) - random.nat)] + invalid (random.only (predicate.unite (n.< (/.number #/.January)) + (n.> (/.number #/.December))) + random.nat)] ($_ _.and (_.cover [/.number /.by_number] (|> expected @@ -71,7 +71,7 @@ false)) (_.cover [/.year] (let [all (list.size /.year) - uniques (set.size (set.from_list /.hash /.year))] + uniques (set.size (set.of_list /.hash /.year))] (and (n.= (/.number #/.December) all) (n.= all diff --git a/stdlib/source/test/lux/time/year.lux b/stdlib/source/test/lux/time/year.lux index d97eb8334..84ed24fc4 100644 --- a/stdlib/source/test/lux/time/year.lux +++ b/stdlib/source/test/lux/time/year.lux @@ -29,7 +29,7 @@ (def: #export random (Random /.Year) - (random.one (|>> /.year try.to_maybe) random.int)) + (random.one (|>> /.year try.maybe) random.int)) (def: #export test Test @@ -79,9 +79,9 @@ (_.for [/.Period] (_.cover [/.leap /.century /.era] (n.= /.leap (n./ /.century /.era)))) - (let [leap (try.assume (/.year (.int /.leap))) - century (try.assume (/.year (.int /.century))) - era (try.assume (/.year (.int /.era)))] + (let [leap (try.assumed (/.year (.int /.leap))) + century (try.assumed (/.year (.int /.century))) + era (try.assumed (/.year (.int /.era)))] ($_ _.and (_.cover [/.leap?] (and (/.leap? leap) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index 44807af9d..62330114a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -142,7 +142,7 @@ (do {! r.monad} [module-name (r.unicode 5) variant-name (r.unicode 5) - record-name (|> (r.unicode 5) (r.filter (|>> (text\= variant-name) not))) + record-name (|> (r.unicode 5) (r.only (|>> (text\= variant-name) not))) size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) variant-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) record-tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) @@ -154,8 +154,8 @@ record-tags+ (list\map code-tag record-tags) variantTC (list.zip/2 variant-tags+ primitivesC)] inputC (input variant-tags+ record-tags+ primitivesC) - [outputT outputC] (r.filter (|>> product.left (is? Any) not) - _primitive.primitive) + [outputT outputC] (r.only (|>> product.left (is? Any) not) + _primitive.primitive) #let [analyse-pm (function (_ branches) (|> (/.case _primitive.phase branches archive.empty inputC) (//type.with-type outputT) @@ -195,8 +195,8 @@ (|> (analyse-pm redundant-branchesC) _structure.check-fails))) (do ! - [[heterogeneousT heterogeneousC] (r.filter (|>> product.left (check.checks? outputT) not) - _primitive.primitive) + [[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.checks? outputT) not) + _primitive.primitive) heterogeneous-idx (|> r.nat (\ ! map (n.% (list.size exhaustive-patterns)))) #let [heterogeneous-branchesC (list.concat (list (list.take heterogeneous-idx exhaustive-branchesC) (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous-idx exhaustive-branchesC))] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 68b39b8b8..b8a692f07 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -38,94 +38,94 @@ [meta ["." archive]]]]]]]]) -(def: (check-apply expectedT num-args analysis) +(def: (check_apply expectedT num_args analysis) (-> Type Nat (Operation Analysis) Bit) (|> analysis - (//type.with-type expectedT) + (//type.with_type expectedT) (phase.run _primitive.state) (case> (#try.Success applyA) (let [[funcA argsA] (////analysis.application applyA)] - (n.= num-args (list.size argsA))) + (n.= num_args (list.size argsA))) (#try.Failure _) false))) (def: abstraction (do r.monad - [func-name (r.unicode 5) - arg-name (|> (r.unicode 5) (r.filter (|>> (text\= func-name) not))) + [func_name (r.unicode 5) + arg_name (|> (r.unicode 5) (r.only (|>> (text\= func_name) not))) [outputT outputC] _primitive.primitive [inputT _] _primitive.primitive - #let [g!arg (code.local-identifier arg-name)]] - (<| (_.context (%.name (name-of /.function))) + #let [g!arg (code.local_identifier arg_name)]] + (<| (_.context (%.name (name_of /.function))) ($_ _.and (_.test "Can analyse function." - (and (|> (//type.with-type (All [a] (-> a outputT)) - (/.function _primitive.phase func-name arg-name archive.empty outputC)) - _structure.check-succeeds) - (|> (//type.with-type (All [a] (-> a a)) - (/.function _primitive.phase func-name arg-name archive.empty g!arg)) - _structure.check-succeeds))) + (and (|> (//type.with_type (All [a] (-> a outputT)) + (/.function _primitive.phase func_name arg_name archive.empty outputC)) + _structure.check_succeeds) + (|> (//type.with_type (All [a] (-> a a)) + (/.function _primitive.phase func_name arg_name archive.empty g!arg)) + _structure.check_succeeds))) (_.test "Generic functions can always be specialized." - (and (|> (//type.with-type (-> inputT outputT) - (/.function _primitive.phase func-name arg-name archive.empty outputC)) - _structure.check-succeeds) - (|> (//type.with-type (-> inputT inputT) - (/.function _primitive.phase func-name arg-name archive.empty g!arg)) - _structure.check-succeeds))) + (and (|> (//type.with_type (-> inputT outputT) + (/.function _primitive.phase func_name arg_name archive.empty outputC)) + _structure.check_succeeds) + (|> (//type.with_type (-> inputT inputT) + (/.function _primitive.phase func_name arg_name archive.empty g!arg)) + _structure.check_succeeds))) (_.test "The function's name is bound to the function's type." - (|> (//type.with-type (Rec self (-> inputT self)) - (/.function _primitive.phase func-name arg-name archive.empty (code.local-identifier func-name))) - _structure.check-succeeds)) + (|> (//type.with_type (Rec self (-> inputT self)) + (/.function _primitive.phase func_name arg_name archive.empty (code.local_identifier func_name))) + _structure.check_succeeds)) )))) (def: apply (do {! r.monad} - [full-args (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) - partial-args (|> r.nat (\ ! map (n.% full-args))) - var-idx (|> r.nat (\ ! map (|>> (n.% full-args) (n.max 1)))) - inputsTC (r.list full-args _primitive.primitive) + [full_args (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) + partial_args (|> r.nat (\ ! map (n.% full_args))) + var_idx (|> r.nat (\ ! map (|>> (n.% full_args) (n.max 1)))) + inputsTC (r.list full_args _primitive.primitive) #let [inputsT (list\map product.left inputsTC) inputsC (list\map product.right inputsTC)] [outputT outputC] _primitive.primitive #let [funcT (type.function inputsT outputT) - partialT (type.function (list.drop partial-args inputsT) outputT) + partialT (type.function (list.drop partial_args inputsT) outputT) varT (#.Parameter 1) - polyT (<| (type.univ-q 1) - (type.function (list.concat (list (list.take var-idx inputsT) + polyT (<| (type.univ_q 1) + (type.function (list.concat (list (list.take var_idx inputsT) (list varT) - (list.drop (inc var-idx) inputsT)))) + (list.drop (inc var_idx) inputsT)))) varT) - poly-inputT (maybe.assume (list.nth var-idx inputsT)) - partial-poly-inputsT (list.drop (inc var-idx) inputsT) - partial-polyT1 (<| (type.function partial-poly-inputsT) - poly-inputT) - partial-polyT2 (<| (type.univ-q 1) - (type.function (#.Cons varT partial-poly-inputsT)) + poly_inputT (maybe.assume (list.nth var_idx inputsT)) + partial_poly_inputsT (list.drop (inc var_idx) inputsT) + partial_polyT1 (<| (type.function partial_poly_inputsT) + poly_inputT) + partial_polyT2 (<| (type.univ_q 1) + (type.function (#.Cons varT partial_poly_inputsT)) varT) - dummy-function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]] - (<| (_.context (%.name (name-of /.apply))) + dummy_function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]] + (<| (_.context (%.name (name_of /.apply))) ($_ _.and (_.test "Can analyse monomorphic type application." - (|> (/.apply _primitive.phase inputsC funcT dummy-function archive.empty (' [])) - (check-apply outputT full-args))) + (|> (/.apply _primitive.phase inputsC funcT dummy_function archive.empty (' [])) + (check_apply outputT full_args))) (_.test "Can partially apply functions." - (|> (/.apply _primitive.phase (list.take partial-args inputsC) funcT dummy-function archive.empty (' [])) - (check-apply partialT partial-args))) + (|> (/.apply _primitive.phase (list.take partial_args inputsC) funcT dummy_function archive.empty (' [])) + (check_apply partialT partial_args))) (_.test "Can apply polymorphic functions." - (|> (/.apply _primitive.phase inputsC polyT dummy-function archive.empty (' [])) - (check-apply poly-inputT full-args))) + (|> (/.apply _primitive.phase inputsC polyT dummy_function archive.empty (' [])) + (check_apply poly_inputT full_args))) (_.test "Polymorphic partial application propagates found type-vars." - (|> (/.apply _primitive.phase (list.take (inc var-idx) inputsC) polyT dummy-function archive.empty (' [])) - (check-apply partial-polyT1 (inc var-idx)))) + (|> (/.apply _primitive.phase (list.take (inc var_idx) inputsC) polyT dummy_function archive.empty (' [])) + (check_apply partial_polyT1 (inc var_idx)))) (_.test "Polymorphic partial application preserves quantification for type-vars." - (|> (/.apply _primitive.phase (list.take var-idx inputsC) polyT dummy-function archive.empty (' [])) - (check-apply partial-polyT2 var-idx))) + (|> (/.apply _primitive.phase (list.take var_idx inputsC) polyT dummy_function archive.empty (' [])) + (check_apply partial_polyT2 var_idx))) )))) (def: #export test Test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) ($_ _.and ..abstraction ..apply diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index aa3382aa5..e3b4ad9ad 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -53,8 +53,8 @@ (def: #export primitive (Random [Type Code]) (`` ($_ r.either - (~~ (template [<type> <code-wrapper> <value-gen>] - [(r.and (r\wrap <type>) (r\map <code-wrapper> <value-gen>))] + (~~ (template [<type> <code_wrapper> <value_gen>] + [(r.and (r\wrap <type>) (r\map <code_wrapper> <value_gen>))] [Any code.tuple (r.list 0 (r\wrap (' [])))] [Bit code.bit r.bit] @@ -65,28 +65,28 @@ [Text code.text (r.unicode 5)] ))))) -(exception: (wrong-inference {expected Type} {inferred Type}) +(exception: (wrong_inference {expected Type} {inferred Type}) (exception.report ["Expected" (%.type expected)] ["Inferred" (%.type inferred)])) -(def: (infer expected-type analysis) +(def: (infer expected_type analysis) (-> Type (Operation Analysis) (Try Analysis)) (|> analysis - //type.with-inference + //type.with_inference (phase.run ..state) - (case> (#try.Success [inferred-type output]) - (if (is? expected-type inferred-type) + (case> (#try.Success [inferred_type output]) + (if (is? expected_type inferred_type) (#try.Success output) - (exception.throw wrong-inference [expected-type inferred-type])) + (exception.throw wrong_inference [expected_type inferred_type])) (#try.Failure error) (#try.Failure error)))) (def: #export test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) (`` ($_ _.and - (_.test (%.name (name-of #////analysis.Unit)) + (_.test (%.name (name_of #////analysis.Unit)) (|> (infer Any (..phase archive.empty (' []))) (case> (^ (#try.Success (#////analysis.Primitive (#////analysis.Unit output)))) (is? [] output) @@ -96,7 +96,7 @@ (~~ (template [<type> <tag> <random> <constructor>] [(do r.monad [sample <random>] - (_.test (%.name (name-of <tag>)) + (_.test (%.name (name_of <tag>)) (|> (infer <type> (..phase archive.empty (<constructor> sample))) (case> (#try.Success (#////analysis.Primitive (<tag> output))) (is? sample output) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux index 4f94ea927..d854d5677 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -34,49 +34,49 @@ (type: Check (-> (Try Any) Bit)) -(template [<name> <on-success> <on-failure>] +(template [<name> <on_success> <on_failure>] [(def: <name> Check (|>> (case> (#try.Success _) - <on-success> + <on_success> (#try.Failure _) - <on-failure>)))] + <on_failure>)))] [success? true false] [failure? false true] ) -(def: (reach-test var-name [export? def-module] [import? dependent-module] check!) +(def: (reach_test var_name [export? def_module] [import? dependent_module] check!) (-> Text [Bit Text] [Bit Text] Check Bit) (|> (do {! phase.monad} - [_ (//module.with-module 0 def-module - (//module.define var-name (#.Right [export? Any (' {}) []])))] - (//module.with-module 0 dependent-module + [_ (//module.with_module 0 def_module + (//module.define var_name (#.Right [export? Any (' {}) []])))] + (//module.with_module 0 dependent_module (do ! [_ (if import? - (//module.import def-module) + (//module.import def_module) (wrap []))] - (//type.with-inference - (_primitive.phase archive.empty (code.identifier [def-module var-name])))))) + (//type.with_inference + (_primitive.phase archive.empty (code.identifier [def_module var_name])))))) (phase.run _primitive.state) check!)) (def: #export test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) (do r.monad [[expectedT _] _primitive.primitive - def-module (r.unicode 5) - scope-name (r.unicode 5) - var-name (r.unicode 5) - dependent-module (|> (r.unicode 5) - (r.filter (|>> (text\= def-module) not)))] + def_module (r.unicode 5) + scope_name (r.unicode 5) + var_name (r.unicode 5) + dependent_module (|> (r.unicode 5) + (r.only (|>> (text\= def_module) not)))] ($_ _.and (_.test "Can analyse variable." - (|> (//scope.with-scope scope-name - (//scope.with-local [var-name expectedT] - (//type.with-inference - (_primitive.phase archive.empty (code.local-identifier var-name))))) + (|> (//scope.with_scope scope_name + (//scope.with_local [var_name expectedT] + (//type.with_inference + (_primitive.phase archive.empty (code.local_identifier var_name))))) (phase.run _primitive.state) (case> (^ (#try.Success [inferredT (#////analysis.Reference (////reference.local var))])) (and (type\= expectedT inferredT) @@ -85,23 +85,23 @@ _ false))) (_.test "Can analyse definition (in the same module)." - (let [def-name [def-module var-name]] + (let [def_name [def_module var_name]] (|> (do phase.monad - [_ (//module.define var-name (#.Right [false expectedT (' {}) []]))] - (//type.with-inference - (_primitive.phase archive.empty (code.identifier def-name)))) - (//module.with-module 0 def-module) + [_ (//module.define var_name (#.Right [false expectedT (' {}) []]))] + (//type.with_inference + (_primitive.phase archive.empty (code.identifier def_name)))) + (//module.with_module 0 def_module) (phase.run _primitive.state) - (case> (^ (#try.Success [_ inferredT (#////analysis.Reference (////reference.constant constant-name))])) + (case> (^ (#try.Success [_ inferredT (#////analysis.Reference (////reference.constant constant_name))])) (and (type\= expectedT inferredT) - (name\= def-name constant-name)) + (name\= def_name constant_name)) _ false)))) (_.test "Can analyse definition (if exported from imported module)." - (reach-test var-name [true def-module] [true dependent-module] success?)) + (reach_test var_name [true def_module] [true dependent_module] success?)) (_.test "Cannot analyse definition (if not exported from imported module)." - (reach-test var-name [false def-module] [true dependent-module] failure?)) + (reach_test var_name [false def_module] [true dependent_module] failure?)) (_.test "Cannot analyse definition (if exported from non-imported module)." - (reach-test var-name [true def-module] [false dependent-module] failure?)) + (reach_test var_name [true def_module] [false dependent_module] failure?)) )))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index d263e3f0d..3782e861f 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -38,21 +38,21 @@ [meta ["." archive]]]]]]]]) -(template [<name> <on-success> <on-error>] +(template [<name> <on_success> <on_error>] [(def: #export <name> (All [a] (-> (Operation a) Bit)) (|>> (phase.run _primitive.state) (case> (#try.Success _) - <on-success> + <on_success> _ - <on-error>)))] + <on_error>)))] - [check-succeeds true false] - [check-fails false true] + [check_succeeds true false] + [check_fails false true] ) -(def: (check-sum' tag size variant) +(def: (check_sum' tag size variant) (-> Tag Nat (Variant Analysis) Bit) (let [expected//right? (n.= (dec size) tag) expected//lefts (if expected//right? @@ -65,36 +65,36 @@ (bit\= expected//right? actual//right?)))) -(def: (check-sum type tag size analysis) +(def: (check_sum type tag size analysis) (-> Type Tag Nat (Operation Analysis) Bit) (|> analysis - (//type.with-type type) + (//type.with_type type) (phase.run _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) - (check-sum' tag size variant) + (check_sum' tag size variant) _ false))) -(def: (with-tags module tags type) +(def: (with_tags module tags type) (All [a] (-> Text (List //module.Tag) Type (Operation a) (Operation [Module a]))) (|>> (do phase.monad - [_ (//module.declare-tags tags false type)]) - (//module.with-module 0 module))) + [_ (//module.declare_tags tags false type)]) + (//module.with_module 0 module))) -(def: (check-variant module tags expectedT variantT tag analysis) +(def: (check_variant module tags expectedT variantT tag analysis) (-> Text (List //module.Tag) Type Type Tag (Operation Analysis) Bit) (|> analysis - (with-tags module tags variantT) - (//type.with-type expectedT) + (with_tags module tags variantT) + (//type.with_type expectedT) (phase.run _primitive.state) (case> (^ (#try.Success [_ (////analysis.variant variant)])) - (check-sum' tag (list.size tags) variant) + (check_sum' tag (list.size tags) variant) _ false))) -(def: (correct-size? size) +(def: (correct_size? size) (-> Nat (-> Analysis Bit)) (|>> (case> (^ (////analysis.tuple elems)) (|> elems @@ -104,14 +104,14 @@ _ false))) -(def: (check-record module tags expectedT recordT size analysis) +(def: (check_record module tags expectedT recordT size analysis) (-> Text (List //module.Tag) Type Type Nat (Operation Analysis) Bit) (|> analysis - (with-tags module tags recordT) - (//type.with-type expectedT) + (with_tags module tags recordT) + (//type.with_type expectedT) (phase.run _primitive.state) (case> (#try.Success [_ productA]) - (correct-size? size productA) + (correct_size? size productA) _ false))) @@ -131,41 +131,41 @@ (list.drop choice primitives))) [+valueT +valueC] (maybe.assume (list.nth +choice +primitives)) +variantT (type.variant (list\map product.left +primitives))]] - (<| (_.context (%.name (name-of /.sum))) + (<| (_.context (%.name (name_of /.sum))) ($_ _.and (_.test "Can analyse." - (check-sum variantT choice size + (check_sum variantT choice size (/.sum _primitive.phase choice archive.empty valueC))) (_.test "Can analyse through bound type-vars." (|> (do phase.monad - [[_ varT] (//type.with-env check.var) - _ (//type.with-env - (check.check varT variantT))] - (//type.with-type varT - (/.sum _primitive.phase choice archive.empty valueC))) + [[_ varT] (//type.with_env check.var) + _ (//type.with_env + (check.check varT variantT))] + (//type.with_type varT + (/.sum _primitive.phase choice archive.empty valueC))) (phase.run _primitive.state) (case> (^ (#try.Success (////analysis.variant variant))) - (check-sum' choice size variant) + (check_sum' choice size variant) _ false))) (_.test "Cannot analyse through unbound type-vars." (|> (do phase.monad - [[_ varT] (//type.with-env check.var)] - (//type.with-type varT - (/.sum _primitive.phase choice archive.empty valueC))) - check-fails)) + [[_ varT] (//type.with_env check.var)] + (//type.with_type varT + (/.sum _primitive.phase choice archive.empty valueC))) + check_fails)) (_.test "Can analyse through existential quantification." - (|> (//type.with-type (type.ex-q 1 +variantT) - (/.sum _primitive.phase +choice archive.empty +valueC)) - check-succeeds)) + (|> (//type.with_type (type.ex_q 1 +variantT) + (/.sum _primitive.phase +choice archive.empty +valueC)) + check_succeeds)) (_.test "Can analyse through universal quantification." - (let [check-outcome (if (not (n.= choice +choice)) - check-succeeds - check-fails)] - (|> (//type.with-type (type.univ-q 1 +variantT) - (/.sum _primitive.phase +choice archive.empty +valueC)) - check-outcome))) + (let [check_outcome (if (not (n.= choice +choice)) + check_succeeds + check_fails)] + (|> (//type.with_type (type.univ_q 1 +variantT) + (/.sum _primitive.phase +choice archive.empty +valueC)) + check_outcome))) )))) (def: product @@ -180,52 +180,52 @@ (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) +tupleT (type.tuple (list\map product.left +primitives))]] - (<| (_.context (%.name (name-of /.product))) + (<| (_.context (%.name (name_of /.product))) ($_ _.and (_.test "Can analyse." - (|> (//type.with-type tupleT - (/.product archive.empty _primitive.phase (list\map product.right primitives))) + (|> (//type.with_type tupleT + (/.product archive.empty _primitive.phase (list\map product.right primitives))) (phase.run _primitive.state) (case> (#try.Success tupleA) - (correct-size? size tupleA) + (correct_size? size tupleA) _ false))) (_.test "Can infer." - (|> (//type.with-inference - (/.product archive.empty _primitive.phase (list\map product.right primitives))) + (|> (//type.with_inference + (/.product archive.empty _primitive.phase (list\map product.right primitives))) (phase.run _primitive.state) (case> (#try.Success [_type tupleA]) (and (check.checks? tupleT _type) - (correct-size? size tupleA)) + (correct_size? size tupleA)) _ false))) (_.test "Can analyse singleton." - (|> (//type.with-type singletonT - (_primitive.phase archive.empty (` [(~ singletonC)]))) - check-succeeds)) + (|> (//type.with_type singletonT + (_primitive.phase archive.empty (` [(~ singletonC)]))) + check_succeeds)) (_.test "Can analyse through bound type-vars." (|> (do phase.monad - [[_ varT] (//type.with-env check.var) - _ (//type.with-env - (check.check varT (type.tuple (list\map product.left primitives))))] - (//type.with-type varT - (/.product archive.empty _primitive.phase (list\map product.right primitives)))) + [[_ varT] (//type.with_env check.var) + _ (//type.with_env + (check.check varT (type.tuple (list\map product.left primitives))))] + (//type.with_type varT + (/.product archive.empty _primitive.phase (list\map product.right primitives)))) (phase.run _primitive.state) (case> (#try.Success tupleA) - (correct-size? size tupleA) + (correct_size? size tupleA) _ false))) (_.test "Can analyse through existential quantification." - (|> (//type.with-type (type.ex-q 1 +tupleT) - (/.product archive.empty _primitive.phase (list\map product.right +primitives))) - check-succeeds)) + (|> (//type.with_type (type.ex_q 1 +tupleT) + (/.product archive.empty _primitive.phase (list\map product.right +primitives))) + check_succeeds)) (_.test "Cannot analyse through universal quantification." - (|> (//type.with-type (type.univ-q 1 +tupleT) - (/.product archive.empty _primitive.phase (list\map product.right +primitives))) - check-fails)) + (|> (//type.with_type (type.univ_q 1 +tupleT) + (/.product archive.empty _primitive.phase (list\map product.right +primitives))) + check_fails)) )))) (def: variant @@ -233,44 +233,44 @@ [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) choice (|> r.nat (\ ! map (n.% size))) - other-choice (|> r.nat (\ ! map (n.% size)) (r.filter (|>> (n.= choice) not))) + other_choice (|> r.nat (\ ! map (n.% size)) (r.only (|>> (n.= choice) not))) primitives (r.list size _primitive.primitive) - module-name (r.unicode 5) - type-name (r.unicode 5) - #let [with-name (|>> (#.Named [module-name type-name])) + module_name (r.unicode 5) + type_name (r.unicode 5) + #let [with_name (|>> (#.Named [module_name type_name])) varT (#.Parameter 1) primitivesT (list\map product.left primitives) [choiceT choiceC] (maybe.assume (list.nth choice primitives)) - [other-choiceT other-choiceC] (maybe.assume (list.nth other-choice primitives)) + [other_choiceT other_choiceC] (maybe.assume (list.nth other_choice primitives)) monoT (type.variant primitivesT) polyT (|> (type.variant (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q 1)) - choice-tag (maybe.assume (list.nth choice tags)) - other-choice-tag (maybe.assume (list.nth other-choice tags))]] - (<| (_.context (%.name (name-of /.tagged-sum))) + (type.univ_q 1)) + choice_tag (maybe.assume (list.nth choice tags)) + other_choice_tag (maybe.assume (list.nth other_choice tags))]] + (<| (_.context (%.name (name_of /.tagged_sum))) ($_ _.and (_.test "Can infer." - (|> (/.tagged-sum _primitive.phase [module-name choice-tag] archive.empty choiceC) - (check-variant module-name tags - monoT (with-name monoT) + (|> (/.tagged_sum _primitive.phase [module_name choice_tag] archive.empty choiceC) + (check_variant module_name tags + monoT (with_name monoT) choice))) (_.test "Inference retains universal quantification when type-vars are not bound." - (|> (/.tagged-sum _primitive.phase [module-name other-choice-tag] archive.empty other-choiceC) - (check-variant module-name tags - polyT (with-name polyT) - other-choice))) + (|> (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC) + (check_variant module_name tags + polyT (with_name polyT) + other_choice))) (_.test "Can specialize." - (|> (//type.with-type monoT - (/.tagged-sum _primitive.phase [module-name other-choice-tag] archive.empty other-choiceC)) - (check-variant module-name tags - monoT (with-name polyT) - other-choice))) + (|> (//type.with_type monoT + (/.tagged_sum _primitive.phase [module_name other_choice_tag] archive.empty other_choiceC)) + (check_variant module_name tags + monoT (with_name polyT) + other_choice))) (_.test "Specialization when type-vars get bound." - (|> (/.tagged-sum _primitive.phase [module-name choice-tag] archive.empty choiceC) - (check-variant module-name tags - monoT (with-name polyT) + (|> (/.tagged_sum _primitive.phase [module_name choice_tag] archive.empty choiceC) + (check_variant module_name tags + monoT (with_name polyT) choice))) )))) @@ -279,28 +279,28 @@ [size (|> r.nat (\ ! map (|>> (n.% 10) (n.max 2)))) tags (|> (r.set text.hash size (r.unicode 5)) (\ ! map set.to_list)) primitives (r.list size _primitive.primitive) - module-name (r.unicode 5) - type-name (r.unicode 5) + module_name (r.unicode 5) + type_name (r.unicode 5) choice (|> r.nat (\ ! map (n.% size))) #let [varT (#.Parameter 1) - tagsC (list\map (|>> [module-name] code.tag) tags) + tagsC (list\map (|>> [module_name] code.tag) tags) primitivesT (list\map product.left primitives) primitivesC (list\map product.right primitives) - monoT (#.Named [module-name type-name] (type.tuple primitivesT)) + monoT (#.Named [module_name type_name] (type.tuple primitivesT)) recordC (list.zip/2 tagsC primitivesC) polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) - (type.univ-q 1) - (#.Named [module-name type-name]))]] - (<| (_.context (%.name (name-of /.record))) + (type.univ_q 1) + (#.Named [module_name type_name]))]] + (<| (_.context (%.name (name_of /.record))) (_.test "Can infer." (|> (/.record archive.empty _primitive.phase recordC) - (check-record module-name tags monoT monoT size)))))) + (check_record module_name tags monoT monoT size)))))) (def: #export test Test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) ($_ _.and ..sum ..product diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index ebcaa3917..a0643cbcd 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -33,11 +33,11 @@ ["." archive]]]]]]) (template [<name> <success> <failure>] - [(def: (<name> procedure params output-type) + [(def: (<name> procedure params output_type) (-> Text (List Code) Type Bit) - (|> (////scope.with-scope "" - (////type.with-type output-type - (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) + (|> (////scope.with_scope "" + (////type.with_type output_type + (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) (phase.run _primitive.state) (case> (#try.Success _) <success> @@ -45,27 +45,27 @@ (#try.Failure _) <failure>)))] - [check-success+ true false] - [check-failure+ false true] + [check_success+ true false] + [check_failure+ false true] ) (def: primitive (Random [Type Code]) - (r.filter (|>> product.left (is? Any) not) _primitive.primitive)) + (r.only (|>> product.left (is? Any) not) _primitive.primitive)) (def: lux Test (do r.monad [[primT primC] ..primitive [antiT antiC] (|> ..primitive - (r.filter (|>> product.left (type\= primT) not)))] + (r.only (|>> product.left (type\= primT) not)))] ($_ _.and (_.test "Can test for reference equality." - (check-success+ "lux is" (list primC primC) Bit)) + (check_success+ "lux is" (list primC primC) Bit)) (_.test "Reference equality must be done with elements of the same type." - (check-failure+ "lux is" (list primC antiC) Bit)) + (check_failure+ "lux is" (list primC antiC) Bit)) (_.test "Can 'try' risky IO computations." - (check-success+ "lux try" + (check_success+ "lux try" (list (` ("lux io error" "YOLO"))) (type (Either Text primT)))) ))) @@ -78,23 +78,23 @@ paramC (|> r.nat (\ ! map code.nat))] ($_ _.and (_.test "i64 'and'." - (check-success+ "lux i64 and" (list paramC subjectC) Nat)) + (check_success+ "lux i64 and" (list paramC subjectC) Nat)) (_.test "i64 'or'." - (check-success+ "lux i64 or" (list paramC subjectC) Nat)) + (check_success+ "lux i64 or" (list paramC subjectC) Nat)) (_.test "i64 'xor'." - (check-success+ "lux i64 xor" (list paramC subjectC) Nat)) + (check_success+ "lux i64 xor" (list paramC subjectC) Nat)) (_.test "i64 left-shift." - (check-success+ "lux i64 left-shift" (list paramC subjectC) Nat)) + (check_success+ "lux i64 left-shift" (list paramC subjectC) Nat)) (_.test "i64 logical-right-shift." - (check-success+ "lux i64 logical-right-shift" (list paramC subjectC) Nat)) + (check_success+ "lux i64 logical-right-shift" (list paramC subjectC) Nat)) (_.test "i64 arithmetic-right-shift." - (check-success+ "lux i64 arithmetic-right-shift" (list paramC signedC) Int)) + (check_success+ "lux i64 arithmetic-right-shift" (list paramC signedC) Int)) (_.test "i64 equivalence." - (check-success+ "lux i64 =" (list paramC subjectC) Bit)) + (check_success+ "lux i64 =" (list paramC subjectC) Bit)) (_.test "i64 addition." - (check-success+ "lux i64 +" (list paramC subjectC) Int)) + (check_success+ "lux i64 +" (list paramC subjectC) Int)) (_.test "i64 subtraction." - (check-success+ "lux i64 -" (list paramC subjectC) Int)) + (check_success+ "lux i64 -" (list paramC subjectC) Int)) ))) (def: int @@ -104,52 +104,52 @@ paramC (|> r.int (\ ! map code.int))] ($_ _.and (_.test "Can multiply integers." - (check-success+ "lux i64 *" (list paramC subjectC) Int)) + (check_success+ "lux i64 *" (list paramC subjectC) Int)) (_.test "Can divide integers." - (check-success+ "lux i64 /" (list paramC subjectC) Int)) + (check_success+ "lux i64 /" (list paramC subjectC) Int)) (_.test "Can calculate remainder of integers." - (check-success+ "lux i64 %" (list paramC subjectC) Int)) + (check_success+ "lux i64 %" (list paramC subjectC) Int)) (_.test "Can compare integers." - (check-success+ "lux i64 <" (list paramC subjectC) Bit)) + (check_success+ "lux i64 <" (list paramC subjectC) Bit)) (_.test "Can convert integer to text." - (check-success+ "lux i64 char" (list subjectC) Text)) + (check_success+ "lux i64 char" (list subjectC) Text)) (_.test "Can convert integer to fraction." - (check-success+ "lux i64 f64" (list subjectC) Frac)) + (check_success+ "lux i64 f64" (list subjectC) Frac)) ))) (def: frac Test (do {! r.monad} - [subjectC (|> r.safe-frac (\ ! map code.frac)) - paramC (|> r.safe-frac (\ ! map code.frac)) - encodedC (|> r.safe-frac (\ ! map (|>> %.frac code.text)))] + [subjectC (|> r.safe_frac (\ ! map code.frac)) + paramC (|> r.safe_frac (\ ! map code.frac)) + encodedC (|> r.safe_frac (\ ! map (|>> %.frac code.text)))] ($_ _.and (_.test "Can add frac numbers." - (check-success+ "lux f64 +" (list paramC subjectC) Frac)) + (check_success+ "lux f64 +" (list paramC subjectC) Frac)) (_.test "Can subtract frac numbers." - (check-success+ "lux f64 -" (list paramC subjectC) Frac)) + (check_success+ "lux f64 -" (list paramC subjectC) Frac)) (_.test "Can multiply frac numbers." - (check-success+ "lux f64 *" (list paramC subjectC) Frac)) + (check_success+ "lux f64 *" (list paramC subjectC) Frac)) (_.test "Can divide frac numbers." - (check-success+ "lux f64 /" (list paramC subjectC) Frac)) + (check_success+ "lux f64 /" (list paramC subjectC) Frac)) (_.test "Can calculate remainder of frac numbers." - (check-success+ "lux f64 %" (list paramC subjectC) Frac)) + (check_success+ "lux f64 %" (list paramC subjectC) Frac)) (_.test "Can test equivalence of frac numbers." - (check-success+ "lux f64 =" (list paramC subjectC) Bit)) + (check_success+ "lux f64 =" (list paramC subjectC) Bit)) (_.test "Can compare frac numbers." - (check-success+ "lux f64 <" (list paramC subjectC) Bit)) + (check_success+ "lux f64 <" (list paramC subjectC) Bit)) (_.test "Can obtain minimum frac number." - (check-success+ "lux f64 min" (list) Frac)) + (check_success+ "lux f64 min" (list) Frac)) (_.test "Can obtain maximum frac number." - (check-success+ "lux f64 max" (list) Frac)) + (check_success+ "lux f64 max" (list) Frac)) (_.test "Can obtain smallest frac number." - (check-success+ "lux f64 smallest" (list) Frac)) + (check_success+ "lux f64 smallest" (list) Frac)) (_.test "Can convert frac number to integer." - (check-success+ "lux f64 i64" (list subjectC) Int)) + (check_success+ "lux f64 i64" (list subjectC) Int)) (_.test "Can convert frac number to text." - (check-success+ "lux f64 encode" (list subjectC) Text)) + (check_success+ "lux f64 encode" (list subjectC) Text)) (_.test "Can convert text to frac number." - (check-success+ "lux f64 decode" (list encodedC) (type (Maybe Frac)))) + (check_success+ "lux f64 decode" (list encodedC) (type (Maybe Frac)))) ))) (def: text @@ -162,19 +162,19 @@ toC (|> r.nat (\ ! map code.nat))] ($_ _.and (_.test "Can test text equivalence." - (check-success+ "lux text =" (list paramC subjectC) Bit)) + (check_success+ "lux text =" (list paramC subjectC) Bit)) (_.test "Compare texts in lexicographical order." - (check-success+ "lux text <" (list paramC subjectC) Bit)) + (check_success+ "lux text <" (list paramC subjectC) Bit)) (_.test "Can concatenate one text to another." - (check-success+ "lux text concat" (list subjectC paramC) Text)) + (check_success+ "lux text concat" (list subjectC paramC) Text)) (_.test "Can find the index of a piece of text inside a larger one that (may) contain it." - (check-success+ "lux text index" (list fromC paramC subjectC) (type (Maybe Nat)))) + (check_success+ "lux text index" (list fromC paramC subjectC) (type (Maybe Nat)))) (_.test "Can query the size/length of a text." - (check-success+ "lux text size" (list subjectC) Nat)) + (check_success+ "lux text size" (list subjectC) Nat)) (_.test "Can obtain the character code of a text at a given index." - (check-success+ "lux text char" (list fromC subjectC) Nat)) + (check_success+ "lux text char" (list fromC subjectC) Nat)) (_.test "Can clip a piece of text between 2 indices." - (check-success+ "lux text clip" (list fromC toC subjectC) Text)) + (check_success+ "lux text clip" (list fromC toC subjectC) Text)) ))) (def: io @@ -184,16 +184,16 @@ exitC (|> r.int (\ ! map code.int))] ($_ _.and (_.test "Can log messages to standard output." - (check-success+ "lux io log" (list logC) Any)) + (check_success+ "lux io log" (list logC) Any)) (_.test "Can throw a run-time error." - (check-success+ "lux io error" (list logC) Nothing)) + (check_success+ "lux io error" (list logC) Nothing)) (_.test "Can query the current time (as milliseconds since epoch)." - (check-success+ "lux io current-time" (list) Int)) + (check_success+ "lux io current-time" (list) Int)) ))) (def: #export test Test - (<| (_.context (name.module (name-of /._))) + (<| (_.context (name.module (name_of /._))) ($_ _.and ..lux ..i64 diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 9b21270a4..7e1ebf587 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -57,7 +57,7 @@ (let [local (do {! random.monad} [register (\ ! map (|>> (n.% arity) inc) random.nat)] (wrap [next - [(#variable.Local (/.register-optimization offset register)) + [(#variable.Local (/.register_optimization offset register)) (#variable.Local register)]]))] (case offset 0 local @@ -140,7 +140,7 @@ [//.path/member] )) (random\wrap [(inc next) - [(//.path/bind (/.register-optimization offset next)) + [(//.path/bind (/.register_optimization offset next)) (//.path/bind next)]]) )))) sequential (: (Scenario Path) @@ -161,7 +161,7 @@ (def: (branch offset arity next) (Scenario Synthesis) - (let [random-member (: (Random Member) + (let [random_member (: (Random Member) (random.or random.nat random.nat))] ($_ random.either @@ -170,7 +170,7 @@ [[next [inputE inputA]] (..reference offset arity next) [next [bodyE bodyA]] (..reference offset arity next)] (wrap [next - [(//.branch/let [inputE (/.register-optimization offset next) bodyE]) + [(//.branch/let [inputE (/.register_optimization offset next) bodyE]) (//.branch/let [inputA next bodyA])]])) (do {! random.monad} [[next [testE testA]] (..reference offset arity next) @@ -182,8 +182,8 @@ ($_ random.either (do {! random.monad} [[next [recordE recordA]] (..reference offset arity next) - path-length (\ ! map (|>> (n.% 5) inc) random.nat) - path (random.list path-length random-member)] + path_length (\ ! map (|>> (n.% 5) inc) random.nat) + path (random.list path_length random_member)] (wrap [next [(//.branch/get [path recordE]) (//.branch/get [path recordA])]])) @@ -204,7 +204,7 @@ [next [iterationE iterationA]] (..reference offset arity next)] (wrap [next [(//.loop/scope - {#//.start (/.register-optimization offset next) + {#//.start (/.register_optimization offset next) #//.inits (list firstE secondE) #//.iteration iterationE}) (//.loop/scope @@ -266,26 +266,26 @@ (<| (_.covering /._) ($_ _.and (do {! random.monad} - [expected-offset (\ ! map (|>> (n.% 5) (n.+ 2)) random.nat) + [expected_offset (\ ! map (|>> (n.% 5) (n.+ 2)) random.nat) arity (\ ! map (|>> (n.% 5) inc) random.nat) - expected-inits (|> random.nat + expected_inits (|> random.nat (\ ! map (|>> .i64 //.i64)) (random.list arity)) - [_ [expected iteration]] (..scenario expected-offset arity 0)] - (_.cover [/.Transform /.optimization /.register-optimization] - (case (/.optimization true expected-offset expected-inits - {#//.environment (|> expected-offset + [_ [expected iteration]] (..scenario expected_offset arity 0)] + (_.cover [/.Transform /.optimization /.register_optimization] + (case (/.optimization true expected_offset expected_inits + {#//.environment (|> expected_offset list.indices (list\map (|>> #variable.Local))) #//.arity arity #//.body iteration}) - (^ (#.Some (//.loop/scope [actual-offset actual-inits + (^ (#.Some (//.loop/scope [actual_offset actual_inits actual]))) - (and (n.= expected-offset - actual-offset) + (and (n.= expected_offset + actual_offset) (\ (list.equivalence //.equivalence) = - expected-inits - actual-inits) + expected_inits + actual_inits) (\ //.equivalence = expected actual)) _ 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 cbb463ac3..8a71ed224 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -108,7 +108,7 @@ (def: comment-text^ (Random Text) - (let [char-gen (|> r.nat (r.filter (|>> (n.= (`` (char (~~ (static text.new-line))))) not)))] + (let [char-gen (|> r.nat (r.only (|>> (n.= (`` (char (~~ (static text.new-line))))) not)))] (do r.monad [size (|> r.nat (r\map (n.% 20)))] (r.text char-gen size)))) diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index b6c24bde2..65c02256b 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -70,28 +70,28 @@ ($equivalence.spec /.equivalence ..random)) (do {! random.monad} - [anonymousT (random.filter (|>> (case> (#.Named _ _) false - _ true)) - ..random) + [anonymousT (random.only (|>> (case> (#.Named _ _) false + _ true)) + ..random) name/0 ..name name/1 ..name #let [namedT (#.Named name/0 anonymousT) aliasedT (#.Named name/1 namedT)]] ($_ _.and - (_.cover [/.un_alias] - (\ /.equivalence = namedT (/.un_alias aliasedT))) - (_.cover [/.un_name] - (\ /.equivalence = anonymousT (/.un_name aliasedT))))) + (_.cover [/.de_aliased] + (\ /.equivalence = namedT (/.de_aliased aliasedT))) + (_.cover [/.anonymous] + (\ /.equivalence = anonymousT (/.anonymous aliasedT))))) (do {! random.monad} [size (|> random.nat (\ ! map (n.% 3))) members (|> ..random - (random.filter (function (_ type) - (case type - (^or (#.Sum _) (#.Product _)) - #0 + (random.only (function (_ type) + (case type + (^or (#.Sum _) (#.Product _)) + #0 - _ - #1))) + _ + #1))) (list.repeat size) (monad.seq !)) #let [(^open "/\.") /.equivalence @@ -104,50 +104,50 @@ (and (list\= (list) members) (list\= (list <unit>) flat)))))] - [/.variant /.flatten_variant Nothing] - [/.tuple /.flatten_tuple Any] + [/.variant /.flat_variant Nothing] + [/.tuple /.flat_tuple Any] )) ))) - (_.cover [/.apply] + (_.cover [/.applied] (and (<| (maybe.default #0) (do maybe.monad - [partial (/.apply (list Bit) Ann) - full (/.apply (list Int) partial)] + [partial (/.applied (list Bit) Ann) + full (/.applied (list Int) partial)] (wrap (\ /.equivalence = full (#.Product Bit Int))))) - (|> (/.apply (list Bit) Text) + (|> (/.applied (list Bit) Text) (case> #.None #1 _ #0)))) (do {! random.monad} [size (|> random.nat (\ ! map (n.% 3))) members (monad.seq ! (list.repeat size ..random)) extra (|> ..random - (random.filter (function (_ type) - (case type - (^or (#.Function _) (#.Apply _)) - #0 + (random.only (function (_ type) + (case type + (^or (#.Function _) (#.Apply _)) + #0 - _ - #1)))) + _ + #1)))) #let [(^open "/\.") /.equivalence (^open "list\.") (list.equivalence /.equivalence)]] ($_ _.and - (_.cover [/.function /.flatten_function] - (let [[inputs output] (|> (/.function members extra) /.flatten_function)] + (_.cover [/.function /.flat_function] + (let [[inputs output] (|> (/.function members extra) /.flat_function)] (and (list\= members inputs) (/\= extra output)))) - (_.cover [/.application /.flatten_application] - (let [[tfunc tparams] (|> extra (/.application members) /.flatten_application)] + (_.cover [/.application /.flat_application] + (let [[tfunc tparams] (|> extra (/.application members) /.flat_application)] (n.= (list.size members) (list.size tparams)))) )) (do {! random.monad} [size (|> random.nat (\ ! map (|>> (n.% 3) inc))) body_type (|> ..random - (random.filter (function (_ type) - (case type - (^or (#.UnivQ _) (#.ExQ _)) - #0 + (random.only (function (_ type) + (case type + (^or (#.UnivQ _) (#.ExQ _)) + #0 - _ - #1)))) + _ + #1)))) #let [(^open "/\.") /.equivalence]] (`` ($_ _.and (~~ (template [<ctor> <dtor>] @@ -156,8 +156,8 @@ (and (n.= size flat_size) (/\= body_type flat_body))))] - [/.univ_q /.flatten_univ_q] - [/.ex_q /.flatten_ex_q] + [/.univ_q /.flat_univ_q] + [/.ex_q /.flat_ex_q] )) (_.cover [/.quantified?] (and (not (/.quantified? body_type)) @@ -167,17 +167,17 @@ (do {! random.monad} [depth (|> random.nat (\ ! map (|>> (n.% 3) inc))) element_type (|> ..random - (random.filter (function (_ type) - (case type - (^ (#.Primitive name (list element_type))) - (not (text\= array.type_name name)) + (random.only (function (_ type) + (case type + (^ (#.Primitive name (list element_type))) + (not (text\= array.type_name name)) - _ - #1)))) + _ + #1)))) #let [(^open "/\.") /.equivalence]] ($_ _.and - (_.cover [/.array /.flatten_array] - (let [[flat_depth flat_element] (|> element_type (/.array depth) /.flatten_array)] + (_.cover [/.array /.flat_array] + (let [[flat_depth flat_element] (|> element_type (/.array depth) /.flat_array)] (and (n.= depth flat_depth) (/\= element_type flat_element)))) (_.cover [/.array?] @@ -210,14 +210,14 @@ (is? left,right)))) (do random.monad [expected random.nat] - (_.cover [/.:share] + (_.cover [/.:sharing] (n.= expected - (/.:share [a] - (I64 a) - expected + (/.:sharing [a] + (I64 a) + expected - (I64 a) - (.i64 expected))))) + (I64 a) + (.i64 expected))))) /abstract.test /check.test diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 40079eae9..1807046e5 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -338,7 +338,7 @@ (All [a] (-> (-> a a Bit) (Random a) (Random [a a]))) (do random.monad [left random - right (random.filter (|>> (= left) not) random)] + right (random.only (|>> (= left) not) random)] (wrap [left right]))) (type: Super diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux index 5d39b91f2..9a800b92d 100644 --- a/stdlib/source/test/lux/type/quotient.lux +++ b/stdlib/source/test/lux/type/quotient.lux @@ -30,7 +30,7 @@ Test (<| (_.covering /._) (do random.monad - [modulus (random.filter (n.> 0) random.nat) + [modulus (random.only (n.> 0) random.nat) #let [class (: (-> Nat Text) (|>> (n.% modulus) %.nat))] value random.nat] diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index 6ee53edcd..52c8fac88 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -64,16 +64,16 @@ (maybe\map (|>> /.un_refine (n.= (n.+ modulus (inc modulus))))) (maybe.default false) not))) - (_.cover [/.filter] - (let [expected (list.filter predicate raws) - actual (/.filter (/.refinement predicate) raws)] + (_.cover [/.only] + (let [expected (list.only predicate raws) + actual (/.only (/.refinement predicate) raws)] (and (n.= (list.size expected) (list.size actual)) (\ (list.equivalence n.equivalence) = expected (list\map /.un_refine actual))))) (_.cover [/.partition] - (let [expected (list.filter predicate raws) + (let [expected (list.only predicate raws) [actual alternative] (/.partition (/.refinement predicate) raws)] (and (n.= (list.size expected) (list.size actual)) diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 1bed08707..683bf504c 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -27,7 +27,7 @@ (-> Nat (Random (/.Qty <type>))) (|> random.int (\ random.monad map (i.% (.int range))) - (random.filter (|>> (i.= +0) not)) + (random.only (|>> (i.= +0) not)) (\ random.monad map (\ <unit> in))))] [meter /.Meter /.meter] @@ -158,7 +158,7 @@ [#let [zero (\ /.meter in +0) (^open "meter\.") (: (Equivalence (/.Qty /.Meter)) /.equivalence)] - left (random.filter (|>> (meter\= zero) not) (..meter 1,000)) + left (random.only (|>> (meter\= zero) not) (..meter 1,000)) right (..meter 1,000) extra (..second 1,000)] (`` ($_ _.and diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index c34a5c488..e7fd9f42b 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -25,15 +25,15 @@ (implementation (def: (on_read [dead? content]) (do try.monad - [char (try.from_maybe (text.nth 0 content)) - [_ content] (try.from_maybe (text.split 1 content))] + [char (try.of_maybe (text.nth 0 content)) + [_ content] (try.of_maybe (text.split 1 content))] (if dead? (exception.throw ..dead []) (wrap [[dead? content] char])))) (def: (on_read_line [dead? content]) (do try.monad - [[line content] (try.from_maybe (text.split_with text.new_line content))] + [[line content] (try.of_maybe (text.split_with text.new_line content))] (if dead? (exception.throw ..dead []) (wrap [[dead? content] line])))) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index bbbcdf680..ebb9a374d 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -51,8 +51,8 @@ (/.deletion? /.deletion))) (do random.monad [left ..concern - right (random.filter (|>> (is? left) not) - ..concern) + right (random.only (|>> (is? left) not) + ..concern) #let [[left left?] left [right right?] right]] (_.cover [/.also] diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index f75907fad..89c559bb5 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -114,14 +114,14 @@ (list.concat (`` (list (~~ (template [<definition> <keys>] [((: (-> Any (List /.Key)) (function (_ _) - (`` (list (~~ (template.splice <keys>)))))) + (`` (list (~~ (template.spliced <keys>)))))) [])] <groups>)))))) (def: catalogue (Set /.Key) - (set.from_list n.hash ..listing)) + (set.of_list n.hash ..listing)) (def: verdict (n.= (list.size ..listing) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index b051d8e8e..09f8fa86a 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -87,14 +87,14 @@ (list.concat (`` (list (~~ (template [<category> <status+>] [((: (-> Any (List //.Status)) (function (_ _) - (`` (list (~~ (template.splice <status+>)))))) + (`` (list (~~ (template.spliced <status+>)))))) 123)] <categories>)))))) (def: unique (Set //.Status) - (set.from_list n.hash ..all)) + (set.of_list n.hash ..all)) (def: verdict (n.= (list.size ..all) diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux index a063a23bf..851214fb8 100644 --- a/stdlib/source/test/lux/world/output/video/resolution.lux +++ b/stdlib/source/test/lux/world/output/video/resolution.lux @@ -40,7 +40,7 @@ (def: catalogue (Set /.Resolution) - (set.from_list /.hash ..listing)) + (set.of_list /.hash ..listing)) (def: #export random (Random /.Resolution) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 749441a7a..d86683c5f 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -38,7 +38,7 @@ (if dead? (exception.throw ..dead []) (do try.monad - [to_echo (try.from_maybe (list.head arguments))] + [to_echo (try.of_maybe (list.head arguments))] (wrap [dead? to_echo])))) (def: (on_error dead?) |