diff options
Diffstat (limited to '')
112 files changed, 2354 insertions, 2201 deletions
diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux index 330370e9f..4326a6d49 100644 --- a/stdlib/source/documentation/lux/control/pipe.lux +++ b/stdlib/source/documentation/lux/control/pipe.lux @@ -1,117 +1,118 @@ (.using - [library - [lux {"-" if loop} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" let cond if loop exec case} + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) -(documentation: /.new> +(documentation: /.new "Ignores the piped argument, and begins a new pipe." [(n.= 1 (|> 20 (n.* 3) (n.+ 4) - (new> 0 [++])))]) + (new 0 [++])))]) -(documentation: /.let> +(documentation: /.let "Gives a name to the piped-argument, within the given expression." [(n.= 10 (|> 5 - (let> x (n.+ x x))))]) + (let x (n.+ x x))))]) -(documentation: /.cond> +(documentation: /.cond (format "Branching for pipes." \n "Both the tests and the bodies are piped-code, and must be given inside a tuple.") [(|> +5 - (cond> [i.even?] [(i.* +2)] - [i.odd?] [(i.* +3)] - [(new> -1 [])]))]) + (cond [i.even?] [(i.* +2)] + [i.odd?] [(i.* +3)] + [(new -1 [])]))]) -(documentation: /.if> +(documentation: /.if "If-branching." [(same? (if (n.even? sample) "even" "odd") (|> sample - (if> [n.even?] - [(new> "even" [])] - [(new> "odd" [])])))]) + (if [n.even?] + [(new "even" [])] + [(new "odd" [])])))]) -(documentation: /.when> +(documentation: /.when "Only execute the body when the test passes." [(same? (if (n.even? sample) (n.* 2 sample) sample) (|> sample - (when> [n.even?] - [(n.* 2)])))]) + (when [n.even?] + [(n.* 2)])))]) -(documentation: /.loop> +(documentation: /.loop (format "Loops for pipes." \n "Both the testing and calculating steps are pipes and must be given inside tuples.") [(|> +1 - (loop> [(i.< +10)] - [++]))]) + (loop [(i.< +10)] + [++]))]) -(documentation: /.do> +(documentation: /.do (format "Monadic pipes." \n "Each steps in the monadic computation is a pipe and must be given inside a tuple.") [(|> +5 - (do> identity.monad - [(i.* +3)] - [(i.+ +4)] - [++]))]) + (do identity.monad + [(i.* +3)] + [(i.+ +4)] + [++]))]) -(documentation: /.exec> +(documentation: /.exec (format "Non-updating pipes." \n "Will generate piped computations, but their results will not be used in the larger scope.") [(|> +5 - (exec> [.nat %n log!]) + (exec [.nat %n log!]) (i.* +10))]) -(documentation: /.tuple> +(documentation: /.tuple (format "Parallel branching for pipes." \n "Allows to run multiple pipelines for a value and gives you a tuple of the outputs.") [(|> +5 - (tuple> [(i.* +10)] - [-- (i./ +2)] - [i#encoded])) + (tuple [(i.* +10)] + [-- (i./ +2)] + [i#encoded])) "=>" [+50 +2 "+5"]]) -(documentation: /.case> +(documentation: /.case (format "Pattern-matching for pipes." \n "The bodies of each branch are NOT pipes; just regular values.") [(|> +5 - (case> +0 "zero" - +1 "one" - +2 "two" - +3 "three" - +4 "four" - +5 "five" - +6 "six" - +7 "seven" - +8 "eight" - +9 "nine" - _ "???"))]) + (case + +0 "zero" + +1 "one" + +2 "two" + +3 "three" + +4 "four" + +5 "five" + +6 "six" + +7 "seven" + +8 "eight" + +9 "nine" + _ "???"))]) (.def: .public documentation (.List $.Module) ($.module /._ "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities." - [..new> - ..let> - ..cond> - ..if> - ..when> - ..loop> - ..do> - ..exec> - ..tuple> - ..case>] + [..new + ..let + ..cond + ..if + ..when + ..loop + ..do + ..exec + ..tuple + ..case] [])) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index d534c198c..cfa4fb11f 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -5,7 +5,7 @@ [abstract monad] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" function] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}] @@ -112,11 +112,12 @@ (|> obituary async.value (# io.functor each - (|>> (case> {.#None} - bit.yes + (|>> (pipe.case + {.#None} + bit.yes - _ - bit.no)))))) + _ + bit.no)))))) (def: .public (obituary' actor) (All (_ s) (-> (Actor s) (IO (Maybe (Obituary s))))) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index b131ddd1e..489513399 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -6,7 +6,7 @@ [apply {"+" Apply}] ["[0]" monad {"+" Monad do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" function] ["[0]" io {"+" IO io}]] [data @@ -82,11 +82,12 @@ (All (_ a) (-> (Async a) (IO Bit))) (|>> ..value (# io.functor each - (|>> (case> {.#None} - #0 + (|>> (pipe.case + {.#None} + #0 - {.#Some _} - #1))))) + {.#Some _} + #1))))) (implementation: .public functor (Functor Async) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 58e664966..d30da93b7 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -4,7 +4,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" if>}] + ["[0]" pipe] ["[0]" io {"+" IO}] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}]] @@ -54,9 +54,9 @@ (with_expansions [<had_open_position?> (as_is (the #open_positions) (i.> -1))] (do io.monad [[_ state'] (atom.update! (|>> (revised #open_positions --) - (if> [<had_open_position?>] - [] - [(revised #waiting_list (queue.end sink))])) + (pipe.if [<had_open_position?>] + [] + [(revised #waiting_list (queue.end sink))])) semaphore)] (with_expansions [<go_ahead> (sink []) <get_in_line> (in false)] diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index ef50f8f86..5251267d6 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -1,37 +1,37 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - ["<>" parser - ["<[0]>" code {"+" Parser}]]] - [data - ["[0]" identity] - [collection - ["[0]" list ("[1]#[0]" monad)]]] - [macro {"+" with_symbols} - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["n" nat] - ["i" int]]]]]) + [library + [lux {"-" let cond if loop exec case} + [abstract + ["[0]" monad]] + [control + ["[0]" try] + ["<>" parser + ["<[0]>" code {"+" Parser}]]] + [data + ["[0]" identity] + [collection + ["[0]" list ("[1]#[0]" monad)]]] + [macro {"+" with_symbols} + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["n" nat] + ["i" int]]]]]) (def: body^ (Parser (List Code)) (<code>.tuple (<>.some <code>.any))) -(syntax: .public (new> [start <code>.any - body body^ - prev <code>.any]) +(syntax: .public (new [start <code>.any + body body^ + prev <code>.any]) (in (list (` (|> (~ start) (~+ body)))))) -(syntax: .public (let> [binding <code>.any - body <code>.any - prev <code>.any]) - (in (list (` (let [(~ binding) (~ prev)] +(syntax: .public (let [binding <code>.any + body <code>.any + prev <code>.any]) + (in (list (` (.let [(~ binding) (~ prev)] (~ body)))))) (def: _reversed_ @@ -39,53 +39,53 @@ (function (_ tokens) {try.#Success [(list.reversed tokens) []]})) -(syntax: .public (cond> [_ _reversed_ - prev <code>.any - else body^ - _ _reversed_ - branches (<>.some (<>.and body^ body^))]) +(syntax: .public (cond [_ _reversed_ + prev <code>.any + else body^ + _ _reversed_ + branches (<>.some (<>.and body^ body^))]) (with_symbols [g!temp] - (in (list (` (let [(~ g!temp) (~ prev)] - (cond (~+ (do list.monad - [[test then] branches] - (list (` (|> (~ g!temp) (~+ test))) - (` (|> (~ g!temp) (~+ then)))))) - (|> (~ g!temp) (~+ else))))))))) + (in (list (` (.let [(~ g!temp) (~ prev)] + (.cond (~+ (monad.do list.monad + [[test then] branches] + (list (` (|> (~ g!temp) (~+ test))) + (` (|> (~ g!temp) (~+ then)))))) + (|> (~ g!temp) (~+ else))))))))) -(syntax: .public (if> [test body^ - then body^ - else body^ - prev <code>.any]) - (in (list (` (cond> [(~+ test)] [(~+ then)] - [(~+ else)] - (~ prev)))))) +(syntax: .public (if [test body^ + then body^ + else body^ + prev <code>.any]) + (in (list (` (..cond [(~+ test)] [(~+ then)] + [(~+ else)] + (~ prev)))))) -(syntax: .public (when> [test body^ - then body^ - prev <code>.any]) - (in (list (` (cond> [(~+ test)] [(~+ then)] - [] - (~ prev)))))) +(syntax: .public (when [test body^ + then body^ + prev <code>.any]) + (in (list (` (..cond [(~+ test)] [(~+ then)] + [] + (~ prev)))))) -(syntax: .public (loop> [test body^ - then body^ - prev <code>.any]) +(syntax: .public (loop [test body^ + then body^ + prev <code>.any]) (with_symbols [g!temp] - (in (list (` (loop [(~ g!temp) (~ prev)] - (if (|> (~ g!temp) (~+ test)) + (in (list (` (.loop [(~ g!temp) (~ prev)] + (.if (|> (~ g!temp) (~+ test)) ((~' again) (|> (~ g!temp) (~+ then))) (~ g!temp)))))))) -(syntax: .public (do> [monad <code>.any - steps (<>.some body^) - prev <code>.any]) +(syntax: .public (do [monad <code>.any + steps (<>.some body^) + prev <code>.any]) (with_symbols [g!temp] - (case (list.reversed steps) + (.case (list.reversed steps) (^ (list& last_step prev_steps)) - (let [step_bindings (do list.monad - [step (list.reversed prev_steps)] - (list g!temp (` (|> (~ g!temp) (~+ step)))))] - (in (list (` ((~! do) (~ monad) + (.let [step_bindings (monad.do list.monad + [step (list.reversed prev_steps)] + (list g!temp (` (|> (~ g!temp) (~+ step)))))] + (in (list (` ((~! monad.do) (~ monad) [.let [(~ g!temp) (~ prev)] (~+ step_bindings)] (|> (~ g!temp) (~+ last_step))))))) @@ -93,23 +93,23 @@ _ (in (list prev))))) -(syntax: .public (exec> [body body^ - prev <code>.any]) +(syntax: .public (exec [body body^ + prev <code>.any]) (with_symbols [g!temp] - (in (list (` (let [(~ g!temp) (~ prev)] - (exec (|> (~ g!temp) (~+ body)) + (in (list (` (.let [(~ g!temp) (~ prev)] + (.exec (|> (~ g!temp) (~+ body)) (~ g!temp)))))))) -(syntax: .public (tuple> [paths (<>.many body^) - prev <code>.any]) +(syntax: .public (tuple [paths (<>.many body^) + prev <code>.any]) (with_symbols [g!temp] - (in (list (` (let [(~ g!temp) (~ prev)] + (in (list (` (.let [(~ g!temp) (~ prev)] [(~+ (list#each (function (_ body) (` (|> (~ g!temp) (~+ body)))) paths))])))))) -(syntax: .public (case> [branches (<>.many (<>.and <code>.any <code>.any)) - prev <code>.any]) - (in (list (` (case (~ prev) +(syntax: .public (case [branches (<>.many (<>.and <code>.any <code>.any)) + prev <code>.any]) + (in (list (` (.case (~ prev) (~+ (|> branches (list#each (function (_ [pattern body]) (list pattern body))) list#conjoint))))))) diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index c39e7873f..45527975a 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -1,18 +1,18 @@ (.using - [library - [lux {"-" not and or} - [abstract - [equivalence {"+" Equivalence}]] - [control - pipe - ["[0]" maybe]] - [data - [collection - ["[0]" array {"+" Array} ("[1]#[0]" mix)]]] - [math - [number - ["n" nat] - ["[0]" i64]]]]]) + [library + [lux {"-" not and or} + [abstract + [equivalence {"+" Equivalence}]] + [control + ["[0]" pipe] + ["[0]" maybe]] + [data + [collection + ["[0]" array {"+" Array} ("[1]#[0]" mix)]]] + [math + [number + ["n" nat] + ["[0]" i64]]]]]) (type: .public Chunk I64) @@ -70,11 +70,11 @@ (let [idx|output (-- size|output)] (if (n.> 0 size|output) (case (|> (..chunk idx|output input) - (cond> [(new> (n.= chunk_index idx|output) [])] - [(<op> bit_index)] + (pipe.cond [(pipe.new (n.= chunk_index idx|output) [])] + [(<op> bit_index)] - ... else - []) + ... else + []) .nat) 0 ... TODO: Remove 'no_op' once new-luxc is the official compiler. diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 4ddbf3e26..4d0eb7b57 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -1,32 +1,32 @@ (.using - [library - [lux {"-" and or nat int rev list type symbol} - [abstract - [monoid {"+" Monoid}] - [monad {"+" Monad do}] - [equivalence {"+" Equivalence}]] - [control - [pipe {"+" case>}] - ["[0]" function] - ["[0]" try {"+" Try}] - ["<>" parser ("[1]#[0]" monad) - ["/" binary {"+" Offset Size Parser}]]] - [data - ["[0]" product] - ["[0]" binary {"+" Binary}] - [text - ["%" format {"+" format}] - [encoding - ["[0]" utf8]]] - [collection - ["[0]" list] - ["[0]" sequence {"+" Sequence} ("[1]#[0]" functor)] - ["[0]" set {"+" Set}]]] - [math - [number - ["[0]" i64] - ["n" nat] - ["[0]" frac]]]]]) + [library + [lux {"-" and or nat int rev list type symbol} + [abstract + [monoid {"+" Monoid}] + [monad {"+" Monad do}] + [equivalence {"+" Equivalence}]] + [control + ["[0]" pipe] + ["[0]" function] + ["[0]" try {"+" Try}] + ["<>" parser ("[1]#[0]" monad) + ["/" binary {"+" Offset Size Parser}]]] + [data + ["[0]" product] + ["[0]" binary {"+" Binary}] + [text + ["%" format {"+" format}] + [encoding + ["[0]" utf8]]] + [collection + ["[0]" list] + ["[0]" sequence {"+" Sequence} ("[1]#[0]" functor)] + ["[0]" set {"+" Set}]]] + [math + [number + ["[0]" i64] + ["n" nat] + ["[0]" frac]]]]]) (def: mask (-> Size (I64 Any)) @@ -114,7 +114,7 @@ (def: .public bit (Writer Bit) - (|>> (case> #0 0 #1 1) ..bits/8)) + (|>> (pipe.case #0 0 #1 1) ..bits/8)) (template [<name> <type>] [(def: .public <name> (Writer <type>) ..bits/64)] diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 315665921..aee3310cd 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -1,34 +1,34 @@ (.using - [library - [lux {"-" has} - ["[0]" meta {"+" monad}] - [abstract - [equivalence {"+" Equivalence}] - [codec {"+" Codec}] - [predicate {"+" Predicate}] - ["[0]" monad {"+" do}]] - [control - pipe - ["[0]" maybe] - ["[0]" try {"+" Try}] - ["<>" parser ("[1]#[0]" monad) - ["<[0]>" text {"+" Parser}] - ["<[0]>" code]]] - [data - ["[0]" bit] - ["[0]" product] - ["[0]" text ("[1]#[0]" equivalence monoid)] - [collection - ["[0]" list ("[1]#[0]" mix functor)] - ["[0]" sequence {"+" Sequence sequence} ("[1]#[0]" monad)] - ["[0]" dictionary {"+" Dictionary}]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["n" nat] - ["f" frac ("[1]#[0]" decimal)]]]]]) + [library + [lux {"-" has} + ["[0]" meta {"+" monad}] + [abstract + [equivalence {"+" Equivalence}] + [codec {"+" Codec}] + [predicate {"+" Predicate}] + ["[0]" monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" maybe] + ["[0]" try {"+" Try}] + ["<>" parser ("[1]#[0]" monad) + ["<[0]>" text {"+" Parser}] + ["<[0]>" code]]] + [data + ["[0]" bit] + ["[0]" product] + ["[0]" text ("[1]#[0]" equivalence monoid)] + [collection + ["[0]" list ("[1]#[0]" mix functor)] + ["[0]" sequence {"+" Sequence sequence} ("[1]#[0]" monad)] + ["[0]" dictionary {"+" Dictionary}]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["n" nat] + ["f" frac ("[1]#[0]" decimal)]]]]]) (template [<name> <type>] [(type: .public <name> @@ -60,8 +60,8 @@ (def: .public null? (Predicate JSON) - (|>> (case> {#Null} true - _ false))) + (|>> (pipe.case {#Null} true + _ false))) (def: .public object (-> (List [String JSON]) JSON) @@ -226,20 +226,21 @@ (def: boolean_format (-> Boolean Text) - (|>> (case> - #0 "false" - #1 "true"))) + (|>> (pipe.case + #0 "false" + #1 "true"))) (def: number_format (-> Number Text) - (|>> (case> +0.0 ... OR -0.0 - "0.0" - - value - (let [raw (# f.decimal encoded value)] - (if (f.< +0.0 value) - raw - (|> raw (text.split_at 1) maybe.trusted product.right)))))) + (|>> (pipe.case + +0.0 ... OR -0.0 + "0.0" + + value + (let [raw (# f.decimal encoded value)] + (if (f.< +0.0 value) + raw + (|> raw (text.split_at 1) maybe.trusted product.right)))))) (def: escape "\") (def: escaped_dq (text#composite ..escape text.double_quote)) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 8e51999b3..3b7e5d329 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -4,7 +4,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}] ["<>" parser @@ -721,10 +721,11 @@ (def: entry_writer (Writer Entry) - (|>> (case> {#Normal value} (..normal_file_writer value) - {#Symbolic_Link value} (..symbolic_link_writer value) - {#Directory value} (..directory_writer value) - {#Contiguous value} (..contiguous_file_writer value)))) + (|>> (pipe.case + {#Normal value} (..normal_file_writer value) + {#Symbolic_Link value} (..symbolic_link_writer value) + {#Directory value} (..directory_writer value) + {#Contiguous value} (..contiguous_file_writer value)))) (def: end_of_archive_size Size diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index a6d04ca55..3fbb14abf 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -8,7 +8,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" new>}] + ["[0]" pipe] ["[0]" function] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}] @@ -255,7 +255,7 @@ (`` (|> value (~~ (template.spliced <then>))))]) (["boolean" [(:as .Bit) %.bit]] ["string" [(:as .Text) %.text]] - ["nil" [(new> "nil" [])]]) + ["nil" [(pipe.new "nil" [])]]) "number" (case (math::type value) @@ -300,7 +300,7 @@ [+1 Int %.int] [+1.0 Frac %.frac] ["" Text %.text] - [("ruby object nil") Any (new> "nil" [])] + [("ruby object nil") Any (pipe.new "nil" [])] )) (same? (class_of {.#None}) value_class) @@ -330,7 +330,7 @@ ["integer" [(:as .Int) %.int]] ["double" [(:as .Frac) %.frac]] ["string" [(:as .Text) %.text]] - ["NULL" [(new> "null" [])]] + ["NULL" [(pipe.new "null" [])]] ["array" [(tuple_inspection inspection)]]) "object" @@ -357,7 +357,7 @@ [..integer? [(:as .Int) %.int]] [..real? [(:as .Frac) %.frac]] [..string? [(:as .Text) %.text]] - ["scheme object nil?" [(new> "()" [])]] + ["scheme object nil?" [(pipe.new "()" [])]] [..vector? [(tuple_inspection inspection)]])) (..pair? value) diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index b6ae88601..6c98c57e0 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -1,20 +1,20 @@ (.using - [library - [lux {"-" Code int if cond or and comment let symbol} - [control - [pipe {"+" case> cond> new>}]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" monad monoid)]]] - [macro - ["[0]" template]] - [math - [number - ["f" frac]]] - [type - abstract]]]) + [library + [lux {"-" Code int if cond or and comment let symbol} + [control + ["[0]" pipe]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" monad monoid)]]] + [macro + ["[0]" template]] + [math + [number + ["f" frac]]] + [type + abstract]]]) (def: as_form (-> Text Text) @@ -76,8 +76,9 @@ (def: .public bool (-> Bit Literal) - (|>> (case> #0 ..nil - #1 (..symbol "t")))) + (|>> (pipe.case + #0 ..nil + #1 (..symbol "t")))) (def: .public int (-> Int Literal) @@ -85,17 +86,17 @@ (def: .public float (-> Frac Literal) - (|>> (cond> [(f.= f.positive_infinity)] - [(new> "(/ 1.0 0.0)" [])] - - [(f.= f.negative_infinity)] - [(new> "(/ -1.0 0.0)" [])] - - [f.not_a_number?] - [(new> "(/ 0.0 0.0)" [])] - - ... else - [%.frac]) + (|>> (pipe.cond [(f.= f.positive_infinity)] + [(pipe.new "(/ 1.0 0.0)" [])] + + [(f.= f.negative_infinity)] + [(pipe.new "(/ -1.0 0.0)" [])] + + [f.not_a_number?] + [(pipe.new "(/ 0.0 0.0)" [])] + + ... else + [%.frac]) :abstraction)) (def: .public (double value) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index b3f54a375..e227d6806 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -1,21 +1,21 @@ (.using - [library - [lux {"-" Location Code Label or and function if undefined for comment not int try ++ -- the} - [control - [pipe {"+" case>}]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [macro - ["[0]" template]] - [math - [number - ["i" int] - ["f" frac]]] - [type - abstract]]]) + [library + [lux {"-" Location Code Label or and function if undefined for comment not int try ++ -- the} + [control + ["[0]" pipe]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + [macro + ["[0]" template]] + [math + [number + ["i" int] + ["f" frac]]] + [type + abstract]]]) (def: expression (text.enclosed ["(" ")"])) @@ -72,9 +72,9 @@ (def: .public boolean (-> Bit Literal) - (|>> (case> - #0 "false" - #1 "true") + (|>> (pipe.case + #0 "false" + #1 "true") :abstraction)) (def: .public (number value) diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index 09dbf910f..666531963 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -7,7 +7,7 @@ [functor {"+" Functor}] [monad {"+" Monad do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" state {"+" +State}] ["[0]" try {"+" Try}]] [data @@ -49,12 +49,13 @@ (def: (each $ it) (|>> it - (case> {try.#Success [state output]} - {try.#Success [state ($ output)]} - - ... {try.#Failure error} - failure - (:expected failure))))) + (pipe.case + {try.#Success [state output]} + {try.#Success [state ($ output)]} + + ... {try.#Failure error} + failure + (:expected failure))))) (implementation: .public monad (Monad Resource) diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index aa733a4e9..e2b00d292 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -1,24 +1,24 @@ (.using - [library - [lux {"-" Primitive int char} - [abstract - [equivalence {"+" Equivalence}] - [hash {"+" Hash}]] - [control - [pipe {"+" case>}]] - [data - ["[0]" text ("[1]#[0]" hash) - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [type - abstract]]] - ["[0]" // "_" - [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration Inheritance}] - ["[1][0]" descriptor] - ["/[1]" // "_" - [encoding - ["[1][0]" name {"+" External}]]]]) + [library + [lux {"-" Primitive int char} + [abstract + [equivalence {"+" Equivalence}] + [hash {"+" Hash}]] + [control + ["[0]" pipe]] + [data + ["[0]" text ("[1]#[0]" hash) + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [type + abstract]]] + ["[0]" // "_" + [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration Inheritance}] + ["[1][0]" descriptor] + ["/[1]" // "_" + [encoding + ["[1][0]" name {"+" External}]]]]) (abstract: .public (Signature category) Text @@ -129,11 +129,12 @@ (def: var_declaration/* (-> (List (Signature Var)) Text) - (|>> (case> {.#End} - "" - - it - (..var_declaration/+ it)))) + (|>> (pipe.case + {.#End} + "" + + it + (..var_declaration/+ it)))) (def: .public (inheritance variables super interfaces) (-> (List (Signature Var)) (Signature Class) (List (Signature Class)) (Signature Inheritance)) diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index ed2e1087f..97f9abab1 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -7,7 +7,7 @@ [hash {"+" Hash}] ["[0]" enum]] [control - [pipe {"+" case> cond> new>}] + ["[0]" pipe] [parser ["<[0]>" code]]] [data @@ -91,8 +91,9 @@ (def: .public boolean (-> Bit Literal) - (|>> (case> #0 "false" - #1 "true") + (|>> (pipe.case + #0 "false" + #1 "true") :abstraction)) (def: .public int @@ -107,17 +108,17 @@ (def: .public float (-> Frac Literal) - (|>> (cond> [(f.= f.positive_infinity)] - [(new> "(1.0/0.0)" [])] - - [(f.= f.negative_infinity)] - [(new> "(-1.0/0.0)" [])] - - [(f.= f.not_a_number)] - [(new> "(0.0/0.0)" [])] - - ... else - [%.frac (text.replaced "+" "")]) + (|>> (pipe.cond [(f.= f.positive_infinity)] + [(pipe.new "(1.0/0.0)" [])] + + [(f.= f.negative_infinity)] + [(pipe.new "(-1.0/0.0)" [])] + + [(f.= f.not_a_number)] + [(pipe.new "(0.0/0.0)" [])] + + ... else + [%.frac (text.replaced "+" "")]) :abstraction)) (def: safe diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index b23ac1b98..6f5b171c9 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -7,7 +7,7 @@ [hash {"+" Hash}] ["[0]" enum]] [control - [pipe {"+" case> cond> new>}] + ["[0]" pipe] [parser ["<[0]>" code]]] [data @@ -134,8 +134,9 @@ (def: .public bool (-> Bit Literal) - (|>> (case> #0 "false" - #1 "true") + (|>> (pipe.case + #0 "false" + #1 "true") :abstraction)) (def: .public int @@ -148,17 +149,17 @@ (def: .public float (-> Frac Literal) - (|>> (cond> [(f.= f.positive_infinity)] - [(new> "+INF" [])] - - [(f.= f.negative_infinity)] - [(new> "-INF" [])] - - [(f.= f.not_a_number)] - [(new> "NAN" [])] - - ... else - [%.frac]) + (|>> (pipe.cond [(f.= f.positive_infinity)] + [(pipe.new "+INF" [])] + + [(f.= f.negative_infinity)] + [(pipe.new "-INF" [])] + + [(f.= f.not_a_number)] + [(pipe.new "NAN" [])] + + ... else + [%.frac]) :abstraction)) (def: safe diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 0f25e6eb2..1b5ecd2ee 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -8,7 +8,7 @@ [hash {"+" Hash}] ["[0]" enum]] [control - [pipe {"+" new> case> cond>}] + ["[0]" pipe] [parser ["<[0]>" code]]] [data @@ -132,8 +132,9 @@ (def: .public bool (-> Bit Literal) - (|>> (case> #0 "False" - #1 "True") + (|>> (pipe.case + #0 "False" + #1 "True") :abstraction)) (def: .public int @@ -146,17 +147,17 @@ (def: .public float (-> Frac Literal) - (`` (|>> (cond> (~~ (template [<test> <python>] - [[<test>] - [(new> (format "float(" text.double_quote <python> text.double_quote ")") [])]] - - [(f.= f.positive_infinity) "inf"] - [(f.= f.negative_infinity) "-inf"] - [f.not_a_number? "nan"] - )) - - ... else - [%.frac]) + (`` (|>> (pipe.cond (~~ (template [<test> <python>] + [[<test>] + [(pipe.new (format "float(" text.double_quote <python> text.double_quote ")") [])]] + + [(f.= f.positive_infinity) "inf"] + [(f.= f.negative_infinity) "-inf"] + [f.not_a_number? "nan"] + )) + + ... else + [%.frac]) :abstraction))) (def: safe diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index f4c3588ce..ad23a3e20 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -1,26 +1,26 @@ (.using - [library - [lux {"-" Code or and list if function cond not int} - [control - [pipe {"+" case> cond> new>}] - ["[0]" function] - ["[0]" maybe ("[1]#[0]" functor)] - [parser - ["<[0]>" code]]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [macro - [syntax {"+" syntax:}] - ["[0]" template] - ["[0]" code]] - [math - [number - ["f" frac]]] - [type - abstract]]]) + [library + [lux {"-" Code or and list if function cond not int} + [control + ["[0]" pipe] + ["[0]" function] + ["[0]" maybe ("[1]#[0]" functor)] + [parser + ["<[0]>" code]]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + [macro + [syntax {"+" syntax:}] + ["[0]" template] + ["[0]" code]] + [math + [number + ["f" frac]]] + [type + abstract]]]) (abstract: .public (Code kind) Text @@ -113,8 +113,9 @@ (def: .public bool (-> Bit Expression) - (|>> (case> #0 "FALSE" - #1 "TRUE") + (|>> (pipe.case + #0 "FALSE" + #1 "TRUE") :abstraction)) (def: .public int @@ -123,17 +124,17 @@ (def: .public float (-> Frac Expression) - (|>> (cond> [(f.= f.positive_infinity)] - [(new> "1.0/0.0" [])] - - [(f.= f.negative_infinity)] - [(new> "-1.0/0.0" [])] - - [(f.= f.not_a_number)] - [(new> "0.0/0.0" [])] - - ... else - [%.frac]) + (|>> (pipe.cond [(f.= f.positive_infinity)] + [(pipe.new "1.0/0.0" [])] + + [(f.= f.negative_infinity)] + [(pipe.new "-1.0/0.0" [])] + + [(f.= f.not_a_number)] + [(pipe.new "0.0/0.0" [])] + + ... else + [%.frac]) ..self_contained)) (def: safe diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index b965a3296..a5949aab0 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -7,7 +7,7 @@ [hash {"+" Hash}] ["[0]" enum]] [control - [pipe {"+" case> cond> new>}] + ["[0]" pipe] [parser ["<[0]>" code]]] [data @@ -153,8 +153,9 @@ (def: .public bool (-> Bit Literal) - (|>> (case> #0 "false" - #1 "true") + (|>> (pipe.case + #0 "false" + #1 "true") :abstraction)) (def: safe @@ -186,17 +187,17 @@ (def: .public float (-> Frac Literal) - (|>> (cond> [(f.= f.positive_infinity)] - [(new> "(+1.0/0.0)" [])] - - [(f.= f.negative_infinity)] - [(new> "(-1.0/0.0)" [])] - - [(f.= f.not_a_number)] - [(new> "(+0.0/-0.0)" [])] - - ... else - [%.frac]) + (|>> (pipe.cond [(f.= f.positive_infinity)] + [(pipe.new "(+1.0/0.0)" [])] + + [(f.= f.negative_infinity)] + [(pipe.new "(-1.0/0.0)" [])] + + [(f.= f.not_a_number)] + [(pipe.new "(+0.0/-0.0)" [])] + + ... else + [%.frac]) :abstraction)) (def: .public (array_range from to array) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 5a90ecbe4..2ea9a66e8 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -6,7 +6,7 @@ [equivalence {"+" Equivalence}] [hash {"+" Hash}]] [control - [pipe {"+" new> cond> case>}]] + ["[0]" pipe]] [data ["[0]" text ["%" format {"+" format}]] @@ -107,8 +107,9 @@ (def: .public bool (-> Bit Computation) - (|>> (case> #0 "#f" - #1 "#t") + (|>> (pipe.case + #0 "#f" + #1 "#t") :abstraction)) (def: .public int @@ -117,17 +118,17 @@ (def: .public float (-> Frac Computation) - (|>> (cond> [(f.= f.positive_infinity)] - [(new> "+inf.0" [])] - - [(f.= f.negative_infinity)] - [(new> "-inf.0" [])] - - [f.not_a_number?] - [(new> "+nan.0" [])] - - ... else - [%.frac]) + (|>> (pipe.cond [(f.= f.positive_infinity)] + [(pipe.new "+inf.0" [])] + + [(f.= f.negative_infinity)] + [(pipe.new "-inf.0" [])] + + [f.not_a_number?] + [(pipe.new "+nan.0" [])] + + ... else + [%.frac]) :abstraction)) (def: .public positive_infinity Computation (..float f.positive_infinity)) @@ -161,16 +162,17 @@ (def: form (-> (List (Code Any)) Code) (.let [nested_new_line (format \n+ text.tab)] - (|>> (case> {.#End} - (:abstraction "()") - - {.#Item head tail} - (|> tail - (list#each (|>> :representation ..nested)) - {.#Item (:representation head)} - (text.interposed nested_new_line) - (text.enclosed ["(" ")"]) - :abstraction))))) + (|>> (pipe.case + {.#End} + (:abstraction "()") + + {.#Item head tail} + (|> tail + (list#each (|>> :representation ..nested)) + {.#Item (:representation head)} + (text.interposed nested_new_line) + (text.enclosed ["(" ")"]) + :abstraction))))) (def: .public (apply/* args func) (-> (List Expression) Expression Computation) diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index 2ace74aa6..3cb983c36 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -6,7 +6,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe] ["[0]" try] ["[0]" exception {"+" exception:}] @@ -403,11 +403,12 @@ product.right (function (_ _)) "lux try" - (case> {try.#Success output} - output - - {try.#Failure error} - (..assertion (exception.error ..error_during_execution [error]) false)))) + (pipe.case + {try.#Success output} + output + + {try.#Failure error} + (..assertion (exception.error ..error_during_execution [error]) false)))) state (: (Atom (Dictionary Nat [Tally Text])) (atom.atom (dictionary.empty n.order))) [read! write!] (: [Assertion diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index debab4ab4..2b7c172f5 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -8,7 +8,7 @@ [codec {"+" Codec}] [monad {"+" Monad do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}] ["<>" parser @@ -117,8 +117,9 @@ (def: pred (|>> :representation - (case> 0 ..limit - millis millis) + (pipe.case + 0 ..limit + millis millis) -- :abstraction)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux index fa9e2e0fb..4b18f2874 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/inference.lux @@ -5,7 +5,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe] ["[0]" try] ["[0]" exception {"+" exception:}]] @@ -265,16 +265,17 @@ (|> it type.flat_variant (list.after lefts) - (case> {.#Item [head tail]} - (let [case (if right? - (type.variant tail) - head)] - (-> (if (n.= 0 depth) - case - (..with_recursion (|> depth -- (n.* 2)) complex case)) - (type.application (parameters depth) complex))) + (pipe.case + {.#Item [head tail]} + (let [case (if right? + (type.variant tail) + head)] + (-> (if (n.= 0 depth) + case + (..with_recursion (|> depth -- (n.* 2)) complex case)) + (type.application (parameters depth) complex))) - {.#End} - (-> .Nothing complex)) + {.#End} + (-> .Nothing complex)) phase#in)] ) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux index 39fcf63e7..484d1e886 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/module.lux @@ -4,7 +4,7 @@ [abstract ["[0]" monad {"+" do}]] [control - pipe + ["[0]" pipe] ["[0]" try] ["[0]" exception {"+" exception:}]] [data @@ -111,8 +111,9 @@ (|> state (the .#modules) (plist.value module) - (case> {.#Some _} #1 {.#None} #0) - [state] {try.#Success})))) + (pipe.case {.#Some _} #1 {.#None} #0) + [state] + {try.#Success})))) (def: .public (define name definition) (-> Text Global (Operation Any)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 18e485a46..5b833c0b7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -7,7 +7,7 @@ ["[0]" monad {"+" do}] ["[0]" predicate]] [control - pipe + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" monad)] ["[0]" exception {"+" exception:}] @@ -1342,11 +1342,12 @@ (template [<name> <tag>] [(def: <name> (-> Evaluation (Maybe Method_Signature)) - (|>> (case> {<tag> output} - {.#Some output} + (|>> (pipe.case + {<tag> output} + {.#Some output} - _ - {.#None})))] + _ + {.#None})))] [pass! #Pass] [hint! #Hint] @@ -2404,7 +2405,7 @@ [constant (`` (|> value (~~ (template.spliced <constant>)))) attribute (attribute.constant constant)] (field.field ..constant::modifier name #1 <type> (sequence.sequence attribute)))]) - ([.#Bit jvm.boolean [(case> #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] + ([.#Bit jvm.boolean [(pipe.case #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] [.#Int jvm.byte [.i64 i32.i32 constant.integer pool.integer]] [.#Int jvm.short [.i64 i32.i32 constant.integer pool.integer]] [.#Int jvm.int [.i64 i32.i32 constant.integer pool.integer]] @@ -2426,10 +2427,11 @@ (def: method_privacy (-> ffi.Privacy (Modifier method.Method)) - (|>> (case> {ffi.#PublicP} method.public - {ffi.#PrivateP} method.private - {ffi.#ProtectedP} method.protected - {ffi.#DefaultP} modifier.empty))) + (|>> (pipe.case + {ffi.#PublicP} method.public + {ffi.#PrivateP} method.private + {ffi.#ProtectedP} method.protected + {ffi.#DefaultP} modifier.empty))) (def: constructor_name "<init>") diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index 8c314121a..0dc4e8ed4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -5,7 +5,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try {"+" Try} ("[1]#[0]" functor)] ["[0]" exception] ["<>" parser ("[1]#[0]" monad) @@ -102,10 +102,11 @@ (def: method_privacy (-> ffi.Privacy (Modifier method.Method)) - (|>> (case> {ffi.#PublicP} method.public - {ffi.#PrivateP} method.private - {ffi.#ProtectedP} method.protected - {ffi.#DefaultP} modifier.empty))) + (|>> (pipe.case + {ffi.#PublicP} method.public + {ffi.#PrivateP} method.private + {ffi.#ProtectedP} method.protected + {ffi.#DefaultP} modifier.empty))) (def: visibility' (<text>.Parser (Modifier field.Field)) @@ -235,7 +236,7 @@ [constant (`` (|> value (~~ (template.spliced <constant>)))) attribute (attribute.constant constant)] (field.field ..constant::modifier name #1 <type> (sequence.sequence attribute)))]) - ([.#Bit type.boolean [(case> #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] + ([.#Bit type.boolean [(pipe.case #0 +0 #1 +1) .i64 i32.i32 constant.integer pool.integer]] [.#Int type.byte [.i64 i32.i32 constant.integer pool.integer]] [.#Int type.short [.i64 i32.i32 constant.integer pool.integer]] [.#Int type.int [.i64 i32.i32 constant.integer pool.integer]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux index 19fafd7d5..e5cc82537 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/primitive.lux @@ -1,8 +1,6 @@ (.using [library [lux {"-" i64} - [control - [pipe {"+" cond> new>}]] [math [number ["[0]" frac]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux index ae74e45f3..274c4d0ad 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux @@ -4,7 +4,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try]] [data [collection @@ -89,14 +89,15 @@ (function (_ state) (|> (//extension.apply archive optimization [name args]) (phase.result' state) - (case> {try.#Success output} - {try.#Success output} - - {try.#Failure _} - (|> args - (monad.each phase.monad optimization') - (phase#each (|>> [name] {/.#Extension})) - (phase.result' state)))))) + (pipe.case + {try.#Success output} + {try.#Success output} + + {try.#Failure _} + (|> args + (monad.each phase.monad optimization') + (phase#each (|>> [name] {/.#Extension})) + (phase.result' state)))))) ))) (def: .public (phase archive analysis) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 1bf6357f7..a9fa9c013 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -5,7 +5,7 @@ [equivalence {"+" Equivalence}] ["[0]" monad {"+" do}]] [control - [pipe {"+" when> new> case>}]] + ["[0]" pipe]] [data ["[0]" product] ["[0]" bit ("[1]#[0]" equivalence)] @@ -72,7 +72,7 @@ (<| (///#each (|>> {/.#Seq {/.#Access {/access.#Side [/side.#lefts lefts /side.#right? right?]}}})) (path' value_pattern end?) - (when> [(new> (not end?) [])] [(///#each ..clean_up)]) + (pipe.when [(pipe.new (not end?) [])] [(///#each ..clean_up)]) thenC) {///pattern.#Complex {///complex.#Tuple tuple}} @@ -90,7 +90,7 @@ tuple::lefts) /member.#right? right?]}}})) (path' tuple::member end?') - (when> [(new> (not end?') [])] [(///#each ..clean_up)]) + (pipe.when [(pipe.new (not end?') [])] [(///#each ..clean_up)]) nextC)))) thenC (list.reversed (list.enumeration tuple)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux index c08117adc..e9ec84dca 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -5,7 +5,7 @@ ["[0]" monad {"+" do}] ["[0]" enum]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" exception {"+" exception:}]] [data @@ -222,11 +222,12 @@ {/.#Abstraction [_env _arity _body]} (do [! phase.monad] [_env' (monad.each ! - (|>> (case> {/.#Reference {////reference.#Variable {////reference/variable.#Foreign register}}} - (..find_foreign environment register) + (|>> (pipe.case + {/.#Reference {////reference.#Variable {////reference/variable.#Foreign register}}} + (..find_foreign environment register) - captured - (grow environment captured))) + captured + (grow environment captured))) _env)] (in (/.function/abstraction [_env' _arity _body]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux index 1d8b9e6d3..b4e9e5b28 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -6,7 +6,6 @@ [equivalence {"+" Equivalence}] [hash {"+" Hash}]] [control - [pipe {"+" case>}] ["[0]" maybe] ["[0]" exception {"+" exception:}]] [data diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux index bd9463555..7d98c463a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis/simple.lux @@ -5,7 +5,7 @@ [equivalence {"+" Equivalence}] [hash {"+" Hash}]] [control - [pipe {"+" case>}]] + ["[0]" pipe]] [data ["[0]" bit ("[1]#[0]" equivalence)] ["[0]" text ("[1]#[0]" equivalence) @@ -61,10 +61,11 @@ (def: &equivalence ..equivalence) (def: hash - (|>> (case> (^template [<factor> <tag> <hash>] - [{<tag> value'} - (n.* <factor> (# <hash> hash value'))]) - ([2 #Bit bit.hash] - [3 #F64 f.hash] - [5 #Text text.hash] - [7 #I64 i64.hash]))))) + (|>> (pipe.case + (^template [<factor> <tag> <hash>] + [{<tag> value'} + (n.* <factor> (# <hash> hash value'))]) + ([2 #Bit bit.hash] + [3 #F64 f.hash] + [5 #Text text.hash] + [7 #I64 i64.hash]))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux index be3619845..a1a201a79 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -4,7 +4,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case> let>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" exception {"+" exception:}] ["<>" parser @@ -79,8 +79,9 @@ sequence.list (list.all (|>> product.left (the //.#category) - (case> {<tag> it} {.#Some it} - _ {.#None})))))] + (pipe.case + {<tag> it} {.#Some it} + _ {.#None})))))] [//category.#Definition definition definitions //category.Definition product.left {.#Some it}] diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux index e397214b4..b584dd240 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux @@ -5,7 +5,7 @@ [abstract ["[0]" monad {"+" Monad do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}]] [data @@ -61,11 +61,12 @@ success (|> path (# fs make_directory) - (# ! each (|>> (case> {try.#Failure error} - <failure> + (# ! each (|>> (pipe.case + {try.#Failure error} + <failure> - success - success)))))))))) + success + success)))))))))) (def: file file.Path diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux index a9f5d67a5..ba6bb8706 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux @@ -5,7 +5,7 @@ [monad {"+" do}] [equivalence {"+" Equivalence}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["<>" parser ["<[0]>" cli {"+" Parser}] ["<[0]>" text]]] @@ -106,7 +106,8 @@ (def: .public target (-> Service Target) - (|>> (case> (^or {#Compilation [host_dependencies libraries compilers sources target module]} - {#Interpretation [host_dependencies libraries compilers sources target module]} - {#Export [sources target]}) - target))) + (|>> (pipe.case + (^or {#Compilation [host_dependencies libraries compilers sources target module]} + {#Interpretation [host_dependencies libraries compilers sources target module]} + {#Export [sources target]}) + target))) diff --git a/stdlib/source/library/lux/tool/compiler/reference.lux b/stdlib/source/library/lux/tool/compiler/reference.lux index 56f9b9589..7dff736ed 100644 --- a/stdlib/source/library/lux/tool/compiler/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/reference.lux @@ -5,7 +5,7 @@ [equivalence {"+" Equivalence}] [hash {"+" Hash}]] [control - [pipe {"+" case>}]] + ["[0]" pipe]] [data [text ["%" format {"+" Format}]]] @@ -80,8 +80,9 @@ (def: .public format (Format Reference) - (|>> (case> {#Variable variable} - (/variable.format variable) - - {#Constant constant} - (%.symbol constant)))) + (|>> (pipe.case + {#Variable variable} + (/variable.format variable) + + {#Constant constant} + (%.symbol constant)))) diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux index 0efc63114..0614c5b30 100644 --- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux @@ -1,18 +1,18 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}] - [hash {"+" Hash}]] - [control - [pipe {"+" case>}]] - [data - [text - ["%" format {"+" Format}]]] - [math - [number - ["n" nat] - ["i" int]]]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}] + [hash {"+" Hash}]] + [control + ["[0]" pipe]] + [data + [text + ["%" format {"+" Format}]]] + [math + [number + ["n" nat] + ["i" int]]]]]) (type: .public Register Nat) @@ -42,29 +42,32 @@ ..equivalence) (def: hash - (|>> (case> (^template [<factor> <tag>] - [{<tag> register} - (|> register - (# n.hash hash) - (n.* <factor>))]) - ([2 #Local] - [3 #Foreign]))))) + (|>> (pipe.case + (^template [<factor> <tag>] + [{<tag> register} + (|> register + (# n.hash hash) + (n.* <factor>))]) + ([2 #Local] + [3 #Foreign]))))) (template: .public (self) [{..#Local 0}]) (def: .public self? (-> Variable Bit) - (|>> (case> (^ (..self)) - true + (|>> (pipe.case + (^ (..self)) + true - _ - false))) + _ + false))) (def: .public format (Format Variable) - (|>> (case> {#Local local} - (%.format "+" (%.nat local)) - - {#Foreign foreign} - (%.format "-" (%.nat foreign))))) + (|>> (pipe.case + {#Local local} + (%.format "+" (%.nat local)) + + {#Foreign foreign} + (%.format "-" (%.nat foreign))))) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index e3f87b053..ff9f2aeee 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -5,7 +5,7 @@ [abstract ["[0]" monad {"+" Monad do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" functor)] ["[0]" exception {"+" exception:}] @@ -460,11 +460,12 @@ (def: (can_execute? path) (# async.monad each - (|>> (case> {try.#Success _} - true + (|>> (pipe.case + {try.#Success _} + true - {try.#Failure _} - false) + {try.#Failure _} + false) {try.#Success}) (with_async write! (Try Any) (Fs::access path diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 973ad7ca2..6ad98c38c 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -6,7 +6,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" io {"+" IO}] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try}] @@ -110,64 +110,66 @@ (def: jvm_method (-> //.Method Text) - (|>> (case> {//.#Post} "POST" - {//.#Get} "GET" - {//.#Put} "PUT" - {//.#Patch} "PATCH" - {//.#Delete} "DELETE" - {//.#Head} "HEAD" - {//.#Connect} "CONNECT" - {//.#Options} "OPTIONS" - {//.#Trace} "TRACE"))) + (|>> (pipe.case + {//.#Post} "POST" + {//.#Get} "GET" + {//.#Put} "PUT" + {//.#Patch} "PATCH" + {//.#Delete} "DELETE" + {//.#Head} "HEAD" + {//.#Connect} "CONNECT" + {//.#Options} "OPTIONS" + {//.#Trace} "TRACE"))) (def: (default_body input) (-> java/io/BufferedInputStream (//.Body IO)) (|>> (maybe#each (|>> [true])) (maybe.else [false ..default_buffer_size]) - (case> [_ 0] - (do (try.with io.monad) - [_ (java/lang/AutoCloseable::close input)] - (in ..empty_body)) - - [partial? buffer_size] - (let [buffer (binary.empty buffer_size)] - (if partial? - (loop [so_far +0] - (do [! (try.with io.monad)] - [.let [remaining (i.- so_far (.int buffer_size))] - bytes_read (# ! each (|>> ffi.of_int) - (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))] - (case bytes_read - -1 (do ! - [_ (java/lang/AutoCloseable::close input)] - (in [(.nat so_far) buffer])) - +0 (again so_far) - _ (if (i.= remaining bytes_read) - (in [buffer_size buffer]) - (again (i.+ bytes_read so_far)))))) - (loop [so_far +0 - output (# binary.monoid identity)] - (do [! (try.with io.monad)] - [.let [remaining (i.- so_far (.int buffer_size))] - bytes_read (# ! each (|>> ffi.of_int) - (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))] - (case bytes_read - -1 (do ! - [_ (java/lang/AutoCloseable::close input)] - (case so_far - +0 (in (..body_of output)) - _ (|> buffer - (binary.slice 0 (.nat so_far)) - (# try.functor each - (|>> (# binary.monoid composite output) - ..body_of)) - (# io.monad in)))) - +0 (again so_far output) - _ (if (i.= remaining bytes_read) - (again +0 - (# binary.monoid composite output buffer)) - (again (i.+ bytes_read so_far) - output)))))))))) + (pipe.case + [_ 0] + (do (try.with io.monad) + [_ (java/lang/AutoCloseable::close input)] + (in ..empty_body)) + + [partial? buffer_size] + (let [buffer (binary.empty buffer_size)] + (if partial? + (loop [so_far +0] + (do [! (try.with io.monad)] + [.let [remaining (i.- so_far (.int buffer_size))] + bytes_read (# ! each (|>> ffi.of_int) + (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))] + (case bytes_read + -1 (do ! + [_ (java/lang/AutoCloseable::close input)] + (in [(.nat so_far) buffer])) + +0 (again so_far) + _ (if (i.= remaining bytes_read) + (in [buffer_size buffer]) + (again (i.+ bytes_read so_far)))))) + (loop [so_far +0 + output (# binary.monoid identity)] + (do [! (try.with io.monad)] + [.let [remaining (i.- so_far (.int buffer_size))] + bytes_read (# ! each (|>> ffi.of_int) + (java/io/BufferedInputStream::read buffer (ffi.as_int so_far) (ffi.as_int remaining) input))] + (case bytes_read + -1 (do ! + [_ (java/lang/AutoCloseable::close input)] + (case so_far + +0 (in (..body_of output)) + _ (|> buffer + (binary.slice 0 (.nat so_far)) + (# try.functor each + (|>> (# binary.monoid composite output) + ..body_of)) + (# io.monad in)))) + +0 (again so_far output) + _ (if (i.= remaining bytes_read) + (again +0 + (# binary.monoid composite output buffer)) + (again (i.+ bytes_read so_far) + output)))))))))) (def: (default_headers connection) (-> java/net/HttpURLConnection (IO (Try //.Headers))) @@ -228,14 +230,15 @@ (|> (# client request method url headers data) async.future (# async.monad each - (|>> (case> {try.#Success [status message]} - {try.#Success [status (revised //.#body (: (-> (//.Body IO) (//.Body Async)) - (function (_ body) - (|>> body async.future))) - message)]} - - {try.#Failure error} - {try.#Failure error})))))) + (|>> (pipe.case + {try.#Success [status message]} + {try.#Success [status (revised //.#body (: (-> (//.Body IO) (//.Body Async)) + (function (_ body) + (|>> body async.future))) + message)]} + + {try.#Failure error} + {try.#Failure error})))))) (def: .public headers (-> (List [Text Text]) //.Headers) diff --git a/stdlib/source/library/lux/world/net/http/header.lux b/stdlib/source/library/lux/world/net/http/header.lux index 8388a0d5d..61bd78dbc 100644 --- a/stdlib/source/library/lux/world/net/http/header.lux +++ b/stdlib/source/library/lux/world/net/http/header.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - [control - [pipe {"+" case>}]] - [data - [text - ["%" format {"+" format}]] - [collection - ["[0]" dictionary {"+" Dictionary}]]]]] - [// {"+" Header} - ["[0]" mime {"+" MIME}] - [// {"+" URL}]]) + [library + [lux "*" + [control + ["[0]" pipe]] + [data + [text + ["%" format {"+" format}]] + [collection + ["[0]" dictionary {"+" Dictionary}]]]]] + [// {"+" Header} + ["[0]" mime {"+" MIME}] + [// {"+" URL}]]) (def: .public (has name value) (-> Text Text Header) (dictionary.revised' name "" - (|>> (case> - "" - value - - previous - (format previous "," value))))) + (|>> (pipe.case + "" + value + + previous + (format previous "," value))))) (def: .public content_length (-> Nat Header) diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index af302a16b..4145bb9c5 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -6,7 +6,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" do>}] ["[0]" io {"+" IO}] ["[0]" try {"+" Try} ("[1]#[0]" functor)] ["[0]" exception {"+" exception:}] diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index 180f39a95..eeecd1f8d 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -4,7 +4,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" do>}] ["[0]" try {"+" Try}] [concurrency ["[0]" async {"+" Async} ("[1]#[0]" monad)]] diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index c824e7497..e36db11f0 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -1,34 +1,34 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" Monad do}] - ["[0]" mix]] - [control - [pipe {"+" do>}] - ["[0]" try {"+" Try}] - [parser - ["<[0]>" code]]] - [data - [binary {"+" Binary}] - ["[0]" text - [encoding - ["[0]" utf8]]] - [collection - ["[0]" list]]] - [meta - ["[0]" location]] - [tool - [compiler - [language - [lux - ["[0]" syntax]]]]] - [world - ["[0]" file]]]] - ["[0]" // "_" - ["[1][0]" profile {"+" Name Profile}] - ["[1][0]" project {"+" Project}] - ["[1][0]" parser]]) + [library + [lux "*" + [abstract + ["[0]" monad {"+" Monad do}] + ["[0]" mix]] + [control + ["[0]" pipe] + ["[0]" try {"+" Try}] + [parser + ["<[0]>" code]]] + [data + [binary {"+" Binary}] + ["[0]" text + [encoding + ["[0]" utf8]]] + [collection + ["[0]" list]]] + [meta + ["[0]" location]] + [tool + [compiler + [language + [lux + ["[0]" syntax]]]]] + [world + ["[0]" file]]]] + ["[0]" // "_" + ["[1][0]" profile {"+" Name Profile}] + ["[1][0]" project {"+" Project}] + ["[1][0]" parser]]) (def: (lux_parser source_code) (-> Text (Try Code)) @@ -44,10 +44,10 @@ (def: project_parser (-> Binary (Try Project)) - (|>> (do> try.monad - [(# utf8.codec decoded)] - [..lux_parser] - [(list) (<code>.result //parser.project)]))) + (|>> (pipe.do try.monad + [(# utf8.codec decoded)] + [..lux_parser] + [(list) (<code>.result //parser.project)]))) (def: .public (read monad fs profiles) (All (_ !) (-> (Monad !) (file.System !) (List Name) (! (Try Profile)))) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 90ce39aa7..7a2957ae0 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -5,7 +5,7 @@ [monad {"+" do}] [equivalence {"+" Equivalence}]] [control - [pipe {"+" do>}] + ["[0]" pipe] ["[0]" try {"+" Try}] ["<>" parser ["<[0]>" xml {"+" Parser}] @@ -182,10 +182,10 @@ (case project {try.#Success binary_metadata} (in (|> binary_metadata - (do> try.monad - [(# utf8.codec decoded)] - [(# xml.codec decoded)] - [list (<xml>.result ..parser)]))) + (pipe.do try.monad + [(# utf8.codec decoded)] + [(# xml.codec decoded)] + [list (<xml>.result ..parser)]))) {try.#Failure error} (in {try.#Success diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index 7aa41ff78..83ba59279 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -5,7 +5,7 @@ [monad {"+" do}] [equivalence {"+" Equivalence}]] [control - [pipe {"+" do> case>}] + ["[0]" pipe] ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}] ["<>" parser @@ -99,11 +99,12 @@ (revised ///artifact/versioning.#versions (: (-> (List ///artifact/snapshot/version.Version) (List ///artifact/snapshot/version.Version)) - (|>> (case> (^ (list)) - (list <default_version>) + (|>> (pipe.case + (^ (list)) + (list <default_version>) - versions - versions))))) + versions + versions))))) (<>.else [///artifact/versioning.#snapshot {///artifact/snapshot.#Local} ///artifact/versioning.#last_updated ///artifact/time.epoch ///artifact/versioning.#versions (list <default_version>)])))] @@ -130,10 +131,10 @@ (case project {try.#Success project} (in (|> project - (do> try.monad - [(# utf8.codec decoded)] - [(# xml.codec decoded)] - [list (<xml>.result ..parser)]))) + (pipe.do try.monad + [(# utf8.codec decoded)] + [(# xml.codec decoded)] + [list (<xml>.result ..parser)]))) {try.#Failure error} (in {try.#Success diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index ccb7f11ac..323afbb80 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -4,7 +4,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try}] ["[0]" exception] @@ -65,8 +65,9 @@ (def: distribution (-> /.Distribution XML) - (|>> (case> {/.#Repo} "repo" - {/.#Manual} "manual") + (|>> (pipe.case + {/.#Repo} "repo" + {/.#Manual} "manual") (..property "distribution"))) (def: (license [name url distribution]) diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index c529d124c..c51f0cced 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -1,24 +1,24 @@ (.using - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" io] - ["[0]" try]] - [math - ["r" random {"+" Random}]] - [macro - ["[0]" code]] - [tool - [compiler - [analysis {"+" State+}] - ["[0]" phase - [macro {"+" Expander}] - ["[0]" analysis - ["[1]/[0]" scope] - ["[1]/[0]" type]]]]]]) + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" io] + ["[0]" try]] + [math + ["r" random {"+" Random}]] + [macro + ["[0]" code]] + [tool + [compiler + [analysis {"+" State+}] + ["[0]" phase + [macro {"+" Expander}] + ["[0]" analysis + ["[1]/[0]" scope] + ["[1]/[0]" type]]]]]]) (def: (check_success+ expander state extension params output_type) (-> Expander State+ Text (List Code) Type Bit) @@ -26,11 +26,12 @@ (analysis/type.with_type output_type (analysis.phase expander (` ((~ (code.text extension)) (~+ params)))))) (phase.result state) - (case> {try.#Success _} - true + (pipe.case + {try.#Success _} + true - {try.#Failure _} - false))) + {try.#Failure _} + false))) (def: check (Random [Code Type Code]) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 7d6c81a7b..46fd92eb2 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -1,32 +1,32 @@ (.using - [lux {"-" case} - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" try {"+" Try}]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]] - [number - ["n" nat] - ["f" frac]] - [collection - ["[0]" list ("[1]#[0]" mix)]]] - [math - ["r" random {"+" Random}]] - [tool - [compiler - ["[0]" reference] - ["[0]" analysis] - ["[0]" synthesis {"+" Path Synthesis}] - ["[0]" phase - ["[1]/[0]" synthesis - ["[0]" case]] - ["[0]" extension/synthesis]]]]] - [/// - [common {"+" Runner}]]) + [lux {"-" case} + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try {"+" Try}]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]] + [number + ["n" nat] + ["f" frac]] + [collection + ["[0]" list ("[1]#[0]" mix)]]] + [math + ["r" random {"+" Random}]] + [tool + [compiler + ["[0]" reference] + ["[0]" analysis] + ["[0]" synthesis {"+" Path Synthesis}] + ["[0]" phase + ["[1]/[0]" synthesis + ["[0]" case]] + ["[0]" extension/synthesis]]]]] + [/// + [common {"+" Runner}]]) (def: limit Nat 10) @@ -40,11 +40,12 @@ (def: .public (verify expected) (-> Frac (Try Any) Bit) - (|>> (case> {try.#Success actual} - (f.= expected (:as Frac actual)) + (|>> (pipe.case + {try.#Success actual} + (f.= expected (:as Frac actual)) - {try.#Failure _} - false))) + {try.#Failure _} + false))) (def: case (Random [Synthesis Path]) @@ -249,29 +250,32 @@ (_.test "CODE" (|> special_input (run "special_input") - (case> {try.#Success output} - true - - {try.#Failure _} - false))) + (pipe.case + {try.#Success output} + true + + {try.#Failure _} + false))) (_.test "PATTERN_MATCHING 0" (|> (synthesis.branch/case [special_input special_path]) (run "special_path") - (case> {try.#Success output} - true - - {try.#Failure _} - false))) + (pipe.case + {try.#Success output} + true + + {try.#Failure _} + false))) (_.test "PATTERN_MATCHING 1" (|> (synthesis.branch/case [special_input special_pattern_path]) (run "special_pattern_path") - (case> {try.#Success output} - true - - {try.#Failure _} - false))) + (pipe.case + {try.#Success output} + true + + {try.#Failure _} + false))) )) (def: .public (spec run) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 88f13e2ae..19041bbb7 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -1,32 +1,32 @@ (.using - [lux {"-" i64} - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" try {"+" Try}]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [number - ["[0]" i64] - ["n" nat] - ["i" int] - ["f" frac]] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]] - [collection - ["[0]" list]]] - [math - ["r" random {"+" Random}]] - [tool - [compiler - ["[0]" reference] - ["[0]" synthesis]]]] - ["[0]" // "_" - ["[1][0]" case] - [// - [common {"+" Runner}]]]) + [lux {"-" i64} + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try {"+" Try}]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [number + ["[0]" i64] + ["n" nat] + ["i" int] + ["f" frac]] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]] + [collection + ["[0]" list]]] + [math + ["r" random {"+" Random}]] + [tool + [compiler + ["[0]" reference] + ["[0]" synthesis]]]] + ["[0]" // "_" + ["[1][0]" case] + [// + [common {"+" Runner}]]]) (def: safe (-> Text Text) @@ -42,11 +42,12 @@ (|> {synthesis.#Extension <extension> (list (synthesis.i64 param) (synthesis.i64 subject))} (run (..safe <extension>)) - (case> {try.#Success valueT} - (n.= (<reference> param subject) (:as Nat valueT)) + (pipe.case + {try.#Success valueT} + (n.= (<reference> param subject) (:as Nat valueT)) - {try.#Failure _} - false) + {try.#Failure _} + false) (let [param <param_expr>])))] ["lux i64 and" i64.and param] @@ -62,13 +63,14 @@ (list (synthesis.i64 subject) (synthesis.i64 param))} (run (..safe "lux i64 arithmetic-right-shift")) - (case> {try.#Success valueT} - ("lux i64 =" - (i64.arithmetic_right_shifted param subject) - (:as I64 valueT)) - - {try.#Failure _} - false) + (pipe.case + {try.#Success valueT} + ("lux i64 =" + (i64.arithmetic_right_shifted param subject) + (:as I64 valueT)) + + {try.#Failure _} + false) (let [param (n.% 64 param)]))) )))) @@ -82,11 +84,12 @@ [(_.test <extension> (|> {synthesis.#Extension <extension> (list (synthesis.i64 subject))} (run (..safe <extension>)) - (case> {try.#Success valueT} - (<comp> (<prepare> subject) (:as <type> valueT)) + (pipe.case + {try.#Success valueT} + (<comp> (<prepare> subject) (:as <type> valueT)) - {try.#Failure _} - false) + {try.#Failure _} + false) (let [subject <subject_expr>])))] ["lux i64 f64" Frac i.frac f.= subject] @@ -100,11 +103,12 @@ (|> {synthesis.#Extension <extension> (list (synthesis.i64 param) (synthesis.i64 subject))} (run (..safe <extension>)) - (case> {try.#Success valueT} - (<comp> (<reference> param subject) (:as <outputT> valueT)) + (pipe.case + {try.#Success valueT} + (<comp> (<reference> param subject) (:as <outputT> valueT)) - {try.#Failure _} - false)))] + {try.#Failure _} + false)))] ["lux i64 +" i.+ Int i.=] ["lux i64 -" i.- Int i.=] @@ -144,12 +148,13 @@ (|> {synthesis.#Extension <extension> (list (synthesis.f64 param) (synthesis.f64 subject))} (run (..safe <extension>)) - (case> {try.#Success valueV} - (bit#= (<text> param subject) - (:as Bit valueV)) + (pipe.case + {try.#Success valueV} + (bit#= (<text> param subject) + (:as Bit valueV)) - _ - false)))] + _ + false)))] ["lux f64 =" f.=] ["lux f64 <" f.<] @@ -193,65 +198,72 @@ (_.test "Can compare texts for equality." (and (|> {synthesis.#Extension "lux text =" (list sample_lowerS sample_lowerS)} (run (..safe "lux text =")) - (case> {try.#Success valueV} - (:as Bit valueV) + (pipe.case + {try.#Success valueV} + (:as Bit valueV) - _ - false)) + _ + false)) (|> {synthesis.#Extension "lux text =" (list sample_upperS sample_lowerS)} (run (..safe "lux text =")) - (case> {try.#Success valueV} - (not (:as Bit valueV)) + (pipe.case + {try.#Success valueV} + (not (:as Bit valueV)) - _ - false)))) + _ + false)))) (_.test "Can compare texts for order." (|> {synthesis.#Extension "lux text <" (list sample_lowerS sample_upperS)} (run (..safe "lux text <")) - (case> {try.#Success valueV} - (:as Bit valueV) + (pipe.case + {try.#Success valueV} + (:as Bit valueV) - {try.#Failure _} - false))) + {try.#Failure _} + false))) (_.test "Can get length of text." (|> {synthesis.#Extension "lux text size" (list sample_lowerS)} (run (..safe "lux text size")) - (case> {try.#Success valueV} - (n.= sample_size (:as Nat valueV)) + (pipe.case + {try.#Success valueV} + (n.= sample_size (:as Nat valueV)) - _ - false))) + _ + false))) (_.test "Can concatenate text." (|> {synthesis.#Extension "lux text size" (list concatenatedS)} (run (..safe "lux text size")) - (case> {try.#Success valueV} - (n.= (n.* 2 sample_size) (:as Nat valueV)) + (pipe.case + {try.#Success valueV} + (n.= (n.* 2 sample_size) (:as Nat valueV)) - _ - false))) + _ + false))) (_.test "Can find index of sub-text." (and (|> {synthesis.#Extension "lux text index" (list concatenatedS sample_lowerS (synthesis.i64 +0))} (run (..safe "lux text index")) - (case> (^multi {try.#Success valueV} - [(:as (Maybe Nat) valueV) - {.#Some valueV}]) - (n.= 0 valueV) + (pipe.case + (^multi {try.#Success valueV} + [(:as (Maybe Nat) valueV) + {.#Some valueV}]) + (n.= 0 valueV) - _ - false)) + _ + false)) (|> {synthesis.#Extension "lux text index" (list concatenatedS sample_upperS (synthesis.i64 +0))} (run (..safe "lux text index")) - (case> (^multi {try.#Success valueV} - [(:as (Maybe Nat) valueV) - {.#Some valueV}]) - (n.= sample_size valueV) + (pipe.case + (^multi {try.#Success valueV} + [(:as (Maybe Nat) valueV) + {.#Some valueV}]) + (n.= sample_size valueV) - _ - false)))) + _ + false)))) (let [test_clip (: (-> (I64 Any) (I64 Any) Text Bit) (function (_ offset length expected) (|> {synthesis.#Extension "lux text clip" @@ -259,13 +271,14 @@ (synthesis.i64 offset) (synthesis.i64 length))} (run (..safe "lux text clip")) - (case> (^multi {try.#Success valueV} - [(:as (Maybe Text) valueV) - {.#Some valueV}]) - (text#= expected valueV) - - _ - false))))] + (pipe.case + (^multi {try.#Success valueV} + [(:as (Maybe Text) valueV) + {.#Some valueV}]) + (text#= expected valueV) + + _ + false))))] (_.test "Can clip text to extract sub-text." (and (test_clip 0 sample_size sample_lower) (test_clip sample_size sample_size sample_upper)))) @@ -274,14 +287,15 @@ (list sample_lowerS (synthesis.i64 char_idx))} (run (..safe "lux text char")) - (case> (^multi {try.#Success valueV} - [(:as (Maybe Int) valueV) - {.#Some valueV}]) - (text.contains? ("lux i64 char" valueV) - sample_lower) - - _ - false))) + (pipe.case + (^multi {try.#Success valueV} + [(:as (Maybe Int) valueV) + {.#Some valueV}]) + (text.contains? ("lux i64 char" valueV) + sample_lower) + + _ + false))) ))) (def: (io run) @@ -293,11 +307,12 @@ (|> {synthesis.#Extension "lux io log" (list (synthesis.text (format "LOG: " message)))} (run (..safe "lux io log")) - (case> {try.#Success valueV} - true + (pipe.case + {try.#Success valueV} + true - {try.#Failure _} - false))) + {try.#Failure _} + false))) (_.test "Can throw runtime errors." (and (|> {synthesis.#Extension "lux try" (list (synthesis.function/abstraction @@ -306,36 +321,39 @@ synthesis.#body {synthesis.#Extension "lux io error" (list (synthesis.text message))}]))} (run (..safe "lux try")) - (case> (^multi {try.#Success valueV} - [(:as (Try Text) valueV) - {try.#Failure error}]) - (text.contains? message error) + (pipe.case + (^multi {try.#Success valueV} + [(:as (Try Text) valueV) + {try.#Failure error}]) + (text.contains? message error) - _ - false)) + _ + false)) (|> {synthesis.#Extension "lux try" (list (synthesis.function/abstraction [synthesis.#environment (list) synthesis.#arity 1 synthesis.#body (synthesis.text message)]))} (run (..safe "lux try")) - (case> (^multi {try.#Success valueV} - [(:as (Try Text) valueV) - {try.#Success valueV}]) - (text#= message valueV) + (pipe.case + (^multi {try.#Success valueV} + [(:as (Try Text) valueV) + {try.#Success valueV}]) + (text#= message valueV) - _ - false)))) + _ + false)))) (_.test "Can obtain current time in milli-seconds." (|> (synthesis.tuple (list {synthesis.#Extension "lux io current-time" (list)} {synthesis.#Extension "lux io current-time" (list)})) (run (..safe "lux io current-time")) - (case> {try.#Success valueV} - (let [[pre post] (:as [Nat Nat] valueV)] - (n.>= pre post)) + (pipe.case + {try.#Success valueV} + (let [[pre post] (:as [Nat Nat] valueV)] + (n.>= pre post)) - {try.#Failure _} - false))) + {try.#Failure _} + false))) ))) (def: .public (spec runner) diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux index c03971eef..e6bdf79c0 100644 --- a/stdlib/source/specification/compositor/generation/function.lux +++ b/stdlib/source/specification/compositor/generation/function.lux @@ -5,7 +5,6 @@ [monad {"+" do}] ["[0]" enum]] [control - [pipe {"+" case>}] ["[0]" maybe]] [data [number diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index c7d486553..a193aa16f 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -1,24 +1,24 @@ (.using - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" try]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [number - ["f" frac]] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [math - ["r" random]] - [tool - [compiler - ["[0]" synthesis]]]] - [/// - [common {"+" Runner}]]) + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [number + ["f" frac]] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [math + ["r" random]] + [tool + [compiler + ["[0]" synthesis]]]] + [/// + [common {"+" Runner}]]) (def: (f/=' reference subject) (-> Frac Frac Bit) @@ -34,11 +34,12 @@ [expected <gen>] (_.test (%.symbol (symbol <synthesis>)) (|> (run <evaluation_name> (<synthesis> expected)) - (case> {try.#Success actual} - (<test> expected (:expected actual)) + (pipe.case + {try.#Success actual} + (<test> expected (:expected actual)) - {try.#Failure _} - false))))] + {try.#Failure _} + false))))] ["bit" synthesis.bit r.bit bit#=] ["i64" synthesis.i64 r.i64 "lux i64 ="] diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index b3f270445..87c7b605b 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -1,23 +1,23 @@ (.using - [lux {"-" symbol} - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" try]] - [data - [number - ["n" nat] - ["f" frac]]] - [tool - [compiler - ["[0]" reference] - ["[0]" synthesis]]] - [math - ["r" random {"+" Random}]]] - [/// - [common {"+" Runner Definer}]]) + [lux {"-" symbol} + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try]] + [data + [number + ["n" nat] + ["f" frac]]] + [tool + [compiler + ["[0]" reference] + ["[0]" synthesis]]] + [math + ["r" random {"+" Random}]]] + [/// + [common {"+" Runner Definer}]]) (def: symbol (Random Symbol) @@ -31,11 +31,12 @@ expected r.safe_frac] (_.test "Definitions." (|> (define name (synthesis.f64 expected)) - (case> {try.#Success actual} - (f.= expected (:as Frac actual)) + (pipe.case + {try.#Success actual} + (f.= expected (:as Frac actual)) - {try.#Failure _} - false))))) + {try.#Failure _} + false))))) (def: (variable run) (-> Runner Test) @@ -47,11 +48,12 @@ register (synthesis.variable/local register)]) (run "variable") - (case> {try.#Success actual} - (f.= expected (:as Frac actual)) + (pipe.case + {try.#Success actual} + (f.= expected (:as Frac actual)) - {try.#Failure _} - false))))) + {try.#Failure _} + false))))) (def: .public (spec runner definer) (-> Runner Definer Test) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index bf852085d..5fe2a809f 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -1,30 +1,30 @@ (.using - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" maybe] - ["[0]" try]] - [data - [number - ["n" nat] - ["i" int]] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]] - [collection - ["[0]" array {"+" Array}] - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["r" random]] - ["[0]" ffi {"+" import:}] - [tool - [compiler - ["[0]" analysis] - ["[0]" synthesis]]]] - [/// - [common {"+" Runner}]]) + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" maybe] + ["[0]" try]] + [data + [number + ["n" nat] + ["i" int]] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]] + [collection + ["[0]" array {"+" Array}] + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["r" random]] + ["[0]" ffi {"+" import:}] + [tool + [compiler + ["[0]" analysis] + ["[0]" synthesis]]]] + [/// + [common {"+" Runner}]]) (import: java/lang/Integer) @@ -42,26 +42,27 @@ analysis.#right? last?_in analysis.#value (synthesis.i64 value_in)]) (run "variant") - (case> {try.#Success valueT} - (let [valueT (:as (Array Any) valueT)] - (and (n.= 3 (array.size valueT)) - (let [tag_out (:as java/lang/Integer (maybe.trusted (array.read! 0 valueT))) - last?_out (array.read! 1 valueT) - value_out (:as Any (maybe.trusted (array.read! 2 valueT))) - same_tag? (|> tag_out ffi.int_to_long (:as Nat) (n.= tag_in)) - same_flag? (case last?_out - {.#Some last?_out'} - (and last?_in (text#= "" (:as Text last?_out'))) + (pipe.case + {try.#Success valueT} + (let [valueT (:as (Array Any) valueT)] + (and (n.= 3 (array.size valueT)) + (let [tag_out (:as java/lang/Integer (maybe.trusted (array.read! 0 valueT))) + last?_out (array.read! 1 valueT) + value_out (:as Any (maybe.trusted (array.read! 2 valueT))) + same_tag? (|> tag_out ffi.int_to_long (:as Nat) (n.= tag_in)) + same_flag? (case last?_out + {.#Some last?_out'} + (and last?_in (text#= "" (:as Text last?_out'))) - {.#None} - (not last?_in)) - same_value? (|> value_out (:as Int) (i.= value_in))] - (and same_tag? - same_flag? - same_value?)))) + {.#None} + (not last?_in)) + same_value? (|> value_out (:as Int) (i.= value_in))] + (and same_tag? + same_flag? + same_value?)))) - {try.#Failure _} - false))))) + {try.#Failure _} + false))))) (def: (tuple run) (-> Runner Test) @@ -71,15 +72,16 @@ (_.test (%.symbol (symbol synthesis.tuple)) (|> (synthesis.tuple (list#each (|>> synthesis.i64) tuple_in)) (run "tuple") - (case> {try.#Success tuple_out} - (let [tuple_out (:as (Array Any) tuple_out)] - (and (n.= size (array.size tuple_out)) - (list.every? (function (_ [left right]) - (i.= left (:as Int right))) - (list.zipped/2 tuple_in (array.list tuple_out))))) + (pipe.case + {try.#Success tuple_out} + (let [tuple_out (:as (Array Any) tuple_out)] + (and (n.= size (array.size tuple_out)) + (list.every? (function (_ [left right]) + (i.= left (:as Int right))) + (list.zipped/2 tuple_in (array.list tuple_out))))) - {try.#Failure _} - false))))) + {try.#Failure _} + false))))) (def: .public (spec runner) (-> Runner Test) diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index c6a4f3faf..0e4a240d2 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -6,7 +6,6 @@ [monad {"+" do}] ["[0]" predicate]] [control - [pipe {"+" case>}] [io {"+" IO}] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try ("[1]#[0]" functor)] diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 85e8e7bc5..0dd70ae6d 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence]]] - [control - [pipe {"+" case>}] - ["[0]" try] - [parser - ["[0]" cli]]] - [data - ["[0]" text] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random} ("[1]#[0]" monad)]]]] - [\\program - ["[0]" / - ["/[1]" // "_" - ["[1]" profile]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" pipe] + ["[0]" try] + [parser + ["[0]" cli]]] + [data + ["[0]" text] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random} ("[1]#[0]" monad)]]]] + [\\program + ["[0]" / + ["/[1]" // "_" + ["[1]" profile]]]]) (def: compilation (Random /.Compilation) @@ -76,12 +76,13 @@ (|> expected ..format (cli.result /.command) - (case> {try.#Success [names actual]} - (and (# (list.equivalence text.equivalence) = (list //.default) names) - (# /.equivalence = expected actual)) - - {try.#Failure error} - false))))) + (pipe.case + {try.#Success [names actual]} + (and (# (list.equivalence text.equivalence) = (list //.default) names) + (# /.equivalence = expected actual)) + + {try.#Failure error} + false))))) (def: with_profile Test @@ -93,12 +94,13 @@ ..format (list& "with" expected_profile) (cli.result /.command) - (case> {try.#Success [actual_profile actual_command]} - (and (# (list.equivalence text.equivalence) = (list expected_profile //.default) actual_profile) - (# /.equivalence = expected_command actual_command)) - - {try.#Failure error} - false))))) + (pipe.case + {try.#Success [actual_profile actual_command]} + (and (# (list.equivalence text.equivalence) = (list expected_profile //.default) actual_profile) + (# /.equivalence = expected_command actual_command)) + + {try.#Failure error} + false))))) (def: .public test Test diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index a9e9c56fb..bfdbb789e 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try] [parser ["[0]" environment]] @@ -110,11 +110,12 @@ fs (shell.async ($build.good_shell [])) resolution) - (# ! each (|>> (case> {try.#Failure error} - (same? end_signal error) + (# ! each (|>> (pipe.case + {try.#Failure error} + (same? end_signal error) - {try.#Success _} - false)))) + {try.#Success _} + false)))) correct_number_of_runs! (|> @runs atom.read! async.future diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index 0b8eac768..f8d2d46ec 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -5,8 +5,8 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] [io {"+" IO}] + ["[0]" pipe] ["[0]" try] ["[0]" exception] [concurrency @@ -232,11 +232,12 @@ actual/1 (# console read_line []) actual/2 (# console read_line []) end! (|> (# console read_line []) - (# ! each (|>> (case> {try.#Failure error} - true - - {try.#Success _} - false) + (# ! each (|>> (pipe.case + {try.#Failure error} + true + + {try.#Success _} + false) {try.#Success})))] (in (and (text#= expected/0 actual/0) (text#= expected/1 actual/1) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 1d3168d93..f529c2d0a 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -6,7 +6,7 @@ [monad {"+" do}] [hash {"+" Hash}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try] [parser ["<[0]>" code]]] @@ -84,16 +84,17 @@ //format.project list (<code>.result /.project) - (case> {try.#Success actual} - (|> expected - ..with_empty_profile - dictionary.entries - (list#each (function (_ [name profile]) - [name (|> profile - ..with_default_sources - ..with_default_repository)])) - (dictionary.of_list text.hash) - (# //project.equivalence = actual)) - - {try.#Failure error} - false)))))) + (pipe.case + {try.#Success actual} + (|> expected + ..with_empty_profile + dictionary.entries + (list#each (function (_ [name profile]) + [name (|> profile + ..with_default_sources + ..with_default_repository)])) + (dictionary.of_list text.hash) + (# //project.equivalence = actual)) + + {try.#Failure error} + false)))))) diff --git a/stdlib/source/test/aedifex/profile.lux b/stdlib/source/test/aedifex/profile.lux index 1cfc7eb40..c7f63d254 100644 --- a/stdlib/source/test/aedifex/profile.lux +++ b/stdlib/source/test/aedifex/profile.lux @@ -9,7 +9,6 @@ ["$[0]" equivalence] ["$[0]" monoid]]] [control - [pipe {"+" case>}] ["[0]" try] [parser ["[0]" cli]]] diff --git a/stdlib/source/test/lux/abstract/interval.lux b/stdlib/source/test/lux/abstract/interval.lux index e4cf534e0..a9dfc2572 100644 --- a/stdlib/source/test/lux/abstract/interval.lux +++ b/stdlib/source/test/lux/abstract/interval.lux @@ -8,7 +8,7 @@ [\\specification ["$[0]" equivalence]]] [control - [pipe {"+" case>}]] + ["[0]" pipe]] [data [collection ["[0]" set] @@ -141,11 +141,12 @@ [[l m r] (|> (random.set n.hash 3 random.nat) (# ! each (|>> set.list (list.sorted n.<) - (case> (^ (list b t1 t2)) - [b t1 t2] + (pipe.case + (^ (list b t1 t2)) + [b t1 t2] - _ - (undefined))))) + _ + (undefined))))) .let [left (/.singleton n.enum l) right (/.singleton n.enum r)]] ($_ _.and @@ -163,11 +164,12 @@ [[b t1 t2] (|> (random.set n.hash 3 random.nat) (# ! each (|>> set.list (list.sorted n.<) - (case> (^ (list b t1 t2)) - [b t1 t2] + (pipe.case + (^ (list b t1 t2)) + [b t1 t2] - _ - (undefined))))) + _ + (undefined))))) .let [int_left (/.between n.enum t1 t2) int_right (/.between n.enum b t1)]] ($_ _.and @@ -190,11 +192,12 @@ [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) (# ! each (|>> set.list (list.sorted n.<) - (case> (^ (list x0 x1 x2 x3)) - [x0 x1 x2 x3] + (pipe.case + (^ (list x0 x1 x2 x3)) + [x0 x1 x2 x3] - _ - (undefined)))))] + _ + (undefined)))))] ($_ _.and (_.test "Every interval is nested into itself." (/.nested? some_interval some_interval)) @@ -223,11 +226,12 @@ [x0 x1 x2 x3] (|> (random.set n.hash 4 random.nat) (# ! each (|>> set.list (list.sorted n.<) - (case> (^ (list x0 x1 x2 x3)) - [x0 x1 x2 x3] + (pipe.case + (^ (list x0 x1 x2 x3)) + [x0 x1 x2 x3] - _ - (undefined)))))] + _ + (undefined)))))] ($_ _.and (_.test "No interval overlaps with itself." (not (/.overlaps? some_interval some_interval))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 7f844f558..faff80b79 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -10,7 +10,6 @@ ["$[0]" apply] ["$[0]" monad]]] [control - [pipe {"+" case>}] ["[0]" io]] [time ["[0]" instant] diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index fe8528548..6fefaecfe 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -1,29 +1,29 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid] - ["$[0]" functor] - ["$[0]" apply] - ["$[0]" monad]]] - [control - ["[0]" io ("[1]#[0]" monad)] - pipe] - [data - ["[0]" text] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / ("[1]#[0]" monoid monad)]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash] + ["$[0]" monoid] + ["$[0]" functor] + ["$[0]" apply] + ["$[0]" monad]]] + [control + ["[0]" io ("[1]#[0]" monad)] + ["[0]" pipe]] + [data + ["[0]" text] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / ("[1]#[0]" monoid monad)]]) (def: .public test Test @@ -55,11 +55,12 @@ [a (lifted (io#in left)) b (in right)] (in (n.+ a b)))) - (case> {.#Some actual} - (n.= expected actual) + (pipe.case + {.#Some actual} + (n.= expected actual) - _ - false))))) + _ + false))))) (do random.monad [default random.nat value random.nat] diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index a3f401643..074115336 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -1,37 +1,37 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" try] - ["[0]" exception] - ["<>" parser]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["i" int] - ["f" frac] - ["r" rev]]] - [meta - ["[0]" symbol ("[1]#[0]" equivalence)]] - [tool - [compiler - [reference {"+" Constant} - [variable {"+"}]] - [language - [lux - ["[0]" analysis]]]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try] + ["[0]" exception] + ["<>" parser]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["i" int] + ["f" frac] + ["r" rev]]] + [meta + ["[0]" symbol ("[1]#[0]" equivalence)]] + [tool + [compiler + [reference {"+" Constant} + [variable {"+"}]] + [language + [lux + ["[0]" analysis]]]]]]] + [\\library + ["[0]" /]]) (template: (!expect <expectation> <computation>) [(case <computation> @@ -58,22 +58,24 @@ (_.cover [/.result /.any] (|> (list expected) (/.result /.any) - (case> {try.#Success actual} - (# analysis.equivalence = expected actual) + (pipe.case + {try.#Success actual} + (# analysis.equivalence = expected actual) - {try.#Failure _} - false)))) + {try.#Failure _} + false)))) (~~ (template [<query> <check> <random> <analysis> <=>] [(do [! random.monad] [expected <random>] (_.cover [<query>] (|> (list (<analysis> expected)) (/.result <query>) - (case> {try.#Success actual} - (<=> expected actual) + (pipe.case + {try.#Success actual} + (<=> expected actual) - {try.#Failure _} - false)))) + {try.#Failure _} + false)))) (do [! random.monad] [expected <random>] (_.cover [<check>] @@ -96,11 +98,12 @@ (_.cover [/.tuple] (|> (list (analysis.tuple (list (analysis.bit expected)))) (/.result (/.tuple /.bit)) - (case> {try.#Success actual} - (bit#= expected actual) + (pipe.case + {try.#Success actual} + (bit#= expected actual) - {try.#Failure _} - false)))) + {try.#Failure _} + false)))) (do [! random.monad] [dummy random.bit] (_.cover [/.end?] @@ -124,26 +127,29 @@ (_.cover [/.cannot_parse] (and (|> (list (analysis.bit expected)) (/.result /.nat) - (case> {try.#Success _} - false + (pipe.case + {try.#Success _} + false - {try.#Failure error} - (exception.match? /.cannot_parse error))) + {try.#Failure error} + (exception.match? /.cannot_parse error))) (|> (list) (/.result /.bit) - (case> {try.#Success _} - false + (pipe.case + {try.#Success _} + false - {try.#Failure error} - (exception.match? /.cannot_parse error)))))) + {try.#Failure error} + (exception.match? /.cannot_parse error)))))) (do [! random.monad] [expected random.bit] (_.cover [/.unconsumed_input] (|> (list (analysis.bit expected) (analysis.bit expected)) (/.result /.bit) - (case> {try.#Success _} - false + (pipe.case + {try.#Success _} + false - {try.#Failure error} - (exception.match? /.unconsumed_input error))))) + {try.#Failure error} + (exception.match? /.unconsumed_input error))))) ))))) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 482f3603a..11cca9980 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -1,46 +1,46 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" type] - [abstract - [equivalence {"+" Equivalence}] - [predicate {"+" Predicate}] - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" maybe] - ["[0]" try] - ["[0]" exception] - ["<>" parser]] - [data - ["[0]" binary] - ["[0]" sum] - ["[0]" bit] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}] - [encoding - ["[0]" utf8]]] - ["[0]" format "_" - ["[1]" binary]] - [collection - ["[0]" list] - ["[0]" sequence] - ["[0]" set]]] - [macro - ["[0]" code]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["[0]" i64] - ["[0]" int] - ["[0]" rev] - ["[0]" frac]]] - [meta - ["[0]" symbol]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" type] + [abstract + [equivalence {"+" Equivalence}] + [predicate {"+" Predicate}] + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" maybe] + ["[0]" try] + ["[0]" exception] + ["<>" parser]] + [data + ["[0]" binary] + ["[0]" sum] + ["[0]" bit] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}] + [encoding + ["[0]" utf8]]] + ["[0]" format "_" + ["[1]" binary]] + [collection + ["[0]" list] + ["[0]" sequence] + ["[0]" set]]] + [macro + ["[0]" code]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["[0]" i64] + ["[0]" int] + ["[0]" rev] + ["[0]" frac]]] + [meta + ["[0]" symbol]]]] + [\\library + ["[0]" /]]) (template: (!expect <expectation> <computation>) [(case <computation> @@ -57,11 +57,12 @@ (|> value (# utf8.codec encoded) (# utf8.codec decoded) - (case> {try.#Success converted} - (text#= value converted) - - {try.#Failure error} - false))) + (pipe.case + {try.#Success converted} + (text#= value converted) + + {try.#Failure error} + false))) (def: random_text (Random Text) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 23ee86ccc..0ac380274 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" maybe] - ["[0]" try] - ["[0]" exception] - ["<>" parser]] - [data - ["[0]" bit] - ["[0]" text] - [collection - ["[0]" list ("[1]#[0]" functor)] - ["[0]" set] - ["[0]" dictionary] - ["[0]" sequence {"+" sequence} ("[1]#[0]" functor)]] - [format - ["[0]" json]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["[0]" frac]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" maybe] + ["[0]" try] + ["[0]" exception] + ["<>" parser]] + [data + ["[0]" bit] + ["[0]" text] + [collection + ["[0]" list ("[1]#[0]" functor)] + ["[0]" set] + ["[0]" dictionary] + ["[0]" sequence {"+" sequence} ("[1]#[0]" functor)]] + [format + ["[0]" json]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["[0]" frac]]]]] + [\\library + ["[0]" /]]) (template: (!expect <pattern> <value>) [(case <value> @@ -127,11 +127,12 @@ expected_string (random.unicode 1) [boolean_field number_field string_field] (|> (random.set text.hash 3 (random.unicode 3)) (# ! each (|>> set.list - (case> (^ (list boolean_field number_field string_field)) - [boolean_field number_field string_field] + (pipe.case + (^ (list boolean_field number_field string_field)) + [boolean_field number_field string_field] - _ - (undefined)))))] + _ + (undefined)))))] (_.cover [/.object /.field] (|> (/.result (/.object ($_ <>.and (/.field boolean_field /.boolean) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 0a2f2fbeb..62a78cd0e 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -5,7 +5,6 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] ["<>" parser] ["[0]" try] ["[0]" exception]] diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 6476f9e30..5258921b2 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -6,7 +6,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] ["[0]" try] ["[0]" exception]] [data diff --git a/stdlib/source/test/lux/control/pipe.lux b/stdlib/source/test/lux/control/pipe.lux index 0e8acc13f..32153db22 100644 --- a/stdlib/source/test/lux/control/pipe.lux +++ b/stdlib/source/test/lux/control/pipe.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" debug] - [abstract - [monad {"+" do}]] - [data - ["[0]" identity] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" debug] + [abstract + [monad {"+" do}]] + [data + ["[0]" identity] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -24,65 +24,65 @@ ($_ _.and (do ! [another random.nat] - (_.cover [/.new>] + (_.cover [/.new] (n.= (++ another) (|> sample (n.* 3) (n.+ 4) - (/.new> another [++]))))) - (_.cover [/.let>] + (/.new another [++]))))) + (_.cover [/.let] (n.= (n.+ sample sample) (|> sample - (/.let> x [(n.+ x x)])))) - (_.cover [/.cond>] + (/.let x [(n.+ x x)])))) + (_.cover [/.cond] (text#= (cond (n.= 0 sample) "zero" (n.even? sample) "even" "odd") (|> sample - (/.cond> [(n.= 0)] [(/.new> "zero" [])] - [n.even?] [(/.new> "even" [])] - [(/.new> "odd" [])])))) - (_.cover [/.if>] + (/.cond [(n.= 0)] [(/.new "zero" [])] + [n.even?] [(/.new "even" [])] + [(/.new "odd" [])])))) + (_.cover [/.if] (text#= (if (n.even? sample) "even" "odd") (|> sample - (/.if> [n.even?] - [(/.new> "even" [])] - [(/.new> "odd" [])])))) - (_.cover [/.when>] + (/.if [n.even?] + [(/.new "even" [])] + [(/.new "odd" [])])))) + (_.cover [/.when] (n.= (if (n.even? sample) (n.* 2 sample) sample) (|> sample - (/.when> [n.even?] - [(n.* 2)])))) - (_.cover [/.loop>] + (/.when [n.even?] + [(n.* 2)])))) + (_.cover [/.loop] (n.= (n.* 10 sample) (|> sample - (/.loop> [(n.= (n.* 10 sample)) not] - [(n.+ sample)])))) - (_.cover [/.do>] + (/.loop [(n.= (n.* 10 sample)) not] + [(n.+ sample)])))) + (_.cover [/.do] (n.= (++ (n.+ 4 (n.* 3 sample))) (|> sample - (/.do> identity.monad - [(n.* 3)] - [(n.+ 4)] - [++])))) - (_.cover [/.exec>] + (/.do identity.monad + [(n.* 3)] + [(n.+ 4)] + [++])))) + (_.cover [/.exec] (n.= (n.* 10 sample) (|> sample - (/.exec> [%.nat (format "sample = ") debug.log!]) + (/.exec [%.nat (format "sample = ") debug.log!]) (n.* 10)))) - (_.cover [/.tuple>] + (_.cover [/.tuple] (let [[left middle right] (|> sample - (/.tuple> [++] - [--] - [%.nat]))] + (/.tuple [++] + [--] + [%.nat]))] (and (n.= (++ sample) left) (n.= (-- sample) middle) (text#= (%.nat sample) right)))) - (_.cover [/.case>] + (_.cover [/.case] (text#= (case (n.% 10 sample) 0 "zero" 1 "one" @@ -97,15 +97,16 @@ _ "???") (|> sample (n.% 10) - (/.case> 0 "zero" - 1 "one" - 2 "two" - 3 "three" - 4 "four" - 5 "five" - 6 "six" - 7 "seven" - 8 "eight" - 9 "nine" - _ "???")))) + (/.case + 0 "zero" + 1 "one" + 2 "two" + 3 "three" + 4 "four" + 5 "five" + 6 "six" + 7 "seven" + 8 "eight" + 9 "nine" + _ "???")))) )))) diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index 40498c0d8..39e10983a 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [control - [pipe {"+" let>}] - ["[0]" io]] - [data - ["[0]" product]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" State}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [control + ["[0]" pipe] + ["[0]" io]] + [data + ["[0]" product]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" State}]]) (def: (with_conditions [state output] computation) (-> [Nat Nat] (State Nat Nat) Bit) @@ -89,15 +89,15 @@ (_.cover [/.while /.result] (|> (/.while condition (/.update ++)) (/.result 0) - (let> [state' output'] - (n.= limit state')))) + (pipe.let [state' output'] + (n.= limit state')))) (_.cover [/.do_while] (|> (/.do_while condition (/.update ++)) (/.result 0) - (let> [state' output'] - (or (n.= limit state') - (and (n.= 0 limit) - (n.= 1 state')))))) + (pipe.let [state' output'] + (or (n.= limit state') + (and (n.= 0 limit) + (n.= 1 state')))))) ))) (def: monad_transformer @@ -115,9 +115,9 @@ (in (n.+ a b)))) (/.result' state) io.run! - (let> [state' output'] - (and (n.= state state') - (n.= (n.+ left right) output'))))) + (pipe.let [state' output'] + (and (n.= state state') + (n.= (n.+ left right) output'))))) ))) (def: .public test diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index b07aa194d..b3efe3dd2 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -1,25 +1,25 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad] - ["$[0]" equivalence]]] - [control - pipe - ["[0]" io]] - [data - ["[0]" text ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Try}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad] + ["$[0]" equivalence]]] + [control + ["[0]" pipe] + ["[0]" io]] + [data + ["[0]" text ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Try}]]) (def: injection (Injection Try) @@ -86,10 +86,11 @@ b (in alternative)] (in (n.+ a b))) io.run! - (case> {/.#Success result} - (n.= (n.+ expected alternative) - result) + (pipe.case + {/.#Success result} + (n.= (n.+ expected alternative) + result) - _ - false)))) + _ + false)))) ))) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 458b447e4..e4d2bb2aa 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -14,7 +14,7 @@ ["$[0]" apply] ["$[0]" monad]]] [control - pipe + ["[0]" pipe] ["[0]" io] ["[0]" maybe] ["[0]" function]] @@ -76,11 +76,12 @@ [a (lifted (io#in parameter)) b (in subject)] (in (n.+ a b)))) - (case> (^ (list actual)) - (n.= expected actual) - - _ - false))))) + (pipe.case + (^ (list actual)) + (n.= expected actual) + + _ + false))))) )) (def: whole diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux index 55d01f81e..111597da6 100644 --- a/stdlib/source/test/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux @@ -1,29 +1,29 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" functor] - ["$[0]" comonad]]] - [control - pipe - ["[0]" maybe ("[1]#[0]" functor)]] - [data - ["[0]" product] - ["[0]" text] - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - ["[0]" //] - [\\library - ["[0]" / {"+" Zipper} - ["tree" //]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" functor] + ["$[0]" comonad]]] + [control + ["[0]" pipe] + ["[0]" maybe ("[1]#[0]" functor)]] + [data + ["[0]" product] + ["[0]" text] + [collection + ["[0]" list]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + ["[0]" //] + [\\library + ["[0]" / {"+" Zipper} + ["tree" //]]]) (def: move Test @@ -34,25 +34,25 @@ (_.cover [/.down] (|> (tree.branch dummy (list (tree.leaf expected))) /.zipper - (do> maybe.monad - [/.down] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.up] (|> (tree.branch expected (list (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.down] - [/.up] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.up] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.right] (|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected))) /.zipper - (do> maybe.monad - [/.down] - [/.right] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.right] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.rightmost] (|> (tree.branch dummy @@ -61,19 +61,19 @@ (tree.leaf dummy) (tree.leaf expected))) /.zipper - (do> maybe.monad - [/.down] - [/.rightmost] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.rightmost] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.left] (|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.down] - [/.right] - [/.left] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.right] + [/.left] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.leftmost] (|> (tree.branch dummy @@ -82,29 +82,29 @@ (tree.leaf dummy) (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.down] - [/.rightmost] - [/.leftmost] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.rightmost] + [/.leftmost] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.next] (and (|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.next] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.next] + [/.value (n.= expected) in]) (maybe.else false)) (|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected))) /.zipper - (do> maybe.monad - [/.next] - [/.next] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.next] + [/.next] + [/.value (n.= expected) in]) (maybe.else false)))) (_.cover [/.end] (|> (tree.branch dummy @@ -113,9 +113,9 @@ (tree.leaf dummy) (tree.leaf expected))) /.zipper - (do> maybe.monad - [/.end] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.end] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.start] (|> (tree.branch expected @@ -124,30 +124,30 @@ (tree.leaf dummy) (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.end] - [/.start] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.end] + [/.start] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.previous] (and (|> (tree.branch expected (list (tree.leaf dummy) (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.next] - [/.previous] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.next] + [/.previous] + [/.value (n.= expected) in]) (maybe.else false)) (|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.next] - [/.next] - [/.previous] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.next] + [/.next] + [/.previous] + [/.value (n.= expected) in]) (maybe.else false)))) ))) @@ -205,15 +205,15 @@ (/.interpose expected))] (and (n.= dummy (/.value cursor)) (|> cursor - (do> maybe.monad - [/.down] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.value (n.= expected) in]) (maybe.else false)) (|> cursor - (do> maybe.monad - [/.down] - [/.down] - [/.value (n.= dummy) in]) + (pipe.do maybe.monad + [/.down] + [/.down] + [/.value (n.= dummy) in]) (maybe.else false))))) (_.cover [/.adopt] (let [cursor (|> (tree.branch dummy (list (tree.leaf dummy))) @@ -221,41 +221,41 @@ (/.adopt expected))] (and (n.= dummy (/.value cursor)) (|> cursor - (do> maybe.monad - [/.down] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [/.value (n.= expected) in]) (maybe.else false)) (|> cursor - (do> maybe.monad - [/.down] - [/.right] - [/.value (n.= dummy) in]) + (pipe.do maybe.monad + [/.down] + [/.right] + [/.value (n.= dummy) in]) (maybe.else false))))) (_.cover [/.insert_left] (|> (tree.branch dummy (list (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.down] - [(/.insert_left expected)] - [/.left] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [(/.insert_left expected)] + [/.left] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.insert_right] (|> (tree.branch dummy (list (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.down] - [(/.insert_right expected)] - [/.right] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [(/.insert_right expected)] + [/.right] + [/.value (n.= expected) in]) (maybe.else false))) (_.cover [/.remove] (|> (tree.branch dummy (list (tree.leaf dummy))) /.zipper - (do> maybe.monad - [/.down] - [(/.insert_left expected)] - [/.remove] - [/.value (n.= expected) in]) + (pipe.do maybe.monad + [/.down] + [(/.insert_left expected)] + [/.remove] + [/.value (n.= expected) in]) (maybe.else false))) )))) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index 0ee929ca7..439fe1f5c 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -8,7 +8,6 @@ ["$[0]" equivalence] ["$[0]" codec]]] [control - pipe ["[0]" maybe] ["[0]" try] ["p" parser diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 2aa3c5058..6dc6eeb9e 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -8,7 +8,7 @@ ["$[0]" equivalence] ["$[0]" hash]]] [control - pipe] + ["[0]" pipe]] [data ["[0]" text] [collection @@ -39,13 +39,15 @@ (_.cover [/.left] (|> (/.left expected) (: (Or Nat Nat)) - (case> {0 #0 actual} (n.= expected actual) - _ false))) + (pipe.case + {0 #0 actual} (n.= expected actual) + _ false))) (_.cover [/.right] (|> (/.right expected) (: (Or Nat Nat)) - (case> {0 #1 actual} (n.= expected actual) - _ false))) + (pipe.case + {0 #1 actual} (n.= expected actual) + _ false))) (_.cover [/.either] (and (|> (/.left expected) (: (Or Nat Nat)) @@ -59,11 +61,11 @@ (and (|> (/.left expected) (: (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) - (case> {0 #0 actual} (n.= (n.+ shift expected) actual) _ false)) + (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false)) (|> (/.right expected) (: (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) - (case> {0 #1 actual} (n.= (n.- shift expected) actual) _ false)))) + (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false)))) (do ! [size (# ! each (n.% 5) random.nat) expected (random.list size random.nat)] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index faa8e0f86..ed6cc5d9d 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -1,35 +1,35 @@ (.using - [library - [lux {"-" char} - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" order] - ["$[0]" monoid]]] - [control - pipe - ["[0]" maybe]] - [data - [collection - ["[0]" list] - ["[0]" set]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - ["[0]" / "_" - ["[1][0]" buffer] - ["[1][0]" encoding] - ["[1][0]" format] - ["[1][0]" regex] - ["[1][0]" escape] - ["[1][0]" unicode "_" - ["[1]" set]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" char} + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash] + ["$[0]" order] + ["$[0]" monoid]]] + [control + ["[0]" pipe] + ["[0]" maybe]] + [data + [collection + ["[0]" list] + ["[0]" set]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + ["[0]" / "_" + ["[1][0]" buffer] + ["[1][0]" encoding] + ["[1][0]" format] + ["[1][0]" regex] + ["[1][0]" escape] + ["[1][0]" unicode "_" + ["[1]" set]]] + [\\library + ["[0]" /]]) (def: bounded_size (random.Random Nat) @@ -289,26 +289,28 @@ ($_ _.and (_.cover [/.split_at] (|> (/.split_at sizeL sample) - (case> {.#Right [_l _r]} - (and (/#= sampleL _l) - (/#= sampleR _r) - (/#= sample (/.together (list _l _r)))) + (pipe.case + {.#Right [_l _r]} + (and (/#= sampleL _l) + (/#= sampleR _r) + (/#= sample (/.together (list _l _r)))) - _ - #0))) + _ + #0))) (_.cover [/.clip /.clip_since] (|> [(/.clip 0 sizeL sample) (/.clip sizeL (n.- sizeL (/.size sample)) sample) (/.clip_since sizeL sample) (/.clip_since 0 sample)] - (case> [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}] - (and (/#= sampleL _l) - (/#= sampleR _r) - (/#= _r _r') - (/#= sample _f)) + (pipe.case + [{.#Right _l} {.#Right _r} {.#Right _r'} {.#Right _f}] + (and (/#= sampleL _l) + (/#= sampleR _r) + (/#= _r _r') + (/#= sample _f)) - _ - #0))) + _ + #0))) )) (do [! random.monad] [sizeP bounded_size diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index d5596ae56..0ab71cbaa 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -1,56 +1,59 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - pipe - ["[0]" try] - [parser - ["<[0]>" text {"+" Parser}] - ["<[0]>" code]]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - ["[0]" macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number {"+" hex}] - ["[0]" random]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try] + [parser + ["<[0]>" text {"+" Parser}] + ["<[0]>" code]]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + ["[0]" macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number {"+" hex}] + ["[0]" random]]]] + [\\library + ["[0]" /]]) (def: (should_pass regex input) (-> (Parser Text) Text Bit) (|> input (<text>.result regex) - (case> {try.#Success parsed} - (text#= parsed input) + (pipe.case + {try.#Success parsed} + (text#= parsed input) - _ - #0))) + _ + #0))) (def: (text_should_pass test regex input) (-> Text (Parser Text) Text Bit) (|> input (<text>.result regex) - (case> {try.#Success parsed} - (text#= test parsed) + (pipe.case + {try.#Success parsed} + (text#= test parsed) - _ - false))) + _ + false))) (def: (should_fail regex input) (All (_ a) (-> (Parser a) Text Bit)) (|> input (<text>.result regex) - (case> {try.#Failure _} - true + (pipe.case + {try.#Failure _} + true - _ - false))) + _ + false))) (syntax: (should_check [pattern <code>.any regex <code>.any @@ -58,11 +61,12 @@ (macro.with_symbols [g!message g!_] (in (list (` (|> (~ input) (<text>.result (~ regex)) - (case> (^ {try.#Success (~ pattern)}) - true + (pipe.case + (^ {try.#Success (~ pattern)}) + true - (~ g!_) - false))))))) + (~ g!_) + false))))))) (def: basics Test diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 74107be7d..0cc809a70 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -9,7 +9,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception] [parser @@ -75,11 +75,12 @@ (function (_ lux) (|> (macro.single_expansion expression) (meta.result lux) - (case> {try.#Success expansion} - {try.#Failure "OOPS!"} - - {try.#Failure error} - {try.#Success [lux (list (code.text error))]})))) + (pipe.case + {try.#Success expansion} + {try.#Failure "OOPS!"} + + {try.#Failure error} + {try.#Success [lux (list (code.text error))]})))) (def: for_conversions Test @@ -179,12 +180,14 @@ (_.cover [/.???] (and (|> (/.??? (/.null)) (: (Maybe java/lang/Object)) - (case> {.#None} #1 - {.#Some _} #0)) + (pipe.case + {.#None} #1 + {.#Some _} #0)) (|> (/.??? sample) (: (Maybe java/lang/Object)) - (case> {.#Some _} #1 - {.#None} #0)))) + (pipe.case + {.#Some _} #1 + {.#None} #0)))) (_.cover [/.!!!] (and (|> (/.??? (/.null)) /.!!! @@ -615,11 +618,12 @@ (function (_ lux) (|> (macro.single_expansion expression) (meta.result lux) - (case> {try.#Success expansion} - true - - {try.#Failure error} - false) + (pipe.case + {try.#Success expansion} + true + + {try.#Failure error} + false) code.bit list [lux] @@ -654,11 +658,12 @@ (try.else false)) (|> (list (code.local_symbol var/2)) (<code>.result type_variable) - (case> {try.#Failure error} - (exception.match? /.unknown_type_variable error) - - _ - false))))) + (pipe.case + {try.#Failure error} + (exception.match? /.unknown_type_variable error) + + _ + false))))) ))) (def: .public test diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 1a9db190f..39a86642e 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -6,7 +6,7 @@ [equivalence {"+" Equivalence}] [monad {"+" do}]] [control - [pipe {"+" case>}]] + ["[0]" pipe]] [data ["[0]" text ("[1]#[0]" equivalence) ["%" format {"+" format}]]] @@ -182,11 +182,13 @@ (not (/.null? sample)))) (_.cover [/.???] (and (|> (: (Maybe java/lang/Object) (/.??? (/.null))) - (case> {.#None} #1 - _ #0)) + (pipe.case + {.#None} #1 + _ #0)) (|> (: (Maybe java/lang/Object) (/.??? sample)) - (case> {.#Some _} #1 - _ #0)))) + (pipe.case + {.#Some _} #1 + _ #0)))) (_.cover [/.!!!] (and (/.null? (/.!!! (/.??? (/.null)))) (not (/.null? (/.!!! (/.??? sample)))))) diff --git a/stdlib/source/test/lux/meta/symbol.lux b/stdlib/source/test/lux/meta/symbol.lux index 2ce0ba52b..261015a31 100644 --- a/stdlib/source/test/lux/meta/symbol.lux +++ b/stdlib/source/test/lux/meta/symbol.lux @@ -9,8 +9,6 @@ ["$[0]" hash] ["$[0]" order] ["$[0]" codec]]] - [control - pipe] [data ["[0]" text]] [math diff --git a/stdlib/source/test/lux/target/js.lux b/stdlib/source/test/lux/target/js.lux index 16366a141..8f1da42bb 100644 --- a/stdlib/source/test/lux/target/js.lux +++ b/stdlib/source/test/lux/target/js.lux @@ -7,7 +7,7 @@ [monad {"+" do}] ["[0]" predicate]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" function] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" functor)]] @@ -817,11 +817,12 @@ (/.return $arg/0))) (list)) ..eval - (case> {try.#Success it} - false - - {try.#Failure error} - true)))) + (pipe.case + {try.#Success it} + false + + {try.#Failure error} + true)))) ..test|exception ..test|function ..test|branching diff --git a/stdlib/source/test/lux/target/lua.lux b/stdlib/source/test/lux/target/lua.lux index 0bee11310..84cf47b3f 100644 --- a/stdlib/source/test/lux/target/lua.lux +++ b/stdlib/source/test/lux/target/lua.lux @@ -10,7 +10,7 @@ ["$[0]" equivalence] ["$[0]" hash]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" function] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" functor)]] @@ -56,8 +56,9 @@ (|> /.nil /.code ..load - (case> {.#None} true - {.#Some _} false))) + (pipe.case + {.#None} true + {.#Some _} false))) (_.cover [/.boolean] (expression (|>> (:as Bit) (bit#= boolean)) (/.boolean boolean))) diff --git a/stdlib/source/test/lux/target/python.lux b/stdlib/source/test/lux/target/python.lux index afcc8a43e..2a9bdb68e 100644 --- a/stdlib/source/test/lux/target/python.lux +++ b/stdlib/source/test/lux/target/python.lux @@ -11,7 +11,6 @@ ["$[0]" equivalence] ["$[0]" hash]]] [control - [pipe {"+" case>}] ["[0]" function] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" functor)]] diff --git a/stdlib/source/test/lux/target/ruby.lux b/stdlib/source/test/lux/target/ruby.lux index ee6b63d1c..58cf47c7b 100644 --- a/stdlib/source/test/lux/target/ruby.lux +++ b/stdlib/source/test/lux/target/ruby.lux @@ -10,7 +10,7 @@ [\\specification ["$[0]" equivalence]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" functor)]] [data @@ -52,8 +52,9 @@ (-> /.Expression Bit) (|>> /.code ..eval - (try#each (|>> (case> {.#None} true - {.#Some _} false))) + (try#each (|>> (pipe.case + {.#None} true + {.#Some _} false))) (try.else false))) (def: test|literal diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 72af6c159..074e2ebf4 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -1,37 +1,37 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" enum] - ["$[0]" codec]]] - [control - [pipe {"+" case>}] - ["[0]" try ("[1]#[0]" functor)] - ["[0]" exception] - [parser - ["<[0]>" text]]] - [data - ["[0]" text - ["%" format {"+" format}]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - ["[0]" / "_" - ["[1][0]" date] - ["[1][0]" day] - ["[1][0]" duration] - ["[1][0]" instant] - ["[1][0]" month] - ["[1][0]" year]] - [\\library - ["[0]" / - ["[0]" duration]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" enum] + ["$[0]" codec]]] + [control + ["[0]" pipe] + ["[0]" try ("[1]#[0]" functor)] + ["[0]" exception] + [parser + ["<[0]>" text]]] + [data + ["[0]" text + ["%" format {"+" format}]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + ["[0]" / "_" + ["[1][0]" date] + ["[1][0]" day] + ["[1][0]" duration] + ["[1][0]" instant] + ["[1][0]" month] + ["[1][0]" year]] + [\\library + ["[0]" / + ["[0]" duration]]]) (def: for_implementation Test @@ -76,8 +76,9 @@ (text.prefix <prefix>) (text.suffix <suffix>) (# /.codec decoded) - (case> {try.#Success _} true - {try.#Failure error} false)) + (pipe.case + {try.#Success _} true + {try.#Failure error} false)) invalid! (|> <invalid> @@ -85,11 +86,12 @@ (text.prefix <prefix>) (text.suffix <suffix>) (# /.codec decoded) - (case> {try.#Success _} - false - - {try.#Failure error} - (exception.match? <exception> error)))] + (pipe.case + {try.#Success _} + false + + {try.#Failure error} + (exception.match? <exception> error)))] (and valid! invalid!)))] @@ -102,8 +104,9 @@ %.nat (format "00:00:00.") (# /.codec decoded) - (case> {try.#Success _} true - {try.#Failure error} false))) + (pipe.case + {try.#Success _} true + {try.#Failure error} false))) )))) (def: .public test 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 7ca3c4b12..eb623b548 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis.lux @@ -8,7 +8,7 @@ [\\specification ["$[0]" equivalence]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" function] ["[0]" maybe] ["[0]" try] @@ -272,52 +272,57 @@ (|> (/.failure expected_error) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (case> {try.#Failure actual_error} - (and (text.contains? expected_error actual_error) - (text.contains? (location.format location/0) actual_error)) + (pipe.case + {try.#Failure actual_error} + (and (text.contains? expected_error actual_error) + (text.contains? (location.format location/0) actual_error)) - _ - false))) + _ + false))) (_.cover [/.except] (|> (/.except <exception> []) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (case> {try.#Failure actual_error} - (and (text.contains? (exception.error <exception> []) actual_error) - (text.contains? (location.format location/0) actual_error)) + (pipe.case + {try.#Failure actual_error} + (and (text.contains? (exception.error <exception> []) actual_error) + (text.contains? (location.format location/0) actual_error)) - _ - false))) + _ + false))) (_.cover [/.with_exception] (|> (/.failure expected_error) (/.with_exception <exception> []) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (case> {try.#Failure actual_error} - (and (text.contains? expected_error actual_error) - (text.contains? (exception.error <exception> []) actual_error) - (text.contains? (location.format location/0) actual_error)) - - _ - false))) + (pipe.case + {try.#Failure actual_error} + (and (text.contains? expected_error actual_error) + (text.contains? (exception.error <exception> []) actual_error) + (text.contains? (location.format location/0) actual_error)) + + _ + false))) (_.cover [/.assertion] (and (|> (/.assertion <exception> [] false) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (case> {try.#Failure actual_error} - (and (text.contains? (exception.error <exception> []) actual_error) - (text.contains? (location.format location/0) actual_error)) + (pipe.case + {try.#Failure actual_error} + (and (text.contains? (exception.error <exception> []) actual_error) + (text.contains? (location.format location/0) actual_error)) - _ - false)) + _ + false)) (|> (/.assertion <exception> [] true) (phase.result [extension.#bundle extension.empty extension.#state state/0]) - (case> {try.#Success _} - true + (pipe.case + {try.#Success _} + true - _ - false)))) + _ + false)))) )))) (def: test|state @@ -370,11 +375,12 @@ (extension.read (|>> (the .#current_module) (maybe.else "")))) (phase.result [extension.#bundle extension.empty extension.#state state]) - (case> {try.#Success actual} - (same? expected_module actual) + (pipe.case + {try.#Success actual} + (same? expected_module actual) - _ - false))) + _ + false))) (_.cover [/.with_current_module] (let [current_module (extension.read (|>> (the .#current_module) (maybe.else "")))] (|> (do phase.monad @@ -396,11 +402,12 @@ (extension.read (the .#location))) (phase.result [extension.#bundle extension.empty extension.#state state]) - (case> {try.#Success actual} - (same? expected actual) + (pipe.case + {try.#Success actual} + (same? expected actual) - _ - false)))) + _ + false)))) (_.cover [/.with_location] (let [expected (/.location expected_file) dummy (/.location expected_code) @@ -424,11 +431,12 @@ (extension.read (the .#source))) (phase.result [extension.#bundle extension.empty extension.#state state]) - (case> {try.#Success actual} - (same? expected actual) + (pipe.case + {try.#Success actual} + (same? expected actual) - _ - false)))) + _ + false)))) (_.cover [/.with_source_code] (let [expected (/.source expected_file expected_code) dummy (/.source expected_code expected_file) 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 d8ae7a32e..e7e26bd54 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 @@ -8,7 +8,7 @@ [\\specification ["$[0]" equivalence]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try {"+" Try} ("[1]#[0]" functor)] ["[0]" exception {"+" Exception}]] [data @@ -116,14 +116,15 @@ (in [(|> coverages (list.only (|>> /.exhaustive? not)) list.reversed - (case> {.#End} - {/.#Exhaustive} - - {.#Item last prevs} - (list#mix (function (_ left right) - {/.#Seq left right}) - last - prevs))) + (pipe.case + {.#End} + {/.#Exhaustive} + + {.#Item last prevs} + (list#mix (function (_ left right) + {/.#Seq left right}) + last + prevs))) {//pattern.#Complex {//complex.#Tuple patterns}}])) (do random.monad @@ -239,7 +240,7 @@ [expected/2 pattern/2] (random.only ($_ predicate.and (|>> product.left (/#= expected/0) not) (|>> product.left (/#= expected/1) not) - (|>> product.left (case> {/.#Variant _} false _ true))) + (|>> product.left (pipe.case {/.#Variant _} false _ true))) ..random_value_pattern) bit random.bit diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux index e3dd8a53f..af025cb4d 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/macro.lux @@ -7,7 +7,7 @@ [\\specification ["$[0]" equivalence]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception]] @@ -87,12 +87,13 @@ (_.cover [/.expansion_failed] (|> (/.expansion ..expander name singular (list)) (meta.result lux) - (case> {try.#Failure it} - (and (text.contains? expected_error it) - (text.contains? (the exception.#label /.expansion_failed) it)) + (pipe.case + {try.#Failure it} + (and (text.contains? expected_error it) + (text.contains? (the exception.#label /.expansion_failed) it)) - _ - false))) + _ + false))) (_.cover [/.single_expansion] (|> (/.single_expansion ..expander name singular poly) (meta.result lux) @@ -101,9 +102,10 @@ (_.cover [/.must_have_single_expansion] (|> (/.single_expansion ..expander name multiple (list mono)) (meta.result lux) - (case> {try.#Failure it} - (text.contains? (the exception.#label /.must_have_single_expansion) it) + (pipe.case + {try.#Failure it} + (text.contains? (the exception.#label /.must_have_single_expansion) it) - _ - false))) + _ + false))) ))) 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 904bd4dd7..52ab6e6ff 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 @@ -5,7 +5,7 @@ [abstract ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception]] [data @@ -121,12 +121,13 @@ (in it)) (/phase.result state) (try#each (|>> (the .#module_aliases) - (case> (^ (list [actual_alias actual_import])) - (and (same? expected_alias actual_alias) - (same? expected_import actual_import)) + (pipe.case + (^ (list [actual_alias actual_import])) + (and (same? expected_alias actual_alias) + (same? expected_import actual_import)) - _ - false))) + _ + false))) (try.else false))) ))) @@ -164,11 +165,12 @@ [_ (<pre> name)] (<post> name))) (/phase.result state) - (case> {try.#Success _} - false - - {try.#Failure error} - (text.contains? (the exception.#label /.can_only_change_state_of_active_module) error)))] + (pipe.case + {try.#Success _} + false + + {try.#Failure error} + (text.contains? (the exception.#label /.can_only_change_state_of_active_module) error)))] [/.set_compiled /.set_active] [/.set_compiled /.set_compiled] @@ -181,11 +183,12 @@ (and (~~ (template [<set>] [(|> (<set> name) (/phase.result state) - (case> {try.#Success _} - false - - {try.#Failure error} - (text.contains? (the exception.#label /.unknown_module) error)))] + (pipe.case + {try.#Success _} + false + + {try.#Failure error} + (text.contains? (the exception.#label /.unknown_module) error)))] [/.set_active] [/.set_compiled] @@ -221,8 +224,9 @@ [(|> (/.with hash module_name (/.define def_name <global>)) (/phase.result state) - (case> {try.#Success _} true - {try.#Failure _} false))] + (pipe.case + {try.#Success _} true + {try.#Failure _} false))] [definition] [{.#Type [public? def_type {.#Left [labels|head labels|tail]}]}] @@ -234,8 +238,9 @@ [_ (/.define def_name definition)] (/.define alias_name alias))) (/phase.result state) - (case> {try.#Success _} true - {try.#Failure _} false))))) + (pipe.case + {try.#Success _} true + {try.#Failure _} false))))) (_.cover [/.cannot_define_more_than_once] (`` (and (~~ (template [<global>] [(|> (/.with hash module_name @@ -243,8 +248,9 @@ [_ (/.define def_name <global>)] (/.define def_name <global>))) (/phase.result state) - (case> {try.#Success _} false - {try.#Failure _} true))] + (pipe.case + {try.#Success _} false + {try.#Failure _} true))] [{.#Definition [public? def_type []]}] [{.#Type [public? def_type {.#Left [labels|head labels|tail]}]}] @@ -257,8 +263,9 @@ _ (/.define alias_name alias)] (/.define alias_name alias))) (/phase.result state) - (case> {try.#Success _} false - {try.#Failure _} true))))) + (pipe.case + {try.#Success _} false + {try.#Failure _} true))))) ))) (def: test|label @@ -291,8 +298,9 @@ (monad.each ! (|>> [module_name] <query> /extension.lifted) (list& labels|head labels|tail)))) (/phase.result state) - (case> {try.#Success _} <on_success> - {try.#Failure _} (not <on_success>)))] + (pipe.case + {try.#Success _} <on_success> + {try.#Failure _} (not <on_success>)))] [.#Left false meta.tag true] [.#Left false meta.slot false] @@ -306,11 +314,12 @@ _ (/.define def_name {.#Type [public? it {<side> [labels|head labels|tail]}]})] (/.declare_labels <record?> (list& labels|head labels|tail) public? it))) (/phase.result state) - (case> {try.#Success _} - false - - {try.#Failure error} - (text.contains? (the exception.#label /.cannot_declare_labels_for_anonymous_type) error)))] + (pipe.case + {try.#Success _} + false + + {try.#Failure error} + (text.contains? (the exception.#label /.cannot_declare_labels_for_anonymous_type) error)))] [.#Left false] [.#Right true]))))) @@ -322,11 +331,12 @@ _ (/.define def_name {.#Type [public? it {<side> [labels|head labels|tail]}]})] (/.declare_labels <record?> (list& labels|head labels|tail) public? it))) (/phase.result state) - (case> {try.#Success _} - false - - {try.#Failure error} - (text.contains? (the exception.#label /.cannot_declare_labels_for_foreign_type) error)))] + (pipe.case + {try.#Success _} + false + + {try.#Failure error} + (text.contains? (the exception.#label /.cannot_declare_labels_for_foreign_type) error)))] [.#Left false] [.#Right true]))))) 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 db4902b2b..faf28f47e 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 @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception]] @@ -64,8 +64,9 @@ /.with (//phase.result state) (try#each (|>> product.right - (case> {.#None} true - {.#Some _} false))) + (pipe.case + {.#None} true + {.#Some _} false))) (try.else false))) (_.cover [/.with_local] (|> (/.with_local [name/0 type/0] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux index a5f1b5797..2a13b674c 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/type.lux @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)]] [data ["[0]" product]] @@ -58,22 +58,25 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (case> {try.#Success _} true - {try.#Failure _} false)) + (pipe.case + {try.#Success _} true + {try.#Failure _} false)) (|> (/.inference dummy) (/.expecting expected) (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (case> {try.#Success _} false - {try.#Failure _} true)) + (pipe.case + {try.#Success _} false + {try.#Failure _} true)) (|> (/.inference expected) (/.expecting dummy) (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (case> {try.#Success _} false - {try.#Failure _} true)))) + (pipe.case + {try.#Success _} false + {try.#Failure _} true)))) (_.cover [/.inferring] (|> (/.inference expected) /.inferring @@ -92,8 +95,9 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (case> {try.#Success _} true - {try.#Failure _} false))) + (pipe.case + {try.#Success _} true + {try.#Failure _} false))) (_.cover [/.existential /.existential?] (|> (do /phase.monad [:it: /.existential] @@ -112,8 +116,9 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (case> {try.#Success _} true - {try.#Failure _} false)) + (pipe.case + {try.#Success _} true + {try.#Failure _} false)) (|> (do /phase.monad [varT (/.check (do check.monad [[id type] check.var] @@ -124,6 +129,7 @@ (/module.with 0 module) (/phase#each product.right) (/phase.result state) - (case> {try.#Success _} false - {try.#Failure _} true)))) + (pipe.case + {try.#Success _} false + {try.#Failure _} true)))) )))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index b08ab36de..5fa0d281b 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -5,7 +5,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] ["[0]" try {"+" Try} ("[1]#[0]" functor)] ["[0]" exception]] [data 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 203c7a46f..f27af5d36 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 @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try {"+" Try} ("[1]#[0]" functor)] ["[0]" exception {"+" Exception}]] @@ -479,22 +479,24 @@ (//module.with 0 module) (//phase#each product.right) (//phase.result state) - (case> {try.#Success {.#Some actual}} - (let [(^open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))] - (list#= expected (list.reversed actual))) - - _ - false))))] + (pipe.case + {try.#Success {.#Some actual}} + (let [(^open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))] + (list#= expected (list.reversed actual))) + + _ + false))))] (and (normal? (list) (list)) (normal? expected_record global_record) (normal? expected_record local_record) (|> (/.normal false tuple) (//phase.result state) - (case> {try.#Success {.#None}} - true - - _ - false))))) + (pipe.case + {try.#Success {.#None}} + true + + _ + false))))) (_.cover [/.order] (let [local_record (list.zipped/2 (list#each (|>> [""]) slots/0) tuple) global_record (list.zipped/2 (list#each (|>> [module]) slots/0) tuple) @@ -507,22 +509,24 @@ (//module.with 0 module) (//phase#each (|>> product.right product.right)) (//phase.result state) - (case> {try.#Success {.#Some [actual_arity actual_tuple actual_type]}} - (and (n.= arity actual_arity) - (# code.equivalence = (code.tuple tuple) (code.tuple actual_tuple)) - (type#= :record: actual_type)) - - _ - false)))) + (pipe.case + {try.#Success {.#Some [actual_arity actual_tuple actual_type]}} + (and (n.= arity actual_arity) + (# code.equivalence = (code.tuple tuple) (code.tuple actual_tuple)) + (type#= :record: actual_type)) + + _ + false)))) unit? (: (-> Bit Bit) (function (_ pattern_matching?) (|> (/.order false (list)) (//phase.result state) - (case> (^ {try.#Success {.#Some [0 (list) actual_type]}}) - (same? .Any actual_type) + (pipe.case + (^ {try.#Success {.#Some [0 (list) actual_type]}}) + (same? .Any actual_type) - _ - false))))] + _ + false))))] (and (ordered? false global_record) (ordered? false (list.reversed global_record)) (ordered? false local_record) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index dfc9ba28d..fd60e1de8 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -5,7 +5,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] ["[0]" function] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception]] 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 3c215c00b..45fef5649 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 @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception]] [data @@ -53,11 +53,12 @@ (//phase#each product.right) (//phase.result state) (try#each (|>> product.right - (case> (^ [actual_type (//analysis.local 0)]) - (type#= expected_type actual_type) + (pipe.case + (^ [actual_type (//analysis.local 0)]) + (type#= expected_type actual_type) - _ - false))) + _ + false))) (try.else false)) can_find_foreign_variable! @@ -71,11 +72,12 @@ (//phase.result state) (try#each (|>> product.right product.right - (case> (^ [actual_type (//analysis.foreign 0)]) - (type#= expected_type actual_type) + (pipe.case + (^ [actual_type (//analysis.foreign 0)]) + (type#= expected_type actual_type) - _ - false))) + _ + false))) (try.else false)) can_find_local_definition! @@ -86,13 +88,14 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (case> (^ [actual_type (//analysis.constant [actual_module actual_name])]) - (and (type#= expected_type actual_type) - (same? expected_module actual_module) - (same? expected_name actual_name)) + (pipe.case + (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (and (type#= expected_type actual_type) + (same? expected_module actual_module) + (same? expected_name actual_name)) - _ - false))) + _ + false))) (try.else false)) can_find_foreign_definition! @@ -105,13 +108,14 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (case> (^ [actual_type (//analysis.constant [actual_module actual_name])]) - (and (type#= expected_type actual_type) - (same? import actual_module) - (same? expected_name actual_name)) + (pipe.case + (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (and (type#= expected_type actual_type) + (same? import actual_module) + (same? expected_name actual_name)) - _ - false))) + _ + false))) (try.else false)) can_find_alias! @@ -125,13 +129,14 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (case> (^ [actual_type (//analysis.constant [actual_module actual_name])]) - (and (type#= expected_type actual_type) - (same? import actual_module) - (same? expected_name actual_name)) + (pipe.case + (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (and (type#= expected_type actual_type) + (same? import actual_module) + (same? expected_name actual_name)) - _ - false))) + _ + false))) (try.else false)) can_find_type! @@ -145,13 +150,14 @@ (//module.with 0 expected_module) (//phase.result state) (try#each (|>> product.right - (case> (^ [actual_type (//analysis.constant [actual_module actual_name])]) - (and (type#= .Type actual_type) - (same? expected_module actual_module) - (same? expected_name actual_name)) + (pipe.case + (^ [actual_type (//analysis.constant [actual_module actual_name])]) + (and (type#= .Type actual_type) + (same? expected_module actual_module) + (same? expected_name actual_name)) - _ - false))) + _ + false))) (try.else false))] (and can_find_local_variable! can_find_foreign_variable! 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 86f813b1d..454cebdc6 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 @@ -6,7 +6,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try]] [data ["[0]" product]] @@ -34,43 +34,47 @@ (/phase#each product.right) (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) - (case> (^ {try.#Success analysis}) - (? analysis) + (pipe.case + (^ {try.#Success analysis}) + (? analysis) - _ - false)) + _ + false)) (|> it (/type.expecting .Nothing) (/module.with 0 module) (/phase#each product.right) (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) - (case> (^ {try.#Failure error}) - true + (pipe.case + (^ {try.#Failure error}) + true - _ - false)) + _ + false)) (|> it /type.inferring (/module.with 0 module) (/phase#each product.right) (/phase.result [/extension.#bundle /extension.empty /extension.#state state]) - (case> (^ {try.#Success [inferred analysis]}) - (and (type#= type inferred) - (? analysis)) + (pipe.case + (^ {try.#Success [inferred analysis]}) + (and (type#= type inferred) + (? analysis)) - _ - false)))) + _ + false)))) (template: (analysis? <type> <tag>) [(: (-> <type> Analysis Bit) (function (_ expected) - (|>> (case> (^ (<tag> actual)) - (same? expected actual) + (|>> (pipe.case + (^ (<tag> actual)) + (same? expected actual) - _ - false))))]) + _ + false))))]) (def: .public test (<| (_.covering /._) @@ -83,7 +87,7 @@ (`` ($_ _.and (_.cover [/.unit] (..analysis state module .Any /.unit - (|>> (case> (^ (/analysis.unit)) true _ false)))) + (|>> (pipe.case (^ (/analysis.unit)) true _ false)))) (~~ (template [<analysis> <type> <random> <tag>] [(do ! [sample <random>] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux index ab2af87eb..1f24840eb 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension.lux @@ -8,7 +8,7 @@ ["$[0]" equivalence] ["$[0]" hash]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try] ["[0]" exception]] [data @@ -122,22 +122,24 @@ (/.install extender extension handler/1)) (phase.result [/.#bundle /.empty /.#state state]) - (case> {try.#Failure error} - (exception.match? /.cannot_overwrite error) + (pipe.case + {try.#Failure error} + (exception.match? /.cannot_overwrite error) - _ - false))) + _ + false))) (_.cover [/.unknown] (|> (/.apply archive.empty (function (_ archive input) (# phase.monad in (++ input))) [extension (list left right)]) (phase.result [/.#bundle /.empty /.#state state]) - (case> {try.#Failure error} - (exception.match? /.unknown error) + (pipe.case + {try.#Failure error} + (exception.match? /.unknown error) - _ - false))) + _ + false))) ))) (def: test|bundle @@ -197,11 +199,12 @@ (/.apply archive.empty phase [extension (list)])) (phase.result [/.#bundle /.empty /.#state state]) - (case> {try.#Failure error} - (exception.match? /.incorrect_arity error) + (pipe.case + {try.#Failure error} + (exception.match? /.incorrect_arity error) - _ - false)))) + _ + false)))) (_.cover [/.invalid_syntax] (let [handler (: (/.Handler Int Nat Nat) (function (_ @self phase archive inputs) @@ -211,11 +214,12 @@ (/.apply archive.empty phase [extension (list left right)])) (phase.result [/.#bundle /.empty /.#state state]) - (case> {try.#Failure error} - (exception.match? /.invalid_syntax error) + (pipe.case + {try.#Failure error} + (exception.match? /.invalid_syntax error) - _ - false)))) + _ + false)))) (_.for [/.Name] ..test|name) )) @@ -252,11 +256,12 @@ (/.lifted (phase.lifted {try.#Failure expected_error}))) (phase.result [/.#bundle /.empty /.#state state]) - (case> {try.#Failure actual_error} - (same? expected_error actual_error) + (pipe.case + {try.#Failure actual_error} + (same? expected_error actual_error) - _ - false)))) + _ + false)))) (_.cover [/.up] (|> (do phase.monad [] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 90cf891ac..24a9fb366 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -1,37 +1,37 @@ (.using - [lux {"-" i64 int primitive} - [abstract - ["[0]" monad {"+" do}]] - [data - ["%" text/format {"+" format}]] - ["r" math/random {"+" Random}] - ["_" test {"+" Test}] - [control - pipe - [io {"+" IO}] - ["[0]" try] - [concurrency - ["[0]" atom]]] - [data - ["[0]" product]] - ["[0]" type ("[1]#[0]" equivalence)] - [macro - ["[0]" code]] - [meta - ["[0]" symbol]]] - [//// - [analysis - ["_[0]" primitive]]] - [\\ - ["[0]" / - ["///[1]" //// "_" - [analysis - ["[1][0]" scope] - ["[1][0]" type]] - [//// - ["[0]" phase] - [meta - ["[0]" archive]]]]]]) + [lux {"-" i64 int primitive} + [abstract + ["[0]" monad {"+" do}]] + [data + ["%" text/format {"+" format}]] + ["r" math/random {"+" Random}] + ["_" test {"+" Test}] + [control + ["[0]" pipe] + [io {"+" IO}] + ["[0]" try] + [concurrency + ["[0]" atom]]] + [data + ["[0]" product]] + ["[0]" type ("[1]#[0]" equivalence)] + [macro + ["[0]" code]] + [meta + ["[0]" symbol]]] + [//// + [analysis + ["_[0]" primitive]]] + [\\ + ["[0]" / + ["///[1]" //// "_" + [analysis + ["[1][0]" scope] + ["[1][0]" type]] + [//// + ["[0]" phase] + [meta + ["[0]" archive]]]]]]) (template [<name> <success> <failure>] [(def: (<name> procedure params output_type) @@ -40,11 +40,12 @@ (////type.with_type output_type (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) (phase.result _primitive.state) - (case> {try.#Success _} - <success> + (pipe.case + {try.#Success _} + <success> - {try.#Failure _} - <failure>)))] + {try.#Failure _} + <failure>)))] [check_success+ true false] [check_failure+ false true] 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 beb9c4a34..c5d7ccd02 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 @@ -5,7 +5,7 @@ [hash {"+" Hash}] ["[0]" monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)]] [data ["[0]" sum] @@ -71,13 +71,14 @@ (|> letA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (case> (^ {try.#Success (synthesis.branch/let [inputS registerS outputS])}) - (and (n.= registerA registerS) - (//primitive.corresponds? inputA inputS) - (//primitive.corresponds? outputA outputS)) + (pipe.case + (^ {try.#Success (synthesis.branch/let [inputS registerS outputS])}) + (and (n.= registerA registerS) + (//primitive.corresponds? inputA inputS) + (//primitive.corresponds? outputA outputS)) - _ - false))))) + _ + false))))) (def: if_test Test @@ -99,13 +100,14 @@ (|> ifA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (case> (^ {try.#Success (synthesis.branch/if [inputS thenS elseS])}) - (and (//primitive.corresponds? inputA inputS) - (//primitive.corresponds? thenA thenS) - (//primitive.corresponds? elseA elseS)) + (pipe.case + (^ {try.#Success (synthesis.branch/if [inputS thenS elseS])}) + (and (//primitive.corresponds? inputA inputS) + (//primitive.corresponds? thenA thenS) + (//primitive.corresponds? elseA elseS)) - _ - false))))) + _ + false))))) (def: random_member (Random synthesis.Member) @@ -158,12 +160,13 @@ (|> getA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (case> (^ {try.#Success (synthesis.branch/get [pathS recordS])}) - (and (# (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS) - (//primitive.corresponds? recordA recordS)) + (pipe.case + (^ {try.#Success (synthesis.branch/get [pathS recordS])}) + (and (# (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS) + (//primitive.corresponds? recordA recordS)) - _ - false))))) + _ + false))))) (def: random_bit (Random [Path Match]) @@ -185,11 +188,12 @@ (|> random_element (random.set hash 5) (# random.monad each (|>> set.list - (case> (^ (list s0 s1 s2 s3 s4)) - [s0 s1 s2 s3 s4] + (pipe.case + (^ (list s0 s1 s2 s3 s4)) + [s0 s1 s2 s3 s4] - _ - (undefined)))))) + _ + (undefined)))))) (template [<name> <hash> <random> <path> <synthesis> <pattern> <analysis>] [(def: <name> @@ -333,12 +337,13 @@ (_.cover [/.synthesize_case] (|> (/.synthesize_case //.phase archive.empty expected_input match) (phase.result [///bundle.empty synthesis.init]) - (case> (^ {try.#Success (synthesis.branch/case [actual_input actual_path])}) - (and (# synthesis.equivalence = expected_input actual_input) - (# synthesis.path_equivalence = expected_path actual_path)) + (pipe.case + (^ {try.#Success (synthesis.branch/case [actual_input actual_path])}) + (and (# synthesis.equivalence = expected_input actual_input) + (# synthesis.path_equivalence = expected_path actual_path)) - _ - false))))) + _ + false))))) (def: .public test Test 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 6fa2b9257..159207280 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 @@ -1,32 +1,32 @@ (.using - [lux {"-" primitive} - [abstract ["[0]" monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" try]] - [data - ["%" text/format {"+" format}] - [number - ["n" nat]] - [collection - ["[0]" list]]] - ["r" math/random {"+" Random} ("[1]#[0]" monad)] - ["_" test {"+" Test}] - [meta - ["[0]" symbol]]] - [\\ - ["[0]" / "_" - ["/[1]" // - ["/[1]" // "_" - [extension - ["[1][0]" bundle]] - ["/[1]" // - ["[1][0]" analysis {"+" Analysis}] - ["[1][0]" synthesis {"+" Synthesis}] - [/// - ["[0]" phase] - [meta - ["[0]" archive]]]]]]]]) + [lux {"-" primitive} + [abstract ["[0]" monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" try]] + [data + ["%" text/format {"+" format}] + [number + ["n" nat]] + [collection + ["[0]" list]]] + ["r" math/random {"+" Random} ("[1]#[0]" monad)] + ["_" test {"+" Test}] + [meta + ["[0]" symbol]]] + [\\ + ["[0]" / "_" + ["/[1]" // + ["/[1]" // "_" + [extension + ["[1][0]" bundle]] + ["/[1]" // + ["[1][0]" analysis {"+" Analysis}] + ["[1][0]" synthesis {"+" Synthesis}] + [/// + ["[0]" phase] + [meta + ["[0]" archive]]]]]]]]) (def: .public primitive (Random Analysis) @@ -82,11 +82,12 @@ (|> {////analysis.#Primitive {<analysis> expected}} (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (case> {try.#Success {////synthesis.#Primitive {<synthesis> actual}}} - (same? expected actual) + (pipe.case + {try.#Success {////synthesis.#Primitive {<synthesis> actual}}} + (same? expected actual) - _ - false))))] + _ + false))))] [////analysis.#Unit ////synthesis.#Text (r#in ////synthesis.unit)] [////analysis.#Bit ////synthesis.#Bit r.bit] 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 ce3327adb..2f66190b4 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 @@ -1,38 +1,38 @@ (.using - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [data - ["%" text/format {"+" format}]] - ["r" math/random {"+" Random}] - ["_" test {"+" Test}] - [control - pipe - ["[0]" try]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - ["[0]" product] - [number - ["n" nat]] - [collection - ["[0]" list]]] - [meta - ["[0]" symbol]]] - ["[0]" // "_" - ["[1][0]" primitive]] - [\\ - ["[0]" / "_" - ["/[1]" // - ["/[1]" // "_" - [extension - ["[1][0]" bundle]] - ["/[1]" // - ["[1][0]" analysis {"+" Analysis}] - ["[1][0]" synthesis {"+" Synthesis}] - [/// - ["[0]" phase] - [meta - ["[0]" archive]]]]]]]]) + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [data + ["%" text/format {"+" format}]] + ["r" math/random {"+" Random}] + ["_" test {"+" Test}] + [control + ["[0]" pipe] + ["[0]" try]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + ["[0]" product] + [number + ["n" nat]] + [collection + ["[0]" list]]] + [meta + ["[0]" symbol]]] + ["[0]" // "_" + ["[1][0]" primitive]] + [\\ + ["[0]" / "_" + ["/[1]" // + ["/[1]" // "_" + [extension + ["[1][0]" bundle]] + ["/[1]" // + ["[1][0]" analysis {"+" Analysis}] + ["[1][0]" synthesis {"+" Synthesis}] + [/// + ["[0]" phase] + [meta + ["[0]" archive]]]]]]]]) (def: variant Test @@ -48,14 +48,15 @@ (|> (////analysis.variant [lefts right? memberA]) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (case> (^ {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)) - (//primitive.corresponds? memberA valueS))) - - _ - false))))) + (pipe.case + (^ {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)) + (//primitive.corresponds? memberA valueS))) + + _ + false))))) (def: tuple Test @@ -66,13 +67,14 @@ (|> (////analysis.tuple membersA) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (case> (^ {try.#Success (////synthesis.tuple membersS)}) - (and (n.= size (list.size membersS)) - (list.every? (product.uncurried //primitive.corresponds?) - (list.zipped/2 membersA membersS))) + (pipe.case + (^ {try.#Success (////synthesis.tuple membersS)}) + (and (n.= size (list.size membersS)) + (list.every? (product.uncurried //primitive.corresponds?) + (list.zipped/2 membersA membersS))) - _ - false))))) + _ + false))))) (def: .public test Test 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 55a187083..42a9d531a 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 @@ -6,7 +6,6 @@ [math ["[0]" random {"+" Random}]] [control - [pipe {"+" case>}] ["[0]" try]] [data ["[0]" product] diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive.lux b/stdlib/source/test/lux/tool/compiler/meta/archive.lux index 7cbd76e8a..f89666969 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive.lux @@ -5,7 +5,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] ["[0]" try] ["[0]" exception]] [data diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux index a99e8eccf..1ed849972 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/module/document.lux @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception] [parser @@ -52,42 +52,47 @@ (and (|> expected (/.document key/0) (/.marked? key/0) - (case> {try.#Success it} true - {try.#Failure error} false)) + (pipe.case + {try.#Success it} true + {try.#Failure error} false)) (|> expected (/.document key/0) (/.marked? key/1) - (case> {try.#Success it} false - {try.#Failure error} true)))) + (pipe.case + {try.#Success it} false + {try.#Failure error} true)))) (_.cover [/.invalid_signature] (and (|> expected (/.document key/0) (/.content key/1) - (case> {try.#Success it} - false - - {try.#Failure error} - (exception.match? /.invalid_signature error))) + (pipe.case + {try.#Success it} + false + + {try.#Failure error} + (exception.match? /.invalid_signature error))) (|> expected (/.document key/0) (/.marked? key/1) - (case> {try.#Success it} - false - - {try.#Failure error} - (exception.match? /.invalid_signature error))))) + (pipe.case + {try.#Success it} + false + + {try.#Failure error} + (exception.match? /.invalid_signature error))))) (_.cover [/.writer /.parser] (|> expected (/.document key/0) (binaryF.result (/.writer binaryF.nat)) (<binary>.result (/.parser key/0 <binary>.nat)) - (case> {try.#Success it} - (and (/signature#= signature/0 (/.signature it)) - (|> it - (/.content key/0) - (try#each (nat.= expected)) - (try.else false))) - - {try.#Failure error} - false))) + (pipe.case + {try.#Success it} + (and (/signature#= signature/0 (/.signature it)) + (|> it + (/.content key/0) + (try#each (nat.= expected)) + (try.else false))) + + {try.#Failure error} + false))) )))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/cli.lux b/stdlib/source/test/lux/tool/compiler/meta/cli.lux index 48aa9c079..725d1f495 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/cli.lux @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] ["<>" parser ["<[0]>" cli]]] @@ -61,13 +61,14 @@ [(_.cover [<type>] (|> (list& "build" compilation') (<cli>.result /.service) - (try#each (|>> (case> {/.#Compilation it} - (|> it - (the <slot>) - <?>) - - _ - false))) + (try#each (|>> (pipe.case + {/.#Compilation it} + (|> it + (the <slot>) + <?>) + + _ + false))) (try.else false)))] [/.Host_Dependency /.#host_dependencies (list#= host_dependencies)] @@ -83,13 +84,14 @@ (`` (and (~~ (template [<slot> <?>] [(|> (list& "repl" compilation') (<cli>.result /.service) - (try#each (|>> (case> {/.#Interpretation it} - (|> it - (the <slot>) - <?>) - - _ - false))) + (try#each (|>> (pipe.case + {/.#Interpretation it} + (|> it + (the <slot>) + <?>) + + _ + false))) (try.else false))] [/.#host_dependencies (list#= host_dependencies)] @@ -104,13 +106,14 @@ (`` (and (~~ (template [<side> <?>] [(|> (list& "export" export) (<cli>.result /.service) - (try#each (|>> (case> {/.#Export it} - (|> it - <side> - <?>) - - _ - false))) + (try#each (|>> (pipe.case + {/.#Export it} + (|> it + <side> + <?>) + + _ + false))) (try.else false))] [product.left (list#= sources)] diff --git a/stdlib/source/test/lux/tool/compiler/meta/export.lux b/stdlib/source/test/lux/tool/compiler/meta/export.lux index 2864dabfd..762449a9e 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/export.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/export.lux @@ -5,7 +5,7 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] [concurrency ["[0]" async]] @@ -79,41 +79,43 @@ (|> it (try#each (|>> product.left sequence.list - (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]})) - (with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0)) - (same? /.mode mode/0) - (same? /.ownership ownership/0) - (binary#= content/0 (tar.data actual_content/0))) - (and (text#= file/1' (tar.from_path actual_path/1)) - (same? /.mode mode/1) - (same? /.ownership ownership/1) - (binary#= content/1 (tar.data actual_content/1))))] - (or <test> - (let [[[actual_path/0 actual_content/0] [actual_path/1 actual_content/1]] - [[actual_path/1 actual_content/1] [actual_path/0 actual_content/0]]] - <test>))) - - _ - false))) + (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]})) + (with_expansions [<test> (and (and (text#= file/0' (tar.from_path actual_path/0)) + (same? /.mode mode/0) + (same? /.ownership ownership/0) + (binary#= content/0 (tar.data actual_content/0))) + (and (text#= file/1' (tar.from_path actual_path/1)) + (same? /.mode mode/1) + (same? /.ownership ownership/1) + (binary#= content/1 (tar.data actual_content/1))))] + (or <test> + (let [[[actual_path/0 actual_content/0] [actual_path/1 actual_content/1]] + [[actual_path/1 actual_content/1] [actual_path/0 actual_content/0]]] + <test>))) + + _ + false))) (try.else false))) (_.cover' [/.export /.file] (|> it (try#each (|>> product.right sequence.list - (case> (^ (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)) - (binary#= content/1 (tar.data actual_content/1))))] - (or <test> - (let [[[actual_path/0 actual_content/0] [actual_path/1 actual_content/1]] - [[actual_path/1 actual_content/1] [actual_path/0 actual_content/0]]] - <test>))) - - _ - false))) + (pipe.case + (^ (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)) + (binary#= content/1 (tar.data actual_content/1))))] + (or <test> + (let [[[actual_path/0 actual_content/0] [actual_path/1 actual_content/1]] + [[actual_path/1 actual_content/1] [actual_path/0 actual_content/0]]] + <test>))) + + _ + false))) (try.else false))) ))) )))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/import.lux b/stdlib/source/test/lux/tool/compiler/meta/import.lux index 7a24f9a82..e601614f6 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/import.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/import.lux @@ -5,7 +5,6 @@ [abstract [monad {"+" do}]] [control - [pipe {"+" case>}] ["[0]" maybe ("[1]#[0]" functor)] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception] diff --git a/stdlib/source/test/lux/tool/compiler/phase.lux b/stdlib/source/test/lux/tool/compiler/phase.lux index f0137730a..19ec57c3c 100644 --- a/stdlib/source/test/lux/tool/compiler/phase.lux +++ b/stdlib/source/test/lux/tool/compiler/phase.lux @@ -8,7 +8,7 @@ ["$[0]" functor {"+" Injection Comparison}] ["$[0]" monad]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" try ("[1]#[0]" functor)] ["[0]" exception {"+" exception:}]] [data @@ -54,19 +54,19 @@ (_.cover [/.failure] (|> (/.failure expected_error) (/.result state) - (case> {try.#Failure actual_error} - (same? expected_error actual_error) + (pipe.case {try.#Failure actual_error} + (same? expected_error actual_error) - _ - false))) + _ + false))) (_.cover [/.lifted] (and (|> (/.lifted {try.#Failure expected_error}) (/.result state) - (case> {try.#Failure actual_error} - (same? expected_error actual_error) + (pipe.case {try.#Failure actual_error} + (same? expected_error actual_error) - _ - false)) + _ + false)) (|> (/.lifted {try.#Success expected}) (# /.functor each (same? expected)) (/.result state) @@ -74,26 +74,26 @@ (_.cover [/.except] (|> (/.except ..oops []) (/.result state) - (case> {try.#Failure error} - (exception.match? ..oops error) + (pipe.case {try.#Failure error} + (exception.match? ..oops error) - _ - false))) + _ + false))) (_.cover [/.assertion] (and (|> (/.assertion ..oops [] false) (/.result state) - (case> {try.#Failure error} - (exception.match? ..oops error) + (pipe.case {try.#Failure error} + (exception.match? ..oops error) - _ - false)) + _ + false)) (|> (/.assertion ..oops [] true) (/.result state) - (case> {try.#Success _} - true + (pipe.case {try.#Success _} + true - _ - false)))) + _ + false)))) ))) (def: test|state @@ -125,12 +125,12 @@ (# n.hex encoded) (text#= state/hex))))) (/.result' state) - (case> {try.#Success [state' verdict]} - (and verdict - (n.= state state')) + (pipe.case {try.#Success [state' verdict]} + (and verdict + (n.= state state')) - _ - false))) + _ + false))) ))) (def: test|operation @@ -147,20 +147,20 @@ (_.cover [/.result] (|> (# /.monad in expected) (/.result state) - (case> {try.#Success actual} - (same? expected actual) + (pipe.case {try.#Success actual} + (same? expected actual) - _ - false))) + _ + false))) (_.cover [/.result'] (|> (# /.monad in expected) (/.result' state) - (case> {try.#Success [state' actual]} - (and (same? state state') - (same? expected actual)) + (pipe.case {try.#Success [state' actual]} + (and (same? state state') + (same? expected actual)) - _ - false))) + _ + false))) ..test|state ..test|error ))) @@ -186,13 +186,13 @@ (# /.monad in (%.frac input)))))] (|> (phase archive.empty expected) (/.result' [state/0 state/1]) - (case> {try.#Success [[state/0' state/1'] actual]} - (and (text#= (%.frac (i.frac expected)) actual) - (same? state/0 state/0') - (same? state/1 state/1')) + (pipe.case {try.#Success [[state/0' state/1'] actual]} + (and (text#= (%.frac (i.frac expected)) actual) + (same? state/0 state/0') + (same? state/1 state/1')) - _ - false)))) + _ + false)))) ))) (def: .public test diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 0d20b2ddc..a9799f045 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -1,39 +1,39 @@ (.using - [library - [lux {"-" symbol} - ["_" test {"+" Test}] - [abstract - ["[0]" monad {"+" do}] - [\\specification - ["$[0]" equivalence]]] - [control - [pipe {"+" case>}] - ["[0]" maybe]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" list] - ["[0]" array]]] - [macro - ["[0]" code ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random} ("[1]#[0]" monad)] - [number - ["n" nat]]]]] - [\\library - ["[0]" / ("[1]#[0]" equivalence)]] - ["[0]" / "_" - ["[1][0]" abstract] - ["[1][0]" check] - ["[1][0]" dynamic] - ["[1][0]" implicit] - ["[1][0]" poly] - ["[1][0]" quotient] - ["[1][0]" refinement] - ["[1][0]" resource] - ["[1][0]" unit] - ["[1][0]" variance]]) + [library + [lux {"-" symbol} + ["_" test {"+" Test}] + [abstract + ["[0]" monad {"+" do}] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" pipe] + ["[0]" maybe]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" list] + ["[0]" array]]] + [macro + ["[0]" code ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random} ("[1]#[0]" monad)] + [number + ["n" nat]]]]] + [\\library + ["[0]" / ("[1]#[0]" equivalence)]] + ["[0]" / "_" + ["[1][0]" abstract] + ["[1][0]" check] + ["[1][0]" dynamic] + ["[1][0]" implicit] + ["[1][0]" poly] + ["[1][0]" quotient] + ["[1][0]" refinement] + ["[1][0]" resource] + ["[1][0]" unit] + ["[1][0]" variance]]) (def: short (Random Text) @@ -80,8 +80,8 @@ ($equivalence.spec /.equivalence (..random 0))) (do [! random.monad] - [anonymousT (random.only (|>> (case> {.#Named _ _} false - _ true)) + [anonymousT (random.only (|>> (pipe.case {.#Named _ _} false + _ true)) (..random 0)) symbol/0 ..symbol symbol/1 ..symbol @@ -125,7 +125,7 @@ full (/.applied (list Int) partial)] (in (# /.equivalence = full {.#Product Bit Int})))) (|> (/.applied (list Bit) Text) - (case> {.#None} #1 _ #0)))) + (pipe.case {.#None} #1 _ #0)))) (do [! random.monad] [size (|> random.nat (# ! each (n.% 3))) members (monad.all ! (list.repeated size (..random 0))) diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index a99a19f5d..04ab804ec 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -10,7 +10,7 @@ ["$[0]" apply] ["$[0]" monad]]] [control - [pipe {"+" case>}] + ["[0]" pipe] ["[0]" function] ["[0]" try] ["[0]" exception {"+" exception:}]] @@ -164,13 +164,13 @@ (and (|> (/.check <left> <right>) (: (/.Check Any)) (/.result /.fresh_context) - (case> {try.#Failure error} (? error) - {try.#Success _} false)) + (pipe.case {try.#Failure error} (? error) + {try.#Success _} false)) (|> (/.check <right> <left>) (: (/.Check Any)) (/.result /.fresh_context) - (case> {try.#Failure error} (? error) - {try.#Success _} false)))))] + (pipe.case {try.#Failure error} (? error) + {try.#Success _} false)))))] ($_ _.and (_.cover [/.type_check_failed] (let [scenario (scenario (exception.match? /.type_check_failed))] @@ -273,26 +273,26 @@ [[var_id var_type] /.var] (/.peek var_id)) (/.result /.fresh_context) - (case> {try.#Success {.#None}} true - _ false)) + (pipe.case {try.#Success {.#None}} true + _ false)) (|> (do /.monad [[var_id var/0] /.var [_ var/1] /.var _ (/.check var/0 var/1)] (/.peek var_id)) (/.result /.fresh_context) - (case> {try.#Success {.#None}} true - _ false)) + (pipe.case {try.#Success {.#None}} true + _ false)) (|> (do /.monad [[var_id var_type] /.var _ (/.bind expected var_id)] (/.peek var_id)) (/.result /.fresh_context) - (case> {try.#Success {.#Some actual}} - (same? expected actual) - - _ - false))))) + (pipe.case {try.#Success {.#Some actual}} + (same? expected actual) + + _ + false))))) (do random.monad [nominal (random.ascii/upper 10) .let [expected {.#Primitive nominal (list)}]] @@ -364,11 +364,11 @@ (def: succeeds? (All (_ a) (-> (/.Check a) Bit)) (|>> (/.result /.fresh_context) - (case> {try.#Success _} - true + (pipe.case {try.#Success _} + true - {try.#Failure error} - false))) + {try.#Failure error} + false))) (def: fails? (All (_ a) (-> (/.Check a) Bit)) diff --git a/stdlib/source/test/lux/type/poly/json.lux b/stdlib/source/test/lux/type/poly/json.lux index 668b8ea21..16300a25d 100644 --- a/stdlib/source/test/lux/type/poly/json.lux +++ b/stdlib/source/test/lux/type/poly/json.lux @@ -13,7 +13,6 @@ ["$[0]" equivalence] ["$[0]" codec]]] [control - pipe ["[0]" try] ["p" parser ... TODO: Get rid of this import ASAP diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 919f7249e..3d4de1e0f 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -5,7 +5,7 @@ [abstract [monad {"+" Monad do}]] [control - [pipe {"+" do>}] + ["[0]" pipe] ["[0]" io {"+" IO}] ["[0]" try {"+" Try}] ["[0]" function] @@ -41,11 +41,11 @@ product.right (the //.#body) (function.on {.#None}) - (# ! each (|>> (do> try.monad - [] - [product.right (# utf8.codec decoded)] - [(# nat.decimal decoded)] - [(nat.= expected) in]) + (# ! each (|>> (pipe.do try.monad + [] + [product.right (# utf8.codec decoded)] + [(# nat.decimal decoded)] + [(nat.= expected) in]) (try.else false)))) {try.#Failure error} diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux index de559c620..d1696c608 100644 --- a/stdlib/source/test/lux/world/program.lux +++ b/stdlib/source/test/lux/world/program.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - [pipe {"+" case>}] - ["[0]" io] - ["[0]" maybe ("[1]#[0]" functor)] - ["[0]" try] - ["[0]" exception] - [parser - [environment {"+" Environment}]]] - [data - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" dictionary] - ["[0]" list]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / - [// - [file {"+" Path}]]]] - [\\specification - ["$[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" pipe] + ["[0]" io] + ["[0]" maybe ("[1]#[0]" functor)] + ["[0]" try] + ["[0]" exception] + [parser + [environment {"+" Environment}]]] + [data + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" dictionary] + ["[0]" list]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / + [// + [file {"+" Path}]]]] + [\\specification + ["$[0]" /]]) (def: (environment env_size) (-> Nat (Random Environment)) @@ -70,9 +70,9 @@ (|> unknown (# program variable) io.run! - (case> {try.#Success _} - false - - {try.#Failure error} - (exception.match? /.unknown_environment_variable error))))) + (pipe.case {try.#Success _} + false + + {try.#Failure error} + (exception.match? /.unknown_environment_variable error))))) )))) |