From 41495e32d3f5f88b5f189f48dd4fdbfa883c6ac0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 14 Mar 2022 18:27:37 -0400 Subject: De-sigil-ification: > --- .../library/lux/control/concurrency/actor.lux | 11 +- .../library/lux/control/concurrency/async.lux | 11 +- .../library/lux/control/concurrency/semaphore.lux | 8 +- stdlib/source/library/lux/control/pipe.lux | 146 ++++++++++----------- stdlib/source/library/lux/data/collection/bits.lux | 36 ++--- stdlib/source/library/lux/data/format/binary.lux | 58 ++++---- stdlib/source/library/lux/data/format/json.lux | 87 ++++++------ stdlib/source/library/lux/data/format/tar.lux | 11 +- stdlib/source/library/lux/debug.lux | 10 +- stdlib/source/library/lux/target/common_lisp.lux | 59 +++++---- stdlib/source/library/lux/target/js.lux | 40 +++--- .../library/lux/target/jvm/constant/pool.lux | 15 ++- .../library/lux/target/jvm/type/signature.lux | 51 +++---- stdlib/source/library/lux/target/lua.lux | 29 ++-- stdlib/source/library/lux/target/php.lux | 29 ++-- stdlib/source/library/lux/target/python.lux | 29 ++-- stdlib/source/library/lux/target/r.lux | 71 +++++----- stdlib/source/library/lux/target/ruby.lux | 29 ++-- stdlib/source/library/lux/target/scheme.lux | 50 +++---- stdlib/source/library/lux/test.lux | 13 +- stdlib/source/library/lux/time.lux | 7 +- .../compiler/language/lux/analysis/inference.lux | 23 ++-- .../tool/compiler/language/lux/analysis/module.lux | 7 +- .../language/lux/phase/extension/analysis/jvm.lux | 22 ++-- .../language/lux/phase/extension/directive/jvm.lux | 13 +- .../lux/phase/generation/php/primitive.lux | 2 - .../tool/compiler/language/lux/phase/synthesis.lux | 19 +-- .../compiler/language/lux/phase/synthesis/case.lux | 6 +- .../language/lux/phase/synthesis/function.lux | 11 +- .../lux/tool/compiler/language/lux/synthesis.lux | 1 - .../compiler/language/lux/synthesis/simple.lux | 17 +-- .../lux/tool/compiler/meta/archive/registry.lux | 7 +- .../lux/tool/compiler/meta/cache/module.lux | 11 +- .../source/library/lux/tool/compiler/meta/cli.lux | 11 +- .../source/library/lux/tool/compiler/reference.lux | 13 +- .../lux/tool/compiler/reference/variable.lux | 63 ++++----- stdlib/source/library/lux/world/file.lux | 11 +- .../source/library/lux/world/net/http/client.lux | 127 +++++++++--------- .../source/library/lux/world/net/http/header.lux | 36 ++--- 39 files changed, 616 insertions(+), 584 deletions(-) (limited to 'stdlib/source/library') 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 [ (as_is (the #open_positions) (i.> -1))] (do io.monad [[_ state'] (atom.update! (|>> (revised #open_positions --) - (if> [] - [] - [(revised #waiting_list (queue.end sink))])) + (pipe.if [] + [] + [(revised #waiting_list (queue.end sink))])) semaphore)] (with_expansions [ (sink []) (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)) (.tuple (<>.some .any))) -(syntax: .public (new> [start .any - body body^ - prev .any]) +(syntax: .public (new [start .any + body body^ + prev .any]) (in (list (` (|> (~ start) (~+ body)))))) -(syntax: .public (let> [binding .any - body .any - prev .any]) - (in (list (` (let [(~ binding) (~ prev)] +(syntax: .public (let [binding .any + body .any + prev .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 .any - else body^ - _ _reversed_ - branches (<>.some (<>.and body^ body^))]) +(syntax: .public (cond [_ _reversed_ + prev .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 .any]) - (in (list (` (cond> [(~+ test)] [(~+ then)] - [(~+ else)] - (~ prev)))))) +(syntax: .public (if [test body^ + then body^ + else body^ + prev .any]) + (in (list (` (..cond [(~+ test)] [(~+ then)] + [(~+ else)] + (~ prev)))))) -(syntax: .public (when> [test body^ - then body^ - prev .any]) - (in (list (` (cond> [(~+ test)] [(~+ then)] - [] - (~ prev)))))) +(syntax: .public (when [test body^ + then body^ + prev .any]) + (in (list (` (..cond [(~+ test)] [(~+ then)] + [] + (~ prev)))))) -(syntax: .public (loop> [test body^ - then body^ - prev .any]) +(syntax: .public (loop [test body^ + then body^ + prev .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 .any - steps (<>.some body^) - prev .any]) +(syntax: .public (do [monad .any + steps (<>.some body^) + prev .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 .any]) +(syntax: .public (exec [body body^ + prev .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 .any]) +(syntax: .public (tuple [paths (<>.many body^) + prev .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 .any .any)) - prev .any]) - (in (list (` (case (~ prev) +(syntax: .public (case [branches (<>.many (<>.and .any .any)) + prev .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) [])] - [( bit_index)] + (pipe.cond [(pipe.new (n.= chunk_index idx|output) [])] + [( 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 [ ] [(def: .public (Writer ) ..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 [ ] [(type: .public @@ -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 ))))]) (["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 [ ] - [[] - [(new> (format "float(" text.double_quote text.double_quote ")") [])]] - - [(f.= f.positive_infinity) "inf"] - [(f.= f.negative_infinity) "-inf"] - [f.not_a_number? "nan"] - )) - - ... else - [%.frac]) + (`` (|>> (pipe.cond (~~ (template [ ] + [[] + [(pipe.new (format "float(" text.double_quote 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 [ ] [(def: (-> Evaluation (Maybe Method_Signature)) - (|>> (case> { output} - {.#Some output} + (|>> (pipe.case + { output} + {.#Some output} - _ - {.#None})))] + _ + {.#None})))] [pass! #Pass] [hint! #Hint] @@ -2404,7 +2405,7 @@ [constant (`` (|> value (~~ (template.spliced )))) attribute (attribute.constant constant)] (field.field ..constant::modifier name #1 (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 "") 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' (.Parser (Modifier field.Field)) @@ -235,7 +236,7 @@ [constant (`` (|> value (~~ (template.spliced )))) attribute (attribute.constant constant)] (field.field ..constant::modifier name #1 (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 [ ] - [{ value'} - (n.* (# hash value'))]) - ([2 #Bit bit.hash] - [3 #F64 f.hash] - [5 #Text text.hash] - [7 #I64 i64.hash]))))) + (|>> (pipe.case + (^template [ ] + [{ value'} + (n.* (# 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> { it} {.#Some it} - _ {.#None})))))] + (pipe.case + { 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} - + (# ! each (|>> (pipe.case + {try.#Failure error} + - 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 [ ] - [{ register} - (|> register - (# n.hash hash) - (n.* ))]) - ([2 #Local] - [3 #Foreign]))))) + (|>> (pipe.case + (^template [ ] + [{ register} + (|> register + (# n.hash hash) + (n.* ))]) + ([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) -- cgit v1.2.3