diff options
author | Eduardo Julian | 2021-09-05 22:52:26 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-05 22:52:26 -0400 |
commit | 132ffdae1add622c8a3c6065d7730a8fe8ea5e78 (patch) | |
tree | 540310f190007d192b892db2d0a520d17b73ad48 /stdlib/source/specification | |
parent | 09e2747bf8c6dcdc1d7318f2490f0de37d77b39f (diff) |
Changed the syntax of do/be's (co)monad bindings.
Diffstat (limited to 'stdlib/source/specification')
12 files changed, 33 insertions, 33 deletions
diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index c7c221eb7..d71abc703 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -64,7 +64,7 @@ [r.i64 synthesis.i64 synthesis.path/i64] [r.frac synthesis.f64 synthesis.path/f64] [(r.unicode 5) synthesis.text synthesis.path/text])) - (do {! r.monad} + (do [! r.monad] [size ..size idx (|> r.nat (\ ! each (n.% size))) [subS subP] case @@ -79,7 +79,7 @@ (synthesis.member/left idx)) subP)]] (in [caseS caseP])) - (do {! r.monad} + (do [! r.monad] [size ..size idx (|> r.nat (\ ! each (n.% size))) [subS subP] case diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 18d739d8e..917d830b6 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -174,7 +174,7 @@ (def: (text run) (-> Runner Test) - (do {! r.monad} + (do [! r.monad] [sample_size (|> r.nat (\ ! each (|>> (n.% 10) (n.max 1)))) sample_lower (r.ascii/lower_alpha sample_size) sample_upper (r.ascii/upper_alpha sample_size) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index dc92cc224..f356bce90 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -49,7 +49,7 @@ (def: .public (spec run) (-> Runner Test) - (do {! r.monad} + (do [! r.monad] [[arity local functionS] ..function partial_arity (|> r.nat (\ ! each (|>> (n.% arity) (n.max 1)))) inputs (r.list arity r.safe_frac) diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index bcf2bb2d1..37aea49fe 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -39,7 +39,7 @@ (def: (variable run) (-> Runner Test) - (do {! r.monad} + (do [! r.monad] [register (|> r.nat (\ ! each (n.% 100))) expected r.safe_frac] (_.test "Local variables." diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 4161c650a..cd86ecab2 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -30,7 +30,7 @@ (def: (variant run) (-> Runner Test) - (do {! r.monad} + (do [! r.monad] [num_tags (|> r.nat (\ ! each (|>> (n.% 10) (n.max 2)))) tag_in (|> r.nat (\ ! each (n.% num_tags))) .let [last?_in (|> num_tags -- (n.= tag_in))] @@ -65,7 +65,7 @@ (def: (tuple run) (-> Runner Test) - (do {! r.monad} + (do [! r.monad] [size (|> r.nat (\ ! each (|>> (n.% 10) (n.max 2)))) tuple_in (r.list size r.i64)] (_.test (%.name (name_of synthesis.tuple)) diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index 594a42253..431fc8f29 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -17,7 +17,7 @@ (def: (identity injection comparison (^open "\.")) (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) - (do {! random.monad} + (do [! random.monad] [sample (\ ! each injection random.nat)] (_.test "Identity." ((comparison n.=) @@ -26,7 +26,7 @@ (def: (homomorphism injection comparison (^open "\.")) (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat increase (\ ! each n.+ random.nat)] (_.test "Homomorphism." @@ -36,7 +36,7 @@ (def: (interchange injection comparison (^open "\.")) (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat increase (\ ! each n.+ random.nat)] (_.test "Interchange." @@ -47,7 +47,7 @@ (def: (composition injection comparison (^open "\.")) (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat increase (\ ! each n.+ random.nat) decrease (\ ! each n.- random.nat)] diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux index 76235ad53..4941d31ad 100644 --- a/stdlib/source/specification/lux/abstract/comonad.lux +++ b/stdlib/source/specification/lux/abstract/comonad.lux @@ -15,7 +15,7 @@ (def: (left_identity injection (^open "_//.")) (All (_ f) (-> (Injection f) (CoMonad f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat morphism (\ ! each (function (_ diff) (|>> _//out (n.+ diff))) @@ -37,7 +37,7 @@ (def: (associativity injection comparison (^open "_//.")) (All (_ f) (-> (Injection f) (Comparison f) (CoMonad f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat increase (\ ! each (function (_ diff) (|>> _//out (n.+ diff))) diff --git a/stdlib/source/specification/lux/abstract/functor.lux b/stdlib/source/specification/lux/abstract/functor.lux index 1186640fa..681f6dcd5 100644 --- a/stdlib/source/specification/lux/abstract/functor.lux +++ b/stdlib/source/specification/lux/abstract/functor.lux @@ -24,7 +24,7 @@ (def: (identity injection comparison (^open "@//.")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) - (do {! random.monad} + (do [! random.monad] [sample (\ ! each injection random.nat)] (_.test "Identity." ((comparison n.=) @@ -33,7 +33,7 @@ (def: (homomorphism injection comparison (^open "@//.")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat increase (\ ! each n.+ random.nat)] (_.test "Homomorphism." @@ -43,7 +43,7 @@ (def: (composition injection comparison (^open "@//.")) (All (_ f) (-> (Injection f) (Comparison f) (Functor f) Test)) - (do {! random.monad} + (do [! random.monad] [sample (\ ! each injection random.nat) increase (\ ! each n.+ random.nat) decrease (\ ! each n.- random.nat)] diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux index 2be8f2285..11ee011e1 100644 --- a/stdlib/source/specification/lux/abstract/monad.lux +++ b/stdlib/source/specification/lux/abstract/monad.lux @@ -13,7 +13,7 @@ (def: (left_identity injection comparison (^open "_//.")) (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat morphism (\ ! each (function (_ diff) (|>> (n.+ diff) _//in)) @@ -34,7 +34,7 @@ (def: (associativity injection comparison (^open "_//.")) (All (_ f) (-> (Injection f) (Comparison f) (/.Monad f) Test)) - (do {! random.monad} + (do [! random.monad] [sample random.nat increase (\ ! each (function (_ diff) (|>> (n.+ diff) _//in)) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index 14cb79211..765893ba6 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -34,7 +34,7 @@ (def: (for_path fs) (-> (IO (/.System Async)) Test) (<| (_.for [/.Path]) - (do {! random.monad} + (do [! random.monad] [parent (random.ascii/numeric 2) child (random.ascii/numeric 2)]) in @@ -89,7 +89,7 @@ post_file_size (\ fs file_size path) post_content (\ fs read path)] (in (<| (try.else false) - (do {! try.monad} + (do [! try.monad] [pre_file_size! (\ ! each (n.= expected_file_size) pre_file_size) @@ -114,7 +114,7 @@ [modified? (\ fs modify expected_time path) last_modified (\ fs last_modified path)] (in (<| (try.else false) - (do {! try.monad} + (do [! try.monad] [_ modified?] (\ ! each (instant\= expected_time) last_modified)))))) @@ -141,7 +141,7 @@ (-> (/.System Async) /.Path Text Text (Async Bit)) (let [origin (/.rooted fs parent child) destination (/.rooted fs parent alternate_child)] - (do {! async.monad} + (do [! async.monad] [moved? (\ fs move destination origin) lost? (|> origin (\ fs file?) @@ -157,7 +157,7 @@ (def: (for_system fs) (-> (IO (/.System Async)) Test) - (<| (do {! random.monad} + (<| (do [! random.monad] [parent (random.ascii/numeric 2) child (random.ascii/numeric 2) sub_dir (random.only (|>> (text\= child) not) @@ -171,7 +171,7 @@ appendix ($binary.random expected_file_size) expected_time random.instant]) in - (do {! async.monad} + (do [! async.monad] [fs (async.future fs) .let [path (/.rooted fs parent child)] @@ -208,12 +208,12 @@ (def: (make_directories&cannot_make_directory fs) (-> (IO (/.System Async)) Test) - (<| (do {! random.monad} + (<| (do [! random.monad] [dir/0 (random.ascii/numeric 2) dir/1 (random.ascii/numeric 2) dir/2 (random.ascii/numeric 2)]) in - (do {! async.monad} + (do [! async.monad] [fs (async.future fs) .let [dir/1 (/.rooted fs dir/0 dir/1) dir/2 (/.rooted fs dir/1 dir/2)] @@ -255,10 +255,10 @@ (def: (make_file&cannot_make_file fs) (-> (IO (/.System Async)) Test) - (<| (do {! random.monad} + (<| (do [! random.monad] [file/0 (random.ascii/numeric 3)]) in - (do {! async.monad} + (do [! async.monad] [fs (async.future fs) make_file!/0 (/.make_file ! fs (utf8\encoded file/0) file/0) make_file!/1 (/.make_file ! fs (utf8\encoded file/0) file/0)]) @@ -285,12 +285,12 @@ (def: (exists? fs) (-> (IO (/.System Async)) Test) - (<| (do {! random.monad} + (<| (do [! random.monad] [file (random.ascii/numeric 2) dir (random.only (|>> (text\= file) not) (random.ascii/numeric 2))]) in - (do {! async.monad} + (do [! async.monad] [fs (async.future fs) pre_file/0 (\ fs file? file) diff --git a/stdlib/source/specification/lux/world/program.lux b/stdlib/source/specification/lux/world/program.lux index b1577364a..772aa28a4 100644 --- a/stdlib/source/specification/lux/world/program.lux +++ b/stdlib/source/specification/lux/world/program.lux @@ -22,7 +22,7 @@ (-> (/.Program Async) Test) (do random.monad [exit random.int] - (in (do {! async.monad} + (in (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 3ec8c6142..8f12be702 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -69,10 +69,10 @@ (def: .public (spec shell) (-> (/.Shell Async) Test) (<| (_.for [/.Shell /.Process]) - (do {! random.monad} + (do [! random.monad] [message (random.ascii/alpha 10) seconds (\ ! each (|>> (n.% 5) (n.+ 5)) random.nat)] - (in (do {! async.monad} + (in (do [! async.monad] [?echo (\ shell execute (..echo! message)) ?sleep (\ shell execute (..sleep! seconds))] (case [?echo ?sleep] |