diff options
Diffstat (limited to '')
56 files changed, 358 insertions, 196 deletions
diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index b5e796c2d..81f331e41 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -134,7 +134,7 @@ [_ package] $///package.random] (in [dependency (|> ///dependency/resolution.empty - (dictionary.put dependency package))]))) + (dictionary.has dependency package))]))) (def: .public test Test diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 0698899da..c4311fc2c 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -100,7 +100,7 @@ [.let [console (@version.echo "") local (///repository/local.repository program fs)] pre (|> ///dependency/resolution.empty - (dictionary.put dependee dependee_package) + (dictionary.has dependee dependee_package) (///dependency/deployment.all local)) post (|> (\ ///.monoid identity) (set@ #///.dependencies (set.of_list ///dependency.hash (list dependee depender))) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 7352de63a..ccccc47cd 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -69,7 +69,7 @@ [_ (: (IO Any) (case [method input] [#@http.Put (#.Some input)] - (atom.update! (dictionary.put url input) cache) + (atom.update! (dictionary.has url input) cache) _ (in [])))] @@ -172,7 +172,7 @@ (random.set hash num_bundles) (\ ! map set.list)) .let [resolution (list\fold (function (_ [dependency expected_artifact package] resolution) - (dictionary.put dependency package resolution)) + (dictionary.has dependency package resolution)) resolution.empty bundles) cache (: Cache diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 4bef34eff..da101dfa2 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -53,7 +53,7 @@ (do {! random.monad} [artifact $///artifact.random [_ package] $///package.random] - (in (dictionary.put {#///dependency.artifact artifact + (in (dictionary.has {#///dependency.artifact artifact #///dependency.type ///artifact/type.lux_library} package /.empty)))) diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index 168d378d4..086551be0 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -34,12 +34,12 @@ (def: (with_default_source sources) (-> (Set //.Source) (Set //.Source)) (if (set.empty? sources) - (set.add //.default_source sources) + (set.has //.default_source sources) sources)) (def: with_default_repository (-> (Set Address) (Set Address)) - (set.add //.default_repository)) + (set.has //.default_repository)) (def: .public test Test diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 354352d6a..152123d55 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -64,7 +64,7 @@ (def: with_default_repository (-> //.Profile //.Profile) - (update@ #//.repositories (set.add //.default_repository))) + (update@ #//.repositories (set.has //.default_repository))) (def: single_profile Test diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 33f719efc..ce7647c9e 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -82,7 +82,7 @@ (def: (on_upload uri content state) (if (dictionary.key? state uri) (exception.except ..cannot_upload [uri]) - (#try.Success (dictionary.put uri content state))))) + (#try.Success (dictionary.has uri content state))))) (def: .public test Test @@ -95,7 +95,7 @@ (..artifact ..invalid_version) (/.mock ..mock (|> ..empty - (dictionary.put (remote.uri ..invalid_version + (dictionary.has (remote.uri ..invalid_version (..artifact ..invalid_version) //artifact/extension.lux_library) (binary.empty 0))))))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index e8af74a92..34d3b4cc1 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -1070,7 +1070,7 @@ @.python @.ruby))) -(syntax: (for_meta|Info) +(syntax: (for_meta|Info []) (function (_ lux) (let [info (get@ #.info lux) @@ -1084,7 +1084,7 @@ (#.Right [lux (list (code.bit (and conforming_target! compiling!)))])))) -(syntax: (for_meta|Module_State) +(syntax: (for_meta|Module_State []) (do meta.monad [prelude_module (meta.module .prelude_module)] (in (list (code.bit (case (get@ #.module_state prelude_module) diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index ee696a14b..b583f4a8e 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -31,7 +31,7 @@ (#/.Effect effect) (|> effect (list\map interpret) - list.concat))) + list.joined))) (def: comparison (Comparison (/.Free List)) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index b7458e8c8..2da826ebb 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -104,7 +104,7 @@ [])] (/.poison! actor))) _ (async.delay 100) - result (async.future (async.poll read))] + result (async.future (async.value read))] (_.cover' [/.poisoned] (case result (#.Some error) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 23cb61056..a92a5c44c 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -35,8 +35,8 @@ (function (_ == left right) (io.run! (do io.monad - [?left (/.poll left) - ?right (/.poll right)] + [?left (/.value left) + ?right (/.value right)] (in (case [?left ?right] [(#.Some left) (#.Some right)] @@ -135,11 +135,11 @@ (n.= (n.+ leftE rightE) (n.+ leftA rightA))))) (in (do /.monad - [?actual (/.future (/.poll (/.resolved expected))) + [?actual (/.future (/.value (/.resolved expected))) .let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] (/.async []))] - ?never (/.future (/.poll async))] - (_.cover' [/.poll] + ?never (/.future (/.value async))] + (_.cover' [/.value] (case [?actual ?never] [(#.Some actual) #.None] (n.= expected actual) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 8bb5a33fd..45dadc8cb 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -36,8 +36,8 @@ (function (_ == left right) (io.run! (do io.monad - [?left (async.poll left) - ?right (async.poll right)] + [?left (async.value left) + ?right (async.value right)] (in (case [?left ?right] [(#.Some (#.Some [left _])) (#.Some (#.Some [right _]))] @@ -93,7 +93,7 @@ (#try.Success channel) (io.run! (do io.monad - [?actual (async.poll channel)] + [?actual (async.value channel)] (in (case ?actual (#.Some (#.Some [actual _])) (n.= sample actual) @@ -118,14 +118,14 @@ [output (|> sample async.resolved /.of_async - /.consume)] - (_.cover' [/.of_async /.consume] + /.list)] + (_.cover' [/.of_async /.list] (list\= (list sample) output)))) (in (do async.monad [output (|> inputs (/.sequential 0) - /.consume)] + /.list)] (_.cover' [/.sequential] (list\= inputs output)))) @@ -133,7 +133,7 @@ [output (|> inputs (/.sequential 0) (/.only n.even?) - /.consume)] + /.list)] (_.cover' [/.only] (list\= (list.only n.even? inputs) output)))) @@ -142,23 +142,23 @@ (async.async [])) sink (: (Atom (Row Nat)) (atom.atom row.empty))] - _ (async.future (/.subscribe (function (_ value) - (do {! io.monad} - [current (atom.read! sink) - _ (atom.update! (row.add value) sink)] - (if (n.< (list.size inputs) - (inc (row.size current))) - (in (#.Some [])) - (do ! - [_ (!signal [])] - (in #.None))))) - (/.sequential 0 (list\compose inputs inputs)))) + _ (async.future (/.subscribe! (function (_ value) + (do {! io.monad} + [current (atom.read! sink) + _ (atom.update! (row.add value) sink)] + (if (n.< (list.size inputs) + (inc (row.size current))) + (in (#.Some [])) + (do ! + [_ (!signal [])] + (in #.None))))) + (/.sequential 0 (list\compose inputs inputs)))) _ ?signal listened (|> sink atom.read! async.future (\ ! map row.list))] - (_.cover' [/.Subscriber /.subscribe] + (_.cover' [/.Subscriber /.subscribe!] (list\= inputs listened)))) (in (do async.monad [actual (/.fold (function (_ input total) @@ -174,7 +174,7 @@ (/.folds (function (_ input total) (async.resolved (n.+ input total))) 0) - /.consume)] + /.list)] (_.cover' [/.folds] (list\= (list.folds n.+ 0 inputs) actual)))) @@ -184,7 +184,7 @@ distint/2 distint/2) (/.sequential 0) (/.distinct n.equivalence) - /.consume)] + /.list)] (_.cover' [/.distinct] (list\= (list distint/0 distint/1 distint/2) actual)))) @@ -215,7 +215,7 @@ (#.Some [[(inc iterations) (n.+ shift current)] current]) #.None)))) - /.consume)] + /.list)] (_.cover' [/.iterations] (and (n.= max_iterations (list.size actual)) (list\= (list.folds n.+ sample (list.repeated (dec max_iterations) shift)) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 94017a803..40cc7d703 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -42,7 +42,7 @@ [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad - [result (async.time_out ..delay (/.wait semaphore))] + [result (async.time_out ..delay (/.wait! semaphore))] (_.cover' [/.semaphore] (case result (#.Some _) @@ -54,9 +54,9 @@ [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} - [_ (monad.map ! /.wait (list.repeated initial_open_positions semaphore)) - result (async.time_out ..delay (/.wait semaphore))] - (_.cover' [/.wait] + [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore)) + result (async.time_out ..delay (/.wait! semaphore))] + (_.cover' [/.wait!] (case result (#.Some _) false @@ -67,12 +67,12 @@ [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} - [_ (monad.map ! /.wait (list.repeated initial_open_positions semaphore)) - .let [block (/.wait semaphore)] + [_ (monad.map ! /.wait! (list.repeated initial_open_positions semaphore)) + .let [block (/.wait! semaphore)] result/0 (async.time_out ..delay block) - open_positions (/.signal semaphore) + open_positions (/.signal! semaphore) result/1 (async.time_out ..delay block)] - (_.cover' [/.signal] + (_.cover' [/.signal!] (case [result/0 result/1 open_positions] [#.None (#.Some _) (#try.Success +0)] true @@ -83,7 +83,7 @@ [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do async.monad - [outcome (/.signal semaphore)] + [outcome (/.signal! semaphore)] (_.cover' [/.semaphore_is_maxed_out] (case outcome (#try.Failure error) @@ -103,7 +103,7 @@ expected_As (text.join_with "" (list.repeated repetitions "A")) expected_Bs (text.join_with "" (list.repeated repetitions "B")) mutex (/.mutex []) - processA (<| (/.synchronize mutex) + processA (<| (/.synchronize! mutex) io.io async.future (do {! io.monad} @@ -111,7 +111,7 @@ (list.repeated repetitions) (atom.update! (|>> (format "A")) resource))] (in []))) - processB (<| (/.synchronize mutex) + processB (<| (/.synchronize! mutex) io.io async.future (do {! io.monad} @@ -123,7 +123,7 @@ [_ processA _ processB .let [outcome (io.run! (atom.read! resource))]] - (_.cover' [/.mutex /.synchronize] + (_.cover' [/.mutex /.synchronize!] (or (text\= (format expected_As expected_Bs) outcome) (text\= (format expected_Bs expected_As) @@ -133,7 +133,7 @@ (def: (waiter resource barrier id) (-> (Atom Text) /.Barrier Nat (Async Any)) (do async.monad - [_ (/.block barrier) + [_ (/.block! barrier) _ (async.future (atom.update! (|>> (format (%.nat id))) resource))] (in []))) @@ -171,7 +171,7 @@ (waiter resource barrier id)))) (monad.seq !)) .let [outcome (io.run! (atom.read! resource))]] - (_.cover' [/.barrier /.block] + (_.cover' [/.barrier /.block!] (and (text.ends_with? expected_ending outcome) (list.every? (function (_ id) (text.contains? (%.nat id) outcome)) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 3b0b5cf72..5ac592494 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -86,7 +86,7 @@ _ (/.commit (/.update (n.* 2) box)) _ (async.future (\ sink close)) _ (/.commit (/.update (n.* 3) box)) - changes (frp.consume follower)] + changes (frp.list follower)] (_.cover' [/.follow] (\ (list.equivalence n.equivalence) = (list expected (n.* 2 expected)) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 224943369..d6fa54ee1 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -76,7 +76,9 @@ _ #0)) -(syntax: (match pattern then input) +(syntax: (match [pattern <code>.any + then <code>.any + input <code>.any]) (in (list (` (case (~ input) (^ (#try.Success [(~' _) (~ pattern)])) (~ then) diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index ffe943eb6..fb1f485c0 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -57,7 +57,7 @@ (_.cover [/.somewhere] (|> (/.result (|> (/.somewhere (/.this expected)) (<>.before (<>.some /.any))) - (list.concat (list pre_ignore (list expected) post_ignore))) + (list.joined (list pre_ignore (list expected) post_ignore))) (!expect (#try.Success _)))) (_.cover [/.end] (and (|> (/.result /.end (list)) diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux index b7a889bbe..ba846b8b2 100644 --- a/stdlib/source/test/lux/control/parser/environment.lux +++ b/stdlib/source/test/lux/control/parser/environment.lux @@ -37,7 +37,7 @@ expected (random.ascii/alpha 1)] (_.cover [/.Property /.property] (|> /.empty - (dictionary.put property expected) + (dictionary.has property expected) (/.result (/.property property)) (\ try.functor map (text\= expected)) (try.else false)))) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index d4cb4c50c..92efb1121 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -102,14 +102,14 @@ (//\in [])) (list (#xml.Node expected_tag (|> (dictionary.empty name.hash) - (dictionary.put expected_attribute expected_value)) + (dictionary.has expected_attribute expected_value)) (list)))) (!expect (#try.Success []))))) (!failure /.unknown_attribute [[(/.attribute ["" expected]) (#xml.Node [expected expected] (|> (dictionary.empty name.hash) - (dictionary.put [expected ""] expected)) + (dictionary.has [expected ""] expected)) (list))]]) (!failure /.empty_input [[(do //.monad @@ -133,7 +133,7 @@ (/.attribute [expected expected]))) (#xml.Node [expected expected] (|> (dictionary.empty name.hash) - (dictionary.put [expected expected] expected)) + (dictionary.has [expected expected] expected)) (list))]]) (!failure /.unexpected_input [[/.text @@ -164,7 +164,7 @@ (_.cover [/.somewhere] (|> (/.result parser (list (node parent - (list.concat (list (list.repeated repetitions (node wrong (list))) + (list.joined (list (list.repeated repetitions (node wrong (list))) (list (node right (list))) (list.repeated repetitions (node wrong (list)))))))) (!expect (#try.Success [])))) diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index c89d0e3eb..9b17a19fa 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -42,12 +42,12 @@ (_.for [/.monad] ($monad.spec ..injection ..comparison /.monad)) - (_.cover [/.result /.ask] + (_.cover [/.result /.read] (n.= sample - (/.result sample /.ask))) + (/.result sample /.read))) (_.cover [/.local] (n.= (n.* factor sample) - (/.result sample (/.local (n.* factor) /.ask)))) + (/.result sample (/.local (n.* factor) /.read)))) (let [(^open "io\.") io.monad] (_.cover [/.with /.lift] (|> (: (/.Reader Any (IO Nat)) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 33f91e26f..ea3750151 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -10,7 +10,7 @@ ["." try (#+ Try)] ["." exception] [parser - ["<c>" code]]] + ["<.>" code]]] [data ["." product] ["." text @@ -62,7 +62,8 @@ (#.Some focus) (text.contains? (%.code focus) failure)))) -(syntax: (test_macro {macro <c>.identifier} {extra <c>.text}) +(syntax: (test_macro [macro <code>.identifier + extra <code>.text]) (let [now (io.run! instant.now) today (instant.date now) yesterday (instant.date (instant.after (duration.inverse duration.week) now)) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index ad8a63d28..8667b7054 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -154,10 +154,10 @@ (#.Some _) false _ true))) - (_.cover [/.put] + (_.cover [/.has] (and (n.= (inc (/.size dict)) - (/.size (/.put non_key test_val dict))) - (case (/.get non_key (/.put non_key test_val dict)) + (/.size (/.has non_key test_val dict))) + (case (/.get non_key (/.has non_key test_val dict)) (#.Some v) (n.= test_val v) _ true))) @@ -184,21 +184,21 @@ (and can_put_new_keys! cannot_put_old_keys!))) - (_.cover [/.remove] - (and (let [base (/.put non_key test_val dict)] + (_.cover [/.lacks] + (and (let [base (/.has non_key test_val dict)] (and (/.key? base non_key) - (not (/.key? (/.remove non_key base) non_key)))) + (not (/.key? (/.lacks non_key base) non_key)))) (case (list.head (/.keys dict)) #.None true (#.Some known_key) (n.= (dec (/.size dict)) - (/.size (/.remove known_key dict)))))) + (/.size (/.lacks known_key dict)))))) - (_.cover [/.update] - (let [base (/.put non_key test_val dict) - updt (/.update non_key inc base)] + (_.cover [/.revised] + (let [base (/.has non_key test_val dict) + updt (/.revised non_key inc base)] (case [(/.get non_key base) (/.get non_key updt)] [(#.Some x) (#.Some y)] (n.= (inc x) y) @@ -232,7 +232,7 @@ (_.cover [/.sub] (|> dict - (/.put non_key test_val) + (/.has non_key test_val) (/.sub (list non_key)) /.size (n.= 1))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index adce56dc3..b2bed04f9 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -36,7 +36,7 @@ key (random.only (|>> (/.key? partial) not) gen_key) value gen_value] - (in (/.put key value partial))))) + (in (/.has key value partial))))) (def: .public test Test @@ -107,14 +107,14 @@ (and (list.every? (/.key? sample) (/.keys sample)) (not (/.key? sample extra_key)))) - (_.cover [/.put] + (_.cover [/.has] (and (not (/.key? sample extra_key)) - (let [sample+ (/.put extra_key extra_value sample)] + (let [sample+ (/.has extra_key extra_value sample)] (and (/.key? sample+ extra_key) (n.= (inc (/.size sample)) (/.size sample+)))))) (_.cover [/.get] - (let [sample+ (/.put extra_key extra_value sample)] + (let [sample+ (/.has extra_key extra_value sample)] (case [(/.get extra_key sample) (/.get extra_key sample+)] [#.None (#.Some actual)] @@ -122,15 +122,15 @@ _ false))) - (_.cover [/.remove] + (_.cover [/.lacks] (|> sample - (/.put extra_key extra_value) - (/.remove extra_key) + (/.has extra_key extra_value) + (/.lacks extra_key) (/\= sample))) - (_.cover [/.update] + (_.cover [/.revised] (|> sample - (/.put extra_key extra_value) - (/.update extra_key (n.+ shift)) + (/.has extra_key extra_value) + (/.revised extra_key (n.+ shift)) (/.get extra_key) (maybe\map (n.= (n.+ shift extra_value))) (maybe.else false))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/plist.lux b/stdlib/source/test/lux/data/collection/dictionary/plist.lux index ad74dc0a0..b36d5d9d2 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/plist.lux @@ -65,28 +65,28 @@ (/.contains? key sample)) (/.keys sample)) (not (/.contains? extra_key sample)))) - (_.cover [/.put] - (let [sample+ (/.put extra_key extra_value sample)] + (_.cover [/.has] + (let [sample+ (/.has extra_key extra_value sample)] (and (not (/.contains? extra_key sample)) (/.contains? extra_key sample+) (n.= (inc (/.size sample)) (/.size sample+))))) (_.cover [/.get] (|> sample - (/.put extra_key extra_value) + (/.has extra_key extra_value) (/.get extra_key) (maybe\map (n.= extra_value)) (maybe.else false))) - (_.cover [/.update] + (_.cover [/.revised] (|> sample - (/.put extra_key extra_value) - (/.update extra_key (n.+ shift)) + (/.has extra_key extra_value) + (/.revised extra_key (n.+ shift)) (/.get extra_key) (maybe\map (n.= (n.+ shift extra_value))) (maybe.else false))) - (_.cover [/.remove] + (_.cover [/.lacks] (|> sample - (/.put extra_key extra_value) - (/.remove extra_key) + (/.has extra_key extra_value) + (/.lacks extra_key) (\ (/.equivalence n.equivalence) = sample))) )))) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 426b556b8..e9be412e2 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -222,7 +222,7 @@ (let [subs (/.sub sub_size sample)] (and (/.every? (|>> /.size (n.<= sub_size)) subs) (/\= sample - (/.concat subs))))) + (/.joined subs))))) )))) (def: member @@ -341,11 +341,11 @@ ((/.zipped_with 2) +/2 sample/0 sample/1)) (/\= (/.zipped_with/3 +/3 sample/0 sample/1 sample/2) ((/.zipped_with 3) +/3 sample/0 sample/1 sample/2)))) - (_.cover [/.concat] + (_.cover [/.joined] (and (/\= (/\compose sample/0 sample/1) - (/.concat (list sample/0 sample/1))) + (/.joined (list sample/0 sample/1))) (/\= ($_ /\compose sample/0 sample/1 sample/2) - (/.concat (list sample/0 sample/1 sample/2))))) + (/.joined (list sample/0 sample/1 sample/2))))) )))) (def: search diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index c57711e8e..a6e4679fb 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -104,11 +104,11 @@ [sample (/.put good_index non_member sample) actual (/.item good_index sample)] (in (is? non_member actual))))) - (_.cover [/.update] + (_.cover [/.revised] (<| (try.else false) (do try.monad [sample (/.put good_index non_member sample) - sample (/.update good_index inc sample) + sample (/.revised good_index inc sample) actual (/.item good_index sample)] (in (n.= (inc non_member) actual))))) (_.cover [/.within_bounds?] @@ -125,7 +125,7 @@ (exception.match? /.index_out_of_bounds error))))] (and (fails! (/.item bad_index sample)) (fails! (/.put bad_index non_member sample)) - (fails! (/.update bad_index inc sample))))) + (fails! (/.revised bad_index inc sample))))) )) ))) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 7485d857c..61c301f94 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -103,7 +103,7 @@ offset))))) (_.cover [/.cycle] (let [cycle (list& cycle_start cycle_next)] - (list\= (list.concat (list.repeated size cycle)) + (list\= (list.joined (list.repeated size cycle)) (/.take (n.* size (list.size cycle)) (/.cycle [cycle_start cycle_next]))))) (_.cover [/.^sequence&] diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index 18e0a03f0..bd76d5bf3 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -72,28 +72,28 @@ (_.cover [/.member?] (and (list.every? (/.member? setL) (/.list setL)) (not (/.member? setL non_memberL)))) - (_.cover [/.add] + (_.cover [/.has] (let [before_addition! (not (/.member? setL non_memberL)) after_addition! - (/.member? (/.add non_memberL setL) non_memberL) + (/.member? (/.has non_memberL setL) non_memberL) size_increase! (n.= (inc (/.size setL)) - (/.size (/.add non_memberL setL)))] + (/.size (/.has non_memberL setL)))] (and before_addition! after_addition!))) - (_.cover [/.remove] + (_.cover [/.lacks] (let [symmetry! (|> setL - (/.add non_memberL) - (/.remove non_memberL) + (/.has non_memberL) + (/.lacks non_memberL) (\= setL)) idempotency! (|> setL - (/.remove non_memberL) + (/.lacks non_memberL) (\= setL))] (and symmetry! idempotency!))) diff --git a/stdlib/source/test/lux/data/collection/set/multi.lux b/stdlib/source/test/lux/data/collection/set/multi.lux index 888ea2623..09c7c2cd5 100644 --- a/stdlib/source/test/lux/data/collection/set/multi.lux +++ b/stdlib/source/test/lux/data/collection/set/multi.lux @@ -31,7 +31,7 @@ [elements (random.set hash size element) element_counts (random.list size ..count)] (in (list\fold (function (_ [count element] set) - (/.add count element set)) + (/.has count element set)) (/.empty hash) (list.zipped/2 element_counts (set.list elements)))))) @@ -46,7 +46,7 @@ (_.for [/.hash] (|> random.nat (\ random.monad map (function (_ single) - (/.add 1 single (/.empty n.hash)))) + (/.has 1 single (/.empty n.hash)))) ($hash.spec /.hash))) ))) @@ -155,32 +155,32 @@ (/.list sample))] (and non_members_have_0_multiplicity! every_member_has_positive_multiplicity!))) - (_.cover [/.add] + (_.cover [/.has] (let [null_scenario! (|> sample - (/.add 0 non_member) + (/.has 0 non_member) (\ /.equivalence = sample)) normal_scenario! - (let [sample+ (/.add addition_count non_member sample)] + (let [sample+ (/.has addition_count non_member sample)] (and (not (/.member? sample non_member)) (/.member? sample+ non_member) (n.= addition_count (/.multiplicity sample+ non_member))))] (and null_scenario! normal_scenario!))) - (_.cover [/.remove] + (_.cover [/.lacks] (let [null_scenario! (\ /.equivalence = (|> sample - (/.add addition_count non_member)) + (/.has addition_count non_member)) (|> sample - (/.add addition_count non_member) - (/.remove 0 non_member))) + (/.has addition_count non_member) + (/.lacks 0 non_member))) partial_scenario! (let [sample* (|> sample - (/.add addition_count non_member) - (/.remove partial_removal_count non_member))] + (/.has addition_count non_member) + (/.lacks partial_removal_count non_member))] (and (/.member? sample* non_member) (n.= (n.- partial_removal_count addition_count) @@ -188,8 +188,8 @@ total_scenario! (|> sample - (/.add addition_count non_member) - (/.remove addition_count non_member) + (/.has addition_count non_member) + (/.lacks addition_count non_member) (\ /.equivalence = sample))] (and null_scenario! partial_scenario! diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index d5ff02472..725c4b3c0 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -34,7 +34,7 @@ [partial (random (dec size) &order gen_value) value (random.only (|>> (/.member? partial) not) gen_value)] - (in (/.add value partial))))) + (in (/.has value partial))))) (def: .public test Test @@ -91,16 +91,16 @@ (not (/.member? setL non_memberL))] (and members_are_identified! non_members_are_not_identified!))) - (_.cover [/.add] - (let [setL+ (/.add non_memberL setL)] + (_.cover [/.has] + (let [setL+ (/.has non_memberL setL)] (and (not (/.member? setL non_memberL)) (/.member? setL+ non_memberL) (n.= (inc (/.size setL)) (/.size setL+))))) - (_.cover [/.remove] + (_.cover [/.lacks] (|> setL - (/.add non_memberL) - (/.remove non_memberL) + (/.has non_memberL) + (/.lacks non_memberL) (\ /.equivalence = setL))) (_.cover [/.sub?] (let [self! diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 6d0130db6..aaf1fcab8 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -201,7 +201,7 @@ /.yellow_green]] )] (def: all_colors - (list.concat (`` (list (~~ (template [<definition> <by_letter>] + (list.joined (`` (list (~~ (template [<definition> <by_letter>] [((: (-> Any (List //.Color)) (function (_ _) (`` (list (~~ (template.spliced <by_letter>)))))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 0444588e1..51bc3ac0e 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -46,17 +46,17 @@ (random.dictionary text.hash size (random.unicode size) recur) ))))) -(syntax: (boolean) +(syntax: (boolean []) (do meta.monad [value meta.seed] (in (list (code.bit (n.even? value)))))) -(syntax: (number) +(syntax: (number []) (do meta.monad [value meta.seed] (in (list (code.frac (n.frac value)))))) -(syntax: (string) +(syntax: (string []) (do meta.monad [value (macro.identifier "string")] (in (list (code.text (%.code value)))))) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 3c70075d1..f2bcccfc6 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -148,7 +148,7 @@ (do {! random.monad} [size (\ ! map (|>> (n.% 10) inc) random.nat) characters (random.set /.hash size (random.ascii/alpha 1)) - .let [sample (|> characters set.list /.concat)] + .let [sample (|> characters set.list /.joined)] expected (\ ! map (n.% size) random.nat)] (_.cover [/.char] (case (/.char expected sample) @@ -182,7 +182,7 @@ characters (random.set /.hash size (random.ascii/alpha 1)) separator (random.only (|>> (set.member? characters) not) (random.ascii/alpha 1)) - .let [with_no_separator (|> characters set.list /.concat)] + .let [with_no_separator (|> characters set.list /.joined)] static (random.ascii/alpha 1) .let [dynamic (random.only (|>> (\ /.equivalence = static) not) (random.ascii/alpha 1))] @@ -192,9 +192,9 @@ lower (random.ascii/lower 1) upper (random.ascii/upper 1)] ($_ _.and - (_.cover [/.concat] + (_.cover [/.joined] (n.= (set.size characters) - (/.size (/.concat (set.list characters))))) + (/.size (/.joined (set.list characters))))) (_.cover [/.join_with /.split_all_with] (and (|> (set.list characters) (/.join_with separator) @@ -202,7 +202,7 @@ (set.of_list /.hash) (\ set.equivalence = characters)) (\ /.equivalence = - (/.concat (set.list characters)) + (/.joined (set.list characters)) (/.join_with "" (set.list characters))))) (_.cover [/.replaced/1] (\ /.equivalence = @@ -285,7 +285,7 @@ sampleL (random.unicode sizeL) sampleR (random.unicode sizeR) middle (random.unicode 1) - .let [sample (/.concat (list sampleL sampleR)) + .let [sample (/.joined (list sampleL sampleR)) (^open "/\.") /.equivalence]] ($_ _.and (_.cover [/.split] @@ -293,7 +293,7 @@ (case> (#.Right [_l _r]) (and (/\= sampleL _l) (/\= sampleR _r) - (/\= sample (/.concat (list _l _r)))) + (/\= sample (/.joined (list _l _r)))) _ #0))) @@ -323,8 +323,8 @@ .let [part_gen (|> (random.text normal_char_gen sizeP) (random.only (|>> (/.contains? sep1) not)))] parts (random.list sizeL part_gen) - .let [sample1 (/.concat (list.interposed sep1 parts)) - sample2 (/.concat (list.interposed sep2 parts)) + .let [sample1 (/.joined (list.interposed sep1 parts)) + sample2 (/.joined (list.interposed sep2 parts)) (^open "/\.") /.equivalence]] (_.cover [/.replaced] (/\= sample2 diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index 126cb6556..34d6ee08d 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -190,11 +190,11 @@ <encodings>)] (def: all_encodings - (list.concat (list <named>))) + (list.joined (list <named>))) (def: unique_encodings (list\fold (function (_ encoding set) - (set.add (/.name encoding) set)) + (set.has (/.name encoding) set)) (set.empty text.hash) ..all_encodings)) diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 8e8c4b1df..dcb562a3e 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -69,14 +69,14 @@ (debug.private /.\\_sigil) (debug.private /.\u_sigil)))) -(syntax: (static_sample) +(syntax: (static_sample []) (do meta.monad [seed meta.seed .let [[_ expected] (random.result (random.pcg_32 [seed seed]) (random.ascii 10))]] (in (list (code.text expected))))) -(syntax: (static_escaped {un_escaped <code>.text}) +(syntax: (static_escaped [un_escaped <code>.text]) (in (list (code.text (/.escaped un_escaped))))) (def: .public test diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index c0b1f9183..1e77a7904 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -8,7 +8,8 @@ pipe ["." try] [parser - ["<.>" text (#+ Parser)]]] + ["<.>" text (#+ Parser)] + ["<.>" code]]] [data ["." text ("#\." equivalence) ["%" format (#+ format)]]] @@ -51,7 +52,9 @@ _ false))) -(syntax: (should_check pattern regex input) +(syntax: (should_check [pattern <code>.any + regex <code>.any + input <code>.any]) (macro.with_identifiers [g!message g!_] (in (list (` (|> (~ input) (<text>.result (~ regex)) @@ -269,7 +272,7 @@ "123-456-7890"))) )) -(syntax: (expands? form) +(syntax: (expands? [form <code>.any]) (function (_ lux) (#try.Success [lux (list (code.bit (case (macro.single_expansion form lux) (#try.Success _) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 6cdc5f091..db419c3dc 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -157,7 +157,7 @@ [(def: <definition> Test (`` (_.cover [(~~ (template.spliced <part>))] - (let [all (list.concat (list <named>)) + (let [all (list.joined (list <named>)) unique (set.of_list /.hash all)] (n.= (list.size all) (set.size unique))))))] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 7d7f7cf64..4415a3798 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -7,7 +7,9 @@ [monad (#+ do)]] [control ["." try ("#\." functor)] - ["." exception]] + ["." exception] + [parser + ["<.>" code]]] [data ["." text ("#\." equivalence) ["%" format (#+ format)]] @@ -214,7 +216,7 @@ (/.inspection [sample_bit sample_int sample_frac sample_text])) ))))) -(syntax: (macro_error macro) +(syntax: (macro_error [macro <code>.any]) (function (_ compiler) (case ((macro.expansion macro) compiler) (#try.Failure error) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index e49e08476..2a6e714af 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -9,7 +9,9 @@ [control [pipe (#+ case>)] ["." try] - ["." exception]] + ["." exception] + [parser + ["<.>" code]]] [data ["." bit ("#\." equivalence)] ["." text ("#\." equivalence) @@ -56,7 +58,7 @@ [character\= /.Character /.char_to_long Int i\=] ) -(syntax: (macro_error expression) +(syntax: (macro_error [expression <code>.any]) (function (_ lux) (|> (macro.single_expansion expression) (meta.result lux) @@ -573,7 +575,7 @@ example/9!) ))) -(syntax: (expands? expression) +(syntax: (expands? [expression <code>.any]) (function (_ lux) (|> (macro.single_expansion expression) (meta.result lux) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index dacff0557..9c272f1bc 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -279,7 +279,7 @@ (Random /.Language) (let [options (|> ..languages (list\map (|>> (get@ #languages) set.list)) - list.concat)] + list.joined)] (do {! random.monad} [choice (\ ! map (n.% (list.size options)) random.nat)] diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 1dec09208..2388bdecf 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -205,7 +205,7 @@ (Random /.Territory) (let [options (|> ..territories (list\map (|>> (get@ #territories) set.list)) - list.concat)] + list.joined)] (do {! random.monad} [choice (\ ! map (n.% (list.size options)) random.nat)] diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 73a725528..3ac184b75 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -42,16 +42,17 @@ [(: [Text .Global] [(template.text [<definition>]) (#.Definition [true .Macro (' []) <definition>])])]) -(syntax: (pow/2 number) +(syntax: (pow/2 [number <code>.any]) (in (list (` (nat.* (~ number) (~ number)))))) -(syntax: (pow/4 number) +(syntax: (pow/4 [number <code>.any]) (in (list (` (..pow/2 (..pow/2 (~ number))))))) -(syntax: (repeated {times <code>.nat} token) +(syntax: (repeated [times <code>.nat + token <code>.any]) (in (list.repeated times token))) -(syntax: (fresh_identifier) +(syntax: (fresh_identifier []) (do meta.monad [g!fresh (/.identifier "fresh")] (in (list g!fresh)))) diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index 38f25c013..1ab20df9a 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -27,7 +27,7 @@ [\\library ["." /]]) -(syntax: (macro_error macro) +(syntax: (macro_error [macro <code>.any]) (function (_ compiler) (case ((macro.expansion macro) compiler) (#try.Failure error) @@ -42,19 +42,19 @@ (function (_ inputs lux) (#try.Success [lux (list output)])))) -(syntax: (with {name (<code>.tuple (<>.and <code>.text <code>.text))} - constant - {pre_remove <code>.bit} - body) +(syntax: (with [name (<code>.tuple (<>.and <code>.text <code>.text)) + constant <code>.any + pre_remove <code>.bit + body <code>.any]) (macro.with_identifiers [g!output] (do meta.monad [pop! (/.push (list [name (..constant constant)])) [module short] (meta.normal name) _ (if pre_remove (let [remove_macro! (: (-> .Module .Module) - (update@ #.definitions (plist.remove short)))] + (update@ #.definitions (plist.lacks short)))] (function (_ lux) - (#try.Success [(update@ #.modules (plist.update module remove_macro!) lux) + (#try.Success [(update@ #.modules (plist.revised module remove_macro!) lux) []]))) (in []))] (let [pre_expansion (` (let [(~ g!output) (~ body)] diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux index 62988d8de..0e9546c04 100644 --- a/stdlib/source/test/lux/macro/syntax.lux +++ b/stdlib/source/test/lux/macro/syntax.lux @@ -4,6 +4,9 @@ ["_" test (#+ Test)] [abstract [monad (#+ do)]] + [control + [parser + ["<.>" code]]] [math ["." random] [number @@ -20,7 +23,9 @@ ["#." type #_ ["#/." variable]]]) -(/.syntax: (+/3 a b c) +(/.syntax: (+/3 [a <code>.any + b <code>.any + c <code>.any]) (in (list (` ($_ n.+ (~ a) (~ b) (~ c)))))) (def: .public test diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux index 78df63f0d..86c2fbe0b 100644 --- a/stdlib/source/test/lux/macro/template.lux +++ b/stdlib/source/test/lux/macro/template.lux @@ -6,7 +6,9 @@ [monad (#+ do)]] [control ["." try] - ["." exception]] + ["." exception] + [parser + ["<.>" code]]] [data [collection ["." list]]] @@ -26,7 +28,7 @@ (-> Nat Nat) (|>> !pow/2))) -(syntax: (macro_error macro) +(syntax: (macro_error [macro <code>.any]) (function (_ compiler) (case ((macro.expansion macro) compiler) (#try.Failure error) diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 365fef83d..f1e731975 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -18,7 +18,7 @@ [\\library ["." /]]) -(syntax: (|divisor|) +(syntax: (|divisor| []) (do meta.monad [divisor meta.seed] (in (list (code.int (case divisor diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index 0321a5441..c3df88e81 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -21,9 +21,9 @@ [\\library ["." /]]) -(syntax: (actual_program {actual_program (<| <code>.form +(syntax: (actual_program [actual_program (<| <code>.form (<>.after (<code>.text! "lux def program")) - <code>.any)}) + <code>.any)]) (in (list actual_program))) (def: .public test 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 beaf1169e..738e080c4 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 @@ -188,7 +188,7 @@ [redundant_patterns (exhaustive_branches false variantTC inputC) redundancy_idx (|> r.nat (\ ! map (n.% (list.size redundant_patterns)))) .let [redundant_branchesC (<| (list!map (branch outputC)) - list.concat + list.joined (list (list.take redundancy_idx redundant_patterns) (list (maybe.assume (list.item redundancy_idx redundant_patterns))) (list.drop redundancy_idx redundant_patterns)))]] @@ -199,7 +199,7 @@ [[heterogeneousT heterogeneousC] (r.only (|>> product.left (check.subsumes? 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) + .let [heterogeneous_branchesC (list.joined (list (list.take heterogeneous_idx exhaustive_branchesC) (list (let [[_pattern _body] (maybe.assume (list.item heterogeneous_idx exhaustive_branchesC))] [_pattern heterogeneousC])) (list.drop (inc 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 3e97c0dbd..3213443a6 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 @@ -92,7 +92,7 @@ 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) + (type.function (list.joined (list (list.take var_idx inputsT) (list varT) (list.drop (inc var_idx) inputsT)))) varT) 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 fcb23d771..9aa837e50 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 @@ -126,7 +126,7 @@ .let [variantT (type.variant (list\map product.left primitives)) [valueT valueC] (maybe.assume (list.item choice primitives)) +size (inc size) - +primitives (list.concat (list (list.take choice primitives) + +primitives (list.joined (list (list.take choice primitives) (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) [+valueT +valueC] (maybe.assume (list.item +choice +primitives)) @@ -176,7 +176,7 @@ [_ +valueC] _primitive.primitive .let [tupleT (type.tuple (list\map product.left primitives)) [singletonT singletonC] (|> primitives (list.item choice) maybe.assume) - +primitives (list.concat (list (list.take choice primitives) + +primitives (list.joined (list (list.take choice primitives) (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) +tupleT (type.tuple (list\map product.left +primitives))]] @@ -243,7 +243,7 @@ [choiceT choiceC] (maybe.assume (list.item choice primitives)) [other_choiceT other_choiceC] (maybe.assume (list.item other_choice primitives)) monoT (type.variant primitivesT) - polyT (|> (type.variant (list.concat (list (list.take choice primitivesT) + polyT (|> (type.variant (list.joined (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) (type.univ_q 1)) @@ -288,7 +288,7 @@ primitivesC (list\map product.right primitives) monoT (#.Named [module_name type_name] (type.tuple primitivesT)) recordC (list.zipped/2 tagsC primitivesC) - polyT (|> (type.tuple (list.concat (list (list.take choice primitivesT) + polyT (|> (type.tuple (list.joined (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) (type.univ_q 1) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index cb0d81cfd..2678f8f77 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -113,7 +113,7 @@ .let [real_register (dictionary.size (get@ #necessary context)) fake_register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] - [expected_output actual_output] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))] + [expected_output actual_output] (scenario (update@ #necessary (dictionary.has real_register fake_register) context))] (in [(synthesis.branch/let [expected_input real_register expected_output]) (synthesis.branch/let [actual_input fake_register actual_output])]))) @@ -169,7 +169,7 @@ .let [real_register (dictionary.size (get@ #necessary context)) fake_register (n.+ (get@ #redundants context) (dictionary.size (get@ #necessary context)))] - [expected_then actual_then] (scenario (update@ #necessary (dictionary.put real_register fake_register) context))] + [expected_then actual_then] (scenario (update@ #necessary (dictionary.has real_register fake_register) context))] (in [(#synthesis.Seq (#synthesis.Bind real_register) (#synthesis.Seq #synthesis.Pop (#synthesis.Then expected_then))) @@ -245,7 +245,7 @@ [expected_iteration actual_iteration] (scenario (update@ #necessary (function (_ necessary) (list\fold (function (_ [idx _] context) - (dictionary.put (n.+ real_start idx) + (dictionary.has (n.+ real_start idx) (n.+ fake_start idx) context)) necessary diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux index 1b70b0fd2..6275647d0 100644 --- a/stdlib/source/test/lux/type/abstract.lux +++ b/stdlib/source/test/lux/type/abstract.lux @@ -7,7 +7,9 @@ [monad (#+ do)]] [control ["." try] - ["." exception]] + ["." exception] + [parser + ["<.>" code]]] [data ["." text ("#\." equivalence)]] ["." macro @@ -23,7 +25,7 @@ (template.with_locals [g!Foo g!Bar] (as_is (template [<syntax> <meta>] - [(syntax: (<syntax>) + [(syntax: (<syntax> []) (do meta.monad [frame <meta>] (in (list (code.text (get@ #/.name frame))))))] @@ -32,7 +34,7 @@ [specific (/.specific (template.text [g!Foo]))] ) - (syntax: (with_no_active_frames macro) + (syntax: (with_no_active_frames [macro <code>.any]) (function (_ compiler) (let [verdict (case ((macro.expansion macro) compiler) (#try.Failure error) diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index ef086d142..39b336ba2 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -2,6 +2,7 @@ [library [lux (#- type) ["_" test (#+ Test)] + ["." type ("#\." equivalence)] [abstract ["." monad (#+ do)] [\\specification @@ -24,8 +25,7 @@ [math ["." random (#+ Random) ("#\." monad)] [number - ["n" nat]]] - ["." type ("#\." equivalence)]]] + ["n" nat]]]]] [\\library ["." /]]) @@ -699,6 +699,146 @@ (try.else false)) )))) +(def: (primitive_type parameters) + (-> Nat (Random Type)) + (do random.monad + [primitive (random.ascii/upper 3) + parameters (random.list parameters (primitive_type (dec parameters)))] + (in (#.Primitive primitive parameters)))) + +(def: clean_type + (Random Type) + (primitive_type 2)) + +(def: for_subsumption|ultimate + (Random Bit) + (do random.monad + [example ..clean_type] + (in (and (/.subsumes? .Any example) + (not (/.subsumes? example .Any)) + + (/.subsumes? example .Nothing) + (not (/.subsumes? .Nothing example)) + )))) + +(def: for_subsumption|nominal + (Random Bit) + (do random.monad + [primitive (random.ascii/upper 10) + example ..clean_type] + (in (and (/.subsumes? (#.Primitive primitive (list)) + (#.Primitive primitive (list))) + (/.subsumes? (#.Primitive primitive (list .Any)) + (#.Primitive primitive (list example))) + (not (/.subsumes? (#.Primitive primitive (list example)) + (#.Primitive primitive (list .Any)))) + (/.subsumes? (#.Primitive primitive (list example)) + (#.Primitive primitive (list .Nothing))) + (not (/.subsumes? (#.Primitive primitive (list .Nothing)) + (#.Primitive primitive (list example)))) + )))) + +(def: for_subsumption|sum + (Random Bit) + (do random.monad + [left ..clean_type + right ..clean_type] + (in (and (/.subsumes? (#.Sum .Any .Any) + (#.Sum left right)) + (not (/.subsumes? (#.Sum left right) + (#.Sum .Any .Any))) + (/.subsumes? (#.Sum left right) + (#.Sum .Nothing .Nothing)) + (not (/.subsumes? (#.Sum .Nothing .Nothing) + (#.Sum left right))) + )))) + +(def: for_subsumption|product + (Random Bit) + (do random.monad + [left ..clean_type + right ..clean_type] + (in (and (/.subsumes? (#.Product .Any .Any) + (#.Product left right)) + (not (/.subsumes? (#.Product left right) + (#.Product .Any .Any))) + (/.subsumes? (#.Product left right) + (#.Product .Nothing .Nothing)) + (not (/.subsumes? (#.Product .Nothing .Nothing) + (#.Product left right))) + )))) + +(def: for_subsumption|function + (Random Bit) + (do random.monad + [left ..clean_type + right ..clean_type] + (in (and (/.subsumes? (#.Function .Nothing .Any) + (#.Function left right)) + (not (/.subsumes? (#.Function left right) + (#.Function .Nothing .Any))) + (not (/.subsumes? (#.Function .Any .Nothing) + (#.Function left right))) + )))) + +(template [<tag> <name>] + [(def: <name> + (Random Bit) + (do random.monad + [id random.nat + example ..clean_type] + (in (not (or (/.subsumes? (<tag> id) example) + (/.subsumes? example (<tag> id)))))))] + + [#.Var for_subsumption|variable] + [#.Ex for_subsumption|existential] + ) + +(def: for_subsumption|quantification+application + (Random Bit) + (do random.monad + [example ..clean_type] + (in (and (and (/.subsumes? (.type (List example)) (.type (All [a] (List a)))) + (not (/.subsumes? (.type (All [a] (List a))) (.type (List example))))) + (and (/.subsumes? (.type (Ex [a] (List a))) (.type (List example))) + (not (/.subsumes? (.type (List example)) (.type (Ex [a] (List a)))))))))) + +(def: for_subsumption|named + (Random Bit) + (do random.monad + [module (random.ascii/upper 10) + short (random.ascii/upper 10) + example ..clean_type] + (in (and (/.subsumes? (#.Named [module short] example) + example) + (/.subsumes? example + (#.Named [module short] example)) + )))) + +(def: for_subsumption + Test + (do random.monad + [for_subsumption|ultimate ..for_subsumption|ultimate + for_subsumption|nominal ..for_subsumption|nominal + for_subsumption|sum ..for_subsumption|sum + for_subsumption|product ..for_subsumption|product + for_subsumption|function ..for_subsumption|function + for_subsumption|variable ..for_subsumption|variable + for_subsumption|existential ..for_subsumption|existential + for_subsumption|quantification+application ..for_subsumption|quantification+application + for_subsumption|named ..for_subsumption|named] + (_.cover [/.subsumes?] + (and for_subsumption|ultimate + for_subsumption|nominal + for_subsumption|sum + for_subsumption|product + for_subsumption|function + for_subsumption|variable + for_subsumption|existential + for_subsumption|quantification+application + for_subsumption|named + )))) + (def: .public test Test (<| (_.covering /._) @@ -717,4 +857,5 @@ ..context ..check ..clean + ..for_subsumption ))) diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index df66d6f74..88ed4b815 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -155,7 +155,8 @@ )) ))))) -(syntax: (with_error {exception <code>.identifier} to_expand) +(syntax: (with_error [exception <code>.identifier + to_expand <code>.any]) (monad.do meta.monad [[_ _ _ exception] (meta.export exception)] (function (_ compiler) diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index fa9a53c5f..a3edb2b19 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -77,7 +77,7 @@ (i.= expected))) ))))) -(syntax: (natural) +(syntax: (natural []) (\ meta.monad map (|>> code.nat list) meta.seed)) diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 28c2849be..0060dc9a4 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -112,7 +112,7 @@ /.f24]])] (def: listing (List /.Key) - (list.concat (`` (list (~~ (template [<definition> <keys>] + (list.joined (`` (list (~~ (template [<definition> <keys>] [((: (-> Any (List /.Key)) (function (_ _) (`` (list (~~ (template.spliced <keys>)))))) diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index 574ce8513..84cbd6355 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -84,7 +84,7 @@ /.network_authentication_required]])] (def: all (List //.Status) - (list.concat (`` (list (~~ (template [<category> <status+>] + (list.joined (`` (list (~~ (template [<category> <status+>] [((: (-> Any (List //.Status)) (function (_ _) (`` (list (~~ (template.spliced <status+>)))))) |