diff options
Diffstat (limited to '')
79 files changed, 1474 insertions, 1389 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index bd30cf30e..751655065 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -26,6 +26,7 @@ ["[0]" plist]]]] ["[0]" macro [syntax {"+" syntax:}] + ["^" pattern] ["[0]" code ("[1]#[0]" equivalence)] ["[0]" template]] ["[0]" math @@ -172,7 +173,7 @@ ($_ _.and (_.cover [/.list] (case (/.list e/0 e/1) - (^ (/.list a/0 a/1)) + (pattern (/.list a/0 a/1)) (and (n.= e/0 a/0) (n.= e/1 a/1)) @@ -180,7 +181,7 @@ false)) (_.cover [/.list&] (case (/.list& e/0 e/1 (/.list e/2 e/3)) - (^ (/.list& a/0 a/1 (/.list a/2 a/3))) + (pattern (/.list& a/0 a/1 (/.list a/2 a/3))) (and (n.= e/0 a/0) (n.= e/1 a/1) (n.= e/2 a/2) @@ -221,8 +222,8 @@ (n.= expected (# local_returner return []))) (_.cover [/.open:] (n.= static_return (global#return []))) - (_.cover [/.^open] - (let [(/.^open "local#[0]") local_returner] + (_.cover [/.open] + (let [(/.open "local#[0]") local_returner] (n.= expected (local#return [])))) (_.cover [/.#] (n.= expected (/.# local_returner return []))) @@ -455,15 +456,15 @@ (function (_ _) ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. (`` (for @.python (case (' [<input>']) - (^code [<module> - ("lux def" (~ [_ {.#Symbol ["" _]}]) [] #0) - (~~ (template.spliced <referrals>))]) + (^.` [<module> + ("lux def" (~ [_ {.#Symbol ["" _]}]) [] #0) + (~~ (template.spliced <referrals>))]) true _ false) (case (' [<input>']) - (^code [<module> (~~ (template.spliced <referrals>))]) + (^.` [<module> (~~ (template.spliced <referrals>))]) true _ @@ -588,7 +589,7 @@ (same? /.Nat (/.:of expected))) (_.cover [/.Primitive] (case (/.Primitive "foo" [expected/0 expected/1]) - (^ {.#Primitive "foo" (list actual/0 actual/1)}) + (pattern {.#Primitive "foo" (list actual/0 actual/1)}) (and (same? expected/0 actual/0) (same? expected/1 actual/1)) @@ -704,16 +705,6 @@ (_.cover [/.template:] (n.= (n.+ left right) (!n/+ left right)))) - (do [! random.monad] - [sample (# ! each (n.% 5) random.nat)] - (_.cover [/.^template] - (case sample - (/.^template [<case>] - [<case> true]) - ([0] [1] [2] [3] [4]) - - _ - false))) ))) (def: option/0 "0") @@ -728,8 +719,8 @@ ($_ _.and (_.cover [/.static] (case sample - (^ (/.static option/0)) true - (^ (/.static option/1)) true + (pattern (/.static option/0)) true + (pattern (/.static option/1)) true _ false)) (_.cover [/.char] (|> (`` (/.char (~~ (/.static static_char)))) @@ -1028,55 +1019,9 @@ {.#Right +0} true _ false) )) - (_.cover [/.^or] - (and (/.case expected_rev - (/.^or .5 .25) true - _ false) - (/.case expected_frac - (/.^or +0.5 +1.25) true - _ false) - (/.case expected_text - (/.^or "+0.5" "+1.25") true - _ false))) - (_.cover [/.^] + (_.cover [/.pattern] (/.case [..#left expected_nat ..#right expected_int] - (/.^ (!pair 0 +0)) true - _ false)) - (_.cover [/.^let] - (let [expected_pair (: (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] - (/.case expected_pair - (/.^let actual_pair (/.^ (!pair actual_left actual_right))) - (and (/.same? expected_pair actual_pair) - (/.same? expected_nat actual_left) - (/.same? expected_int actual_right))))) - (_.cover [/.^multi] - (let [expected_pair (: (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] - (and (/.case expected_pair - (/.^multi (/.^ (!pair 0 actual_right)) - [actual_right - +0]) - true - - _ - false) - (/.case expected_pair - (/.^multi (/.^ (!pair 0 actual_right)) - (i.= +0 actual_right)) - true - - _ - false)))) - (_.cover [/.^|>] - (case expected_frac - (/.^|> actual_frac [(f.* +2.0) (f.* +2.0)]) - (f.= (f.* +4.0 expected_frac) - actual_frac))) - (_.cover [/.^code] - (case (code.text expected_text) - (/.^code "+0.5") true - (/.^code "+1.25") true + (/.pattern (!pair 0 +0)) true _ false)) (_.cover [/.let] (and (/.let [actual_nat expected_nat] @@ -1193,7 +1138,7 @@ let/3 <code>.local_symbol]) (in (list (code.bit (case (the .#scopes *lux*) - (^ (list& scope/2 _)) + (pattern (list& scope/2 _)) (let [locals/2 (the .#locals scope/2) expected_locals/2 (set.of_list text.hash (list fn/2 var/2 let/2 let/3)) diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux index 1ff97f5b6..ad0bb0250 100644 --- a/stdlib/source/test/lux/abstract/apply.lux +++ b/stdlib/source/test/lux/abstract/apply.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat]]] - ["_" test {"+" Test}]]] - [\\library - ["[0]" / {"+" Apply}]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random] + [number + ["n" nat]]] + ["_" test {"+" Test}]]] + [\\library + ["[0]" / {"+" Apply}]]) (def: .public test Test @@ -28,7 +28,7 @@ (case (# (/.composite maybe.monad maybe.apply list.apply) on {.#Some (list right)} {.#Some (list (n.+ left))}) - (^ {.#Some (list actual)}) + (pattern {.#Some (list actual)}) (n.= expected actual) _ diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux index b4b333f13..541c88971 100644 --- a/stdlib/source/test/lux/abstract/functor.lux +++ b/stdlib/source/test/lux/abstract/functor.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Functor}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Functor}]]) (def: .public test Test @@ -36,7 +36,7 @@ (case (# (/.sum maybe.functor list.functor) each (n.+ shift) {.#Right (list right)}) - (^ {.#Right (list actual)}) + (pattern {.#Right (list actual)}) (n.= (n.+ shift right) actual) _ @@ -45,7 +45,7 @@ (case (# (/.product maybe.functor list.functor) each (n.+ shift) [{.#Some left} (list right)]) - (^ [{.#Some actualL} (list actualR)]) + (pattern [{.#Some actualL} (list actualR)]) (and (n.= (n.+ shift left) actualL) (n.= (n.+ shift right) actualR)) @@ -55,7 +55,7 @@ (case (# (/.composite maybe.functor list.functor) each (n.+ shift) {.#Some (list left)}) - (^ {.#Some (list actual)}) + (pattern {.#Some (list actual)}) (n.= (n.+ shift left) actual) _ diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux index 198babcda..635476226 100644 --- a/stdlib/source/test/lux/abstract/hash.lux +++ b/stdlib/source/test/lux/abstract/hash.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - [functor - ["$[0]" contravariant]]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)]] - [math - ["[0]" random] - [number - ["[0]" nat]]]]] - [\\library - ["[0]" / {"+" Hash} - [// - [equivalence {"+" Equivalence}]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + [functor + ["$[0]" contravariant]]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [math + ["[0]" random] + [number + ["[0]" nat]]]]] + [\\library + ["[0]" / {"+" Hash} + [// + [equivalence {"+" Equivalence}]]]]) (def: .public test Test @@ -25,7 +25,7 @@ rightN random.nat .let [hash (: (Equivalence (/.Hash Nat)) (implementation - (def: (= (^open "left#[0]") (^open "right#[0]")) + (def: (= (open "left#[0]") (open "right#[0]")) (and (bit#= (left#= (left#hash leftN) (left#hash leftN)) (right#= (right#hash leftN) (right#hash leftN))) (bit#= (left#= (left#hash rightN) (left#hash rightN)) diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index a9dfc2572..f2b0d2713 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -142,7 +142,7 @@ (# ! each (|>> set.list (list.sorted n.<) (pipe.case - (^ (list b t1 t2)) + (pattern (list b t1 t2)) [b t1 t2] _ @@ -165,7 +165,7 @@ (# ! each (|>> set.list (list.sorted n.<) (pipe.case - (^ (list b t1 t2)) + (pattern (list b t1 t2)) [b t1 t2] _ @@ -193,7 +193,7 @@ (# ! each (|>> set.list (list.sorted n.<) (pipe.case - (^ (list x0 x1 x2 x3)) + (pattern (list x0 x1 x2 x3)) [x0 x1 x2 x3] _ @@ -227,7 +227,7 @@ (# ! each (|>> set.list (list.sorted n.<) (pipe.case - (^ (list x0 x1 x2 x3)) + (pattern (list x0 x1 x2 x3)) [x0 x1 x2 x3] _ diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index cec359f0e..5f96bbe35 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -1,29 +1,29 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["[0]" io {"+" IO io}]] - [data - [text - ["%" format {"+" format}]] - [collection - ["[0]" list] - ["[0]" sequence {"+" Sequence}]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" actor: message:} - [// - ["[0]" atom {"+" Atom}] - ["[0]" async {"+" Async Resolver} ("[1]#[0]" monad)] - ["[0]" frp]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + ["[0]" io {"+" IO io}]] + [data + [text + ["%" format {"+" format}]] + [collection + ["[0]" list] + ["[0]" sequence {"+" Sequence}]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" actor: message:} + [// + ["[0]" atom {"+" Atom}] + ["[0]" async {"+" Async Resolver} ("[1]#[0]" monad)] + ["[0]" frp]]]]) (exception: got_wrecked) @@ -145,7 +145,7 @@ (in {try.#Success [actor sent? alive? obituary]})))] (_.cover' [/.Obituary /.obituary'] (case result - (^ {try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]}) + (pattern {try.#Success [actor sent? alive? {.#Some [error state (list single_pending_message)]}]}) (and (..mailed? sent?) (not alive?) (exception.match? ..got_wrecked error) @@ -187,7 +187,7 @@ (..mailed? sent/--?) (..mailed? poisoned?) (case obituary - (^ {.#Some [error final_state (list poison_pill)]}) + (pattern {.#Some [error final_state (list poison_pill)]}) (and (exception.match? /.poisoned error) (n.= (++ (++ initial_state)) final_state)) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 7b564d904..c7b5922f3 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -65,7 +65,7 @@ (def: .public test Test (<| (_.covering /._) - (let [(^open "list#[0]") (list.equivalence n.equivalence)] + (let [(open "list#[0]") (list.equivalence n.equivalence)] (do [! random.monad] [inputs (random.list 5 random.nat) sample random.nat diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index ca5cc1c2a..6514b1332 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: injection (All (_ o) (Injection (All (_ i) (/.Cont i o)))) @@ -32,8 +32,8 @@ (<| (_.covering /._) (do random.monad [sample random.nat - .let [(^open "_#[0]") /.apply - (^open "_#[0]") /.monad] + .let [(open "_#[0]") /.apply + (open "_#[0]") /.monad] elems (random.list 3 random.nat)]) (_.for [/.Cont]) ($_ _.and @@ -66,8 +66,8 @@ (restart [(n.+ 10 output) (++ idx)]) (in output)))))) (_.cover [/.shift /.reset] - (let [(^open "_#[0]") /.monad - (^open "list#[0]") (list.equivalence n.equivalence) + (let [(open "_#[0]") /.monad + (open "list#[0]") (list.equivalence n.equivalence) visit (: (-> (List Nat) (/.Cont (List Nat) (List Nat))) (function (visit xs) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index b85135c9c..b36688fbb 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -1,29 +1,31 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" io {"+" IO}] - ["[0]" state {"+" State} ("[1]#[0]" monad)]] - [data - ["[0]" product] - [collection - ["[0]" dictionary {"+" Dictionary}] - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - ["[0]" random] - [number - ["n" nat] - ["[0]" i64]]] - [time - ["[0]" instant] - ["[0]" duration {"+" Duration}]]]] - [\\library - ["[0]" / - ["/[1]" // "_" - ["[1]" mixin]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" io {"+" IO}] + ["[0]" state {"+" State} ("[1]#[0]" monad)]] + [data + ["[0]" product] + [collection + ["[0]" dictionary {"+" Dictionary}] + ["[0]" list ("[1]#[0]" functor mix)]]] + [macro + ["^" pattern]] + [math + ["[0]" random] + [number + ["n" nat] + ["[0]" i64]]] + [time + ["[0]" instant] + ["[0]" duration {"+" Duration}]]]] + [\\library + ["[0]" / + ["/[1]" // "_" + ["[1]" mixin]]]]) (def: (fibonacci again input) (/.Memo Nat Nat) @@ -106,7 +108,7 @@ (: (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) (function (factorial delegate again input) (case input - (^or 0 1) (# state.monad in 1) + (^.or 0 1) (# state.monad in 1) _ (do state.monad [output' (again (-- input))] (in (n.* input output'))))))) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 948d6885b..7ec7c8c09 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -1,25 +1,27 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [equivalence {"+" Equivalence}] - [predicate {"+" Predicate}] - [monad {"+" do}] - [\\specification - ["$[0]" monoid]]] - [control - ["[0]" state {"+" State}]] - [data - ["[0]" product] - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [equivalence {"+" Equivalence}] + [predicate {"+" Predicate}] + [monad {"+" do}] + [\\specification + ["$[0]" monoid]]] + [control + ["[0]" state {"+" State}]] + [data + ["[0]" product] + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + [macro + ["^" pattern]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -51,7 +53,7 @@ (let [factorial (/.fixed (function (_ delegate again input) (case input - (^or 0 1) 1 + (^.or 0 1) 1 _ (n.* input (again (-- input))))))] (n.= expected (factorial input)))) @@ -59,7 +61,7 @@ (let [bottom (: (/.Mixin Nat Nat) (function (_ delegate again input) (case input - (^or 0 1) 1 + (^.or 0 1) 1 _ (delegate input)))) multiplication (: (/.Mixin Nat Nat) (function (_ delegate again input) @@ -71,7 +73,7 @@ (let [loop (: (/.Mixin Nat Nat) (function (_ delegate again input) (case input - (^or 0 1) 1 + (^.or 0 1) 1 _ (n.* input (delegate (-- input)))))) left (/.fixed (/.mixed /.nothing loop)) right (/.fixed (/.mixed loop /.nothing))] @@ -86,7 +88,7 @@ bottom? (: (Predicate Nat) (function (_ input) (case input - (^or 0 1) true + (^.or 0 1) true _ false))) multiplication (: (/.Mixin Nat Nat) (function (_ delegate again input) @@ -128,7 +130,7 @@ (/.of_recursive (function (_ again input) (case input - (^or 0 1) 1 + (^.or 0 1) 1 _ (n.* input (again (-- input)))))))] (n.= expected (factorial input))))) diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux index cc78de46f..8955a580d 100644 --- a/stdlib/source/test/lux/control/lazy.lux +++ b/stdlib/source/test/lux/control/lazy.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad] - ["$[0]" equivalence]]] - [data - ["[0]" product]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Lazy}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad] + ["$[0]" equivalence]]] + [data + ["[0]" product]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Lazy}]]) (def: injection (Injection Lazy) @@ -54,7 +54,7 @@ (_.cover [/.lazy] (let [lazy (/.lazy <eager>) - (^open "_#=") (product.equivalence n.equivalence n.equivalence)] + (open "_#=") (product.equivalence n.equivalence n.equivalence)] (_#= expected (/.value lazy)))) diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index 6fefaecfe..9563e44ce 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -83,7 +83,7 @@ (/.list {.#Some value})))) (do random.monad [expected random.nat - .let [(^open "/#[0]") (/.equivalence n.equivalence)]] + .let [(open "/#[0]") (/.equivalence n.equivalence)]] (_.cover [/.when] (and (/#= {.#Some expected} (/.when true {.#Some expected})) (/#= {.#None} (/.when false {.#Some expected}))))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 5a76942ed..02da11358 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -1,44 +1,44 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [equivalence {"+" Equivalence}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [control - ["[0]" try {"+" Try}] - [parser - ["<[0]>" code]]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["[0]" random] - [number - ["n" nat]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]]]] - [\\library - ["[0]" / {"+" Parser}]] - ["[0]" / "_" - ["[1][0]" analysis] - ["[1][0]" binary] - ["[1][0]" cli] - ["[1][0]" code] - ["[1][0]" environment] - ["[1][0]" json] - ["[1][0]" synthesis] - ["[1][0]" text] - ["[1][0]" tree] - ["[1][0]" type] - ["[1][0]" xml]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [equivalence {"+" Equivalence}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [control + ["[0]" try {"+" Try}] + [parser + ["<[0]>" code]]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["[0]" random] + [number + ["n" nat]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]]]] + [\\library + ["[0]" / {"+" Parser}]] + ["[0]" / "_" + ["[1][0]" analysis] + ["[1][0]" binary] + ["[1][0]" cli] + ["[1][0]" code] + ["[1][0]" environment] + ["[1][0]" json] + ["[1][0]" synthesis] + ["[1][0]" text] + ["[1][0]" tree] + ["[1][0]" type] + ["[1][0]" xml]]) (def: (should_fail expected input) (All (_ a) (-> Text (Try a) Bit)) @@ -80,7 +80,7 @@ then <code>.any input <code>.any]) (in (list (` (case (~ input) - (^ {try.#Success [(~' _) (~ pattern)]}) + (pattern {try.#Success [(~' _) (~ pattern)]}) (~ then) (~' _) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 11cca9980..00ff979d9 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -28,6 +28,7 @@ ["[0]" sequence] ["[0]" set]]] [macro + ["^" pattern] ["[0]" code]] [math ["[0]" random {"+" Random}] @@ -114,7 +115,7 @@ (def: random_type (Random Type) - (let [(^open "[0]") random.monad] + (let [(open "[0]") random.monad] ($_ random.either (in .Nat) (in .List) @@ -132,9 +133,9 @@ (_.cover [<size> <parser> <format>] (|> (format.result <format> expected) (/.result <parser>) - (!expect (^multi {try.#Success actual} - (n.= (.nat expected) - (.nat actual)))))))] + (!expect (^.multi {try.#Success actual} + (n.= (.nat expected) + (.nat actual)))))))] [/.size/8 /.bits/8 format.bits/8] [/.size/16 /.bits/16 format.bits/16] @@ -151,8 +152,8 @@ (_.cover [<parser> <format>] (|> (format.result <format> expected) (/.result <parser>) - (!expect (^multi {try.#Success actual} - (# binary.equivalence = expected actual))))))] + (!expect (^.multi {try.#Success actual} + (# binary.equivalence = expected actual))))))] [/.binary/8 format.binary/8] [/.binary/16 format.binary/16] @@ -169,8 +170,8 @@ (_.cover [<parser> <format>] (|> (format.result <format> expected) (/.result <parser>) - (!expect (^multi {try.#Success actual} - (# text.equivalence = expected actual))))))] + (!expect (^.multi {try.#Success actual} + (# text.equivalence = expected actual))))))] [/.utf8/8 format.utf8/8] [/.utf8/16 format.utf8/16] @@ -189,8 +190,8 @@ (|> expected (format.result (<format> format.nat)) (/.result (<parser> /.nat)) - (!expect (^multi {try.#Success actual} - (# (sequence.equivalence n.equivalence) = expected actual))))))] + (!expect (^.multi {try.#Success actual} + (# (sequence.equivalence n.equivalence) = expected actual))))))] [/.sequence/8 format.sequence/8] [/.sequence/16 format.sequence/16] @@ -208,8 +209,8 @@ (|> expected (format.result <format>) (/.result <parser>) - (!expect (^multi {try.#Success actual} - (# <equivalence> = expected actual))))))] + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))))] [/.bit format.bit random.bit bit.equivalence] [/.nat format.nat random.nat n.equivalence] @@ -221,10 +222,10 @@ (|> expected (format.result format.frac) (/.result /.frac) - (!expect (^multi {try.#Success actual} - (or (# frac.equivalence = expected actual) - (and (frac.not_a_number? expected) - (frac.not_a_number? actual)))))))) + (!expect (^.multi {try.#Success actual} + (or (# frac.equivalence = expected actual) + (and (frac.not_a_number? expected) + (frac.not_a_number? actual)))))))) (do [! random.monad] [expected (# ! each (|>> (i64.and (i64.mask /.size/8)) (n.max 2)) @@ -233,8 +234,8 @@ (|> expected (format.result format.bits/8) (/.result /.bit) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_a_bit error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_a_bit error)))))) ))) (def: complex @@ -247,8 +248,8 @@ (|> expected (format.result <format>) (/.result <parser>) - (!expect (^multi {try.#Success actual} - (# <equivalence> = expected actual))))))] + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))))] [/.location format.location random_location location_equivalence] [/.code format.code random_code code.equivalence] @@ -261,8 +262,8 @@ (|> expected (format.result <format>) (/.result <parser>) - (!expect (^multi {try.#Success actual} - (# <equivalence> = expected actual))))))] + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))))] [/.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)] @@ -274,8 +275,8 @@ (|> expected (format.result (format.list format.nat)) (/.result (/.set n.hash /.nat)) - (!expect (^multi {try.#Failure error} - (exception.match? /.set_elements_are_not_unique error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.set_elements_are_not_unique error)))))) (do [! random.monad] [expected (random.or random.bit random.nat)] (_.cover [/.or format.or] @@ -283,10 +284,10 @@ (format.result (format.or format.bit format.nat)) (/.result (: (/.Parser (Either Bit Nat)) (/.or /.bit /.nat))) - (!expect (^multi {try.#Success actual} - (# (sum.equivalence bit.equivalence n.equivalence) = - expected - actual)))))) + (!expect (^.multi {try.#Success actual} + (# (sum.equivalence bit.equivalence n.equivalence) = + expected + actual)))))) (do [! random.monad] [tag (# ! each (|>> (i64.and (i64.mask /.size/8)) (n.max 2)) @@ -297,8 +298,8 @@ (format.result (format.and format.bits/8 format.bit)) (/.result (: (/.Parser (Either Bit Nat)) (/.or /.bit /.nat))) - (!expect (^multi {try.#Failure error} - (exception.match? /.invalid_tag error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.invalid_tag error)))))) (do [! random.monad] [expected (random.list ..segment_size random.nat)] (_.cover [/.rec format.rec format.and format.any] @@ -311,10 +312,10 @@ (/.or /.any (<>.and /.nat again)))))) - (!expect (^multi {try.#Success actual} - (# (list.equivalence n.equivalence) = - expected - actual)))))) + (!expect (^.multi {try.#Success actual} + (# (list.equivalence n.equivalence) = + expected + actual)))))) ))) (def: .public test @@ -332,16 +333,16 @@ (_.cover [/.binary_was_not_fully_read] (|> data (/.result /.any) - (!expect (^multi {try.#Failure error} - (exception.match? /.binary_was_not_fully_read error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.binary_was_not_fully_read error)))))) (do [! random.monad] [expected (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] (_.cover [/.segment format.segment format.result] (|> expected (format.result (format.segment ..segment_size)) (/.result (/.segment ..segment_size)) - (!expect (^multi {try.#Success actual} - (# binary.equivalence = expected actual)))))) + (!expect (^.multi {try.#Success actual} + (# binary.equivalence = expected actual)))))) (do [! random.monad] [data (# ! each (# utf8.codec encoded) (random.ascii ..segment_size))] (_.cover [/.end?] diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 55b57bf62..812b23586 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -1,22 +1,24 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - ["<>" parser]] - [data - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat ("[1]#[0]" decimal)]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" try] + ["<>" parser]] + [data + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [macro + ["^" pattern]] + [math + ["[0]" random] + [number + ["n" nat ("[1]#[0]" decimal)]]]]] + [\\library + ["[0]" /]]) (template: (!expect <pattern> <value>) [(case <value> @@ -42,13 +44,13 @@ ($_ _.and (_.cover [/.result /.any] (|> (/.result /.any (list expected)) - (!expect (^multi {try.#Success actual} - (text#= expected actual))))) + (!expect (^.multi {try.#Success actual} + (text#= expected actual))))) (_.cover [/.parse] (|> (/.result (/.parse n#decoded) (list expected)) - (!expect (^multi {try.#Success actual} - (text#= expected - (n#encoded actual)))))) + (!expect (^.multi {try.#Success actual} + (text#= expected + (n#encoded actual)))))) (_.cover [/.this] (and (|> (/.result (/.this expected) (list expected)) (!expect {try.#Success _})) @@ -66,17 +68,17 @@ (!expect {try.#Failure _})))) (_.cover [/.named] (|> (/.result (/.named dummy /.any) (list dummy expected)) - (!expect (^multi {try.#Success actual} - (text#= expected actual))))) + (!expect (^.multi {try.#Success actual} + (text#= expected actual))))) (_.cover [/.parameter] (and (|> (/.result (/.parameter [short long] /.any) (list short expected)) - (!expect (^multi {try.#Success actual} - (text#= expected actual)))) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))) (|> (/.result (/.parameter [short long] /.any) (list long expected)) - (!expect (^multi {try.#Success actual} - (text#= expected actual)))) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))) (|> (/.result (/.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 d851a79d1..62030c6bd 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -14,6 +14,7 @@ [collection ["[0]" list]]] [macro + ["^" pattern] ["[0]" code]] [math ["[0]" random {"+" Random} ("[1]#[0]" functor)] @@ -73,8 +74,8 @@ ($_ _.and (_.cover [<query>] (|> (/.result <query> (list (<code> expected))) - (!expect (^multi {try.#Success actual} - (# <equivalence> = expected actual))))) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))) (_.cover [<check>] (and (|> (/.result (<check> expected) (list (<code> expected))) (!expect {try.#Success []})) @@ -101,9 +102,9 @@ (|> (/.result (<query> (<>.and /.nat /.int)) (list (<code> (list (code.nat expected_left) (code.int expected_right))))) - (!expect (^multi {try.#Success [actual_left actual_right]} - (and (# nat.equivalence = expected_left actual_left) - (# int.equivalence = expected_right actual_right)))))))] + (!expect (^.multi {try.#Success [actual_left actual_right]} + (and (# nat.equivalence = expected_left actual_left) + (# int.equivalence = expected_right actual_right)))))))] [/.form code.form] [/.variant code.variant] @@ -116,9 +117,9 @@ (|> (/.result (<>.and (/.local (list (code.nat expected_local)) /.nat) /.int) (list (code.int expected_global))) - (!expect (^multi {try.#Success [actual_local actual_global]} - (and (# nat.equivalence = expected_local actual_local) - (# int.equivalence = expected_global actual_global))))))) + (!expect (^.multi {try.#Success [actual_local actual_global]} + (and (# nat.equivalence = expected_local actual_local) + (# int.equivalence = expected_global actual_global))))))) (do [! random.monad] [dummy (# ! each code.bit random.bit)] (_.cover [/.end?] @@ -129,8 +130,8 @@ (in (and (not pre) post))) (list dummy)) - (!expect (^multi {try.#Success verdict} - verdict))))) + (!expect (^.multi {try.#Success verdict} + verdict))))) (do [! random.monad] [dummy (# ! each code.bit random.bit)] (_.cover [/.end!] @@ -152,8 +153,8 @@ [expected (# ! each code.bit random.bit)] (_.cover [/.not] (and (|> (/.result (/.not /.nat) (list expected)) - (!expect (^multi {try.#Success actual} - (same? expected actual)))) + (!expect (^.multi {try.#Success actual} + (same? expected actual)))) (|> (/.result (/.not /.bit) (list expected)) (!expect {try.#Failure _}))))) )))) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 0ac380274..ea42e6178 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -20,6 +20,8 @@ ["[0]" sequence {"+" sequence} ("[1]#[0]" functor)]] [format ["[0]" json]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random}] [number @@ -49,8 +51,8 @@ [expected (# ! each (|>> {json.#String}) (random.unicode 1))] (_.cover [/.result /.any] (|> (/.result /.any expected) - (!expect (^multi {try.#Success actual} - (# json.equivalence = expected actual)))))) + (!expect (^.multi {try.#Success actual} + (# json.equivalence = expected actual)))))) (_.cover [/.null] (|> (/.result /.null {json.#Null}) (!expect {try.#Success _}))) @@ -61,8 +63,8 @@ ($_ _.and (_.cover [<query>] (|> (/.result <query> {<json> expected}) - (!expect (^multi {try.#Success actual} - (# <equivalence> = expected actual))))) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))) (_.cover [<test>] (and (|> (/.result (<test> expected) {<json> expected}) (!expect {try.#Success #1})) @@ -83,24 +85,24 @@ dummy random.bit] (_.cover [/.unexpected_value] (|> (/.result /.string {json.#Boolean dummy}) - (!expect (^multi {try.#Failure error} - (exception.match? /.unexpected_value error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unexpected_value error)))))) (do [! random.monad] [expected (random.unicode 1) dummy (|> (random.unicode 1) (random.only (|>> (# text.equivalence = expected) not)))] (_.cover [/.value_mismatch] (|> (/.result (/.string! expected) {json.#String dummy}) - (!expect (^multi {try.#Failure error} - (exception.match? /.value_mismatch error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.value_mismatch error)))))) (do [! random.monad] [expected (random.unicode 1)] (_.cover [/.nullable] (and (|> (/.result (/.nullable /.string) {json.#Null}) - (!expect (^multi {try.#Success actual} - (# (maybe.equivalence text.equivalence) = {.#None} actual)))) + (!expect (^.multi {try.#Success actual} + (# (maybe.equivalence text.equivalence) = {.#None} actual)))) (|> (/.result (/.nullable /.string) {json.#String expected}) - (!expect (^multi {try.#Success actual} - (# (maybe.equivalence text.equivalence) = {.#Some expected} actual))))))) + (!expect (^.multi {try.#Success actual} + (# (maybe.equivalence text.equivalence) = {.#Some expected} actual))))))) (do [! random.monad] [size (# ! each (n.% 10) random.nat) expected (|> (random.unicode 1) @@ -109,18 +111,18 @@ (_.cover [/.array] (|> (/.result (/.array (<>.some /.string)) {json.#Array (sequence#each (|>> {json.#String}) expected)}) - (!expect (^multi {try.#Success actual} - (# (sequence.equivalence text.equivalence) = expected (sequence.of_list actual))))))) + (!expect (^.multi {try.#Success actual} + (# (sequence.equivalence text.equivalence) = expected (sequence.of_list actual))))))) (do [! random.monad] [expected (# ! each (|>> {json.#String}) (random.unicode 1))] (_.cover [/.unconsumed_input] (|> (/.result (/.array /.any) {json.#Array (sequence expected expected)}) - (!expect (^multi {try.#Failure error} - (exception.match? /.unconsumed_input error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error)))))) (_.cover [/.empty_input] (|> (/.result (/.array /.any) {json.#Array (sequence)}) - (!expect (^multi {try.#Failure error} - (exception.match? /.empty_input error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.empty_input error))))) (do [! random.monad] [expected_boolean random.bit expected_number ..safe_frac @@ -128,7 +130,7 @@ [boolean_field number_field string_field] (|> (random.set text.hash 3 (random.unicode 3)) (# ! each (|>> set.list (pipe.case - (^ (list boolean_field number_field string_field)) + (pattern (list boolean_field number_field string_field)) [boolean_field number_field string_field] _ @@ -143,10 +145,10 @@ (list [boolean_field {json.#Boolean expected_boolean}] [number_field {json.#Number expected_number}] [string_field {json.#String expected_string}]))}) - (!expect (^multi {try.#Success [actual_boolean actual_number actual_string]} - (and (# bit.equivalence = expected_boolean actual_boolean) - (# frac.equivalence = expected_number actual_number) - (# text.equivalence = expected_string actual_string))))))) + (!expect (^.multi {try.#Success [actual_boolean actual_number actual_string]} + (and (# bit.equivalence = expected_boolean actual_boolean) + (# frac.equivalence = expected_number actual_number) + (# text.equivalence = expected_string actual_string))))))) (do [! random.monad] [size (# ! each (n.% 10) random.nat) keys (random.list size (random.unicode 1)) @@ -159,6 +161,6 @@ (list#each (|>> {json.#String})) (list.zipped/2 keys) (dictionary.of_list text.hash))}) - (!expect (^multi {try.#Success actual} - (# (dictionary.equivalence text.equivalence) = expected actual)))))) + (!expect (^.multi {try.#Success actual} + (# (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 62a78cd0e..97d6934ed 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -13,6 +13,8 @@ ["[0]" text] [collection ["[0]" list ("[1]#[0]" functor)]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random}] [number @@ -68,14 +70,14 @@ ($_ _.and (_.cover [<query>] (|> (/.result <query> (list (<synthesis> expected))) - (!expect (^multi {try.#Success actual} - (# <equivalence> = expected actual))))) + (!expect (^.multi {try.#Success actual} + (# <equivalence> = expected actual))))) (_.cover [<check>] (and (|> (/.result (<check> expected) (list (<synthesis> expected))) (!expect {try.#Success _})) (|> (/.result (<check> expected) (list (<synthesis> dummy))) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_parse error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error)))))) ))] [/.bit /.bit! random.bit synthesis.bit bit.equivalence] @@ -102,15 +104,15 @@ (synthesis.i64 expected_i64) (synthesis.f64 expected_f64) (synthesis.text expected_text))))) - (!expect (^multi {try.#Success [actual_bit actual_i64 actual_f64 actual_text]} - (and (# bit.equivalence = expected_bit actual_bit) - (# i64.equivalence = expected_i64 actual_i64) - (# frac.equivalence = expected_f64 actual_f64) - (# text.equivalence = expected_text actual_text))))) + (!expect (^.multi {try.#Success [actual_bit actual_i64 actual_f64 actual_text]} + (and (# bit.equivalence = expected_bit actual_bit) + (# i64.equivalence = expected_i64 actual_i64) + (# frac.equivalence = expected_f64 actual_f64) + (# text.equivalence = expected_text actual_text))))) (|> (/.result (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) (list (synthesis.text expected_text))) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) (do [! random.monad] [arity random.nat expected_environment ..random_environment @@ -118,15 +120,15 @@ (_.cover [/.function] (and (|> (/.result (/.function arity /.text) (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) - (!expect (^multi {try.#Success [actual_environment actual_body]} - (and (# (list.equivalence synthesis.equivalence) = - expected_environment - actual_environment) - (# text.equivalence = expected_body actual_body))))) + (!expect (^.multi {try.#Success [actual_environment actual_body]} + (and (# (list.equivalence synthesis.equivalence) = + expected_environment + actual_environment) + (# text.equivalence = expected_body actual_body))))) (|> (/.result (/.function arity /.text) (list (synthesis.text expected_body))) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) (do [! random.monad] [arity random.nat expected_environment ..random_environment @@ -134,8 +136,8 @@ (_.cover [/.wrong_arity] (|> (/.result (/.function (++ arity) /.text) (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) - (!expect (^multi {try.#Failure error} - (exception.match? /.wrong_arity error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.wrong_arity error)))))) (do [! random.monad] [arity (# ! each (|>> (n.% 10) ++) random.nat) expected_offset random.nat @@ -146,16 +148,16 @@ (list (synthesis.loop/scope [expected_offset (list#each (|>> 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))))) + (!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))))) (|> (/.result (/.loop (<>.many /.bit) /.text) (list (synthesis.text expected_body))) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) )) (def: .public test @@ -167,26 +169,26 @@ [expected (# ! each (|>> synthesis.i64) random.i64)] (_.cover [/.result /.any] (|> (/.result /.any (list expected)) - (!expect (^multi {try.#Success actual} - (# synthesis.equivalence = expected actual)))))) + (!expect (^.multi {try.#Success actual} + (# synthesis.equivalence = expected actual)))))) (_.cover [/.empty_input] (|> (/.result /.any (list)) - (!expect (^multi {try.#Failure error} - (exception.match? /.empty_input error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.empty_input error))))) (do [! random.monad] [expected (# ! each (|>> synthesis.i64) random.i64)] (_.cover [/.unconsumed_input] (|> (/.result /.any (list expected expected)) - (!expect (^multi {try.#Failure error} - (exception.match? /.unconsumed_input error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error)))))) (do [! random.monad] [dummy (# ! each (|>> synthesis.i64) random.i64)] (_.cover [/.end! /.expected_empty_input] (and (|> (/.result /.end! (list)) (!expect {try.#Success _})) (|> (/.result /.end! (list dummy)) - (!expect (^multi {try.#Failure error} - (exception.match? /.expected_empty_input error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.expected_empty_input error))))))) (do [! random.monad] [dummy (# ! each (|>> synthesis.i64) random.i64)] (_.cover [/.end?] diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 92367175a..0c49e8043 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -1,35 +1,36 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe] - ["[0]" try {"+" Try}] - ["[0]" exception {"+" Exception}] - ["[0]" function]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}] - ["[0]" unicode "_" - ["[1]" set] - ["[1]/[0]" block]]] - [collection - ["[0]" set] - ["[0]" list ("[1]#[0]" functor)] - [tree - ["[0]" finger]]]] - [math - ["[0]" random] - [number {"+" hex} - ["n" nat]]] - [macro - ["[0]" code]]]] - [\\library - ["[0]" / - ["<>" // - ["<c>" code]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe] + ["[0]" try {"+" Try}] + ["[0]" exception {"+" Exception}] + ["[0]" function]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}] + ["[0]" unicode "_" + ["[1]" set] + ["[1]/[0]" block]]] + [collection + ["[0]" set] + ["[0]" list ("[1]#[0]" functor)] + [tree + ["[0]" finger]]]] + [math + ["[0]" random] + [number {"+" hex} + ["n" nat]]] + [macro + ["^" pattern] + ["[0]" code]]]] + [\\library + ["[0]" / + ["<>" // + ["<c>" code]]]]) (template: (!expect <pattern> <value>) [(case <value> @@ -316,13 +317,13 @@ (!expect {try.#Success []})) (|> (/.result (/.this expected) dummy) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_match error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_match error))))))) (_.cover [/.Slice /.slice /.cannot_slice] (|> "" (/.result (/.slice /.any!)) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_slice error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_slice error))))) (do [! random.monad] [expected (random.unicode 1)] (_.cover [/.any /.any!] @@ -337,15 +338,15 @@ (and (..should_pass expected (<>.before /.any /.next)) (|> "" (/.result (<>.before /.any /.next)) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_parse error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_parse error))))))) (do [! random.monad] [dummy (random.unicode 1)] (_.cover [/.unconsumed_input] (|> (format dummy dummy) (/.result /.any) - (!expect (^multi {try.#Failure error} - (exception.match? /.unconsumed_input error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error)))))) (do [! random.monad] [sample (random.unicode 1)] (_.cover [/.Offset /.offset] @@ -393,8 +394,8 @@ (_.cover [/.then] (|> (list (code.text expected)) (<c>.result (/.then /.octal <c>.text)) - (!expect (^multi {try.#Success actual} - (text#= expected actual)))))) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))))) (do [! random.monad] [invalid (random.ascii/upper 1) expected (random.only (|>> (unicode/block.within? unicode/block.basic_latin/upper) @@ -405,14 +406,14 @@ (and (..should_pass (text.of_char expected) (/.not /.upper)) (|> invalid (/.result (/.not /.upper)) - (!expect (^multi {try.#Failure error} - (exception.match? /.expected_to_fail error)))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.expected_to_fail error)))) (..should_pass! (text.of_char expected) (/.not! upper!)) (|> invalid (/.result (/.not! upper!)) - (!expect (^multi {try.#Failure error} - (exception.match? /.expected_to_fail error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.expected_to_fail error))))))) (do [! random.monad] [upper (random.ascii/upper 1) lower (random.ascii/lower 1) diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index 18718e129..3f8bebaaf 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -1,23 +1,25 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - ["[0]" exception]] - [data - [collection - ["[0]" tree - ["[0]" zipper]]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / - ["/[1]" //]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" try] + ["[0]" exception]] + [data + [collection + ["[0]" tree + ["[0]" zipper]]]] + [macro + ["^" pattern]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / + ["/[1]" //]]]) (template: (!expect <pattern> <value>) [(case <value> @@ -34,8 +36,8 @@ (_.cover <coverage> (|> (/.result <parser> <sample>) - (!expect (^multi {try.#Success actual} - (n.= expected actual))))))]) + (!expect (^.multi {try.#Success actual} + (n.= expected actual))))))]) (template: (!cover/2 <coverage> <parser> <sample0> <sample1>) [(do [! random.monad] @@ -43,11 +45,11 @@ expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover <coverage> (and (|> (/.result <parser> <sample0>) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))) (|> (/.result <parser> <sample1>) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))))))]) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))))]) (def: .public test Test @@ -62,8 +64,8 @@ (_.cover [/.result'] (|> (/.result' /.value (zipper.zipper (tree.leaf expected))) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))) (!cover [/.down] (do //.monad [_ /.down] @@ -163,8 +165,8 @@ (`` (and (~~ (template [<parser>] [(|> (/.result <parser> (tree.leaf dummy)) - (!expect (^multi {try.#Failure error} - (exception.match? /.cannot_move_further error))))] + (!expect (^.multi {try.#Failure error} + (exception.match? /.cannot_move_further error))))] [/.down] [/.up] [/.right] [/.left] diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 5258921b2..0a3bf5945 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -13,6 +13,8 @@ ["%" format {"+" format}]] [collection ["[0]" list]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random}] [number @@ -49,8 +51,8 @@ (and (|> (/.result (/.exactly expected) expected) (!expect {try.#Success []})) (|> (/.result (/.exactly expected) dummy) - (!expect (^multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.types_do_not_match error)))))) (_.cover [/.sub] (and (|> (/.result (/.sub expected) expected) (!expect {try.#Success []})) @@ -59,8 +61,8 @@ (|> (/.result (/.sub expected) Nothing) (!expect {try.#Success []})) (|> (/.result (/.sub expected) dummy) - (!expect (^multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.types_do_not_match error)))))) (_.cover [/.super] (and (|> (/.result (/.super expected) expected) (!expect {try.#Success []})) @@ -69,8 +71,8 @@ (|> (/.result (/.super Nothing) expected) (!expect {try.#Success []})) (|> (/.result (/.super expected) dummy) - (!expect (^multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.types_do_not_match error)))))) ))) (def: test|aggregate @@ -84,14 +86,14 @@ [(_.cover [<parser> <exception>] (and (|> (/.result (<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))))) + (!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))))) (|> (/.result (<parser> ($_ //.and /.any /.any /.any)) (<bad_constructor> (list expected_left expected_middle expected_right))) - (!expect (^multi {try.#Failure error} - (exception.match? <exception> error))))))] + (!expect (^.multi {try.#Failure error} + (exception.match? <exception> error))))))] [/.variant /.not_variant type.variant type.tuple] [/.tuple /.not_tuple type.tuple type.variant] @@ -100,25 +102,25 @@ (_.cover [/.function /.not_function] (and (|> (/.result (/.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))))) + (!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))))) (|> (/.result (/.function ($_ //.and /.any /.any) /.any) (type.variant (list expected_left expected_middle expected_right))) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_function error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_function error)))))) (_.cover [/.applied /.not_application] (and (|> (/.result (/.applied ($_ //.and /.any /.any /.any)) (type.application (list expected_middle expected_right) expected_left)) - (!expect (^multi {try.#Success [actual_left actual_middle actual_right]} - (and (type#= expected_left actual_left) - (type#= expected_middle actual_middle) - (type#= expected_right actual_right))))) + (!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))))) (|> (/.result (/.applied ($_ //.and /.any /.any /.any)) (type.variant (list expected_left expected_middle expected_right))) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_application error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_application error)))))) )))) (def: test|parameter @@ -131,19 +133,19 @@ ($_ _.and (_.cover [/.not_parameter] (|> (/.result /.parameter not_parameter) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_parameter error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_parameter error))))) (_.cover [/.unknown_parameter] (|> (/.result /.parameter {.#Parameter parameter}) - (!expect (^multi {try.#Failure error} - (exception.match? /.unknown_parameter error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unknown_parameter error))))) (_.cover [/.with_extension] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) /.any) not_parameter) - (!expect (^multi {try.#Success [quantification##binding argument##binding actual]} - (same? not_parameter actual))))) + (!expect (^.multi {try.#Success [quantification##binding argument##binding actual]} + (same? not_parameter actual))))) (_.cover [/.parameter] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) @@ -162,8 +164,8 @@ _ /.any] (in (/.argument env @)))) not_parameter) - (!expect (^multi {try.#Success [_ _ _ _ actual]} - (n.= expected actual))))))] + (!expect (^.multi {try.#Success [_ _ _ _ actual]} + (n.= expected actual))))))] (and (argument? 0 2) (argument? 1 3) (argument? 2 0)))) @@ -172,8 +174,8 @@ (/.with_extension argument) (/.parameter! 1)) {.#Parameter 0}) - (!expect (^multi {try.#Failure error} - (exception.match? /.wrong_parameter error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.wrong_parameter error))))) (_.cover [/.parameter!] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) @@ -191,18 +193,18 @@ (_.cover [/.not_polymorphic] (and (|> (/.result (/.polymorphic /.any) not_polymorphic) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_polymorphic error)))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_polymorphic error)))) (|> (/.result (/.polymorphic /.any) (type.univ_q 0 not_polymorphic)) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_polymorphic error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_polymorphic error)))))) (_.cover [/.polymorphic] (|> (/.result (/.polymorphic /.any) (type.univ_q expected_inputs not_polymorphic)) - (!expect (^multi {try.#Success [g!poly actual_inputs bodyT]} - (and (n.= expected_inputs (list.size actual_inputs)) - (same? not_polymorphic bodyT)))))) + (!expect (^.multi {try.#Success [g!poly actual_inputs bodyT]} + (and (n.= expected_inputs (list.size actual_inputs)) + (same? not_polymorphic bodyT)))))) ))) (def: test|recursive @@ -213,13 +215,13 @@ (_.cover [/.recursive] (|> (.type (Rec @ expected)) (/.result (/.recursive /.any)) - (!expect (^multi {try.#Success [@self actual]} - (type#= expected actual))))) + (!expect (^.multi {try.#Success [@self actual]} + (type#= expected actual))))) (_.cover [/.recursive_self] (|> (.type (Rec @ @)) (/.result (/.recursive /.recursive_self)) - (!expect (^multi {try.#Success [@expected @actual]} - (same? @expected @actual))))) + (!expect (^.multi {try.#Success [@expected @actual]} + (same? @expected @actual))))) (_.cover [/.recursive_call] (|> (.type (All (self input) (self input))) (/.result (/.polymorphic /.recursive_call)) @@ -227,12 +229,12 @@ (_.cover [/.not_recursive] (and (|> expected (/.result (/.recursive /.any)) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_recursive error)))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_recursive error)))) (|> expected (/.result /.recursive_self) - (!expect (^multi {try.#Failure error} - (exception.match? /.not_recursive error)))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.not_recursive error)))))) ))) (def: .public test @@ -244,8 +246,8 @@ [expected ..primitive] (_.cover [/.result /.any] (|> (/.result /.any expected) - (!expect (^multi {try.#Success actual} - (type#= expected actual)))))) + (!expect (^.multi {try.#Success actual} + (type#= expected actual)))))) (do [! random.monad] [expected ..primitive] (_.cover [/.next /.unconsumed_input] @@ -254,11 +256,11 @@ _ /.any] (in actual)) expected) - (!expect (^multi {try.#Success actual} - (type#= expected actual)))) + (!expect (^.multi {try.#Success actual} + (type#= expected actual)))) (|> (/.result /.next expected) - (!expect (^multi {try.#Failure error} - (exception.match? /.unconsumed_input error))))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.unconsumed_input error))))))) (do [! random.monad] [expected ..primitive] (_.cover [/.empty_input] @@ -267,8 +269,8 @@ [_ /.any] <parser>) expected) - (!expect (^multi {try.#Failure error} - (exception.match? /.empty_input error))))] + (!expect (^.multi {try.#Failure error} + (exception.match? /.empty_input error))))] [/.any] [/.next] @@ -281,8 +283,8 @@ _ /.any] (in env)) expected) - (!expect (^multi {try.#Success environment} - (same? /.fresh environment)))))) + (!expect (^.multi {try.#Success environment} + (same? /.fresh environment)))))) (do [! random.monad] [expected ..primitive dummy (random.only (|>> (type#= expected) not) @@ -293,15 +295,15 @@ (/.local (list expected) /.any)) dummy) - (!expect (^multi {try.#Success actual} - (type#= expected actual)))))) + (!expect (^.multi {try.#Success actual} + (type#= expected actual)))))) (do [! random.monad] [expected random.nat] (_.cover [/.existential /.not_existential] (|> (/.result /.existential {.#Ex expected}) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))) (do [! random.monad] [expected_name (random.and (random.ascii/alpha_num 1) (random.ascii/alpha_num 1)) @@ -309,9 +311,9 @@ (_.cover [/.named /.not_named] (|> (/.result /.named {.#Named expected_name expected_type}) - (!expect (^multi {try.#Success [actual_name actual_type]} - (and (symbol#= expected_name actual_name) - (type#= expected_type actual_type))))))) + (!expect (^.multi {try.#Success [actual_name actual_type]} + (and (symbol#= expected_name actual_name) + (type#= expected_type actual_type))))))) ..test|aggregate ..test|matches ..test|parameter diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index f3b966816..40582948d 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -1,31 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" type ("[1]#[0]" equivalence)] - [abstract - [monad {"+" do}]] - [control - ["[0]" try ("[1]#[0]" functor)] - ["[0]" exception]] - [data - ["[0]" text ("[1]#[0]" equivalence)] - [format - ["[0]" xml ("[1]#[0]" equivalence)]] - [collection - ["[0]" dictionary] - ["[0]" list]]] - [macro - ["[0]" template]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]] - [meta - ["[0]" symbol ("[1]#[0]" equivalence)]]]] - [\\library - ["[0]" / - ["/[1]" // ("[1]#[0]" monad)]]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" type ("[1]#[0]" equivalence)] + [abstract + [monad {"+" do}]] + [control + ["[0]" try ("[1]#[0]" functor)] + ["[0]" exception]] + [data + ["[0]" text ("[1]#[0]" equivalence)] + [format + ["[0]" xml ("[1]#[0]" equivalence)]] + [collection + ["[0]" dictionary] + ["[0]" list]]] + [macro + ["^" pattern] + ["[0]" template]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]] + [meta + ["[0]" symbol ("[1]#[0]" equivalence)]]]] + [\\library + ["[0]" / + ["/[1]" // ("[1]#[0]" monad)]]]) (template: (!expect <pattern> <value>) [(case <value> @@ -42,8 +43,8 @@ (_.cover [<exception>] (`` (and (~~ (template [<parser> <input>] [(|> (/.result <parser> (list <input>)) - (!expect (^multi {try.#Failure error} - (exception.match? <exception> error))))] + (!expect (^.multi {try.#Failure error} + (exception.match? <exception> error))))] <<cases>>)))))))]) @@ -64,8 +65,8 @@ [expected (random.ascii/alpha 1)] (_.cover [/.result /.text] (|> (/.result /.text (list {xml.#Text expected})) - (!expect (^multi {try.#Success actual} - (text#= expected actual)))))) + (!expect (^.multi {try.#Success actual} + (text#= expected actual)))))) (!failure /.unconsumed_inputs [[(//#in expected) {xml.#Text expected}]]) @@ -173,7 +174,7 @@ (|> (/.result parser (list (node parent (list.repeated repetitions (node wrong (list)))))) - (!expect (^multi {try.#Failure error} - (exception.match? /.nowhere error))))) + (!expect (^.multi {try.#Failure error} + (exception.match? /.nowhere error))))) )) ))) diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index e32e06bd6..7b2c8e43f 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Reader} - [// - ["[0]" io {"+" IO}]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Reader} + [// + ["[0]" io {"+" IO}]]]]) (def: (injection value) (Injection (All (_ a r) (Reader r a))) @@ -48,7 +48,7 @@ (_.cover [/.local] (n.= (n.* factor sample) (/.result sample (/.local (n.* factor) /.read)))) - (let [(^open "io#[0]") io.monad] + (let [(open "io#[0]") io.monad] (_.cover [/.with /.lifted] (|> (: (/.Reader Any (IO Nat)) (do (/.with io.monad) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 2aedc2438..d7313ee0e 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" meta] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" io] - ["[0]" try {"+" Try}] - ["[0]" exception] - [parser - ["<[0]>" code]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]]] - [math - [number {"+" hex}] - ["[0]" random {"+" Random} ("[1]#[0]" monad)]] - [time - ["[0]" date {"+" Date}] - ["[0]" instant] - ["[0]" duration]] - ["[0]" macro - ["[0]" code] - ["[0]" syntax {"+" syntax:}]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" meta] + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" io] + ["[0]" try {"+" Try}] + ["[0]" exception] + [parser + ["<[0]>" code]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]]] + [math + [number {"+" hex}] + ["[0]" random {"+" Random} ("[1]#[0]" monad)]] + [time + ["[0]" date {"+" Date}] + ["[0]" instant] + ["[0]" duration]] + ["[0]" macro + ["[0]" code] + ["[0]" syntax {"+" syntax:}]]]] + [\\library + ["[0]" /]]) (def: deadline (Random Date) random.date) (def: message (Random Text) (random#each %.bit random.bit)) @@ -92,13 +92,13 @@ _ false) (case should_succeed0 - (^ {try.#Success (list)}) + (pattern {try.#Success (list)}) true _ false) (case should_succeed1 - (^ {try.#Success (list actual)}) + (pattern {try.#Success (list actual)}) (same? expected actual) _ diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 34b24c1f4..6ced1e85c 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -11,6 +11,8 @@ ["$[0]" monad]]] [data ["[0]" text ("[1]#[0]" equivalence)]] + [macro + ["^" pattern]] [math ["[0]" random] [number @@ -48,7 +50,7 @@ (Ex (_ %) (-> Any (Policy %))) (/.with_policy (: (Context Privacy Policy) - (function (_ (^let privilege (^open "%[0]"))) + (function (_ (^.let privilege (open "%[0]"))) (implementation (def: &hash (implementation diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index 39e10983a..9cc2cac76 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -106,7 +106,7 @@ [state random.nat left random.nat right random.nat] - (let [(^open "io#[0]") io.monad] + (let [(open "io#[0]") io.monad] (_.cover [/.+State /.with /.lifted /.result'] (|> (: (/.+State io.IO Nat Nat) (do (/.with io.monad) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index b3efe3dd2..a606da407 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -44,7 +44,7 @@ [expected random.nat alternative (|> random.nat (random.only (|>> (n.= expected) not))) error (random.unicode 1) - .let [(^open "io#[0]") io.monad]]) + .let [(open "io#[0]") io.monad]]) ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (..attempt random.nat))) diff --git a/stdlib/source/test/lux/control/writer.lux b/stdlib/source/test/lux/control/writer.lux index 63c59adb0..2e8989f1f 100644 --- a/stdlib/source/test/lux/control/writer.lux +++ b/stdlib/source/test/lux/control/writer.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [equivalence {"+" Equivalence}] - [monoid {"+" Monoid}] - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [control - ["[0]" io]] - [data - ["[0]" product] - ["[0]" text ("[1]#[0]" equivalence)]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Writer}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [equivalence {"+" Equivalence}] + [monoid {"+" Monoid}] + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [control + ["[0]" io]] + [data + ["[0]" product] + ["[0]" text ("[1]#[0]" equivalence)]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Writer}]]) (def: (injection monoid value) (All (_ w) (-> (Monoid w) (Injection (Writer w)))) @@ -52,7 +52,7 @@ (product.left (/.write log)))) (_.cover [/.with /.lifted] (let [lifted (/.lifted text.monoid io.monad) - (^open "io#[0]") io.monad] + (open "io#[0]") io.monad] (|> (do (/.with text.monoid io.monad) [a (lifted (io#in left)) b (in right)] diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index 2e2904b3d..b41a178d2 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -62,7 +62,7 @@ the_array (random.array size random.nat) evens (random.array size (random.only n.even? random.nat))] ($_ _.and - (let [(^open "/#[0]") /.functor + (let [(open "/#[0]") /.functor choose (: (-> Nat (Maybe Text)) (function (_ value) (if (n.even? value) @@ -156,9 +156,9 @@ (!.empty size))))) (_.cover [!.type] (case !.Array - (^ (<| {.#Named (symbol !.Array)} - {.#UnivQ (list)} - {.#Primitive nominal_type (list {.#Parameter 1})})) + (pattern (<| {.#Named (symbol !.Array)} + {.#UnivQ (list)} + {.#Primitive nominal_type (list {.#Parameter 1})})) (same? !.type nominal_type) _ @@ -324,10 +324,10 @@ (/.empty size))))) (_.cover [/.type_name] (case /.Array - (^ (<| {.#Named (symbol /.Array)} - {.#Named (symbol !.Array)} - {.#UnivQ (list)} - {.#Primitive nominal_type (list {.#Parameter 1})})) + (pattern (<| {.#Named (symbol /.Array)} + {.#Named (symbol !.Array)} + {.#UnivQ (list)} + {.#Primitive nominal_type (list {.#Parameter 1})})) (same? /.type_name nominal_type) _ diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 4dec751e4..1054e5248 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -1,28 +1,28 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [hash {"+" Hash}] - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" functor {"+" Injection}]]] - [control - ["[0]" maybe ("[1]#[0]" functor)] - ["[0]" try] - ["[0]" exception]] - [data - ["[0]" product] - [collection - ["[0]" list ("[1]#[0]" functor)] - ["[0]" set]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [hash {"+" Hash}] + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" functor {"+" Injection}]]] + [control + ["[0]" maybe ("[1]#[0]" functor)] + ["[0]" try] + ["[0]" exception]] + [data + ["[0]" product] + [collection + ["[0]" list ("[1]#[0]" functor)] + ["[0]" set]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: injection (Injection (/.Dictionary Nat)) @@ -109,12 +109,12 @@ (list.size (/.values dict)))) (_.cover [/.merged] - (let [merging_with_oneself (let [(^open "[0]") (/.equivalence n.equivalence)] + (let [merging_with_oneself (let [(open "[0]") (/.equivalence n.equivalence)] (= dict (/.merged dict dict))) overwritting_keys (let [dict' (|> dict /.entries (list#each (function (_ [k v]) [k (++ v)])) (/.of_list n.hash)) - (^open "[0]") (/.equivalence n.equivalence)] + (open "[0]") (/.equivalence n.equivalence)] (= dict' (/.merged dict' dict)))] (and merging_with_oneself overwritting_keys))) @@ -125,7 +125,7 @@ (/.values (/.merged_with n.+ dict dict))))) (_.cover [/.of_list] - (let [(^open "[0]") (/.equivalence n.equivalence)] + (let [(open "[0]") (/.equivalence n.equivalence)] (and (= dict dict) (|> dict /.entries (/.of_list n.hash) (= dict))))) ))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 5c8f43b56..3e628ec45 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -1,27 +1,27 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [equivalence {"+" Equivalence}] - [order {"+" Order}] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" maybe ("[1]#[0]" monad)]] - [data - ["[0]" product] - ["[0]" bit ("[1]#[0]" equivalence)] - [collection - ["[0]" set] - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["[0]" random {"+" Random} ("[1]#[0]" monad)] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [equivalence {"+" Equivalence}] + [order {"+" Order}] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" maybe ("[1]#[0]" monad)]] + [data + ["[0]" product] + ["[0]" bit ("[1]#[0]" equivalence)] + [collection + ["[0]" set] + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["[0]" random {"+" Random} ("[1]#[0]" monad)] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public (dictionary order gen_key gen_value size) (All (_ k v) @@ -57,11 +57,11 @@ (n.< left right)) pairs) sorted_values (list#each product.right sorted_pairs) - (^open "list#[0]") (list.equivalence (: (Equivalence [Nat Nat]) - (function (_ [kr vr] [ks vs]) - (and (n.= kr ks) - (n.= vr vs))))) - (^open "/#[0]") (/.equivalence n.equivalence)]] + (open "list#[0]") (list.equivalence (: (Equivalence [Nat Nat]) + (function (_ [kr vr] [ks vs]) + (and (n.= kr ks) + (n.= vr vs))))) + (open "/#[0]") (/.equivalence n.equivalence)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (..dictionary n.order random.nat random.nat size))) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index e4d2bb2aa..88ce2f5b9 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -69,7 +69,7 @@ [parameter random.nat subject random.nat] (let [lifted (/.lifted io.monad) - (^open "io#[0]") io.monad + (open "io#[0]") io.monad expected (n.+ parameter subject)] (_.cover [/.with /.lifted] (|> (io.run! (do (/.with io.monad) @@ -77,7 +77,7 @@ b (in subject)] (in (n.+ a b)))) (pipe.case - (^ (list actual)) + (pattern (list actual)) (n.= expected actual) _ @@ -88,7 +88,7 @@ Test (do [! random.monad] [size ..bounded_size - .let [(^open "/#[0]") (/.equivalence n.equivalence)] + .let [(open "/#[0]") (/.equivalence n.equivalence)] sample (# ! each set.list (random.set n.hash size random.nat))] ($_ _.and (_.cover [/.size] @@ -130,8 +130,8 @@ (def: indices Test - (let [(^open "/#[0]") (/.equivalence n.equivalence) - (^open "/#[0]") /.functor] + (let [(open "/#[0]") (/.equivalence n.equivalence) + (open "/#[0]") /.functor] (do [! random.monad] [sample ..random .let [size (/.size sample)]] @@ -190,8 +190,8 @@ (def: slice Test - (let [(^open "/#[0]") (/.equivalence n.equivalence) - (^open "/#[0]") /.monoid] + (let [(open "/#[0]") (/.equivalence n.equivalence) + (open "/#[0]") /.monoid] (do [! random.monad] [sample (random.only (|>> /.size (n.> 0)) ..random) @@ -239,7 +239,7 @@ (def: member Test - (let [(^open "/#[0]") (/.equivalence n.equivalence)] + (let [(open "/#[0]") (/.equivalence n.equivalence)] (do [! random.monad] [sample ..random] (`` ($_ _.and @@ -277,9 +277,9 @@ (def: grouping Test - (let [(^open "/#[0]") (/.equivalence n.equivalence) - (^open "/#[0]") /.functor - (^open "/#[0]") /.monoid + (let [(open "/#[0]") (/.equivalence n.equivalence) + (open "/#[0]") /.functor + (open "/#[0]") /.monoid +/2 (: (-> Nat Nat Nat) (function (_ left right) @@ -372,7 +372,7 @@ (def: search Test - (let [(^open "/#[0]") /.functor + (let [(open "/#[0]") /.functor choice (: (-> Nat (Maybe Text)) (function (_ value) @@ -415,8 +415,8 @@ Test (<| (_.covering /._) (_.for [.List]) - (let [(^open "/#[0]") (/.equivalence n.equivalence) - (^open "/#[0]") /.functor] + (let [(open "/#[0]") (/.equivalence n.equivalence) + (open "/#[0]") /.functor] (do [! random.monad] [sample ..random separator random.nat] @@ -454,7 +454,7 @@ (/.mixes n.+ 0 sample))) (do random.monad [expected random.nat - .let [(^open "/#[0]") (/.equivalence n.equivalence)]] + .let [(open "/#[0]") (/.equivalence n.equivalence)]] (_.cover [/.when] (and (/#= (list expected) (/.when true (list expected))) (/#= (list) (/.when false (list expected)))))) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 220581bd2..125dfaac9 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -52,7 +52,7 @@ [size (# ! each (n.% 100) random.nat) sample (random.set n.hash size random.nat) .let [sample (|> sample set.list /.of_list)] - .let [(^open "/#[0]") (/.equivalence n.equivalence)]] + .let [(open "/#[0]") (/.equivalence n.equivalence)]] ($_ _.and (_.cover [/.size] (n.= size (/.size sample))) @@ -146,7 +146,7 @@ non_member (random.only (|>> (set.member? sample) not) random.nat) .let [sample (|> sample set.list /.of_list)] - .let [(^open "/#[0]") (/.equivalence n.equivalence)]] + .let [(open "/#[0]") (/.equivalence n.equivalence)]] ($_ _.and (do ! [value/0 random.nat @@ -194,7 +194,7 @@ (n.+ (/.size positives) (/.size negatives)))))) (_.cover [/.one] - (let [(^open "/#[0]") /.functor + (let [(open "/#[0]") /.functor choice (: (-> Nat (Maybe Text)) (function (_ value) (if (n.even? value) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index 81626777f..04a3eed86 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -1,23 +1,23 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [order {"+" Order}] - [\\specification - ["$[0]" equivalence]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random} ("[1]#[0]" monad)] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Set} - ["[0]" //]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [order {"+" Order}] + [\\specification + ["$[0]" equivalence]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random} ("[1]#[0]" monad)] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Set} + ["[0]" //]]]) (def: size (random.Random Nat) @@ -48,7 +48,7 @@ random.nat) .let [listL (//.list usetL)] listR (|> (random.set n.hash sizeR random.nat) (# ! each //.list)) - .let [(^open "/#[0]") /.equivalence + .let [(open "/#[0]") /.equivalence setL (/.of_list n.order listL) setR (/.of_list n.order listR) empty (/.empty n.order)]] diff --git a/stdlib/source/test/lux/data/collection/stream.lux b/stdlib/source/test/lux/data/collection/stream.lux index c959de821..d7fa8a191 100644 --- a/stdlib/source/test/lux/data/collection/stream.lux +++ b/stdlib/source/test/lux/data/collection/stream.lux @@ -1,25 +1,25 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [equivalence {"+" Equivalence}] - ["[0]" enum] - [\\specification - ["$[0]" functor] - ["$[0]" comonad]]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [equivalence {"+" Equivalence}] + ["[0]" enum] + [\\specification + ["$[0]" functor] + ["$[0]" comonad]]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (implementation: (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (/.Stream a)))) @@ -42,7 +42,7 @@ Test (<| (_.covering /._) (_.for [/.Stream]) - (let [(^open "list#[0]") (list.equivalence n.equivalence)]) + (let [(open "list#[0]") (list.equivalence n.equivalence)]) (do [! random.monad] [repeated random.nat index (# ! each (n.% 100) random.nat) @@ -103,8 +103,8 @@ (n.= (++ (n.* 2 offset)) (/.item offset odds))))) (_.cover [/.iterations] - (let [(^open "/#[0]") /.functor - (^open "list#[0]") (list.equivalence text.equivalence)] + (let [(open "/#[0]") /.functor + (open "list#[0]") (list.equivalence text.equivalence)] (list#= (/.first size (/#each %.nat (..iterations ++ offset))) (/.first size @@ -115,8 +115,8 @@ (list#= (list.together (list.repeated size cycle)) (/.first (n.* size (list.size cycle)) (/.cycle [cycle_start cycle_next]))))) - (_.cover [/.^stream&] - (let [(/.^stream& first second third next) (..iterations ++ offset)] + (_.cover [/.pattern] + (let [(/.pattern first second third next) (..iterations ++ offset)] (and (n.= offset first) (n.= (n.+ 1 offset) second) (n.= (n.+ 2 offset) third)))) diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 111597da6..b39f5ea63 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -159,8 +159,8 @@ [[size sample] (//.tree random.nat) expected random.nat dummy (random.only (|>> (n.= expected) not) random.nat) - .let [(^open "tree#[0]") (tree.equivalence n.equivalence) - (^open "list#[0]") (list.equivalence n.equivalence)]] + .let [(open "tree#[0]") (tree.equivalence n.equivalence) + (open "list#[0]") (list.equivalence n.equivalence)]] ($_ _.and (_.for [/.equivalence] ($equivalence.spec (/.equivalence n.equivalence) (# ! each (|>> product.right /.zipper) (//.tree random.nat)))) diff --git a/stdlib/source/test/lux/data/color.lux b/stdlib/source/test/lux/data/color.lux index 9223e6b47..8df8e5813 100644 --- a/stdlib/source/test/lux/data/color.lux +++ b/stdlib/source/test/lux/data/color.lux @@ -1,27 +1,27 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] - [data - [collection - ["[0]" list]]] - [macro - ["[0]" template]] - ["[0]" math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["[0]" int] - ["f" frac] - ["r" rev]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash] + ["$[0]" monoid]]] + [data + [collection + ["[0]" list]]] + [macro + ["[0]" template]] + ["[0]" math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["[0]" int] + ["f" frac] + ["r" rev]]]]] + [\\library + ["[0]" /]]) (def: .public random (Random /.Color) @@ -195,7 +195,7 @@ (..encoding expected) (_.cover [/.complement] (let [~expected (/.complement expected) - (^open "/#[0]") /.equivalence] + (open "/#[0]") /.equivalence] (and (not (/#= expected ~expected)) (/#= expected (/.complement ~expected))))) (_.cover [/.black /.white] diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 9bb1e6ea0..f09796461 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -175,7 +175,7 @@ (format.result /.writer) (<b>.result /.parser))] (in (case (sequence.list tar) - (^ (list {<tag> actual_path})) + (pattern (list {<tag> actual_path})) (text#= (/.from_path expected_path) (/.from_path actual_path)) @@ -204,7 +204,7 @@ (format.result /.writer) (<b>.result /.parser))] (in (case (sequence.list tar) - (^ (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]})) + (pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]})) (let [seconds (: (-> Instant Int) (|>> instant.relative (duration.ticks duration.second)))] (and (text#= (/.from_path expected_path) @@ -262,7 +262,7 @@ (format.result /.writer) (<b>.result /.parser))] (in (case (sequence.list tar) - (^ (list {/.#Normal [_ _ actual_mode _ _]})) + (pattern (list {/.#Normal [_ _ actual_mode _ _]})) (n.= (/.mode expected_mode) (/.mode actual_mode)) @@ -285,7 +285,7 @@ (format.result /.writer) (<b>.result /.parser))] (in (case (sequence.list tar) - (^ (list {/.#Normal [_ _ actual_mode _ _]})) + (pattern (list {/.#Normal [_ _ actual_mode _ _]})) (n.= (/.mode <expected_mode>) (/.mode actual_mode)) @@ -352,7 +352,7 @@ (format.result /.writer) (<b>.result /.parser))] (in (case (sequence.list tar) - (^ (list {/.#Normal [_ _ _ actual_ownership _]})) + (pattern (list {/.#Normal [_ _ _ actual_ownership _]})) (and (text#= (/.from_name expected) (/.from_name (the [/.#user /.#name] actual_ownership))) (text#= (/.from_name /.anonymous) @@ -376,7 +376,7 @@ (format.result /.writer) (<b>.result /.parser))] (in (case (sequence.list tar) - (^ (list {/.#Normal [_ _ _ actual_ownership _]})) + (pattern (list {/.#Normal [_ _ _ actual_ownership _]})) (and (text#= (/.from_name /.anonymous) (/.from_name (the [/.#user /.#name] actual_ownership))) (n.= (/.from_small /.no_id) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 439fe1f5c..c547d400c 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -18,6 +18,8 @@ [collection ["[0]" dictionary] ["[0]" list ("[1]#[0]" functor)]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random} ("[1]#[0]" monad)] [number @@ -77,7 +79,7 @@ ($codec.spec /.equivalence /.codec ..random)) (do [! random.monad] - [(^let symbol [namespace name]) ..symbol] + [(^.let symbol [namespace name]) ..symbol] (`` ($_ _.and (~~ (template [<type> <format>] [(_.cover [<type> <format>] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index ed6cc5d9d..8503e08ac 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -285,7 +285,7 @@ sampleR (random.unicode sizeR) middle (random.unicode 1) .let [sample (/.together (list sampleL sampleR)) - (^open "/#[0]") /.equivalence]] + (open "/#[0]") /.equivalence]] ($_ _.and (_.cover [/.split_at] (|> (/.split_at sizeL sample) @@ -326,7 +326,7 @@ parts (random.list sizeL part_gen) .let [sample1 (/.together (list.interposed sep1 parts)) sample2 (/.together (list.interposed sep2 parts)) - (^open "/#[0]") /.equivalence]] + (open "/#[0]") /.equivalence]] (_.cover [/.replaced] (/#= sample2 (/.replaced sep1 sep2 sample1)))) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 0ab71cbaa..58c26d067 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -62,7 +62,7 @@ (in (list (` (|> (~ input) (<text>.result (~ regex)) (pipe.case - (^ {try.#Success (~ pattern)}) + (pattern {try.#Success (~ pattern)}) true (~ g!_) @@ -305,10 +305,10 @@ [sample1 (random.unicode 3) sample2 (random.unicode 3) sample3 (random.unicode 4)] - (_.cover [/.^regex] + (_.cover [/.pattern] (case (format sample1 "-" sample2 "-" sample3) - (/.^regex "(.{3})-(.{3})-(.{4})" - [_ match1 match2 match3]) + (/.pattern "(.{3})-(.{3})-(.{4})" + [_ match1 match2 match3]) (and (text#= sample1 match1) (text#= sample2 match2) (text#= sample3 match3)) diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 692b28b43..9e6566d91 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -53,7 +53,7 @@ ($_ _.and (_.cover [/.default] (case (`` (/.default (~~ (template.symbol [.._] [g!default])))) - (^ (list definition)) + (pattern (list definition)) (and (|> definition (the /.#definition) (text#= (template.text [g!default]))) @@ -67,7 +67,7 @@ false)) (_.cover [/.documentation:] (case ..documentation: - (^ (list documentation:)) + (pattern (list documentation:)) (and (|> documentation: (the /.#definition) (text#= (template.text [/.documentation:]))) @@ -97,7 +97,7 @@ (text.contains? (template.text ['super_description']) (/.documentation super)) (case ..documentation: - (^ (list documentation:)) + (pattern (list documentation:)) (text.contains? (md.markdown (the /.#documentation documentation:)) (/.documentation super)) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index f2e29ec1a..5cb684336 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -15,6 +15,8 @@ ["%" format {"+" format}]] [collection ["[0]" list]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random} ("[1]#[0]" functor)] [number @@ -31,7 +33,8 @@ ["[1][0]" code] ["[1][0]" local] ["[1][0]" syntax] - ["[1][0]" template]]) + ["[1][0]" template] + ["[1][0]" pattern]]) (template: (!expect <pattern> <value>) [(case <value> @@ -169,7 +172,7 @@ <actual> (/.times <cycles> (..iterated <max> <expected>))] (let [expected_remaining (n.- <cycles> <max>)] (case (` <actual>) - (^code (..iterated (~ [_ {.#Nat actual_remaining}]) (~ [_ {.#Nat actual}]))) + (^.` (..iterated (~ [_ {.#Nat actual_remaining}]) (~ [_ {.#Nat actual}]))) (and (n.= expected_remaining actual_remaining) (n.= <expected> actual)) @@ -188,23 +191,23 @@ (|> (/.symbol symbol_prefix) (# meta.monad each %.code) (meta.result lux) - (!expect (^multi {try.#Success actual_symbol} - (and (text.contains? symbol_prefix actual_symbol) - (text.contains? (%.nat seed) actual_symbol)))))) + (!expect (^.multi {try.#Success actual_symbol} + (and (text.contains? symbol_prefix actual_symbol) + (text.contains? (%.nat seed) actual_symbol)))))) (_.cover [/.wrong_syntax_error] (|> (/.single_expansion (` (/.log_single_expansion!))) (meta.result lux) - (!expect (^multi {try.#Failure error} - (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!)) - error))))) + (!expect (^.multi {try.#Failure error} + (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!)) + error))))) (_.cover [/.with_symbols] (with_expansions [<expected> (fresh_symbol)] (|> (/.with_symbols [<expected>] (# meta.monad in <expected>)) (meta.result lux) - (!expect (^multi {try.#Success [_ {.#Symbol ["" actual]}]} - (text.contains? (template.text [<expected>]) - actual)))))) + (!expect (^.multi {try.#Success [_ {.#Symbol ["" actual]}]} + (text.contains? (template.text [<expected>]) + actual)))))) )) ..test|expansion @@ -213,4 +216,5 @@ /local.test /syntax.test /template.test + /pattern.test ))) diff --git a/stdlib/source/test/lux/macro/pattern.lux b/stdlib/source/test/lux/macro/pattern.lux new file mode 100644 index 000000000..d5b7b9dcb --- /dev/null +++ b/stdlib/source/test/lux/macro/pattern.lux @@ -0,0 +1,98 @@ +(.using + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [macro + ["[0]" code]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["i" int] + ["f" frac]]]]] + [\\library + ["[0]" /]]) + +(type: (Pair l r) + (Record + [#left l + #right r])) + +(template: (!pair <left> <right>) + [[..#left <left> + ..#right <right>]]) + +(def: .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [expected_nat (# ! each (n.% 1) random.nat) + expected_int (# ! each (i.% +1) random.int) + expected_rev (random.either (in .5) + (in .25)) + expected_frac (random.either (in +0.5) + (in +1.25)) + expected_text (random.either (in "+0.5") + (in "+1.25"))] + ($_ _.and + (do [! random.monad] + [sample (# ! each (n.% 5) random.nat)] + (_.cover [/.template] + (case sample + (/.template [<case>] + [<case> true]) + ([0] [1] [2] [3] [4]) + + _ + false))) + (_.cover [/.or] + (and (/.case expected_rev + (/.or .5 .25) true + _ false) + (/.case expected_frac + (/.or +0.5 +1.25) true + _ false) + (/.case expected_text + (/.or "+0.5" "+1.25") true + _ false))) + (_.cover [/.let] + (let [expected_pair (: (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] + (/.case expected_pair + (/.let actual_pair (/.pattern (!pair actual_left actual_right))) + (and (/.same? expected_pair actual_pair) + (/.same? expected_nat actual_left) + (/.same? expected_int actual_right))))) + (_.cover [/.multi] + (let [expected_pair (: (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] + (and (/.case expected_pair + (/.multi (/.pattern (!pair 0 actual_right)) + [actual_right + +0]) + true + + _ + false) + (/.case expected_pair + (/.multi (/.pattern (!pair 0 actual_right)) + (i.= +0 actual_right)) + true + + _ + false)))) + (_.cover [/.|>] + (case expected_frac + (/.|> actual_frac [(f.* +2.0) (f.* +2.0)]) + (f.= (f.* +4.0 expected_frac) + actual_frac))) + (_.cover [/.`] + (case (code.text expected_text) + (/.` "+0.5") true + (/.` "+1.25") true + _ false)) + )))) diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index aa53e0e20..3c7b34b10 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -1,27 +1,27 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [equivalence {"+" Equivalence}] - [monad {"+" do}] - [\\specification - [functor - ["$[0]" contravariant]]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [collection - ["[0]" list] - ["[0]" set]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["r" rev]]]]] - [\\library - ["[0]" / {"+" Fuzzy} - ["/[1]" // "_" - ["[1]" continuous]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [equivalence {"+" Equivalence}] + [monad {"+" do}] + [\\specification + [functor + ["$[0]" contravariant]]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [collection + ["[0]" list] + ["[0]" set]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["r" rev]]]]] + [\\library + ["[0]" / {"+" Fuzzy} + ["/[1]" // "_" + ["[1]" continuous]]]]) (def: trivial Test @@ -92,7 +92,7 @@ (# ! each (|>> set.list (list.sorted r.<))) (random.one (function (_ thresholds) (case thresholds - (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) + (pattern (list threshold_0 threshold_1 threshold_2 threshold_3)) {.#Some [threshold_0 threshold_1 threshold_2 threshold_3]} _ @@ -176,7 +176,7 @@ (# ! each (|>> set.list (list.sorted r.<))) (random.one (function (_ thresholds) (case thresholds - (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) + (pattern (list threshold_0 threshold_1 threshold_2 threshold_3)) {.#Some [threshold_0 threshold_1 threshold_2 threshold_3]} _ diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux index 2c47ee6d1..4a6b893f4 100644 --- a/stdlib/source/test/lux/math/number/int.lux +++ b/stdlib/source/test/lux/math/number/int.lux @@ -77,7 +77,7 @@ Test (<| (_.covering /._) (_.for [.Int]) - (let [(^open "/#[0]") /.interval]) + (let [(open "/#[0]") /.interval]) ($_ _.and (do random.monad [sample random.int diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 276ccf956..d9c1c1ba8 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" monoid] - ["$[0]" codec]]] - [control - ["[0]" maybe ("[1]#[0]" functor)]] - [data - ["[0]" bit ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random}]]]] - [\\library - ["[0]" / - [// - ["n" nat ("[1]#[0]" equivalence)]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" monoid] + ["$[0]" codec]]] + [control + ["[0]" maybe ("[1]#[0]" functor)]] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random}]]]] + [\\library + ["[0]" / + [// + ["n" nat ("[1]#[0]" equivalence)]]]]) (def: part (Random Nat) @@ -54,7 +54,7 @@ ($codec.spec /.equivalence /.codec ..random)) (do random.monad - [.let [(^open "#[0]") /.equivalence] + [.let [(open "#[0]") /.equivalence] denom/0 ..part denom/1 ..part] (_.cover [/.ratio] diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 3aa4fc763..8a4f63425 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -21,13 +21,15 @@ [collection ["[0]" list ("[1]#[0]" functor monoid)] ["[0]" set]]] - [meta - ["[0]" location] - ["[0]" symbol ("[1]#[0]" equivalence)]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random}] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + ["[0]" location] + ["[0]" symbol ("[1]#[0]" equivalence)]]]] [\\library ["[0]" /]] ["[0]" / "_" @@ -77,29 +79,29 @@ (_.cover [/.result] (|> (# /.monad in expected) (/.result expected_lux) - (!expect (^multi {try.#Success actual} - (n.= expected actual))))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual))))) (_.cover [/.result'] (|> (# /.monad in expected) (/.result' expected_lux) - (!expect (^multi {try.#Success [actual_lux actual]} - (and (same? expected_lux actual_lux) - (n.= expected actual)))))) + (!expect (^.multi {try.#Success [actual_lux actual]} + (and (same? expected_lux actual_lux) + (n.= expected actual)))))) (_.cover [/.compiler_state] (|> /.compiler_state (/.result expected_lux) - (!expect (^multi {try.#Success actual_lux} - (same? expected_lux actual_lux))))) + (!expect (^.multi {try.#Success actual_lux} + (same? expected_lux actual_lux))))) (_.cover [/.version] (|> /.version (/.result expected_lux) - (!expect (^multi {try.#Success it} - (same? version it))))) + (!expect (^.multi {try.#Success it} + (same? version it))))) (_.cover [/.configuration] (|> /.configuration (/.result expected_lux) - (!expect (^multi {try.#Success it} - (same? configuration it))))) + (!expect (^.multi {try.#Success it} + (same? configuration it))))) ))) (def: error_handling @@ -137,9 +139,9 @@ (|> (/.failure expected_error) (: (Meta Any)) (/.result expected_lux) - (!expect (^multi {try.#Failure actual_error} - (text#= (location.with location.dummy expected_error) - actual_error))))) + (!expect (^.multi {try.#Failure actual_error} + (text#= (location.with location.dummy expected_error) + actual_error))))) (_.cover [/.assertion] (and (|> (/.assertion expected_error true) (: (Meta Any)) @@ -147,45 +149,45 @@ (!expect {try.#Success []})) (|> (/.assertion expected_error false) (/.result expected_lux) - (!expect (^multi {try.#Failure actual_error} - (text#= expected_error actual_error)))))) + (!expect (^.multi {try.#Failure actual_error} + (text#= expected_error actual_error)))))) (_.cover [/.either] (and (|> (/.either (# /.monad in expected) (: (Meta Nat) (/.failure expected_error))) (/.result expected_lux) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) (# /.monad in expected)) (/.result expected_lux) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) (: (Meta Nat) (/.failure expected_error))) (/.result expected_lux) - (!expect (^multi {try.#Failure actual_error} - (text#= (location.with location.dummy expected_error) - actual_error)))) + (!expect (^.multi {try.#Failure actual_error} + (text#= (location.with location.dummy expected_error) + actual_error)))) (|> (/.either (# /.monad in expected) (# /.monad in dummy)) (/.result expected_lux) - (!expect (^multi {try.#Success actual} - (n.= expected actual)))) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))) )) (_.cover [/.try] (and (|> (/.try (/.failure expected_error)) (/.result expected_lux) - (!expect (^multi {try.#Success {try.#Failure actual_error}} - (text#= (location.with location.dummy expected_error) - actual_error)))) + (!expect (^.multi {try.#Success {try.#Failure actual_error}} + (text#= (location.with location.dummy expected_error) + actual_error)))) (|> (/.try (# /.monad in expected)) (/.result expected_lux) - (!expect (^multi {try.#Success {try.#Success actual}} - (same? expected actual)))))) + (!expect (^.multi {try.#Success {try.#Success actual}} + (same? expected actual)))))) ))) (def: module_related @@ -243,18 +245,18 @@ (_.cover [/.current_module_name] (|> /.current_module_name (/.result expected_lux) - (!expect (^multi {try.#Success actual_current_module} - (text#= expected_current_module actual_current_module))))) + (!expect (^.multi {try.#Success actual_current_module} + (text#= expected_current_module actual_current_module))))) (_.cover [/.current_module] (|> /.current_module (/.result expected_lux) - (!expect (^multi {try.#Success actual_module} - (same? expected_module actual_module))))) + (!expect (^.multi {try.#Success actual_module} + (same? expected_module actual_module))))) (_.cover [/.module] (|> (/.module expected_current_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_module} - (same? expected_module actual_module))))) + (!expect (^.multi {try.#Success actual_module} + (same? expected_module actual_module))))) (_.cover [/.module_exists?] (and (|> (/.module_exists? expected_current_module) (/.result expected_lux) @@ -265,8 +267,8 @@ (_.cover [/.modules] (|> /.modules (/.result expected_lux) - (!expect (^multi {try.#Success actual_modules} - (same? expected_modules actual_modules))))) + (!expect (^.multi {try.#Success actual_modules} + (same? expected_modules actual_modules))))) (_.cover [/.imported_modules] (and (|> (/.imported_modules expected_current_module) (/.result expected_lux) @@ -289,14 +291,14 @@ (_.cover [/.normal] (and (|> (/.normal ["" expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success [actual_module actual_short]} - (and (text#= expected_current_module actual_module) - (same? expected_short actual_short))))) + (!expect (^.multi {try.#Success [actual_module actual_short]} + (and (text#= expected_current_module actual_module) + (same? expected_short actual_short))))) (|> (/.normal [dummy_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success [actual_module actual_short]} - (and (text#= dummy_module actual_module) - (same? expected_short actual_short))))))) + (!expect (^.multi {try.#Success [actual_module actual_short]} + (and (text#= dummy_module actual_module) + (same? expected_short actual_short))))))) )))) (def: random_location @@ -350,19 +352,19 @@ post /.seed] (in [pre post])) (/.result expected_lux) - (!expect (^multi {try.#Success [actual_pre actual_post]} - (and (n.= expected_seed actual_pre) - (n.= (++ expected_seed) actual_post)))))) + (!expect (^.multi {try.#Success [actual_pre actual_post]} + (and (n.= expected_seed actual_pre) + (n.= (++ expected_seed) actual_post)))))) (_.cover [/.location] (|> /.location (/.result expected_lux) - (!expect (^multi {try.#Success actual_location} - (same? expected_location actual_location))))) + (!expect (^.multi {try.#Success actual_location} + (same? expected_location actual_location))))) (_.cover [/.expected_type] (|> /.expected_type (/.result expected_lux) - (!expect (^multi {try.#Success actual_type} - (same? expected_type actual_type))))) + (!expect (^.multi {try.#Success actual_type} + (same? expected_type actual_type))))) (_.cover [.Type_Context /.type_context] (|> /.type_context (/.result expected_lux) @@ -438,14 +440,14 @@ current_globals! (|> (/.globals expected_current_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_globals} - (same? current_globals actual_globals)))) + (!expect (^.multi {try.#Success actual_globals} + (same? current_globals actual_globals)))) macro_globals! (|> (/.globals expected_macro_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_globals} - (same? macro_globals actual_globals))))] + (!expect (^.multi {try.#Success actual_globals} + (same? macro_globals actual_globals))))] (and current_globals! macro_globals!))) (_.cover [.Definition /.definitions] @@ -453,35 +455,35 @@ (expected_lux true {.#Some .Macro})] (and (|> (/.definitions expected_current_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_definitions} - (n.= 0 (list.size actual_definitions))))) + (!expect (^.multi {try.#Success actual_definitions} + (n.= 0 (list.size actual_definitions))))) (|> (/.definitions expected_macro_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_definitions} - (n.= 1 (list.size actual_definitions))))) + (!expect (^.multi {try.#Success actual_definitions} + (n.= 1 (list.size actual_definitions))))) ))) (_.cover [/.exports] (and (let [[current_globals macro_globals expected_lux] (expected_lux true {.#Some .Macro})] (and (|> (/.exports expected_current_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_definitions} - (n.= 0 (list.size actual_definitions))))) + (!expect (^.multi {try.#Success actual_definitions} + (n.= 0 (list.size actual_definitions))))) (|> (/.exports expected_macro_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_definitions} - (n.= 1 (list.size actual_definitions))))) + (!expect (^.multi {try.#Success actual_definitions} + (n.= 1 (list.size actual_definitions))))) )) (let [[current_globals macro_globals expected_lux] (expected_lux false {.#Some .Macro})] (and (|> (/.exports expected_current_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_definitions} - (n.= 0 (list.size actual_definitions))))) + (!expect (^.multi {try.#Success actual_definitions} + (n.= 0 (list.size actual_definitions))))) (|> (/.exports expected_macro_module) (/.result expected_lux) - (!expect (^multi {try.#Success actual_definitions} - (n.= 0 (list.size actual_definitions))))) + (!expect (^.multi {try.#Success actual_definitions} + (n.= 0 (list.size actual_definitions))))) )))) ))) @@ -564,8 +566,8 @@ (expected_lux true {.#Some .Macro})] (|> (/.macro [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success {.#Some actual_value}} - (same? expected_value actual_value))))) + (!expect (^.multi {try.#Success {.#Some actual_value}} + (same? expected_value actual_value))))) not_macro! (let [[current_globals macro_globals expected_lux] @@ -586,8 +588,8 @@ (expected_lux true {.#Some .Macro})] (|> (/.macro [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success {.#Some actual_value}} - (same? expected_value actual_value)))))] + (!expect (^.multi {try.#Success {.#Some actual_value}} + (same? expected_value actual_value)))))] (and same_module! not_macro! not_found! @@ -610,17 +612,17 @@ definition! (|> (/.definition [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success {.#Definition [actual_exported? actual_type actual_value]}} - (and (bit#= expected_exported? actual_exported?) - (same? expected_type actual_type) - (same? (:as Any expected_value) actual_value))))) + (!expect (^.multi {try.#Success {.#Definition [actual_exported? actual_type actual_value]}} + (and (bit#= expected_exported? actual_exported?) + (same? expected_type actual_type) + (same? (:as Any expected_value) actual_value))))) alias! (|> (/.definition [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success {.#Alias [actual_module actual_short]}} - (and (same? expected_macro_module actual_module) - (same? expected_short actual_short)))))] + (!expect (^.multi {try.#Success {.#Alias [actual_module actual_short]}} + (and (same? expected_macro_module actual_module) + (same? expected_short actual_short)))))] (and definition! alias!))) (_.cover [/.definition_type] @@ -630,14 +632,14 @@ definition! (|> (/.definition_type [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success actual_type} - (same? expected_type actual_type)))) + (!expect (^.multi {try.#Success actual_type} + (same? expected_type actual_type)))) alias! (|> (/.definition_type [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success actual_type} - (same? expected_type actual_type))))] + (!expect (^.multi {try.#Success actual_type} + (same? expected_type actual_type))))] (and definition! alias!))) (_.cover [/.type_definition] @@ -647,14 +649,14 @@ definition! (|> (/.type_definition [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success actual_value} - (same? (:as .Type expected_value) actual_value)))) + (!expect (^.multi {try.#Success actual_value} + (same? (:as .Type expected_value) actual_value)))) alias! (|> (/.type_definition [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi {try.#Success actual_value} - (same? (:as .Type expected_value) actual_value))))] + (!expect (^.multi {try.#Success actual_value} + (same? (:as .Type expected_value) actual_value))))] (and definition! alias!))) ))) @@ -755,22 +757,22 @@ (|> [label_module label] /.tag (/.result expected_lux) - (!expect (^multi {try.#Success [actual_index actual_tags actual_type]} - (let [correct_index! - (n.= expected_index - actual_index) - - correct_tags! - (# (list.equivalence symbol.equivalence) = - (list#each (|>> [label_module]) {.#Item tags_0}) - actual_tags) - - correct_type! - (type#= type_0 - actual_type)] - (and correct_index! + (!expect (^.multi {try.#Success [actual_index actual_tags actual_type]} + (let [correct_index! + (n.= expected_index + actual_index) + correct_tags! - correct_type!)))) + (# (list.equivalence symbol.equivalence) = + (list#each (|>> [label_module]) {.#Item tags_0}) + actual_tags) + + correct_type! + (type#= type_0 + actual_type)] + (and correct_index! + correct_tags! + correct_type!)))) ))))) (_.cover [/.slot] (|> {.#Item tags_1} @@ -779,22 +781,22 @@ (|> [label_module label] /.slot (/.result expected_lux) - (!expect (^multi {try.#Success [actual_index actual_tags actual_type]} - (let [correct_index! - (n.= expected_index - actual_index) - - correct_tags! - (# (list.equivalence symbol.equivalence) = - (list#each (|>> [label_module]) {.#Item tags_1}) - actual_tags) - - correct_type! - (type#= type_1 - actual_type)] - (and correct_index! + (!expect (^.multi {try.#Success [actual_index actual_tags actual_type]} + (let [correct_index! + (n.= expected_index + actual_index) + correct_tags! - correct_type!)))) + (# (list.equivalence symbol.equivalence) = + (list#each (|>> [label_module]) {.#Item tags_1}) + actual_tags) + + correct_type! + (type#= type_1 + actual_type)] + (and correct_index! + correct_tags! + correct_type!)))) ))))) ))) @@ -807,7 +809,7 @@ (# ! each set.list) (random.one (function (_ values) (case values - (^ (list name_0 name_1 name_2 name_3 name_4)) + (pattern (list name_0 name_1 name_2 name_3 name_4)) {.#Some [name_0 name_1 name_2 name_3 name_4]} _ @@ -991,16 +993,16 @@ (: (Try Nat)) /.lifted (/.result expected_lux) - (!expect (^multi {try.#Failure actual} - (text#= (location.with expected_location expected_error) - actual)))) + (!expect (^.multi {try.#Failure actual} + (text#= (location.with expected_location expected_error) + actual)))) (|> expected_value {try.#Success} (: (Try Nat)) /.lifted (/.result expected_lux) - (!expect (^multi {try.#Success actual} - (same? expected_value actual))))))) + (!expect (^.multi {try.#Success actual} + (same? expected_value actual))))))) ..compiler_related ..error_handling diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index 261015a31..e12f209d1 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -11,6 +11,8 @@ ["$[0]" codec]]] [data ["[0]" text]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random}] [number @@ -30,11 +32,11 @@ [... First Symbol sizeM1 (|> random.nat (# ! each (n.% 100))) sizeS1 (|> random.nat (# ! each (|>> (n.% 100) (n.max 1)))) - (^let symbol1 [module1 short1]) (..random sizeM1 sizeS1) + (^.let symbol1 [module1 short1]) (..random sizeM1 sizeS1) ... Second Symbol sizeM2 (|> random.nat (# ! each (n.% 100))) sizeS2 (|> random.nat (# ! each (|>> (n.% 100) (n.max 1)))) - (^let symbol2 [module2 short2]) (..random sizeM2 sizeS2)] + (^.let symbol2 [module2 short2]) (..random sizeM2 sizeS2)] (_.for [.Symbol] ($_ _.and (_.for [/.equivalence] @@ -61,7 +63,7 @@ (and (same? module1 (/.module symbol1)) (same? short1 (/.short symbol1)))) (_.for [.symbol] - (let [(^open "/#[0]") /.equivalence] + (let [(open "/#[0]") /.equivalence] ($_ _.and (_.test "Can obtain Symbol from a symbol." (and (/#= [.prelude_module "yolo"] (.symbol .yolo)) diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index e78630278..f2aafead6 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -32,7 +32,7 @@ (do random.monad [inputs (random.list 5 (random.ascii/upper 5))] (_.cover [/.program:] - (let [(^open "list#[0]") (list.equivalence text.equivalence)] + (let [(open "list#[0]") (list.equivalence text.equivalence)] (and (with_expansions [<program> (/.program: all_arguments (io.io all_arguments))] (let [outcome ((: (-> (List Text) (io.IO Any)) diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index a4544e4cc..af1550e29 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" monoid] - ["$[0]" codec]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["i" int]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" enum] + ["$[0]" monoid] + ["$[0]" codec]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["i" int]]]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -41,7 +41,7 @@ (_.cover [/.of_millis /.millis] (|> duration /.millis /.of_millis (# /.equivalence = duration)))) (do random.monad - [.let [(^open "#[0]") /.equivalence] + [.let [(open "#[0]") /.equivalence] expected random.duration parameter random.duration] ($_ _.and @@ -59,12 +59,12 @@ (/.neutral? (/.inverse expected))))) )) (do random.monad - [.let [(^open "#[0]") /.equivalence] + [.let [(open "#[0]") /.equivalence] factor random.nat] (_.cover [/.up /.down] (|> /.milli_second (/.up factor) (/.down factor) (#= /.milli_second)))) (do [! random.monad] - [.let [(^open "#[0]") /.order + [.let [(open "#[0]") /.order positive (|> random.duration (random.only (|>> (#= /.empty) not)) (# ! each (function (_ duration) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index c61d4e163..12f2ca7c3 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -1,28 +1,28 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] - [control - ["[0]" function] - ["[0]" try] - ["[0]" io]] - [data - [collection - ["[0]" list ("[1]#[0]" mix)]]] - [math - ["[0]" random]] - [time - ["[0]" duration {"+" Duration}] - ["[0]" day {"+" Day} ("[1]#[0]" enum)]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" enum] + ["$[0]" codec]]] + [control + ["[0]" function] + ["[0]" try] + ["[0]" io]] + [data + [collection + ["[0]" list ("[1]#[0]" mix)]]] + [math + ["[0]" random]] + [time + ["[0]" duration {"+" Duration}] + ["[0]" day {"+" Day} ("[1]#[0]" enum)]]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -39,7 +39,7 @@ ($codec.spec /.equivalence /.codec random.instant)) (do random.monad - [.let [(^open "#[0]") /.equivalence] + [.let [(open "#[0]") /.equivalence] expected random.instant] ($_ _.and (_.cover [/.millis /.of_millis] @@ -52,8 +52,8 @@ (/.time expected)))) )) (do random.monad - [.let [(^open "#[0]") /.equivalence - (^open "duration#[0]") duration.equivalence] + [.let [(open "#[0]") /.equivalence + (open "duration#[0]") duration.equivalence] from random.instant to random.instant] ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux index eb623b548..02c25c3e6 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux @@ -111,7 +111,7 @@ (`` ($_ _.and (_.cover [/.unit] (case (/.unit) - (^ (/.unit)) + (pattern (/.unit)) true _ @@ -119,7 +119,7 @@ (~~ (template [<tag> <expected>] [(_.cover [<tag>] (case (<tag> <expected>) - (^ (<tag> actual)) + (pattern (<tag> actual)) (same? <expected> actual) _ @@ -146,7 +146,7 @@ expected_right expected_left)] (case (/.variant [expected_lefts expected_right? expected]) - (^ (/.variant [actual_lefts actual_right? actual])) + (pattern (/.variant [actual_lefts actual_right? actual])) (and (same? expected_lefts actual_lefts) (same? expected_right? actual_right?) (same? expected actual)) @@ -155,7 +155,7 @@ false))) (_.cover [/.tuple] (case (/.tuple (list expected_left expected_right)) - (^ (/.tuple (list actual_left actual_right))) + (pattern (/.tuple (list actual_left actual_right))) (and (same? expected_left actual_left) (same? expected_right actual_right)) @@ -173,7 +173,7 @@ (~~ (template [<tag> <expected>] [(_.cover [<tag>] (case (<tag> <expected>) - (^ (<tag> actual)) + (pattern (<tag> actual)) (same? <expected> actual) _ @@ -206,7 +206,7 @@ (case (|> [expected_abstraction (list expected_parameter/0 expected_parameter/1)] /.reified /.reification) - (^ [actual_abstraction (list actual_parameter/0 actual_parameter/1)]) + (pattern [actual_abstraction (list actual_parameter/0 actual_parameter/1)]) (and (same? expected_abstraction actual_abstraction) (same? expected_parameter/0 actual_parameter/0) (same? expected_parameter/1 actual_parameter/1)) @@ -215,7 +215,7 @@ false)) (_.cover [/.no_op] (case (/.no_op expected_parameter/0) - (^ (/.no_op actual)) + (pattern (/.no_op actual)) (same? expected_parameter/0 actual) _ @@ -230,7 +230,7 @@ ($_ _.and (_.cover [/.case] (case (/.case [expected_input expected_match]) - (^ (/.case [actual_input actual_match])) + (pattern (/.case [actual_input actual_match])) (and (same? expected_input actual_input) (same? expected_match actual_match)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux index e7e26bd54..dfd65e1ba 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/coverage.lux @@ -20,6 +20,8 @@ ["[0]" set] ["[0]" dictionary] ["[0]" list ("[1]#[0]" functor mix)]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random} ("[1]#[0]" monad)] [number @@ -144,7 +146,7 @@ (def: test|value Test - (<| (let [(^open "/#[0]") /.equivalence]) + (<| (let [(open "/#[0]") /.equivalence]) (do [! random.monad] [left ..random right ..random] @@ -162,7 +164,7 @@ (def: test|coverage Test - (<| (let [(^open "/#[0]") /.equivalence]) + (<| (let [(open "/#[0]") /.equivalence]) (do [! random.monad] [[expected pattern] ..random_pattern] ($_ _.and @@ -198,7 +200,7 @@ (def: test|variant Test - (<| (let [(^open "/#[0]") /.equivalence]) + (<| (let [(open "/#[0]") /.equivalence]) (do [! random.monad] [[expected/0 pattern/0] ..random_partial_pattern [expected/1 pattern/1] (random.only (|>> product.left (/#= expected/0) not) @@ -223,7 +225,7 @@ (Random [/.Coverage Pattern]) (random.only (function (_ [coverage pattern]) (case coverage - (^or {/.#Alt _} {/.#Seq _}) + (^.or {/.#Alt _} {/.#Seq _}) false _ @@ -232,7 +234,7 @@ (def: test|composite Test - (<| (let [(^open "/#[0]") /.equivalence]) + (<| (let [(open "/#[0]") /.equivalence]) (do [! random.monad] [[expected/0 pattern/0] ..random_value_pattern [expected/1 pattern/1] (random.only (|>> product.left (/#= expected/0) not) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux index 52ab6e6ff..f87e34b08 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/module.lux @@ -122,7 +122,7 @@ (/phase.result state) (try#each (|>> (the .#module_aliases) (pipe.case - (^ (list [actual_alias actual_import])) + (pattern (list [actual_alias actual_import])) (and (same? expected_alias actual_alias) (same? expected_import actual_import)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux index e5eb0c0f5..cd72d2b50 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/pattern.lux @@ -52,11 +52,11 @@ ($equivalence.spec /.equivalence ..random)) (_.cover [/.format] - (bit#= (# /.equivalence = left right) - (text#= (/.format left) (/.format right)))) + (bit#= (# /.equivalence = left right) + (text#= (/.format left) (/.format right)))) (_.cover [/.unit] (case (/.unit) - (^ (/.unit)) + (pattern (/.unit)) true _ @@ -64,7 +64,7 @@ (~~ (template [<tag> <value>] [(_.cover [<tag>] (case (<tag> <value>) - (^ (<tag> actual)) + (pattern (<tag> actual)) (same? <value> actual) _ @@ -80,7 +80,7 @@ )) (_.cover [/.variant] (case (/.variant [expected_lefts expected_right? (/.text expected_text)]) - (^ (/.variant [actual_lefts actual_right? (/.text actual_text)])) + (pattern (/.variant [actual_lefts actual_right? (/.text actual_text)])) (and (same? expected_lefts actual_lefts) (same? expected_right? actual_right?) (same? expected_text actual_text)) @@ -94,12 +94,12 @@ (/.rev expected_rev) (/.frac expected_frac) (/.text expected_text))) - (^ (/.tuple (list (/.bit actual_bit) - (/.nat actual_nat) - (/.int actual_int) - (/.rev actual_rev) - (/.frac actual_frac) - (/.text actual_text)))) + (pattern (/.tuple (list (/.bit actual_bit) + (/.nat actual_nat) + (/.int actual_int) + (/.rev actual_rev) + (/.frac actual_frac) + (/.text actual_text)))) (and (same? expected_bit actual_bit) (same? expected_nat actual_nat) (same? expected_int actual_int) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux index faf28f47e..bd2309561 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/scope.lux @@ -158,7 +158,7 @@ (n.= 1 (list.size (the [.#captured .#mappings] scope/1)))))) (try.else false))) (_.cover [/.environment] - (let [(^open "list#[0]") (list.equivalence //variable.equivalence)] + (let [(open "list#[0]") (list.equivalence //variable.equivalence)] (and (|> (<| /.with (/.with_local [name/0 type/0]) (/.with_local [name/1 type/1]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux index 6c1e342ec..88577b388 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis.lux @@ -64,7 +64,7 @@ //type.inferring)] (in (and (type#= .Any :it:) (case it - (^ (//.unit)) + (pattern (//.unit)) true _ @@ -87,7 +87,7 @@ //type.inferring)] (in (and (type#= <type> :it:) (case it - (^ (<analysis> it)) + (pattern (<analysis> it)) (same? <expected> it) _ @@ -128,7 +128,7 @@ (/.phase ..expander archive.empty) (//type.expecting :variant:))] (in (case it - (^ (//.variant [0 #0 (//.unit)])) + (pattern (//.variant [0 #0 (//.unit)])) true _ @@ -144,7 +144,7 @@ (/.phase ..expander archive.empty) (//type.expecting :variant:))] (in (case it - (^ (//.variant [<lefts> <right> (<analysis> actual)])) + (pattern (//.variant [<lefts> <right> (<analysis> actual)])) (same? <expected> actual) _ @@ -170,7 +170,7 @@ (/.phase ..expander archive.empty) (//type.expecting :either:))] (in (case it - (^ (//.variant [0 #0 (//.unit)])) + (pattern (//.variant [0 #0 (//.unit)])) true _ @@ -196,13 +196,13 @@ (/.phase ..expander archive.empty) (//type.expecting :either:))] (in (case it - (^ (//.variant [0 #1 (//.tuple (list (//.unit) - (//.bit bit/?) - (//.nat nat/?) - (//.int int/?) - (//.rev rev/?) - (//.frac frac/?) - (//.text text/?)))])) + (pattern (//.variant [0 #1 (//.tuple (list (//.unit) + (//.bit bit/?) + (//.nat nat/?) + (//.int int/?) + (//.rev rev/?) + (//.frac frac/?) + (//.text text/?)))])) (and (same? bit/0 bit/?) (same? nat/0 nat/?) (same? int/0 int/?) @@ -242,7 +242,7 @@ (in (and (type#= :variant: :it:) (case it - (^ (//.variant [0 #0 (//.unit)])) + (pattern (//.variant [0 #0 (//.unit)])) true _ @@ -261,7 +261,7 @@ (in (and (type#= :variant: :it:) (case it - (^ (//.variant [<lefts> <right> (<analysis> actual)])) + (pattern (//.variant [<lefts> <right> (<analysis> actual)])) (same? <expected> actual) _ @@ -292,7 +292,7 @@ (in (and (type#= :either: :it:) (case it - (^ (//.variant [0 #0 (//.unit)])) + (pattern (//.variant [0 #0 (//.unit)])) true _ @@ -322,13 +322,13 @@ (in (and (type#= :either: :it:) (case it - (^ (//.variant [0 #1 (//.tuple (list (//.unit) - (//.bit bit/?) - (//.nat nat/?) - (//.int int/?) - (//.rev rev/?) - (//.frac frac/?) - (//.text text/?)))])) + (pattern (//.variant [0 #1 (//.tuple (list (//.unit) + (//.bit bit/?) + (//.nat nat/?) + (//.int int/?) + (//.rev rev/?) + (//.frac frac/?) + (//.text text/?)))])) (and (same? bit/0 bit/?) (same? nat/0 nat/?) (same? int/0 int/?) @@ -364,13 +364,13 @@ (in (and (type#= (type [.Any .Bit .Nat .Int .Rev .Frac .Text]) :it:) (case it - (^ (//.tuple (list (//.unit) - (//.bit bit/?) - (//.nat nat/?) - (//.int int/?) - (//.rev rev/?) - (//.frac frac/?) - (//.text text/?)))) + (pattern (//.tuple (list (//.unit) + (//.bit bit/?) + (//.nat nat/?) + (//.int int/?) + (//.rev rev/?) + (//.frac frac/?) + (//.text text/?)))) (and (same? bit/0 bit/?) (same? nat/0 nat/?) (same? int/0 int/?) @@ -407,13 +407,13 @@ (in (and (type#= :record: :it:) (case it - (^ (//.tuple (list (//.unit) - (//.bit bit/?) - (//.nat nat/?) - (//.int int/?) - (//.rev rev/?) - (//.frac frac/?) - (//.text text/?)))) + (pattern (//.tuple (list (//.unit) + (//.bit bit/?) + (//.nat nat/?) + (//.int int/?) + (//.rev rev/?) + (//.frac frac/?) + (//.text text/?)))) (and (same? bit/0 bit/?) (same? nat/0 nat/?) (same? int/0 int/?) @@ -442,7 +442,7 @@ (in (and (type#= (All (_ a) (-> a .Nat)) :it:) (case it - (^ {//.#Function (list) (//.nat nat/?)}) + (pattern {//.#Function (list) (//.nat nat/?)}) (same? nat/0 nat/?) _ @@ -463,7 +463,7 @@ (in (and (type#= (All (_ a) (-> a (All (_ b) (-> b .Nat)))) :it:) (case it - (^ {//.#Function (list) {//.#Function (list) (//.nat nat/?)}}) + (pattern {//.#Function (list) {//.#Function (list) (//.nat nat/?)}}) (same? nat/0 nat/?) _ @@ -484,7 +484,7 @@ (in (and (type#= (All (_ a) (-> a (All (_ b) (-> b b)))) :it:) (case it - (^ {//.#Function (list) {//.#Function (list) (//.local 1)}}) + (pattern {//.#Function (list) {//.#Function (list) (//.local 1)}}) true _ @@ -503,7 +503,7 @@ (/.phase ..expander archive.empty) //type.inferring)] (in (and (case it - (^ {//.#Function (list) {//.#Function (list (//.local 1)) (//.foreign 0)}}) + (pattern {//.#Function (list) {//.#Function (list (//.local 1)) (//.foreign 0)}}) true _ @@ -529,7 +529,7 @@ ... (/.phase ..expander archive.empty) ... //type.inferring)] ... (in (case it - ... (^ {//.#Function (list) {//.#Function (list) (//.local 0)}}) + ... (pattern {//.#Function (list) {//.#Function (list) (//.local 0)}}) ... true ... _ @@ -547,7 +547,7 @@ ... (/.phase ..expander archive.empty) ... //type.inferring)] ... (in (case it - ... (^ {//.#Function (list) {//.#Function (list (//.local 0)) (//.foreign 0)}}) + ... (pattern {//.#Function (list) {//.#Function (list (//.local 0)) (//.foreign 0)}}) ... true ... _ @@ -572,8 +572,8 @@ //type.inferring)] (in (and (type#= .Bit :it:) (case it - (^ {//.#Apply (//.nat nat/?) - {//.#Function (list) (//.bit bit/?)}}) + (pattern {//.#Apply (//.nat nat/?) + {//.#Function (list) (//.bit bit/?)}}) (and (same? bit/0 bit/?) (same? nat/0 nat/?)) @@ -593,8 +593,8 @@ //type.inferring)] (in (and (type#= .Nat :it:) (case it - (^ {//.#Apply (//.nat nat/?) - {//.#Function (list) (//.local 1)}}) + (pattern {//.#Apply (//.nat nat/?) + {//.#Function (list) (//.local 1)}}) (same? nat/0 nat/?) _ @@ -615,9 +615,9 @@ //type.inferring)] (in (and (check.subsumes? (All (_ a) (-> a Bit)) :it:) (case it - (^ {//.#Apply (//.nat nat/?) - {//.#Function (list) - {//.#Function (list) (//.bit bit/?)}}}) + (pattern {//.#Apply (//.nat nat/?) + {//.#Function (list) + {//.#Function (list) (//.bit bit/?)}}}) (and (same? bit/0 bit/?) (same? nat/0 nat/?)) @@ -642,7 +642,7 @@ //type.inferring)] (in (and (type#= .Text :it:) (case it - (^ {//.#Extension "lux text concat" (list (//.text left) (//.text right))}) + (pattern {//.#Extension "lux text concat" (list (//.text left) (//.text right))}) (and (same? text/0 left) (same? text/0 right)) @@ -675,10 +675,10 @@ //type.inferring)] (in (and (type#= .Frac :it:) (case it - (^ {//.#Case (<analysis> input/?) - [[//.#when (//pattern.bind 0) - //.#then (//.frac frac/?)] - (list)]}) + (pattern {//.#Case (<analysis> input/?) + [[//.#when (//pattern.bind 0) + //.#then (//.frac frac/?)] + (list)]}) (and (same? <input> input/?) (same? frac/0 frac/?)) @@ -700,11 +700,11 @@ //type.inferring)] (in (and (type#= .Frac :it:) (case it - (^ {//.#Case (<analysis> input/?) - [[//.#when (<pattern> pattern/?) - //.#then (//.frac frac/?)] - (list [//.#when (//pattern.bind 0) - //.#then (//.frac frac/?)])]}) + (pattern {//.#Case (<analysis> input/?) + [[//.#when (<pattern> pattern/?) + //.#then (//.frac frac/?)] + (list [//.#when (//pattern.bind 0) + //.#then (//.frac frac/?)])]}) (and (same? <input> input/?) (same? <input> pattern/?) (same? frac/0 frac/?)) @@ -737,11 +737,11 @@ //type.inferring)] (in (and (type#= .Frac :it:) (case it - (^ {//.#Case (//.bit bit/?) - [[//.#when (//pattern.bit #0) - //.#then (//.frac false/?)] - (list [//.#when (//pattern.bit #1) - //.#then (//.frac true/?)])]}) + (pattern {//.#Case (//.bit bit/?) + [[//.#when (//pattern.bit #0) + //.#then (//.frac false/?)] + (list [//.#when (//pattern.bit #1) + //.#then (//.frac true/?)])]}) (and (same? bit/0 bit/?) (same? frac/0 false/?) (same? frac/0 true/?)) @@ -768,11 +768,11 @@ //type.inferring)] (in (and (type#= .Frac :it:) (case it - (^ {//.#Case (//.variant [<lefts> <right?> (<analysis> analysis/?)]) - [[//.#when (//pattern.variant [<lefts> <right?> (<pattern> pattern/?)]) - //.#then (//.frac match/?)] - (list [//.#when (//pattern.bind 0) - //.#then (//.frac mismatch/?)])]}) + (pattern {//.#Case (//.variant [<lefts> <right?> (<analysis> analysis/?)]) + [[//.#when (//pattern.variant [<lefts> <right?> (<pattern> pattern/?)]) + //.#then (//.frac match/?)] + (list [//.#when (//pattern.bind 0) + //.#then (//.frac mismatch/?)])]}) (and (same? <expected> analysis/?) (same? <expected> pattern/?) (same? frac/0 match/?) @@ -807,11 +807,11 @@ //type.inferring)] (in (and (type#= .Frac :it:) (case it - (^ {//.#Case (//.tuple (list (//.bit bit/?) (//.nat nat/?))) - [[//.#when (//pattern.tuple (list (//pattern.bit #0) (//pattern.bind 0))) - //.#then (//.frac false/?)] - (list [//.#when (//pattern.tuple (list (//pattern.bit #1) (//pattern.bind 0))) - //.#then (//.frac true/?)])]}) + (pattern {//.#Case (//.tuple (list (//.bit bit/?) (//.nat nat/?))) + [[//.#when (//pattern.tuple (list (//pattern.bit #0) (//pattern.bind 0))) + //.#then (//.frac false/?)] + (list [//.#when (//pattern.tuple (list (//pattern.bit #1) (//pattern.bind 0))) + //.#then (//.frac true/?)])]}) (and (same? bit/0 bit/?) (same? nat/0 nat/?) (same? frac/0 false/?) @@ -850,23 +850,23 @@ //type.inferring)] (in (and (type#= .Frac :it:) (case it - (^ {//.#Case (//.tuple (list (//.unit) - (//.bit bit/?) - (//.nat nat/?) - (//.int int/?) - (//.rev rev/?) - (//.frac frac/?) - (//.text text/?))) - [[//.#when (//pattern.tuple (list (//pattern.unit) - (//pattern.bit bit/?') - (//pattern.nat nat/?') - (//pattern.int int/?') - (//pattern.rev rev/?') - (//pattern.frac frac/?') - (//pattern.text text/?'))) - //.#then (//.frac match/?)] - (list [//.#when (//pattern.bind 0) - //.#then (//.frac mismatch/?)])]}) + (pattern {//.#Case (//.tuple (list (//.unit) + (//.bit bit/?) + (//.nat nat/?) + (//.int int/?) + (//.rev rev/?) + (//.frac frac/?) + (//.text text/?))) + [[//.#when (//pattern.tuple (list (//pattern.unit) + (//pattern.bit bit/?') + (//pattern.nat nat/?') + (//pattern.int int/?') + (//pattern.rev rev/?') + (//pattern.frac frac/?') + (//pattern.text text/?'))) + //.#then (//.frac match/?)] + (list [//.#when (//pattern.bind 0) + //.#then (//.frac mismatch/?)])]}) (and (same? bit/0 bit/?) (same? bit/0 bit/?') (same? nat/0 nat/?) (same? nat/0 nat/?') (same? int/0 int/?) (same? int/0 int/?') diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux index f27af5d36..f6d69fc56 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/complex.lux @@ -18,6 +18,7 @@ ["[0]" list ("[1]#[0]" monad monoid)] ["[0]" set]]] [macro + ["^" pattern] ["[0]" code]] [math ["[0]" random {"+" Random} ("[1]#[0]" monad)] @@ -104,18 +105,18 @@ (def: (analysed? expected actual) (-> Code Analysis Bit) (case [expected actual] - (^ [[_ {.#Tuple (list)}] (//analysis.unit)]) + (pattern [[_ {.#Tuple (list)}] (//analysis.unit)]) true - (^ [[_ {.#Tuple expected}] (//analysis.tuple actual)]) + (pattern [[_ {.#Tuple expected}] (//analysis.tuple actual)]) (and (n.= (list.size expected) (list.size actual)) (list.every? (function (_ [expected actual]) (analysed? expected actual)) (list.zipped/2 expected actual))) - (^template [<expected> <actual>] - [(^ [[_ {<expected> expected}] (<actual> actual)]) + (^.template [<expected> <actual>] + [(pattern [[_ {<expected> expected}] (<actual> actual)]) (same? expected actual)]) ([.#Bit //analysis.bit] [.#Nat //analysis.nat] @@ -149,7 +150,7 @@ [analysis (|> (/.sum ..analysis lefts right? archive.empty code) (//type.expecting type))] (in (case analysis - (^ (//analysis.variant [lefts' right?' analysis])) + (pattern (//analysis.variant [lefts' right?' analysis])) (and (n.= lefts lefts') (bit#= right? right?') (..analysed? code analysis)) @@ -168,7 +169,7 @@ analysis (|> (/.sum ..analysis lefts right? archive.empty tagC) (//type.expecting varT))] (in (case analysis - (^ (//analysis.variant [lefts' right?' it])) + (pattern (//analysis.variant [lefts' right?' it])) (and (n.= lefts lefts') (bit#= right? right?') (..analysed? tagC it)) @@ -241,7 +242,7 @@ analysis (|> (/.variant ..analysis tag archive.empty tagC) (//type.expecting variantT))] (in (case analysis - (^ (//analysis.variant [lefts' right?' analysis])) + (pattern (//analysis.variant [lefts' right?' analysis])) (and (n.= lefts lefts') (bit#= right? right?') (..analysed? tagC analysis)) @@ -259,7 +260,7 @@ [actualT analysis] (|> (/.variant ..analysis tag archive.empty tagC) //type.inferring)] (in (case analysis - (^ (//analysis.variant [lefts' right?' analysis])) + (pattern (//analysis.variant [lefts' right?' analysis])) (and (n.= lefts lefts') (bit#= right? right?') (..analysed? tagC analysis) @@ -306,7 +307,7 @@ (/.product ..analysis archive.empty) (//type.expecting type))] (in (case analysis - (^ (//analysis.tuple actual)) + (pattern (//analysis.tuple actual)) (and (n.= (list.size expected) (list.size actual)) (list.every? (function (_ [expected actual]) @@ -331,7 +332,7 @@ (/.product ..analysis archive.empty) (//type.expecting varT))] (in (case analysis - (^ (//analysis.tuple actual)) + (pattern (//analysis.tuple actual)) (and (n.= (list.size expected) (list.size actual)) (list.every? (function (_ [expected actual]) @@ -349,7 +350,7 @@ (/.product ..analysis archive.empty) //type.inferring)] (in (case analysis - (^ (//analysis.tuple actual)) + (pattern (//analysis.tuple actual)) (and (n.= (list.size expected) (list.size actual)) (list.every? (function (_ [expected actual]) @@ -372,7 +373,7 @@ (list term/0 term/1 term/2 term/2 term/2)))) :inferred: (//type.check (check.clean (list @var) :inferred:))] (in (case analysis - (^ (//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4))))) + (pattern (//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4))))) (and (type#= (Tuple type/0 type/1 type/2 type/2 type/2) :inferred:) (..analysed? term/0 analysis/0) @@ -392,7 +393,7 @@ (/.product ..analysis archive.empty) (//type.expecting (Tuple type/0 type/1 type/2 type/2 type/2)))] (in (case analysis - (^ (//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4))))) + (pattern (//analysis.tuple (list analysis/0 analysis/1 (//analysis.tuple (list analysis/2 analysis/3 analysis/4))))) (and (..analysed? term/0 analysis/0) (..analysed? term/1 analysis/1) (..analysed? term/2 analysis/2) @@ -481,7 +482,7 @@ (//phase.result state) (pipe.case {try.#Success {.#Some actual}} - (let [(^open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))] + (let [(open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))] (list#= expected (list.reversed actual))) _ @@ -522,7 +523,7 @@ (|> (/.order false (list)) (//phase.result state) (pipe.case - (^ {try.#Success {.#Some [0 (list) actual_type]}}) + (pattern {try.#Success {.#Some [0 (list) actual_type]}}) (same? .Any actual_type) _ diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux index 45fef5649..d8c5ce4f8 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -54,7 +54,7 @@ (//phase.result state) (try#each (|>> product.right (pipe.case - (^ [actual_type (//analysis.local 0)]) + (pattern [actual_type (//analysis.local 0)]) (type#= expected_type actual_type) _ @@ -73,7 +73,7 @@ (try#each (|>> product.right product.right (pipe.case - (^ [actual_type (//analysis.foreign 0)]) + (pattern [actual_type (//analysis.foreign 0)]) (type#= expected_type actual_type) _ @@ -89,7 +89,7 @@ (//phase.result state) (try#each (|>> product.right (pipe.case - (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (pattern [actual_type (//analysis.constant [actual_module actual_name])]) (and (type#= expected_type actual_type) (same? expected_module actual_module) (same? expected_name actual_name)) @@ -109,7 +109,7 @@ (//phase.result state) (try#each (|>> product.right (pipe.case - (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (pattern [actual_type (//analysis.constant [actual_module actual_name])]) (and (type#= expected_type actual_type) (same? import actual_module) (same? expected_name actual_name)) @@ -130,7 +130,7 @@ (//phase.result state) (try#each (|>> product.right (pipe.case - (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (pattern [actual_type (//analysis.constant [actual_module actual_name])]) (and (type#= expected_type actual_type) (same? import actual_module) (same? expected_name actual_name)) @@ -151,7 +151,7 @@ (//phase.result state) (try#each (|>> product.right (pipe.case - (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (pattern [actual_type (//analysis.constant [actual_module actual_name])]) (and (type#= .Type actual_type) (same? expected_module actual_module) (same? expected_name actual_name)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux index 454cebdc6..ea5d4ebb4 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/simple.lux @@ -35,7 +35,7 @@ (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) (pipe.case - (^ {try.#Success analysis}) + (pattern {try.#Success analysis}) (? analysis) _ @@ -47,7 +47,7 @@ (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) (pipe.case - (^ {try.#Failure error}) + (pattern {try.#Failure error}) true _ @@ -59,7 +59,7 @@ (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) (pipe.case - (^ {try.#Success [inferred analysis]}) + (pattern {try.#Success [inferred analysis]}) (and (type#= type inferred) (? analysis)) @@ -70,7 +70,7 @@ [(: (-> <type> Analysis Bit) (function (_ expected) (|>> (pipe.case - (^ (<tag> actual)) + (pattern (<tag> actual)) (same? expected actual) _ @@ -87,7 +87,7 @@ (`` ($_ _.and (_.cover [/.unit] (..analysis state module .Any /.unit - (|>> (pipe.case (^ (/analysis.unit)) true _ false)))) + (|>> (pipe.case (pattern (/analysis.unit)) true _ false)))) (~~ (template [<analysis> <type> <random> <tag>] [(do ! [sample <random>] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index c5d7ccd02..ea325ec72 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -72,7 +72,7 @@ (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) (pipe.case - (^ {try.#Success (synthesis.branch/let [inputS registerS outputS])}) + (pattern {try.#Success (synthesis.branch/let [inputS registerS outputS])}) (and (n.= registerA registerS) (//primitive.corresponds? inputA inputS) (//primitive.corresponds? outputA outputS)) @@ -101,7 +101,7 @@ (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) (pipe.case - (^ {try.#Success (synthesis.branch/if [inputS thenS elseS])}) + (pattern {try.#Success (synthesis.branch/if [inputS thenS elseS])}) (and (//primitive.corresponds? inputA inputS) (//primitive.corresponds? thenA thenS) (//primitive.corresponds? elseA elseS)) @@ -161,7 +161,7 @@ (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) (pipe.case - (^ {try.#Success (synthesis.branch/get [pathS recordS])}) + (pattern {try.#Success (synthesis.branch/get [pathS recordS])}) (and (# (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS) (//primitive.corresponds? recordA recordS)) @@ -189,7 +189,7 @@ (random.set hash 5) (# random.monad each (|>> set.list (pipe.case - (^ (list s0 s1 s2 s3 s4)) + (pattern (list s0 s1 s2 s3 s4)) [s0 s1 s2 s3 s4] _ @@ -338,7 +338,7 @@ (|> (/.synthesize_case //.phase archive.empty expected_input match) (phase.result [///bundle.empty synthesis.init]) (pipe.case - (^ {try.#Success (synthesis.branch/case [actual_input actual_path])}) + (pattern {try.#Success (synthesis.branch/case [actual_input actual_path])}) (and (# synthesis.equivalence = expected_input actual_input) (# synthesis.path_equivalence = expected_path actual_path)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 79b5c2e8a..ba3f7dc86 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -1,40 +1,42 @@ (.using - [lux "*" - ["_" test {"+" Test}] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" try]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [number - ["n" nat]] - [collection - ["[0]" list ("[1]#[0]" functor mix monoid)] - ["[0]" dictionary {"+" Dictionary}] - ["[0]" set]]] - [math - ["[0]" random {"+" Random}]]] - ["[0]" // "_" - ["[1][0]" primitive]] - [\\ - ["[0]" / - ["/[1]" // - ["/[1]" // "_" - [extension - ["[1][0]" bundle]] - ["/[1]" // - ["[0]" analysis {"+" Analysis}] - ["[0]" synthesis {"+" Synthesis}] - [/// - [arity {"+" Arity}] - ["[0]" reference - ["[0]" variable {"+" Variable}]] - ["[0]" phase] - [meta - ["[0]" archive]]]]]]]]) + [lux "*" + ["_" test {"+" Test}] + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" try]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [number + ["n" nat]] + [collection + ["[0]" list ("[1]#[0]" functor mix monoid)] + ["[0]" dictionary {"+" Dictionary}] + ["[0]" set]]] + [macro + ["^" pattern]] + [math + ["[0]" random {"+" Random}]]] + ["[0]" // "_" + ["[1][0]" primitive]] + [\\ + ["[0]" / + ["/[1]" // + ["/[1]" // "_" + [extension + ["[1][0]" bundle]] + ["/[1]" // + ["[0]" analysis {"+" Analysis}] + ["[0]" synthesis {"+" Synthesis}] + [/// + [arity {"+" Arity}] + ["[0]" reference + ["[0]" variable {"+" Variable}]] + ["[0]" phase] + [meta + ["[0]" archive]]]]]]]]) (def: (n_function loop? arity body) (-> Bit Arity Synthesis Synthesis) @@ -432,8 +434,8 @@ (|> input (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (!expect (^multi {try.#Success actual} - (# synthesis.equivalence = expected actual))))))) + (!expect (^.multi {try.#Success actual} + (# synthesis.equivalence = expected actual))))))) (def: application Test @@ -445,15 +447,15 @@ (and (|> (analysis.apply [funcA argsA]) (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (!expect (^multi (^ {try.#Success (synthesis.function/apply [funcS argsS])}) - (and (//primitive.corresponds? funcA funcS) - (list.every? (product.uncurried //primitive.corresponds?) - (list.zipped/2 argsA argsS)))))) + (!expect (^.multi (pattern {try.#Success (synthesis.function/apply [funcS argsS])}) + (and (//primitive.corresponds? funcA funcS) + (list.every? (product.uncurried //primitive.corresponds?) + (list.zipped/2 argsA argsS)))))) (|> (analysis.apply [funcA (list)]) (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (!expect (^multi {try.#Success funcS} - (//primitive.corresponds? funcA funcS)))))))) + (!expect (^.multi {try.#Success funcS} + (//primitive.corresponds? funcA funcS)))))))) (def: .public test Test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 4a89589e2..1f220e13a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -1,27 +1,27 @@ (.using - [lux {"-" structure loop function} - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - ["[0]" exception]] - [data - [number - ["n" nat]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["[0]" random {"+" Random} ("[1]#[0]" monad)]]] - [\\ - ["[0]" / - [//// - ["[0]" analysis {"+" Environment}] - ["/[1]" synthesis {"+" Member Path Synthesis}] - [/// - [arity {"+" Arity}] - ["[0]" reference {"+" Constant} - ["[0]" variable {"+" Register Variable}]]]]]]) + [lux {"-" structure loop function} + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" try] + ["[0]" exception]] + [data + [number + ["n" nat]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["[0]" random {"+" Random} ("[1]#[0]" monad)]]] + [\\ + ["[0]" / + [//// + ["[0]" analysis {"+" Environment}] + ["/[1]" synthesis {"+" Member Path Synthesis}] + [/// + [arity {"+" Arity}] + ["[0]" reference {"+" Constant} + ["[0]" variable {"+" Register Variable}]]]]]]) (type: (Scenario a) (-> Register Arity Register (Random [Register [a a]]))) @@ -279,8 +279,8 @@ (list#each (|>> {variable.#Local}))) //.#arity arity //.#body iteration]) - (^ {.#Some (//.loop/scope [actual_offset actual_inits - actual])}) + (pattern {.#Some (//.loop/scope [actual_offset actual_inits + actual])}) (and (n.= expected_offset actual_offset) (# (list.equivalence //.equivalence) = diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux index 159207280..80499a5e2 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux @@ -60,8 +60,8 @@ [////analysis.#Text (|>) ////synthesis.#Text (|>)] )) - (^ [(////analysis.tuple expected) - (////synthesis.tuple actual)]) + (pattern [(////analysis.tuple expected) + (////synthesis.tuple actual)]) (and (n.= (list.size expected) (list.size actual)) (list.every? (function (_ [expected actual]) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index 2f66190b4..6adfb95b2 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -49,7 +49,7 @@ (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) (pipe.case - (^ {try.#Success (////synthesis.variant [leftsS right?S valueS])}) + (pattern {try.#Success (////synthesis.variant [leftsS right?S valueS])}) (let [tagS (if right?S (++ leftsS) leftsS)] (and (n.= tagA tagS) (|> tagS (n.= (-- size)) (bit#= right?S)) @@ -68,7 +68,7 @@ (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) (pipe.case - (^ {try.#Success (////synthesis.tuple membersS)}) + (pattern {try.#Success (////synthesis.tuple membersS)}) (and (n.= size (list.size membersS)) (list.every? (product.uncurried //primitive.corresponds?) (list.zipped/2 membersA membersS))) 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 42a9d531a..f6085d963 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 @@ -15,7 +15,9 @@ ["n" nat]] [collection ["[0]" list ("[1]#[0]" functor mix)] - ["[0]" dictionary {"+" Dictionary}]]]] + ["[0]" dictionary {"+" Dictionary}]]] + [macro + ["^" pattern]]] [\\ ["[0]" / [//// @@ -329,6 +331,6 @@ [[expected input] (..scenario ..default)] (_.cover [/.optimization] (|> (/.optimization input) - (!expect (^multi {try.#Success actual} - (# synthesis.equivalence = expected actual)))))) + (!expect (^.multi {try.#Success actual} + (# synthesis.equivalence = expected actual)))))) ))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive.lux b/stdlib/source/test/lux/tool/compiler/meta/archive.lux index f89666969..e8b0dbb26 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive.lux @@ -137,7 +137,7 @@ /.#registry /registry.empty]] archive (/.has module/0 entry archive) .let [post (/.archived archive) - (^open "list#[0]") (list.equivalence text.equivalence)]] + (open "list#[0]") (list.equivalence text.equivalence)]] (in (and (list#= (list) pre) (list#= (list module/0) post)))) (try.else false))) @@ -153,7 +153,7 @@ archive (/.has module/0 entry archive)] (in (and (list.empty? pre) (case (/.entries archive) - (^ (list [module/0' @module/0' entry'])) + (pattern (list [module/0' @module/0' entry'])) (and (same? module/0 module/0') (same? @module/0 @module/0') (same? entry entry')) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux index b26e16b6a..e347edf4a 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux @@ -70,7 +70,7 @@ (_.cover [/.resource] (let [[@it registry] (/.resource mandatory? expected_dependencies /.empty)] (case (sequence.list (/.artifacts registry)) - (^ (list [artifact actual_dependencies])) + (pattern (list [artifact actual_dependencies])) (and (same? @it (the artifact.#id artifact)) (same? mandatory? (the artifact.#mandatory? artifact)) (tagged? category.#Anonymous (the artifact.#category artifact)) @@ -84,13 +84,13 @@ <wrong_expected> <wrong_expected>'] (and (let [[@it registry] (<new> <expected> mandatory? expected_dependencies /.empty)] (and (case (<query> registry) - (^ (list actual_name)) + (pattern (list actual_name)) (same? <expected> actual_name) _ false) (case (sequence.list (/.artifacts registry)) - (^ (list [artifact actual_dependencies])) + (pattern (list [artifact actual_dependencies])) (and (same? @it (the artifact.#id artifact)) (same? mandatory? (the artifact.#mandatory? artifact)) (case (the artifact.#category artifact) @@ -105,7 +105,7 @@ false))) (let [[@it registry] (<wrong_new> <wrong_expected> mandatory? expected_dependencies /.empty)] (case (<query> registry) - (^ (list)) + (pattern (list)) true _ diff --git a/stdlib/source/test/lux/tool/compiler/meta/cli.lux b/stdlib/source/test/lux/tool/compiler/meta/cli.lux index 725d1f495..ab9504ee5 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/cli.lux @@ -33,7 +33,7 @@ Test (<| (_.covering /._) (_.for [/.Service /.service]) - (let [(^open "list#[0]") (list.equivalence text.equivalence)]) + (let [(open "list#[0]") (list.equivalence text.equivalence)]) (do [! random.monad] [amount (# ! each (|>> (n.% 5) ++) random.nat) sources (random.list amount (random.ascii/lower 1)) diff --git a/stdlib/source/test/lux/tool/compiler/meta/export.lux b/stdlib/source/test/lux/tool/compiler/meta/export.lux index 762449a9e..82efdf546 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/export.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/export.lux @@ -80,8 +80,8 @@ (try#each (|>> product.left sequence.list (pipe.case - (^ (list {tar.#Normal [actual_path/0 when/0 mode/0 ownership/0 actual_content/0]} - {tar.#Normal [actual_path/1 when/1 mode/1 ownership/1 actual_content/1]})) + (pattern (list {tar.#Normal [actual_path/0 when/0 mode/0 ownership/0 actual_content/0]} + {tar.#Normal [actual_path/1 when/1 mode/1 ownership/1 actual_content/1]})) (with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0)) (same? /.mode mode/0) (same? /.ownership ownership/0) @@ -103,8 +103,8 @@ (try#each (|>> product.right sequence.list (pipe.case - (^ (list {tar.#Normal [actual_path/0 _ _ _ actual_content/0]} - {tar.#Normal [actual_path/1 _ _ _ actual_content/1]})) + (pattern (list {tar.#Normal [actual_path/0 _ _ _ actual_content/0]} + {tar.#Normal [actual_path/1 _ _ _ actual_content/1]})) (with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0)) (binary#= content/0 (tar.data actual_content/0))) (and (text#= file/1' (tar.from_path actual_path/1)) diff --git a/stdlib/source/test/lux/tool/compiler/reference.lux b/stdlib/source/test/lux/tool/compiler/reference.lux index fd76a5146..e938f99b9 100644 --- a/stdlib/source/test/lux/tool/compiler/reference.lux +++ b/stdlib/source/test/lux/tool/compiler/reference.lux @@ -52,7 +52,7 @@ (~~ (template [<tag>] [(_.cover [<tag>] (case (<tag> expected_register) - (^ (<tag> actual_register)) + (pattern (<tag> actual_register)) (n.= expected_register actual_register) _ @@ -65,20 +65,20 @@ (_.cover [/.variable /.self] (and (# /.equivalence = (/.self) (/.variable (variable.self))) (case (/.self) - (^ (/.self)) + (pattern (/.self)) true _ false) (case (/.variable (variable.self)) - (^ (/.self)) + (pattern (/.self)) true _ false))) (_.cover [/.constant] (case (/.constant expected_constant) - (^ (/.constant actual_constant)) + (pattern (/.constant actual_constant)) (symbol#= expected_constant actual_constant) _ diff --git a/stdlib/source/test/lux/tool/compiler/reference/variable.lux b/stdlib/source/test/lux/tool/compiler/reference/variable.lux index 15d0997e4..0c0c88936 100644 --- a/stdlib/source/test/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/reference/variable.lux @@ -34,7 +34,7 @@ ($hash.spec /.hash ..random)) (_.cover [/.self] (case (/.self) - (^ (/.self)) true + (pattern (/.self)) true _ false)) (_.cover [/.self?] (/.self? (/.self))) diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index a9799f045..c173fdc85 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -16,6 +16,7 @@ ["[0]" list] ["[0]" array]]] [macro + ["^" pattern] ["[0]" code ("[1]#[0]" equivalence)]] [math ["[0]" random {"+" Random} ("[1]#[0]" monad)] @@ -97,15 +98,15 @@ members (|> (..random 0) (random.only (function (_ type) (case type - (^or {.#Sum _} {.#Product _}) + (^.or {.#Sum _} {.#Product _}) #0 _ #1))) (list.repeated size) (monad.all !)) - .let [(^open "/#[0]") /.equivalence - (^open "list#[0]") (list.equivalence /.equivalence)]] + .let [(open "/#[0]") /.equivalence + (open "list#[0]") (list.equivalence /.equivalence)]] (`` ($_ _.and (~~ (template [<ctor> <dtor> <unit>] [(_.cover [<ctor> <dtor>] @@ -132,13 +133,13 @@ extra (|> (..random 0) (random.only (function (_ type) (case type - (^or {.#Function _} {.#Apply _}) + (^.or {.#Function _} {.#Apply _}) #0 _ #1)))) - .let [(^open "/#[0]") /.equivalence - (^open "list#[0]") (list.equivalence /.equivalence)]] + .let [(open "/#[0]") /.equivalence + (open "list#[0]") (list.equivalence /.equivalence)]] ($_ _.and (_.cover [/.function /.flat_function] (let [[inputs output] (|> (/.function members extra) /.flat_function)] @@ -153,12 +154,12 @@ body_type (|> (..random 0) (random.only (function (_ type) (case type - (^or {.#UnivQ _} {.#ExQ _}) + (^.or {.#UnivQ _} {.#ExQ _}) #0 _ #1)))) - .let [(^open "/#[0]") /.equivalence]] + .let [(open "/#[0]") /.equivalence]] (`` ($_ _.and (~~ (template [<ctor> <dtor>] [(_.cover [<ctor> <dtor>] @@ -179,12 +180,12 @@ element_type (|> (..random 0) (random.only (function (_ type) (case type - (^ {.#Primitive name (list element_type)}) + (pattern {.#Primitive name (list element_type)}) (not (text#= array.type_name name)) _ #1)))) - .let [(^open "/#[0]") /.equivalence]] + .let [(open "/#[0]") /.equivalence]] ($_ _.and (_.cover [/.array /.flat_array] (let [[flat_depth flat_element] (|> element_type (/.array depth) /.flat_array)] @@ -229,7 +230,7 @@ (I64 a) (.i64 expected))))) (do random.monad - [.let [(^open "/#[0]") /.equivalence] + [.let [(open "/#[0]") /.equivalence] left (..random 0) right (..random 0)] ($_ _.and diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 04ab804ec..05ced5386 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -22,6 +22,8 @@ [collection ["[0]" list ("[1]#[0]" functor monoid)] ["[0]" set]]] + [macro + ["^" pattern]] [math ["[0]" random {"+" Random} ("[1]#[0]" monad)] [number @@ -77,7 +79,7 @@ {.#Ex id} #1 - (^template [<tag>] + (^.template [<tag>] [{<tag> left right} (and (valid_type? left) (valid_type? right))]) diff --git a/stdlib/source/test/lux/type/implicit.lux b/stdlib/source/test/lux/type/implicit.lux index b061ea059..38e683a02 100644 --- a/stdlib/source/test/lux/type/implicit.lux +++ b/stdlib/source/test/lux/type/implicit.lux @@ -1,23 +1,23 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [equivalence {"+" }] - [functor {"+" }] - [monoid {"+" }] - [monad {"+" do}] - ["[0]" enum]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [equivalence {"+" }] + [functor {"+" }] + [monoid {"+" }] + [monad {"+" do}] + ["[0]" enum]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (/.implicit: [n.multiplication]) @@ -36,7 +36,7 @@ ($_ _.and (_.cover [/.##] (let [first_order! - (let [(^open "list#[0]") (list.equivalence n.equivalence)] + (let [(open "list#[0]") (list.equivalence n.equivalence)] (and (bit#= (# n.equivalence = left right) (/.## = left right)) (list#= (# list.functor each ++ (enum.range n.enum start end)) diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index c997eadef..714ea853b 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" debug] - ["[0]" meta] - [abstract - [monad {"+" do}] - [equivalence {"+" Equivalence}] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - ["[0]" random {"+" Random}] - [number - ["i" int] - ["[0]" ratio ("[1]#[0]" equivalence)]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" debug] + ["[0]" meta] + [abstract + [monad {"+" do}] + [equivalence {"+" Equivalence}] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" enum]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + ["[0]" random {"+" Random}] + [number + ["i" int] + ["[0]" ratio ("[1]#[0]" equivalence)]]]]] + [\\library + ["[0]" /]]) (template [<name> <type> <unit>] [(def: (<name> range) @@ -101,8 +101,8 @@ (# ! each (i.% +1,000)) (# ! each (i.* +1,000,000,000)) (# ! each (# /.meter in))) - .let [(^open "meter#[0]") (: (Equivalence (/.Qty /.Meter)) - /.equivalence)] + .let [(open "meter#[0]") (: (Equivalence (/.Qty /.Meter)) + /.equivalence)] unscaled (|> random.int (# ! each (i.% +1,000)) (# ! each (i.* (.int how::to))) @@ -156,8 +156,8 @@ Test (do random.monad [.let [zero (# /.meter in +0) - (^open "meter#[0]") (: (Equivalence (/.Qty /.Meter)) - /.equivalence)] + (open "meter#[0]") (: (Equivalence (/.Qty /.Meter)) + /.equivalence)] left (random.only (|>> (meter#= zero) not) (..meter 1,000)) right (..meter 1,000) extra (..second 1,000)] diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index 5c05b5437..f494b7705 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -17,6 +17,8 @@ [collection ["[0]" dictionary {"+" Dictionary}] ["[0]" list]]] + [macro + ["^" pattern]] [math ["[0]" random]] [time @@ -70,8 +72,8 @@ [now instant.now disk' (atom.read! disk)] (case (dictionary.value @ disk') - (^or {.#None} - {.#Some {.#Left _}}) + (^.or {.#None} + {.#Some {.#Left _}}) (do ! [_ (atom.compare_and_swap! disk' (dictionary.has @ {.#Left [now it]} disk') disk)] (case (/.parent fs @) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index cd7c95c46..cbdb160d9 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -104,7 +104,7 @@ poll/pre (# watcher poll []) poll/post (# watcher poll [])] (in (and (case poll/pre - (^ (list [concern actual_path])) + (pattern (list [concern actual_path])) (and (text#= expected_path actual_path) (and (/.creation? concern) (not (/.modification? concern)) @@ -122,7 +122,7 @@ poll/2 (# watcher poll []) poll/2' (# watcher poll [])] (in (and (case poll/2 - (^ (list [concern actual_path])) + (pattern (list [concern actual_path])) (and (text#= expected_path actual_path) (and (not (/.creation? concern)) (/.modification? concern) @@ -139,7 +139,7 @@ poll/3 (# watcher poll []) poll/3' (# watcher poll [])] (in (and (case poll/3 - (^ (list [concern actual_path])) + (pattern (list [concern actual_path])) (and (not (/.creation? concern)) (not (/.modification? concern)) (/.deletion? concern)) |