diff options
Diffstat (limited to '')
8 files changed, 77 insertions, 77 deletions
diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux index de9a05fde..8a2965d51 100644 --- a/stdlib/source/specification/aedifex/repository.lux +++ b/stdlib/source/specification/aedifex/repository.lux @@ -7,7 +7,7 @@ [control ["." try (#+ Try)] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." binary ["_#" \\test]]] @@ -24,11 +24,11 @@ ["#." artifact]]]) (def: #export (spec valid_artifact invalid_artifact subject) - (-> Artifact Artifact (/.Repository Promise) Test) + (-> Artifact Artifact (/.Repository Async) Test) (do random.monad [expected (_binary.random 100)] (wrap ($_ _.and' - (do promise.monad + (do async.monad [#let [good_uri (/remote.uri (get@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)] good_upload! (\ subject upload good_uri expected) good_download! (\ subject download good_uri) diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux index 08a294282..8ccf1e02f 100644 --- a/stdlib/source/specification/compositor.lux +++ b/stdlib/source/specification/compositor.lux @@ -64,4 +64,4 @@ expander) (#try.Failure error) - (_.fail error)))) + (_.failure error)))) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index e14aa8e52..bea185b99 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -28,7 +28,7 @@ [// [common (#+ Runner)]]]) -(def: sanitize +(def: safe (-> Text Text) (text.replace-all " " "_")) @@ -41,7 +41,7 @@ [(_.test <extension> (|> (#synthesis.Extension <extension> (list (synthesis.i64 param) (synthesis.i64 subject))) - (run (..sanitize <extension>)) + (run (..safe <extension>)) (case> (#try.Success valueT) (n.= (<reference> param subject) (:as Nat valueT)) @@ -61,7 +61,7 @@ (|> (#synthesis.Extension "lux i64 arithmetic-right-shift" (list (synthesis.i64 subject) (synthesis.i64 param))) - (run (..sanitize "lux i64 arithmetic-right-shift")) + (run (..safe "lux i64 arithmetic-right-shift")) (case> (#try.Success valueT) ("lux i64 =" (i64.arithmetic-right-shift param subject) @@ -81,7 +81,7 @@ (~~ (template [<extension> <type> <prepare> <comp> <subject-expr>] [(_.test <extension> (|> (#synthesis.Extension <extension> (list (synthesis.i64 subject))) - (run (..sanitize <extension>)) + (run (..safe <extension>)) (case> (#try.Success valueT) (<comp> (<prepare> subject) (:as <type> valueT)) @@ -99,7 +99,7 @@ [(_.test <extension> (|> (#synthesis.Extension <extension> (list (synthesis.i64 param) (synthesis.i64 subject))) - (run (..sanitize <extension>)) + (run (..safe <extension>)) (case> (#try.Success valueT) (<comp> (<reference> param subject) (:as <outputT> valueT)) @@ -130,7 +130,7 @@ [(_.test <extension> (|> (#synthesis.Extension <extension> (list (synthesis.f64 param) (synthesis.f64 subject))) - (run (..sanitize <extension>)) + (run (..safe <extension>)) (//case.verify (<reference> param subject))))] ["lux f64 +" f.+ f.=] @@ -143,7 +143,7 @@ [(_.test <extension> (|> (#synthesis.Extension <extension> (list (synthesis.f64 param) (synthesis.f64 subject))) - (run (..sanitize <extension>)) + (run (..safe <extension>)) (case> (#try.Success valueV) (bit\= (<text> param subject) (:as Bit valueV)) @@ -157,7 +157,7 @@ (~~ (template [<extension> <reference>] [(_.test <extension> (|> (#synthesis.Extension <extension> (list)) - (run (..sanitize <extension>)) + (run (..safe <extension>)) (//case.verify <reference>)))] ["lux f64 min" ("lux f64 min")] @@ -165,7 +165,7 @@ ["lux f64 smallest" ("lux f64 smallest")] )) (_.test "'lux f64 i64 && 'lux i64 f64'" - (|> (run (..sanitize "lux f64 i64") + (|> (run (..safe "lux f64 i64") (|> subject synthesis.f64 (list) (#synthesis.Extension "lux f64 i64") (list) (#synthesis.Extension "lux i64 f64"))) @@ -192,14 +192,14 @@ ($_ _.and (_.test "Can compare texts for equality." (and (|> (#synthesis.Extension "lux text =" (list sample-lowerS sample-lowerS)) - (run (..sanitize "lux text =")) + (run (..safe "lux text =")) (case> (#try.Success valueV) (:as Bit valueV) _ false)) (|> (#synthesis.Extension "lux text =" (list sample-upperS sample-lowerS)) - (run (..sanitize "lux text =")) + (run (..safe "lux text =")) (case> (#try.Success valueV) (not (:as Bit valueV)) @@ -207,7 +207,7 @@ false)))) (_.test "Can compare texts for order." (|> (#synthesis.Extension "lux text <" (list sample-lowerS sample-upperS)) - (run (..sanitize "lux text <")) + (run (..safe "lux text <")) (case> (#try.Success valueV) (:as Bit valueV) @@ -215,7 +215,7 @@ false))) (_.test "Can get length of text." (|> (#synthesis.Extension "lux text size" (list sample-lowerS)) - (run (..sanitize "lux text size")) + (run (..safe "lux text size")) (case> (#try.Success valueV) (n.= sample-size (:as Nat valueV)) @@ -223,7 +223,7 @@ false))) (_.test "Can concatenate text." (|> (#synthesis.Extension "lux text size" (list concatenatedS)) - (run (..sanitize "lux text size")) + (run (..safe "lux text size")) (case> (#try.Success valueV) (n.= (n.* 2 sample-size) (:as Nat valueV)) @@ -233,7 +233,7 @@ (and (|> (#synthesis.Extension "lux text index" (list concatenatedS sample-lowerS (synthesis.i64 +0))) - (run (..sanitize "lux text index")) + (run (..safe "lux text index")) (case> (^multi (#try.Success valueV) {(:as (Maybe Nat) valueV) (#.Some valueV)}) (n.= 0 valueV) @@ -243,7 +243,7 @@ (|> (#synthesis.Extension "lux text index" (list concatenatedS sample-upperS (synthesis.i64 +0))) - (run (..sanitize "lux text index")) + (run (..safe "lux text index")) (case> (^multi (#try.Success valueV) {(:as (Maybe Nat) valueV) (#.Some valueV)}) (n.= sample-size valueV) @@ -256,7 +256,7 @@ (list concatenatedS (synthesis.i64 offset) (synthesis.i64 length))) - (run (..sanitize "lux text clip")) + (run (..safe "lux text clip")) (case> (^multi (#try.Success valueV) {(:as (Maybe Text) valueV) (#.Some valueV)}) (text\= expected valueV) @@ -270,7 +270,7 @@ (|> (#synthesis.Extension "lux text char" (list sample-lowerS (synthesis.i64 char-idx))) - (run (..sanitize "lux text char")) + (run (..safe "lux text char")) (case> (^multi (#try.Success valueV) {(:as (Maybe Int) valueV) (#.Some valueV)}) (text.contains? ("lux i64 char" valueV) @@ -288,7 +288,7 @@ (_.test "Can log messages." (|> (#synthesis.Extension "lux io log" (list (synthesis.text (format "LOG: " message)))) - (run (..sanitize "lux io log")) + (run (..safe "lux io log")) (case> (#try.Success valueV) true @@ -301,7 +301,7 @@ #synthesis.arity 1 #synthesis.body (#synthesis.Extension "lux io error" (list (synthesis.text message)))}))) - (run (..sanitize "lux try")) + (run (..safe "lux try")) (case> (^multi (#try.Success valueV) {(:as (Try Text) valueV) (#try.Failure error)}) (text.contains? message error) @@ -313,7 +313,7 @@ {#synthesis.environment (list) #synthesis.arity 1 #synthesis.body (synthesis.text message)}))) - (run (..sanitize "lux try")) + (run (..safe "lux try")) (case> (^multi (#try.Success valueV) {(:as (Try Text) valueV) (#try.Success valueV)}) (text\= message valueV) @@ -323,7 +323,7 @@ (_.test "Can obtain current time in milli-seconds." (|> (synthesis.tuple (list (#synthesis.Extension "lux io current-time" (list)) (#synthesis.Extension "lux io current-time" (list)))) - (run (..sanitize "lux io current-time")) + (run (..safe "lux io current-time")) (case> (#try.Success valueV) (let [[pre post] (:as [Nat Nat] valueV)] (n.>= pre post)) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index c8482aff2..355b98409 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -76,7 +76,7 @@ (and (n.= size (array.size tuple-out)) (list.every? (function (_ [left right]) (i.= left (:as Int right))) - (list.zip/2 tuple-in (array.to_list tuple-out))))) + (list.zipped/2 tuple-in (array.to_list tuple-out))))) (#try.Failure _) false))))) diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux index f454b61c9..cd2f88485 100644 --- a/stdlib/source/specification/lux/world/console.lux +++ b/stdlib/source/specification/lux/world/console.lux @@ -8,7 +8,7 @@ [io (#+ IO)] ["." try] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." text ["%" format (#+ format)]]] @@ -18,11 +18,11 @@ ["." /]]) (def: #export (spec console) - (-> (IO (/.Console Promise)) Test) + (-> (IO (/.Console Async)) Test) (do random.monad [message (random.ascii/alpha 10)] - (wrap (do promise.monad - [console (promise.future console) + (wrap (do async.monad + [console (async.future console) ?write (\ console write (format message text.new_line)) ?read (\ console read []) ?read_line (\ console read_line []) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index c70e23441..fd1585c34 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -11,7 +11,7 @@ ["." try ("#\." functor)] ["." exception] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." maybe ("#\." functor)] ["." text ("#\." equivalence) @@ -32,14 +32,14 @@ ["." /]]) (def: (for_path fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) (<| (_.for [/.Path]) (do {! random.monad} [parent (random.ascii/numeric 2) child (random.ascii/numeric 2)]) wrap - (do promise.monad - [fs (promise.future fs)] + (do async.monad + [fs (async.future fs)] ($_ _.and' (_.cover' [/.un_nest] (and (|> (/.un_nest fs parent) @@ -75,8 +75,8 @@ )))) (def: (directory?&make_directory fs parent) - (-> (/.System Promise) /.Path (Promise Bit)) - (do promise.monad + (-> (/.System Async) /.Path (Async Bit)) + (do async.monad [directory_pre! (\ fs directory? parent) made? (\ fs make_directory parent) directory_post! (\ fs directory? parent)] @@ -87,8 +87,8 @@ directory_post!)))) (def: (file?&write fs content path) - (-> (/.System Promise) Binary /.Path (Promise Bit)) - (do promise.monad + (-> (/.System Async) Binary /.Path (Async Bit)) + (do async.monad [file_pre! (\ fs file? path) made? (\ fs write content path) file_post! (\ fs file? path)] @@ -99,8 +99,8 @@ file_post!)))) (def: (file_size&read&append fs expected_file_size content appendix path) - (-> (/.System Promise) Nat Binary Binary /.Path (Promise Bit)) - (do promise.monad + (-> (/.System Async) Nat Binary Binary /.Path (Async Bit)) + (do async.monad [pre_file_size (\ fs file_size path) pre_content (\ fs read path) appended? (\ fs append appendix path) @@ -127,8 +127,8 @@ post_content!))))))) (def: (modified?&last_modified fs expected_time path) - (-> (/.System Promise) Instant /.Path (Promise Bit)) - (do promise.monad + (-> (/.System Async) Instant /.Path (Async Bit)) + (do async.monad [modified? (\ fs modify expected_time path) last_modified (\ fs last_modified path)] (wrap (<| (try.default false) @@ -137,10 +137,10 @@ (\ ! map (instant\= expected_time) last_modified)))))) (def: (directory_files&sub_directories fs parent sub_dir child) - (-> (/.System Promise) /.Path /.Path /.Path (Promise Bit)) + (-> (/.System Async) /.Path /.Path /.Path (Async Bit)) (let [sub_dir (/.nest fs parent sub_dir) child (/.nest fs parent child)] - (do promise.monad + (do async.monad [made_sub? (\ fs make_directory sub_dir) directory_files (\ fs directory_files parent) sub_directories (\ fs sub_directories parent) @@ -156,10 +156,10 @@ (try.default false)))))))))) (def: (move&delete fs parent child alternate_child) - (-> (/.System Promise) /.Path Text Text (Promise Bit)) + (-> (/.System Async) /.Path Text Text (Async Bit)) (let [origin (/.nest fs parent child) destination (/.nest fs parent alternate_child)] - (do {! promise.monad} + (do {! async.monad} [moved? (\ fs move destination origin) lost? (|> origin (\ fs file?) @@ -174,7 +174,7 @@ found?)))))))) (def: (for_system fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) (<| (do {! random.monad} [parent (random.ascii/numeric 2) child (random.ascii/numeric 2) @@ -189,8 +189,8 @@ appendix ($binary.random expected_file_size) expected_time random.instant]) wrap - (do {! promise.monad} - [fs (promise.future fs) + (do {! async.monad} + [fs (async.future fs) #let [path (/.nest fs parent child)] directory?&make_directory @@ -225,14 +225,14 @@ move&delete)))) (def: (make_directories&cannot_make_directory fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) (<| (do {! random.monad} [dir/0 (random.ascii/numeric 2) dir/1 (random.ascii/numeric 2) dir/2 (random.ascii/numeric 2)]) wrap - (do {! promise.monad} - [fs (promise.future fs) + (do {! async.monad} + [fs (async.future fs) #let [dir/1 (/.nest fs dir/0 dir/1) dir/2 (/.nest fs dir/1 dir/2)] pre_dir/0 (\ fs directory? dir/0) @@ -272,12 +272,12 @@ ))) (def: (make_file&cannot_make_file fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) (<| (do {! random.monad} [file/0 (random.ascii/numeric 3)]) wrap - (do {! promise.monad} - [fs (promise.future fs) + (do {! async.monad} + [fs (async.future fs) make_file!/0 (/.make_file ! fs (utf8\encode file/0) file/0) make_file!/1 (/.make_file ! fs (utf8\encode file/0) file/0)]) ($_ _.and' @@ -295,21 +295,21 @@ ))) (def: (for_utilities fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) ($_ _.and (..make_directories&cannot_make_directory fs) (..make_file&cannot_make_file fs) )) (def: (exists? fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) (<| (do {! random.monad} [file (random.ascii/numeric 2) dir (random.only (|>> (text\= file) not) (random.ascii/numeric 2))]) wrap - (do {! promise.monad} - [fs (promise.future fs) + (do {! async.monad} + [fs (async.future fs) pre_file/0 (\ fs file? file) pre_file/1 (/.exists? ! fs file) @@ -342,7 +342,7 @@ post_dir/1)))) (def: #export (spec fs) - (-> (IO (/.System Promise)) Test) + (-> (IO (/.System Async)) Test) ($_ _.and (..for_path fs) (..for_utilities fs) diff --git a/stdlib/source/specification/lux/world/program.lux b/stdlib/source/specification/lux/world/program.lux index e79429627..411f29fe9 100644 --- a/stdlib/source/specification/lux/world/program.lux +++ b/stdlib/source/specification/lux/world/program.lux @@ -7,7 +7,7 @@ [control ["." try] [concurrency - ["." promise (#+ Promise)]]] + ["." async (#+ Async)]]] [data ["." text] [collection @@ -19,10 +19,10 @@ ["." /]]) (def: #export (spec subject) - (-> (/.Program Promise) Test) + (-> (/.Program Async) Test) (do random.monad [exit random.int] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [environment (/.environment ! subject)] (_.cover' [/.Program] (and (not (dictionary.empty? environment)) diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux index c4fc51b99..55197a307 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -7,7 +7,7 @@ [control ["." try ("#\." functor)] [concurrency - ["." promise (#+ Promise) ("#\." monad)]] + ["." async (#+ Async) ("#\." monad)]] [parser ["." environment (#+ Environment)]]] [data @@ -34,22 +34,22 @@ ) (def: (can_wait! process) - (-> (/.Process Promise) _.Assertion) + (-> (/.Process Async) _.Assertion) (|> (\ process await []) - (promise\map (|>> (try\map (i.= /.normal)) - (try.default false) - (_.cover' [/.Exit /.normal]))) - promise\join)) + (async\map (|>> (try\map (i.= /.normal)) + (try.default false) + (_.cover' [/.Exit /.normal]))) + async\join)) (def: (can_read! expected process) - (-> Text (/.Process Promise) (Promise Bit)) + (-> Text (/.Process Async) (Async Bit)) (|> (\ process read []) - (promise\map (|>> (try\map (text\= expected)) - (try.default false))))) + (async\map (|>> (try\map (text\= expected)) + (try.default false))))) (def: (can_destroy! process) - (-> (/.Process Promise) (Promise Bit)) - (do promise.monad + (-> (/.Process Async) (Async Bit)) + (do async.monad [?destroy (\ process destroy []) ?await (\ process await [])] (wrap (and (case ?destroy @@ -67,12 +67,12 @@ (with_expansions [<shell_coverage> (as_is [/.Command /.Argument])] (def: #export (spec shell) - (-> (/.Shell Promise) Test) + (-> (/.Shell Async) Test) (<| (_.for [/.Shell /.Process]) (do {! random.monad} [message (random.ascii/alpha 10) seconds (\ ! map (|>> (n.% 5) (n.+ 5)) random.nat)] - (wrap (do {! promise.monad} + (wrap (do {! async.monad} [?echo (\ shell execute (..echo! message)) ?sleep (\ shell execute (..sleep! seconds))] (case [?echo ?sleep] |