diff options
author | Eduardo Julian | 2020-11-26 19:37:11 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-11-26 19:37:11 -0400 |
commit | dbb658bd7976c073a2bf314f194b36b30c45784b (patch) | |
tree | 4771bab5e41fe2ba3939bb3a12941a558b68e712 /stdlib/source/test | |
parent | c4bbfea18d995948012f45a6afda7a6e6ba56f84 (diff) |
Allow name formatting for JVM imports, similar to Lux module imports.
Diffstat (limited to '')
36 files changed, 378 insertions, 278 deletions
diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux index 3d7a22bc6..ca45c3c25 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -6,7 +6,7 @@ [control ["." try]] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [format ["." json (#+ JSON)]]] [math @@ -40,7 +40,7 @@ (_.cover [/.compose] (case (|> expected (:: ..codec encode) (:: ..codec decode)) (#try.Success actual) - (bit@= expected actual) + (bit\= expected actual) (#try.Failure error) false))))) diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/cofree.lux index 6cf767e65..0c75e9f74 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/cofree.lux @@ -13,7 +13,7 @@ [data [collection ["." list] - ["." sequence (#+ Sequence) ("#@." comonad)]]] + ["." sequence (#+ Sequence) ("#\." comonad)]]] [math ["." random]]] {1 @@ -21,12 +21,12 @@ (def: (injection value) (Injection (/.CoFree Sequence)) - [value (sequence@map injection (sequence.repeat value))]) + [value (sequence\map injection (sequence.repeat value))]) (def: (interpret [head tail]) (All [a] (-> (/.CoFree Sequence a) (Sequence a))) (|> tail - (sequence@map (:: (/.comonad sequence.functor) unwrap)) + (sequence\map (:: (/.comonad sequence.functor) unwrap)) [head] //.pending)) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 17e1d0cce..c79a7e4c0 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -5,11 +5,11 @@ [monad (#+ do)]] [data ["." product] - ["." maybe ("#@." functor)] + ["." maybe ("#\." functor)] [number ["n" nat]] [collection - ["." list ("#@." fold)]]] + ["." list ("#\." fold)]]] [math ["." random (#+ Random)]]] {1 @@ -30,14 +30,14 @@ ($_ _.and (_.cover [/.range] (let [expected-size (|> end (n.- start) inc) - expected-start? (|> range list.head (maybe@map (n.= start)) (maybe.default false)) - expected-end? (|> range list.last (maybe@map (n.= end)) (maybe.default false)) + expected-start? (|> range list.head (maybe\map (n.= start)) (maybe.default false)) + expected-end? (|> range list.last (maybe\map (n.= end)) (maybe.default false)) can-be-backwards? (:: (list.equivalence n.equivalence) = (/.range n.enum start end) (list.reverse (/.range n.enum end start))) every-element-is-a-successor? (case range (#.Cons head tail) - (|> (list@fold (function (_ next [verdict prev]) + (|> (list\fold (function (_ next [verdict prev]) [(and verdict (n.= next (:: n.enum succ prev))) next]) diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index ee097034f..ae065c031 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -8,7 +8,7 @@ [functor ["$." contravariant]]]}] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat] ["i" int]]] @@ -29,11 +29,11 @@ #let [equivalence (: (Equivalence (Equivalence Nat)) (structure (def: (= left right) - (and (bit@= (:: left = leftN leftN) + (and (bit\= (:: left = leftN leftN) (:: right = leftN leftN)) - (bit@= (:: left = rightN rightN) + (bit\= (:: left = rightN rightN) (:: right = rightN rightN)) - (bit@= (:: left = leftN rightN) + (bit\= (:: left = leftN rightN) (:: right = leftN rightN))))))]] (<| (_.covering /._) ($_ _.and @@ -41,20 +41,20 @@ ($contravariant.spec equivalence n.equivalence /.functor)) (_.cover [/.sum] (let [equivalence (/.sum n.equivalence i.equivalence)] - (and (bit@= (:: n.equivalence = leftN leftN) + (and (bit\= (:: n.equivalence = leftN leftN) (:: equivalence = (#.Left leftN) (#.Left leftN))) - (bit@= (:: n.equivalence = leftN rightN) + (bit\= (:: n.equivalence = leftN rightN) (:: equivalence = (#.Left leftN) (#.Left rightN))) - (bit@= (:: i.equivalence = leftI leftI) + (bit\= (:: i.equivalence = leftI leftI) (:: equivalence = (#.Right leftI) (#.Right leftI))) - (bit@= (:: i.equivalence = leftI rightI) + (bit\= (:: i.equivalence = leftI rightI) (:: equivalence = (#.Right leftI) (#.Right rightI)))))) (_.cover [/.product] (let [equivalence (/.product n.equivalence i.equivalence)] - (and (bit@= (and (:: n.equivalence = leftN leftN) + (and (bit\= (and (:: n.equivalence = leftN leftN) (:: i.equivalence = leftI leftI)) (:: equivalence = [leftN leftI] [leftN leftI])) - (bit@= (and (:: n.equivalence = leftN rightN) + (bit\= (and (:: n.equivalence = leftN rightN) (:: i.equivalence = leftI rightI)) (:: equivalence = [leftN leftI] [rightN rightI]))))) (_.cover [/.rec] diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index 7aea3a1c5..0c8355a49 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -18,7 +18,7 @@ [math ["." random (#+ Random)]]] {1 - ["." / (#+ Interval) ("#@." equivalence)]}) + ["." / (#+ Interval) ("\." equivalence)]}) (template [<name> <cmp>] [(def: #export <name> @@ -94,7 +94,7 @@ right-outer ..outer] ($_ _.and (_.test "The union of an interval to itself yields the same interval." - (/@= some-interval (/.union some-interval some-interval))) + (\= some-interval (/.union some-interval some-interval))) (_.test "The union of 2 inner intervals is another inner interval." (/.inner? (/.union left-inner right-inner))) (_.test "The union of 2 outer intervals yields an inner interval when their complements don't overlap, and an outer when they do." @@ -115,7 +115,7 @@ right-outer ..outer] ($_ _.and (_.test "The intersection of an interval to itself yields the same interval." - (/@= some-interval (/.intersection some-interval some-interval))) + (\= some-interval (/.intersection some-interval some-interval))) (_.test "The intersection of 2 inner intervals yields an inner interval when they overlap, and an outer when they don't." (if (/.overlaps? left-inner right-inner) (/.inner? (/.intersection left-inner right-inner)) @@ -130,7 +130,7 @@ [some-interval ..interval] ($_ _.and (_.test "The complement of a complement is the same as the original." - (/@= some-interval (|> some-interval /.complement /.complement))) + (\= some-interval (|> some-interval /.complement /.complement))) (_.test "The complement of an interval does not overlap it." (not (/.overlaps? some-interval (/.complement some-interval)))) ))) diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index 61ee28f0e..14529fdc5 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -5,7 +5,7 @@ [number ["n" nat]] [collection - ["." list ("#@." functor fold)]]] + ["." list ("#\." functor fold)]]] [math ["." random]] ["_" test (#+ Test)]] @@ -33,15 +33,15 @@ (:: identity.monad wrap mono))))) (_.cover [/.seq] (:: (list.equivalence n.equivalence) = - (list@map inc poly) + (list\map inc poly) (|> poly - (list@map (|>> inc (:: identity.monad wrap))) + (list\map (|>> inc (:: identity.monad wrap))) (: (List (Identity Nat))) (/.seq identity.monad) (: (Identity (List Nat)))))) (_.cover [/.map] (:: (list.equivalence n.equivalence) = - (list@map inc poly) + (list\map inc poly) (|> poly (/.map identity.monad (|>> inc (:: identity.monad wrap))) (: (Identity (List Nat)))))) @@ -52,7 +52,7 @@ (/.filter identity.monad (|>> n.even? (:: identity.monad wrap))) (: (Identity (List Nat)))))) (_.cover [/.fold] - (n.= (list@fold n.+ 0 poly) + (n.= (list\fold n.+ 0 poly) (|> poly (/.fold identity.monad (function (_ part whole) diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 366948cdb..48c960d19 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -12,7 +12,7 @@ ["$." monad]]}] [data [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math ["." random]]] {1 @@ -30,7 +30,7 @@ (#/.Effect effect) (|> effect - (list@map interpret) + (list\map interpret) list.concat))) (def: comparison diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index d0bbab29b..f330d88ae 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -8,7 +8,7 @@ [functor ["$." contravariant]]]}] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]]] [math @@ -27,11 +27,11 @@ #let [equivalence (: (Equivalence (/.Order Nat)) (structure (def: (= leftO rightO) - (and (bit@= (:: leftO < left left) + (and (bit\= (:: leftO < left left) (:: rightO < left left)) - (bit@= (:: leftO < right right) + (bit\= (:: leftO < right right) (:: rightO < right right)) - (bit@= (:: leftO < left right) + (bit\= (:: leftO < left right) (:: rightO < left right))))))]]) ($_ _.and (_.with-cover [/.functor] @@ -40,16 +40,16 @@ (n.< (/.max n.order left right) (/.min n.order left right))) (_.cover [/.Comparison /.>] - (not (bit@= (n.< left right) + (not (bit\= (n.< left right) (/.> n.order left right)))) (_.cover [/.<=] (and (/.<= n.order left left) (/.<= n.order right right) - (bit@= (:: n.order < left right) + (bit\= (:: n.order < left right) (/.<= n.order left right)))) (_.cover [/.>=] (and (/.>= n.order left left) (/.>= n.order right right) - (bit@= (/.> n.order left right) + (bit\= (/.> n.order left right) (/.>= n.order left right)))) ))) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index cf7f4f074..8bf5c05f0 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -12,7 +12,7 @@ [control ["." function]] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]] [collection @@ -37,7 +37,7 @@ #let [equivalence (: (Equivalence (/.Predicate Nat)) (structure (def: (= left right) - (bit@= (left sample) + (bit\= (left sample) (right sample)))))]]) (_.with-cover [/.Predicate]) ($_ _.and @@ -54,24 +54,24 @@ ($monoid.spec equivalence /.intersection generator)))) (_.cover [/.none] - (bit@= false (/.none sample))) + (bit\= false (/.none sample))) (_.cover [/.all] - (bit@= true (/.all sample))) + (bit\= true (/.all sample))) (_.cover [/.unite] - (bit@= (/.all sample) + (bit\= (/.all sample) ((/.unite /.none /.all) sample))) (_.cover [/.intersect] - (bit@= (/.none sample) + (bit\= (/.none sample) ((/.intersect /.none /.all) sample))) (_.cover [/.complement] - (and (not (bit@= (/.none sample) + (and (not (bit\= (/.none sample) ((/.complement /.none) sample))) - (not (bit@= (/.all sample) + (not (bit\= (/.all sample) ((/.complement /.all) sample))))) (_.cover [/.difference] (let [/2? (multiple? 2) /3? (multiple? 3)] - (bit@= (and (/2? sample) + (bit\= (and (/2? sample) (not (/3? sample))) ((/.difference /3? /2?) sample)))) (_.cover [/.rec] @@ -86,6 +86,6 @@ (#.Cons head tail) (or (even? head) (recur tail)))))))] - (bit@= (list.any? even? samples) + (bit\= (list.any? even? samples) (any-even? samples)))) ))) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index db97197e3..2075913a5 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -5,7 +5,7 @@ [data [number ["n" nat]] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]]] [math ["." random]] @@ -50,7 +50,7 @@ false (#try.Failure message) - (text@= message (/.construct ..an-exception [])))) + (text\= message (/.construct ..an-exception [])))) (_.cover [/.match?] (/.match? ..an-exception (/.construct ..an-exception []))) @@ -61,7 +61,7 @@ (#try.Failure message) (and (not assertion-succeeded?) - (text@= message (/.construct ..an-exception []))))) + (text\= message (/.construct ..an-exception []))))) (_.cover [/.catch] (and (n.= expected (|> (/.throw ..an-exception []) @@ -96,7 +96,7 @@ (#try.Failure _) false) (case (/.with ..an-exception [] (#try.Failure "")) (#try.Success _) false - (#try.Failure message) (text@= message (/.construct ..an-exception []))) + (#try.Failure message) (text\= message (/.construct ..an-exception []))) (case (/.with ..an-exception [] (: (Try Nat) (/.throw ..another-exception []))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index a8c91fbaf..9acf45684 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -16,10 +16,10 @@ [data [number ["n" nat]] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math ["." random]] [macro @@ -32,7 +32,7 @@ (All [a] (-> Text (Try a) Bit)) (case input (#try.Failure actual) - (text@= expected actual) + (text\= expected actual) _ #0)) @@ -92,16 +92,16 @@ (match #.None #1)))) (_.cover [/.some] - (and (|> (list@map code.nat expected+) + (and (|> (list\map code.nat expected+) (/.run (/.some s.nat)) (match actual (:: (list.equivalence n.equivalence) = expected+ actual))) - (|> (list@map (|>> .int code.int) expected+) + (|> (list\map (|>> .int code.int) expected+) (/.run (/.some s.nat)) (match #.Nil #1)))) (_.cover [/.many] - (and (|> (list@map code.nat expected+) + (and (|> (list\map code.nat expected+) (/.run (/.many s.nat)) (match actual (:: (list.equivalence n.equivalence) = expected+ actual))) @@ -109,7 +109,7 @@ (/.run (/.many s.nat)) (match (list actual) (n.= expected0 actual))) - (|> (list@map (|>> .int code.int) expected+) + (|> (list\map (|>> .int code.int) expected+) (/.run (/.many s.nat)) fails?))) (_.cover [/.filter] @@ -174,64 +174,64 @@ separator (random.ascii 1)] ($_ _.and (_.cover [/.exactly] - (and (|> (list@map code.nat expected+) + (and (|> (list\map code.nat expected+) (/.run (/.exactly times s.nat)) (match actual (:: (list.equivalence n.equivalence) = (list.take times expected+) actual))) - (|> (list@map code.nat expected+) + (|> (list\map code.nat expected+) (/.run (/.exactly (inc variadic) s.nat)) fails?))) (_.cover [/.at-least] - (and (|> (list@map code.nat expected+) + (and (|> (list\map code.nat expected+) (/.run (/.at-least times s.nat)) (match actual (:: (list.equivalence n.equivalence) = expected+ actual))) - (|> (list@map code.nat expected+) + (|> (list\map code.nat expected+) (/.run (/.at-least (inc variadic) s.nat)) fails?))) (_.cover [/.at-most] - (and (|> (list@map code.nat expected+) + (and (|> (list\map code.nat expected+) (/.run (/.at-most times s.nat)) (match actual (:: (list.equivalence n.equivalence) = (list.take times expected+) actual))) - (|> (list@map code.nat expected+) + (|> (list\map code.nat expected+) (/.run (/.at-most (inc variadic) s.nat)) (match actual (:: (list.equivalence n.equivalence) = expected+ actual))))) (_.cover [/.between] - (and (|> (list@map code.nat expected+) + (and (|> (list\map code.nat expected+) (/.run (/.between times variadic s.nat)) (match actual (:: (list.equivalence n.equivalence) = expected+ actual))) - (|> (list@map code.nat (list.take times expected+)) + (|> (list\map code.nat (list.take times expected+)) (/.run (/.between times variadic s.nat)) (match actual (:: (list.equivalence n.equivalence) = (list.take times expected+) actual))))) (_.cover [/.sep-by] - (|> (list.interpose (code.text separator) (list@map code.nat expected+)) + (|> (list.interpose (code.text separator) (list\map code.nat expected+)) (/.run (/.sep-by (s.this! (code.text separator)) s.nat)) (match actual (:: (list.equivalence n.equivalence) = expected+ actual)))) (_.cover [/.remaining] - (|> (list@map code.nat expected+) + (|> (list\map code.nat expected+) (/.run /.remaining) (match actual (:: (list.equivalence code.equivalence) = - (list@map code.nat expected+) + (list\map code.nat expected+) actual)))) (_.cover [/.default] (and (|> (/.run (/.default wrong (:: /.monad wrap expected)) (list)) @@ -298,14 +298,19 @@ (list (code.nat odd))) fails?))) (_.cover [/.speculative] - (and (|> (/.run (/.and (/.speculative even^) nat^) - (list (code.nat even))) - (match [speculation actual] - (and (n.= speculation actual) - (n.= expected actual)))) - (|> (/.run (/.and (/.speculative even^) nat^) - (list (code.nat odd))) - fails?))) + (let [happy-path! + (|> (/.run (/.and (/.speculative even^) nat^) + (list (code.nat even))) + (match [speculation actual] + (and (n.= speculation actual) + (n.= even actual)))) + + sad-path! + (|> (/.run (/.and (/.speculative even^) nat^) + (list (code.nat odd))) + fails?)] + (and happy-path! + sad-path!))) (_.cover [/.codec] (|> (/.run (/.codec n.decimal s.text) (list (code.text (%.nat expected)))) diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index dca66b9ef..f09967760 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -9,9 +9,9 @@ ["." exception] ["<>" parser]] [data - ["." name ("#@." equivalence)] - ["." bit ("#@." equivalence)] - ["." text ("#@." equivalence)] + ["." name ("#\." equivalence)] + ["." bit ("#\." equivalence)] + ["." text ("#\." equivalence)] [number ["n" nat] ["i" int] @@ -79,15 +79,15 @@ (/.run (<check> expected)) (!expect (#try.Success _)))))] - [/.bit /.bit! random.bit analysis.bit bit@=] + [/.bit /.bit! random.bit analysis.bit bit\=] [/.nat /.nat! random.nat analysis.nat n.=] [/.int /.int! random.int analysis.int i.=] [/.frac /.frac! random.safe-frac analysis.frac f.=] [/.rev /.rev! random.rev analysis.rev r.=] - [/.text /.text! (random.unicode 10) analysis.text text@=] + [/.text /.text! (random.unicode 10) analysis.text text\=] [/.local /.local! random.nat analysis.variable/local n.=] [/.foreign /.foreign! random.nat analysis.variable/foreign n.=] - [/.constant /.constant! ..constant analysis.constant name@=] + [/.constant /.constant! ..constant analysis.constant name\=] )) (do {! random.monad} [expected random.bit] @@ -95,7 +95,7 @@ (|> (list (analysis.tuple (list (analysis.bit expected)))) (/.run (/.tuple /.bit)) (case> (#try.Success actual) - (bit@= expected actual) + (bit\= expected actual) (#try.Failure _) false)))) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index b02a94f0f..9e4c06f18 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -16,7 +16,7 @@ ["." maybe] ["." bit] ["." name] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["." encoding] ["%" format (#+ format)]] ["." format #_ @@ -55,7 +55,7 @@ encoding.to-utf8 encoding.from-utf8 (case> (#try.Success converted) - (text@= value converted) + (text\= value converted) (#try.Failure error) false))) @@ -74,7 +74,7 @@ (def: (= [expected-module expected-line expected-column] [sample-module sample-line sample-column]) - (and (text@= expected-module sample-module) + (and (text\= expected-module sample-module) (n.= expected-line sample-line) (n.= expected-column sample-column)))) @@ -128,7 +128,7 @@ [(do {! random.monad} [expected (:: ! map (i64.and (i64.mask <size>)) random.nat)] - (_.cover [<size> <parser>] + (_.cover [<size> <parser> <format>] (|> (format.run <format> expected) (/.run <parser>) (!expect (^multi (#try.Success actual) @@ -147,7 +147,7 @@ (~~ (template [<parser> <format>] [(do {! random.monad} [expected (:: ! map encoding.to-utf8 (random.ascii ..segment-size))] - (_.cover [<parser>] + (_.cover [<parser> <format>] (|> (format.run <format> expected) (/.run <parser>) (!expect (^multi (#try.Success actual) @@ -165,7 +165,7 @@ (~~ (template [<parser> <format>] [(do {! random.monad} [expected (random.ascii ..segment-size)] - (_.cover [<parser>] + (_.cover [<parser> <format>] (|> (format.run <format> expected) (/.run <parser>) (!expect (^multi (#try.Success actual) @@ -175,7 +175,7 @@ [/.utf8/16 format.utf8/16] [/.utf8/32 format.utf8/32] [/.utf8/64 format.utf8/64] - [/.text format.utf8/64] + [/.text format.text] ))))) (def: row @@ -184,7 +184,7 @@ (~~ (template [<parser> <format>] [(do {! random.monad} [expected (random.row ..segment-size random.nat)] - (_.cover [<parser>] + (_.cover [<parser> <format>] (|> expected (format.run (<format> format.nat)) (/.run (<parser> /.nat)) @@ -203,7 +203,7 @@ (~~ (template [<parser> <format> <random> <equivalence>] [(do {! random.monad} [expected <random>] - (_.cover [<parser>] + (_.cover [<parser> <format>] (|> expected (format.run <format>) (/.run <parser>) @@ -216,7 +216,7 @@ [/.rev format.rev random.rev rev.equivalence])) (do {! random.monad} [expected random.frac] - (_.cover [/.frac] + (_.cover [/.frac format.frac] (|> expected (format.run format.frac) (/.run /.frac) @@ -242,7 +242,7 @@ (~~ (template [<parser> <format> <random> <equivalence>] [(do {! random.monad} [expected <random>] - (_.cover [<parser>] + (_.cover [<parser> <format>] (|> expected (format.run <format>) (/.run <parser>) @@ -253,20 +253,20 @@ [/.code format.code random-code code.equivalence] [/.type format.type random-type type.equivalence] )) - (~~ (template [<cover> <parser> <format> <random> <equivalence>] + (~~ (template [<parser-coverage> <parser> <format-coverage> <format> <random> <equivalence>] [(do {! random.monad} [expected <random>] - (_.cover [<cover>] + (_.cover [<parser-coverage> <format-coverage>] (|> expected (format.run <format>) (/.run <parser>) (!expect (^multi (#try.Success actual) (:: <equivalence> = expected actual))))))] - [/.maybe (/.maybe /.nat) (format.maybe format.nat) (random.maybe random.nat) (maybe.equivalence n.equivalence)] - [/.list (/.list /.nat) (format.list format.nat) (random.list ..segment-size random.nat) (list.equivalence n.equivalence)] - [/.set (/.set n.hash /.nat) (format.set format.nat) (random.set n.hash ..segment-size random.nat) set.equivalence] - [/.name /.name format.name ..random-name name.equivalence])) + [/.maybe (/.maybe /.nat) format.maybe (format.maybe format.nat) (random.maybe random.nat) (maybe.equivalence n.equivalence)] + [/.list (/.list /.nat) format.list (format.list format.nat) (random.list ..segment-size random.nat) (list.equivalence n.equivalence)] + [/.set (/.set n.hash /.nat) format.set (format.set format.nat) (random.set n.hash ..segment-size random.nat) set.equivalence] + [/.name /.name format.name format.name ..random-name name.equivalence])) (do {! random.monad} [expected (:: ! map (list.repeat ..segment-size) random.nat)] (_.cover [/.set-elements-are-not-unique] @@ -277,7 +277,7 @@ (exception.match? /.set-elements-are-not-unique error)))))) (do {! random.monad} [expected (random.or random.bit random.nat)] - (_.cover [/.or] + (_.cover [/.or format.or] (|> expected (format.run (format.or format.bit format.nat)) (/.run (: (/.Parser (Either Bit Nat)) @@ -300,9 +300,10 @@ (exception.match? /.invalid-tag error)))))) (do {! random.monad} [expected (random.list ..segment-size random.nat)] - (_.cover [/.rec] + (_.cover [/.rec format.rec format.and format.any] (|> expected - (format.run (format.list format.nat)) + (format.run (format.rec (|>> (format.and format.nat) + (format.or format.any)))) (/.run (: (/.Parser (List Nat)) (/.rec (function (_ recur) @@ -320,8 +321,9 @@ (<| (_.covering /._) (_.with-cover [/.Parser]) (`` ($_ _.and - (_.cover [/.run /.any] - (|> (binary.create 0) + (_.cover [/.run /.any + format.no-op format.instance] + (|> (format.instance format.no-op) (/.run /.any) (!expect (#try.Success _)))) (do {! random.monad} @@ -333,8 +335,9 @@ (exception.match? /.binary-was-not-fully-read error)))))) (do {! random.monad} [expected (:: ! map encoding.to-utf8 (random.ascii ..segment-size))] - (_.cover [/.segment] + (_.cover [/.segment format.segment format.run] (|> expected + (format.run (format.segment ..segment-size)) (/.run (/.segment ..segment-size)) (!expect (^multi (#try.Success actual) (:: binary.equivalence = expected actual)))))) diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 7d90eb49d..1222b9de1 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -8,8 +8,8 @@ ["<>" parser]] [data [number - ["n" nat ("#@." decimal)]] - ["." text ("#@." equivalence)] + ["n" nat ("#\." decimal)]] + ["." text ("#\." equivalence)] [collection ["." list]]] [math @@ -30,8 +30,8 @@ (<| (_.covering /._) (_.with-cover [/.Parser]) (do {! random.monad} - [expected (:: ! map n@encode random.nat) - #let [random-dummy (random.filter (|>> (text@= expected) not) + [expected (:: ! map n\encode random.nat) + #let [random-dummy (random.filter (|>> (text\= expected) not) (random.unicode 5))] dummy random-dummy short (random.unicode 1) @@ -42,12 +42,12 @@ (_.cover [/.run /.any] (|> (/.run /.any (list expected)) (!expect (^multi (#try.Success actual) - (text@= expected actual))))) + (text\= expected actual))))) (_.cover [/.parse] - (|> (/.run (/.parse n@decode) (list expected)) + (|> (/.run (/.parse n\decode) (list expected)) (!expect (^multi (#try.Success actual) - (text@= expected - (n@encode actual)))))) + (text\= expected + (n\encode actual)))))) (_.cover [/.this] (and (|> (/.run (/.this expected) (list expected)) (!expect (#try.Success _))) @@ -66,16 +66,16 @@ (_.cover [/.named] (|> (/.run (/.named dummy /.any) (list dummy expected)) (!expect (^multi (#try.Success actual) - (text@= expected actual))))) + (text\= expected actual))))) (_.cover [/.parameter] (and (|> (/.run (/.parameter [short long] /.any) (list short expected)) (!expect (^multi (#try.Success actual) - (text@= expected actual)))) + (text\= expected actual)))) (|> (/.run (/.parameter [short long] /.any) (list long expected)) (!expect (^multi (#try.Success actual) - (text@= expected actual)))) + (text\= expected actual)))) (|> (/.run (/.parameter [short long] /.any) (list dummy expected)) (!expect (#try.Failure _))))) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index a4f25df4d..521704dec 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -10,7 +10,7 @@ [data ["." bit] ["." name] - ["." text ("#@." equivalence)] + ["." text] [number ["." nat] ["." int] @@ -19,7 +19,7 @@ [collection ["." list]]] [macro - ["." code ("#@." equivalence)]] + ["." code]] [math ["." random (#+ Random)]]] {1 diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 4b3bfeb7d..27c508bd5 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -16,10 +16,10 @@ ["n" nat] ["." frac]] [collection - ["." list ("#@." functor)] + ["." list ("#\." functor)] ["." set] ["." dictionary] - ["." row (#+ row) ("#@." functor)]] + ["." row (#+ row) ("#\." functor)]] [format ["." json]]] [math @@ -107,7 +107,7 @@ (:: ! map row.from-list))] (_.cover [/.array] (|> (/.run (/.array (<>.some /.string)) - (#json.Array (row@map (|>> #json.String) expected))) + (#json.Array (row\map (|>> #json.String) expected))) (!expect (^multi (#try.Success actual) (:: (row.equivalence text.equivalence) = expected (row.from-list actual))))))) (do {! random.monad} @@ -154,7 +154,7 @@ (|> (/.run (/.dictionary /.string) (#json.Object (|> values - (list@map (|>> #json.String)) + (list\map (|>> #json.String)) (list.zip/2 keys) (dictionary.from-list text.hash)))) (!expect (^multi (#try.Success actual) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 4d6a359da..da6e3247f 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -19,7 +19,7 @@ ["n" nat] ["." frac]] [collection - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [tool [compiler [reference (#+) @@ -57,10 +57,6 @@ (:: ! map (|>> synthesis.variable)) (random.list size)))) -(def: valid-frac - (Random Frac) - (random.filter (|>> frac.not-a-number? not) random.frac)) - (def: simple Test (`` ($_ _.and @@ -82,7 +78,7 @@ [/.bit /.bit! random.bit synthesis.bit bit.equivalence] [/.i64 /.i64! (:: ! map .i64 random.nat) synthesis.i64 i64.equivalence] - [/.f64 /.f64! ..valid-frac synthesis.f64 frac.equivalence] + [/.f64 /.f64! random.safe-frac synthesis.f64 frac.equivalence] [/.text /.text! (random.unicode 1) synthesis.text text.equivalence] [/.local /.local! random.nat synthesis.variable/local n.equivalence] [/.foreign /.foreign! random.nat synthesis.variable/foreign n.equivalence] @@ -96,7 +92,7 @@ (do {! random.monad} [expected-bit random.bit expected-i64 (:: ! map .i64 random.nat) - expected-f64 ..valid-frac + expected-f64 random.safe-frac expected-text (random.unicode 1)] (_.cover [/.tuple] (and (|> (/.run (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) @@ -117,7 +113,7 @@ [arity random.nat expected-environment ..random-environment expected-body (random.unicode 1)] - (_.cover [/.function /.wrong-arity] + (_.cover [/.function] (and (|> (/.run (/.function arity /.text) (list (synthesis.function/abstraction [expected-environment arity (synthesis.text expected-body)]))) (!expect (^multi (#try.Success [actual-environment actual-body]) @@ -128,11 +124,36 @@ (|> (/.run (/.function arity /.text) (list (synthesis.text expected-body))) (!expect (^multi (#try.Failure error) - (exception.match? /.cannot-parse error)))) - (|> (/.run (/.function (inc arity) /.text) - (list (synthesis.function/abstraction [expected-environment arity (synthesis.text expected-body)]))) + (exception.match? /.cannot-parse error))))))) + (do {! random.monad} + [arity random.nat + expected-environment ..random-environment + expected-body (random.unicode 1)] + (_.cover [/.wrong-arity] + (|> (/.run (/.function (inc arity) /.text) + (list (synthesis.function/abstraction [expected-environment arity (synthesis.text expected-body)]))) + (!expect (^multi (#try.Failure error) + (exception.match? /.wrong-arity error)))))) + (do {! random.monad} + [arity (:: ! map (|>> (n.% 10) inc) random.nat) + expected-offset random.nat + expected-inits (random.list arity random.bit) + expected-body (random.unicode 1)] + (_.cover [/.loop] + (and (|> (/.run (/.loop (<>.many /.bit) /.text) + (list (synthesis.loop/scope [expected-offset + (list\map (|>> synthesis.bit) expected-inits) + (synthesis.text expected-body)]))) + (!expect (^multi (#try.Success [actual-offset actual-inits actual-body]) + (and (:: n.equivalence = expected-offset actual-offset) + (:: (list.equivalence bit.equivalence) = + expected-inits + actual-inits) + (:: text.equivalence = expected-body actual-body))))) + (|> (/.run (/.loop (<>.many /.bit) /.text) + (list (synthesis.text expected-body))) (!expect (^multi (#try.Failure error) - (exception.match? /.wrong-arity error))))))) + (exception.match? /.cannot-parse error))))))) )) (def: #export test diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 206b93b12..2575509de 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -9,14 +9,14 @@ ["." function]] [data ["." maybe] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["." unicode] ["%" format (#+ format)]] [number ["n" nat]] [collection ["." set] - ["." list ("#@." functor)] + ["." list ("#\." functor)] [tree ["." finger]]]] [math @@ -58,7 +58,7 @@ (-> Text (/.Parser Text) Bit) (|> expected (/.run parser) - (:: try.functor map (text@= expected)) + (:: try.functor map (text\= expected)) (try.default false))) (def: (should-pass! expected parser) @@ -139,12 +139,12 @@ (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))))))] + (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)))) @@ -153,7 +153,7 @@ options (|> (random.char unicode.full) (random.set n.hash num-options) (:: ! map (|>> set.to-list - (list@map text.from-code) + (list\map text.from-code) (text.join-with "")))) expected (:: ! map (function (_ value) (|> options @@ -179,7 +179,7 @@ options (|> (random.char unicode.full) (random.set n.hash num-options) (:: ! map (|>> set.to-list - (list@map text.from-code) + (list\map text.from-code) (text.join-with "")))) invalid (:: ! map (function (_ value) (|> options @@ -306,7 +306,7 @@ [#let [size 10] expected (random.unicode size) dummy (|> (random.unicode size) - (random.filter (|>> (text@= expected) not)))] + (random.filter (|>> (text\= expected) not)))] (_.cover [/.this /.cannot-match] (and (|> (/.run (/.this expected) expected) @@ -364,13 +364,13 @@ _ /.any post /.get-input _ /.any] - (wrap (and (text@= input pre) - (text@= right post))))) + (wrap (and (text\= input pre) + (text\= right post))))) (!expect (#try.Success #1))))) (do {! random.monad} [left (random.unicode 1) right (random.unicode 1) - expected (random.filter (|>> (text@= right) not) + expected (random.filter (|>> (text\= right) not) (random.unicode 1))] (_.cover [/.enclosed] (|> (format left expected right) @@ -391,7 +391,7 @@ (|> (list (code.text expected)) (<c>.run (/.embed /.octal <c>.text)) (!expect (^multi (#try.Success actual) - (text@= expected actual)))))) + (text\= expected actual)))))) (do {! random.monad} [invalid (random.ascii/upper-alpha 1) expected (random.filter (|>> (unicode.within? unicode.basic-latin/upper-alpha) diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 10925cb12..729551843 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -7,12 +7,12 @@ ["." try] ["." exception]] [data - ["." name ("#@." equivalence)] + ["." name ("#\." equivalence)] [number ["n" nat]]] [math ["." random (#+ Random)]] - ["." type ("#@." equivalence)]] + ["." type ("#\." equivalence)]] {1 ["." / ["/#" //]]}) @@ -36,7 +36,7 @@ (<| (_.with-cover [/.types-do-not-match]) (do {! random.monad} [expected ..primitive - dummy (random.filter (|>> (type@= expected) not) + dummy (random.filter (|>> (type\= expected) not) ..primitive)]) ($_ _.and (_.cover [/.exactly] @@ -79,9 +79,9 @@ (and (|> (/.run (<parser> ($_ //.and /.any /.any /.any)) (<good-constructor> (list expected-left expected-middle expected-right))) (!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))))) + (and (type\= expected-left actual-left) + (type\= expected-middle actual-middle) + (type\= expected-right actual-right))))) (|> (/.run (<parser> ($_ //.and /.any /.any /.any)) (<bad-constructor> (list expected-left expected-middle expected-right))) (!expect (^multi (#try.Failure error) @@ -95,9 +95,9 @@ (and (|> (/.run (/.function ($_ //.and /.any /.any) /.any) (type.function (list expected-left expected-middle) expected-right)) (!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))))) + (and (type\= expected-left actual-left) + (type\= expected-middle actual-middle) + (type\= expected-right actual-right))))) (|> (/.run (/.function ($_ //.and /.any /.any) /.any) (type.variant (list expected-left expected-middle expected-right))) (!expect (^multi (#try.Failure error) @@ -106,9 +106,9 @@ (and (|> (/.run (/.apply ($_ //.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))))) + (and (type\= expected-left actual-left) + (type\= expected-middle actual-middle) + (type\= expected-right actual-right))))) (|> (/.run (/.apply ($_ //.and /.any /.any /.any)) (type.variant (list expected-left expected-middle expected-right))) (!expect (^multi (#try.Failure error) @@ -125,7 +125,7 @@ (_.cover [/.run /.any] (|> (/.run /.any expected) (!expect (^multi (#try.Success actual) - (type@= expected actual)))))) + (type\= expected actual)))))) (do {! random.monad} [expected ..primitive] (_.cover [/.peek /.unconsumed-input] @@ -135,7 +135,7 @@ (wrap actual)) expected) (!expect (^multi (#try.Success actual) - (type@= expected actual)))) + (type\= expected actual)))) (|> (/.run /.peek expected) (!expect (^multi (#try.Failure error) (exception.match? /.unconsumed-input error))))))) @@ -165,7 +165,7 @@ (is? /.fresh environment)))))) (do {! random.monad} [expected ..primitive - dummy (random.filter (|>> (type@= expected) not) + dummy (random.filter (|>> (type\= expected) not) ..primitive)] (_.cover [/.local] (|> (/.run (do //.monad @@ -174,7 +174,7 @@ /.any)) dummy) (!expect (^multi (#try.Success actual) - (type@= expected actual)))))) + (type\= expected actual)))))) (do {! random.monad} [expected random.nat] (_.cover [/.existential /.not-existential] @@ -190,8 +190,8 @@ (|> (/.run /.named (#.Named expected-name expected-type)) (!expect (^multi (#try.Success [actual-name actual-type]) - (and (name@= expected-name actual-name) - (type@= expected-type actual-type))))))) + (and (name\= expected-name actual-name) + (type\= expected-type actual-type))))))) ..aggregate ..matches ))) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index db7a51d39..70e881cd2 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -7,7 +7,7 @@ ["." try] ["." exception]] [data - ["." text ("#@." equivalence)] + ["." text ("#\." equivalence)] ["." name] [format ["." xml]] @@ -19,10 +19,10 @@ ["." random (#+ Random)]] [macro ["." template]] - ["." type ("#@." equivalence)]] + ["." type ("#\." equivalence)]] {1 ["." / - ["/#" // ("#@." monad)]]}) + ["/#" // ("#\." monad)]]}) (template: (!expect <pattern> <value>) (case <value> @@ -62,9 +62,9 @@ (_.cover [/.run /.text] (|> (/.run /.text (#xml.Text expected)) (!expect (^multi (#try.Success actual) - (text@= expected actual)))))) + (text\= expected actual)))))) (!failure /.unconsumed-inputs - [[(//@wrap expected) + [[(//\wrap expected) (#xml.Text expected)]]) (do {! random.monad} [expected (random.ascii/alpha 1)] diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index f9b261c9f..5de61eed9 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -14,7 +14,7 @@ ["." text ["%" format (#+ format)]]] [math - ["." random (#+ Random) ("#@." monad)]] + ["." random (#+ Random) ("#\." monad)]] [time ["." date (#+ Date)] ["." instant] @@ -27,8 +27,8 @@ ["." /]}) (def: deadline (Random Date) random.date) -(def: message (Random Text) (random@map %.nat random.nat)) -(def: focus (Random Code) (random@map code.text (random.ascii/upper-alpha 10))) +(def: message (Random Text) (random\map %.nat random.nat)) +(def: focus (Random Code) (random\map code.text (random.ascii/upper-alpha 10))) (def: (to-remember macro deadline message focus) (-> Name Date Text (Maybe Code) Code) diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index 30150dc43..070d51888 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -16,7 +16,7 @@ ["." product] [number ["n" nat]] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]]] [math ["." random]]] @@ -49,13 +49,13 @@ ($monad.spec (..injection text.monoid) ..comparison (/.monad text.monoid))) (_.cover [/.write] - (text@= log + (text\= log (product.left (/.write log)))) (_.cover [/.with /.lift] (let [lift (/.lift text.monoid io.monad) - (^open "io@.") io.monad] + (^open "io\.") io.monad] (|> (io.run (do (/.with text.monoid io.monad) - [a (lift (io@wrap left)) + [a (lift (io\wrap left)) b (wrap right)] (wrap (n.+ a b)))) product.right diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index c65567c23..74a295777 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -17,10 +17,11 @@ ["#." sum] ["#." color ["#/." named]] - [format - ["#." json] - ["#." tar] - ["#." xml]] + ["#." format #_ + ["#/." binary] + ["#/." json] + ["#/." tar] + ["#/." xml]] [number ["#." i8] ["#." i16] @@ -51,9 +52,10 @@ (def: format ($_ _.and - /json.test - /tar.test - /xml.test + /format/binary.test + /format/json.test + /format/tar.test + /format/xml.test )) (def: #export test diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 7257a7f7b..1734d80c4 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -8,13 +8,13 @@ [/ ["$." equivalence]]}] [data - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["n" nat]] [collection ["." list]]] [math - ["." random (#+ Random) ("#@." monad)]]] + ["." random (#+ Random) ("#\." monad)]]] {1 ["." / (#+ Set) ["." //]]}) @@ -27,7 +27,7 @@ (All [a] (-> Nat (Order a) (Random a) (Random (Set a)))) (case size 0 - (random@wrap (/.new &order)) + (random\wrap (/.new &order)) _ (do random.monad @@ -48,7 +48,7 @@ random.nat) #let [listL (//.to-list usetL)] listR (|> (random.set n.hash sizeR random.nat) (:: ! map //.to-list)) - #let [(^open "/@.") /.equivalence + #let [(^open "/\.") /.equivalence setL (/.from-list n.order listL) setR (/.from-list n.order listR) empty (/.new n.order)]] @@ -59,7 +59,7 @@ (_.cover [/.size] (n.= sizeL (/.size setL))) (_.cover [/.empty?] - (bit@= (n.= 0 (/.size setL)) + (bit\= (n.= 0 (/.size setL)) (/.empty? setL))) (_.cover [/.new] (/.empty? (/.new n.order))) @@ -70,7 +70,7 @@ (_.cover [/.from-list] (|> setL /.to-list (/.from-list n.order) - (/@= setL))) + (/\= setL))) (~~ (template [<coverage> <comparison>] [(_.cover [<coverage>] (case (<coverage> setL) @@ -118,7 +118,7 @@ (/.super? empty setL) symmetry! - (bit@= (/.super? setL setR) + (bit\= (/.super? setL setR) (/.sub? setR setL))] (and self! empty! diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index a0dfabb54..7c93fb0c1 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -4,8 +4,8 @@ [abstract [monad (#+ do)]] [data - ["." maybe ("#@." functor)] - ["." text ("#@." equivalence monoid)] + ["." maybe ("#\." functor)] + ["." text ("#\." equivalence monoid)] [number ["n" nat]]] [math @@ -29,7 +29,7 @@ (_.with-cover [/.Tree]) (do {! random.monad} [tag-left (random.ascii/alpha-num 1) - tag-right (random.filter (|>> (text@= tag-left) not) + tag-right (random.filter (|>> (text\= tag-left) not) (random.ascii/alpha-num 1)) expected-left random.nat expected-right random.nat] @@ -38,9 +38,9 @@ (exec (/.builder text.monoid) true)) (_.cover [/.tag] - (and (text@= tag-left + (and (text\= tag-left (/.tag (:: ..builder leaf tag-left expected-left))) - (text@= (text@compose tag-left tag-right) + (text\= (text\compose tag-left tag-right) (/.tag (:: ..builder branch (:: ..builder leaf tag-left expected-left) (:: ..builder leaf tag-right expected-right)))))) @@ -77,13 +77,13 @@ (let [can-find-correct-one! (|> (:: ..builder leaf tag-left expected-left) (/.search (text.contains? tag-left)) - (maybe@map (n.= expected-left)) + (maybe\map (n.= expected-left)) (maybe.default false)) cannot-find-incorrect-one! (|> (:: ..builder leaf tag-right expected-right) (/.search (text.contains? tag-left)) - (maybe@map (n.= expected-left)) + (maybe\map (n.= expected-left)) (maybe.default false) not) @@ -92,7 +92,7 @@ (:: ..builder leaf tag-left expected-left) (:: ..builder leaf tag-right expected-right)) (/.search (text.contains? tag-left)) - (maybe@map (n.= expected-left)) + (maybe\map (n.= expected-left)) (maybe.default false)) can-find-right! @@ -100,7 +100,7 @@ (:: ..builder leaf tag-left expected-left) (:: ..builder leaf tag-right expected-right)) (/.search (text.contains? tag-right)) - (maybe@map (n.= expected-right)) + (maybe\map (n.= expected-right)) (maybe.default false))] (and can-find-correct-one! cannot-find-incorrect-one! diff --git a/stdlib/source/test/lux/data/format/binary.lux b/stdlib/source/test/lux/data/format/binary.lux new file mode 100644 index 000000000..9b00113f0 --- /dev/null +++ b/stdlib/source/test/lux/data/format/binary.lux @@ -0,0 +1,35 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [equivalence (#+ Equivalence)] + [monad (#+ do)] + {[0 #spec] + [/ + ["$." monoid]]}] + [data + ["." binary ("#\." equivalence)]] + [math + ["." random (#+ Random)]]] + {1 + ["." /]}) + +(structure: equivalence + (Equivalence /.Specification) + + (def: (= reference subject) + (binary\= (/.instance reference) + (/.instance subject)))) + +(def: random + (Random /.Specification) + (:: random.monad map /.nat random.nat)) + +(def: #export test + Test + (<| (_.covering /._) + (_.with-cover [/.Mutation /.Specification /.Writer]) + ($_ _.and + (_.with-cover [/.monoid] + ($monoid.spec ..equivalence /.monoid ..random)) + ))) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 0e274a6e6..9c83040fa 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -11,8 +11,8 @@ [data ["." product] ["." maybe] - ["." binary ("#@." equivalence)] - ["." text ("#@." equivalence) + ["." binary ("#\." equivalence)] + ["." text ("#\." equivalence) ["." encoding] ["." unicode] ["%" format (#+ format)]] @@ -21,7 +21,7 @@ ["i" int]] [collection ["." row] - ["." list ("#@." fold)]] + ["." list ("#\." fold)]] ["." format #_ ["#" binary]]] [time @@ -44,7 +44,7 @@ (_.cover [/.path /.from-path] (case (/.path expected) (#try.Success actual) - (text@= expected + (text\= expected (/.from-path actual)) (#try.Failure error) @@ -77,7 +77,7 @@ (_.cover [/.name /.from-name] (case (/.name expected) (#try.Success actual) - (text@= expected + (text\= expected (/.from-name actual)) (#try.Failure error) @@ -170,7 +170,7 @@ (<b>.run /.parser))] (wrap (case (row.to-list tar) (^ (list (<tag> actual-path))) - (text@= (/.from-path expected-path) + (text\= (/.from-path expected-path) (/.from-path actual-path)) _ @@ -201,11 +201,11 @@ (^ (list (<tag> [actual-path actual-moment actual-mode actual-ownership actual-content]))) (let [seconds (: (-> Instant Int) (|>> instant.relative (duration.query duration.second)))] - (and (text@= (/.from-path expected-path) + (and (text\= (/.from-path expected-path) (/.from-path actual-path)) (i.= (seconds expected-moment) (seconds actual-moment)) - (binary@= (/.data expected-content) + (binary\= (/.data expected-content) (/.data actual-content)))) _ @@ -239,7 +239,7 @@ (do {! random.monad} [path (random.ascii/lower-alpha 10) modes (random.list 4 ..random-mode) - #let [expected-mode (list@fold /.and /.none modes)]] + #let [expected-mode (list\fold /.and /.none modes)]] (`` ($_ _.and (_.cover [/.and] (|> (do try.monad @@ -347,9 +347,9 @@ (<b>.run /.parser))] (wrap (case (row.to-list tar) (^ (list (#/.Normal [_ _ _ actual-ownership _]))) - (and (text@= (/.from-name expected) + (and (text\= (/.from-name expected) (/.from-name (get@ [#/.user #/.name] actual-ownership))) - (text@= (/.from-name /.anonymous) + (text\= (/.from-name /.anonymous) (/.from-name (get@ [#/.group #/.name] actual-ownership)))) _ @@ -371,11 +371,11 @@ (<b>.run /.parser))] (wrap (case (row.to-list tar) (^ (list (#/.Normal [_ _ _ actual-ownership _]))) - (and (text@= (/.from-name /.anonymous) + (and (text\= (/.from-name /.anonymous) (/.from-name (get@ [#/.user #/.name] actual-ownership))) (n.= (/.from-small /.no-id) (/.from-small (get@ [#/.user #/.id] actual-ownership))) - (text@= (/.from-name /.anonymous) + (text\= (/.from-name /.anonymous) (/.from-name (get@ [#/.group #/.name] actual-ownership))) (n.= (/.from-small /.no-id) (/.from-small (get@ [#/.group #/.id] actual-ownership)))) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index e0a1a5c05..531326d92 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -16,14 +16,14 @@ [data ["." name] ["." maybe] - ["." text ("#@." equivalence)] + ["." text ("#\." equivalence)] [number ["n" nat]] [collection ["." dictionary] - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math - ["r" random (#+ Random) ("#@." monad)]]] + ["r" random (#+ Random) ("#\." monad)]]] {1 ["." / (#+ XML)]}) @@ -42,7 +42,7 @@ (def: (size bottom top) (-> Nat Nat (Random Nat)) (let [constraint (|>> (n.% top) (n.max bottom))] - (r@map constraint r.nat))) + (r\map constraint r.nat))) (def: (text bottom top) (-> Nat Nat (Random Text)) @@ -82,21 +82,21 @@ value (..text 1 10) #let [node (#/.Node tag (dictionary.put attribute value /.attrs) - (list@map (|>> #/.Text) children))]] + (list\map (|>> #/.Text) children))]] ($_ _.and (_.test "Can parse text." (E.default #0 (do E.monad [output (</>.run </>.text (#/.Text text))] - (wrap (text@= text output))))) + (wrap (text\= text output))))) (_.test "Can parse attributes." (E.default #0 (do E.monad [output (</>.run (p.before </>.ignore (</>.attribute attribute)) node)] - (wrap (text@= value output))))) + (wrap (text\= value output))))) (_.test "Can parse nodes." (E.default #0 (do E.monad diff --git a/stdlib/source/test/lux/data/identity.lux b/stdlib/source/test/lux/data/identity.lux index cc2ccf096..4601aaf0b 100644 --- a/stdlib/source/test/lux/data/identity.lux +++ b/stdlib/source/test/lux/data/identity.lux @@ -2,19 +2,13 @@ [lux #* ["_" test (#+ Test)] [abstract - [equivalence (#+)] - [functor (#+)] - comonad [monad (#+ do)] {[0 #spec] [/ ["$." functor (#+ Injection Comparison)] ["$." apply] ["$." monad] - ["$." comonad]]}] - [data - ["." text ("#@." monoid equivalence) - ["%" format (#+ format)]]]] + ["$." comonad]]}]] {1 ["." / (#+ Identity)]}) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index bef97b853..83d2cfcc4 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -11,7 +11,7 @@ ["s" code]]] [data [number (#+ hex)] - ["." text ("#@." equivalence)]] + ["." text ("#\." equivalence)]] [math ["r" random]] ["." meta] @@ -25,7 +25,7 @@ (|> input (<text>.run regex) (case> (#try.Success parsed) - (text@= parsed input) + (text\= parsed input) _ #0))) @@ -35,7 +35,7 @@ (|> input (<text>.run regex) (case> (#try.Success parsed) - (text@= test parsed) + (text\= test parsed) _ false))) @@ -283,9 +283,9 @@ (/.^regex "(.{3})-(.{3})-(.{4})" [_ match1 match2 match3]) (_.test "Can pattern-match using regular-expressions." - (and (text@= sample1 match1) - (text@= sample2 match2) - (text@= sample3 match3))) + (and (text\= sample1 match1) + (text\= sample2 match2) + (text\= sample3 match3))) _ (_.test "Cannot pattern-match using regular-expressions." diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 154cb8ea2..f5ba58758 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -12,7 +12,7 @@ ["<a>" analysis] ["<s>" synthesis]]] [data - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection ["." row]]] @@ -99,7 +99,7 @@ [(_.cover [<macro>] (for {@.old false} - (text@= (`` ((~~ (static <extension>)))) + (text\= (`` ((~~ (static <extension>)))) <extension>)))] [/.analysis: ..my-analysis] diff --git a/stdlib/source/test/lux/host.old.lux b/stdlib/source/test/lux/host.old.lux index e0f2a3757..fdb5d0c30 100644 --- a/stdlib/source/test/lux/host.old.lux +++ b/stdlib/source/test/lux/host.old.lux @@ -20,17 +20,20 @@ (import: java/lang/String) (import: java/lang/Exception - (new [java/lang/String])) + ["#::." + (new [java/lang/String])]) (import: java/lang/Runnable) (import: (java/lang/Class a) - (getName [] java/lang/String)) + ["#::." + (getName [] java/lang/String)]) (import: java/lang/System - (#static out java/io/PrintStream) - (#static currentTimeMillis [] #io long) - (#static getenv [java/lang/String] #io #? java/lang/String)) + ["#::." + (#static out java/io/PrintStream) + (#static currentTimeMillis [] #io long) + (#static getenv [java/lang/String] #io #? java/lang/String)]) (class: #final (TestClass A) [java/lang/Runnable] ## Fields diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 2fbfc92b9..be11f3f6e 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -12,14 +12,14 @@ ["." atom]]] [data ["." maybe] - ["." bit ("#@." equivalence)] + ["." bit ("#\." equivalence)] [number ["." i32 (#+ I32)] ["." i64] ["n" nat] ["i" int] ["f" frac]] - ["." text ("#@." equivalence) + ["." text ("#\." equivalence) ["%" format (#+ format)]] ["." format #_ ["#" binary]] @@ -28,15 +28,15 @@ ["." dictionary] ["." row] ["." set] - ["." list ("#@." functor)]]] + ["." list ("#\." functor)]]] [math - ["." random (#+ Random) ("#@." monad)]] + ["." random (#+ Random) ("#\." monad)]] ["_" test (#+ Test)]] {1 ["." / #_ ["#." loader (#+ Library)] ["#." version] - ["#." modifier ("#@." monoid)] + ["#." modifier ("#\." monoid)] ["#." field] ["#." method (#+ Method)] ["#." class] @@ -54,7 +54,7 @@ ["." category (#+ Value Object Class)]]]}) (def: method-modifier - ($_ /modifier@compose + ($_ /modifier\compose /method.public /method.static)) @@ -65,19 +65,23 @@ (import: java/lang/Long) (import: java/lang/Float) (import: java/lang/Double - (#static compare [double double] int)) + ["#::." + (#static compare [double double] int)]) (import: java/lang/Character) (import: java/lang/String) (import: java/lang/reflect/Method - (invoke [java/lang/Object [java/lang/Object]] #try java/lang/Object)) + ["#::." + (invoke [java/lang/Object [java/lang/Object]] #try java/lang/Object)]) (import: (java/lang/Class c) - (getDeclaredMethod [java/lang/String [(java/lang/Class [? < java/lang/Object])]] java/lang/reflect/Method)) + ["#::." + (getDeclaredMethod [java/lang/String [(java/lang/Class [? < java/lang/Object])]] java/lang/reflect/Method)]) (import: java/lang/Object - (getClass [] (java/lang/Class java/lang/Object)) - (toString [] java/lang/String)) + ["#::." + (getClass [] (java/lang/Class java/lang/Object)) + (toString [] java/lang/String)]) (def: class-name (Random Text) @@ -795,7 +799,7 @@ (<| (_.lift "INVOKEVIRTUAL") (do random.monad [expected ..$Double::random]) - (..bytecode (|>> (:coerce Bit) (bit@= (f.not-a-number? (:coerce Frac expected))))) + (..bytecode (|>> (:coerce Bit) (bit\= (f.not-a-number? (:coerce Frac expected))))) (do /.monad [_ (/.double (:coerce Frac expected)) _ ..$Double::wrap @@ -864,7 +868,7 @@ _ /.lload-1 _ (/.putfield $Self object-field /type.long)] /.return))) - (/method.method ($_ /modifier@compose + (/method.method ($_ /modifier\compose /method.public /method.static) static-method @@ -948,7 +952,7 @@ ($_ _.and (_.context "boolean" (array (/.newarray /instruction.t-boolean) $Boolean::random $Boolean::literal [/.bastore /.baload $Boolean::wrap] - (function (_ expected) (|>> (:coerce Bit) (bit@= (:coerce Bit expected)))))) + (function (_ expected) (|>> (:coerce Bit) (bit\= (:coerce Bit expected)))))) (_.context "byte" (array (/.newarray /instruction.t-byte) $Byte::random $Byte::literal [/.bastore /.baload $Byte::wrap] (function (_ expected) @@ -1007,7 +1011,7 @@ (|>> (:coerce java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (:coerce java/lang/Character expected))))})))) (_.context "object" (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop] - (function (_ expected) (|>> (:coerce Text) (text@= (:coerce Text expected)))))) + (function (_ expected) (|>> (:coerce Text) (text\= (:coerce Text expected)))))) (<| (_.context "multi") (do {! random.monad} [#let [size (:: ! map (|>> (n.% 5) (n.+ 1)) @@ -1210,7 +1214,7 @@ (<| (_.context "object") (let [test (: (-> java/lang/String Any Bit) (function (_ expected actual) - (|> actual (:coerce Text) (text@= (:coerce Text expected)))))] + (|> actual (:coerce Text) (text\= (:coerce Text expected)))))] ($_ _.and (_.lift "ASTORE_0/ALOAD_0" (store-and-load ..$String::random ..$String::literal /.nop [(function.constant /.astore-0) (function.constant /.aload-0)] test)) @@ -1229,7 +1233,7 @@ (do random.monad [expected/1 $String::random #let [object-test (: (-> Any Bit) - (|>> (:coerce Text) (text@= (:coerce Text expected/1))))] + (|>> (:coerce Text) (text\= (:coerce Text expected/1))))] dummy/1 $String::random #let [single ($_ _.and (<| (_.lift "DUP & POP") @@ -1318,7 +1322,7 @@ primitive-method-name (random.ascii/upper-alpha 10) #let [primitive-method-type (/type.method [(list) (get@ #unboxed primitive) (list)])] object-method-name (|> (random.ascii/upper-alpha 10) - (random.filter (|>> (text@= primitive-method-name) not))) + (random.filter (|>> (text\= primitive-method-name) not))) expected (get@ #random primitive) #let [$Self (/type.class class-name (list))]] (wrap (case (do try.monad @@ -1366,7 +1370,7 @@ (_.lift "LRETURN" (primitive-return ..$Long::primitive /.lreturn #.None (!::= java/lang/Long "jvm leq" "jvm long ="))) (_.lift "FRETURN" (primitive-return ..$Float::primitive /.freturn #.None (!::= java/lang/Float "jvm feq" "jvm float ="))) (_.lift "DRETURN" (primitive-return ..$Double::primitive /.dreturn #.None (!::= java/lang/Double "jvm deq" "jvm double ="))) - (_.lift "ARETURN" (primitive-return ..$String::primitive /.areturn #.None (function (_ expected actual) (text@= (:coerce Text expected) (:coerce Text actual))))) + (_.lift "ARETURN" (primitive-return ..$String::primitive /.areturn #.None (function (_ expected actual) (text\= (:coerce Text expected) (:coerce Text actual))))) (_.lift "RETURN" (primitive-return (: (Primitive java/lang/String) {#unboxed /type.void #boxed ..$String @@ -1375,7 +1379,7 @@ #literal (function.constant /.nop)}) /.return (#.Some ..$String::literal) - (function (_ expected actual) (text@= (:coerce Text expected) (:coerce Text actual))))) + (function (_ expected actual) (text\= (:coerce Text expected) (:coerce Text actual))))) ))) (def: branching @@ -1506,7 +1510,7 @@ @wrong /.new-label @return /.new-label _ (..$Integer::literal (host.long-to-int (:coerce java/lang/Long choice))) - _ (/.lookupswitch @wrong (list@map (function (_ option) + _ (/.lookupswitch @wrong (list\map (function (_ option) [(|> option /signed.s4 try.assume) (if (i.= choice option) @right @wrong)]) options)) @@ -1580,11 +1584,11 @@ (do random.monad [abstract-class ..class-name interface-class (|> ..class-name - (random.filter (|>> (text@= abstract-class) not))) + (random.filter (|>> (text\= abstract-class) not))) concrete-class (|> ..class-name (random.filter (function (_ class) - (not (or (text@= abstract-class class) - (text@= interface-class class)))))) + (not (or (text\= abstract-class class) + (text\= interface-class class)))))) part0 ..$Long::random part1 ..$Long::random part2 ..$Long::random @@ -1621,17 +1625,17 @@ [_ (..$Long::literal value)] /.lreturn))))) - interface-bytecode (|> (/class.class /version.v6_0 ($_ /modifier@compose /class.public /class.abstract /class.interface) + interface-bytecode (|> (/class.class /version.v6_0 ($_ /modifier\compose /class.public /class.abstract /class.interface) (/name.internal interface-class) (/name.internal "java.lang.Object") (list) (list) - (list (/method.method ($_ /modifier@compose /method.public /method.abstract) + (list (/method.method ($_ /modifier\compose /method.public /method.abstract) interface-method method::type (list) #.None)) (row.row)) try.assume (format.run /class.writer)) - abstract-bytecode (|> (/class.class /version.v6_0 ($_ /modifier@compose /class.public /class.abstract) + abstract-bytecode (|> (/class.class /version.v6_0 ($_ /modifier\compose /class.public /class.abstract) (/name.internal abstract-class) (/name.internal "java.lang.Object") (list) @@ -1646,7 +1650,7 @@ /.return))) (method inherited-method part0) (method overriden-method fake-part2) - (/method.method ($_ /modifier@compose /method.public /method.abstract) + (/method.method ($_ /modifier\compose /method.public /method.abstract) abstract-method method::type (list) #.None)) (row.row)) try.assume @@ -1673,7 +1677,7 @@ (method overriden-method part2) (method abstract-method part3) (method interface-method part4) - (/method.method ($_ /modifier@compose + (/method.method ($_ /modifier\compose /method.public /method.static) static-method diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux index a01bdb929..e7aa38aa1 100644 --- a/stdlib/source/test/lux/world.lux +++ b/stdlib/source/test/lux/world.lux @@ -2,6 +2,7 @@ [lux #* ["_" test (#+ Test)]] ["." / #_ + ["#." environment] ["#." file] ["#." shell] ["#." console]]) @@ -9,6 +10,7 @@ (def: #export test Test ($_ _.and + /environment.test /file.test /shell.test /console.test diff --git a/stdlib/source/test/lux/world/environment.lux b/stdlib/source/test/lux/world/environment.lux new file mode 100644 index 000000000..2ab284132 --- /dev/null +++ b/stdlib/source/test/lux/world/environment.lux @@ -0,0 +1,31 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + [concurrency + ["." promise]]] + [data + ["." text] + [collection + ["." dictionary] + ["." list]]] + [math + ["." random]]] + {1 + ["." /]}) + +(def: #export test + Test + (<| (_.covering /._) + (_.with-cover [/.Environment /.Property]) + (do random.monad + [_ (wrap [])] + (wrap (do promise.monad + [environment (promise.future /.read)] + (_.claim [/.read] + (and (not (dictionary.empty? environment)) + (|> environment + dictionary.keys + (list.every? (|>> text.empty? not)))))))))) diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 55cfe94bc..fa1edcfe8 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -1,7 +1,7 @@ (.module: [lux #* ["%" data/text/format (#+ format)] - ["r" math/random (#+ Random) ("#@." monad)] + ["r" math/random (#+ Random) ("#\." monad)] ["_" test (#+ Test)] [abstract/monad (#+ do)] [control @@ -34,7 +34,7 @@ (def: (creation-and-deletion number) (-> Nat Test) - (r@wrap (do promise.monad + (r\wrap (do promise.monad [#let [path (format "temp_file_" (%.nat number))] result (promise.future (do (try.with io.monad) @@ -53,7 +53,7 @@ (def: (read-and-write number data) (-> Nat Binary Test) - (r@wrap (do promise.monad + (r\wrap (do promise.monad [#let [path (format "temp_file_" (%.nat number))] result (promise.future (do (try.with io.monad) |