diff options
417 files changed, 11504 insertions, 11464 deletions
diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux index 74d072067..7576f739a 100644 --- a/licentia/source/program/licentia.lux +++ b/licentia/source/program/licentia.lux @@ -63,18 +63,18 @@ (<cli>.named "--output") <cli>.any)] (do io.monad - [?done (: (IO (Try Any)) - (do (try.with io.monad) - [blob (# file.default read input) - document (io#wrap (do [! try.monad] - [raw_json (# utf8.codec decoded blob) - json (|> raw_json - java/lang/String::trim - (# json.codec decoded))] - (|> json - (<json>.result /input.license) - (# ! each /output.license))))] - (# file.default write (# utf8.codec encoded document) output)))] + [?done (is (IO (Try Any)) + (do (try.with io.monad) + [blob (# file.default read input) + document (io#wrap (do [! try.monad] + [raw_json (# utf8.codec decoded blob) + json (|> raw_json + java/lang/String::trim + (# json.codec decoded))] + (|> json + (<json>.result /input.license) + (# ! each /output.license))))] + (# file.default write (# utf8.codec encoded document) output)))] (wrap (debug.log! (case ?done {try.#Success _} (success_message output) diff --git a/licentia/source/program/licentia/license/assurance.lux b/licentia/source/program/licentia/license/assurance.lux index bf5609cc2..a36b38dcf 100644 --- a/licentia/source/program/licentia/license/assurance.lux +++ b/licentia/source/program/licentia/license/assurance.lux @@ -1,13 +1,13 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}]]]]] + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}]]]]] + [// + ["_" term] [// - ["_" term] - [// - ["$" document]]]) + ["$" document]]]) (def: .public representation ($.sentence (format "Each " _.contributor @@ -17,10 +17,10 @@ " conveyed by " _.license))) (def: .public fair_use - (let [copyright_doctrines (: (List Text) - (list "fair use" - "fair dealing" - "other equivalents"))] + (let [copyright_doctrines (is (List Text) + (list "fair use" + "fair dealing" + "other equivalents"))] ($.sentence (format _.license " is not intended to limit any rights " _.recipient " has under applicable copyright doctrines of " ($.or copyright_doctrines))))) diff --git a/licentia/source/program/licentia/license/definition.lux b/licentia/source/program/licentia/license/definition.lux index d9ddede8b..3d002311c 100644 --- a/licentia/source/program/licentia/license/definition.lux +++ b/licentia/source/program/licentia/license/definition.lux @@ -27,9 +27,9 @@ (def: commercial_services (List Text) - (let [services (: (-> Text Text) - (function (_ type) - (format type " services")))] + (let [services (is (-> Text Text) + (function (_ type) + (format type " services")))] (list (services "hosting") (services "consulting") (services "support")))) @@ -58,10 +58,10 @@ ($.paragraph (list (format "having the right to grant any and all of the rights conveyed by " (the #term license))))] [legal_entity "Legal Entity" - (let [abilities (: (List Text) - (list "to enter into contracts" - "to sue" - "to be sued"))] + (let [abilities (is (List Text) + (list "to enter into contracts" + "to sue" + "to be sued"))] ($.paragraph (list (format "any human or non-human entity that is recognized as having privileges and obligations, such as having the ability " ($.and abilities)))))] [recipient "Recipient" @@ -90,10 +90,10 @@ " and which represents an original " ..covered_work_description)))] [submission "Submission" - (let [forms_of_communication (: (List Text) - (list "electronic" - "verbal" - "written"))] + (let [forms_of_communication (is (List Text) + (list "electronic" + "verbal" + "written"))] ($.paragraph (list (format "any form of " ($.or forms_of_communication) " communication sent to " (the #term licensor) ", or its representatives, for the purpose of discussing and improving " (the #term licensed_work) ", but excluding communication that is designated in writing by the copyright owner as " not_a_contribution_notice))))] @@ -101,31 +101,31 @@ [modification "Modification" (let [alteration "any addition to, or deletion from, the substance or structure of" object "file or other storage" - targets (: (List Text) - (list (format "a " object " contained in " (the #term licensed_work)) - (format "any new " object " that contains any part of " (the #term licensed_work)) - (format "any " object " which replaces or otherwise alters the original functionality of "(the #term licensed_work) " at runtime")))] + targets (is (List Text) + (list (format "a " object " contained in " (the #term licensed_work)) + (format "any new " object " that contains any part of " (the #term licensed_work)) + (format "any " object " which replaces or otherwise alters the original functionality of "(the #term licensed_work) " at runtime")))] ($.paragraph (list (format alteration " " ($.or targets)))))] [required_component "Required Component" - (let [possibilities (: (List Text) - (list "text" - "program" - "script" - "schema" - "interface definition" - "control file" - "other work"))] + (let [possibilities (is (List Text) + (list "text" + "program" + "script" + "schema" + "interface definition" + "control file" + "other work"))] ($.paragraph (list (format "any " ($.or possibilities) " created by " (the #term recipient) " which is required by a third party to successfully install and run a " (the #term derivative_work) " by " (the #term recipient)))))] [extension "Extension" - (let [possibilities (: (List Text) - (list (the #term modification) - (the #term derivative_work) - (the #term required_component)))] + (let [possibilities (is (List Text) + (list (the #term modification) + (the #term derivative_work) + (the #term required_component)))] ($.paragraph (list (format "any " ($.or possibilities)))))] [contribution "Contribution" @@ -144,10 +144,10 @@ ", and subsequently incorporated within " (the #term licensed_work))))] [patent_claim (format "Patent Claim Of A " (the #term contributor)) - (let [claim_types (: (List Text) - (list "method" - "process" - "apparatus"))] + (let [claim_types (is (List Text) + (list "method" + "process" + "apparatus"))] ($.paragraph (list (format "any patent claim(s), including without limitation " ($.and claim_types) " claims, in any patent " (the #term licensable) " by such " (the #term contributor) " that would be infringed, but for the grant of " (the #term license) @@ -165,10 +165,10 @@ ", a product or service whose value derives, entirely or substantially, from the functionality of " (the #term licensed_work))))] [personal_use "Personal Use" - (let [valid_purposes (: (List Text) - (list "personal" - "private" - "non-commercial"))] + (let [valid_purposes (is (List Text) + (list "personal" + "private" + "non-commercial"))] ($.paragraph (list (format "use of " (the #term licensed_work) " by an individual solely for his or her " ($.and valid_purposes) " purposes") (format "An individual's use of " (the #term licensed_work) " in his or her capacity as an " ($.or individual_capacities) " does not qualify"))))] @@ -182,18 +182,18 @@ ($.paragraph (list (format "investigation or experimentation for the purpose of understanding the nature and limits of " (the #term licensed_work) " and its potential uses")))] [deploy "Deploy" - (let [deployment_types (: (List Text) - (list "use" - (the #term serve) - "sublicense" - "distribute")) - sub_licensing (: (-> Text Text) - (function (_ type) - (format type " sublicensing"))) - third_party_interactions (: (List Text) - (list (sub_licensing "direct") - (sub_licensing "indirect") - "distribution")) + (let [deployment_types (is (List Text) + (list "use" + (the #term serve) + "sublicense" + "distribute")) + sub_licensing (is (-> Text Text) + (function (_ type) + (format type " sublicensing"))) + third_party_interactions (is (List Text) + (list (sub_licensing "direct") + (sub_licensing "indirect") + "distribution")) basic_definition (format "to " ($.or deployment_types) " " (the #term licensed_work) " other than for internal " (the #term research) diff --git a/licentia/source/program/licentia/license/distribution.lux b/licentia/source/program/licentia/license/distribution.lux index d64b3ccac..849b7294a 100644 --- a/licentia/source/program/licentia/license/distribution.lux +++ b/licentia/source/program/licentia/license/distribution.lux @@ -13,9 +13,9 @@ (def: notices (List Text) - (let [notices (: (-> Text Text) - (function (_ what) - (format what " notices")))] + (let [notices (is (-> Text Text) + (function (_ what) + (format what " notices")))] (list (notices "copyright") (notices "patent") (notices "trademark") diff --git a/licentia/source/program/licentia/license/extension.lux b/licentia/source/program/licentia/license/extension.lux index 38ad300a3..82a5a0243 100644 --- a/licentia/source/program/licentia/license/extension.lux +++ b/licentia/source/program/licentia/license/extension.lux @@ -1,15 +1,15 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}]]]]] - ["[0]" // {"+" Extension} - ["_" term] - ["[0]" grant] - [time {"+" Months Period}] - [// - ["$" document]]]) + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}]]]]] + ["[0]" // {"+" Extension} + ["_" term] + ["[0]" grant] + [time {"+" Months Period}] + [// + ["$" document]]]) (def: .public sharing_requirement (List Text) @@ -136,20 +136,20 @@ " that " _.recipient " creates, or to which " _.recipient " contributes, to be documented in the " _.source_code_form) - modification_types (: (List Text) - (list "additions" - "changes" - "deletions")) + modification_types (is (List Text) + (list "additions" + "changes" + "deletions")) details (format "clearly describing the " ($.and modification_types) " that " _.recipient " made")] (format basic ", " details)) - on_notice_location (let [statement_locations (: (List Text) - (list (format "in the " _.source_code_form) - (format "in any notice displayed by " _.licensed_work - " " _.recipient - " distributes") - (format "in related documentation in which " _.recipient - " describes the origin or ownership of " _.licensed_work)))] + on_notice_location (let [statement_locations (is (List Text) + (list (format "in the " _.source_code_form) + (format "in any notice displayed by " _.licensed_work + " " _.recipient + " distributes") + (format "in related documentation in which " _.recipient + " describes the origin or ownership of " _.licensed_work)))] (format _.recipient " must include a prominent statement that the " _.modification " is derived, directly or indirectly, from " _.licensed_work diff --git a/licentia/source/program/licentia/license/liability.lux b/licentia/source/program/licentia/license/liability.lux index 6f4c82c6b..b6801b900 100644 --- a/licentia/source/program/licentia/license/liability.lux +++ b/licentia/source/program/licentia/license/liability.lux @@ -1,13 +1,13 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}]]]]] + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}]]]]] + [// + ["_" term] [// - ["_" term] - [// - ["$" document]]]) + ["$" document]]]) (def: warranty_communications (List Text) @@ -115,13 +115,13 @@ on_responsibility (let [but "However, in accepting such obligations" cannot_represent_a_contributor (format _.recipient " may not act on behalf of any other " _.contributor) can_only_represent_oneself (format "only on behalf and on sole responsibility of " _.recipient) - each_contributor (: (-> Text Text) - (function (_ responsibility) - (format responsibility " each " _.contributor))) - responsibilities (: (List Text) - (list (each_contributor "indemnify") - (each_contributor "defend") - (format (each_contributor "hold") " harmless"))) + each_contributor (is (-> Text Text) + (function (_ responsibility) + (format responsibility " each " _.contributor))) + responsibilities (is (List Text) + (list (each_contributor "indemnify") + (each_contributor "defend") + (format (each_contributor "hold") " harmless"))) full_responsibility_condition (format "and only if " _.recipient " agrees to " ($.and responsibilities) " for any liability incurred by, or claims asserted against, such " _.contributor @@ -131,22 +131,22 @@ on_responsibility)))) (def: .public disclaim_high_risk - (let [on_work (let [intentions (: (List Text) - (list "designed" - "manufactured" - "intended for use or distribution")) - hazardous_environments (: (List Text) - (list "nuclear facilities" - "aircraft navigation" - "communications systems" - "air traffic control" - "direct life support machines" - "weapons systems")) - consequences (: (List Text) - (list "death" - "personal injury" - "severe physical damage" - "environmental damage")) + (let [on_work (let [intentions (is (List Text) + (list "designed" + "manufactured" + "intended for use or distribution")) + hazardous_environments (is (List Text) + (list "nuclear facilities" + "aircraft navigation" + "communications systems" + "air traffic control" + "direct life support machines" + "weapons systems")) + consequences (is (List Text) + (list "death" + "personal injury" + "severe physical damage" + "environmental damage")) disclaim (format _.licensed_work " is not fault tolerant" ", and is not " ($.or intentions) " as on-line control equipment in hazardous environments requiring fail-safe performance") diff --git a/licentia/source/program/licentia/license/limitation.lux b/licentia/source/program/licentia/license/limitation.lux index 005a46601..cc8ff460c 100644 --- a/licentia/source/program/licentia/license/limitation.lux +++ b/licentia/source/program/licentia/license/limitation.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}]]]]] + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}]]]]] + [// + ["_" term] [// - ["_" term] - [// - ["$" document]]]) + ["$" document]]]) (def: .public acceptance - (let [abilities (: (List Text) - (list "use" - "copy" - "distribute" - "modify" - (format "create an " _.extension - " of either " _.licensed_work - " or any " _.extension - " created by a " _.contributor))) + (let [abilities (is (List Text) + (list "use" + "copy" + "distribute" + "modify" + (format "create an " _.extension + " of either " _.licensed_work + " or any " _.extension + " created by a " _.contributor))) acknowledgement (format _.recipient " is not required to accept " _.license " since " _.recipient diff --git a/licentia/source/program/licentia/license/miscellaneous.lux b/licentia/source/program/licentia/license/miscellaneous.lux index 94f194f84..329d5ce9d 100644 --- a/licentia/source/program/licentia/license/miscellaneous.lux +++ b/licentia/source/program/licentia/license/miscellaneous.lux @@ -1,28 +1,28 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}]]]]] + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}]]]]] + [// + ["_" term] [// - ["_" term] - [// - ["$" document]]]) + ["$" document]]]) (def: .public entire_agreement ($.paragraph (list (format _.license " constitutes the entire agreement between the parties with respect to the subject matter hereof")))) (def: .public relationship_of_parties - (let [legal_associations (: (List Text) - (list "an agency" - "a partnership" - "a joint venture" - "any other form of legal association")) - forms_of_representation (: (List Text) - (list "expressly" - "by implication" - "by appearance" - "otherwise")) + (let [legal_associations (is (List Text) + (list "an agency" + "a partnership" + "a joint venture" + "any other form of legal association")) + forms_of_representation (is (List Text) + (list "expressly" + "by implication" + "by appearance" + "otherwise")) disclaimer (format _.license " will not be construed as creating " ($.or legal_associations)) scope (format "between or among " _.recipient ", " _.licensor @@ -32,14 +32,14 @@ ($.paragraph (list (format disclaimer " " scope ", and " constraint))))) (def: .public independent_development - (let [actions (: (List Text) - (list "acquire" - "license" - "develop" - "subcontract" - "market" - "distribute" - "produce")) + (let [actions (is (List Text) + (list "acquire" + "license" + "develop" + "subcontract" + "market" + "distribute" + "produce")) scope (format "Nothing in " _.license) effect (format "impair the right of " _.licensor) target "technology or products" @@ -71,11 +71,11 @@ (def: .public export_restrictions (let [limiter "applicable laws and regulations" - limited (: (List Text) - (list "downloading" - "acquiring" - "exporting" - "reexporting")) + limited (is (List Text) + (list "downloading" + "acquiring" + "exporting" + "reexporting")) on_circumstances (let [limitation (format _.recipient " may be restricted with respect to " ($.or limited)) target (format _.licensed_work " or any underlying information or technology")] diff --git a/licentia/source/test/licentia.lux b/licentia/source/test/licentia.lux index e721d58f1..c753cd555 100644 --- a/licentia/source/test/licentia.lux +++ b/licentia/source/test/licentia.lux @@ -288,9 +288,9 @@ (do random.monad [license ..license #let [writ (output.license license) - present? (: (-> Text Bit) - (function (_ snippet) - (text.contains? snippet writ)))]] + present? (is (-> Text Bit) + (function (_ snippet) + (text.contains? snippet writ)))]] ($_ _.and (_.test "Copyright notices are present." (list.every? (|>> notice.copyright_holder present?) diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux index c64c0f97b..5e01060b3 100644 --- a/lux-cl/source/program.lux +++ b/lux-cl/source/program.lux @@ -169,47 +169,47 @@ (def: (host_value value) (-> Any org/armedbear/lisp/LispObject) - (let [to_sub (: (-> Any org/armedbear/lisp/LispObject) - (function (_ sub_value) - (let [sub_value (:as java/lang/Object sub_value)] - (`` (<| (~~ (template [<type> <then>] - [(case (ffi.check <type> sub_value) - {.#Some sub_value} - (`` (|> sub_value (~~ (template.splice <then>)))) - - {.#None})] - - [[java/lang/Object] [host_value]] - [java/lang/Boolean [..host_bit]] - [java/lang/Integer [java/lang/Integer::longValue org/armedbear/lisp/Fixnum::getInstance]] - [java/lang/Long [org/armedbear/lisp/Bignum::getInstance]] - [java/lang/Double [org/armedbear/lisp/DoubleFloat::new]] - [java/lang/String [org/armedbear/lisp/SimpleString::new]] - )) - ... else - (:as org/armedbear/lisp/LispObject sub_value))))))] + (let [to_sub (is (-> Any org/armedbear/lisp/LispObject) + (function (_ sub_value) + (let [sub_value (as java/lang/Object sub_value)] + (`` (<| (~~ (template [<type> <then>] + [(case (ffi.check <type> sub_value) + {.#Some sub_value} + (`` (|> sub_value (~~ (template.splice <then>)))) + + {.#None})] + + [[java/lang/Object] [host_value]] + [java/lang/Boolean [..host_bit]] + [java/lang/Integer [java/lang/Integer::longValue org/armedbear/lisp/Fixnum::getInstance]] + [java/lang/Long [org/armedbear/lisp/Bignum::getInstance]] + [java/lang/Double [org/armedbear/lisp/DoubleFloat::new]] + [java/lang/String [org/armedbear/lisp/SimpleString::new]] + )) + ... else + (as org/armedbear/lisp/LispObject sub_value))))))] (`` (ffi.object [] org/armedbear/lisp/LispObject [program/LuxADT] [] ... Methods (program/LuxADT [] (getValue self []) java/lang/Object - (:as java/lang/Object value)) + (as java/lang/Object value)) (org/armedbear/lisp/LispObject [] (length self []) int (|> value - (:as (Array java/lang/Object)) + (as (Array java/lang/Object)) array.size - (:as java/lang/Long) + (as java/lang/Long) java/lang/Number::intValue)) (~~ (template [<name>] [(org/armedbear/lisp/LispObject [] (<name> self [idx int]) org/armedbear/lisp/LispObject - (case (array.read! (|> idx java/lang/Integer::longValue (:as Nat)) - (:as (Array java/lang/Object) value)) + (case (array.read! (|> idx java/lang/Integer::longValue (as Nat)) + (as (Array java/lang/Object) value)) {.#Some sub} (to_sub sub) @@ -228,20 +228,20 @@ (do try.monad [tag (read (org/armedbear/lisp/LispObject::NTH +0 host_object)) value (read (org/armedbear/lisp/LispObject::NTH +2 host_object))] - (wrap [(java/lang/Long::intValue (:as java/lang/Long tag)) + (wrap [(java/lang/Long::intValue (as java/lang/Long tag)) (case (ffi.check org/armedbear/lisp/Nil (org/armedbear/lisp/LispObject::NTH +1 host_object)) {.#Some _} - (: Any (ffi.null)) + (is Any (ffi.null)) _ - (: Any synthesis.unit)) + (is Any synthesis.unit)) value]))) (def: (read_tuple read host_object) (-> (Reader org/armedbear/lisp/LispObject) (Reader org/armedbear/lisp/SimpleVector)) (let [size (.nat (org/armedbear/lisp/LispObject::length host_object))] (loop [idx 0 - output (:as (Array Any) (array.new size))] + output (as (Array Any) (array.new size))] (if (n.< size idx) ... TODO: Start using "SVREF" instead of "elt" ASAP (case (read (org/armedbear/lisp/LispObject::elt (.int idx) host_object)) @@ -249,7 +249,7 @@ {try.#Failure error} {try.#Success member} - (again (++ idx) (array.write! idx (:as Any member) output))) + (again (++ idx) (array.write! idx (as Any member) output))) {try.#Success output})))) (def: (read host_object) @@ -274,23 +274,23 @@ {.#Some host_object} (if (same? (org/armedbear/lisp/Symbol::T) host_object) {try.#Success true} - (exception.throw ..unknown_kind_of_object (:as java/lang/Object host_object))) + (exception.throw ..unknown_kind_of_object (as java/lang/Object host_object))) {.#None}) ... else - (exception.throw ..unknown_kind_of_object (:as java/lang/Object host_object)) + (exception.throw ..unknown_kind_of_object (as java/lang/Object host_object)) ))) (def: ensure_macro (-> Macro (Maybe org/armedbear/lisp/Closure)) - (|>> (:as java/lang/Object) (ffi.check org/armedbear/lisp/Closure))) + (|>> (as java/lang/Object) (ffi.check org/armedbear/lisp/Closure))) (def: (call_macro inputs lux macro) (-> (List Code) Lux org/armedbear/lisp/Closure (Try (Try [Lux (List Code)]))) (do try.monad [raw_output (org/armedbear/lisp/LispObject::execute (..host_value inputs) (..host_value lux) macro)] - (:as (Try (Try [Lux (List Code)])) - (..read raw_output)))) + (as (Try (Try [Lux (List Code)])) + (..read raw_output)))) (def: (expander macro inputs lux) Expander @@ -299,45 +299,45 @@ (call_macro inputs lux macro) {.#None} - (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro)))) + (exception.throw ..cannot_apply_a_non_function (as java/lang/Object macro)))) (def: host (IO (Host (_.Expression Any) (_.Expression Any))) (io (let [_ (org/armedbear/lisp/Interpreter::createInstance) interpreter (org/armedbear/lisp/Interpreter::getInstance) - run! (: (-> (_.Code Any) (Try Any)) - (function (_ code) - (do try.monad - [host_value (org/armedbear/lisp/Interpreter::eval (_.code code) interpreter)] - (read host_value))))] - (: (Host (_.Expression Any) (_.Expression Any)) - (structure - (def: (evaluate! context code) - (run! code)) - - (def: (execute! input) - (org/armedbear/lisp/Interpreter::eval (_.code input) interpreter)) - - (def: (define! context input) - (let [global (reference.artifact context) - @global (_.var global)] - (do try.monad - [#let [definition (_.defparameter @global input)] - _ (org/armedbear/lisp/Interpreter::eval (_.code definition) interpreter) - value (run! @global)] - (wrap [global value definition])))) - - (def: (ingest context content) - (|> content (# encoding.utf8 decoded) try.trusted (:as (_.Expression Any)))) - - (def: (re_learn context content) - (run! content)) - - (def: (re_load context content) - (do try.monad - [_ (run! content)] - (run! (_.var (reference.artifact context))))) - ))))) + run! (is (-> (_.Code Any) (Try Any)) + (function (_ code) + (do try.monad + [host_value (org/armedbear/lisp/Interpreter::eval (_.code code) interpreter)] + (read host_value))))] + (is (Host (_.Expression Any) (_.Expression Any)) + (structure + (def: (evaluate! context code) + (run! code)) + + (def: (execute! input) + (org/armedbear/lisp/Interpreter::eval (_.code input) interpreter)) + + (def: (define! context input) + (let [global (reference.artifact context) + @global (_.var global)] + (do try.monad + [#let [definition (_.defparameter @global input)] + _ (org/armedbear/lisp/Interpreter::eval (_.code definition) interpreter) + value (run! @global)] + (wrap [global value definition])))) + + (def: (ingest context content) + (|> content (# encoding.utf8 decoded) try.trusted (as (_.Expression Any)))) + + (def: (re_learn context content) + (run! content)) + + (def: (re_load context content) + (do try.monad + [_ (run! content)] + (run! (_.var (reference.artifact context))))) + ))))) (def: platform (IO (Platform [_.Tag Register] (_.Expression Any) (_.Expression Any))) @@ -374,17 +374,17 @@ (def: extender Extender ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (exec ("lux io log" "TODO: Extender") {try.#Failure "TODO: Extender"}))) @@ -392,7 +392,7 @@ @.common_lisp (def: (extender handler) Extender - (:expected handler))) + (as_expected handler))) (def: (declare_success! _) (-> Any (Promise Any)) diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 7a27e7172..5e7cdd72f 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -166,32 +166,32 @@ (def: (js_int value) (-> Int org/openjdk/nashorn/api/scripting/JSObject) - (<| (ffi.:as org/openjdk/nashorn/api/scripting/JSObject) + (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject) (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [IntValue] [] ... Methods (IntValue [] (getValue self []) java/lang/Object - (ffi.:as java/lang/Object (ffi.as_long value))) + (ffi.as java/lang/Object (ffi.as_long value))) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (getMember self [member java/lang/String]) java/lang/Object (case (ffi.of_string member) (pattern (static runtime.i64_high_field)) (|> value .nat runtime.high jvm_int - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) (pattern (static runtime.i64_low_field)) (|> value .nat runtime.low jvm_int - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) _ (panic! (exception.error ..unknown_member [(ffi.of_string member) - (ffi.:as java/lang/Object (ffi.as_long value))])))) + (ffi.as java/lang/Object (ffi.as_long value))])))) ))) (def: (::toString js_object) (-> Any org/openjdk/nashorn/api/scripting/JSObject) - (<| (ffi.:as org/openjdk/nashorn/api/scripting/JSObject) + (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject) (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [] [] (org/openjdk/nashorn/api/scripting/AbstractJSObject @@ -204,12 +204,12 @@ (|> js_object debug.inspection ffi.as_string - (ffi.:as java/lang/Object))) + (ffi.as java/lang/Object))) ))) (def: (::slice js_object value) (-> (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject) (Array java/lang/Object) org/openjdk/nashorn/api/scripting/JSObject) - (<| (ffi.:as org/openjdk/nashorn/api/scripting/JSObject) + (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject) (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [] [] (org/openjdk/nashorn/api/scripting/AbstractJSObject @@ -223,37 +223,37 @@ (|> args (array.read! 0) maybe.trusted - (:as Int) + (as Int) ffi.as_int) (ffi.as_int (.int (array.size value)))) - (:as java/lang/Object) + (as java/lang/Object) js_object - (ffi.:as java/lang/Object))) + (ffi.as java/lang/Object))) ))) (def: (js_structure value) (-> (Array java/lang/Object) org/openjdk/nashorn/api/scripting/JSObject) - (let [js_object (: (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject) - (function (_ sub_value) - (<| (case (ffi.check [java/lang/Object] sub_value) - {.#Some sub_value} - (|> sub_value (:as (Array java/lang/Object)) js_structure) - - {.#None}) - (case (ffi.check java/lang/Long sub_value) - {.#Some sub_value} - (|> sub_value ffi.of_long js_int) - - {.#None}) - ... else - (:as org/openjdk/nashorn/api/scripting/JSObject sub_value))))] - (<| (ffi.:as org/openjdk/nashorn/api/scripting/JSObject) + (let [js_object (is (-> java/lang/Object org/openjdk/nashorn/api/scripting/JSObject) + (function (_ sub_value) + (<| (case (ffi.check [java/lang/Object] sub_value) + {.#Some sub_value} + (|> sub_value (as (Array java/lang/Object)) js_structure) + + {.#None}) + (case (ffi.check java/lang/Long sub_value) + {.#Some sub_value} + (|> sub_value ffi.of_long js_int) + + {.#None}) + ... else + (as org/openjdk/nashorn/api/scripting/JSObject sub_value))))] + (<| (ffi.as org/openjdk/nashorn/api/scripting/JSObject) (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [StructureValue] [] ... Methods (StructureValue [] (getValue self []) java/lang/Object - (ffi.:as java/lang/Object value)) + (ffi.as java/lang/Object value)) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (isArray self []) boolean (ffi.as_boolean #1)) @@ -263,17 +263,17 @@ (case (ffi.of_string member) (^.or "toJSON" "toString") (|> (::toString value) - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) "length" (|> value array.size jvm_int - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) "slice" (|> (::slice js_object value) - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) (pattern (static runtime.variant_tag_field)) (|> value @@ -293,18 +293,18 @@ (array.read! 2) maybe.trusted js_object - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) _ - (panic! (exception.error ..unknown_member [(:as Text member) (:as java/lang/Object value)]))) + (panic! (exception.error ..unknown_member [(as Text member) (as java/lang/Object value)]))) ) (org/openjdk/nashorn/api/scripting/AbstractJSObject [] (getSlot self [idx int]) java/lang/Object (|> value - (array.read! (|> idx java/lang/Integer::longValue (:as Nat))) + (array.read! (|> idx java/lang/Integer::longValue (as Nat))) maybe.trusted js_object - (:as java/lang/Object))) + (as java/lang/Object))) )))) (exception: undefined_has_no_lux_representation) @@ -355,7 +355,7 @@ (^.multi [{.#Some tag} ?flag {.#Some value}] [[(ffi.check java/lang/Number tag) (lux_object value)] [{.#Some tag} {try.#Success value}]]) - {.#Some [(java/lang/Number::intValue (:as java/lang/Number tag)) + {.#Some [(java/lang/Number::intValue (as java/lang/Number tag)) (maybe.else (ffi.null) ?flag) value]} @@ -369,8 +369,8 @@ (if (ffi.of_boolean (org/openjdk/nashorn/api/scripting/JSObject::isArray js_object)) (let [num_keys (.nat (ffi.of_int (org/openjdk/nashorn/api/scripting/ScriptObjectMirror::size js_object)))] (loop [idx 0 - output (: (Array java/lang/Object) - (array.empty num_keys))] + output (is (Array java/lang/Object) + (array.empty num_keys))] (if (n.< num_keys idx) (case (org/openjdk/nashorn/api/scripting/JSObject::getMember (ffi.as_string (%.nat idx)) js_object) {.#Some member} @@ -381,7 +381,7 @@ {.#None} (case (lux_object member) {try.#Success parsed_member} - (again (++ idx) (array.write! idx (:as java/lang/Object parsed_member) output)) + (again (++ idx) (array.write! idx (as java/lang/Object parsed_member) output)) {try.#Failure error} {.#None})) @@ -437,12 +437,12 @@ {.#None} (if (ffi.of_boolean (org/openjdk/nashorn/api/scripting/JSObject::isFunction js_object)) {try.#Success js_object} - ... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) + ... (exception.except ..unknown_kind_of_host_object [(as java/lang/Object js_object)]) {try.#Success js_object} )))) {.#None}) ... else - ... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) + ... (exception.except ..unknown_kind_of_host_object [(as java/lang/Object js_object)]) {try.#Success js_object} ))) @@ -450,7 +450,7 @@ (-> Any (Maybe org/openjdk/nashorn/api/scripting/JSObject)) (do maybe.monad [function (|> function - (:as java/lang/Object) + (as java/lang/Object) (ffi.check org/openjdk/nashorn/api/scripting/JSObject))] (if (ffi.of_boolean (org/openjdk/nashorn/api/scripting/JSObject::isFunction function)) {.#Some function} @@ -463,12 +463,12 @@ (for @.jvm (as_is (def: (call_macro inputs lux macro) (-> (List Code) Lux org/openjdk/nashorn/api/scripting/JSObject (Try (Try [Lux (List Code)]))) - (let [to_js (: (-> Any java/lang/Object) - (|>> (:as (Array java/lang/Object)) js_structure (:as java/lang/Object)))] - (<| (:as (Try (Try [Lux (List Code)]))) + (let [to_js (is (-> Any java/lang/Object) + (|>> (as (Array java/lang/Object)) js_structure (as java/lang/Object)))] + (<| (as (Try (Try [Lux (List Code)]))) (org/openjdk/nashorn/api/scripting/JSObject::call {.#None} (|> (array.empty 2) - (: (Array java/lang/Object)) + (is (Array java/lang/Object)) (array.write! 0 (to_js inputs)) (array.write! 1 (to_js lux))) macro)))) @@ -484,21 +484,21 @@ (case (call_macro inputs lux macro) {try.#Success output} (|> output - (:as java/lang/Object) + (as java/lang/Object) lux_object - (:as (Try (Try [Lux (List Code)])))) + (as (Try (Try [Lux (List Code)])))) {try.#Failure error} {try.#Failure error}) {.#None} - (exception.except ..cannot_apply_a_non_function (:as java/lang/Object macro)))) + (exception.except ..cannot_apply_a_non_function (as java/lang/Object macro)))) ) @.js (def: (expander macro inputs lux) Expander - {try.#Success ((:as Macro' macro) inputs lux)}) + {try.#Success ((as Macro' macro) inputs lux)}) ) (for @.jvm @@ -534,22 +534,22 @@ (IO (Host _.Expression _.Statement)) (io (let [interpreter (javax/script/ScriptEngineFactory::getScriptEngine (org/openjdk/nashorn/api/scripting/NashornScriptEngineFactory::new))] - (: (Host _.Expression _.Statement) - (implementation - (def: (evaluate alias [_ input]) (..evaluate! interpreter alias input)) - (def: execute (..execute! interpreter)) - (def: (define context custom [_ input]) (..define! interpreter context custom input)) + (is (Host _.Expression _.Statement) + (implementation + (def: (evaluate alias [_ input]) (..evaluate! interpreter alias input)) + (def: execute (..execute! interpreter)) + (def: (define context custom [_ input]) (..define! interpreter context custom input)) - (def: (ingest context content) - (|> content (# utf8.codec decoded) try.trusted (:as _.Statement))) + (def: (ingest context content) + (|> content (# utf8.codec decoded) try.trusted (as _.Statement))) - (def: (re_learn context custom content) - (..execute! interpreter content)) - - (def: (re_load context custom content) - (do try.monad - [_ (..execute! interpreter content)] - (..evaluate! interpreter context (_.var (reference.artifact context)))))))))) + (def: (re_learn context custom content) + (..execute! interpreter content)) + + (def: (re_load context custom content) + (do try.monad + [_ (..execute! interpreter content)] + (..evaluate! interpreter context (_.var (reference.artifact context)))))))))) ) @.js @@ -593,39 +593,39 @@ (def: host (IO (Host _.Expression _.Statement)) - (io (: (Host _.Expression _.Statement) - (implementation - (def: (evaluate alias [_ input]) (..evaluate! alias input)) - (def: execute ..execute!) - (def: (define context custom [_ input]) (..define! context custom input)) - - (def: (ingest context content) - (|> content (# utf8.codec decoded) try.trusted (:as _.Statement))) - - (def: (re_learn context custom content) - (..execute! content)) - - (def: (re_load context custom content) - (do try.monad - [_ (..execute! content)] - (..evaluate! context (_.var (reference.artifact context))))))))) + (io (is (Host _.Expression _.Statement) + (implementation + (def: (evaluate alias [_ input]) (..evaluate! alias input)) + (def: execute ..execute!) + (def: (define context custom [_ input]) (..define! context custom input)) + + (def: (ingest context content) + (|> content (# utf8.codec decoded) try.trusted (as _.Statement))) + + (def: (re_learn context custom content) + (..execute! content)) + + (def: (re_load context custom content) + (do try.monad + [_ (..execute! content)] + (..evaluate! context (_.var (reference.artifact context))))))))) )) (def: (phase_wrapper archive) (-> Archive (runtime.Operation phase.Wrapper)) (do phase.monad [] - (in (:as phase.Wrapper - (for @.jvm - ... The implementation for @.jvm is technically incorrect. - ... However, the JS compiler runs fast enough on Node to be fully hosted there. - ... And running the JS compiler on the JVM (on top of Nashorn) is impractically slow. - ... This means that in practice, only the @.js implementation matters. - ... And since no cross-language boundary needs to be handled, it's a correct implementation. - (|>>) - - @.js - (|>>)))))) + (in (as phase.Wrapper + (for @.jvm + ... The implementation for @.jvm is technically incorrect. + ... However, the JS compiler runs fast enough on Node to be fully hosted there. + ... And running the JS compiler on the JVM (on top of Nashorn) is impractically slow. + ... This means that in practice, only the @.js implementation matters. + ... And since no cross-language boundary needs to be handled, it's a correct implementation. + (|>>) + + @.js + (|>>)))))) (def: platform (IO (Platform [Register Text] _.Expression _.Statement)) @@ -663,36 +663,36 @@ (def: (extender phase_wrapper) (-> phase.Wrapper Extender) ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (do try.monad [handler (try.of_maybe (..ensure_function handler)) - .let [to_js (: (-> Any java/lang/Object) - (|>> (:as (Array java/lang/Object)) js_structure (:as java/lang/Object)))] + .let [to_js (is (-> Any java/lang/Object) + (|>> (as (Array java/lang/Object)) js_structure (as java/lang/Object)))] output (org/openjdk/nashorn/api/scripting/JSObject::call {.#None} (|> (array.empty 5) - (: (Array java/lang/Object)) + (is (Array java/lang/Object)) (array.write! 0 name) - (array.write! 1 (:as java/lang/Object (extender phase))) + (array.write! 1 (as java/lang/Object (extender phase))) (array.write! 2 (to_js archive)) (array.write! 3 (to_js parameters)) (array.write! 4 (to_js state))) handler)] - (lux_object (:as java/lang/Object output))))) + (lux_object (as java/lang/Object output))))) @.js (def: (extender phase_wrapper handler) (-> phase.Wrapper Extender) - (:expected handler))) + (as_expected handler))) (def: (declare_success! _) (-> Any (Async Any)) diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index f125192f5..ff0e5cecf 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -559,7 +559,7 @@ (-> jvm.Extender Any jvm.Handler) (function (_ extension_name phase archive inputs) (# phase.monad each - (|>> (:as (/.Bytecode Inst /.Label)) ..bytecode) + (|>> (as (/.Bytecode Inst /.Label)) ..bytecode) ((extender pseudo) extension_name phase archive inputs)))) (type: Phase (directive.Phase jvm.Anchor jvm.Inst jvm.Definition)) @@ -573,13 +573,13 @@ (pattern (list nameC valueC)) (do phase.monad [[_ _ name] (lux/.evaluate! archive Text nameC) - [_ handlerV] (lux/.generator archive (:as Text name) ..Handler' valueC) + [_ handlerV] (lux/.generator archive (as Text name) ..Handler' valueC) _ (|> handlerV (..true_handler extender) - (extension.install extender (:as Text name)) + (extension.install extender (as Text name)) directive.lifted_generation) _ (directive.lifted_generation - (generation.log! (format "Generation " (%.text (:as Text name)))))] + (generation.log! (format "Generation " (%.text (as Text name)))))] (in directive.no_requirements)) _ @@ -758,10 +758,10 @@ (def: constructor (Parser (Constructor Code)) - (let [constructor_argument (: (Parser [(Type Value) Code]) - (<code>.tuple - (<>.and ..value - <code>.any)))] + (let [constructor_argument (is (Parser [(Type Value) Code]) + (<code>.tuple + (<>.and ..value + <code>.any)))] (<| <code>.form (<>.after (<code>.text! "init")) ($_ <>.and @@ -1311,10 +1311,10 @@ /type.void (list)]) argumentsT (list#each product.right arguments) - initialize_object! (: Inst - (|>> (_.ALOAD 0) - super_constructor_argument_values - (_.INVOKESPECIAL super_class ..constructor_name super_constructorT)))]] + initialize_object! (is Inst + (|>> (_.ALOAD 0) + super_constructor_argument_values + (_.INVOKESPECIAL super_class ..constructor_name super_constructorT)))]] (in (def.method (..visibility privacy) (if strict_floating_point? jvm.strictM @@ -1459,8 +1459,8 @@ ... Necessary for reflection to work properly during analysis. _ (directive.lifted_generation (generation.execute! header)) - .let [supers (: (List (Type Class)) - (list& super_class super_interfaces))] + .let [supers (is (List (Type Class)) + (list& super_class super_interfaces))] _ (|> methodsC (list.all ..convert_overriden_method) (//A.require_complete_method_concretion class_loader supers) diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 99ff673b6..b9ec15962 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -141,7 +141,7 @@ (# io.monad each (function (_ library) (dictionary.key? library class_name))) (try.lifted io.monad) - (: (IO (Try Bit)))) + (is (IO (Try Bit)))) _ (if existing_class? (in []) (loader.store class_name class_bytecode library))] @@ -160,33 +160,33 @@ (io (let [library (loader.new_library []) loader (loader.memory library)] [loader - (: Host - (implementation - (def: (evaluate context valueI) - (# try.monad each product.left - (..evaluate! library loader (format "E" (..class_name context)) valueI))) - - (def: execute - (..execute! library loader)) - - (def: define - (..define! library loader)) - - (def: (ingest context bytecode) - [(..class_name context) bytecode]) - - (def: (re_learn context custom [_ bytecode]) - (io.run! - (loader.store (maybe.else (..class_name context) custom) bytecode library))) - - (def: (re_load context custom [directive_name bytecode]) - (io.run! - (do (try.with io.monad) - [.let [class_name (maybe.else (..class_name context) - custom)] - _ (loader.store class_name bytecode library) - class (loader.load class_name loader)] - (# io.monad in (..class_value class_name class)))))))]))) + (is Host + (implementation + (def: (evaluate context valueI) + (# try.monad each product.left + (..evaluate! library loader (format "E" (..class_name context)) valueI))) + + (def: execute + (..execute! library loader)) + + (def: define + (..define! library loader)) + + (def: (ingest context bytecode) + [(..class_name context) bytecode]) + + (def: (re_learn context custom [_ bytecode]) + (io.run! + (loader.store (maybe.else (..class_name context) custom) bytecode library))) + + (def: (re_load context custom [directive_name bytecode]) + (io.run! + (do (try.with io.monad) + [.let [class_name (maybe.else (..class_name context) + custom)] + _ (loader.store class_name bytecode library) + class (loader.load class_name loader)] + (# io.monad in (..class_value class_name class)))))))]))) (def: .public $Variant (type.array ..$Value)) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index 8e90b4510..cb5004f83 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -133,22 +133,22 @@ (^.template [<tag> <unwrap> <dup> <pop> <test> <comparison> <if>] [{<tag> cons} (do [@ phase.monad] - [forkG (: (Operation Inst) - (monad.mix @ (function (_ [test thenP] elseG) - (do @ - [thenG (path' stack_depth @else @end phase archive thenP)] - (in (<| _.with_label (function (_ @else)) - (|>> <dup> - (<test> test) - <comparison> - (<if> @else) - <pop> - thenG - (_.label @else) - elseG))))) - (|>> <pop> - (_.GOTO @else)) - {.#Item cons}))] + [forkG (is (Operation Inst) + (monad.mix @ (function (_ [test thenP] elseG) + (do @ + [thenG (path' stack_depth @else @end phase archive thenP)] + (in (<| _.with_label (function (_ @else)) + (|>> <dup> + (<test> test) + <comparison> + (<if> @else) + <pop> + thenG + (_.label @else) + elseG))))) + (|>> <pop> + (_.GOTO @else)) + {.#Item cons}))] (in (|>> peekI <unwrap> forkG)))]) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux index 20f3fdf7a..10fe4e948 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -1,45 +1,45 @@ (.using - [library - [lux {"-" Type Label} - [ffi {"+" import:}] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" try] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - ["[0]" product] - [collection - ["[0]" list ("[1]@[0]" monad)] - ["[0]" dictionary]]] - [math - [number - ["f" frac]]] - [target - [jvm - ["[0]" type]]] - [tool - [compiler - ["[0]" phase] - [meta - [archive {"+" Archive}]] - [language - [lux - ["[0]" synthesis {"+" Synthesis %synthesis}] - [phase - [generation - [extension {"+" Nullary Unary Binary Trinary Variadic - nullary unary binary trinary variadic}]] - ["[0]" extension - ["[0]" bundle]]]]]]]]] - [luxc - [lang - [host - ["$" jvm {"+" Label Inst Def Handler Bundle Operation Phase} - ["_" inst]]]]] - ["[0]" /// - ["[0]" runtime]]) + [library + [lux {"-" Type Label} + [ffi {"+" import:}] + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" try] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + ["[0]" product] + [collection + ["[0]" list ("[1]@[0]" monad)] + ["[0]" dictionary]]] + [math + [number + ["f" frac]]] + [target + [jvm + ["[0]" type]]] + [tool + [compiler + ["[0]" phase] + [meta + [archive {"+" Archive}]] + [language + [lux + ["[0]" synthesis {"+" Synthesis %synthesis}] + [phase + [generation + [extension {"+" Nullary Unary Binary Trinary Variadic + nullary unary binary trinary variadic}]] + ["[0]" extension + ["[0]" bundle]]]]]]]]] + [luxc + [lang + [host + ["$" jvm {"+" Label Inst Def Handler Bundle Operation Phase} + ["_" inst]]]]] + ["[0]" /// + ["[0]" runtime]]) (def: .public (custom [parser handler]) (All (_ s) @@ -93,19 +93,19 @@ (do [@ phase.monad] [inputG (phase archive input) elseG (phase archive else) - conditionalsG+ (: (Operation (List [(List [Int Label]) - Inst])) - (monad.each @ (function (_ [chars branch]) - (do @ - [branchG (phase archive branch)] - (in (<| _.with_label (function (_ @branch)) - [(list@each (function (_ char) - [(.int char) @branch]) - chars) - (|>> (_.label @branch) - branchG - (_.GOTO @end))])))) - conditionals)) + conditionalsG+ (is (Operation (List [(List [Int Label]) + Inst])) + (monad.each @ (function (_ [chars branch]) + (do @ + [branchG (phase archive branch)] + (in (<| _.with_label (function (_ @branch)) + [(list@each (function (_ char) + [(.int char) @branch]) + chars) + (|>> (_.label @branch) + branchG + (_.GOTO @end))])))) + conditionals)) .let [table (|> conditionalsG+ (list@each product.left) list@conjoint) @@ -291,7 +291,7 @@ (def: bundle::lux Bundle - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "syntax char case!" lux::syntax_char_case!) (bundle.install "is" (binary lux::is)) (bundle.install "try" (unary lux::try)))) @@ -299,7 +299,7 @@ (def: bundle::i64 Bundle (<| (bundle.prefix "i64") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "and" (binary i64::and)) (bundle.install "or" (binary i64::or)) (bundle.install "xor" (binary i64::xor)) @@ -318,7 +318,7 @@ (def: bundle::f64 Bundle (<| (bundle.prefix "f64") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary f64::+)) (bundle.install "-" (binary f64::-)) (bundle.install "*" (binary f64::*)) @@ -333,7 +333,7 @@ (def: bundle::text Bundle (<| (bundle.prefix "text") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "=" (binary text::=)) (bundle.install "<" (binary text::<)) (bundle.install "concat" (binary text::concat)) @@ -345,7 +345,7 @@ (def: bundle::io Bundle (<| (bundle.prefix "io") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "log" (unary io::log)) (bundle.install "error" (unary io::error))))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux index f98188196..820e230db 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -164,7 +164,7 @@ (def: conversion_bundle Bundle (<| (bundle.prefix "conversion") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "double-to-float" (unary conversion::double_to_float)) (bundle.install "double-to-int" (unary conversion::double_to_int)) (bundle.install "double-to-long" (unary conversion::double_to_long)) @@ -295,7 +295,7 @@ (def: int_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.int)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary int::+)) (bundle.install "-" (binary int::-)) (bundle.install "*" (binary int::*)) @@ -314,7 +314,7 @@ (def: long_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.long)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary long::+)) (bundle.install "-" (binary long::-)) (bundle.install "*" (binary long::*)) @@ -333,7 +333,7 @@ (def: float_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.float)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary float::+)) (bundle.install "-" (binary float::-)) (bundle.install "*" (binary float::*)) @@ -346,7 +346,7 @@ (def: double_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.double)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "+" (binary double::+)) (bundle.install "-" (binary double::-)) (bundle.install "*" (binary double::*)) @@ -359,7 +359,7 @@ (def: char_bundle Bundle (<| (bundle.prefix (reflection.reflection reflection.char)) - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "=" (binary char::=)) (bundle.install "<" (binary char::<)) ))) @@ -615,7 +615,7 @@ (def: object_bundle Bundle (<| (bundle.prefix "object") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "null" (nullary object::null)) (bundle.install "null?" (unary object::null?)) (bundle.install "synchronized" (binary object::synchronized)) @@ -794,17 +794,17 @@ (def: member_bundle Bundle (<| (bundle.prefix "member") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (dictionary.merged (<| (bundle.prefix "get") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "static" get::static) (bundle.install "virtual" get::virtual)))) (dictionary.merged (<| (bundle.prefix "put") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "static" put::static) (bundle.install "virtual" put::virtual)))) (dictionary.merged (<| (bundle.prefix "invoke") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "static" invoke::static) (bundle.install "virtual" invoke::virtual) (bundle.install "special" invoke::special) @@ -834,7 +834,7 @@ hidden [_ {synthesis.#Control {synthesis.#Branch {synthesis.#Case _ path}}}] - (loop [path (: synthesis.Path path)] + (loop [path (is synthesis.Path path)] (case path (^.or {synthesis.#Pop} {synthesis.#Access _} @@ -1088,7 +1088,7 @@ (list#mix (function (_ [lux_register type] [jvm_register before]) (let [[jvm_register' after] (prepare_argument (n.+ offset lux_register) type jvm_register)] [jvm_register' (|>> before after)])) - (: [Register Inst] [offset (|>>)])) + (is [Register Inst] [offset (|>>)])) product.right)) (def: .public (returnI returnT) @@ -1228,7 +1228,7 @@ (def: class_bundle Bundle (<| (bundle.prefix "class") - (|> (: Bundle bundle.empty) + (|> (is Bundle bundle.empty) (bundle.install "anonymous" class::anonymous) ))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index 92ca0e16c..f93f4d035 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -173,8 +173,8 @@ (def: (with_init class env arity) (-> (Type Class) (Environment Synthesis) Arity Def) (let [env_size (list.size env) - offset_partial (: (-> Nat Nat) - (|>> ++ (n.+ env_size))) + offset_partial (is (-> Nat Nat) + (|>> ++ (n.+ env_size))) store_capturedI (|> (case env_size 0 (list) _ (enum.range n.enum 0 (-- env_size))) @@ -283,25 +283,25 @@ (-> Phase Archive Label Text (Environment Synthesis) Arity Inst (Operation [Def Inst])) (let [classD (type.class class (list)) - applyD (: Def - (if (poly_arg? arity) - (|> (n.min arity //runtime.num_apply_variants) - (enum.range n.enum 1) - (list@each (with_apply classD env arity @begin bodyI)) - (list& (with_implementation arity @begin bodyI)) - def.fuse) - (def.method {$.#Public} $.strictM //runtime.apply_method (//runtime.apply_signature 1) - (|>> (_.label @begin) - bodyI - _.ARETURN)))) - functionD (: Def - (|>> (def.int_field {$.#Public} ($_ $.++F $.staticF $.finalF) arity_field (.int arity)) - (with_environment env) - (with_partial arity) - (with_init classD env arity) - (with_reset classD arity env) - applyD - ))] + applyD (is Def + (if (poly_arg? arity) + (|> (n.min arity //runtime.num_apply_variants) + (enum.range n.enum 1) + (list@each (with_apply classD env arity @begin bodyI)) + (list& (with_implementation arity @begin bodyI)) + def.fuse) + (def.method {$.#Public} $.strictM //runtime.apply_method (//runtime.apply_signature 1) + (|>> (_.label @begin) + bodyI + _.ARETURN)))) + functionD (is Def + (|>> (def.int_field {$.#Public} ($_ $.++F $.staticF $.finalF) arity_field (.int arity)) + (with_environment env) + (with_partial arity) + (with_init classD env arity) + (with_reset classD arity env) + applyD + ))] (do phase.monad [instanceI (..instance generate archive classD arity env)] (in [functionD instanceI])))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux index 92b8c0286..4449b3606 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux @@ -53,16 +53,16 @@ ... will refer to the new value of X, instead of the old value, and ... shouldn't be the case. valuesI+ (monad.each @ (function (_ [register argS]) - (: (Operation Inst) - (if (invariant? register argS) - (in function.identity) - (translate archive argS)))) + (is (Operation Inst) + (if (invariant? register argS) + (in function.identity) + (translate archive argS)))) pairs) .let [storesI+ (list@each (function (_ [register argS]) - (: Inst - (if (invariant? register argS) - function.identity - (_.ASTORE register)))) + (is Inst + (if (invariant? register argS) + function.identity + (_.ASTORE register)))) (list.reversed pairs))]] (in (|>> (_.fuse valuesI+) (_.fuse storesI+) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux index 49bc10ff3..734b55316 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -102,7 +102,7 @@ _ (let [constantI (if (|> value - (:as java/lang/Double) + (as java/lang/Double) java/lang/Double::doubleToRawLongBits (i.= ..d0-bits)) _.DCONST_0 diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index ee3e16ed8..76c170725 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -167,11 +167,11 @@ last_rightI _.AALOAD (_.CHECKCAST //.$Tuple)) - recurI (: (-> Label Inst) - (function (_ @loop) - (|>> sub_leftsI (_.ISTORE 1) - sub_tupleI (_.ASTORE 0) - (_.GOTO @loop))))] + recurI (is (-> Label Inst) + (function (_ @loop) + (|>> sub_leftsI (_.ISTORE 1) + sub_tupleI (_.ASTORE 0) + (_.GOTO @loop))))] (|>> ($d.method {$.#Public} $.staticM "pm_fail" throw_methodT (|>> (illegal_state_exception "Invalid expression for pattern-matching.") _.ATHROW)) @@ -200,12 +200,12 @@ $lefts (_.ILOAD 1) $right? (_.ALOAD 2) - variant_partI (: (-> Nat Inst) - (function (_ idx) - (|>> (_.int (.int idx)) _.AALOAD))) - ::lefts (: Inst - (|>> (variant_partI 0) - (_.unwrap type.int))) + variant_partI (is (-> Nat Inst) + (function (_ idx) + (|>> (_.int (.int idx)) _.AALOAD))) + ::lefts (is Inst + (|>> (variant_partI 0) + (_.unwrap type.int))) ::right? (variant_partI 1) ::value (variant_partI 2) @@ -226,11 +226,11 @@ update_$lefts (|>> _.ISUB (_.int +1) _.ISUB) - iterate! (: (-> Label Inst) - (function (_ @loop) - (|>> update_$variant - update_$lefts - (_.GOTO @loop))))]) + iterate! (is (-> Label Inst) + (function (_ @loop) + (|>> update_$variant + update_$lefts + (_.GOTO @loop))))]) (|>> $lefts ... lefts (_.label @loop) $variant ::lefts ... lefts, variant::lefts diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index 74def59a7..3bcf4ccf9 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -184,32 +184,32 @@ (def: (read_variant read host_object) (-> Translator net/sandius/rembulan/impl/DefaultTable (Try Any)) - (case [(net/sandius/rembulan/Table::get_key (:as java/lang/Object runtime.variant_tag_field) host_object) - (net/sandius/rembulan/Table::get_key (:as java/lang/Object runtime.variant_flag_field) host_object) - (net/sandius/rembulan/Table::get_key (:as java/lang/Object runtime.variant_value_field) host_object)] + (case [(net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_tag_field) host_object) + (net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_flag_field) host_object) + (net/sandius/rembulan/Table::get_key (as java/lang/Object runtime.variant_value_field) host_object)] (^.multi [{.#Some tag} ?flag {.#Some value}] [(read value) {try.#Success value}]) - {try.#Success [(: Any (|> tag - (:as Int) - ffi.as_long - java/lang/Long::intValue - (: java/lang/Integer))) - (: Any (case ?flag - {.#Some _} (: Any "") - {.#None} (:as Any (ffi.null)))) - (: Any value)]} + {try.#Success [(is Any (|> tag + (as Int) + ffi.as_long + java/lang/Long::intValue + (is java/lang/Integer))) + (is Any (case ?flag + {.#Some _} (is Any "") + {.#None} (as Any (ffi.null)))) + (is Any value)]} _ - (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) + (exception.except ..unknown_kind_of_object [(as java/lang/Object host_object)]))) (def: (read_tuple read host_object) (-> Translator net/sandius/rembulan/impl/DefaultTable (Try Any)) (let [init_num_keys (.nat (ffi.of_long (net/sandius/rembulan/Table::rawlen host_object)))] (loop [num_keys init_num_keys idx 0 - output (: (Array java/lang/Object) - (array.empty init_num_keys))] + output (is (Array java/lang/Object) + (array.empty init_num_keys))] (if (n.< num_keys idx) (case (net/sandius/rembulan/Table::get_idx (ffi.as_long (.int (++ idx))) host_object) {.#None} @@ -218,7 +218,7 @@ {.#Some member} (case (read member) {try.#Success parsed_member} - (again num_keys (++ idx) (array.write! idx (:as java/lang/Object parsed_member) output)) + (again num_keys (++ idx) (array.write! idx (as java/lang/Object parsed_member) output)) {try.#Failure error} {try.#Failure error})) @@ -262,7 +262,7 @@ (-> net/sandius/rembulan/runtime/ExecutionContext Any Any) (|> ec net/sandius/rembulan/runtime/ExecutionContext::getReturnBuffer - (net/sandius/rembulan/runtime/ReturnBuffer::setTo (:as java/lang/Object value)))) + (net/sandius/rembulan/runtime/ReturnBuffer::setTo (as java/lang/Object value)))) (def: (function/* arity) (-> Nat Code) @@ -301,8 +301,8 @@ (~~ (template [<arity>] [(pattern (list (~~ (static.literals function.identity (..input/* <arity>))))) - (in (to_host ((:as (~~ (static.literal function.identity (..function/* <arity>))) - lux_function) + (in (to_host ((as (~~ (static.literal function.identity (..function/* <arity>))) + lux_function) (~~ (static.literals function.identity (..input/* <arity>))))))] [1] @@ -313,21 +313,21 @@ )) (pattern (list& (~~ (static.literals function.identity (..input/* 5))) input/+)) - (again ((:as (~~ (static.literal function.identity (..function/* 5))) - lux_function) + (again ((as (~~ (static.literal function.identity (..function/* 5))) + lux_function) (~~ (static.literals function.identity (..input/* 5)))) input/+) ))))))) (def: (lua_function to_host lux_function) (-> (-> Any java/lang/Object) Any net/sandius/rembulan/runtime/LuaFunction) - (<| (:as net/sandius/rembulan/runtime/LuaFunction) + (<| (as net/sandius/rembulan/runtime/LuaFunction) (`` (`` (ffi.object [] net/sandius/rembulan/runtime/LuaFunction [LuxValue] [] ... Methods (LuxValue [] (getValue self []) java/lang/Object - (:as java/lang/Object lux_function)) + (as java/lang/Object lux_function)) (net/sandius/rembulan/runtime/LuaFunction [] (invoke self [% net/sandius/rembulan/runtime/ExecutionContext]) @@ -344,7 +344,7 @@ "throws" [net/sandius/rembulan/runtime/ResolvedControlThrowable] (<| (..return %) (apply/* to_host - (ffi.:as net/sandius/rembulan/runtime/LuaFunction self) + (ffi.as net/sandius/rembulan/runtime/LuaFunction self) (list (~~ (static.literals function.identity (..input/* <arity>)))) lux_function)))] @@ -362,7 +362,7 @@ "throws" [net/sandius/rembulan/runtime/ResolvedControlThrowable] (<| (..return %) (apply/* to_host - (ffi.:as net/sandius/rembulan/runtime/LuaFunction self) + (ffi.as net/sandius/rembulan/runtime/LuaFunction self) (array.list {.#None} input/*) lux_function))) ))))) @@ -372,13 +372,13 @@ (def: (lux_structure to_host value) (-> (-> Any java/lang/Object) (Array java/lang/Object) LuxValue) - (<| (ffi.:as LuxValue) + (<| (ffi.as LuxValue) (ffi.object [] net/sandius/rembulan/impl/DefaultTable [LuxValue] [] ... Methods (LuxValue [] (getValue self []) java/lang/Object - (:as java/lang/Object value)) + (as java/lang/Object value)) (net/sandius/rembulan/impl/DefaultTable [] (rawlen self []) long @@ -401,8 +401,8 @@ (case (array.read! 0 value) {.#Some it} (|> it - (:as java/lang/Integer) - (ffi.:as java/lang/Object)) + (as java/lang/Integer) + (ffi.as java/lang/Object)) {.#None} (undefined)) @@ -410,7 +410,7 @@ (pattern (static runtime.variant_flag_field)) (case (array.read! 1 value) {.#Some _} - (:as java/lang/Object "") + (as java/lang/Object "") {.#None} (ffi.null)) @@ -426,10 +426,10 @@ array.size .int ffi.as_long - (ffi.:as java/lang/Object)) + (ffi.as java/lang/Object)) _ - (panic! (exception.error ..unknown_kind_of_object [(:as java/lang/Object field)]))) + (panic! (exception.error ..unknown_kind_of_object [(as java/lang/Object field)]))) {.#None} (case (ffi.check java/lang/Long field) @@ -439,10 +439,10 @@ (to_host it) {.#None} - (: java/lang/Object (ffi.null))) + (is java/lang/Object (ffi.null))) {.#None} - (panic! (exception.error ..unknown_kind_of_object [(:as java/lang/Object field)]))))) + (panic! (exception.error ..unknown_kind_of_object [(as java/lang/Object field)]))))) ))) (exception: (cannot_apply_a_non_function [object java/lang/Object]) @@ -451,7 +451,7 @@ (def: ensure_function (-> Macro (Maybe net/sandius/rembulan/runtime/LuaFunction)) - (|>> (:as java/lang/Object) + (|>> (as java/lang/Object) (ffi.check net/sandius/rembulan/runtime/LuaFunction))) (type: Baggage @@ -461,19 +461,19 @@ (def: (call_macro to_host [state_context executor] inputs lux macro) (-> (-> Any java/lang/Object) Baggage (List Code) Lux net/sandius/rembulan/runtime/LuaFunction (Try Any)) (do try.monad - [.let [inputs (: (ffi.type [java/lang/Object]) - (|> (array.empty 2) - (array.write! 0 ... (:as java/lang/Object inputs) - ... (net/sandius/rembulan/impl/ImmutableTable$Builder::build (net/sandius/rembulan/impl/ImmutableTable$Builder::new)) - (:as java/lang/Object (lux_structure to_host (:as (Array java/lang/Object) inputs)))) - (array.write! 1 ... (:as java/lang/Object lux) - ... (net/sandius/rembulan/impl/ImmutableTable$Builder::build (net/sandius/rembulan/impl/ImmutableTable$Builder::new)) - (:as java/lang/Object (lux_structure to_host (:as (Array java/lang/Object) lux))))))] - output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (:as java/lang/Object macro) inputs executor)] + [.let [inputs (is (ffi.type [java/lang/Object]) + (|> (array.empty 2) + (array.write! 0 ... (as java/lang/Object inputs) + ... (net/sandius/rembulan/impl/ImmutableTable$Builder::build (net/sandius/rembulan/impl/ImmutableTable$Builder::new)) + (as java/lang/Object (lux_structure to_host (as (Array java/lang/Object) inputs)))) + (array.write! 1 ... (as java/lang/Object lux) + ... (net/sandius/rembulan/impl/ImmutableTable$Builder::build (net/sandius/rembulan/impl/ImmutableTable$Builder::new)) + (as java/lang/Object (lux_structure to_host (as (Array java/lang/Object) lux))))))] + output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (as java/lang/Object macro) inputs executor)] (|> output (array.read! 0) maybe.trusted - (:as java/lang/Object) + (as java/lang/Object) ..read))) (def: (expander to_host baggage macro inputs lux) @@ -483,21 +483,21 @@ (case (..call_macro to_host baggage inputs lux macro) {try.#Success output} (|> output - (:as (Try [Lux (List Code)])) + (as (Try [Lux (List Code)])) {try.#Success}) {try.#Failure error} {try.#Failure error}) {.#None} - (exception.except ..cannot_apply_a_non_function (:as java/lang/Object macro)))))] + (exception.except ..cannot_apply_a_non_function (as java/lang/Object macro)))))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) @.lua (def: (expander macro inputs lux) Expander - {try.#Success ((:as Macro' macro) inputs lux)}))) + {try.#Success ((as Macro' macro) inputs lux)}))) (with_expansions [<jvm> (as_is (with_expansions [$var_args (_.var "...") $str_rel_to_abs (_.var "_utf8_str_rel_to_abs") @@ -697,127 +697,127 @@ loader (net/sandius/rembulan/compiler/CompilerChunkLoader::of (ffi.as_string "_lux_definition")) executor (net/sandius/rembulan/exec/DirectCallExecutor::newExecutor) scheduling_context (net/sandius/rembulan/exec/DirectCallExecutor::schedulingContextFactory executor) - run! (: (-> _.Statement (Try Any)) - (function (_ code) - (do try.monad - [lua_function (net/sandius/rembulan/load/ChunkLoader::loadTextChunk variable (ffi.as_string "lux compilation") (ffi.as_string (_.code code)) loader) - output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (:as java/lang/Object lua_function) (array.empty 0) - executor)] - (case (array.read! 0 output) - {.#None} - (in []) - - {.#Some value} - (read value))))) + run! (is (-> _.Statement (Try Any)) + (function (_ code) + (do try.monad + [lua_function (net/sandius/rembulan/load/ChunkLoader::loadTextChunk variable (ffi.as_string "lux compilation") (ffi.as_string (_.code code)) loader) + output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (as java/lang/Object lua_function) (array.empty 0) + executor)] + (case (array.read! 0 output) + {.#None} + (in []) + + {.#Some value} + (read value))))) _ (try.trusted (run! ..rembulan_prelude))] [[state_context executor] - (: (Host _.Expression _.Statement) - (implementation - (def: (evaluate context [_ code]) - (run! (_.return code))) - - (def: execute run!) - - (def: (define context custom [_ input]) - (let [global (maybe.else (reference.artifact context) - custom) - @global (_.var global) - definition (_.set (list @global) input)] - (do try.monad - [_ (run! definition) - value (run! (_.return @global))] - (in [global value definition])))) - - (def: (ingest context content) - (|> content - (# utf8.codec decoded) - try.trusted - (:as _.Statement))) - - (def: (re_learn context custom content) - (run! content)) - - (def: (re_load context custom content) - (do try.monad - [_ (run! content)] - (run! (_.return (_.var (reference.artifact context))))))))]))))] + (is (Host _.Expression _.Statement) + (implementation + (def: (evaluate context [_ code]) + (run! (_.return code))) + + (def: execute run!) + + (def: (define context custom [_ input]) + (let [global (maybe.else (reference.artifact context) + custom) + @global (_.var global) + definition (_.set (list @global) input)] + (do try.monad + [_ (run! definition) + value (run! (_.return @global))] + (in [global value definition])))) + + (def: (ingest context content) + (|> content + (# utf8.codec decoded) + try.trusted + (as _.Statement))) + + (def: (re_learn context custom content) + (run! content)) + + (def: (re_load context custom content) + (do try.monad + [_ (run! content)] + (run! (_.return (_.var (reference.artifact context))))))))]))))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) @.lua (as_is (ffi.import: (load [ffi.String] "try" ffi.Function)) (def: host (IO (Host _.Expression _.Statement)) - (io (let [run! (: (-> _.Statement (Try Any)) - (function (_ code) - (do try.monad - [lua_function (..load (_.code code))] - (let [output ("lua apply" lua_function)] - {try.#Success (if ("lua object nil?" output) - [] - output)}))))] - (: (Host _.Expression _.Statement) - (implementation - (def: (evaluate! context [_ code]) - (run! (_.return code))) - - (def: execute! run!) - - (def: (define! context custom [_ input]) - (let [global (maybe.else (reference.artifact context) - custom) - @global (_.var global)] - (do try.monad - [.let [definition (_.set (list @global) input)] - _ (run! definition) - value (run! (_.return @global))] - (in [global value definition])))) - - (def: (ingest context content) - (|> content (# utf8.codec decoded) try.trusted (:as _.Statement))) - - (def: (re_learn context custom content) - (run! content)) - - (def: (re_load context custom content) - (do try.monad - [_ (run! content)] - (run! (_.return (_.var (reference.artifact context)))))))))))))) + (io (let [run! (is (-> _.Statement (Try Any)) + (function (_ code) + (do try.monad + [lua_function (..load (_.code code))] + (let [output ("lua apply" lua_function)] + {try.#Success (if ("lua object nil?" output) + [] + output)}))))] + (is (Host _.Expression _.Statement) + (implementation + (def: (evaluate! context [_ code]) + (run! (_.return code))) + + (def: execute! run!) + + (def: (define! context custom [_ input]) + (let [global (maybe.else (reference.artifact context) + custom) + @global (_.var global)] + (do try.monad + [.let [definition (_.set (list @global) input)] + _ (run! definition) + value (run! (_.return @global))] + (in [global value definition])))) + + (def: (ingest context content) + (|> content (# utf8.codec decoded) try.trusted (as _.Statement))) + + (def: (re_learn context custom content) + (run! content)) + + (def: (re_load context custom content) + (do try.monad + [_ (run! content)] + (run! (_.return (_.var (reference.artifact context)))))))))))))) (with_expansions [<jvm> (as_is (def: (to_host it) (-> Any java/lang/Object) (`` (<| (~~ (template [<jvm> <lua>] - [(case (ffi.check <jvm> (:as java/lang/Object it)) + [(case (ffi.check <jvm> (as java/lang/Object it)) {.#Some it} - (:as java/lang/Object - (<lua> [(:expected it)])) + (as java/lang/Object + (<lua> [(as_expected it)])) {.#None})] [[java/lang/Object] (..lux_structure to_host)] [library/lux/Function (..lua_function to_host)] )) - (:as java/lang/Object it)))) + (as java/lang/Object it)))) (def: (extender [state_context executor] phase_wrapper) (-> Baggage (-> phase.Wrapper Extender)) ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (do try.monad [handler (try.of_maybe (..ensure_function handler)) output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context - (:as java/lang/Object handler) + (as java/lang/Object handler) (|> (array.empty 5) (array.write! 0 name) - (array.write! 1 (:as java/lang/Object (phase_wrapper phase))) + (array.write! 1 (as java/lang/Object (phase_wrapper phase))) (array.write! 2 (..to_host archive)) (array.write! 3 (..to_host parameters)) (array.write! 4 (..to_host state))) @@ -825,7 +825,7 @@ (|> output (array.read! 0) maybe.trusted - (:as java/lang/Object) + (as java/lang/Object) ..read)))))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) @@ -833,16 +833,16 @@ @.lua (def: (extender phase_wrapper handler) (-> phase.Wrapper Extender) - (:expected handler)))) + (as_expected handler)))) (def: (phase_wrapper archive) (-> Archive (runtime.Operation phase.Wrapper)) (do phase.monad [] - (in (:as phase.Wrapper - (for @.old (..lua_function ..to_host) - @.jvm (..lua_function ..to_host) - @.lua (|>>)))))) + (in (as phase.Wrapper + (for @.old (..lua_function ..to_host) + @.jvm (..lua_function ..to_host) + @.lua (|>>)))))) (with_expansions [<jvm> (def: platform (IO [Baggage (Platform [Register _.Label] _.Expression _.Statement)]) diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 0abd174f2..8cb0fba11 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -373,11 +373,11 @@ Called by `imenu--generic-function'." "All" "Ex" "Interface" "type")) - (type//checking (altRE ":" ":as" ":let" ":~" ":expected" ":of" ":sharing" ":by_example" ":hole")) - (type//abstract (altRE "abstract:" ":abstraction" ":representation" ":transmutation" "\\^:representation")) + (type//checking (altRE "is" "as" "let" "as_expected" "type_of" "sharing" "by_example" "hole")) + (type//abstract (altRE "abstract:" "abstraction" "representation" "transmutation")) (type//unit (altRE "unit:" "scale:")) (type//poly (altRE "poly:")) - (type//dynamic (altRE ":dynamic" "/.:static")) + (type//dynamic (altRE "dynamic" "static")) (type//capability (altRE "capability:")) ;; Data (data//record (altRE "the" "has" "revised")) @@ -439,7 +439,7 @@ Called by `imenu--generic-function'." definition ;; ;;;;;;;;;;;;;;;;;;;;;; "with_expansions" - "undefined" "symbol" "static" + "undefined" "symbol" "for" "io" "infix" diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index af80c26a0..6652c8011 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -191,7 +191,7 @@ (php/runtime/memory/NullMemory::INSTANCE)) (case (ffi.check java/lang/Boolean value) {.#Some value} - (if (:as Bit value) + (if (as Bit value) (php/runtime/memory/TrueMemory::INSTANCE) (php/runtime/memory/FalseMemory::INSTANCE)) @@ -213,7 +213,7 @@ {.#None}) (case (ffi.check [java/lang/Object] value) {.#Some value} - (lux_structure (:as (Array java/lang/Object) value)) + (lux_structure (as (Array java/lang/Object) value)) {.#None}) (case (ffi.check php/runtime/memory/ObjectMemory value) @@ -235,7 +235,7 @@ ... Methods (program/StructureValue [] (getValue self []) java/lang/Object - (:expected value)) + (as_expected value)) (php/runtime/Memory [] (toString self []) @@ -278,12 +278,12 @@ [] (valueOfIndex self [trace php/runtime/env/TraceInfo index java/lang/String]) php/runtime/Memory - (case (:as Text index) + (case (as Text index) (pattern (static runtime.variant_tag_field)) (|> value (array.read! 0) maybe.trusted - (:as java/lang/Integer) + (as java/lang/Integer) php/runtime/memory/LongMemory::valueOf) (pattern (static runtime.variant_flag_field)) @@ -311,15 +311,15 @@ (-> Reader php/runtime/memory/ArrayMemory (Try Any)) (let [size (|> host_object php/runtime/memory/ArrayMemory::size - (:as Nat) + (as Nat) --)] (loop [idx 0 - output (:as (Array Any) (array.new size))] + output (as (Array Any) (array.new size))] (if (n.< size idx) (let [value (|> host_object (php/runtime/memory/ArrayMemory::get (php/runtime/memory/LongMemory::new (.int idx))) maybe.trusted - (:as php/runtime/memory/ReferenceMemory) + (as php/runtime/memory/ReferenceMemory) php/runtime/memory/ReferenceMemory::getValue)] (case (ffi.check php/runtime/memory/NullMemory value) {.#Some _} @@ -354,19 +354,19 @@ maybe.trusted read)] [{try.#Success tag} {try.#Success value}] - {try.#Success [(java/lang/Long::intValue (:as java/lang/Long tag)) - (: Any - (case (|> host_object - (php/runtime/memory/ArrayMemory::get ..variant_flag_field) - maybe.trusted - (:as php/runtime/memory/ReferenceMemory) - php/runtime/memory/ReferenceMemory::getValue - (ffi.check php/runtime/memory/NullMemory)) - {.#Some _} - (ffi.null) - - {.#None} - synthesis.unit)) + {try.#Success [(java/lang/Long::intValue (as java/lang/Long tag)) + (is Any + (case (|> host_object + (php/runtime/memory/ArrayMemory::get ..variant_flag_field) + maybe.trusted + (as php/runtime/memory/ReferenceMemory) + php/runtime/memory/ReferenceMemory::getValue + (ffi.check php/runtime/memory/NullMemory)) + {.#Some _} + (ffi.null) + + {.#None} + synthesis.unit)) value]} _ @@ -431,7 +431,7 @@ (def: (ensure_macro macro) (-> Macro (Maybe php/runtime/memory/ObjectMemory)) (|> macro - (:as java/lang/Object) + (as java/lang/Object) (ffi.check php/runtime/memory/ObjectMemory))) (def: interpreter @@ -444,20 +444,20 @@ (java/lang/Class::getDeclaredField "environment") (pipe.exec [(java/lang/reflect/AccessibleObject::setAccessible true)]) (java/lang/reflect/Field::get ..interpreter) - (:as php/runtime/env/Environment))) + (as php/runtime/env/Environment))) (def: (call_macro inputs lux macro) (-> (List Code) Lux php/runtime/memory/ObjectMemory (Try (Try [Lux (List Code)]))) - (<| :expected + (<| as_expected (do try.monad [output (php/runtime/lang/Closure::call ..default_environment (|> (ffi.array php/runtime/Memory 3) (ffi.write! 0 macro) - (ffi.write! 1 (lux_structure (:as (Array java/lang/Object) inputs))) - (ffi.write! 2 (lux_structure (:as (Array java/lang/Object) lux)))) - (:as php/runtime/lang/Closure - (php/runtime/memory/ObjectMemory::value macro)))] - (..read (:as java/lang/Object output))))) + (ffi.write! 1 (lux_structure (as (Array java/lang/Object) inputs))) + (ffi.write! 2 (lux_structure (as (Array java/lang/Object) lux)))) + (as php/runtime/lang/Closure + (php/runtime/memory/ObjectMemory::value macro)))] + (..read (as java/lang/Object output))))) (def: (expander macro inputs lux) Expander @@ -466,41 +466,41 @@ (call_macro inputs lux macro) {.#None} - (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro)))) + (exception.throw ..cannot_apply_a_non_function (as java/lang/Object macro)))) (def: host (IO (Host _.Expression _.Statement)) - (io (let [run! (: (-> (_.Code Any) (Try Any)) - (function (_ code) - (do try.monad - [output (javax/script/ScriptEngine::eval (format "<?php " (_.code code)) ..interpreter)] - (..read output))))] - (: (Host _.Expression _.Statement) - (structure - (def: (evaluate! context code) - (run! (_.return code))) - - (def: execute! run!) - - (def: (define! context input) - (let [global (reference.artifact context) - @global (_.global global)] - (do try.monad - [#let [definition (_.set! @global input)] - _ (run! definition) - value (run! (_.return @global))] - (wrap [global value definition])))) - - (def: (ingest context content) - (|> content (# utf8.codec decoded) try.trusted (:as _.Statement))) - - (def: (re_learn context content) - (run! content)) - - (def: (re_load context content) - (do try.monad - [_ (run! content)] - (run! (_.return (_.var (reference.artifact context))))))))))) + (io (let [run! (is (-> (_.Code Any) (Try Any)) + (function (_ code) + (do try.monad + [output (javax/script/ScriptEngine::eval (format "<?php " (_.code code)) ..interpreter)] + (..read output))))] + (is (Host _.Expression _.Statement) + (structure + (def: (evaluate! context code) + (run! (_.return code))) + + (def: execute! run!) + + (def: (define! context input) + (let [global (reference.artifact context) + @global (_.global global)] + (do try.monad + [#let [definition (_.set! @global input)] + _ (run! definition) + value (run! (_.return @global))] + (wrap [global value definition])))) + + (def: (ingest context content) + (|> content (# utf8.codec decoded) try.trusted (as _.Statement))) + + (def: (re_learn context content) + (run! content)) + + (def: (re_load context content) + (do try.monad + [_ (run! content)] + (run! (_.return (_.var (reference.artifact context))))))))))) (def: platform (IO (Platform [Nat _.Label] _.Expression _.Statement)) @@ -522,21 +522,21 @@ (def: extender Extender ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (do try.monad [handler (try.from_maybe (..ensure_macro handler)) - #let [to_php (: (-> Any php/runtime/Memory) - (|>> (:as (Array java/lang/Object)) lux_structure (:as php/runtime/Memory)))] + #let [to_php (is (-> Any php/runtime/Memory) + (|>> (as (Array java/lang/Object)) lux_structure (as php/runtime/Memory)))] output (php/runtime/lang/Closure::call ..default_environment (|> (ffi.array php/runtime/Memory 6) (ffi.write! 0 handler) @@ -545,14 +545,14 @@ (ffi.write! 3 (to_php archive)) (ffi.write! 4 (to_php parameters)) (ffi.write! 5 (to_php state))) - (:as php/runtime/lang/Closure - (php/runtime/memory/ObjectMemory::value handler)))] + (as php/runtime/lang/Closure + (php/runtime/memory/ObjectMemory::value handler)))] (..read output)))) @.php (def: (extender handler) Extender - (:expected handler))) + (as_expected handler))) (def: (declare_success! _) (-> Any (Promise Any)) diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index 0e72141bf..513de48f0 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -150,8 +150,8 @@ (-> Translator Translator) (let [size (|> host_object org/python/core/PyObject::__len__ ffi.of_int .nat)] (loop [idx 0 - output (:as (Array Any) - (array.empty size))] + output (as (Array Any) + (array.empty size))] (if (n.< size idx) (case (org/python/core/PyObject::__getitem__ (ffi.as_int (.int idx)) host_object) {try.#Success value} @@ -186,18 +186,18 @@ [(read value) {try.#Success value}]) {try.#Success [tag - (: Any - (case (ffi.check org/python/core/PyNone - (:as java/lang/Object flag)) - {.#Some _} - (:as Any (ffi.null)) - - {.#None} - (:as Any synthesis.unit))) + (is Any + (case (ffi.check org/python/core/PyNone + (as java/lang/Object flag)) + {.#Some _} + (as Any (ffi.null)) + + {.#None} + (as Any synthesis.unit))) value]} _ - (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) + (exception.except ..unknown_kind_of_object [(as java/lang/Object host_object)]))) (ffi.interface: LuxValue (value [] java/lang/Object)) @@ -209,7 +209,7 @@ (def: (read host_object) Translator (`` (<| (~~ (template [<class> <processing>] - [(case (ffi.check <class> (:as <class> host_object)) + [(case (ffi.check <class> (as <class> host_object)) {.#Some host_object} {try.#Success (`` (|> host_object (~~ (template.spliced <processing>))))} @@ -218,11 +218,11 @@ [LuxValue [LuxValue::value]] [org/python/core/PyNone [(pipe.new [] [])]] [org/python/core/PyBoolean [org/python/core/PyObject::__nonzero__]] - ... [org/python/core/PyInteger [(ffi.:as org/python/core/PyObject) org/python/core/PyObject::asInt]] - [org/python/core/PyInteger [(ffi.:as org/python/core/PyObject) + ... [org/python/core/PyInteger [(ffi.as org/python/core/PyObject) org/python/core/PyObject::asInt]] + [org/python/core/PyInteger [(ffi.as org/python/core/PyObject) ("jvm member invoke virtual" [] "org.python.core.PyObject" "asInt" []) "jvm object cast" - (: (Primitive "java.lang.Integer"))]] + (is (Primitive "java.lang.Integer"))]] [org/python/core/PyLong [org/python/core/PyObject::asLong]] [org/python/core/PyFloat [org/python/core/PyObject::asDouble]] [org/python/core/PyString [org/python/core/PyObject::asString]] @@ -233,14 +233,14 @@ (~~ (template [<class> <processing>] [(case (ffi.check <class> host_object) {.#Some host_object} - (<| <processing> (:as org/python/core/PyObject) host_object) + (<| <processing> (as org/python/core/PyObject) host_object) _)] [org/python/core/PyTuple (..read_variant read)] [org/python/core/PyList (..read_tuple read)] )) - ... (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]) + ... (exception.except ..unknown_kind_of_object [(as java/lang/Object host_object)]) {try.#Success host_object}))) (def: (function/? arity) @@ -254,11 +254,11 @@ (def: (pseudo_function to_host it) (-> (-> Any org/python/core/PyObject) Any org/python/core/PyObject) - (<| (:as org/python/core/PyObject) + (<| (as org/python/core/PyObject) (ffi.object [] org/python/core/PyObject [LuxValue] [] ... Methods - (LuxValue [] (value self []) java/lang/Object (:as java/lang/Object it)) + (LuxValue [] (value self []) java/lang/Object (as java/lang/Object it)) (org/python/core/PyObject [] (__call__ self [inputs [org/python/core/PyObject] @@ -271,11 +271,11 @@ inputs inputs] (`` (`` (case inputs (pattern (list)) - (:as org/python/core/PyObject self) + (as org/python/core/PyObject self) (~~ (template [<arity>] [(pattern (list (~~ (static.literals code.local_symbol (inputs/? <arity>))))) - (to_host ((:as (~~ (static.literal function.identity (function/? <arity>))) it) + (to_host ((as (~~ (static.literal function.identity (function/? <arity>))) it) (~~ (static.literals code.local_symbol (inputs/? <arity>)))))] [1] @@ -289,7 +289,7 @@ (pattern (list& (~~ (static.literals code.local_symbol (inputs/? 8))) input/+)) - (again ((:as (~~ (static.literal function.identity (function/? 8))) it) + (again ((as (~~ (static.literal function.identity (function/? 8))) it) (~~ (static.literals code.local_symbol (inputs/? 8)))) input/+)))))))))))) @@ -302,43 +302,43 @@ (def: (to_host|array to_host it) (-> (-> Any org/python/core/PyObject) Any org/python/core/PyObject) - (:as org/python/core/PyObject - (ffi.object [] org/python/core/PyArray [LuxValue] - [(java/lang/Class java/lang/Object) ..object_class - java/lang/Object (:as java/lang/Object it)] - ... Methods - (LuxValue [] (value self []) java/lang/Object (:as java/lang/Object it)) - - (org/python/core/PyArray - [] (pyget self [index' int]) - org/python/core/PyObject - (case (|> it - (:as (Array Any)) - (array.read! (|> index' ffi.int_to_long (:as Nat)))) - {.#None} - (::super! [index']) - - {.#Some it} - (<| (case (ffi.check [java/lang/Object] (:as java/lang/Object it)) - {.#Some it} - (to_host it) - - {.#None}) - (case (ffi.check library/lux/Function (:as java/lang/Object it)) - {.#Some it} - (pseudo_function to_host it) - - {.#None}) - (::super! [index'])))) - ))) + (as org/python/core/PyObject + (ffi.object [] org/python/core/PyArray [LuxValue] + [(java/lang/Class java/lang/Object) ..object_class + java/lang/Object (as java/lang/Object it)] + ... Methods + (LuxValue [] (value self []) java/lang/Object (as java/lang/Object it)) + + (org/python/core/PyArray + [] (pyget self [index' int]) + org/python/core/PyObject + (case (|> it + (as (Array Any)) + (array.read! (|> index' ffi.int_to_long (as Nat)))) + {.#None} + (::super! [index']) + + {.#Some it} + (<| (case (ffi.check [java/lang/Object] (as java/lang/Object it)) + {.#Some it} + (to_host it) + + {.#None}) + (case (ffi.check library/lux/Function (as java/lang/Object it)) + {.#Some it} + (pseudo_function to_host it) + + {.#None}) + (::super! [index'])))) + ))) (def: (to_host it) (-> Any org/python/core/PyObject) (`` (<| (~~ (template [<jvm> <python>] - [(case (ffi.check <jvm> (:as java/lang/Object it)) + [(case (ffi.check <jvm> (as java/lang/Object it)) {.#Some it} - (:as org/python/core/PyObject - (<python> [it])) + (as org/python/core/PyObject + (<python> [it])) {.#None})] @@ -349,7 +349,7 @@ [library/lux/Function (pseudo_function to_host)] [[java/lang/Object] (to_host|array to_host)] )) - (:as org/python/core/PyObject it)))) + (as org/python/core/PyObject it)))) )] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) @@ -363,11 +363,11 @@ (ffi.write! 1 (..to_host lux)))) (try#each ..read) try#conjoint - :expected)) + as_expected)) (def: python_function! (-> Any (Maybe org/python/core/PyFunction)) - (|>> (:as java/lang/Object) + (|>> (as java/lang/Object) (ffi.check org/python/core/PyFunction))) (exception: (cannot_apply_a_non_function [object java/lang/Object]) @@ -382,68 +382,68 @@ (case (..call_macro inputs lux macro) {try.#Success output} (|> output - (:as org/python/core/PyObject) + (as org/python/core/PyObject) ..read - (:as (Try (Try [Lux (List Code)])))) + (as (Try (Try [Lux (List Code)])))) {try.#Failure error} {try.#Failure error}) {.#None} - (exception.except ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))))] + (exception.except ..cannot_apply_a_non_function [(as java/lang/Object macro)]))))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) @.python (def: (expander macro inputs lux) Expander - {try.#Success ((:as Macro' macro) inputs lux)}))) + {try.#Success ((as Macro' macro) inputs lux)}))) (with_expansions [<jvm> (def: host (IO (Host (_.Expression Any) (_.Statement Any))) (io (let [interpreter (org/python/util/PythonInterpreter::new) - evaluate! (: (-> unit.ID [(Maybe unit.ID) (_.Expression Any)] (Try Any)) - (function (evaluate! context [_ input]) - (do try.monad - [output (org/python/util/PythonInterpreter::eval (ffi.as_string (_.code input)) interpreter)] - (..read output)))) - execute! (: (-> (_.Statement Any) (Try Any)) - (function (execute! input) - (case (org/python/util/PythonInterpreter::exec (ffi.as_string (_.code input)) interpreter) - {try.#Failure error} - (if (text.contains? "maximum recursion depth exceeded" error) - (execute! input) - {try.#Failure error}) - - output - output)))] - (: (Host (_.Expression Any) (_.Statement Any)) - (implementation - (def: evaluate evaluate!) - (def: execute execute!) - (def: (define context custom [@def input]) - (let [global (maybe.else (reference.artifact context) - custom) - @global (_.var global)] - (do try.monad - [.let [definition (_.set (list @global) input)] - _ (execute! definition) - value (evaluate! context [@def @global])] - (in [global value definition])))) - - (def: (ingest context content) - (|> content - (# utf8.codec decoded) - try.trusted - (:as (_.Statement Any)))) - - (def: (re_learn context custom content) - (execute! content)) - - (def: (re_load context custom content) - (do try.monad - [_ (execute! content)] - (evaluate! context [{.#None} (_.var (reference.artifact context))]))))))))] + evaluate! (is (-> unit.ID [(Maybe unit.ID) (_.Expression Any)] (Try Any)) + (function (evaluate! context [_ input]) + (do try.monad + [output (org/python/util/PythonInterpreter::eval (ffi.as_string (_.code input)) interpreter)] + (..read output)))) + execute! (is (-> (_.Statement Any) (Try Any)) + (function (execute! input) + (case (org/python/util/PythonInterpreter::exec (ffi.as_string (_.code input)) interpreter) + {try.#Failure error} + (if (text.contains? "maximum recursion depth exceeded" error) + (execute! input) + {try.#Failure error}) + + output + output)))] + (is (Host (_.Expression Any) (_.Statement Any)) + (implementation + (def: evaluate evaluate!) + (def: execute execute!) + (def: (define context custom [@def input]) + (let [global (maybe.else (reference.artifact context) + custom) + @global (_.var global)] + (do try.monad + [.let [definition (_.set (list @global) input)] + _ (execute! definition) + value (evaluate! context [@def @global])] + (in [global value definition])))) + + (def: (ingest context content) + (|> content + (# utf8.codec decoded) + try.trusted + (as (_.Statement Any)))) + + (def: (re_learn context custom content) + (execute! content)) + + (def: (re_load context custom content) + (do try.monad + [_ (execute! content)] + (evaluate! context [{.#None} (_.var (reference.artifact context))]))))))))] (for @.old <jvm> @.jvm <jvm> @@ -453,58 +453,58 @@ (def: host (IO (Host (_.Expression Any) (_.Statement Any))) - (io (: (Host (_.Expression Any) (_.Statement Any)) - (let [globals (..dict []) - evaluate! (: (-> unit.ID (_.Expression Any) (Try Any)) - (function (evaluate! context input) - (..eval [(_.code input) globals]))) - execute! (: (-> (_.Statement Any) (Try Any)) - (function (execute! input) - (ffi.try ("python exec" (_.code input) globals)))) - define! (: (-> unit.ID (_.Expression Any) (Try [Text Any (_.Statement Any)])) - (function (define! context input) - (let [global (reference.artifact context) - @global (_.var global)] - (do try.monad - [.let [definition (_.set (list @global) input)] - _ (execute! definition) - value (evaluate! context @global)] - (in [global value definition])))))] - (implementation - (def: evaluate! evaluate!) - (def: execute! execute!) - (def: define! define!) - - (def: (ingest context content) - (|> content (# utf8.codec decoded) try.trusted (:as (_.Statement Any)))) - - (def: (re_learn context content) - (execute! content)) - - (def: (re_load context content) - (do try.monad - [_ (execute! content)] - (evaluate! context (_.var (reference.artifact context))))))))))))) + (io (is (Host (_.Expression Any) (_.Statement Any)) + (let [globals (..dict []) + evaluate! (is (-> unit.ID (_.Expression Any) (Try Any)) + (function (evaluate! context input) + (..eval [(_.code input) globals]))) + execute! (is (-> (_.Statement Any) (Try Any)) + (function (execute! input) + (ffi.try ("python exec" (_.code input) globals)))) + define! (is (-> unit.ID (_.Expression Any) (Try [Text Any (_.Statement Any)])) + (function (define! context input) + (let [global (reference.artifact context) + @global (_.var global)] + (do try.monad + [.let [definition (_.set (list @global) input)] + _ (execute! definition) + value (evaluate! context @global)] + (in [global value definition])))))] + (implementation + (def: evaluate! evaluate!) + (def: execute! execute!) + (def: define! define!) + + (def: (ingest context content) + (|> content (# utf8.codec decoded) try.trusted (as (_.Statement Any)))) + + (def: (re_learn context content) + (execute! content)) + + (def: (re_load context content) + (do try.monad + [_ (execute! content)] + (evaluate! context (_.var (reference.artifact context))))))))))))) (with_expansions [<jvm> (as_is (def: (extender phase_wrapper) (-> phase.Wrapper Extender) ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (_ handler)) - (:as Handler) + (as Handler) (function (_ name phase)) - (:as Phase) + (as Phase) (function (_ archive parameters)) - (:as Operation) + (as Operation) (function (_ state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (do try.monad [handler (try.of_maybe (..python_function! handler)) output (org/python/core/PyFunction::__call__ (|> (ffi.array org/python/core/PyObject 5) - (ffi.write! 0 (:as org/python/core/PyObject (org/python/core/PyString::new (ffi.as_string name)))) - (ffi.write! 1 (:as org/python/core/PyObject (phase_wrapper phase))) + (ffi.write! 0 (as org/python/core/PyObject (org/python/core/PyString::new (ffi.as_string name)))) + (ffi.write! 1 (as org/python/core/PyObject (phase_wrapper phase))) (ffi.write! 2 (..to_host archive)) (ffi.write! 3 (..to_host parameters)) (ffi.write! 4 (..to_host state))) @@ -516,12 +516,12 @@ @.python (def: (extender phase_wrapper handler) (-> phase.Wrapper Extender) - (:expected handler)))) + (as_expected handler)))) (def: (phase_wrapper archive) (-> Archive (runtime.Operation phase.Wrapper)) (|> (..pseudo_function ..to_host) - (:as phase.Wrapper) + (as phase.Wrapper) phase#in)) (def: platform @@ -586,7 +586,7 @@ (type (_.Statement Any))] ..extender service - [(packager.package (: (_.Statement Any) (_.manual "")) + [(packager.package (is (_.Statement Any) (_.manual "")) _.code _.then ..scope) diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux index da00a6f02..77b3fc757 100644 --- a/lux-r/source/program.lux +++ b/lux-r/source/program.lux @@ -191,9 +191,9 @@ (def: (host_value value) (-> Any org/renjin/sexp/SEXP) - (let [... to_sub (: (-> Any org/armedbear/lisp/LispObject) + (let [... to_sub (is (-> Any org/armedbear/lisp/LispObject) ... (function (_ sub_value) - ... (let [sub_value (:as java/lang/Object sub_value)] + ... (let [sub_value (as java/lang/Object sub_value)] ... (`` (<| (~~ (template [<type> <then>] ... [(case (ffi.check <type> sub_value) ... {.#Some sub_value} @@ -208,7 +208,7 @@ ... [java/lang/String [org/armedbear/lisp/SimpleString::new]] ... )) ... ... else - ... (:as org/armedbear/lisp/LispObject sub_value)))))) + ... (as org/armedbear/lisp/LispObject sub_value)))))) ] (`` (macro.log_expand_once! (ffi.object [] @@ -221,12 +221,12 @@ [[org/renjin/sexp/SEXP] (ffi.array org/renjin/sexp/SEXP 0) ... (java/util/List java/lang/Object) - ... (:expected (..fake_list [])) + ... (as_expected (..fake_list [])) ] ... Methods ... (program/LuxADT ... [] (getValue self []) java/lang/Object - ... (:as java/lang/Object value)) + ... (as java/lang/Object value)) ... (org/renjin/sexp/AbstractSEXP ... [] (eval self [context org/renjin/eval/Context environment org/renjin/sexp/Environment]) @@ -360,21 +360,21 @@ (do try.monad [tag (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_tag_field) - (:as java/lang/Object) + (as java/lang/Object) read) value (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_value_field) - (:as java/lang/Object) + (as java/lang/Object) read)] - (wrap [(|> tag (:as java/lang/Long) java/lang/Long::intValue) + (wrap [(|> tag (as java/lang/Long) java/lang/Long::intValue) (case (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_flag_field) (ffi.check org/renjin/sexp/Null)) {.#Some _} - (: Any (ffi.null)) + (is Any (ffi.null)) _ - (: Any synthesis.unit)) + (is Any synthesis.unit)) value]))) (def: (read_i64 host_object) @@ -396,14 +396,14 @@ (-> (Reader java/lang/Object) (Reader org/renjin/sexp/ListVector)) (let [size (.nat (org/renjin/sexp/ListVector::length host_object))] (loop [idx 0 - output (:as (Array Any) (array.new size))] + output (as (Array Any) (array.new size))] (if (n.< size idx) - (case (|> host_object (org/renjin/sexp/ListVector::get_index (.int idx)) (:as java/lang/Object) read) + (case (|> host_object (org/renjin/sexp/ListVector::get_index (.int idx)) (as java/lang/Object) read) {try.#Failure error} {try.#Failure error} {try.#Success member} - (again (++ idx) (array.write! idx (:as Any member) output))) + (again (++ idx) (array.write! idx (as Any member) output))) {try.#Success output})))) (def: (field_class field host_object) @@ -412,7 +412,7 @@ (org/renjin/sexp/ListVector::get_field field) java/lang/Object::getClass java/lang/Object::toString - (:as Text))) + (as Text))) (def: (read host_object) (Reader java/lang/Object) @@ -455,24 +455,24 @@ (def: ensure_macro (-> Macro (Maybe org/renjin/sexp/Closure)) - (|>> (:as java/lang/Object) (ffi.check org/renjin/sexp/Closure))) + (|>> (as java/lang/Object) (ffi.check org/renjin/sexp/Closure))) (def: (call_macro interpreter inputs lux macro) (-> org/renjin/script/RenjinScriptEngine (List Code) Lux org/renjin/sexp/Closure (Try (Try [Lux (List Code)]))) (let [_ ("lux io log" "@call_macro 0") - r_inputs (: org/renjin/sexp/PairList - (case (ffi.try (|> (org/renjin/sexp/PairList$Builder::new) - (org/renjin/sexp/PairList$Builder::add (..host_value inputs)) - (org/renjin/sexp/PairList$Builder::add (..host_value lux)) - org/renjin/sexp/PairList$Builder::build - (:as org/renjin/sexp/PairList))) - {try.#Success r_inputs} - r_inputs - - {try.#Failure error} - (exec - ("lux io log" error) - (panic! error)))) + r_inputs (is org/renjin/sexp/PairList + (case (ffi.try (|> (org/renjin/sexp/PairList$Builder::new) + (org/renjin/sexp/PairList$Builder::add (..host_value inputs)) + (org/renjin/sexp/PairList$Builder::add (..host_value lux)) + org/renjin/sexp/PairList$Builder::build + (as org/renjin/sexp/PairList))) + {try.#Success r_inputs} + r_inputs + + {try.#Failure error} + (exec + ("lux io log" error) + (panic! error)))) _ ("lux io log" "@call_macro 1") r_macro (org/renjin/sexp/FunctionCall::new macro r_inputs) _ ("lux io log" "@call_macro 2") @@ -483,8 +483,8 @@ (do try.monad [raw_output (org/renjin/sexp/FunctionCall::eval r_context r_environment r_macro) #let [_ ("lux io log" "@call_macro 5")]] - (:as (Try (Try [Lux (List Code)])) - (..read (:as java/lang/Object raw_output)))))) + (as (Try (Try [Lux (List Code)])) + (..read (as java/lang/Object raw_output)))))) (def: (expander interpreter macro inputs lux) (-> org/renjin/script/RenjinScriptEngine Expander) @@ -493,56 +493,56 @@ (call_macro interpreter inputs lux macro) {.#None} - (exception.throw ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))) + (exception.throw ..cannot_apply_a_non_function [(as java/lang/Object macro)]))) (def: host (IO [org/renjin/script/RenjinScriptEngine (Host _.Expression _.Expression)]) (io (let [interpreter (|> (org/renjin/script/RenjinScriptEngineFactory::new) org/renjin/script/RenjinScriptEngineFactory::getScriptEngine) - run! (: (-> (_.Code Any) (Try Any)) - (function (_ code) - (do try.monad - [host_value (javax/script/ScriptEngine::eval (_.code code) interpreter)] - (read host_value))))] - [(:as org/renjin/script/RenjinScriptEngine interpreter) - (: (Host _.Expression _.Expression) - (structure - (def: (evaluate! context code) - (exec ("lux io log" "@evaluate!") - (run! code))) - - (def: (execute! input) - (exec - ("lux io log" "@execute!") - ... ("lux io log" (_.code input)) - (javax/script/ScriptEngine::eval (_.code input) interpreter))) - - (def: (define! context input) - (let [global (reference.artifact context) - $global (_.var global)] - (do try.monad - [#let [definition (_.set! $global input)] - #let [_ ("lux io log" "@define! 0") - ... _ ("lux io log" (_.code definition)) - ] - _ (javax/script/ScriptEngine::eval (_.code definition) interpreter) - #let [_ ("lux io log" "@define! 1")] - value (run! $global) - #let [_ ("lux io log" "@define! 2")]] - (wrap [global value definition])))) - - (def: (ingest context content) - (|> content (# utf8.codec decoded) try.trusted (:as _.Expression))) - - (def: (re_learn context content) - (run! content)) - - (def: (re_load context content) - (do try.monad - [_ (run! content)] - (run! (_.var (reference.artifact context))))) - ))]))) + run! (is (-> (_.Code Any) (Try Any)) + (function (_ code) + (do try.monad + [host_value (javax/script/ScriptEngine::eval (_.code code) interpreter)] + (read host_value))))] + [(as org/renjin/script/RenjinScriptEngine interpreter) + (is (Host _.Expression _.Expression) + (structure + (def: (evaluate! context code) + (exec ("lux io log" "@evaluate!") + (run! code))) + + (def: (execute! input) + (exec + ("lux io log" "@execute!") + ... ("lux io log" (_.code input)) + (javax/script/ScriptEngine::eval (_.code input) interpreter))) + + (def: (define! context input) + (let [global (reference.artifact context) + $global (_.var global)] + (do try.monad + [#let [definition (_.set! $global input)] + #let [_ ("lux io log" "@define! 0") + ... _ ("lux io log" (_.code definition)) + ] + _ (javax/script/ScriptEngine::eval (_.code definition) interpreter) + #let [_ ("lux io log" "@define! 1")] + value (run! $global) + #let [_ ("lux io log" "@define! 2")]] + (wrap [global value definition])))) + + (def: (ingest context content) + (|> content (# utf8.codec decoded) try.trusted (as _.Expression))) + + (def: (re_learn context content) + (run! content)) + + (def: (re_load context content) + (do try.monad + [_ (run! content)] + (run! (_.var (reference.artifact context))))) + ))]))) (def: platform (IO [org/renjin/script/RenjinScriptEngine @@ -564,17 +564,17 @@ (def: extender Extender ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (exec ("lux io log" "TODO: Extender") {try.#Failure "TODO: Extender"}))) @@ -582,7 +582,7 @@ @.r (def: (extender handler) Extender - (:expected handler))) + (as_expected handler))) (def: (declare_success! _) (-> Any (Promise Any)) diff --git a/lux-ruby/project.lux b/lux-ruby/project.lux index 97856704a..de1979660 100644 --- a/lux-ruby/project.lux +++ b/lux-ruby/project.lux @@ -1,5 +1,5 @@ ["" - ["identity" ["com.github.luxlang" "lux-ruby" "0.6.4"] + ["identity" ["com.github.luxlang" "lux-ruby" "0.6.6-SNAPSHOT"] "description" "A Ruby compiler for Lux." "info" ["url" "https://github.com/LuxLang/lux" "scm" "https://github.com/LuxLang/lux.git" @@ -15,8 +15,8 @@ "repositories" ["https://oss.sonatype.org/content/repositories/snapshots/" "https://oss.sonatype.org/service/local/staging/deploy/maven2/"] - "compiler" ["com.github.luxlang" "lux-jvm" "0.6.4" "jar"] - "dependencies" [... ["com.github.luxlang" "stdlib" "0.6.4" "tar"] + "lux" ["com.github.luxlang" "lux-jvm" "0.6.6-SNAPSHOT" "jar"] + "dependencies" [... ["com.github.luxlang" "stdlib" "0.6.6-SNAPSHOT" "tar"] ["org.jruby" "jruby-complete" "9.2.15.0" "jar"]] diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 3b8d46737..198faf43b 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -236,8 +236,8 @@ (-> Translator org/jruby/RubyArray (Try Any)) (let [size (.nat (ffi.of_int (org/jruby/RubyArray::getLength host_object)))] (loop [idx 0 - output (: (Array Any) - (array.empty size))] + output (is (Array Any) + (array.empty size))] (if (n.< size idx) (case (org/jruby/RubyArray::get (ffi.as_int (.int idx)) host_object) {.#None} @@ -265,21 +265,21 @@ [{.#Some tag} ?flag {.#Some value}] (do try.monad [value (read value)] - (in [(: Any (|> tag - (:as java/lang/Long) - java/lang/Long::intValue - (: java/lang/Integer))) - (: Any - (case ?flag - {.#Some _} - "" - - {.#None} - (: java/lang/Object (ffi.null)))) - (: Any value)])) + (in [(is Any (|> tag + (as java/lang/Long) + java/lang/Long::intValue + (is java/lang/Integer))) + (is Any + (case ?flag + {.#Some _} + "" + + {.#None} + (is java/lang/Object (ffi.null)))) + (is Any value)])) _ - (exception.except ..unknown_kind_of_object [(ffi.:as java/lang/Object host_object)]))) + (exception.except ..unknown_kind_of_object [(ffi.as java/lang/Object host_object)]))) (exception: .public nil_has_no_lux_representation) @@ -317,7 +317,7 @@ (def: lux_unit org/jruby/runtime/builtin/IRubyObject - (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime (ffi.as_string "")))) (def: (wrapped_lux_value useful_object_class lux_structure) @@ -332,22 +332,22 @@ {.#Some value} (|> value <then> - (ffi.:as org/jruby/runtime/builtin/IRubyObject)) + (ffi.as org/jruby/runtime/builtin/IRubyObject)) {.#None})] - [[java/lang/Object] (<| lux_structure (:as (Array java/lang/Object)))] + [[java/lang/Object] (<| lux_structure (as (Array java/lang/Object)))] [java/lang/Boolean (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime)] [java/lang/Long (org/jruby/RubyFixnum::new ..initial_ruby_runtime)] [java/lang/Double (org/jruby/RubyFloat::new ..initial_ruby_runtime)] [java/lang/String (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime)] [org/jruby/runtime/builtin/IRubyObject (<|)] )) - ... (:as org/jruby/runtime/builtin/IRubyObject value) - (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + ... (as org/jruby/runtime/builtin/IRubyObject value) + (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime - (useful_object_class again (:as (Array java/lang/Object) value)) - (ffi.:as java/lang/Object value))))))) + (useful_object_class again (as (Array java/lang/Object) value)) + (ffi.as java/lang/Object value))))))) (exception: (invalid_variant_access [field Text]) (exception.report @@ -377,7 +377,7 @@ org/jruby/RubyClass) (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)) - (<| (ffi.:as org/jruby/internal/runtime/methods/DynamicMethod) + (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] [java/lang/String (ffi.as_string "call")] @@ -401,43 +401,43 @@ list.indices (list#each (function (_ index) (ffi.read! index args))) - (monad.each ! (|>> (ffi.:as java/lang/Object) ..read))) + (monad.each ! (|>> (ffi.as java/lang/Object) ..read))) output (case args (pattern (list arg/0)) - (in ((:as (-> Any java/lang/Object) value) + (in ((as (-> Any java/lang/Object) value) arg/0)) (pattern (list arg/0 arg/1)) - (in ((:as (-> Any Any java/lang/Object) value) + (in ((as (-> Any Any java/lang/Object) value) arg/0 arg/1)) (pattern (list arg/0 arg/1 arg/2)) - (in ((:as (-> Any Any Any java/lang/Object) value) + (in ((as (-> Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2)) (pattern (list arg/0 arg/1 arg/2 arg/3)) - (in ((:as (-> Any Any Any Any java/lang/Object) value) + (in ((as (-> Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3)) (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4)) - (in ((:as (-> Any Any Any Any Any java/lang/Object) value) + (in ((as (-> Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4)) (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5)) - (in ((:as (-> Any Any Any Any Any Any java/lang/Object) value) + (in ((as (-> Any Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4 arg/5)) (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6)) - (in ((:as (-> Any Any Any Any Any Any Any java/lang/Object) value) + (in ((as (-> Any Any Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6)) (pattern (list arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6 arg/7)) - (in ((:as (-> Any Any Any Any Any Any Any Any java/lang/Object) value) + (in ((as (-> Any Any Any Any Any Any Any Any java/lang/Object) value) arg/0 arg/1 arg/2 arg/3 arg/4 arg/5 arg/6 arg/7)) _ (exception.except ..invalid_arity [arity]))] - (in (wrapped_lux_value (:expected useful_object_class) lux_structure output))))))))) + (in (wrapped_lux_value (as_expected useful_object_class) lux_structure output))))))))) (def: (::access useful_object_class lux_structure value) (-> (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) @@ -445,7 +445,7 @@ org/jruby/RubyClass) (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod)) - (<| (ffi.:as org/jruby/internal/runtime/methods/DynamicMethod) + (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] [java/lang/String (ffi.as_string "[]")] @@ -467,7 +467,7 @@ {.#Some member} (case (array.read! (.nat (ffi.of_long (org/jruby/RubyFixnum::getLongValue member))) value) {.#Some value} - (wrapped_lux_value (:expected useful_object_class) lux_structure value) + (wrapped_lux_value (as_expected useful_object_class) lux_structure value) {.#None} ..ruby_nil) @@ -480,10 +480,10 @@ (|> value (array.read! 0) maybe.trusted - (:as java/lang/Integer) + (as java/lang/Integer) java/lang/Integer::longValue (org/jruby/RubyFixnum::new ..initial_ruby_runtime) - (ffi.:as org/jruby/runtime/builtin/IRubyObject)) + (ffi.as org/jruby/runtime/builtin/IRubyObject)) (pattern (static runtime.variant_flag_field)) (case (array.read! 1 value) @@ -496,7 +496,7 @@ (pattern (static runtime.variant_value_field)) (case (array.read! 2 value) {.#Some value} - (wrapped_lux_value (:expected useful_object_class) lux_structure value) + (wrapped_lux_value (as_expected useful_object_class) lux_structure value) {.#None} (panic! (exception.error ..nil_has_no_lux_representation []))) @@ -515,14 +515,14 @@ (lux_structure (java/util/Arrays::copyOfRange value (ffi.as_int first) (ffi.as_int (i.+ first size))))) _ - (panic! (exception.error ..invalid_index [(ffi.:as java/lang/Object member)]))) + (panic! (exception.error ..invalid_index [(ffi.as java/lang/Object member)]))) {.#None}) - (panic! (exception.error ..invalid_index [(ffi.:as java/lang/Object member)])))))))) + (panic! (exception.error ..invalid_index [(ffi.as java/lang/Object member)])))))))) (def: (::= value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) - (<| (ffi.:as org/jruby/internal/runtime/methods/DynamicMethod) + (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] [java/lang/String (ffi.as_string "==")] @@ -539,22 +539,22 @@ args [org/jruby/runtime/builtin/IRubyObject] block org/jruby/runtime/Block]) org/jruby/runtime/builtin/IRubyObject - (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime) ffi.as_boolean (case (|> args (ffi.read! 0) - (ffi.:as java/lang/Object) + (ffi.as java/lang/Object) ..read) {try.#Success reference} - (same? (: Any reference) (: Any value)) + (same? (is Any reference) (is Any value)) {try.#Failure error} false)))))) (def: (::length value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) - (<| (ffi.:as org/jruby/internal/runtime/methods/DynamicMethod) + (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] [java/lang/String (ffi.as_string "length")] @@ -576,11 +576,11 @@ .int ffi.as_long (org/jruby/RubyFixnum::new ..initial_ruby_runtime) - (ffi.:as org/jruby/runtime/builtin/IRubyObject)))))) + (ffi.as org/jruby/runtime/builtin/IRubyObject)))))) (def: (::to_s value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) - (<| (ffi.:as org/jruby/internal/runtime/methods/DynamicMethod) + (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] [java/lang/String (ffi.as_string "to_s")] @@ -601,7 +601,7 @@ debug.inspection ffi.as_string (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime) - (ffi.:as org/jruby/runtime/builtin/IRubyObject)))))) + (ffi.as org/jruby/runtime/builtin/IRubyObject)))))) (exception: (invalid_operation [method Text]) (exception.report @@ -609,7 +609,7 @@ (def: (::respond_to? value) (-> (Array java/lang/Object) org/jruby/internal/runtime/methods/DynamicMethod) - (<| (ffi.:as org/jruby/internal/runtime/methods/DynamicMethod) + (<| (ffi.as org/jruby/internal/runtime/methods/DynamicMethod) (ffi.object [] org/jruby/internal/runtime/methods/DynamicMethod [] [java/lang/String (ffi.as_string "respond_to?")] @@ -644,7 +644,7 @@ false) ffi.as_boolean (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime) - (ffi.:as org/jruby/runtime/builtin/IRubyObject)) + (ffi.as org/jruby/runtime/builtin/IRubyObject)) {.#None} (panic! (exception.error ..invalid_operation ["respond_to?"]))))))) @@ -657,7 +657,7 @@ (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (Array java/lang/Object) org/jruby/RubyClass) - (<| (ffi.:as org/jruby/RubyClass) + (<| (ffi.as org/jruby/RubyClass) (ffi.object [] org/jruby/RubyClass [] [org/jruby/Ruby ..initial_ruby_runtime] @@ -688,10 +688,10 @@ (def: (lux_structure value) (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) - (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (org/jruby/java/proxies/JavaProxy::new ..initial_ruby_runtime (useful_object_class lux_structure value) - (ffi.:as java/lang/Object value)))) + (ffi.as java/lang/Object value)))) (exception: (cannot_apply_a_non_function [object java/lang/Object]) (exception.report @@ -699,24 +699,24 @@ (def: macro! (-> Macro (Maybe org/jruby/RubyProc)) - (|>> (:as java/lang/Object) + (|>> (as java/lang/Object) (ffi.check org/jruby/RubyProc))) (def: to_host (-> Any org/jruby/runtime/builtin/IRubyObject) - (|>> (:as (Array java/lang/Object)) + (|>> (as (Array java/lang/Object)) ..lux_structure)) (def: (call_macro inputs lux macro) (-> (List Code) Lux org/jruby/RubyProc (Try (Try [Lux (List Code)]))) - (:expected + (as_expected (do try.monad [expansion (org/jruby/RubyProc::call (!ruby_thread_context) (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 2) (ffi.write! 0 (..to_host inputs)) (ffi.write! 1 (..to_host lux))) macro)] - (..read (ffi.:as java/lang/Object expansion))))) + (..read (ffi.as java/lang/Object expansion))))) (def: (expander macro inputs lux) Expander @@ -725,53 +725,53 @@ (case (call_macro inputs lux macro) {try.#Success output} (|> output - (:as java/lang/Object) + (as java/lang/Object) ..read - (:as (Try (Try [Lux (List Code)])))) + (as (Try (Try [Lux (List Code)])))) {try.#Failure error} {try.#Failure error}) {.#None} - (exception.except ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))) + (exception.except ..cannot_apply_a_non_function [(as java/lang/Object macro)]))) (def: host (IO (Host _.Expression _.Statement)) - (io (let [run! (: (-> (_.Code Any) (Try Any)) - (function (_ code) - (do try.monad - [output (org/jruby/embed/ScriptingContainer::runScriptlet (ffi.as_string (_.code code)) ..interpreter)] - (..read (maybe.else (:as java/lang/Object []) - output)))))] - (: (Host _.Expression _.Statement) - (implementation - (def: (evaluate context [_ code]) - (run! code)) - - (def: execute run!) - - (def: (define context custom [_ input]) - (let [global (maybe.else (reference.artifact context) - custom) - @global (_.global global)] - (do try.monad - [.let [definition (_.set (list @global) input)] - value (run! definition)] - (in [global value definition])))) - - (def: (ingest context content) - (|> content - (# utf8.codec decoded) - try.trusted - (:as _.Statement))) - - (def: (re_learn context custom content) - (run! content)) - - (def: (re_load context custom content) - (do try.monad - [_ (run! content)] - (run! (_.global (reference.artifact context)))))))))) + (io (let [run! (is (-> (_.Code Any) (Try Any)) + (function (_ code) + (do try.monad + [output (org/jruby/embed/ScriptingContainer::runScriptlet (ffi.as_string (_.code code)) ..interpreter)] + (..read (maybe.else (as java/lang/Object []) + output)))))] + (is (Host _.Expression _.Statement) + (implementation + (def: (evaluate context [_ code]) + (run! code)) + + (def: execute run!) + + (def: (define context custom [_ input]) + (let [global (maybe.else (reference.artifact context) + custom) + @global (_.global global)] + (do try.monad + [.let [definition (_.set (list @global) input)] + value (run! definition)] + (in [global value definition])))) + + (def: (ingest context content) + (|> content + (# utf8.codec decoded) + try.trusted + (as _.Statement))) + + (def: (re_learn context custom content) + (run! content)) + + (def: (re_load context custom content) + (do try.monad + [_ (run! content)] + (run! (_.global (reference.artifact context)))))))))) (for @.jvm (as_is (exception: .public (invaid_phase_application [partial_application (List Any) arity (List Any)]) @@ -795,7 +795,7 @@ (def: phase_block_body org/jruby/runtime/BlockBody - (<| (ffi.:as org/jruby/runtime/BlockBody) + (<| (ffi.as org/jruby/runtime/BlockBody) (ffi.object [] org/jruby/runtime/BlockBody [] [org/jruby/runtime/Signature ..phase_block_signature] ... Methods @@ -851,13 +851,13 @@ (do [! try.monad] [inputs (|> inputs (array.list {.#None}) - (monad.each ! (|>> (ffi.:as java/lang/Object) ..read)))]) + (monad.each ! (|>> (ffi.as java/lang/Object) ..read)))]) (case inputs ... It seems that org/jruby/runtime/Block::call can misbehave when getting called with a Lux state value. (pattern (list info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host)) (case partial_application (pattern (list partial/0 partial/1)) - (in (..to_host ((:as (-> Any Any Any Any) phase) + (in (..to_host ((as (-> Any Any Any Any) phase) partial/0 partial/1 [info source location current_module modules scopes type_context expected seed scope_type_vars extensions eval host]))) @@ -866,21 +866,21 @@ (exception.except ..invaid_phase_application [partial_application inputs])) (pattern (list)) - {try.#Success (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + {try.#Success (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (host_phase partial_application phase))} (pattern (list input/0)) (case partial_application (pattern (list)) - (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (in (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (host_phase (list input/0) phase))) (pattern (list partial/0)) - (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (in (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (host_phase (list partial/0 input/0) phase))) (pattern (list partial/0 partial/1)) - (in (..to_host ((:as (-> Any Any Any Any) phase) + (in (..to_host ((as (-> Any Any Any Any) phase) partial/0 partial/1 input/0))) @@ -891,11 +891,11 @@ (pattern (list input/0 input/1)) (case partial_application (pattern (list)) - (in (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (in (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (host_phase (list input/0 input/1) phase))) (pattern (list partial/0)) - (in (..to_host ((:as (-> Any Any Any Any) phase) + (in (..to_host ((as (-> Any Any Any Any) phase) partial/0 input/0 input/1))) @@ -906,7 +906,7 @@ (pattern (list input/0 input/1 input/2)) (case partial_application (pattern (list)) - (in (..to_host ((:as (-> Any Any Any Any) phase) + (in (..to_host ((as (-> Any Any Any Any) phase) input/0 input/1 input/2))) @@ -921,39 +921,39 @@ (def: (extender phase_wrapper) (-> phase.Wrapper Extender) ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (do try.monad [handler (try.of_maybe (..macro! handler)) output (org/jruby/RubyProc::call (!ruby_thread_context) (|> (ffi.array org/jruby/runtime/builtin/IRubyObject 5) - (ffi.write! 0 (<| (ffi.:as org/jruby/runtime/builtin/IRubyObject) + (ffi.write! 0 (<| (ffi.as org/jruby/runtime/builtin/IRubyObject) (org/jruby/RubyString::newInternalFromJavaExternal (!ruby_runtime) (ffi.as_string name)))) - (ffi.write! 1 (:as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase))) + (ffi.write! 1 (as org/jruby/runtime/builtin/IRubyObject (phase_wrapper phase))) (ffi.write! 2 (..to_host archive)) (ffi.write! 3 (..to_host parameters)) (ffi.write! 4 (..to_host state))) handler)] - (..read (ffi.:as java/lang/Object output)))))) + (..read (ffi.as java/lang/Object output)))))) @.ruby (def: (extender phase_wrapper handler) (-> phase.Wrapper Extender) - (:expected handler))) + (as_expected handler))) (def: (phase_wrapper archive) (-> Archive (runtime.Operation phase.Wrapper)) (<| phase#in - (:as phase.Wrapper) + (as phase.Wrapper) (for @.jvm (..host_phase (list)) @.ruby (|>>)))) @@ -973,7 +973,7 @@ (let [normal_runtime? (_.do "const_defined?" (list (_.string (_.code _.command_line_arguments))) {.#None} - (: _.CVar (_.manual "Object")))] + (is _.CVar (_.manual "Object")))] (_.statement (_.apply_lambda/* (list (runtime.lux//program_args (_.? normal_runtime? _.command_line_arguments diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux index 50d4e2220..7689755c5 100644 --- a/lux-scheme/source/program.lux +++ b/lux-scheme/source/program.lux @@ -139,10 +139,10 @@ (def: (variant? value) (-> Any Bit) - (case (ffi.check [java/lang/Object] (:as java/lang/Object value)) + (case (ffi.check [java/lang/Object] (as java/lang/Object value)) {.#Some array} ... TODO: Get rid of this coercion ASAP. - (let [array (:as (Array java/lang/Object) array)] + (let [array (as (Array java/lang/Object) array)] (and (n.= 3 (array.size array)) (case (array.read! 0 array) {.#Some tag} @@ -178,7 +178,7 @@ ... Methods (program/VariantValue [] (getValue self []) java/lang/Object - (:as java/lang/Object value)) + (as java/lang/Object value)) (gnu/lists/Pair [] (getCar self []) java/lang/Object (if cdr? @@ -191,7 +191,7 @@ (|> value (array.read! 0) maybe.trusted - (:as java/lang/Integer) + (as java/lang/Integer) gnu/math/IntNum::new))) (gnu/lists/Pair [] (getCdr self []) java/lang/Object @@ -209,14 +209,14 @@ ... Methods (program/TupleValue [] (getValue self []) java/lang/Object - (:as java/lang/Object value)) + (as java/lang/Object value)) (gnu/lists/SimpleVector [] (getBufferLength self []) int (ffi.long_to_int (array.size value))) (gnu/lists/SimpleVector [] (getRaw self [idx int]) java/lang/Object (|> value - (array.read! (|> idx java/lang/Integer::longValue (:as Nat))) + (array.read! (|> idx java/lang/Integer::longValue (as Nat))) maybe.trusted lux_value)) (gnu/lists/SimpleVector @@ -252,8 +252,8 @@ {.#Some value} ... TODO: Get rid of the coercions below. (if (variant? value) - (variant_value lux_value false (:as (Array java/lang/Object) value)) - (tuple_value lux_value (:as (Array java/lang/Object) value))) + (variant_value lux_value false (as (Array java/lang/Object) value)) + (tuple_value lux_value (as (Array java/lang/Object) value))) {.#None}) value)) @@ -263,40 +263,40 @@ (def: (variant tag flag value) (-> Nat Bit Any Any) - [(java/lang/Long::intValue (:as java/lang/Long tag)) - (: Any - (if flag - synthesis.unit - (ffi.null))) + [(java/lang/Long::intValue (as java/lang/Long tag)) + (is Any + (if flag + synthesis.unit + (ffi.null))) value]) (def: (read_variant read host_object) (-> (Reader java/lang/Object) (Reader gnu/lists/Pair)) (do try.monad [tag (read (gnu/lists/Pair::getCar host_object)) - #let [host_object (:as gnu/lists/Pair (gnu/lists/Pair::getCdr host_object)) + #let [host_object (as gnu/lists/Pair (gnu/lists/Pair::getCdr host_object)) flag (case (ffi.check java/lang/Boolean (gnu/lists/Pair::getCar host_object)) {.#Some flag} - (:as Bit flag) + (as Bit flag) {.#None} (undefined))] value (read (gnu/lists/Pair::getCdr host_object))] - (wrap (..variant (:as Nat tag) flag value)))) + (wrap (..variant (as Nat tag) flag value)))) (def: (read_tuple read host_object) (-> (Reader java/lang/Object) (Reader (gnu/lists/FVector java/lang/Object))) (let [size (.nat (gnu/lists/FVector::getBufferLength host_object))] (loop [idx 0 - output (: (Array Any) - (array.new size))] + output (is (Array Any) + (array.new size))] (if (n.< size idx) (case (read (gnu/lists/FVector::getRaw (.int idx) host_object)) {try.#Failure error} {try.#Failure error} {try.#Success lux_value} - (again (++ idx) (array.write! idx (: Any lux_value) output))) + (again (++ idx) (array.write! idx (is Any lux_value) output))) {try.#Success output})))) (def: (read host_object) @@ -336,7 +336,7 @@ {.#None}) (case (ffi.check gnu/lists/FVector host_object) {.#Some host_object} - (read_tuple read (:as (gnu/lists/FVector java/lang/Object) host_object)) + (read_tuple read (as (gnu/lists/FVector java/lang/Object) host_object)) {.#None}) ... else @@ -344,62 +344,62 @@ (def: ensure_macro (-> Macro (Maybe gnu/mapping/Procedure)) - (|>> (:as java/lang/Object) (ffi.check gnu/mapping/Procedure))) + (|>> (as java/lang/Object) (ffi.check gnu/mapping/Procedure))) (def: (expander macro inputs lux) Expander (case (..ensure_macro macro) {.#Some macro} - (case (gnu/mapping/Procedure::apply2 (lux_value (:as java/lang/Object inputs)) - (lux_value (:as java/lang/Object lux)) + (case (gnu/mapping/Procedure::apply2 (lux_value (as java/lang/Object inputs)) + (lux_value (as java/lang/Object lux)) macro) {try.#Success output} (|> output ..read - (:as (Try (Try [Lux (List Code)])))) + (as (Try (Try [Lux (List Code)])))) {try.#Failure error} {try.#Failure error}) {.#None} - (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro)))) + (exception.throw ..cannot_apply_a_non_function (as java/lang/Object macro)))) (def: host (IO (Host _.Expression _.Expression)) (io (let [interpreter (kawa/standard/Scheme::getR7rsInstance) - run! (: (-> (_.Code Any) (Try Any)) - (function (_ input) - (do try.monad - [output (gnu/expr/Language::eval (_.code input) interpreter)] - (read output))))] - (: (Host _.Expression _.Expression) - (structure - (def: (evaluate! context code) - (run! code)) - - (def: (execute! input) - (gnu/expr/Language::eval (_.code input) interpreter)) - - (def: (define! context input) - (let [global (reference.artifact context) - @global (_.var global)] - (do try.monad - [#let [definition (_.define_constant @global input)] - _ (gnu/expr/Language::eval (_.code definition) interpreter) - value (run! @global)] - (wrap [global value definition])))) - - (def: (ingest context content) - (|> content (# encoding.utf8 decoded) try.trusted (:as _.Expression))) - - (def: (re_learn context content) - (run! content)) - - (def: (re_load context content) - (do try.monad - [_ (run! content)] - (run! (_.var (reference.artifact context))))) - ))))) + run! (is (-> (_.Code Any) (Try Any)) + (function (_ input) + (do try.monad + [output (gnu/expr/Language::eval (_.code input) interpreter)] + (read output))))] + (is (Host _.Expression _.Expression) + (structure + (def: (evaluate! context code) + (run! code)) + + (def: (execute! input) + (gnu/expr/Language::eval (_.code input) interpreter)) + + (def: (define! context input) + (let [global (reference.artifact context) + @global (_.var global)] + (do try.monad + [#let [definition (_.define_constant @global input)] + _ (gnu/expr/Language::eval (_.code definition) interpreter) + value (run! @global)] + (wrap [global value definition])))) + + (def: (ingest context content) + (|> content (# encoding.utf8 decoded) try.trusted (as _.Expression))) + + (def: (re_learn context content) + (run! content)) + + (def: (re_load context content) + (do try.monad + [_ (run! content)] + (run! (_.var (reference.artifact context))))) + ))))) (def: platform (IO (Platform _.Var _.Expression _.Expression)) @@ -424,31 +424,31 @@ (def: extender Extender ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) + (<| (as Extender) (function (@self handler)) - (:as Handler) + (as Handler) (function (@self name phase)) - (:as Phase) + (as Phase) (function (@self archive parameters)) - (:as Operation) + (as Operation) (function (@self state)) - (:as Try) + (as Try) try.trusted - (:as Try) + (as Try) (do try.monad - [handler (try.from_maybe (..ensure_macro (:as Macro handler))) - output (gnu/mapping/Procedure::applyN (array.from_list (list (lux_value (:as java/lang/Object name)) - (lux_value (:as java/lang/Object phase)) - (lux_value (:as java/lang/Object archive)) - (lux_value (:as java/lang/Object parameters)) - (lux_value (:as java/lang/Object state)))) + [handler (try.from_maybe (..ensure_macro (as Macro handler))) + output (gnu/mapping/Procedure::applyN (array.from_list (list (lux_value (as java/lang/Object name)) + (lux_value (as java/lang/Object phase)) + (lux_value (as java/lang/Object archive)) + (lux_value (as java/lang/Object parameters)) + (lux_value (as java/lang/Object state)))) handler)] (..read output)))) @.scheme (def: (extender handler) Extender - (:expected handler))) + (as_expected handler))) (def: (declare_success! _) (-> Any (Promise Any)) diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index bbefd85a6..823f6efc4 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -172,15 +172,15 @@ (documentation: /.list "List literals." - [(: (List Nat) - (list 0 1 2 3))]) + [(is (List Nat) + (list 0 1 2 3))]) (documentation: /.list& "List literals, with the last element being a tail-list." - [(: (List Nat) - (list& 0 1 2 3 - (: (List Nat) - (list 4 5 6))))]) + [(is (List Nat) + (list& 0 1 2 3 + (is (List Nat) + (list 4 5 6))))]) (documentation: /.Union "Union types." @@ -307,15 +307,15 @@ [(type (All (_ a) (Maybe (List a))))]) -(documentation: /.: +(documentation: /.is "The type-annotation macro." - [(: (List Int) - (list +1 +2 +3))]) + [(is (List Int) + (list +1 +2 +3))]) -(documentation: /.:as +(documentation: /.as "The type-coercion macro." - [(:as Dinosaur - (list +1 +2 +3))]) + [(as Dinosaur + (list +1 +2 +3))]) (documentation: /.Rec "Parameter-less recursive types." @@ -350,8 +350,8 @@ (documentation: /.case (format "The pattern-matching macro." \n "Allows the usage of macros within the patterns to provide custom syntax.") - [(case (: (List Int) - (list +1 +2 +3)) + [(case (is (List Int) + (list +1 +2 +3)) {#Item x {#Item y {#Item z {#End}}}} {#Some ($_ * x y z)} @@ -361,8 +361,8 @@ (documentation: /.pattern (format "Macro-expanding patterns." \n "It's a special macro meant to be used with 'case'.") - [(case (: (List Int) - (list +1 +2 +3)) + [(case (is (List Int) + (list +1 +2 +3)) (pattern (list x y z)) {#Some ($_ * x y z)} @@ -400,16 +400,16 @@ (documentation: /.function "Syntax for creating functions." - [(: (All (_ a b) - (-> a b a)) - (function (_ x y) - x))] + [(is (All (_ a b) + (-> a b a)) + (function (_ x y) + x))] ["Allows for giving the function itself a name, for the sake of recursion." - (: (-> Nat Nat) - (function (factorial n) - (case n - 0 1 - _ (* n (factorial (-- n))))))]) + (is (-> Nat Nat) + (function (factorial n) + (case n + 0 1 + _ (* n (factorial (-- n))))))]) (documentation: /.def: "Defines global constants/functions." @@ -464,13 +464,13 @@ (documentation: /.implementation "Express a value that implements an interface." - [(: (Order Int) - (implementation - (def: &equivalence - equivalence) - (def: (< reference subject) - (< reference subject)) - ))]) + [(is (Order Int) + (implementation + (def: &equivalence + equivalence) + (def: (< reference subject) + (< reference subject)) + ))]) (documentation: /.implementation: "Interface implementation." @@ -510,10 +510,10 @@ "Interface definition." [(type: .public (Order a) (Interface - (: (Equivalence a) - &equivalence) - (: (-> a a Bit) - <)))]) + (is (Equivalence a) + &equivalence) + (is (-> a a Bit) + <)))]) (.template [<name>] [(documentation: <name> @@ -765,15 +765,15 @@ "=>" ["documentation/lux" "#doc"]]) -(documentation: /.:parameter +(documentation: /.parameter (format "WARNING: Please stay away from this macro; it's very likely to be removed in a future version of Lux." "Allows you to refer to the type-variables in a polymorphic function's type, by their index.") ["In the example below, 0 corresponds to the 'a' variable." (def: .public (of_list list) (All (_ a) (-> (List a) (Sequence a))) (list#mix add - (: (Sequence (:parameter 0)) - empty) + (is (Sequence (parameter 0)) + empty) list))]) (documentation: /.same? @@ -801,11 +801,11 @@ (^|> value [++ (% 10) (max 1)]) (foo value))]) -(documentation: /.:expected +(documentation: /.as_expected "Coerces the given expression to the type of whatever is expected." - [(: Dinosaur - (:expected (: (List Nat) - (list 1 2 3))))]) + [(is Dinosaur + (as_expected (is (List Nat) + (list 1 2 3))))]) (documentation: /.undefined (format "Meant to be used as a stand-in for functions with undefined implementations." @@ -815,13 +815,13 @@ (-> Int Int) (undefined))]) -(documentation: /.:of +(documentation: /.type_of "Generates the type corresponding to a given expression." [(let [my_num +123] - (:of my_num)) + (type_of my_num)) "==" Int] - [(:of +123) + [(type_of +123) "==" Int]) @@ -842,8 +842,8 @@ (documentation: /.char "If given a 1-character text literal, yields the char-code of the sole character." - [(: Nat - (char "A")) + [(is Nat + (char "A")) "=>" 65]) @@ -865,13 +865,13 @@ (documentation: /.^code "Generates pattern-matching code for Code values in a way that looks like code-templating." - [(: (Maybe Nat) - (case (` (#0 123 +456.789)) - (^code (#0 (~ [_ {.#Nat number}]) +456.789)) - {.#Some number} + [(is (Maybe Nat) + (case (` (#0 123 +456.789)) + (^code (#0 (~ [_ {.#Nat number}]) +456.789)) + {.#Some number} - _ - {.#None}))]) + _ + {.#None}))]) (documentation: /.false "The boolean FALSE value.") @@ -879,24 +879,19 @@ (documentation: /.true "The boolean TRUE value.") -(documentation: /.:let - "Local bindings for types." - [(:let [side (Either Int Frac)] - (List [side side]))]) - (documentation: /.try "" - [(: Foo - (case (: (Either Text Bar) - (try (: Bar - (risky computation which may panic)))) - {.#Right success} - (: Foo - (do something after success)) - - {.#Left error} - (: Foo - (recover from error))))]) + [(is Foo + (case (is (Either Text Bar) + (try (is Bar + (risky computation which may panic)))) + {.#Right success} + (is Foo + (do something after success)) + + {.#Left error} + (is Foo + (recover from error))))]) (.def: .public documentation (.List $.Module) @@ -954,8 +949,8 @@ ..template ..not ..type - ..: - ..:as + ..is + ..as ..Rec ..exec ..case @@ -997,13 +992,13 @@ ..static ..^multi ..symbol - ..:parameter + ..parameter ..same? ..^let ..^|> - ..:expected + ..as_expected ..undefined - ..:of + ..type_of ..template: ..as_is ..char @@ -1012,7 +1007,6 @@ ..^code ..false ..true - ..:let ..try ($.default (/.Code' w)) ($.default /.Alias) diff --git a/stdlib/source/documentation/lux/abstract/codec.lux b/stdlib/source/documentation/lux/abstract/codec.lux index 567a27e79..d39113c45 100644 --- a/stdlib/source/documentation/lux/abstract/codec.lux +++ b/stdlib/source/documentation/lux/abstract/codec.lux @@ -1,20 +1,20 @@ (.using - [library - [lux - ["$" documentation {"+" documentation:}]]] - [\\library - ["[0]" /]]) + [library + [lux + ["$" documentation {"+" documentation:}]]] + [\\library + ["[0]" /]]) (documentation: (/.Codec medium value) "A way to move back-and-forth between a type and an alternative representation for it.") (documentation: /.composite "Codec composition." - [(: (Codec c a) - (composite (: (Codec c b) - cb_codec) - (: (Codec b a) - ba_codec)))]) + [(is (Codec c a) + (composite (is (Codec c b) + cb_codec) + (is (Codec b a) + ba_codec)))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index bb8be17d8..93dd86efa 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -1,20 +1,20 @@ (.using - [library - [lux {"-" if loop} - ["$" documentation {"+" documentation:}] - [data - [text - ["%" format {"+" format}]]] - [macro - ["[0]" template]] - [math - [number - ["n" nat] - ["i" int] - ["r" rev] - ["f" frac]]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" if loop} + ["$" documentation {"+" documentation:}] + [data + [text + ["%" format {"+" format}]]] + [macro + ["[0]" template]] + [math + [number + ["n" nat] + ["i" int] + ["r" rev] + ["f" frac]]]]] + [\\library + ["[0]" /]]) (documentation: /.=> "Concatenative function types." @@ -48,8 +48,8 @@ (documentation: /.apply "A generator for functions that turn arity N functions into arity N concatenative functions." - [(: (=> [Nat] [Nat]) - ((apply 1) ++))]) + [(is (=> [Nat] [Nat]) + ((apply 1) ++))]) (template [<arity>] [(with_expansions [<name> (template.symbol [/._] ["apply/" <arity>]) diff --git a/stdlib/source/documentation/lux/control/exception.lux b/stdlib/source/documentation/lux/control/exception.lux index 656b30a5a..96e970156 100644 --- a/stdlib/source/documentation/lux/control/exception.lux +++ b/stdlib/source/documentation/lux/control/exception.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" if loop} - ["$" documentation {"+" documentation:}] - [data - [text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" if loop} + ["$" documentation {"+" documentation:}] + [data + [text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Exception it) "An exception provides a way to decorate error messages.") @@ -46,11 +46,11 @@ (documentation: /.report "An error report." - [(: Text - (report ["Row 0" value/0] - ["Row 1" value/1] - ,,, - ["Row N" value/N]))]) + [(is Text + (report ["Row 0" value/0] + ["Row 1" value/1] + ,,, + ["Row N" value/N]))]) (documentation: /.listing (format "A numbered report of the entries on a list." diff --git a/stdlib/source/documentation/lux/control/security/policy.lux b/stdlib/source/documentation/lux/control/security/policy.lux index 9bb54bef8..2a373f04c 100644 --- a/stdlib/source/documentation/lux/control/security/policy.lux +++ b/stdlib/source/documentation/lux/control/security/policy.lux @@ -39,21 +39,21 @@ (type: (Policy %) (Interface - (: (-> Text (Password %)) - password) - (: (-> (Password %) Text) - unsafe))) + (is (-> Text (Password %)) + password) + (is (-> (Password %) Text) + unsafe))) (def: (policy _) (Ex (_ %) (-> Any (Policy %))) (with_policy - (: (Context Privacy Policy) - (function (_ (open "%::.")) - (implementation - (def: (password value) - (%::can_upgrade value)) - (def: (unsafe password) - (%::can_downgrade password)))))))] + (is (Context Privacy Policy) + (function (_ (open "%::.")) + (implementation + (def: (password value) + (%::can_upgrade value)) + (def: (unsafe password) + (%::can_downgrade password)))))))] [(with_policy context)]) (documentation: /.Privacy diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index 55af9dad9..3d719ee3e 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -1,19 +1,19 @@ (.using - [library - [lux {"-" list} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" list} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Sequence it) "A sequential data-structure with fast random access.") @@ -52,8 +52,8 @@ (documentation: /.sequence "Sequence literals." - [(: (Sequence Nat) - (sequence 12 34 56 78 90))]) + [(is (Sequence Nat) + (sequence 12 34 56 78 90))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux index 34d05eba3..f4287d194 100644 --- a/stdlib/source/documentation/lux/data/collection/tree.lux +++ b/stdlib/source/documentation/lux/data/collection/tree.lux @@ -1,20 +1,20 @@ (.using - [library - [lux {"-" list} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]] - ["[0]" / "_" - ["[1][0]" finger] - ["[1][0]" zipper]]) + [library + [lux {"-" list} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]] + ["[0]" / "_" + ["[1][0]" finger] + ["[1][0]" zipper]]) (documentation: (/.Tree it) "A generic tree data-structure.") @@ -33,11 +33,11 @@ (documentation: /.tree "Tree literals." - [(: (Tree Nat) - (tree 12 - {34 {} - 56 {} - 78 {90 {}}}))]) + [(is (Tree Nat) + (tree 12 + {34 {} + 56 {} + 78 {90 {}}}))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/debug.lux b/stdlib/source/documentation/lux/debug.lux index f50793f14..f40a14bde 100644 --- a/stdlib/source/documentation/lux/debug.lux +++ b/stdlib/source/documentation/lux/debug.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" private} - ["$" documentation {"+" documentation:}] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" private} + ["$" documentation {"+" documentation:}] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.inspection "A best-effort attempt to generate a textual representation of a value, without knowing its type." @@ -31,12 +31,12 @@ "Prints/writes a message to standard output." [(log! message)]) -(documentation: /.:hole +(documentation: /.hole (format "A typed 'hole'." \n "Reveals the type expected of the expression that should go in the hole.") - [(: (-> Nat Text) - (function (_ number) - (:hole))) + [(is (-> Nat Text) + (function (_ number) + (hole))) "=>" .Text]) @@ -45,8 +45,8 @@ [(let [foo 123 bar +456 baz +789.0] - (: Any - (here))) + (is Any + (here))) "=>" "foo: +123" "bar: +456" @@ -57,8 +57,8 @@ (let [foo 123 bar +456 baz +789.0] - (: Any - (here [foo %.nat] baz))) + (is Any + (here [foo %.nat] baz))) "=>" "foo: 123" "baz: +789.0" @@ -72,7 +72,7 @@ ..representation ..private ..log! - ..:hole + ..hole ..here ($.default /.cannot_represent_value) ($.default /.type_hole) diff --git a/stdlib/source/documentation/lux/documentation.lux b/stdlib/source/documentation/lux/documentation.lux index 711525027..f1ba6db85 100644 --- a/stdlib/source/documentation/lux/documentation.lux +++ b/stdlib/source/documentation/lux/documentation.lux @@ -1,39 +1,39 @@ (.using - [library - [lux "*" - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (/.documentation: /.default "" - [(: /.Definition - (default ..definition))]) + [(is /.Definition + (default ..definition))]) (/.documentation: /.documentation: "" [(documentation: /.default "" - [(: /.Definition - (default ..definition))])]) + [(is /.Definition + (default ..definition))])]) (/.documentation: /.module "" - [(: (.List /.Module) - (module /._ - "" - [..default - ..documentation: - ..module - (/.default /.unqualified_symbol) - (/.default /.Definition) - (/.default /.Module) - (/.default /.documentation)] - []))]) + [(is (.List /.Module) + (module /._ + "" + [..default + ..documentation: + ..module + (/.default /.unqualified_symbol) + (/.default /.Definition) + (/.default /.Module) + (/.default /.documentation)] + []))]) (.def: .public documentation (.List /.Module) diff --git a/stdlib/source/documentation/lux/ffi.js.lux b/stdlib/source/documentation/lux/ffi.js.lux index 81082ada3..df5a6f037 100644 --- a/stdlib/source/documentation/lux/ffi.js.lux +++ b/stdlib/source/documentation/lux/ffi.js.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" int char type :as} + [lux {"-" int char type} ["$" documentation {"+" documentation:}] [data ["[0]" text {"+" \n} @@ -46,9 +46,9 @@ (documentation: /.closure (format "Allows defining closures/anonymous-functions in the form that JavaScript expects." \n "This is useful for adapting Lux functions for usage by JavaScript code.") - [(: /.Function - (closure [left right] - (do_something (:as Foo left) (:as Bar right))))]) + [(is /.Function + (closure [left right] + (do_something (as Foo left) (as Bar right))))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index 5bf182890..510636c0f 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" int char type :as} + [lux {"-" int char type as} ["$" documentation {"+" documentation:}] [data ["[0]" text {"+" \n} @@ -141,7 +141,7 @@ (documentation: /.??? "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." - [(= (??? (: java/lang/String (null))) + [(= (??? (is java/lang/String (null))) {.#None})] [(= (??? "YOLO") {.#Some "YOLO"})]) @@ -150,7 +150,7 @@ (format "Takes a (Maybe ObjectType) and returns a ObjectType." \n "A .#None would get translated into a (null).") [(= (null) - (!!! (??? (: java/lang/Thread (null)))))] + (!!! (??? (is java/lang/Thread (null)))))] [(= "foo" (!!! (??? "foo")))]) @@ -245,13 +245,13 @@ (documentation: /.type "" - [(: Type - (type java/lang/String))]) + [(is Type + (type java/lang/String))]) -(documentation: /.:as +(documentation: /.as "" - [(:as java/lang/Object - (: java/lang/String + [(as java/lang/Object + (is java/lang/String ???))]) (.def: .public documentation @@ -322,7 +322,7 @@ ..write! ..class_for ..type - ..:as + ..as ($.default /.Privacy) ($.default /.State) ($.default /.Inheritance) diff --git a/stdlib/source/documentation/lux/ffi.lua.lux b/stdlib/source/documentation/lux/ffi.lua.lux index 79d6f03ac..0126a5117 100644 --- a/stdlib/source/documentation/lux/ffi.lua.lux +++ b/stdlib/source/documentation/lux/ffi.lua.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" int char type :as} + [lux {"-" int char type} ["$" documentation {"+" documentation:}] [data ["[0]" text {"+" \n} @@ -17,9 +17,9 @@ (documentation: /.closure (format "Allows defining closures/anonymous-functions in the form that Lua expects." \n "This is useful for adapting Lux functions for usage by Lua code.") - [(: ..Function - (closure [left right] - (do_something (:as Foo left) (:as Bar right))))]) + [(is ..Function + (closure [left right] + (do_something (as Foo left) (as Bar right))))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 56336a41b..926b70045 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" int char type :as} + [lux {"-" int char type} ["$" documentation {"+" documentation:}] [data ["[0]" text {"+" \n} @@ -104,7 +104,7 @@ (documentation: /.??? "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." - [(= (??? (: java/lang/String (null))) + [(= (??? (is java/lang/String (null))) {.#None})] [(= (??? "YOLO") {.#Some "YOLO"})]) @@ -115,7 +115,7 @@ (!!! (??? "foo")))] ["A .#None would get translated into a (null)." (= (null) - (!!! (??? (: java/lang/Thread (null)))))]) + (!!! (??? (is java/lang/Thread (null)))))]) (documentation: /.check (format "Checks whether an object is an instance of a particular class." @@ -204,13 +204,13 @@ (documentation: /.class_for "Loads the class as a java.lang.Class object." - [(: (Primitive "java.lang.Class" ["java.lang.Object"]) - (class_for java/lang/String))]) + [(is (Primitive "java.lang.Class" ["java.lang.Object"]) + (class_for java/lang/String))]) (documentation: /.type "" - [(: .Type - (type java/lang/String))]) + [(is .Type + (type java/lang/String))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/ffi.py.lux b/stdlib/source/documentation/lux/ffi.py.lux index 34a88e01d..40ea7878e 100644 --- a/stdlib/source/documentation/lux/ffi.py.lux +++ b/stdlib/source/documentation/lux/ffi.py.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" int char type :as} + [lux {"-" int char type} ["$" documentation {"+" documentation:}] [data ["[0]" text {"+" \n} @@ -37,10 +37,10 @@ (documentation: /.lambda (format "Allows defining closures/anonymous-functions in the form that Python expects." \n "This is useful for adapting Lux functions for usage by Python code.") - [(: ..Function - (lambda [left right] - (do_something (:as Foo left) - (:as Bar right))))]) + [(is ..Function + (lambda [left right] + (do_something (as Foo left) + (as Bar right))))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/ffi.rb.lux b/stdlib/source/documentation/lux/ffi.rb.lux index 01b883a84..822ad8146 100644 --- a/stdlib/source/documentation/lux/ffi.rb.lux +++ b/stdlib/source/documentation/lux/ffi.rb.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" int char type :as} - ["$" documentation {"+" documentation:}] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" int char type} + ["$" documentation {"+" documentation:}] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.import: "Easily import types, methods, functions and constants." diff --git a/stdlib/source/documentation/lux/static.lux b/stdlib/source/documentation/lux/static.lux index 245ca33bc..bcde2dad6 100644 --- a/stdlib/source/documentation/lux/static.lux +++ b/stdlib/source/documentation/lux/static.lux @@ -1,20 +1,20 @@ (.using - [library - [lux {"-" nat int rev} - ["$" documentation {"+" documentation:}] - [data - [text - ["%" format {"+" format}]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" nat int rev} + ["$" documentation {"+" documentation:}] + [data + [text + ["%" format {"+" format}]] + [collection + ["[0]" list]]]]] + [\\library + ["[0]" /]]) (template [<name> <type>] [(documentation: <name> (%.code (' (<name> - (: <type> - (value generating expression))))))] + (is <type> + (value generating expression))))))] [/.nat .Nat] [/.int .Int] @@ -26,15 +26,15 @@ (documentation: /.literal "" [(/.literal - (: (-> ??? Code) - format) - (: ??? - (value generating expression)))]) + (is (-> ??? Code) + format) + (is ??? + (value generating expression)))]) (template [<name> <type>] [(documentation: <name> - (%.code (' (: <type> - (<name>)))))] + (%.code (' (is <type> + (<name>)))))] [/.random_nat .Nat] [/.random_int .Int] @@ -45,10 +45,10 @@ (documentation: /.random "" [(/.random - (: (-> ??? Code) - format) - (: (Random ???) - (random data generator)))]) + (is (-> ??? Code) + format) + (is (Random ???) + (random data generator)))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index 5c4093923..295003e1d 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" and for} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" and for} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.Tally "A record of successes and failures while executing tests.") @@ -72,29 +72,29 @@ (format "Specifies a test as covering one or more definitions." \n "Adds to the test tally information to track which definitions have been tested.") [(cover' [definition/0 definition/1 ,,, definition/N] - (: Bit - (some "computation")))]) + (is Bit + (some "computation")))]) (documentation: /.cover (format "Specifies a test as covering one or more definitions." \n "Adds to the test tally information to track which definitions have been tested.") [(cover [definition/0 definition/1 ,,, definition/N] - (: Bit - (some "computation")))]) + (is Bit + (some "computation")))]) (documentation: /.for (format "Specifies a context for tests as covering one or more definitions." \n "Adds to the test tally information to track which definitions have been tested.") [(for [definition/0 definition/1 ,,, definition/N] - (: Test - some_test))]) + (is Test + some_test))]) (documentation: /.covering (format "Specifies the module being covered by a test." \n "Adds tracking information to the tally to know which exported definitions in the module need to be covered.") [(covering .._ - (: Test - some_test))]) + (is Test + some_test))]) (documentation: /.in_parallel "Executes multiple tests in parallel (if the host platform supports it) to take advantage of multiple cores." diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux index a39d5b2db..957dac26a 100644 --- a/stdlib/source/documentation/lux/type.lux +++ b/stdlib/source/documentation/lux/type.lux @@ -1,28 +1,28 @@ (.using - [library - [lux {"-" function :as} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]] - ["[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 {"-" function as let} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]] + ["[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]]) (template [<name>] [(documentation: <name> @@ -108,48 +108,53 @@ (documentation: /.array? "Is a type an array type?") -(documentation: /.:log! +(documentation: /.log! "Logs to the console/terminal the type of an expression." - [(:log! (: Foo (foo expression))) + [(log! (is Foo (foo expression))) "=>" "Expression: (foo expression)" " Type: Foo" (foo expression)]) -(documentation: /.:as +(documentation: /.as (%.format "Casts a value to a specific type." \n "The specified type can depend on type variables of the original type of the value." \n "NOTE: Careless use of type-casts is an easy way to introduce bugs. USE WITH CAUTION.") - [(: (Bar Bit Nat Text) - (:as [a b c] + [(is (Bar Bit Nat Text) + (as [a b c] (Foo a [b c]) (Bar a b c) - (: (Foo Bit [Nat Text]) - (foo expression))))]) + (is (Foo Bit [Nat Text]) + (foo expression))))]) -(documentation: /.:sharing +(documentation: /.sharing "Allows specifing the type of an expression as sharing type-variables with the type of another expression." - [(: (Bar Bit Nat Text) - (:sharing [a b c] + [(is (Bar Bit Nat Text) + (sharing [a b c] (Foo a [b c]) - (: (Foo Bit [Nat Text]) - (foo expression)) + (is (Foo Bit [Nat Text]) + (foo expression)) (Bar a b c) (bar expression)))]) -(documentation: /.:by_example +(documentation: /.by_example "Constructs a type that shares type-variables with an expression of some other type." - [(: Type - (:by_example [a b c] + [(is Type + (by_example [a b c] (Foo a [b c]) - (: (Foo Bit [Nat Text]) - (foo expression)) + (is (Foo Bit [Nat Text]) + (foo expression)) (Bar a b c))) "=>" (.type (Bar Bit Nat Text))]) +(documentation: /.let + "Local bindings for types." + [(let [side (Either Int Frac)] + (List [side side]))]) + (.def: .public documentation (.List $.Module) ($.module /._ @@ -175,10 +180,11 @@ ..array ..flat_array ..array? - ..:log! - ..:as - ..:sharing - ..:by_example + ..log! + ..as + ..sharing + ..by_example + ..let ($.default /.equivalence)] [/abstract.documentation /check.documentation diff --git a/stdlib/source/documentation/lux/type/abstract.lux b/stdlib/source/documentation/lux/type/abstract.lux index 62d1ea026..4fdf9e3fc 100644 --- a/stdlib/source/documentation/lux/type/abstract.lux +++ b/stdlib/source/documentation/lux/type/abstract.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" and} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" pattern} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.Frame "Meta-data about an abstract/nominal type in a stack of them.") @@ -23,18 +23,16 @@ "A specific abstract/nominal type still being defined somewhere in the scope." [(specific name)]) -(template [<name> <from> <to>] +(template [<name> <from> <$> <to>] [(documentation: <name> "Type-casting macro for abstract/nominal types." [(|> value - (: Representation) - :abstraction - (: Abstraction) - :representation - (: Representation))])] - - [/.:abstraction representation abstraction] - [/.:representation abstraction representation] + (is <from>) + <$> + (is <to>))])] + + [/.abstraction Representation abstraction Abstraction] + [/.representation Abstraction representation Representation] ) (documentation: /.abstract: @@ -45,44 +43,44 @@ (def: (string value) (-> Text String) - (:abstraction value)) + (abstraction value)) (def: (text value) (-> String Text) - (:representation value)))] + (representation value)))] ["Type-parameters are optional." (abstract: (Duplicate a) [a a] (def: (duplicate value) (All (_ a) (-> a (Duplicate a))) - (:abstraction [value value])))] + (abstraction [value value])))] ["Definitions can be nested." (abstract: (Single a) a (def: (single value) (All (_ a) (-> a (Single a))) - (:abstraction value)) + (abstraction value)) (abstract: (Double a) [a a] (def: (double value) (All (_ a) (-> a (Double a))) - (:abstraction [value value])) + (abstraction [value value])) (def: (single' value) (All (_ a) (-> a (Single a))) - (:abstraction Single [value value])) + (abstraction Single [value value])) (let [value 0123] (same? value (|> value single' - (:representation Single) + (representation Single) double - :representation)))))] + representation)))))] ["Type-parameters do not necessarily have to be used in the representation type." "If they are not used, they become phantom types and can be used to customize types without changing the representation." (abstract: (JavaScript a) @@ -93,17 +91,17 @@ (def: (+ x y) (-> (JavaScript Expression) (JavaScript Expression) (JavaScript Expression)) - (:abstraction - (format "(" (:representation x) "+" (:representation y) ")"))) + (abstraction + (format "(" (representation x) "+" (representation y) ")"))) (def: (while test body) (-> (JavaScript Expression) (JavaScript Statement) (JavaScript Statement)) - (:abstraction - (format "while(" (:representation test) ") {" - (:representation body) + (abstraction + (format "while(" (representation test) ") {" + (representation body) "}"))))]) -(documentation: /.:transmutation +(documentation: /.transmutation "Transmutes an abstract/nominal type's phantom types." [(abstract: (JavaScript a) Text @@ -113,17 +111,17 @@ (def: (statement expression) (-> (JavaScript Expression) (JavaScript Statement)) - (:transmutation expression)) + (transmutation expression)) (def: (statement' expression) (-> (JavaScript Expression) (JavaScript Statement)) - (:transmutation JavaScript expression)))]) + (transmutation JavaScript expression)))]) -(documentation: /.^:representation +(documentation: /.pattern "Pattern-matching macro to easily extract a representation." [(def: (computation abstraction) (All (_ a) (-> (Abstract a) ???)) - (let [(^:representation value) abstraction] + (let [(pattern value) abstraction] (foo (bar (baz value)))))]) (.def: .public documentation @@ -133,10 +131,10 @@ [..Frame ..current ..specific - ..:abstraction - ..:representation + ..abstraction + ..representation ..abstract: - ..:transmutation - ..^:representation + ..transmutation + ..pattern ($.default /.no_active_frames)] [])) diff --git a/stdlib/source/documentation/lux/type/dynamic.lux b/stdlib/source/documentation/lux/type/dynamic.lux index 03a8fd322..1140e6158 100644 --- a/stdlib/source/documentation/lux/type/dynamic.lux +++ b/stdlib/source/documentation/lux/type/dynamic.lux @@ -1,38 +1,38 @@ (.using - [library - [lux {"-" and} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" static} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: /.Dynamic "A value coupled with its type, so it can be checked later.") -(documentation: /.:dynamic +(documentation: /.dynamic "" - [(: Dynamic - (:dynamic 123))]) + [(is Dynamic + (dynamic 123))]) -(documentation: /.:static +(documentation: /.static "" - [(: (try.Try Nat) - (:static Nat (:dynamic 123)))]) + [(is (try.Try Nat) + (static Nat (dynamic 123)))]) (.def: .public documentation (.List $.Module) ($.module /._ "" [..Dynamic - ..:dynamic - ..:static + ..dynamic + ..static ($.default /.wrong_type) ($.default /.format)] [])) diff --git a/stdlib/source/documentation/lux/type/quotient.lux b/stdlib/source/documentation/lux/type/quotient.lux index 9b6289933..799645f81 100644 --- a/stdlib/source/documentation/lux/type/quotient.lux +++ b/stdlib/source/documentation/lux/type/quotient.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" type} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" type} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Class value label) "The class knows how to classify/label values that are meant to be equivalent to one another.") @@ -34,8 +34,8 @@ Type (type even)) - (: Even - (quotient even 123))]) + (is Even + (quotient even 123))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/type/refinement.lux b/stdlib/source/documentation/lux/type/refinement.lux index 008f64e82..bbe26014b 100644 --- a/stdlib/source/documentation/lux/type/refinement.lux +++ b/stdlib/source/documentation/lux/type/refinement.lux @@ -1,17 +1,17 @@ (.using - [library - [lux {"-" type} - ["$" documentation {"+" documentation:}] - [control - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" text {"+" \n} - ["%" format {"+" format}]]] - [macro - ["[0]" template]]]] - [\\library - ["[0]" /]]) + [library + [lux {"-" type} + ["$" documentation {"+" documentation:}] + [control + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" text {"+" \n} + ["%" format {"+" format}]]] + [macro + ["[0]" template]]]] + [\\library + ["[0]" /]]) (documentation: (/.Refined it) "A refined version of another type, using a predicate to select valid instances.") @@ -45,8 +45,8 @@ Type (type even)) - (: (Maybe Even) - (even 123))]) + (is (Maybe Even) + (even 123))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index aa5e5c476..7a80d68e7 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1365,10 +1365,10 @@ ... (type: (Monad m) ... (Interface -... (: (All (_ a) (-> a (m a))) -... #in) -... (: (All (_ a b) (-> (-> a (m b)) (m a) (m b))) -... #then))) +... (is (All (_ a) (-> a (m a))) +... #in) +... (is (All (_ a b) (-> (-> a (m b)) (m a) (m b))) +... #then))) ("lux def type tagged" Monad {#Named [..prelude_module "Monad"] (All (_ !) @@ -2261,7 +2261,7 @@ {#End}}}}}] (` ("lux in-module" (~ (text$ module)) (~ (normal_type type')))) - [_ {#Form {#Item [_ {#Symbol ["" ":~"]}] {#Item expression {#End}}}}] + [_ {#Form {#Item [_ {#Symbol ["" "~"]}] {#Item expression {#End}}}}] expression [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item body {#End}}}}] @@ -2311,7 +2311,7 @@ (failure "Wrong syntax for type")} tokens)) -(macro:' .public (: tokens) +(macro:' .public (is tokens) ({{#Item type {#Item value {#End}}} (meta#in (list (` ("lux type check" (..type (~ type)) @@ -2321,14 +2321,14 @@ (failure "Wrong syntax for :")} tokens)) -(macro:' .public (:as tokens) +(macro:' .public (as tokens) ({{#Item type {#Item value {#End}}} (meta#in (list (` ("lux type as" (..type (~ type)) (~ value))))) _ - (failure "Wrong syntax for :as")} + (failure "Wrong syntax for as")} tokens)) (def:''' .private (empty? xs) @@ -2377,22 +2377,22 @@ (list#reversed tokens))) (macro:' .private (def:' tokens) - (let' [parts (: (Maybe [Code Code (List Code) (Maybe Code) Code]) - ({{#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item type {#Item body {#End}}}}} - {#Some [export_policy name args {#Some type} body]} - - {#Item export_policy {#Item name {#Item type {#Item body {#End}}}}} - {#Some [export_policy name {#End} {#Some type} body]} - - {#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item body {#End}}}} - {#Some [export_policy name args {#None} body]} - - {#Item export_policy {#Item name {#Item body {#End}}}} - {#Some [export_policy name {#End} {#None} body]} - - _ - {#None}} - tokens))] + (let' [parts (is (Maybe [Code Code (List Code) (Maybe Code) Code]) + ({{#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item type {#Item body {#End}}}}} + {#Some [export_policy name args {#Some type} body]} + + {#Item export_policy {#Item name {#Item type {#Item body {#End}}}}} + {#Some [export_policy name {#End} {#Some type} body]} + + {#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item body {#End}}}} + {#Some [export_policy name args {#None} body]} + + {#Item export_policy {#Item name {#Item body {#End}}}} + {#Some [export_policy name {#End} {#None} body]} + + _ + {#None}} + tokens))] ({{#Some [export_policy name args ?type body]} (let' [body' ({{#End} body @@ -2401,7 +2401,7 @@ (` (function' (~ name) [(~+ args)] (~ body)))} args) body'' ({{#Some type} - (` (: (~ type) (~ body'))) + (` (is (~ type) (~ body'))) {#None} body'} @@ -2503,12 +2503,12 @@ {#Some bindings} (|> bindings list#reversed - (list#mix (: (-> [Code Code] Code Code) - (function' [lr body'] - (let' [[l r] lr] - (if (symbol? l) - (` ({(~ l) (~ body')} (~ r))) - (` (case (~ r) (~ l) (~ body'))))))) + (list#mix (is (-> [Code Code] Code Code) + (function' [lr body'] + (let' [[l r] lr] + (if (symbol? l) + (` ({(~ l) (~ body')} (~ r))) + (` (case (~ r) (~ l) (~ body'))))))) body) list meta#in) @@ -2520,22 +2520,22 @@ (failure "Wrong syntax for let"))) (macro:' .public (function tokens) - (case (: (Maybe [Text Code (List Code) Code]) - (case tokens - (pattern (list [_ {#Form (list& [_ {#Symbol ["" name]}] head tail)}] body)) - {#Some name head tail body} - - _ - {#None})) + (case (is (Maybe [Text Code (List Code) Code]) + (case tokens + (pattern (list [_ {#Form (list& [_ {#Symbol ["" name]}] head tail)}] body)) + {#Some name head tail body} + + _ + {#None})) {#Some g!name head tail body} (let [g!blank (local_symbol$ "") - nest (: (-> Code (-> Code Code Code)) - (function' [g!name] - (function' [arg body'] - (if (symbol? arg) - (` ([(~ g!name) (~ arg)] (~ body'))) - (` ([(~ g!name) (~ g!blank)] - (.case (~ g!blank) (~ arg) (~ body'))))))))] + nest (is (-> Code (-> Code Code Code)) + (function' [g!name] + (function' [arg body'] + (if (symbol? arg) + (` ([(~ g!name) (~ arg)] (~ body'))) + (` ([(~ g!name) (~ g!blank)] + (.case (~ g!blank) (~ arg) (~ body'))))))))] (meta#in (list (nest (..local_symbol$ g!name) head (list#mix (nest g!blank) body (list#reversed tail)))))) @@ -2750,8 +2750,8 @@ (~ body)))) body (case ?type {#Some type} - (` (: (~ type) - (~ body))) + (` (is (~ type) + (~ body))) {#None} body)] @@ -2809,8 +2809,8 @@ [(macro: .public (<name> tokens) (case (list#reversed tokens) (pattern (list& last init)) - (meta#in (list (list#mix (: (-> Code Code Code) - (function (_ pre post) (` <form>))) + (meta#in (list (list#mix (is (-> Code Code Code) + (function (_ pre post) (` <form>))) last init))) @@ -2831,7 +2831,7 @@ (macro: (maybe#else tokens state) (case tokens (pattern (list else maybe)) - (let [g!temp (: Code [dummy_location {#Symbol ["" ""]}]) + (let [g!temp (is Code [dummy_location {#Symbol ["" ""]}]) code (` (case (~ maybe) {.#Some (~ g!temp)} (~ g!temp) @@ -3125,34 +3125,34 @@ [tokens' (monad#each meta_monad expansion tokens) struct_type ..expected_type tags+type (record_slots struct_type) - tags (: (Meta (List Symbol)) - (case tags+type - {#Some [tags _]} - (meta#in tags) + tags (is (Meta (List Symbol)) + (case tags+type + {#Some [tags _]} + (meta#in tags) - _ - (failure ($_ text#composite - "No tags available for type: " - (type#encoded struct_type))))) - .let [tag_mappings (: (List [Text Code]) - (list#each (function (_ tag) - [(product#right tag) - (symbol$ tag)]) - tags))] + _ + (failure ($_ text#composite + "No tags available for type: " + (type#encoded struct_type))))) + .let [tag_mappings (is (List [Text Code]) + (list#each (function (_ tag) + [(product#right tag) + (symbol$ tag)]) + tags))] members (monad#each meta_monad - (: (-> Code (Meta (List Code))) - (function (_ token) - (case token - (pattern [_ {#Form (list [_ {#Text "lux def"}] [_ {#Symbol ["" slot_name]}] value export_policy)}]) - (case (plist#value slot_name tag_mappings) - {#Some tag} - (in (list tag value)) + (is (-> Code (Meta (List Code))) + (function (_ token) + (case token + (pattern [_ {#Form (list [_ {#Text "lux def"}] [_ {#Symbol ["" slot_name]}] value export_policy)}]) + (case (plist#value slot_name tag_mappings) + {#Some tag} + (in (list tag value)) - _ - (failure (text#composite "Unknown implementation member: " slot_name))) + _ + (failure (text#composite "Unknown implementation member: " slot_name))) - _ - (failure "Invalid implementation member.")))) + _ + (failure "Invalid implementation member.")))) (list#conjoint tokens'))] (in (list (tuple$ (list#conjoint members)))))) @@ -3336,14 +3336,14 @@ module_name current_module_name .let' [type_name (local_symbol$ name) [type labels??] type+labels?? - type' (: (Maybe Code) - (case args - {#End} - {#Some type} + type' (is (Maybe Code) + (case args + {#End} + {#Some type} - _ - {#Some (` (.All ((~ type_name) (~+ (list#each local_symbol$ args))) - (~ type)))}))]] + _ + {#Some (` (.All ((~ type_name) (~+ (list#each local_symbol$ args))) + (~ type)))}))]] (case type' {#Some type''} (let [typeC (` {.#Named [(~ (text$ module_name)) @@ -3398,14 +3398,14 @@ (def: (referral_references defs) (-> (List Code) (Meta (List Text))) (monad#each meta_monad - (: (-> Code (Meta Text)) - (function (_ def) - (case def - [_ {#Symbol ["" name]}] - (meta#in name) + (is (-> Code (Meta Text)) + (function (_ def) + (case def + [_ {#Symbol ["" name]}] + (meta#in name) - _ - (failure "only/+ and exclude/- require symbols.")))) + _ + (failure "only/+ and exclude/- require symbols.")))) defs)) (def: (referrals_parser tokens) @@ -3474,14 +3474,14 @@ (def: (replaced pattern replacement template) (-> Text Text Text Text) - ((: (-> Text Text Text) - (function (again left right) - (case (..text#split_by pattern right) - {#Some [pre post]} - (again ($_ "lux text concat" left pre replacement) post) + ((is (-> Text Text Text) + (function (again left right) + (case (..text#split_by pattern right) + {#Some [pre post]} + (again ($_ "lux text concat" left pre replacement) post) - {#None} - ("lux text concat" left right)))) + {#None} + ("lux text concat" left right)))) "" template)) (def: (alias_stand_in index) @@ -3576,75 +3576,75 @@ (-> Bit Text (List Text) (List Code) (Meta (List Importation))) (do meta_monad [imports' (monad#each meta_monad - (: (-> Code (Meta (List Importation))) - (function (_ token) - (case token - ... Simple - [_ {#Symbol ["" module_name]}] - (do meta_monad - [absolute_module_name (..absolute_module_name nested? relative_root module_name)] - (in (list [#import_name absolute_module_name - #import_alias {#None} - #import_refer [#refer_defs {#All} - #refer_open (list)]]))) - - ... Nested - (pattern [_ {#Tuple (list& [_ {#Symbol ["" module_name]}] extra)}]) - (do meta_monad - [absolute_module_name (case (normal_parallel_path relative_root module_name) - {#Some parallel_path} - (in parallel_path) - - {#None} - (..absolute_module_name nested? relative_root module_name)) - referral+extra (referrals_parser extra) - .let [[referral extra] referral+extra] - openings+extra (openings_parser extra) - .let [[openings extra] openings+extra] - sub_imports (imports_parser #1 absolute_module_name context extra)] - (in (case [referral openings] - [{#Nothing} {#End}] - sub_imports - - _ - (list& [#import_name absolute_module_name - #import_alias {#None} - #import_refer [#refer_defs referral - #refer_open openings]] - sub_imports)))) - - (pattern [_ {#Tuple (list& [_ {#Text alias}] [_ {#Symbol ["" module_name]}] extra)}]) - (do meta_monad - [absolute_module_name (case (normal_parallel_path relative_root module_name) - {#Some parallel_path} - (in parallel_path) - - {#None} - (..absolute_module_name nested? relative_root module_name)) - referral+extra (referrals_parser extra) - .let [[referral extra] referral+extra] - openings+extra (openings_parser extra) - .let [[openings extra] openings+extra - module_alias (..module_alias {#Item module_name context} alias)] - sub_imports (imports_parser #1 absolute_module_name {#Item module_alias context} extra)] - (in (case [referral openings] - [{#Ignore} {#End}] - sub_imports - - _ - (list& [#import_name absolute_module_name - #import_alias {#Some module_alias} - #import_refer [#refer_defs referral - #refer_open openings]] - sub_imports)))) - - ... Unrecognized syntax. - _ - (do meta_monad - [current_module current_module_name] - (failure ($_ text#composite - "Wrong syntax for import @ " current_module - \n (code#encoded token))))))) + (is (-> Code (Meta (List Importation))) + (function (_ token) + (case token + ... Simple + [_ {#Symbol ["" module_name]}] + (do meta_monad + [absolute_module_name (..absolute_module_name nested? relative_root module_name)] + (in (list [#import_name absolute_module_name + #import_alias {#None} + #import_refer [#refer_defs {#All} + #refer_open (list)]]))) + + ... Nested + (pattern [_ {#Tuple (list& [_ {#Symbol ["" module_name]}] extra)}]) + (do meta_monad + [absolute_module_name (case (normal_parallel_path relative_root module_name) + {#Some parallel_path} + (in parallel_path) + + {#None} + (..absolute_module_name nested? relative_root module_name)) + referral+extra (referrals_parser extra) + .let [[referral extra] referral+extra] + openings+extra (openings_parser extra) + .let [[openings extra] openings+extra] + sub_imports (imports_parser #1 absolute_module_name context extra)] + (in (case [referral openings] + [{#Nothing} {#End}] + sub_imports + + _ + (list& [#import_name absolute_module_name + #import_alias {#None} + #import_refer [#refer_defs referral + #refer_open openings]] + sub_imports)))) + + (pattern [_ {#Tuple (list& [_ {#Text alias}] [_ {#Symbol ["" module_name]}] extra)}]) + (do meta_monad + [absolute_module_name (case (normal_parallel_path relative_root module_name) + {#Some parallel_path} + (in parallel_path) + + {#None} + (..absolute_module_name nested? relative_root module_name)) + referral+extra (referrals_parser extra) + .let [[referral extra] referral+extra] + openings+extra (openings_parser extra) + .let [[openings extra] openings+extra + module_alias (..module_alias {#Item module_name context} alias)] + sub_imports (imports_parser #1 absolute_module_name {#Item module_alias context} extra)] + (in (case [referral openings] + [{#Ignore} {#End}] + sub_imports + + _ + (list& [#import_name absolute_module_name + #import_alias {#Some module_alias} + #import_refer [#refer_defs referral + #refer_open openings]] + sub_imports)))) + + ... Unrecognized syntax. + _ + (do meta_monad + [current_module current_module_name] + (failure ($_ text#composite + "Wrong syntax for import @ " current_module + \n (code#encoded token))))))) imports)] (in (list#conjoint imports')))) @@ -3658,28 +3658,28 @@ [current_module modules])] (case (plist#value module modules) {#Some =module} - (let [to_alias (list#each (: (-> [Text Global] - (List Text)) - (function (_ [name definition]) - (case definition - {#Alias _} - (list) - - {#Definition [exported? def_type def_value]} - (if exported? - (list name) - (list)) - - {#Type [exported? type labels]} - (if exported? - (list name) - (list)) - - {#Tag _} - (list) - - {#Slot _} - (list)))) + (let [to_alias (list#each (is (-> [Text Global] + (List Text)) + (function (_ [name definition]) + (case definition + {#Alias _} + (list) + + {#Definition [exported? def_type def_value]} + (if exported? + (list name) + (list)) + + {#Type [exported? type labels]} + (if exported? + (list name) + (list)) + + {#Tag _} + (list) + + {#Slot _} + (list)))) (let [[..#module_hash _ ..#module_aliases _ ..#definitions definitions ..#imports _ ..#module_state _] =module] definitions))] {#Right state (list#conjoint to_alias)}) @@ -3728,19 +3728,19 @@ ..#scopes scopes ..#type_context types ..#host host ..#seed seed ..#expected expected ..#location location ..#extensions extensions ..#scope_type_vars scope_type_vars ..#eval _eval] - (list#one (: (-> Scope (Maybe Type)) - (function (_ env) - (case env - [..#name _ - ..#inner _ - ..#locals [..#counter _ ..#mappings locals] - ..#captured _] - (list#one (: (-> [Text [Type Any]] (Maybe Type)) - (function (_ [bname [type _]]) - (if (text#= name bname) - {#Some type} - {#None}))) - locals)))) + (list#one (is (-> Scope (Maybe Type)) + (function (_ env) + (case env + [..#name _ + ..#inner _ + ..#locals [..#counter _ ..#mappings locals] + ..#captured _] + (list#one (is (-> [Text [Type Any]] (Maybe Type)) + (function (_ [bname [type _]]) + (if (text#= name bname) + {#Some type} + {#None}))) + locals)))) scopes))) (def: (definition_type name state) @@ -3834,25 +3834,25 @@ [.let [[module name] full_name] current_module current_module_name] (function (_ compiler) - (let [temp (: (Either Text [Lux Type]) - (if (text#= "" module) - (case (in_env name compiler) - {#Some struct_type} - {#Right [compiler struct_type]} + (let [temp (is (Either Text [Lux Type]) + (if (text#= "" module) + (case (in_env name compiler) + {#Some struct_type} + {#Right [compiler struct_type]} - _ - (case (definition_type [current_module name] compiler) - {#Some struct_type} - {#Right [compiler struct_type]} + _ + (case (definition_type [current_module name] compiler) + {#Some struct_type} + {#Right [compiler struct_type]} - _ - {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})) - (case (definition_type full_name compiler) - {#Some struct_type} - {#Right [compiler struct_type]} + _ + {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})) + (case (definition_type full_name compiler) + {#Some struct_type} + {#Right [compiler struct_type]} - _ - {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})))] + _ + {#Left ($_ text#composite "Unknown var: " (symbol#encoded full_name))})))] (case temp {#Right [compiler {#Var type_id}]} (let [[..#info _ ..#source _ ..#current_module _ ..#modules _ @@ -3903,39 +3903,39 @@ {#Some tags&members} (do meta_monad - [full_body ((: (-> Symbol [(List Symbol) (List Type)] Code (Meta Code)) - (function (again source [tags members] target) - (let [locals (list#each (function (_ [t_module t_name]) - [[t_module t_name] - ["" (..module_alias (list t_name) alias)]]) - tags) - pattern (case locals - (pattern (list [slot binding])) - (symbol$ binding) - - _ - (|> locals - (list#each (function (_ [slot binding]) - (list (symbol$ slot) - (symbol$ binding)))) - list#conjoint - tuple$))] - (do meta_monad - [enhanced_target (monad#mix meta_monad - (function (_ [[_ m_local] m_type] enhanced_target) - (do meta_monad - [m_implementation (record_slots m_type)] - (case m_implementation - {#Some m_tags&members} - (again m_local - m_tags&members - enhanced_target) - - {#None} - (in enhanced_target)))) - target - (zipped/2 locals members))] - (in (` ({(~ pattern) (~ enhanced_target)} (~ (symbol$ source))))))))) + [full_body ((is (-> Symbol [(List Symbol) (List Type)] Code (Meta Code)) + (function (again source [tags members] target) + (let [locals (list#each (function (_ [t_module t_name]) + [[t_module t_name] + ["" (..module_alias (list t_name) alias)]]) + tags) + pattern (case locals + (pattern (list [slot binding])) + (symbol$ binding) + + _ + (|> locals + (list#each (function (_ [slot binding]) + (list (symbol$ slot) + (symbol$ binding)))) + list#conjoint + tuple$))] + (do meta_monad + [enhanced_target (monad#mix meta_monad + (function (_ [[_ m_local] m_type] enhanced_target) + (do meta_monad + [m_implementation (record_slots m_type)] + (case m_implementation + {#Some m_tags&members} + (again m_local + m_tags&members + enhanced_target) + + {#None} + (in enhanced_target)))) + target + (zipped/2 locals members))] + (in (` ({(~ pattern) (~ enhanced_target)} (~ (symbol$ source))))))))) name tags&members body)] (in (list full_body))))) @@ -3947,10 +3947,10 @@ (pattern (list& else branches')) (case (pairs branches') {#Some branches'} - (meta#in (list (list#mix (: (-> [Code Code] Code Code) - (function (_ branch else) - (let [[then ?] branch] - (` (if (~ ?) (~ then) (~ else)))))) + (meta#in (list (list#mix (is (-> [Code Code] Code Code) + (function (_ branch else) + (let [[then ?] branch] + (` (if (~ ?) (~ then) (~ else)))))) else branches'))) @@ -3987,12 +3987,12 @@ (case (interface_methods type) {#Some members} (let [pattern (|> (zipped/2 tags (enumeration members)) - (list#each (: (-> [Symbol [Nat Type]] (List Code)) - (function (_ [[r_module r_name] [r_idx r_type]]) - (list (symbol$ [r_module r_name]) - (if ("lux i64 =" idx r_idx) - g!output - g!_))))) + (list#each (is (-> [Symbol [Nat Type]] (List Code)) + (function (_ [[r_module r_name] [r_idx r_type]]) + (list (symbol$ [r_module r_name]) + (if ("lux i64 =" idx r_idx) + g!output + g!_))))) list#conjoint tuple$)] (meta#in (list (` ({(~ pattern) (~ g!output)} (~ record)))))) @@ -4001,9 +4001,9 @@ (failure "the can only use records."))) (pattern (list [_ {#Tuple slots}] record)) - (meta#in (list (list#mix (: (-> Code Code Code) - (function (_ slot inner) - (` (..the (~ slot) (~ inner))))) + (meta#in (list (list#mix (is (-> Code Code Code) + (function (_ slot inner) + (` (..the (~ slot) (~ inner))))) record slots))) @@ -4034,9 +4034,9 @@ {#Some [tags' members']} (do meta_monad [decls' (monad#each meta_monad - (: (-> [Nat Symbol Type] (Meta (List Code))) - (function (_ [sub_tag_index sname stype]) - (open_declaration alias tags' sub_tag_index sname source+ stype))) + (is (-> [Nat Symbol Type] (Meta (List Code))) + (function (_ [sub_tag_index sname stype]) + (open_declaration alias tags' sub_tag_index sname source+ stype))) (enumeration (zipped/2 tags' members')))] (meta#in (list#conjoint decls'))) @@ -4057,9 +4057,9 @@ (case output {#Some [tags members]} (do meta_monad - [decls' (monad#each meta_monad (: (-> [Nat Symbol Type] (Meta (List Code))) - (function (_ [tag_index sname stype]) - (open_declaration alias tags tag_index sname source stype))) + [decls' (monad#each meta_monad (is (-> [Nat Symbol Type] (Meta (List Code))) + (function (_ [tag_index sname stype]) + (open_declaration alias tags tag_index sname source stype))) (enumeration (zipped/2 tags members)))] (meta#in (list#conjoint decls'))) @@ -4118,15 +4118,15 @@ (-> Text Refer (Meta (List Code))) (do meta_monad [current_module ..current_module_name - .let [test_referrals (: (-> Text (List Text) (List Text) (Meta (List Any))) - (function (_ module_name all_defs referred_defs) - (monad#each meta_monad - (: (-> Text (Meta Any)) - (function (_ _def) - (if (is_member? all_defs _def) - (meta#in []) - (failure ($_ text#composite _def " is not defined in module " module_name " @ " current_module))))) - referred_defs)))] + .let [test_referrals (is (-> Text (List Text) (List Text) (Meta (List Any))) + (function (_ module_name all_defs referred_defs) + (monad#each meta_monad + (is (-> Text (Meta Any)) + (function (_ _def) + (if (is_member? all_defs _def) + (meta#in []) + (failure ($_ text#composite _def " is not defined in module " module_name " @ " current_module))))) + referred_defs)))] defs' (case r_defs {#All} (exported_definitions module_name) @@ -4148,16 +4148,16 @@ {#Nothing} (in (list))) - .let [defs (list#each (: (-> Text Code) - (function (_ def) - (` ("lux def alias" (~ (local_symbol$ def)) (~ (symbol$ [module_name def])))))) + .let [defs (list#each (is (-> Text Code) + (function (_ def) + (` ("lux def alias" (~ (local_symbol$ def)) (~ (symbol$ [module_name def])))))) defs') openings (|> r_opens - (list#each (: (-> Openings (List Code)) - (function (_ [alias structs]) - (list#each (function (_ name) - (` (open: (~ (text$ alias)) (~ (symbol$ [module_name name]))))) - structs)))) + (list#each (is (-> Openings (List Code)) + (function (_ [alias structs]) + (list#each (function (_ name) + (` (open: (~ (text$ alias)) (~ (symbol$ [module_name name]))))) + structs)))) list#conjoint)]] (in (list#composite defs openings)))) @@ -4174,22 +4174,22 @@ (def: (refer_code module_name module_alias' [r_defs r_opens]) (-> Text (Maybe Text) Refer Code) (let [module_alias (..maybe#else module_name module_alias') - localizations (: (List Code) - (case r_defs - {#All} - (list (' "*")) - - {#Only defs} - (list (variant$ (list& (' "+") (list#each local_symbol$ defs)))) - - {#Exclude defs} - (list (variant$ (list& (' "-") (list#each local_symbol$ defs)))) - - {#Ignore} - (list) - - {#Nothing} - (list))) + localizations (is (List Code) + (case r_defs + {#All} + (list (' "*")) + + {#Only defs} + (list (variant$ (list& (' "+") (list#each local_symbol$ defs)))) + + {#Exclude defs} + (list (variant$ (list& (' "-") (list#each local_symbol$ defs)))) + + {#Ignore} + (list) + + {#Nothing} + (list))) openings (list#each (function (_ [alias structs]) (form$ (list& (text$ (..module_alias (list (alias_stand_in 0) module_alias) alias)) (list#each local_symbol$ structs)))) @@ -4221,26 +4221,26 @@ {#Some members} (do meta_monad [pattern' (monad#each meta_monad - (: (-> [Symbol [Nat Type]] (Meta [Symbol Nat Code])) - (function (_ [r_slot_name [r_idx r_type]]) - (do meta_monad - [g!slot (..generated_symbol "")] - (meta#in [r_slot_name r_idx g!slot])))) + (is (-> [Symbol [Nat Type]] (Meta [Symbol Nat Code])) + (function (_ [r_slot_name [r_idx r_type]]) + (do meta_monad + [g!slot (..generated_symbol "")] + (meta#in [r_slot_name r_idx g!slot])))) (zipped/2 tags (enumeration members)))] (let [pattern (|> pattern' - (list#each (: (-> [Symbol Nat Code] (List Code)) - (function (_ [r_slot_name r_idx r_var]) - (list (symbol$ r_slot_name) - r_var)))) + (list#each (is (-> [Symbol Nat Code] (List Code)) + (function (_ [r_slot_name r_idx r_var]) + (list (symbol$ r_slot_name) + r_var)))) list#conjoint tuple$) output (|> pattern' - (list#each (: (-> [Symbol Nat Code] (List Code)) - (function (_ [r_slot_name r_idx r_var]) - (list (symbol$ r_slot_name) - (if ("lux i64 =" idx r_idx) - value - r_var))))) + (list#each (is (-> [Symbol Nat Code] (List Code)) + (function (_ [r_slot_name r_idx r_var]) + (list (symbol$ r_slot_name) + (if ("lux i64 =" idx r_idx) + value + r_var))))) list#conjoint tuple$)] (meta#in (list (` ({(~ pattern) (~ output)} (~ record))))))) @@ -4256,20 +4256,20 @@ _ (do meta_monad [bindings (monad#each meta_monad - (: (-> Code (Meta Code)) - (function (_ _) (..generated_symbol "temp"))) + (is (-> Code (Meta Code)) + (function (_ _) (..generated_symbol "temp"))) slots) .let [pairs (zipped/2 slots bindings) - update_expr (list#mix (: (-> [Code Code] Code Code) - (function (_ [s b] v) - (` (..has (~ s) (~ v) (~ b))))) + update_expr (list#mix (is (-> [Code Code] Code Code) + (function (_ [s b] v) + (` (..has (~ s) (~ v) (~ b))))) value (list#reversed pairs)) - [_ accesses'] (list#mix (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) - (function (_ [new_slot new_binding] [old_record accesses']) - [(` (the (~ new_slot) (~ new_binding))) - {#Item (list new_binding old_record) accesses'}])) - [record (: (List (List Code)) {#End})] + [_ accesses'] (list#mix (is (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) + (function (_ [new_slot new_binding] [old_record accesses']) + [(` (the (~ new_slot) (~ new_binding))) + {#Item (list new_binding old_record) accesses'}])) + [record (is (List (List Code)) {#End})] pairs) accesses (list#conjoint (list#reversed accesses'))]] (in (list (` (let [(~+ accesses)] @@ -4304,26 +4304,26 @@ {#Some members} (do meta_monad [pattern' (monad#each meta_monad - (: (-> [Symbol [Nat Type]] (Meta [Symbol Nat Code])) - (function (_ [r_slot_name [r_idx r_type]]) - (do meta_monad - [g!slot (..generated_symbol "")] - (meta#in [r_slot_name r_idx g!slot])))) + (is (-> [Symbol [Nat Type]] (Meta [Symbol Nat Code])) + (function (_ [r_slot_name [r_idx r_type]]) + (do meta_monad + [g!slot (..generated_symbol "")] + (meta#in [r_slot_name r_idx g!slot])))) (zipped/2 tags (enumeration members)))] (let [pattern (|> pattern' - (list#each (: (-> [Symbol Nat Code] (List Code)) - (function (_ [r_slot_name r_idx r_var]) - (list (symbol$ r_slot_name) - r_var)))) + (list#each (is (-> [Symbol Nat Code] (List Code)) + (function (_ [r_slot_name r_idx r_var]) + (list (symbol$ r_slot_name) + r_var)))) list#conjoint tuple$) output (|> pattern' - (list#each (: (-> [Symbol Nat Code] (List Code)) - (function (_ [r_slot_name r_idx r_var]) - (list (symbol$ r_slot_name) - (if ("lux i64 =" idx r_idx) - (` ((~ fun) (~ r_var))) - r_var))))) + (list#each (is (-> [Symbol Nat Code] (List Code)) + (function (_ [r_slot_name r_idx r_var]) + (list (symbol$ r_slot_name) + (if ("lux i64 =" idx r_idx) + (` ((~ fun) (~ r_var))) + r_var))))) list#conjoint tuple$)] (meta#in (list (` ({(~ pattern) (~ output)} (~ record))))))) @@ -4368,20 +4368,20 @@ [_ {#Tuple templates}])}] [_ {#Form data}] branches)) - (case (: (Maybe (List Code)) - (do maybe_monad - [bindings' (monad#each maybe_monad symbol_short bindings) - data' (monad#each maybe_monad tuple_list data)] - (let [num_bindings (list#size bindings')] - (if (every? (|>> ("lux i64 =" num_bindings)) - (list#each list#size data')) - (let [apply (: (-> Replacement_Environment (List Code)) - (function (_ env) (list#each (realized_template env) templates)))] - (|> data' - (list#each (function#composite apply (replacement_environment bindings'))) - list#conjoint - in)) - {#None})))) + (case (is (Maybe (List Code)) + (do maybe_monad + [bindings' (monad#each maybe_monad symbol_short bindings) + data' (monad#each maybe_monad tuple_list data)] + (let [num_bindings (list#size bindings')] + (if (every? (|>> ("lux i64 =" num_bindings)) + (list#each list#size data')) + (let [apply (is (-> Replacement_Environment (List Code)) + (function (_ env) (list#each (realized_template env) templates)))] + (|> data' + (list#each (function#composite apply (replacement_environment bindings'))) + list#conjoint + in)) + {#None})))) {#Some output} (meta#in (list#composite output branches)) @@ -4465,10 +4465,10 @@ inits (list#each product#right pairs)] (if (every? symbol? inits) (do meta_monad - [inits' (: (Meta (List Symbol)) - (case (monad#each maybe_monad symbol_name inits) - {#Some inits'} (meta#in inits') - {#None} (failure "Wrong syntax for loop"))) + [inits' (is (Meta (List Symbol)) + (case (monad#each maybe_monad symbol_name inits) + {#Some inits'} (meta#in inits') + {#None} (failure "Wrong syntax for loop"))) init_types (monad#each meta_monad type_definition inits') expected ..expected_type] (meta#in (list (` (("lux type check" @@ -4479,8 +4479,8 @@ (~+ inits)))))) (do meta_monad [aliases (monad#each meta_monad - (: (-> Code (Meta Code)) - (function (_ _) (..generated_symbol ""))) + (is (-> Code (Meta Code)) + (function (_ _) (..generated_symbol ""))) inits)] (meta#in (list (` (let [(~+ (..interleaved aliases inits))] (.loop (~ name) @@ -4516,14 +4516,14 @@ (case (parsed (andP (tupleP (someP bindingP)) (someP anyP)) tokens) {#Some [bindings bodies]} (loop [bindings bindings - map (: (PList (List Code)) - (list))] - (let [normal (: (-> Code (List Code)) - (function (_ it) - (list#mix (function (_ [binding expansion] it) - (list#conjoint (list#each (with_expansions' binding expansion) it))) - (list it) - map)))] + map (is (PList (List Code)) + (list))] + (let [normal (is (-> Code (List Code)) + (function (_ it) + (list#mix (function (_ [binding expansion] it) + (list#conjoint (list#each (with_expansions' binding expansion) it))) + (list it) + map)))] (case bindings {#Item [var_name expr] &rest} (do meta_monad @@ -4571,7 +4571,7 @@ (case (flat_alias type) (pattern#template [<name> <type> <wrapper>] [{#Named ["library/lux" <name>] _} - (in (<wrapper> (:as <type> value)))]) + (in (<wrapper> (as <type> value)))]) (["Bit" Bit bit$] ["Nat" Nat nat$] ["Int" Int int$] @@ -4658,7 +4658,7 @@ (list) (list g!_ (` {.#None})))))))) (` {.#Some (~ body)}) - (: (List [Code Code]) (list#reversed levels)))] + (is (List [Code Code]) (list#reversed levels)))] (list init_pattern inner_pattern_body))) (macro: (pattern#multi tokens) @@ -4713,7 +4713,7 @@ (-> a a Bit)) ("lux is" reference sample)) -(macro: .public (:expected tokens) +(macro: .public (as_expected tokens) (case tokens (pattern (list expr)) (do meta_monad @@ -4721,7 +4721,7 @@ (in (list (` ("lux type as" (~ (type_code type)) (~ expr)))))) _ - (failure (..wrong_syntax_error (symbol ..:expected))))) + (failure (..wrong_syntax_error (symbol ..as_expected))))) (def: location (Meta Location) @@ -4741,7 +4741,7 @@ _ (failure (..wrong_syntax_error (symbol ..undefined))))) -(macro: .public (:of tokens) +(macro: .public (type_of tokens) (case tokens (pattern (list [_ {#Symbol var_name}])) (do meta_monad @@ -4752,10 +4752,10 @@ (do meta_monad [g!temp (..generated_symbol "g!temp")] (in (list (` (let [(~ g!temp) (~ expression)] - (..:of (~ g!temp))))))) + (..type_of (~ g!temp))))))) _ - (failure (..wrong_syntax_error (symbol ..:of))))) + (failure (..wrong_syntax_error (symbol ..type_of))))) (def: (templateP tokens) (-> (List Code) (Maybe [Code Text (List Text) (List Code)])) @@ -4796,7 +4796,7 @@ (template [<name> <to>] [(template: .public (<name> it) - [(..|> it (..: (..I64 ..Any)) (..:as <to>))])] + [(..|> it (..is (..I64 ..Any)) (..as <to>))])] [i64 ..I64] [nat ..Nat] @@ -4837,7 +4837,7 @@ (case (..flat_alias type) (pattern#or {#Primitive "#Text" {#End}} {#Named ["library/lux" "Text"] {#Primitive "#Text" {#End}}}) - (in (:as ..Text value)) + (in (as ..Text value)) _ (failure ($_ text#composite @@ -4879,7 +4879,7 @@ {.#None} (failure (..wrong_syntax_error (symbol ..for))))) -... TODO: Delete "scope_type_vars" (including the #scope_type_vars Lux state) and ":parameter" ASAP. +... TODO: Delete "scope_type_vars" (including the #scope_type_vars Lux state) and "parameter" ASAP. (for "{old}" (as_is (def: (scope_type_vars state) (Meta (List Nat)) (case state @@ -4889,7 +4889,7 @@ ..#scope_type_vars scope_type_vars ..#eval _eval] {#Right [state scope_type_vars]})) - (macro: .public (:parameter tokens) + (macro: .public (parameter tokens) (case tokens (pattern (list [_ {#Nat idx}])) (do meta_monad @@ -4910,13 +4910,13 @@ [current_module ..current_module_name imports (imports_parser #0 current_module {#End} _imports) .let [=imports (|> imports - (list#each (: (-> Importation Code) - (function (_ [module_name m_alias =refer]) - (` [(~ (text$ module_name)) (~ (text$ (..maybe#else "" m_alias)))])))) + (list#each (is (-> Importation Code) + (function (_ [module_name m_alias =refer]) + (` [(~ (text$ module_name)) (~ (text$ (..maybe#else "" m_alias)))])))) tuple$) - =refers (list#each (: (-> Importation Code) - (function (_ [module_name m_alias =refer]) - (refer_code module_name m_alias =refer))) + =refers (list#each (is (-> Importation Code) + (function (_ [module_name m_alias =refer]) + (refer_code module_name m_alias =refer))) imports) =module (` ("lux def module" (~ =imports)))] g!_ (..generated_symbol "")] @@ -4974,23 +4974,6 @@ Bit #1) -(macro: .public (:let tokens) - (case tokens - (pattern (list [_ {#Tuple bindings}] bodyT)) - (case (..pairs bindings) - {#Some bindings} - (meta#in (list (` (..with_expansions [(~+ (|> bindings - (list#each (function (_ [localT valueT]) - (list localT (` (..as_is (~ valueT)))))) - (list#mix list#composite (list))))] - (~ bodyT))))) - - {#None} - (..failure ":let requires an even number of parts")) - - _ - (..failure (..wrong_syntax_error (symbol ..:let))))) - (macro: .public (try tokens) (case tokens (pattern (list expression)) @@ -5055,4 +5038,4 @@ (def: .public macro (-> Macro Macro') - (|>> (:as Macro'))) + (|>> (as Macro'))) diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux index 6a509bb0a..0d3a0fd1e 100644 --- a/stdlib/source/library/lux/abstract/apply.lux +++ b/stdlib/source/library/lux/abstract/apply.lux @@ -8,11 +8,11 @@ (type: .public (Apply f) (Interface - (: (Functor f) - &functor) - (: (All (_ a b) - (-> (f a) (f (-> a b)) (f b))) - on))) + (is (Functor f) + &functor) + (is (All (_ a b) + (-> (f a) (f (-> a b)) (f b))) + on))) (implementation: .public (composite f_monad f_apply g_apply) (All (_ F G) @@ -29,7 +29,7 @@ (for @.old (let [fgf' (# f_apply on fgf (# f_monad in (function (_ gf gx) (# g_apply on gx gf))))] - (:expected (# f_apply on (:expected fgx) (:expected fgf')))) + (as_expected (# f_apply on (as_expected fgx) (as_expected fgf')))) (let [fgf' (# f_apply on fgf (# f_monad in (function (_ gf gx) (# g_apply on gx gf))))] diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux index 4e146fa41..d7ff3c13f 100644 --- a/stdlib/source/library/lux/abstract/codec.lux +++ b/stdlib/source/library/lux/abstract/codec.lux @@ -1,18 +1,18 @@ (.using - [library - [lux "*" - [control - ["[0]" try {"+" Try}]]]] - [// - [monad {"+" do}] - ["[0]" functor]]) + [library + [lux "*" + [control + ["[0]" try {"+" Try}]]]] + [// + [monad {"+" do}] + ["[0]" functor]]) (type: .public (Codec m a) (Interface - (: (-> a m) - encoded) - (: (-> m (Try a)) - decoded))) + (is (-> a m) + encoded) + (is (-> m (Try a)) + decoded))) (implementation: .public (composite cb_codec ba_codec) (All (_ a b c) diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index b5c1598d2..a0dd97014 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -14,48 +14,48 @@ (type: .public (CoMonad w) (Interface - (: (Functor w) - &functor) - (: (All (_ a) - (-> (w a) a)) - out) - (: (All (_ a) - (-> (w a) (w (w a)))) - disjoint))) + (is (Functor w) + &functor) + (is (All (_ a) + (-> (w a) a)) + out) + (is (All (_ a) + (-> (w a) (w (w a)))) + disjoint))) (macro: .public (be tokens state) - (case (: (Maybe [(Maybe Text) Code (List Code) Code]) - (case tokens - (pattern (list [_ {.#Tuple (list [_ {.#Symbol ["" name]}] comonad)}] [_ {.#Tuple bindings}] body)) - {.#Some [{.#Some name} comonad bindings body]} - - (pattern (list comonad [_ {.#Tuple bindings}] body)) - {.#Some [{.#None} comonad bindings body]} + (case (is (Maybe [(Maybe Text) Code (List Code) Code]) + (case tokens + (pattern (list [_ {.#Tuple (list [_ {.#Symbol ["" name]}] comonad)}] [_ {.#Tuple bindings}] body)) + {.#Some [{.#Some name} comonad bindings body]} + + (pattern (list comonad [_ {.#Tuple bindings}] body)) + {.#Some [{.#None} comonad bindings body]} - _ - {.#None})) + _ + {.#None})) {.#Some [?name comonad bindings body]} (case (list.pairs bindings) {.#Some bindings} (let [[module short] (symbol ..be) - symbol (: (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) + symbol (is (-> Text Code) + (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) g!_ (symbol "_") g!each (symbol "each") g!disjoint (symbol "disjoint") - body' (list#mix (: (-> [Code Code] Code Code) - (function (_ binding body') - (with_expansions [<default> (` (|> (~ value) (~ g!disjoint) ((~ g!each) (function ((~ g!_) (~ var)) (~ body')))))] - (let [[var value] binding] - (case var - [_ {.#Symbol ["" _]}] - <default> + body' (list#mix (is (-> [Code Code] Code Code) + (function (_ binding body') + (with_expansions [<default> (` (|> (~ value) (~ g!disjoint) ((~ g!each) (function ((~ g!_) (~ var)) (~ body')))))] + (let [[var value] binding] + (case var + [_ {.#Symbol ["" _]}] + <default> - [_ {.#Symbol _}] - (` ((~ var) (~ value) (~ body'))) + [_ {.#Symbol _}] + (` ((~ var) (~ value) (~ body'))) - _ - <default>))))) + _ + <default>))))) body (list.reversed bindings))] {.#Right [state (list (case ?name diff --git a/stdlib/source/library/lux/abstract/enum.lux b/stdlib/source/library/lux/abstract/enum.lux index c172df2ab..fd9e19e37 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -6,16 +6,16 @@ (type: .public (Enum e) (Interface - (: (Order e) &order) - (: (-> e e) succ) - (: (-> e e) pred))) + (is (Order e) &order) + (is (-> e e) succ) + (is (-> e e) pred))) (def: .public (range enum from to) (All (_ a) (-> (Enum a) a a (List a))) (let [(open "/#[0]") enum] (loop [end to - output (`` (: (List (~~ (:of from))) - {.#End}))] + output (`` (is (List (~~ (type_of from))) + {.#End}))] (cond (/#< end from) (again (/#pred end) {.#Item end output}) diff --git a/stdlib/source/library/lux/abstract/equivalence.lux b/stdlib/source/library/lux/abstract/equivalence.lux index 30ed40f20..3a28cbba2 100644 --- a/stdlib/source/library/lux/abstract/equivalence.lux +++ b/stdlib/source/library/lux/abstract/equivalence.lux @@ -1,14 +1,14 @@ (.using - [library - [lux "*"]] - [// - [functor - ["[0]" contravariant]]]) + [library + [lux "*"]] + [// + [functor + ["[0]" contravariant]]]) (type: .public (Equivalence a) (Interface - (: (-> a a Bit) - =))) + (is (-> a a Bit) + =))) (def: .public (rec sub) (All (_ a) diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux index 636e4c592..1dd348bc3 100644 --- a/stdlib/source/library/lux/abstract/functor.lux +++ b/stdlib/source/library/lux/abstract/functor.lux @@ -4,10 +4,10 @@ (type: .public (Functor f) (Interface - (: (All (_ a b) - (-> (-> a b) - (-> (f a) (f b)))) - each))) + (is (All (_ a b) + (-> (-> a b) + (-> (f a) (f b)))) + each))) (type: .public (Or f g) (All (_ a) (.Or (f a) (g a)))) diff --git a/stdlib/source/library/lux/abstract/functor/contravariant.lux b/stdlib/source/library/lux/abstract/functor/contravariant.lux index 5366a4ecf..8777299c4 100644 --- a/stdlib/source/library/lux/abstract/functor/contravariant.lux +++ b/stdlib/source/library/lux/abstract/functor/contravariant.lux @@ -1,10 +1,10 @@ (.using - [library - [lux "*"]]) + [library + [lux "*"]]) (type: .public (Functor f) (Interface - (: (All (_ a b) - (-> (-> b a) - (-> (f a) (f b)))) - each))) + (is (All (_ a b) + (-> (-> b a) + (-> (f a) (f b)))) + each))) diff --git a/stdlib/source/library/lux/abstract/hash.lux b/stdlib/source/library/lux/abstract/hash.lux index c556c4598..04610b639 100644 --- a/stdlib/source/library/lux/abstract/hash.lux +++ b/stdlib/source/library/lux/abstract/hash.lux @@ -1,17 +1,17 @@ (.using - [library - [lux "*"]] - [// - ["[0]" equivalence {"+" Equivalence}] - [functor - ["[0]" contravariant]]]) + [library + [lux "*"]] + [// + ["[0]" equivalence {"+" Equivalence}] + [functor + ["[0]" contravariant]]]) (type: .public (Hash a) (Interface - (: (Equivalence a) - &equivalence) - (: (-> a Nat) - hash))) + (is (Equivalence a) + &equivalence) + (is (-> a Nat) + hash))) (implementation: .public functor (contravariant.Functor Hash) diff --git a/stdlib/source/library/lux/abstract/interval.lux b/stdlib/source/library/lux/abstract/interval.lux index 68865241c..5ed94dafe 100644 --- a/stdlib/source/library/lux/abstract/interval.lux +++ b/stdlib/source/library/lux/abstract/interval.lux @@ -9,14 +9,14 @@ (type: .public (Interval a) (Interface - (: (Enum a) - &enum) + (is (Enum a) + &enum) - (: a - bottom) + (is a + bottom) - (: a - top))) + (is a + top))) (def: .public (between enum bottom top) (All (_ a) (-> (Enum a) a a (Interval a))) diff --git a/stdlib/source/library/lux/abstract/mix.lux b/stdlib/source/library/lux/abstract/mix.lux index 0a3c2088a..1c13dd985 100644 --- a/stdlib/source/library/lux/abstract/mix.lux +++ b/stdlib/source/library/lux/abstract/mix.lux @@ -6,9 +6,9 @@ (type: .public (Mix F) (Interface - (: (All (_ a b) - (-> (-> b a a) a (F b) a)) - mix))) + (is (All (_ a b) + (-> (-> b a a) a (F b) a)) + mix))) (def: .public (with_monoid monoid mix value) (All (_ F a) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 0802c0198..6a07fe8a2 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -45,47 +45,47 @@ (type: .public (Monad m) (Interface - (: (Functor m) - &functor) - (: (All (_ a) - (-> a (m a))) - in) - (: (All (_ a) - (-> (m (m a)) (m a))) - conjoint))) + (is (Functor m) + &functor) + (is (All (_ a) + (-> a (m a))) + in) + (is (All (_ a) + (-> (m (m a)) (m a))) + conjoint))) (macro: .public (do tokens state) - (case (: (Maybe [(Maybe Text) Code (List Code) Code]) - (case tokens - (pattern (list [_ {.#Tuple (list [_ {.#Symbol ["" name]}] monad)}] [_ {.#Tuple bindings}] body)) - {.#Some [{.#Some name} monad bindings body]} - - (pattern (list monad [_ {.#Tuple bindings}] body)) - {.#Some [{.#None} monad bindings body]} - - _ - {.#None})) + (case (is (Maybe [(Maybe Text) Code (List Code) Code]) + (case tokens + (pattern (list [_ {.#Tuple (list [_ {.#Symbol ["" name]}] monad)}] [_ {.#Tuple bindings}] body)) + {.#Some [{.#Some name} monad bindings body]} + + (pattern (list monad [_ {.#Tuple bindings}] body)) + {.#Some [{.#None} monad bindings body]} + + _ + {.#None})) {.#Some [?name monad bindings body]} (if (|> bindings list#size .int ("lux i64 %" +2) ("lux i64 =" +0)) (let [[module short] (symbol ..do) - symbol (: (-> Text Code) - (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) + symbol (is (-> Text Code) + (|>> ($_ "lux text concat" module " " short " ") [""] {.#Symbol} [location.dummy])) g!_ (symbol "_") g!each (symbol "each") g!conjoint (symbol "conjoint") - body' (list#mix (: (-> [Code Code] Code Code) - (function (_ binding body') - (with_expansions [<default> (` (|> (~ value) ((~ g!each) (function ((~ g!_) (~ var)) (~ body'))) (~ g!conjoint)))] - (let [[var value] binding] - (case var - [_ {.#Symbol ["" _]}] - <default> - - [_ {.#Symbol _}] - (` ((~ var) (~ value) (~ body'))) - - _ - <default>))))) + body' (list#mix (is (-> [Code Code] Code Code) + (function (_ binding body') + (with_expansions [<default> (` (|> (~ value) ((~ g!each) (function ((~ g!_) (~ var)) (~ body'))) (~ g!conjoint)))] + (let [[var value] binding] + (case var + [_ {.#Symbol ["" _]}] + <default> + + [_ {.#Symbol _}] + (` ((~ var) (~ value) (~ body'))) + + _ + <default>))))) body (reversed (pairs bindings)))] {.#Right [state (list (case ?name diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index 97cfae478..a6b99afc4 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -1,28 +1,28 @@ (.using - [library - [lux "*" - [control - ["<>" parser - ["<[0]>" code {"+" Parser}]]] - [data - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - ["[0]" macro - [syntax {"+" syntax:}] - ["[0]" code]]]] - ["[0]" //]) + [library + [lux "*" + [control + ["<>" parser + ["<[0]>" code {"+" Parser}]]] + [data + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + ["[0]" macro + [syntax {"+" syntax:}] + ["[0]" code]]]] + ["[0]" //]) (type: .public (IxMonad m) (Interface - (: (All (_ p a) - (-> a (m p p a))) - in) + (is (All (_ p a) + (-> a (m p p a))) + in) - (: (All (_ ii it io vi vo) - (-> (-> vi (m it io vo)) - (m ii it vi) - (m ii io vo))) - then))) + (is (All (_ ii it io vi vo) + (-> (-> vi (m it io vo)) + (m ii it vi) + (m ii io vo))) + then))) (type: Binding [Code Code]) diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux index cf6e59cec..fe386411d 100644 --- a/stdlib/source/library/lux/abstract/monoid.lux +++ b/stdlib/source/library/lux/abstract/monoid.lux @@ -1,13 +1,13 @@ (.using - [library - [lux {"-" and}]]) + [library + [lux {"-" and}]]) (type: .public (Monoid a) (Interface - (: a - identity) - (: (-> a a a) - composite))) + (is a + identity) + (is (-> a a a) + composite))) (def: .public (and left right) (All (_ l r) (-> (Monoid l) (Monoid r) (Monoid [l r]))) diff --git a/stdlib/source/library/lux/abstract/order.lux b/stdlib/source/library/lux/abstract/order.lux index 610d477bb..e09899ad5 100644 --- a/stdlib/source/library/lux/abstract/order.lux +++ b/stdlib/source/library/lux/abstract/order.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - [control - ["[0]" function]]]] - [// - ["[0]" equivalence {"+" Equivalence}] - [functor - ["[0]" contravariant]]]) + [library + [lux "*" + [control + ["[0]" function]]]] + [// + ["[0]" equivalence {"+" Equivalence}] + [functor + ["[0]" contravariant]]]) (type: .public (Order a) (Interface - (: (Equivalence a) - &equivalence) + (is (Equivalence a) + &equivalence) - (: (-> a a Bit) - <))) + (is (-> a a Bit) + <))) (type: .public (Comparison a) (-> (Order a) a a Bit)) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 84383bba4..c4bf4c544 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -133,12 +133,12 @@ (with_symbols [g!_ g!func g!stack g!output] (monad.do [! meta.monad] [g!inputs (|> (macro.symbol "input") (list.repeated arity) (monad.all !))] - (in (list (` (: (All ((~ g!_) (~+ g!inputs) (~ g!output)) - (-> (-> (~+ g!inputs) (~ g!output)) - (=> [(~+ g!inputs)] [(~ g!output)]))) - (function ((~ g!_) (~ g!func)) - (function ((~ g!_) (~ (stack_mix g!inputs g!stack))) - [(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))) + (in (list (` (is (All ((~ g!_) (~+ g!inputs) (~ g!output)) + (-> (-> (~+ g!inputs) (~ g!output)) + (=> [(~+ g!inputs)] [(~ g!output)]))) + (function ((~ g!_) (~ g!func)) + (function ((~ g!_) (~ (stack_mix g!inputs g!stack))) + [(~ g!stack) ((~ g!func) (~+ g!inputs))]))))))))) (template [<arity>] [(`` (def: .public (~~ (template.symbol ["apply/" <arity>])) diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index cfa4fb11f..bdb3db4ce 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -28,8 +28,8 @@ [number ["n" nat]]] ["[0]" meta {"+" monad}] - [type {"+" :sharing} - ["[0]" abstract {"+" abstract: :representation :abstraction}]]]] + [type {"+" sharing} + ["[0]" abstract {"+" abstract: representation abstraction}]]]] [// ["[0]" atom {"+" Atom atom}] ["[0]" async {"+" Async Resolver} ("[1]#[0]" monad)] @@ -81,21 +81,21 @@ (def: .public (spawn! behavior init) (All (_ o s) (-> (Behavior o s) o (IO (Actor s)))) (io (let [[on_init on_mail] behavior - self (:sharing [o s] - (Behavior o s) - behavior - - (Actor s) - (:abstraction [#obituary (async.async []) - #mailbox (atom (async.async []))])) + self (sharing [o s] + (Behavior o s) + behavior + + (Actor s) + (abstraction [#obituary (async.async []) + #mailbox (atom (async.async []))])) process (loop [state (on_init init) - [|mailbox| _] (io.run! (atom.read! (the #mailbox (:representation self))))] + [|mailbox| _] (io.run! (atom.read! (the #mailbox (representation self))))] (do [! async.monad] [[head tail] |mailbox| ?state' (on_mail head state self)] (case ?state' {try.#Failure error} - (let [[_ resolve] (the #obituary (:representation self))] + (let [[_ resolve] (the #obituary (representation self))] (exec (io.run! (do io.monad [pending (..pending tail)] @@ -108,7 +108,7 @@ (def: .public (alive? actor) (All (_ s) (-> (Actor s) (IO Bit))) - (let [[obituary _] (the #obituary (:representation actor))] + (let [[obituary _] (the #obituary (representation actor))] (|> obituary async.value (# io.functor each @@ -121,12 +121,12 @@ (def: .public (obituary' actor) (All (_ s) (-> (Actor s) (IO (Maybe (Obituary s))))) - (let [[obituary _] (the #obituary (:representation actor))] + (let [[obituary _] (the #obituary (representation actor))] (async.value obituary))) (def: .public obituary (All (_ s) (-> (Actor s) (Async (Obituary s)))) - (|>> :representation + (|>> representation (the #obituary) product.left)) @@ -137,7 +137,7 @@ (if alive? (let [entry [mail (async.async [])]] (do ! - [|mailbox|&resolve (atom.read! (the #mailbox (:representation actor)))] + [|mailbox|&resolve (atom.read! (the #mailbox (representation actor)))] (loop [[|mailbox| resolve] |mailbox|&resolve] (do ! [|mailbox| (async.value |mailbox|)] @@ -147,7 +147,7 @@ [resolved? (resolve entry)] (if resolved? (do ! - [_ (atom.write! (product.right entry) (the #mailbox (:representation actor)))] + [_ (atom.write! (product.right entry) (the #mailbox (representation actor)))] (in {try.#Success []})) (again |mailbox|&resolve))) @@ -160,13 +160,13 @@ (def: (mail message) (All (_ s o) (-> (Message s o) [(Async (Try o)) (Mail s)])) - (let [[async resolve] (:sharing [s o] - (Message s o) - message - - [(Async (Try o)) - (Resolver (Try o))] - (async.async []))] + (let [[async resolve] (sharing [s o] + (Message s o) + message + + [(Async (Try o)) + (Resolver (Try o))] + (async.async []))] [async (function (_ state self) (do [! async.monad] @@ -271,7 +271,7 @@ (def: (~ export_policy) (~ g!actor) (All ((~ g!_) (~+ g!vars)) (..Behavior (~ state_type) ((~ g!type) (~+ g!vars)))) - [..#on_init (|>> ((~! abstract.:abstraction) (~ g!type))) + [..#on_init (|>> ((~! abstract.abstraction) (~ g!type))) ..#on_mail (~ (..on_mail g!_ ?on_mail))]) (~+ messages)))))))) @@ -279,12 +279,12 @@ (syntax: .public (actor [[state_type init] (<code>.tuple (<>.and <code>.any <code>.any)) ?on_mail on_mail^]) (with_symbols [g!_] - (in (list (` (: ((~! io.IO) (..Actor (~ state_type))) - (..spawn! (: (..Behavior (~ state_type) (~ state_type)) - [..#on_init (|>>) - ..#on_mail (~ (..on_mail g!_ ?on_mail))]) - (: (~ state_type) - (~ init))))))))) + (in (list (` (is ((~! io.IO) (..Actor (~ state_type))) + (..spawn! (is (..Behavior (~ state_type) (~ state_type)) + [..#on_init (|>>) + ..#on_mail (~ (..on_mail g!_ ?on_mail))]) + (is (~ state_type) + (~ init))))))))) (type: Signature (Record @@ -334,13 +334,13 @@ (..Message (~ (the abstract.#abstraction actor_scope)) (~ output_type)))) (function ((~ g!_) (~ g!state) (~ g!self)) - (let [(~ g!state) (:as (~ (the abstract.#representation actor_scope)) - (~ g!state))] + (let [(~ g!state) (as (~ (the abstract.#representation actor_scope)) + (~ g!state))] (|> (~ body) - (: ((~! async.Async) ((~! try.Try) [(~ (the abstract.#representation actor_scope)) - (~ output_type)]))) - (:as ((~! async.Async) ((~! try.Try) [(~ (the abstract.#abstraction actor_scope)) - (~ output_type)])))))))) + (is ((~! async.Async) ((~! try.Try) [(~ (the abstract.#representation actor_scope)) + (~ output_type)]))) + (as ((~! async.Async) ((~! try.Try) [(~ (the abstract.#abstraction actor_scope)) + (~ output_type)])))))))) ))))) (type: .public Stop @@ -351,10 +351,10 @@ (def: .public (observe! action channel actor) (All (_ e s) (-> (-> e Stop (Mail s)) (Channel e) (Actor s) (IO Any))) - (let [signal (: (Atom Bit) - (atom.atom ..continue!)) - stop (: Stop - (atom.write! ..stop! signal))] + (let [signal (is (Atom Bit) + (atom.atom ..continue!)) + stop (is Stop + (atom.write! ..stop! signal))] (frp.subscribe! (function (_ event) (do [! io.monad] [continue? (atom.read! signal)] diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 32bc8cca1..6070efb3e 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -13,8 +13,8 @@ ["[0]" product]] [macro ["^" pattern]] - [type {"+" :sharing} - abstract]]] + [type {"+" sharing} + [abstract {"-" pattern}]]]] [// ["[0]" thread] ["[0]" atom {"+" Atom atom}]]) @@ -29,7 +29,7 @@ (def: (resolver async) (All (_ a) (-> (Async a) (Resolver a))) (function (resolve value) - (let [async (:representation async)] + (let [async (representation async)] (do [! io.monad] [(^.let old [_value _observers]) (atom.read! async)] (case _value @@ -49,23 +49,23 @@ (def: .public (resolved value) (All (_ a) (-> a (Async a))) - (:abstraction (atom [{.#Some value} (list)]))) + (abstraction (atom [{.#Some value} (list)]))) (def: .public (async _) (All (_ a) (-> Any [(Async a) (Resolver a)])) - (let [async (:abstraction (atom [{.#None} (list)]))] + (let [async (abstraction (atom [{.#None} (list)]))] [async (..resolver async)])) (def: .public value (All (_ a) (-> (Async a) (IO (Maybe a)))) - (|>> :representation + (|>> representation atom.read! (# io.functor each product.left))) (def: .public (upon! f async) (All (_ a) (-> (-> a (IO Any)) (Async a) (IO Any))) (do [! io.monad] - [.let [async (:representation async)] + [.let [async (representation async)] (^.let old [_value _observers]) (atom.read! async)] (case _value {.#Some value} @@ -77,7 +77,7 @@ [swapped? (atom.compare_and_swap! old new async)] (if swapped? (in []) - (upon! f (:abstraction async)))))))) + (upon! f (abstraction async)))))))) ) (def: .public resolved? @@ -128,13 +128,13 @@ (def: .public (and left right) (All (_ a b) (-> (Async a) (Async b) (Async [a b]))) - (let [[read! write!] (:sharing [a b] - [(Async a) (Async b)] - [left right] + (let [[read! write!] (sharing [a b] + [(Async a) (Async b)] + [left right] - [(Async [a b]) - (Resolver [a b])] - (..async [])) + [(Async [a b]) + (Resolver [a b])] + (..async [])) _ (io.run! (..upon! (function (_ left) (..upon! (function (_ right) (write! [left right])) diff --git a/stdlib/source/library/lux/control/concurrency/atom.lux b/stdlib/source/library/lux/control/concurrency/atom.lux index b15cecead..1fe0d8262 100644 --- a/stdlib/source/library/lux/control/concurrency/atom.lux +++ b/stdlib/source/library/lux/control/concurrency/atom.lux @@ -13,7 +13,7 @@ [collection ["[0]" array]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (with_expansions [<jvm> (as_is (ffi.import: (java/util/concurrent/atomic/AtomicReference a) "[1]::[0]" @@ -54,27 +54,27 @@ (def: .public (atom value) (All (_ a) (-> a (Atom a))) - (:abstraction (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::new value)] - (for @.old <jvm> - @.jvm <jvm> - (<write> 0 value (<new> 1)))))) + (abstraction (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::new value)] + (for @.old <jvm> + @.jvm <jvm> + (<write> 0 value (<new> 1)))))) (def: .public (read! atom) (All (_ a) (-> (Atom a) (IO a))) - (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::get (:representation atom))] + (with_expansions [<jvm> (java/util/concurrent/atomic/AtomicReference::get (representation atom))] (for @.old <jvm> @.jvm <jvm> - (io.io (<read> 0 (:representation atom)))))) + (io.io (<read> 0 (representation atom)))))) (def: .public (compare_and_swap! current new atom) (All (_ a) (-> a a (Atom a) (IO Bit))) - (io.io (with_expansions [<jvm> (ffi.of_boolean (java/util/concurrent/atomic/AtomicReference::compareAndSet current new (:representation atom)))] + (io.io (with_expansions [<jvm> (ffi.of_boolean (java/util/concurrent/atomic/AtomicReference::compareAndSet current new (representation atom)))] (for @.old <jvm> @.jvm <jvm> - (let [old (<read> 0 (:representation atom))] + (let [old (<read> 0 (representation atom))] (if (same? old current) (exec - (<write> 0 new (:representation atom)) + (<write> 0 new (representation atom)) true) false)))))) )) diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index c366207f9..361a2439b 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -11,8 +11,8 @@ ["[0]" try {"+" Try}] ["[0]" exception {"+" exception:}] ["[0]" io {"+" IO io}]] - [type {"+" :sharing} - abstract]]] + [type {"+" sharing} + [abstract {"-" pattern}]]]] [// ["[0]" atom {"+" Atom}] ["[0]" async {"+" Async} ("[1]#[0]" monad)]]) @@ -24,10 +24,10 @@ (type: .public (Sink a) (Interface - (: (IO (Try Any)) - close) - (: (-> a (IO (Try Any))) - feed))) + (is (IO (Try Any)) + close) + (is (-> a (IO (Try Any))) + feed))) (def: (sink resolve) (All (_ a) @@ -56,13 +56,13 @@ (loop [_ []] (do [! io.monad] [current (atom.read! sink) - .let [[next resolve_next] (:sharing [a] - (async.Resolver (Maybe [a (Channel a)])) - current - - [(Async (Maybe [a (Channel a)])) - (async.Resolver (Maybe [a (Channel a)]))] - (async.async []))] + .let [[next resolve_next] (sharing [a] + (async.Resolver (Maybe [a (Channel a)])) + current + + [(Async (Maybe [a (Channel a)])) + (async.Resolver (Maybe [a (Channel a)]))] + (async.async []))] fed? (current {.#Some [value next]})] (if fed? ... I fed the sink. @@ -123,28 +123,28 @@ (def: (conjoint mma) (let [[output sink] (channel [])] (exec - (: (Async Any) - (loop [mma mma] - (do [! async.monad] - [?mma mma] - (case ?mma - {.#Some [ma mma']} - (do ! - [_ (loop [ma ma] - (do ! - [?ma ma] - (case ?ma - {.#Some [a ma']} - (exec - (io.run! (# sink feed a)) - (again ma')) - - {.#None} - (in []))))] - (again mma')) - - {.#None} - (in (: Any (io.run! (# sink close)))))))) + (is (Async Any) + (loop [mma mma] + (do [! async.monad] + [?mma mma] + (case ?mma + {.#Some [ma mma']} + (do ! + [_ (loop [ma ma] + (do ! + [?ma ma] + (case ?ma + {.#Some [a ma']} + (exec + (io.run! (# sink feed a)) + (again ma')) + + {.#None} + (in []))))] + (again mma')) + + {.#None} + (in (is Any (io.run! (# sink close)))))))) output)))) (type: .public (Subscriber a) @@ -153,21 +153,21 @@ (def: .public (subscribe! subscriber channel) (All (_ a) (-> (Subscriber a) (Channel a) (IO Any))) (io (exec - (: (Async Any) - (loop [channel channel] - (do async.monad - [item channel] - (case item - {.#Some [head tail]} - (case (io.run! (subscriber head)) - {.#Some _} - (again tail) - - {.#None} - (in [])) - - {.#None} - (in []))))) + (is (Async Any) + (loop [channel channel] + (do async.monad + [item channel] + (case item + {.#Some [head tail]} + (case (io.run! (subscriber head)) + {.#Some _} + (again tail) + + {.#None} + (in [])) + + {.#None} + (in []))))) []))) (def: .public (only pass? channel) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 753b32dff..504e5472b 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -18,7 +18,7 @@ ["n" nat] ["i" int]]] [type - abstract + ["[0]" abstract {"-" pattern}] ["[0]" refinement]]]] [// ["[0]" atom {"+" Atom}] @@ -40,15 +40,15 @@ (-> Nat Semaphore) (let [max_positions (n.min initial_open_positions ..most_positions_possible)] - (:abstraction (atom.atom [#max_positions max_positions - #open_positions (.int max_positions) - #waiting_list queue.empty])))) + (abstraction (atom.atom [#max_positions max_positions + #open_positions (.int max_positions) + #waiting_list queue.empty])))) (def: .public (wait! semaphore) (Ex (_ k) (-> Semaphore (Async Any))) - (let [semaphore (:representation semaphore) - [signal sink] (: [(Async Any) (Resolver Any)] - (async.async []))] + (let [semaphore (representation semaphore) + [signal sink] (is [(Async Any) (Resolver Any)] + (async.async []))] (exec (io.run! (with_expansions [<had_open_position?> (as_is (the #open_positions) (i.> -1))] @@ -71,7 +71,7 @@ (def: .public (signal! semaphore) (Ex (_ k) (-> Semaphore (Async (Try Int)))) - (let [semaphore (:representation semaphore)] + (let [semaphore (representation semaphore)] (async.future (do [! io.monad] [[pre post] (atom.update! (function (_ state) @@ -99,15 +99,15 @@ (def: .public (mutex _) (-> Any Mutex) - (:abstraction (semaphore 1))) + (abstraction (semaphore 1))) (def: acquire! (-> Mutex (Async Any)) - (|>> :representation ..wait!)) + (|>> representation ..wait!)) (def: release! (-> Mutex (Async Any)) - (|>> :representation ..signal!)) + (|>> representation ..signal!)) (def: .public (synchronize! mutex procedure) (All (_ a) (-> Mutex (IO (Async a)) (Async a))) @@ -122,7 +122,7 @@ (refinement.refiner (n.> 0))) (type: .public Limit - (:~ (refinement.type limit))) + (~ (refinement.type limit))) (abstract: .public Barrier (Record @@ -133,10 +133,10 @@ (def: .public (barrier limit) (-> Limit Barrier) - (:abstraction [#limit limit - #count (atom.atom 0) - #start_turnstile (..semaphore 0) - #end_turnstile (..semaphore 0)])) + (abstraction [#limit limit + #count (atom.atom 0) + #start_turnstile (..semaphore 0) + #end_turnstile (..semaphore 0)])) (def: (un_block! times turnstile) (-> Nat Semaphore (Async Any)) @@ -148,7 +148,7 @@ (# async.monad in [])))) (template [<phase> <update> <goal> <turnstile>] - [(def: (<phase> (^:representation barrier)) + [(def: (<phase> (abstract.pattern barrier)) (-> Barrier (Async Any)) (do async.monad [.let [limit (refinement.value (the #limit barrier)) diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 2be44daba..3668a2e9c 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -16,7 +16,7 @@ [macro ["^" pattern]] [type - abstract]]] + [abstract {"-" pattern}]]]] [// ["[0]" atom {"+" Atom atom}] ["[0]" async {"+" Async Resolver}] @@ -30,24 +30,24 @@ (def: .public (var value) (All (_ a) (-> a (Var a))) - (:abstraction (atom.atom [value (list)]))) + (abstraction (atom.atom [value (list)]))) (def: read! (All (_ a) (-> (Var a) a)) - (|>> :representation atom.read! io.run! product.left)) + (|>> representation atom.read! io.run! product.left)) (def: (un_follow! sink var) (All (_ a) (-> (Sink a) (Var a) (IO Any))) (do io.monad [_ (atom.update! (function (_ [value observers]) [value (list.only (|>> (same? sink) not) observers)]) - (:representation var))] + (representation var))] (in []))) (def: (write! new_value var) (All (_ a) (-> a (Var a) (IO Any))) (do [! io.monad] - [.let [var' (:representation var)] + [.let [var' (representation var)] (^.let old [old_value observers]) (atom.read! var') succeeded? (atom.compare_and_swap! old [new_value observers] var')] (if succeeded? @@ -71,7 +71,7 @@ [.let [[channel sink] (frp.channel [])] _ (atom.update! (function (_ [value observers]) [value {.#Item sink observers}]) - (:representation target))] + (representation target))] (in [channel sink]))) ) @@ -91,11 +91,11 @@ (All (_ a) (-> (Var a) Tx (Maybe a))) (|> tx (list.example (function (_ [_var _original _current]) - (same? (:as (Var Any) var) - (:as (Var Any) _var)))) + (same? (as (Var Any) var) + (as (Var Any) _var)))) (# maybe.monad each (function (_ [_var _original _current]) _current)) - :expected)) + as_expected)) (def: .public (read var) (All (_ a) (-> (Var a) (STM a))) @@ -116,11 +116,11 @@ {.#End} {.#Item [_var _original _current] tx'} - (if (same? (:as (Var Any) var) - (:as (Var Any) _var)) - {.#Item [#var (:as (Var Any) _var) - #original (:as Any _original) - #current (:as Any value)] + (if (same? (as (Var Any) var) + (as (Var Any) _var)) + {.#Item [#var (as (Var Any) _var) + #original (as Any _original) + #current (as Any value)] tx'} {.#Item [#var _var #original _original diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index ff25a2891..3d0be75fd 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -78,13 +78,13 @@ (def: exception (Parser [Code (List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) - (let [private (: (Parser [(List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) - ($_ <>.and - (<>.else (list) (<code>.tuple (<>.some |type_variable|.parser))) - (<>.either (<code>.form (<>.and <code>.local_symbol |input|.parser)) - (<>.and <code>.local_symbol (<>#in (list)))) - (<>.maybe <code>.any) - ))] + (let [private (is (Parser [(List |type_variable|.Variable) [Text (List |input|.Input)] (Maybe Code)]) + ($_ <>.and + (<>.else (list) (<code>.tuple (<>.some |type_variable|.parser))) + (<>.either (<code>.form (<>.and <code>.local_symbol |input|.parser)) + (<>.and <code>.local_symbol (<>#in (list)))) + (<>.maybe <code>.any) + ))] ($_ <>.either (<>.and <code>.any private) (<>.and (<>#in (` .private)) private) @@ -118,15 +118,15 @@ largest_header_size)) text.together (text#composite text.new_line)) - on_entry (: (-> [Text Text] Text) - (function (_ [header message]) - (let [padding (|> " " - (list.repeated (n.- (text.size header) - largest_header_size)) - text.together)] - (|> message - (text.replaced text.new_line on_new_line) - ($_ text#composite padding header header_separator)))))] + on_entry (is (-> [Text Text] Text) + (function (_ [header message]) + (let [padding (|> " " + (list.repeated (n.- (text.size header) + largest_header_size)) + text.together)] + (|> message + (text.replaced text.new_line on_new_line) + ($_ text#composite padding header header_separator)))))] (case entries {.#End} "" diff --git a/stdlib/source/library/lux/control/function/inline.lux b/stdlib/source/library/lux/control/function/inline.lux index ef0836888..f932b64e9 100644 --- a/stdlib/source/library/lux/control/function/inline.lux +++ b/stdlib/source/library/lux/control/function/inline.lux @@ -36,9 +36,9 @@ (monad.all !)) .let [inlined (` (("lux in-module" (~ (code.text @)) - (.: (~ type) - (.function ((~ (code.local_symbol name)) (~+ parameters)) - (~ term)))) + (.is (~ type) + (.function ((~ (code.local_symbol name)) (~+ parameters)) + (~ term)))) (~+ (list#each (function (_ g!parameter) (` ((~' ~) (~ g!parameter)))) g!parameters)))) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 381a1ba28..69b78c0c3 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -3,6 +3,7 @@ (.using [library [lux {"-" open} + ["[0]" type] [abstract [hash {"+" Hash}] [monad {"+" do}]] @@ -37,7 +38,7 @@ (def: .public (open memo) (All (_ i o) - (:let [Memory (Dictionary i o)] + (type.let [Memory (Dictionary i o)] (-> (Memo i o) (-> [Memory i] [Memory o])))) (let [memo (//.fixed (//.mixed ..memoization (//.of_recursive memo)))] (function (_ [memory input]) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index ba9da195e..02f5eaabb 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -47,8 +47,8 @@ (.def: (macro g!context g!self) (-> Code Code Macro) - (<| (:as Macro) - (: Macro') + (<| (as Macro) + (is Macro') (function (_ parameters) (# meta.monad in (list (` (((~ g!self) (~ g!context)) (~+ parameters)))))))) @@ -60,9 +60,9 @@ {.#Item mutual {.#End}} (.let [g!name (|> mutual (the [#declaration declaration.#name]) code.local_symbol)] - (in (list (` (.let [(~ g!name) (: (~ (the #type mutual)) - (function (~ (declaration.format (the #declaration mutual))) - (~ (the #body mutual))))] + (in (list (` (.let [(~ g!name) (is (~ (the #type mutual)) + (function (~ (declaration.format (the #declaration mutual))) + (~ (the #body mutual))))] (~ body)))))) _ @@ -84,9 +84,9 @@ (..macro g!context g!name)]) (list.zipped/2 hidden_names functions)))] - (in (list (` (.let [(~ g!context) (: (Rec (~ g!context) - [(~+ context_types)]) - [(~+ definitions)]) + (in (list (` (.let [(~ g!context) (is (Rec (~ g!context) + [(~+ context_types)]) + [(~+ definitions)]) [(~+ user_names)] (.let [[(~+ user_names)] (~ g!context)] [(~+ (list#each (function (_ g!name) (` ((~ g!name) (~ g!context)))) @@ -138,9 +138,9 @@ functions)))] (in (list& (` (.def: (~ g!context) [(~+ (list#each (the [#mutual #type]) functions))] - (.let [(~ g!context) (: (Rec (~ g!context) - [(~+ context_types)]) - [(~+ definitions)]) + (.let [(~ g!context) (is (Rec (~ g!context) + [(~+ context_types)]) + [(~+ definitions)]) [(~+ user_names)] (~ g!context)] [(~+ (list#each (function (_ g!name) (` ((~ g!name) (~ g!context)))) diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index f112b4e1b..3edf5e3ee 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -1,34 +1,35 @@ (.using - [library - [lux "*" - [abstract - [functor {"+" Functor}] - [apply {"+" Apply}] - [monad {"+" Monad do}]] - [control - [parser - ["<[0]>" code]]] - [type - abstract] - [macro {"+" with_symbols} - [syntax {"+" syntax:}] - ["[0]" template]]]]) + [library + [lux "*" + [abstract + [functor {"+" Functor}] + [apply {"+" Apply}] + [monad {"+" Monad do}]] + [control + [parser + ["<[0]>" code]]] + [type + [abstract {"-" pattern}]] + [macro {"+" with_symbols} + [syntax {"+" syntax:}] + ["[0]" template]]]]) (abstract: .public (IO a) (-> Any a) (def: label (All (_ a) (-> (-> Any a) (IO a))) - (|>> :abstraction)) + (|>> abstraction)) (template: (!io computation) - [(:abstraction (template.with_locals [g!func g!arg] - (function (g!func g!arg) - computation)))]) + [(abstraction + (template.with_locals [g!func g!arg] + (function (g!func g!arg) + computation)))]) (template: (run!' io) ... creatio ex nihilo - [((:representation io) [])]) + [((representation io) [])]) (syntax: .public (io [computation <code>.any]) (with_symbols [g!func g!arg] diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 01b3432cd..27131e570 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -14,34 +14,34 @@ ["[0]" atom]]] [macro {"+" with_symbols} [syntax {"+" syntax:}]] - [type {"+" :sharing} - abstract]]]) + [type {"+" sharing} + [abstract {"-" pattern}]]]]) (abstract: .public (Lazy a) (-> [] a) (def: (lazy' generator) (All (_ a) (-> (-> [] a) (Lazy a))) - (let [cache (atom.atom (:sharing [a] - (-> [] a) - generator + (let [cache (atom.atom (sharing [a] + (-> [] a) + generator - (Maybe a) - {.#None}))] - (:abstraction (function (_ _) - (case (io.run! (atom.read! cache)) - {.#Some value} - value + (Maybe a) + {.#None}))] + (abstraction (function (_ _) + (case (io.run! (atom.read! cache)) + {.#Some value} + value - _ - (let [value (generator [])] - (exec - (io.run! (atom.compare_and_swap! _ {.#Some value} cache)) - value))))))) + _ + (let [value (generator [])] + (exec + (io.run! (atom.compare_and_swap! _ {.#Some value} cache)) + value))))))) (def: .public (value lazy) (All (_ a) (-> (Lazy a) a)) - ((:representation lazy) []))) + ((representation lazy) []))) (syntax: .public (lazy [expression <code>.any]) (with_symbols [g!_] diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index cd963db10..98192ffa1 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -39,7 +39,7 @@ ... {.#None} it - (:expected it)))) + (as_expected it)))) (implementation: .public apply (Apply Maybe) @@ -69,7 +69,7 @@ ... {.#None} it - (:expected it)))) + (as_expected it)))) (implementation: .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Maybe a)))) @@ -119,7 +119,7 @@ ... {.#None} it - (in (:expected it)))))) + (in (as_expected it)))))) (def: .public (lifted monad) (All (_ M a) (-> (Monad M) (-> (M a) (M (Maybe a))))) @@ -128,7 +128,7 @@ (macro: .public (else tokens state) (case tokens (pattern (.list else maybe)) - (let [g!temp (: Code [location.dummy {.#Symbol ["" ""]}])] + (let [g!temp (is Code [location.dummy {.#Symbol ["" ""]}])] {.#Right [state (.list (` (.case (~ maybe) {.#Some (~ g!temp)} (~ g!temp) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index ba305659a..b8c37c1bb 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -1,7 +1,7 @@ (.using [library [lux {"-" and or nat int rev list type symbol} - [type {"+" :sharing}] + [type {"+" sharing}] [abstract [hash {"+" Hash}] [monad {"+" do}]] @@ -111,8 +111,8 @@ (template: (!variant <case>+) [(do [! //.monad] - [flag (: (Parser Nat) - ..bits/8)] + [flag (is (Parser Nat) + ..bits/8)] (with_expansions [<case>+' (template.spliced <case>+)] (case flag (^.template [<number> <tag> <parser>] @@ -144,8 +144,8 @@ (def: .public bit (Parser Bit) (do //.monad - [value (: (Parser Nat) - ..bits/8)] + [value (is (Parser Nat) + ..bits/8)] (case value 0 (in #0) 1 (in #1) @@ -192,15 +192,15 @@ [(def: .public (<name> valueP) (All (_ v) (-> (Parser v) (Parser (Sequence v)))) (do //.monad - [amount (: (Parser Nat) - <bits>)] + [amount (is (Parser Nat) + <bits>)] (loop [index 0 - output (:sharing [v] - (Parser v) - valueP - - (Sequence v) - sequence.empty)] + output (sharing [v] + (Parser v) + valueP + + (Sequence v) + sequence.empty)] (if (n.< amount index) (do //.monad [value valueP] diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 8550ce29f..6587f2270 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -186,7 +186,7 @@ .let [funcL (label funcI) [all_varsL env'] (loop [current_arg 0 env' env - all_varsL (: (List Code) (list))] + all_varsL (is (List Code) (list))] (if (n.< num_args current_arg) (if (n.= 0 current_arg) (let [varL (label (++ funcI))] diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index f66ce87c4..b23ddf2e6 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -1,27 +1,27 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["[0]" io {"+" IO}] - ["<>" parser - ["<c>" code]] - [concurrency - ["[0]" async {"+" Async}]]] - [data - [text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [type - abstract] - ["[0]" meta] - ["[0]" macro - ["[0]" code] - [syntax {"+" syntax:} - ["|[0]|" export] - ["|[0]|" declaration]]]]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + ["[0]" io {"+" IO}] + ["<>" parser + ["<c>" code]] + [concurrency + ["[0]" async {"+" Async}]]] + [data + [text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [type + [abstract {"-" pattern}]] + ["[0]" meta] + ["[0]" macro + ["[0]" code] + [syntax {"+" syntax:} + ["|[0]|" export] + ["|[0]|" declaration]]]]]) (abstract: .public (Capability brand input output) (-> input output) @@ -30,14 +30,14 @@ (All (_ brand input output) (-> (-> input output) (Capability brand input output))) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (use capability input) (All (_ brand input output) (-> (Capability brand input output) input output)) - ((:representation capability) input)) + ((representation capability) input)) (syntax: .public (capability: [[export_policy declaration [forger input output]] (|export|.parser @@ -65,5 +65,5 @@ (All (_ brand input output) (-> (Capability brand input (IO output)) (Capability brand input (Async output)))) - (..capability (|>> ((:representation capability)) async.future))) + (..capability (|>> ((representation capability)) async.future))) ) diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index 17a7ff1d8..d3165f0c6 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -1,12 +1,12 @@ (.using - [library - [lux "*" - [abstract - [functor {"+" Functor}] - [apply {"+" Apply}] - [monad {"+" Monad}]] - [type - abstract]]]) + [library + [lux "*" + [abstract + [functor {"+" Functor}] + [apply {"+" Apply}] + [monad {"+" Monad}]] + [type + [abstract {"-" pattern}]]]]) (abstract: .public (Policy brand value label) value @@ -39,8 +39,8 @@ (def: privilege Privilege - [#can_upgrade (|>> :abstraction) - #can_downgrade (|>> :representation)]) + [#can_upgrade (|>> abstraction) + #can_downgrade (|>> representation)]) (def: .public (with_policy context) (All (_ brand scope) @@ -55,25 +55,25 @@ (constructor (All (_ value) (Policy brand value label)))))) (implementation: .public functor - (:~ (..of_policy Functor)) + (~ (..of_policy Functor)) (def: (each f fa) - (|> fa :representation f :abstraction))) + (|> fa representation f abstraction))) (implementation: .public apply - (:~ (..of_policy Apply)) + (~ (..of_policy Apply)) (def: &functor ..functor) (def: (on fa ff) - (:abstraction ((:representation ff) (:representation fa))))) + (abstraction ((representation ff) (representation fa))))) (implementation: .public monad - (:~ (..of_policy Monad)) + (~ (..of_policy Monad)) (def: &functor ..functor) - (def: in (|>> :abstraction)) - (def: conjoint (|>> :representation))) + (def: in (|>> abstraction)) + (def: conjoint (|>> representation))) ) (template [<brand> <value> <upgrade> <downgrade>] diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux index b07c213a1..95c7ddc69 100644 --- a/stdlib/source/library/lux/control/thread.lux +++ b/stdlib/source/library/lux/control/thread.lux @@ -12,7 +12,7 @@ [collection ["[0]" array {"+" Array}]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (type: .public (Thread ! a) (-> ! a)) @@ -25,33 +25,33 @@ (function (_ !) (|> (array.empty 1) (array.write! 0 init) - :abstraction))) + abstraction))) (def: .public (read! box) (All (_ ! a) (-> (Box ! a) (Thread ! a))) (function (_ !) (for @.old - ("jvm aaload" (:representation box) 0) + ("jvm aaload" (representation box) 0) @.jvm ("jvm array read object" (|> 0 - (:as (Primitive "java.lang.Long")) + (as (Primitive "java.lang.Long")) "jvm object cast" "jvm conversion long-to-int") - (:representation box)) + (representation box)) - @.js ("js array read" 0 (:representation box)) - @.python ("python array read" 0 (:representation box)) - @.lua ("lua array read" 0 (:representation box)) - @.ruby ("ruby array read" 0 (:representation box)) - @.php ("php array read" 0 (:representation box)) - @.scheme ("scheme array read" 0 (:representation box))))) + @.js ("js array read" 0 (representation box)) + @.python ("python array read" 0 (representation box)) + @.lua ("lua array read" 0 (representation box)) + @.ruby ("ruby array read" 0 (representation box)) + @.php ("php array read" 0 (representation box)) + @.scheme ("scheme array read" 0 (representation box))))) (def: .public (write! value box) (All (_ a) (-> a (All (_ !) (-> (Box ! a) (Thread ! Any))))) (function (_ !) - (|> box :representation (array.write! 0 value) :abstraction))) + (|> box representation (array.write! 0 value) abstraction))) ) (def: .public (result thread) diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 6f50ef702..4da14bb92 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -25,7 +25,7 @@ ... {#Failure msg} it - (:expected it)))) + (as_expected it)))) (implementation: .public apply (Apply Try) @@ -41,11 +41,11 @@ ... {#Failure msg} it - (:expected it)) + (as_expected it)) ... {#Failure msg} it - (:expected it)))) + (as_expected it)))) (implementation: .public monad (Monad Try) @@ -62,7 +62,7 @@ ... {#Failure msg} it - (:expected it)))) + (as_expected it)))) (implementation: .public (with monad) ... TODO: Replace (All (_ a) (! (Try a))) with (functor.Then ! Try) @@ -85,7 +85,7 @@ ... {#Failure error} it - (in (:expected it)))))) + (in (as_expected it)))))) (def: .public (lifted monad) (All (_ ! a) (-> (Monad !) (-> (! a) (! (Try a))))) diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index 852891255..bfbf6183e 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -63,12 +63,12 @@ (def: (conjoint MlMla) (do monad [[l1 Mla] (for @.old - (: {.#Apply (Writer (:parameter 0) - {.#Apply (Writer (:parameter 0) - (:parameter 2)) - (:parameter 1)}) - (:parameter 1)} - MlMla) + (is {.#Apply (Writer (parameter 0) + {.#Apply (Writer (parameter 0) + (parameter 2)) + (parameter 1)}) + (parameter 1)} + MlMla) ... On new compiler MlMla) [l2 a] Mla] diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux index 45527975a..797bb5981 100644 --- a/stdlib/source/library/lux/data/collection/bits.lux +++ b/stdlib/source/library/lux/data/collection/bits.lux @@ -83,7 +83,7 @@ chunk (|> (if (same? ..empty output) - (: Bits (array.empty size|output)) + (is Bits (array.empty size|output)) output) (array.write! idx|output (.i64 chunk)) (again (-- size|output)))) @@ -124,7 +124,7 @@ chunk (if (n.> 0 size|output) (|> (if (same? ..empty output) - (: Bits (array.empty size|output)) + (is Bits (array.empty size|output)) output) (array.write! idx (.i64 chunk)) (again (-- size|output))) @@ -151,7 +151,7 @@ chunk (|> (if (same? ..empty output) - (: Bits (array.empty size|output)) + (is Bits (array.empty size|output)) output) (array.write! idx (.i64 chunk)) (again (-- size|output)))) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 4b0071ddd..450bfea3a 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -382,10 +382,10 @@ (if (< x x') [{.#Item x' pre} post] [pre {.#Item x' post}])) - (`` [(: (~~ (:of xs)) - (list)) - (: (~~ (:of xs)) - (list))]) + (`` [(is (~~ (type_of xs)) + (list)) + (is (~~ (type_of xs)) + (list))]) xs')] ($_ composite (sorted < pre) (list x) (sorted < post))))) @@ -460,9 +460,9 @@ (if (n.> 0 num_lists) (let [(open "[0]") ..functor indices (..indices num_lists) - type_vars (: (List Code) (each (|>> nat#encoded symbol$) indices)) + type_vars (is (List Code) (each (|>> nat#encoded symbol$) indices)) zipped_type (` (.All ((~ (symbol$ "0_")) (~+ type_vars)) - (-> (~+ (each (: (-> Code Code) (function (_ var) (` (List (~ var))))) + (-> (~+ (each (is (-> Code Code) (function (_ var) (` (List (~ var))))) type_vars)) (List [(~+ type_vars)])))) vars+lists (|> indices @@ -476,15 +476,15 @@ g!step (symbol$ "0step0") g!blank (symbol$ "0,0") list_vars (each product.right vars+lists) - code (` (: (~ zipped_type) - (function ((~ g!step) (~+ list_vars)) - (case [(~+ list_vars)] - (~ pattern) - {.#Item [(~+ (each product.left vars+lists))] - ((~ g!step) (~+ list_vars))} - - (~ g!blank) - {.#End}))))] + code (` (is (~ zipped_type) + (function ((~ g!step) (~+ list_vars)) + (case [(~+ list_vars)] + (~ pattern) + {.#Item [(~+ (each product.left vars+lists))] + ((~ g!step) (~+ list_vars))} + + (~ g!blank) + {.#End}))))] {.#Right [state (list code)]}) {.#Left "Cannot zipped 0 lists."}) @@ -502,10 +502,10 @@ indices (..indices num_lists) g!return_type (symbol$ "0return_type0") g!func (symbol$ "0func0") - type_vars (: (List Code) (each (|>> nat#encoded symbol$) indices)) + type_vars (is (List Code) (each (|>> nat#encoded symbol$) indices)) zipped_type (` (All ((~ (symbol$ "0_")) (~+ type_vars) (~ g!return_type)) (-> (-> (~+ type_vars) (~ g!return_type)) - (~+ (each (: (-> Code Code) (function (_ var) (` (List (~ var))))) + (~+ (each (is (-> Code Code) (function (_ var) (` (List (~ var))))) type_vars)) (List (~ g!return_type))))) vars+lists (|> indices @@ -519,15 +519,15 @@ g!step (symbol$ "0step0") g!blank (symbol$ "0,0") list_vars (each product.right vars+lists) - code (` (: (~ zipped_type) - (function ((~ g!step) (~ g!func) (~+ list_vars)) - (case [(~+ list_vars)] - (~ pattern) - {.#Item ((~ g!func) (~+ (each product.left vars+lists))) - ((~ g!step) (~ g!func) (~+ list_vars))} - - (~ g!blank) - {.#End}))))] + code (` (is (~ zipped_type) + (function ((~ g!step) (~ g!func) (~+ list_vars)) + (case [(~+ list_vars)] + (~ pattern) + {.#Item ((~ g!func) (~+ (each product.left vars+lists))) + ((~ g!step) (~ g!func) (~+ list_vars))} + + (~ g!blank) + {.#End}))))] {.#Right [state (list code)]}) {.#Left "Cannot zipped_with 0 lists."}) @@ -585,9 +585,9 @@ (do [! monad] [lMla MlMla ... TODO: Remove this version ASAP and use one below. - lla (for @.old (: {.#Apply (type (List (List (:parameter 1)))) - (:parameter 0)} - (monad.all ! lMla)) + lla (for @.old (is {.#Apply (type (List (List (parameter 1)))) + (parameter 0)} + (monad.all ! lMla)) (monad.all ! lMla))] (in (..together lla))))) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index 86a1dc237..102472124 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}] - [monad {"+" do}]] - [control - ["[0]" maybe]] - [data - [collection - ["[0]" tree "_" - ["[1]" finger {"+" Tree}]]]] - [math - [number - ["n" nat ("[1]#[0]" interval)]]] - [type {"+" :by_example} - [abstract {"+" abstract: :abstraction :representation}]]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}] + [monad {"+" do}]] + [control + ["[0]" maybe]] + [data + [collection + ["[0]" tree "_" + ["[1]" finger {"+" Tree}]]]] + [math + [number + ["n" nat ("[1]#[0]" interval)]]] + [type {"+" by_example} + [abstract {"+" abstract: abstraction representation}]]]]) (type: .public Priority Nat) @@ -31,29 +31,29 @@ (tree.builder n.maximum)) (def: :@: - (:by_example [@] - (tree.Builder @ Priority) - ..builder - - @)) + (by_example [@] + (tree.Builder @ Priority) + ..builder + + @)) (abstract: .public (Queue a) (Maybe (Tree :@: Priority a)) (def: .public empty Queue - (:abstraction {.#None})) + (abstraction {.#None})) (def: .public (front queue) (All (_ a) (-> (Queue a) (Maybe a))) (do maybe.monad - [tree (:representation queue)] + [tree (representation queue)] (tree.one (n.= (tree.tag tree)) tree))) (def: .public (size queue) (All (_ a) (-> (Queue a) Nat)) - (case (:representation queue) + (case (representation queue) {.#None} 0 @@ -68,7 +68,7 @@ (def: .public (member? equivalence queue member) (All (_ a) (-> (Equivalence a) (Queue a) a Bit)) - (case (:representation queue) + (case (representation queue) {.#None} false @@ -84,9 +84,9 @@ (def: .public (next queue) (All (_ a) (-> (Queue a) (Queue a))) - (:abstraction + (abstraction (do maybe.monad - [tree (:representation queue) + [tree (representation queue) .let [highest_priority (tree.tag tree)]] (loop [node tree] (case (tree.root node) @@ -113,8 +113,8 @@ (def: .public (end priority value queue) (All (_ a) (-> Priority a (Queue a) (Queue a))) (let [addition (# ..builder leaf priority value)] - (:abstraction - (case (:representation queue) + (abstraction + (case (representation queue) {.#None} {.#Some addition} diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 34a3e512d..285a65109 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -225,8 +225,8 @@ ... If so, a brand-new root must be established, that is ... 1-level taller. (|> sequence - (.has #root (|> (`` (: (Hierarchy (~~ (:of val))) - (empty_hierarchy []))) + (.has #root (|> (`` (is (Hierarchy (~~ (type_of val))) + (empty_hierarchy []))) (array.has! 0 {#Hierarchy (the #root sequence)}) (array.has! 1 (..path (the #level sequence) (the #tail sequence))))) (.revised #level level_up)) @@ -291,9 +291,9 @@ {try.#Success (if (n.< (tail_off sequence_size) idx) (.revised #root (hierarchy#has (the #level sequence) idx val) sequence) - (.revised #tail (`` (: (-> (Base (~~ (:of val))) - (Base (~~ (:of val)))) - (|>> array.clone (array.has! (branch_idx idx) val)))) + (.revised #tail (`` (is (-> (Base (~~ (type_of val))) + (Base (~~ (type_of val)))) + (|>> array.clone (array.has! (branch_idx idx) val)))) sequence))} (exception.except ..index_out_of_bounds [sequence idx])))) @@ -485,15 +485,15 @@ [(def: .public <name> (All (_ a) (-> (Predicate a) (Sequence a) Bit)) - (let [help (: (All (_ a) - (-> (Predicate a) (Node a) Bit)) - (function (help predicate node) - (case node - {#Base base} - (<array> predicate base) - - {#Hierarchy hierarchy} - (<array> (help predicate) hierarchy))))] + (let [help (is (All (_ a) + (-> (Predicate a) (Node a) Bit)) + (function (help predicate node) + (case node + {#Base base} + (<array> predicate base) + + {#Hierarchy hierarchy} + (<array> (help predicate) hierarchy))))] (function (<name> predicate sequence) (let [(open "_[0]") sequence] (<op> (help predicate {#Hierarchy _#root}) diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index ea7fd7df0..6de0ed5df 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -14,7 +14,7 @@ [number ["n" nat]]] [type - [abstract {"+" abstract: :abstraction :representation ^:representation}]]]] + ["[0]" abstract {"+" abstract: abstraction representation}]]]] ["[0]" // [// ["[0]" list ("[1]#[0]" mix monoid)] @@ -25,42 +25,42 @@ (def: .public empty (All (_ a) (-> (Hash a) (Set a))) - (|>> dictionary.empty :abstraction)) + (|>> dictionary.empty abstraction)) (def: .public size (All (_ a) (-> (Set a) Nat)) - (|>> :representation dictionary.values (list#mix n.+ 0))) + (|>> representation dictionary.values (list#mix n.+ 0))) (def: .public (has multiplicity elem set) (All (_ a) (-> Nat a (Set a) (Set a))) (case multiplicity 0 set _ (|> set - :representation + representation (dictionary.revised' elem 0 (n.+ multiplicity)) - :abstraction))) + abstraction))) (def: .public (lacks multiplicity elem set) (All (_ a) (-> Nat a (Set a) (Set a))) (case multiplicity 0 set - _ (case (dictionary.value elem (:representation set)) + _ (case (dictionary.value elem (representation set)) {.#Some current} - (:abstraction + (abstraction (if (n.> multiplicity current) - (dictionary.revised elem (n.- multiplicity) (:representation set)) - (dictionary.lacks elem (:representation set)))) + (dictionary.revised elem (n.- multiplicity) (representation set)) + (dictionary.lacks elem (representation set)))) {.#None} set))) (def: .public (multiplicity set elem) (All (_ a) (-> (Set a) a Nat)) - (|> set :representation (dictionary.value elem) (maybe.else 0))) + (|> set representation (dictionary.value elem) (maybe.else 0))) (def: .public list (All (_ a) (-> (Set a) (List a))) - (|>> :representation + (|>> representation dictionary.entries (list#mix (function (_ [elem multiplicity] output) (list#composite (list.repeated multiplicity elem) output)) @@ -69,13 +69,13 @@ (template [<name> <composite>] [(def: .public (<name> parameter subject) (All (_ a) (-> (Set a) (Set a) (Set a))) - (:abstraction (dictionary.merged_with <composite> (:representation parameter) (:representation subject))))] + (abstraction (dictionary.merged_with <composite> (representation parameter) (representation subject))))] [union n.max] [sum n.+] ) - (def: .public (intersection parameter (^:representation subject)) + (def: .public (intersection parameter (abstract.pattern subject)) (All (_ a) (-> (Set a) (Set a) (Set a))) (list#mix (function (_ [elem multiplicity] output) (..has (n.min (..multiplicity parameter elem) @@ -88,7 +88,7 @@ (def: .public (difference parameter subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (|> parameter - :representation + representation dictionary.entries (list#mix (function (_ [elem multiplicity] output) (..lacks multiplicity elem output)) @@ -97,7 +97,7 @@ (def: .public (sub? reference subject) (All (_ a) (-> (Set a) (Set a) Bit)) (|> subject - :representation + representation dictionary.entries (list.every? (function (_ [elem multiplicity]) (|> elem @@ -106,7 +106,7 @@ (def: .public (support set) (All (_ a) (-> (Set a) (//.Set a))) - (let [(^.let set [hash _]) (:representation set)] + (let [(^.let set [hash _]) (representation set)] (|> set dictionary.keys (//.of_list hash)))) @@ -114,9 +114,9 @@ (implementation: .public equivalence (All (_ a) (Equivalence (Set a))) - (def: (= (^:representation reference) sample) + (def: (= (abstract.pattern reference) sample) (and (n.= (dictionary.size reference) - (dictionary.size (:representation sample))) + (dictionary.size (representation sample))) (|> reference dictionary.entries (list.every? (function (_ [elem multiplicity]) @@ -129,7 +129,7 @@ (def: &equivalence ..equivalence) - (def: (hash (^:representation set)) + (def: (hash (abstract.pattern set)) (let [[hash _] set] (list#mix (function (_ [elem multiplicity] acc) (|> elem (# hash hash) (n.* multiplicity) (n.+ acc))) diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux index 5827e0993..c73e4d04a 100644 --- a/stdlib/source/library/lux/data/collection/set/ordered.lux +++ b/stdlib/source/library/lux/data/collection/set/ordered.lux @@ -10,23 +10,23 @@ [dictionary ["/" ordered]]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Set a) (/.Dictionary a a) (def: .public empty (All (_ a) (-> (Order a) (Set a))) - (|>> /.empty :abstraction)) + (|>> /.empty abstraction)) (def: .public (member? set elem) (All (_ a) (-> (Set a) a Bit)) - (/.key? (:representation set) elem)) + (/.key? (representation set) elem)) (template [<type> <name> <alias>] [(def: .public <name> (All (_ a) (-> (Set a) <type>)) - (|>> :representation <alias>))] + (|>> representation <alias>))] [(Maybe a) min /.min] [(Maybe a) max /.max] @@ -36,15 +36,15 @@ (def: .public (has elem set) (All (_ a) (-> a (Set a) (Set a))) - (|> set :representation (/.has elem elem) :abstraction)) + (|> set representation (/.has elem elem) abstraction)) (def: .public (lacks elem set) (All (_ a) (-> a (Set a) (Set a))) - (|> set :representation (/.lacks elem) :abstraction)) + (|> set representation (/.lacks elem) abstraction)) (def: .public list (All (_ a) (-> (Set a) (List a))) - (|>> :representation /.keys)) + (|>> representation /.keys)) (def: .public (of_list &order list) (All (_ a) (-> (Order a) (List a) (Set a))) @@ -58,19 +58,19 @@ (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list right) (list.only (..member? left)) - (..of_list (the /.#&order (:representation right))))) + (..of_list (the /.#&order (representation right))))) (def: .public (difference param subject) (All (_ a) (-> (Set a) (Set a) (Set a))) (|> (..list subject) (list.only (|>> (..member? param) not)) - (..of_list (the /.#&order (:representation subject))))) + (..of_list (the /.#&order (representation subject))))) (implementation: .public equivalence (All (_ a) (Equivalence (Set a))) (def: (= reference sample) - (# (list.equivalence (# (:representation reference) &equivalence)) + (# (list.equivalence (# (representation reference) &equivalence)) = (..list reference) (..list sample)))) ) diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index 5c096b40b..fa7a5c589 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -1,33 +1,33 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}] - [functor {"+" Functor}]] - [data - [collection - ["//" list]]] - [type - abstract]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}] + [functor {"+" Functor}]] + [data + [collection + ["//" list]]] + [type + [abstract {"-" pattern}]]]]) (abstract: .public (Stack a) (List a) (def: .public empty Stack - (:abstraction (list))) + (abstraction (list))) (def: .public size (All (_ a) (-> (Stack a) Nat)) - (|>> :representation //.size)) + (|>> representation //.size)) (def: .public empty? (All (_ a) (-> (Stack a) Bit)) - (|>> :representation //.empty?)) + (|>> representation //.empty?)) (def: .public (value stack) (All (_ a) (-> (Stack a) (Maybe a))) - (case (:representation stack) + (case (representation stack) {.#End} {.#None} @@ -36,16 +36,16 @@ (def: .public (next stack) (All (_ a) (-> (Stack a) (Maybe [a (Stack a)]))) - (case (:representation stack) + (case (representation stack) {.#End} {.#None} {.#Item top stack'} - {.#Some [top (:abstraction stack')]})) + {.#Some [top (abstraction stack')]})) (def: .public (top value stack) (All (_ a) (-> a (Stack a) (Stack a))) - (:abstraction {.#Item value (:representation stack)})) + (abstraction {.#Item value (representation stack)})) (implementation: .public (equivalence super) (All (_ a) @@ -53,14 +53,14 @@ (Equivalence (Stack a)))) (def: (= reference subject) - (# (//.equivalence super) = (:representation reference) (:representation subject)))) + (# (//.equivalence super) = (representation reference) (representation subject)))) (implementation: .public functor (Functor Stack) (def: (each f value) (|> value - :representation + representation (# //.functor each f) - :abstraction))) + abstraction))) ) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index 30486daff..26caf5317 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -8,7 +8,7 @@ [collection ["[0]" list ("[1]#[0]" monoid)]]] [type - [abstract {"+" abstract: :abstraction :representation}]]]]) + [abstract {"+" abstract: abstraction representation}]]]]) ... https://en.wikipedia.org/wiki/Finger_tree (abstract: .public (Tree @ t v) @@ -20,19 +20,19 @@ (type: .public (Builder @ t) (Interface - (: (All (_ v) - (-> t v (Tree @ t v))) - leaf) - (: (All (_ v) - (-> (Tree @ t v) - (Tree @ t v) - (Tree @ t v))) - branch))) + (is (All (_ v) + (-> t v (Tree @ t v))) + leaf) + (is (All (_ v) + (-> (Tree @ t v) + (Tree @ t v) + (Tree @ t v))) + branch))) (template [<name> <tag> <output>] [(def: .public <name> (All (_ @ t v) (-> (Tree @ t v) <output>)) - (|>> :representation (the <tag>)))] + (|>> representation (the <tag>)))] [tag #tag t] [root #root (Either v [(Tree @ t v) (Tree @ t v)])] @@ -42,20 +42,20 @@ (All (_ t) (Ex (_ @) (-> (Monoid t) (Builder @ t)))) (def: (leaf tag value) - (:abstraction + (abstraction [#monoid monoid #tag tag #root {.#Left value}])) (def: (branch left right) - (:abstraction + (abstraction [#monoid monoid #tag (# monoid composite (..tag left) (..tag right)) #root {.#Right [left right]}]))) (def: .public (value tree) (All (_ @ t v) (-> (Tree @ t v) v)) - (case (the #root (:representation tree)) + (case (the #root (representation tree)) {0 #0 value} value @@ -64,9 +64,9 @@ (def: .public (tags tree) (All (_ @ t v) (-> (Tree @ t v) (List t))) - (case (the #root (:representation tree)) + (case (the #root (representation tree)) {0 #0 value} - (list (the #tag (:representation tree))) + (list (the #tag (representation tree))) {0 #1 [left right]} (list#composite (tags left) @@ -74,7 +74,7 @@ (def: .public (values tree) (All (_ @ t v) (-> (Tree @ t v) (List v))) - (case (the #root (:representation tree)) + (case (the #root (representation tree)) {0 #0 value} (list value) @@ -84,7 +84,7 @@ (def: .public (one predicate tree) (All (_ @ t v) (-> (Predicate t) (Tree @ t v) (Maybe v))) - (let [[monoid tag root] (:representation tree)] + (let [[monoid tag root] (representation tree)] (if (predicate tag) (let [(open "tag//[0]") monoid] (loop [_tag tag//identity @@ -96,8 +96,8 @@ {0 #1 [left right]} (let [shifted_tag (tag//composite _tag (..tag left))] (if (predicate shifted_tag) - (again _tag (the #root (:representation left))) - (again shifted_tag (the #root (:representation right)))))))) + (again _tag (the #root (representation left))) + (again shifted_tag (the #root (representation right)))))))) {.#None}))) ) diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index e4fd53818..9986e63a8 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -104,11 +104,11 @@ [family (the #family zipper)] (in (let [(open "_[0]") family] (for @.old - (revised #node (: (-> (Tree (:parameter 0)) - (Tree (:parameter 0))) - (has //.#children (list#composite (list.reversed _#lefts) - {.#Item (the #node zipper) - _#rights}))) + (revised #node (is (-> (Tree (parameter 0)) + (Tree (parameter 0))) + (has //.#children (list#composite (list.reversed _#lefts) + {.#Item (the #node zipper) + _#rights}))) _#parent) (has [#node //.#children] (list#composite (list.reversed _#lefts) @@ -128,10 +128,10 @@ (has <side> side') (revised <op_side> (|>> {.#Item (the #node zipper)})))} #node next] - (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) - (function (_ side' zipper) - (|>> (has <side> side') - (revised <op_side> (|>> {.#Item (the #node zipper)})))))] + (let [move (is (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) + (function (_ side' zipper) + (|>> (has <side> side') + (revised <op_side> (|>> {.#Item (the #node zipper)})))))] [#family {.#Some (move side' zipper family)} #node next]))} @@ -158,11 +158,11 @@ (revised <op_side> (|>> {.#Item (the #node zipper)} (list#composite prevs))))} #node last] - (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) - (function (_ prevs zipper) - (|>> (has <side> {.#End}) - (revised <op_side> (|>> {.#Item (the #node zipper)} - (list#composite prevs))))))] + (let [move (is (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) + (function (_ prevs zipper) + (|>> (has <side> {.#End}) + (revised <op_side> (|>> {.#Item (the #node zipper)} + (list#composite prevs))))))] [#family {.#Some (move prevs zipper family)} #node last]))})))] @@ -310,12 +310,12 @@ (the [#node //.#value])) (def: (disjoint (open "_[0]")) - (let [tree_splitter (: (All (_ a) (-> (Tree a) (Tree (Zipper a)))) - (function (tree_splitter tree) - [//.#value (..zipper tree) - //.#children (|> tree - (the //.#children) - (list#each tree_splitter))]))] + (let [tree_splitter (is (All (_ a) (-> (Tree a) (Tree (Zipper a)))) + (function (tree_splitter tree) + [//.#value (..zipper tree) + //.#children (|> tree + (the //.#children) + (list#each tree_splitter))]))] [#family (maybe#each (function (_ (open "_[0]")) [..#parent (disjoint _#parent) ..#lefts (list#each tree_splitter _#lefts) diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux index 093a2b6ba..c5cf003ef 100644 --- a/stdlib/source/library/lux/data/color.lux +++ b/stdlib/source/library/lux/data/color.lux @@ -16,7 +16,7 @@ ["[0]" rev ("[1]#[0]" interval)] ["[0]" i64]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: rgb_limit 256) (def: top (-- rgb_limit)) @@ -56,20 +56,20 @@ (def: .public (of_rgb [red green blue]) (-> RGB Color) - (:abstraction [#red (n.% ..rgb_limit red) - #green (n.% ..rgb_limit green) - #blue (n.% ..rgb_limit blue)])) + (abstraction [#red (n.% ..rgb_limit red) + #green (n.% ..rgb_limit green) + #blue (n.% ..rgb_limit blue)])) (def: .public rgb (-> Color RGB) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (Equivalence Color) (def: (= reference sample) - (let [[rR gR bR] (:representation reference) - [rS gS bS] (:representation sample)] + (let [[rR gR bR] (representation reference) + [rS gS bS] (representation sample)] (and (n.= rR rS) (n.= gR gS) (n.= bR bS))))) @@ -80,7 +80,7 @@ (def: &equivalence ..equivalence) (def: (hash value) - (let [[r g b] (:representation value)] + (let [[r g b] (representation value)] ($_ i64.or (i64.left_shifted 16 r) (i64.left_shifted 8 g) @@ -104,11 +104,11 @@ (def: identity ..black) (def: (composite left right) - (let [[lR lG lB] (:representation left) - [rR rG rB] (:representation right)] - (:abstraction [#red (n.max lR rR) - #green (n.max lG rG) - #blue (n.max lB rB)])))) + (let [[lR lG lB] (representation left) + [rR rG rB] (representation right)] + (abstraction [#red (n.max lR rR) + #green (n.max lG rG) + #blue (n.max lB rB)])))) (def: (opposite_intensity value) (-> Nat Nat) @@ -116,10 +116,10 @@ (def: .public (complement color) (-> Color Color) - (let [[red green blue] (:representation color)] - (:abstraction [#red (opposite_intensity red) - #green (opposite_intensity green) - #blue (opposite_intensity blue)]))) + (let [[red green blue] (representation color)] + (abstraction [#red (opposite_intensity red) + #green (opposite_intensity green) + #blue (opposite_intensity blue)]))) (implementation: .public subtraction (Monoid Color) @@ -127,11 +127,11 @@ (def: identity ..white) (def: (composite left right) - (let [[lR lG lB] (:representation (..complement left)) - [rR rG rB] (:representation right)] - (:abstraction [#red (n.min lR rR) - #green (n.min lG rG) - #blue (n.min lB rB)])))) + (let [[lR lG lB] (representation (..complement left)) + [rR rG rB] (representation right)] + (abstraction [#red (n.min lR rR) + #green (n.min lG rG) + #blue (n.min lB rB)])))) ) (def: .public (hsl color) @@ -304,12 +304,12 @@ (-> Frac Color Color Color) (let [dS (..normal ratio) dE (|> +1.0 (f.- dS)) - interpolated' (: (-> Nat Nat Nat) - (function (_ end start) - (|> (|> start .int int.frac (f.* dS)) - (f.+ (|> end .int int.frac (f.* dE))) - f.int - .nat))) + interpolated' (is (-> Nat Nat Nat) + (function (_ end start) + (|> (|> start .int int.frac (f.* dS)) + (f.+ (|> end .int int.frac (f.* dE))) + f.int + .nat))) [redS greenS blueS] (rgb start) [redE greenE blueE] (rgb end)] (of_rgb [#red (interpolated' redE redS) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index 649e50f5d..dc42d50d2 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -13,7 +13,7 @@ [number ["[0]" nat]]] [type - [abstract {"-" Frame}]] + [abstract {"-" Frame pattern}]] [world [net {"+" URL}]]]] ["[0]" / "_" @@ -32,25 +32,25 @@ (def: .public css (-> (CSS Any) Text) - (|>> :representation)) + (|>> representation)) (def: .public empty (CSS Any) - (:abstraction "")) + (abstraction "")) (type: .public Style (List (Ex (_ brand) [(Property brand) (Value brand)]))) (def: .public (rule selector style) (-> (Selector Any) Style (CSS Common)) - (:abstraction (format (/selector.selector selector) "{" (/style.inline (/style.style style)) "}"))) + (abstraction (format (/selector.selector selector) "{" (/style.inline (/style.style style)) "}"))) (def: .public char_set (-> Encoding (CSS Special)) (|>> encoding.name %.text (text.enclosed ["@charset " ";"]) - :abstraction)) + abstraction)) (def: .public (font font) (-> Font (CSS Special)) @@ -73,18 +73,18 @@ text.together (text.enclosed ["{" "}"]) (format "@font-face") - :abstraction))) + abstraction))) (def: .public (import url query) (-> URL (Maybe Query) (CSS Special)) - (:abstraction (format (format "@import url(" (%.text url) ")") - (case query - {.#Some query} - (format " " (/query.query query)) - - {.#None} - "") - ";"))) + (abstraction (format (format "@import url(" (%.text url) ")") + (case query + {.#Some query} + (format " " (/query.query query)) + + {.#None} + "") + ";"))) (def: separator text.new_line) @@ -96,20 +96,20 @@ (def: .public (key_frames animation frames) (-> (Value Animation) (List Frame) (CSS Special)) - (:abstraction (format "@keyframes " (/value.value animation) " {" - (|> frames - (list#each (function (_ frame) - (format (/value.value (the #when frame)) " {" - (/style.inline (/style.style (the #what frame))) - "}"))) - (text.interposed ..separator)) - "}"))) + (abstraction (format "@keyframes " (/value.value animation) " {" + (|> frames + (list#each (function (_ frame) + (format (/value.value (the #when frame)) " {" + (/style.inline (/style.style (the #what frame))) + "}"))) + (text.interposed ..separator)) + "}"))) (template: (!composite <pre> <post>) - [(:abstraction - (format (:representation <pre>) + [(abstraction + (format (representation <pre>) ..separator - (:representation <post>)))]) + (representation <post>)))]) (def: .public (and pre post) (All (_ kind) (-> (CSS kind) (CSS kind) (CSS kind))) @@ -118,14 +118,14 @@ (def: .public (in_context combinator selector css) (-> Combinator (Selector Any) (CSS Common) (CSS Common)) (|> css - :representation + representation (text.all_split_by ..separator) (list#each (let [prefix (|> selector (combinator (/selector.tag "")) /selector.selector)] (|>> (format prefix)))) (text.interposed ..separator) - :abstraction)) + abstraction)) (def: .public (dependent combinator selector style inner) (-> Combinator (Selector Any) Style (CSS Common) (CSS Common)) @@ -145,14 +145,14 @@ (All (_ kind) (-> (Specializer kind) (Selector (Generic Any)) (CSS Common) (CSS Common))) (|> css - :representation + representation (text.all_split_by ..separator) (list#each (let [prefix (|> selector - (specializer (:expected (/selector.tag ""))) + (specializer (as_expected (/selector.tag ""))) /selector.selector)] (|>> (format prefix)))) (text.interposed ..separator) - :abstraction)) + abstraction)) (def: .public (specialized combinator selector style inner) (All (_ kind) diff --git a/stdlib/source/library/lux/data/format/css/class.lux b/stdlib/source/library/lux/data/format/css/class.lux index e3b1a67b7..6d056d1ac 100644 --- a/stdlib/source/library/lux/data/format/css/class.lux +++ b/stdlib/source/library/lux/data/format/css/class.lux @@ -11,18 +11,18 @@ [syntax {"+" syntax:}] ["[0]" code]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public Class Text (def: .public class (-> Class Text) - (|>> :representation)) + (|>> representation)) (def: .public custom (-> Text Class) - (|>> :abstraction)) + (|>> abstraction)) (syntax: .public (generic []) (do meta.monad diff --git a/stdlib/source/library/lux/data/format/css/id.lux b/stdlib/source/library/lux/data/format/css/id.lux index c5a6f5862..1ace95687 100644 --- a/stdlib/source/library/lux/data/format/css/id.lux +++ b/stdlib/source/library/lux/data/format/css/id.lux @@ -11,18 +11,18 @@ [syntax {"+" syntax:}] ["[0]" code]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public ID Text (def: .public id (-> ID Text) - (|>> :representation)) + (|>> representation)) (def: .public custom (-> Text ID) - (|>> :abstraction)) + (|>> abstraction)) (syntax: .public (generic []) (do meta.monad diff --git a/stdlib/source/library/lux/data/format/css/property.lux b/stdlib/source/library/lux/data/format/css/property.lux index 155297f84..65b4bfd5f 100644 --- a/stdlib/source/library/lux/data/format/css/property.lux +++ b/stdlib/source/library/lux/data/format/css/property.lux @@ -1,58 +1,58 @@ (.using - [library - [lux {"-" All Location} - [control - [parser - ["s" code]]] - [data - ["[0]" text]] - [type - abstract] - [macro - ["[0]" template] - ["[0]" code] - [syntax {"+" syntax:}]]]] - [// - [value {"+" All - Number - Length Thickness Time - Color - Location Fit - Slice - Alignment Animation_Direction - Animation Animation_Fill - Column_Fill Column_Span - Iteration Count - Play - Timing Visibility Attachment - Blend Span Image - Angle Repeat Border - Collapse Box_Decoration_Break Caption - Float Clear - Content - Cursor - Shadow Clip - Text_Direction - Display Empty - Filter - Flex_Direction Flex_Wrap - Font Font_Kerning Font_Size Font_Stretch Font_Style Font_Weight Font_Variant - Grid Grid_Content Grid_Flow Grid_Span Grid_Template - Hanging_Punctuation Hyphens Isolation - List_Style_Position List_Style_Type - Overflow Page_Break Pointer_Events - Position - Quotes - Resize Scroll_Behavior Table_Layout - Text_Align Text_Align_Last - Text_Decoration_Line Text_Decoration_Style - Text_Justification Text_Overflow Text_Transform - Transform Transform_Origin Transform_Style - Transition - Bidi User_Select - Vertical_Align - White_Space Word_Break Word_Wrap Writing_Mode - Z_Index}]]) + [library + [lux {"-" All Location} + [control + [parser + ["s" code]]] + [data + ["[0]" text]] + [type + [abstract {"-" pattern}]] + [macro + ["[0]" template] + ["[0]" code] + [syntax {"+" syntax:}]]]] + [// + [value {"+" All + Number + Length Thickness Time + Color + Location Fit + Slice + Alignment Animation_Direction + Animation Animation_Fill + Column_Fill Column_Span + Iteration Count + Play + Timing Visibility Attachment + Blend Span Image + Angle Repeat Border + Collapse Box_Decoration_Break Caption + Float Clear + Content + Cursor + Shadow Clip + Text_Direction + Display Empty + Filter + Flex_Direction Flex_Wrap + Font Font_Kerning Font_Size Font_Stretch Font_Style Font_Weight Font_Variant + Grid Grid_Content Grid_Flow Grid_Span Grid_Template + Hanging_Punctuation Hyphens Isolation + List_Style_Position List_Style_Type + Overflow Page_Break Pointer_Events + Position + Quotes + Resize Scroll_Behavior Table_Layout + Text_Align Text_Align_Last + Text_Decoration_Line Text_Decoration_Style + Text_Justification Text_Overflow Text_Transform + Transform Transform_Origin Transform_Style + Transition + Bidi User_Select + Vertical_Align + White_Space Word_Break Word_Wrap Writing_Mode + Z_Index}]]) (syntax: (text_symbol [symbol s.text]) (in (list (code.local_symbol (text.replaced "-" "_" symbol))))) @@ -62,13 +62,13 @@ (def: .public name (-> (Property Any) Text) - (|>> :representation)) + (|>> representation)) (template [<brand> <alias>+ <property>+] [(`` (template [<alias> <property>] [(def: .public <alias> (Property <brand>) - (:abstraction <property>))] + (abstraction <property>))] (~~ (template.spliced <alias>+)))) @@ -76,7 +76,7 @@ (template [<property>] [(`` (def: .public (~~ (text_symbol <property>)) (Property <brand>) - (:abstraction <property>)))] + (abstraction <property>)))] <rows>))] diff --git a/stdlib/source/library/lux/data/format/css/query.lux b/stdlib/source/library/lux/data/format/css/query.lux index 8251fcb06..7e2272c4a 100644 --- a/stdlib/source/library/lux/data/format/css/query.lux +++ b/stdlib/source/library/lux/data/format/css/query.lux @@ -1,25 +1,25 @@ (.using - [library - [lux {"-" and or not} - [control - [parser - ["s" code]]] - [data - ["[0]" text - ["%" format {"+" format}]]] - [macro - ["[0]" template] - ["[0]" code] - [syntax {"+" syntax:}]] - [type - abstract]]] - ["[0]" // "_" - ["[1][0]" value {"+" Value Length Count Resolution Ratio - Orientation Scan Boolean Update - Block_Overflow Inline_Overflow - Display_Mode Color_Gamut Inverted_Colors - Pointer Hover - Light Scripting Motion Color_Scheme}]]) + [library + [lux {"-" and or not} + [control + [parser + ["s" code]]] + [data + ["[0]" text + ["%" format {"+" format}]]] + [macro + ["[0]" template] + ["[0]" code] + [syntax {"+" syntax:}]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + ["[1][0]" value {"+" Value Length Count Resolution Ratio + Orientation Scan Boolean Update + Block_Overflow Inline_Overflow + Display_Mode Color_Gamut Inverted_Colors + Pointer Hover + Light Scripting Motion Color_Scheme}]]) (syntax: (text_symbol [symbol s.text]) (in (list (code.local_symbol (text.replaced "-" "_" symbol))))) @@ -29,12 +29,12 @@ (def: .public media (-> Media Text) - (|>> :representation)) + (|>> representation)) (template [<media>] [(`` (def: .public (~~ (text_symbol <media>)) Media - (:abstraction <media>)))] + (abstraction <media>)))] ["all"] ["print"] @@ -47,12 +47,12 @@ (def: .public feature (-> Feature Text) - (|>> :representation)) + (|>> representation)) (template [<feature> <brand>] [(`` (def: .public ((~~ (text_symbol <feature>)) input) (-> (Value <brand>) Feature) - (:abstraction (format "(" <feature> ": " (//value.value input) ")"))))] + (abstraction (format "(" <feature> ": " (//value.value input) ")"))))] ["min-color" Count] ["color" Count] @@ -107,12 +107,12 @@ (def: .public query (-> Query Text) - (|>> :representation)) + (|>> representation)) (template [<name> <operator>] [(def: .public <name> (-> Media Query) - (|>> ..media (format <operator>) :abstraction))] + (|>> ..media (format <operator>) abstraction))] [except "not "] [only "only "] @@ -120,14 +120,14 @@ (def: .public not (-> Feature Query) - (|>> ..feature (format "not ") :abstraction)) + (|>> ..feature (format "not ") abstraction)) (template [<name> <operator>] [(def: .public (<name> left right) (-> Query Query Query) - (:abstraction (format (:representation left) - <operator> - (:representation right))))] + (abstraction (format (representation left) + <operator> + (representation right))))] [and " and "] [or " or "] diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux index 47a394603..fc53d8731 100644 --- a/stdlib/source/library/lux/data/format/css/selector.lux +++ b/stdlib/source/library/lux/data/format/css/selector.lux @@ -9,7 +9,7 @@ [number ["i" int]]] [type - abstract] + [abstract {"-" pattern}]] [macro ["[0]" template]]]] ["[0]" // "_" @@ -40,20 +40,20 @@ (def: .public selector (-> (Selector Any) Text) - (|>> :representation)) + (|>> representation)) (def: .public any (Selector Cannot_Chain) - (:abstraction "*")) + (abstraction "*")) (def: .public tag (-> Tag (Selector Cannot_Chain)) - (|>> :abstraction)) + (|>> abstraction)) (template [<name> <type> <prefix> <kind> <out>] [(def: .public <name> (-> <type> (Selector <kind>)) - (|>> <out> (format <prefix>) :abstraction))] + (|>> <out> (format <prefix>) abstraction))] [id ID "#" Unique //id.id] [class Class "." Can_Chain //class.class] @@ -63,9 +63,9 @@ [(`` (template [<combinator> <name>] [(def: .public (<name> right left) (-> (Selector <right>) (Selector <left>) (Selector Composite)) - (:abstraction (format (:representation left) - <combinator> - (:representation right))))] + (abstraction (format (representation left) + <combinator> + (representation right))))] (~~ (template.spliced <combinator>+))))] @@ -91,12 +91,12 @@ (def: .public (with? attribute) (-> Attribute (Selector Can_Chain)) - (:abstraction (format "[" attribute "]"))) + (abstraction (format "[" attribute "]"))) (template [<check> <name>] [(def: .public (<name> attribute value) (-> Attribute Text (Selector Can_Chain)) - (:abstraction (format "[" attribute <check> value "]")))] + (abstraction (format "[" attribute <check> value "]")))] ["=" same?] ["~=" has?] @@ -110,7 +110,7 @@ [(`` (template [<name> <pseudo>] [(def: .public <name> (Selector <kind>) - (:abstraction <pseudo>))] + (abstraction <pseudo>))] (~~ (template.spliced <pseudo>+))))] @@ -158,24 +158,24 @@ locale.code (text.enclosed ["(" ")"]) (format ":lang") - :abstraction)) + abstraction)) (def: .public not (-> (Selector Any) (Selector Can_Chain)) - (|>> :representation + (|>> representation (text.enclosed ["(" ")"]) (format ":not") - :abstraction)) + abstraction)) (abstract: .public Index Text (def: .public index (-> Nat Index) - (|>> %.nat :abstraction)) + (|>> %.nat abstraction)) (template [<name> <index>] - [(def: .public <name> Index (:abstraction <index>))] + [(def: .public <name> Index (abstraction <index>))] [odd "odd"] [even "even"] @@ -189,18 +189,18 @@ (def: .public (formula input) (-> Formula Index) (let [(open "_[0]") input] - (:abstraction (format (if (i.< +0 _#variable) - (%.int _#variable) - (%.nat (.nat _#variable))) - (%.int _#constant))))) + (abstraction (format (if (i.< +0 _#variable) + (%.int _#variable) + (%.nat (.nat _#variable))) + (%.int _#constant))))) (template [<name> <pseudo>] [(def: .public (<name> index) (-> Index (Selector Can_Chain)) - (|> (:representation index) + (|> (representation index) (text.enclosed ["(" ")"]) (format <pseudo>) - (:abstraction Selector)))] + (abstraction Selector)))] [nth_child ":nth-child"] [nth_last_child ":nth-last-child"] diff --git a/stdlib/source/library/lux/data/format/css/style.lux b/stdlib/source/library/lux/data/format/css/style.lux index 8ec6a207f..42c7d07cb 100644 --- a/stdlib/source/library/lux/data/format/css/style.lux +++ b/stdlib/source/library/lux/data/format/css/style.lux @@ -7,7 +7,7 @@ [collection ["[0]" list ("[1]#[0]" mix)]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // "_" ["[1][0]" value {"+" Value}] ["[1][0]" property {"+" Property}]]) @@ -17,19 +17,19 @@ (def: .public empty Style - (:abstraction "")) + (abstraction "")) (def: .public (with [property value]) (All (_ brand) (-> [(Property brand) (Value brand)] (-> Style Style))) - (|>> :representation + (|>> representation (format (//property.name property) ": " (//value.value value) ";") - :abstraction)) + abstraction)) (def: .public inline (-> Style Text) - (|>> :representation)) + (|>> representation)) (def: .public (style config) (-> (List (Ex (_ brand) [(Property brand) (Value brand)])) diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index b48718568..dad95e9b8 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -23,7 +23,7 @@ ["r" rev] ["f" frac]]] [type - abstract] + [abstract {"-" pattern}]] [world [net {"+" URL}]]]] [// @@ -38,10 +38,10 @@ (def: .public <out> (-> <abstraction> <representation>) - (|>> :representation)) + (|>> representation)) (`` (template [<name> <value>] - [(def: .public <name> <abstraction> (:abstraction <value>))] + [(def: .public <name> <abstraction> (abstraction <value>))] (~~ (template.spliced <sample>+)) )) @@ -51,9 +51,9 @@ (template: (multi: <multi> <type> <separator>) [(def: .public (<multi> pre post) (-> (Value <type>) (Value <type>) (Value <type>)) - (:abstraction (format (:representation pre) - <separator> - (:representation post))))]) + (abstraction (format (representation pre) + <separator> + (representation post))))]) (def: (%number value) (Format Frac) @@ -67,10 +67,10 @@ (def: .public value (-> (Value Any) Text) - (|>> :representation)) + (|>> representation)) (template [<name> <value>] - [(def: .public <name> Value (:abstraction <value>))] + [(def: .public <name> Value (abstraction <value>))] [initial "initial"] [inherit "inherit"] @@ -97,7 +97,7 @@ (`` (template [<name> <value>] [(def: .public <name> (Value <brand>) - (:abstraction <value>))] + (abstraction <value>))] (~~ (template.spliced <alias>+)))) @@ -105,7 +105,7 @@ (template [<value>] [(`` (def: .public (~~ (..text_symbol <value>)) (Value <brand>) - (:abstraction <value>)))] + (abstraction <value>)))] <rows>))] @@ -788,7 +788,7 @@ (text.interposed ..value_separator) (text.enclosed ["(" ")"]) (format name) - :abstraction)) + abstraction)) (enumeration: Step Text step @@ -809,7 +809,7 @@ (template [<name> <brand>] [(def: .public <name> (-> Nat (Value <brand>)) - (|>> %.nat :abstraction))] + (|>> %.nat abstraction))] [iteration Iteration] [count Count] @@ -819,7 +819,7 @@ (def: .public animation (-> Label (Value Animation)) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (rgb color) (-> color.Color (Value Color)) @@ -842,7 +842,7 @@ (template [<name> <suffix>] [(def: .public (<name> value) (-> Frac (Value Length)) - (:abstraction (format (%number value) <suffix>)))] + (abstraction (format (%number value) <suffix>)))] [em "em"] [ex "ex"] @@ -871,10 +871,10 @@ (template [<name> <suffix>] [(def: .public (<name> value) (-> Int (Value Time)) - (:abstraction (format (if (i.< +0 value) - (%.int value) - (%.nat (.nat value))) - <suffix>)))] + (abstraction (format (if (i.< +0 value) + (%.int value) + (%.nat (.nat value))) + <suffix>)))] [seconds "s"] @@ -883,50 +883,50 @@ (def: .public thickness (-> (Value Length) (Value Thickness)) - (|>> :transmutation)) + (|>> transmutation)) (def: slice_separator " ") (def: .public (slice_number/2 horizontal vertical) (-> Nat Nat (Value Slice)) - (:abstraction (format (%.nat horizontal) ..slice_separator - (%.nat vertical)))) + (abstraction (format (%.nat horizontal) ..slice_separator + (%.nat vertical)))) (abstract: .public Stop Text (def: .public stop (-> (Value Color) Stop) - (|>> (:representation Value) (:abstraction Stop))) + (|>> (representation Value) (abstraction Stop))) (def: stop_separator " ") (def: .public (single_stop length color) (-> (Value Length) (Value Color) Stop) - (:abstraction (format (:representation Value color) ..stop_separator - (:representation Value length)))) + (abstraction (format (representation Value color) ..stop_separator + (representation Value length)))) (def: .public (double_stop start end color) (-> (Value Length) (Value Length) (Value Color) Stop) - (:abstraction (format (:representation Value color) ..stop_separator - (:representation Value start) ..stop_separator - (:representation Value end)))) + (abstraction (format (representation Value color) ..stop_separator + (representation Value start) ..stop_separator + (representation Value end)))) (abstract: .public Hint Text (def: .public hint (-> (Value Length) Hint) - (|>> (:representation Value) (:abstraction Hint))) + (|>> (representation Value) (abstraction Hint))) (def: (with_hint [hint stop]) (-> [(Maybe Hint) Stop] Text) (case hint {.#None} - (:representation Stop stop) + (representation Stop stop) {.#Some hint} - (format (:representation Hint hint) ..value_separator (:representation Stop stop)))))) + (format (representation Hint hint) ..value_separator (representation Stop stop)))))) (type: .public (List/1 a) [a (List a)]) @@ -936,17 +936,17 @@ (def: .public angle (-> Angle Text) - (|>> :representation)) + (|>> representation)) (def: .public (turn value) (-> Rev Angle) - (:abstraction (format (%.rev value) "turn"))) + (abstraction (format (%.rev value) "turn"))) (def: degree_limit Nat 360) (def: .public (degree value) (-> Nat Angle) - (:abstraction (format (%.nat (n.% ..degree_limit value)) "deg"))) + (abstraction (format (%.nat (n.% ..degree_limit value)) "deg"))) (template [<degree> <name>] [(def: .public <name> @@ -963,7 +963,7 @@ [(def: .public (<name> angle start next) (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] - (..apply <function> (list& (:representation Angle angle) + (..apply <function> (list& (representation Angle angle) (with_hint now) (list#each with_hint after)))))] @@ -976,16 +976,16 @@ (def: .public (%% value) (-> Nat (Value Percentage)) - (:abstraction (format (%.nat (n.% percentage_limit value)) "%"))) + (abstraction (format (%.nat (n.% percentage_limit value)) "%"))) (def: .public slice_percent/1 (-> (Value Percentage) (Value Slice)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public (slice_percent/2 horizontal vertical) (-> (Value Percentage) (Value Percentage) (Value Slice)) - (:abstraction (format (:representation horizontal) ..slice_separator - (:representation vertical)))) + (abstraction (format (representation horizontal) ..slice_separator + (representation vertical)))) (template [<input> <pre> <function>+] [(`` (template [<name> <function>] @@ -995,11 +995,11 @@ (~~ (template.spliced <function>+))))] - [Nat (<| :representation ..px n.frac) + [Nat (<| representation ..px n.frac) [[blur "blur"]]] [Nat (<| ..angle ..degree) [[hue_rotate "hue-rotate"]]] - [(Value Percentage) :representation + [(Value Percentage) representation [[brightness "brightness"] [contrast "contrast"] [grayscale "grayscale"] @@ -1020,11 +1020,11 @@ (Maybe (Value Length)) (Maybe (Value Length)) (Value Color) (Value Filter)) - (|> (list (:representation horizontal) - (:representation vertical) - (|> blur (maybe.else ..default_shadow_length) :representation) - (|> spread (maybe.else ..default_shadow_length) :representation) - (:representation color)) + (|> (list (representation horizontal) + (representation vertical) + (|> blur (maybe.else ..default_shadow_length) representation) + (|> spread (maybe.else ..default_shadow_length) representation) + (representation color)) (text.interposed " ") (list) (..apply "drop-shadow"))) @@ -1034,9 +1034,9 @@ (template [<name> <type>] [(def: .public (<name> horizontal vertical) (-> (Value Length) (Value Length) (Value <type>)) - (:abstraction (format (:representation horizontal) - ..length_separator - (:representation vertical))))] + (abstraction (format (representation horizontal) + ..length_separator + (representation vertical))))] [location Location] [fit Fit] @@ -1071,7 +1071,7 @@ (-> Shape (Maybe Extent) (Value Location) Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) - (let [after_extent (format "at " (:representation location)) + (let [after_extent (format "at " (representation location)) with_extent (case extent {.#Some extent} (format (..extent extent) " " after_extent) @@ -1096,14 +1096,14 @@ (let [with_inset (if inset? (list "inset") (list))] - (|> (list& (:representation horizontal) - (:representation vertical) - (|> blur (maybe.else ..default_shadow_length) :representation) - (|> spread (maybe.else ..default_shadow_length) :representation) - (:representation color) + (|> (list& (representation horizontal) + (representation vertical) + (|> blur (maybe.else ..default_shadow_length) representation) + (|> spread (maybe.else ..default_shadow_length) representation) + (representation color) with_inset) (text.interposed " ") - :abstraction))) + abstraction))) (type: .public Rectangle (Record @@ -1115,21 +1115,21 @@ (def: .public (clip rectangle) (-> Rectangle (Value Clip)) (`` (..apply "rect" (list (~~ (template [<side>] - [(:representation (the <side> rectangle))] + [(representation (the <side> rectangle))] [#top] [#right] [#bottom] [#left])))))) (def: .public counter (-> Label (Value Counter)) - (|>> :abstraction)) + (|>> abstraction)) (def: .public current_count (-> (Value Counter) (Value Content)) - (|>> :representation (list) (..apply "counter"))) + (|>> representation (list) (..apply "counter"))) (def: .public text (-> Text (Value Content)) - (|>> %.text :abstraction)) + (|>> %.text abstraction)) (def: .public attribute (-> Label (Value Content)) @@ -1148,7 +1148,7 @@ [monospace "monospace"]] [(def: .public font (-> Text Font) - (|>> %.text :abstraction)) + (|>> %.text abstraction)) (def: .public (font_family options) (-> (List Font) (Value Font)) @@ -1157,57 +1157,57 @@ (|> options (list#each ..font_name) (text.interposed ",") - (:abstraction Value)) + (abstraction Value)) {.#End} ..initial))]) (def: .public font_size (-> (Value Length) (Value Font_Size)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public number (-> Frac (Value Number)) - (|>> %number :abstraction)) + (|>> %number abstraction)) (def: .public grid (-> Label (Value Grid)) - (|>> :abstraction)) + (|>> abstraction)) (def: .public fit_content (-> (Value Length) (Value Grid_Content)) - (|>> :representation (list) (..apply "fit-content"))) + (|>> representation (list) (..apply "fit-content"))) (def: .public (min_max min max) (-> (Value Grid_Content) (Value Grid_Content) (Value Grid_Content)) - (..apply "minmax" (list (:representation min) - (:representation max)))) + (..apply "minmax" (list (representation min) + (representation max)))) (def: .public grid_span (-> Nat (Value Grid_Span)) - (|>> %.nat (format "span ") :abstraction)) + (|>> %.nat (format "span ") abstraction)) (def: grid_column_separator " ") (def: grid_row_separator " ") (def: .public grid_template (-> (List (List (Maybe (Value Grid)))) (Value Grid_Template)) - (let [empty (: (Value Grid) - (:abstraction "."))] + (let [empty (is (Value Grid) + (abstraction "."))] (|>> (list#each (|>> (list#each (|>> (maybe.else empty) - :representation)) + representation)) (text.interposed ..grid_column_separator) (text.enclosed ["'" "'"]))) (text.interposed ..grid_row_separator) - :abstraction))) + abstraction))) (def: .public (resolution dpi) (-> Nat (Value Resolution)) - (:abstraction (format (%.nat dpi) "dpi"))) + (abstraction (format (%.nat dpi) "dpi"))) (def: .public (ratio numerator denominator) (-> Nat Nat (Value Ratio)) - (:abstraction (format (%.nat numerator) "/" (%.nat denominator)))) + (abstraction (format (%.nat numerator) "/" (%.nat denominator)))) (enumeration: Quote Text quote_text @@ -1224,7 +1224,7 @@ [low_double_quote "\201E"]] [(def: .public quote (-> Text Quote) - (|>> :abstraction))]) + (|>> abstraction))]) (def: quote_separator " ") @@ -1233,7 +1233,7 @@ (|> (list left0 right0 left1 right1) (list#each (|>> ..quote_text %.text)) (text.interposed ..quote_separator) - :abstraction)) + abstraction)) (def: .public (matrix_2d [a b] [c d] [tx ty]) (-> [Frac Frac] @@ -1302,24 +1302,24 @@ (def: .public (origin_2d x y) (-> (Value Length) (Value Length) (Value Transform_Origin)) - (:abstraction (format (:representation x) ..origin_separator - (:representation y)))) + (abstraction (format (representation x) ..origin_separator + (representation y)))) (def: .public (origin_3d x y z) (-> (Value Length) (Value Length) (Value Length) (Value Transform_Origin)) - (:abstraction (format (:representation x) ..origin_separator - (:representation y) ..origin_separator - (:representation z)))) + (abstraction (format (representation x) ..origin_separator + (representation y) ..origin_separator + (representation z)))) (def: .public vertical_align (-> (Value Length) (Value Vertical_Align)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public (z_index index) (-> Int (Value Z_Index)) - (:abstraction (if (i.< +0 index) - (%.int index) - (%.nat (.nat index))))) + (abstraction (if (i.< +0 index) + (%.int index) + (%.nat (.nat index))))) (multi: multi_image Image ",") (multi: multi_shadow Shadow ",") @@ -1331,11 +1331,11 @@ (.All (_ kind) (-> (Value <parameter>) (Value (Numeric kind)) (Value (Numeric kind)))) - (|> (format (:representation subject) + (|> (format (representation subject) (template.text [" " <name> " "]) - (:representation parameter)) + (representation parameter)) (text.enclosed ["calc(" ")"]) - :abstraction))] + abstraction))] [+ (Numeric kind)] [- (Numeric kind)] diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index b6021695d..96de4515b 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -15,7 +15,7 @@ [target ["[0]" js]] [type - abstract] + [abstract {"-" pattern}]] [world [net {"+" URL}]]]] [// @@ -121,21 +121,21 @@ (def: .public html (-> Document Text) - (|>> :representation)) + (|>> representation)) (def: .public (and pre post) (All (_ brand) (-> (HTML brand) (HTML brand) (HTML brand))) - (:abstraction (format (:representation pre) (:representation post)))) + (abstraction (format (representation pre) (representation post)))) (def: .public (comment content node) (All (_ brand) (-> Text (HTML brand) (HTML brand))) - (:abstraction + (abstraction (format (text.enclosed ["<!--" "-->"] content) - (:representation node)))) + (representation node)))) (def: (empty name attributes) (-> Tag Attributes HTML) - (:abstraction + (abstraction (format (..open name attributes) (..close name)))) @@ -143,18 +143,18 @@ (-> Tag Attributes HTML) (|> attributes (..open tag) - :abstraction)) + abstraction)) (def: (tag name attributes content) (-> Tag Attributes (HTML Any) HTML) - (:abstraction + (abstraction (format (..open name attributes) - (:representation content) + (representation content) (..close name)))) (def: (raw tag attributes content) (-> Text Attributes Text HTML) - (:abstraction + (abstraction (format (..open tag attributes) content (..close tag)))) @@ -197,7 +197,7 @@ (def: .public text (-> Text Content) (|>> ..safe - :abstraction)) + abstraction)) (.template [<tag> <alias> <name>] [(def: .public <name> @@ -550,7 +550,7 @@ content {.#Some caption} - (..and (:as HTML caption) + (..and (as HTML caption) content))] (..tag "table" attributes content))) @@ -561,9 +561,9 @@ (let [doc_type <doc_type>] (function (_ head body) (|> (..tag "html" (list) (..and head body)) - :representation + representation (format doc_type) - :abstraction))))] + abstraction))))] [html/5 "<!DOCTYPE html>"] [html/4_01 (format "<!DOCTYPE HTML PUBLIC " text.double_quote "-//W3C//DTD HTML 4.01//EN" text.double_quote " " text.double_quote "http://www.w3.org/TR/html4/strict.dtd" text.double_quote ">")] diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index d5eafa15d..0a08da9b6 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -123,7 +123,7 @@ code)) (syntax: .public (json [token ..jsonP]) - (in (list (` (: JSON (~ (jsonF token))))))) + (in (list (` (is JSON (~ (jsonF token))))))) (def: .public (fields json) (-> JSON (Try (List String))) diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index 02a8de78e..984c023c1 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -1,15 +1,15 @@ (.using - [library - [lux {"-" and} - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [type - abstract] - [world - [net {"+" URL}]]]]) + [library + [lux {"-" and} + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [type + [abstract {"-" pattern}]] + [world + [net {"+" URL}]]]]) ... https://www.markdownguide.org/basic-syntax/ @@ -39,11 +39,11 @@ (def: .public empty Markdown - (:abstraction "")) + (abstraction "")) (def: .public text (-> Text (Markdown Span)) - (|>> ..safe :abstraction)) + (|>> ..safe abstraction)) (def: blank_line (format text.new_line text.new_line)) @@ -51,7 +51,7 @@ (template [<name> <prefix>] [(def: .public (<name> content) (-> Text (Markdown Block)) - (:abstraction (format <prefix> " " (..safe content) ..blank_line)))] + (abstraction (format <prefix> " " (..safe content) ..blank_line)))] [heading/1 "#"] [heading/2 "##"] @@ -63,22 +63,22 @@ (def: (block content) (-> Text (Markdown Block)) - (:abstraction (format content ..blank_line))) + (abstraction (format content ..blank_line))) (def: .public paragraph (-> (Markdown Span) (Markdown Block)) - (|>> :representation ..block)) + (|>> representation ..block)) (def: .public break (Markdown Span) - (:abstraction (format " " text.new_line))) + (abstraction (format " " text.new_line))) (template [<name> <wrapper>] [(def: .public <name> (-> (Markdown Span) (Markdown Span)) - (|>> :representation + (|>> representation (text.enclosed [<wrapper> <wrapper>]) - :abstraction))] + abstraction))] [bold "**"] [italic "_"] @@ -99,20 +99,20 @@ (def: .public quote (-> (Markdown Block) (Markdown Block)) - (|>> :representation + (|>> representation (..prefix "> ") - :abstraction)) + abstraction)) (def: .public numbered_list (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) (|>> list.enumeration (list#each (function (_ [idx [summary detail]]) - (format "1. " (:representation summary) + (format "1. " (representation summary) (case detail {.#Some detail} (|> detail - :representation + representation ..indent (text.enclosed [text.new_line text.new_line]) (format text.new_line)) @@ -126,11 +126,11 @@ (-> (List [(Markdown Span) (Maybe (Markdown Block))]) (Markdown Block)) (|>> (list#each (function (_ [summary detail]) - (format "* " (:representation summary) + (format "* " (representation summary) (case detail {.#Some detail} (|> detail - :representation + representation ..indent (text.enclosed [text.new_line text.new_line]) (format text.new_line)) @@ -143,7 +143,7 @@ ... A snippet of code. (def: .public snippet (-> Text (Markdown Span)) - (|>> (text.enclosed ["`` " " ``"]) :abstraction)) + (|>> (text.enclosed ["`` " " ``"]) abstraction)) ... A (generic) block of code. (def: .public generic_code @@ -163,7 +163,7 @@ (def: .public (image description url) (-> Text URL (Markdown Span)) - (:abstraction (format "![" (..safe description) "](" url ")"))) + (abstraction (format "![" (..safe description) "](" url ")"))) (def: .public horizontal_rule (Markdown Block) @@ -171,7 +171,7 @@ (def: .public (link description url) (-> (Markdown Span) URL (Markdown Span)) - (:abstraction (format "[" (:representation description) "](" url ")"))) + (abstraction (format "[" (representation description) "](" url ")"))) (type: .public Email Text) @@ -179,7 +179,7 @@ (template [<name> <type>] [(def: .public <name> (-> <type> (Markdown Span)) - (|>> (text.enclosed ["<" ">"]) :abstraction))] + (|>> (text.enclosed ["<" ">"]) abstraction))] [url URL] [email Email] @@ -188,7 +188,7 @@ (template [<name> <brand> <infix>] [(def: .public (<name> pre post) (-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>)) - (:abstraction (format (:representation pre) <infix> (:representation post))))] + (abstraction (format (representation pre) <infix> (representation post))))] [and Span " "] [then Block ""] @@ -196,5 +196,5 @@ (def: .public markdown (All (_ a) (-> (Markdown a) Text)) - (|>> :representation)) + (|>> representation)) ) diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 567d1a10a..422d11814 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -33,7 +33,7 @@ [world ["[0]" file]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (type: Size Nat) @@ -78,18 +78,18 @@ (def: .public (<in> value) (-> Nat (Try <type>)) (if (n.< <limit> value) - {try.#Success (:abstraction value)} + {try.#Success (abstraction value)} (exception.except <exception> [value]))) (def: .public <out> (-> <type> Nat) - (|>> :representation)) + (|>> representation)) (def: <writer> (Writer <type>) (let [suffix <suffix> padded_size (n.+ (text.size suffix) <size>)] - (|>> :representation + (|>> representation (# n.octal encoded) (..octal_padding <size>) (text.suffix suffix) @@ -99,7 +99,7 @@ (def: <coercion> (-> Nat <type>) (|>> (n.% <limit>) - :abstraction)) + abstraction)) )] [not_a_small_number small_limit ..small_size @@ -161,11 +161,11 @@ (def: from_checksum (-> Checksum Text) - (|>> :representation)) + (|>> representation)) (def: dummy_checksum Checksum - (:abstraction " ")) + (abstraction " ")) (def: checksum_suffix (format ..blank ..null)) @@ -176,7 +176,7 @@ (def: checksum_checksum (|> ..dummy_checksum - :representation + representation (# utf8.codec encoded) ..checksum)) @@ -188,13 +188,13 @@ (# n.octal encoded) (..octal_padding ..small_size) (text.suffix ..checksum_suffix) - :abstraction)) + abstraction)) (def: checksum_writer (Writer Checksum) (let [padded_size (n.+ (text.size ..checksum_suffix) ..small_size)] - (|>> :representation + (|>> representation (# utf8.codec encoded) (format.segment padded_size)))) @@ -207,7 +207,7 @@ value (<>.lifted (# n.octal decoded digits))] (in [value - (:abstraction (format digits ..checksum_suffix))]))) + (abstraction (format digits ..checksum_suffix))]))) ) (def: last_ascii @@ -263,18 +263,18 @@ binary.size (n.> <size>)) (exception.except <exception> [value]) - {try.#Success (:abstraction value)}) + {try.#Success (abstraction value)}) (exception.except ..not_ascii [value]))) (def: .public <out> (-> <type> <representation>) - (|>> :representation)) + (|>> representation)) (def: <writer> (Writer <type>) (let [suffix ..null padded_size (n.+ (text.size suffix) <size>)] - (|>> :representation + (|>> representation (text.suffix suffix) (# utf8.codec encoded) (format.segment padded_size)))) @@ -308,17 +308,17 @@ Text (def: ustar - (:abstraction "ustar ")) + (abstraction "ustar ")) (def: from_magic (-> Magic Text) - (|>> :representation)) + (|>> representation)) (def: magic_writer (Writer Magic) (let [padded_size (n.+ (text.size ..null) ..magic_size)] - (|>> :representation + (|>> representation (# utf8.codec encoded) (format.segment padded_size)))) @@ -331,7 +331,7 @@ _ (<>.assertion (exception.error ..wrong_character [expected end]) (n.= expected end))] (<>.lifted - (# try.monad each (|>> :abstraction) + (# try.monad each (|>> abstraction) (# utf8.codec decoded string))))) ) @@ -396,11 +396,11 @@ (def: link_flag (-> Link_Flag Char) - (|>> :representation)) + (|>> representation)) (def: link_flag_writer (Writer Link_Flag) - (|>> :representation + (|>> representation format.bits/8)) (with_expansions [<options> (as_is [0 old_normal] @@ -415,7 +415,7 @@ (template [<flag> <name>] [(def: <name> Link_Flag - (:abstraction <flag>))] + (abstraction <flag>))] <options> ) @@ -444,17 +444,17 @@ (def: .public mode (-> Mode Nat) - (|>> :representation)) + (|>> representation)) (def: .public (and left right) (-> Mode Mode Mode) - (:abstraction - (i64.or (:representation left) - (:representation right)))) + (abstraction + (i64.or (representation left) + (representation right)))) (def: mode_writer (Writer Mode) - (|>> :representation + (|>> representation ..small try.trusted ..small_writer)) @@ -483,7 +483,7 @@ (template [<code> <name>] [(def: .public <name> Mode - (:abstraction (number.oct <code>)))] + (abstraction (number.oct <code>)))] <options> ) @@ -514,11 +514,11 @@ (Parser Mode) (do [! <>.monad] [value (# ! each ..from_small ..small_parser)] - (if (n.> (:representation ..maximum_mode) + (if (n.> (representation ..maximum_mode) value) (<>.lifted (exception.except ..invalid_mode [value])) - (in (:abstraction value)))))) + (in (abstraction value)))))) ) (def: maximum_content_size @@ -534,15 +534,15 @@ (-> Binary (Try Content)) (do try.monad [size (..big (binary.size content))] - (in (:abstraction [size content])))) + (in (abstraction [size content])))) (def: from_content (-> Content [Big Binary]) - (|>> :representation)) + (|>> representation)) (def: .public data (-> Content Binary) - (|>> :representation product.right)) + (|>> representation product.right)) ) (type: .public ID diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 825daeac3..2459936a2 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -220,9 +220,9 @@ (def: xml_header Text - (let [quote (: (-> Text Text) - (function (_ value) - ($_ text#composite text.double_quote value text.double_quote)))] + (let [quote (is (-> Text Text) + (function (_ value) + ($_ text#composite text.double_quote value text.double_quote)))] ($_ text#composite "<?xml" " version=" (quote "1.0") @@ -233,13 +233,13 @@ (Codec Text XML) (def: encoded - (let [attributes (: (-> Attrs Text) - (function (_ attrs) - (|> attrs - dictionary.entries - (list#each (function (_ [key value]) - ($_ text#composite (..attribute key) "=" text.double_quote (sanitize_value value) text.double_quote))) - (text.interposed " "))))] + (let [attributes (is (-> Attrs Text) + (function (_ attrs) + (|> attrs + dictionary.entries + (list#each (function (_ [key value]) + ($_ text#composite (..attribute key) "=" text.double_quote (sanitize_value value) text.double_quote))) + (text.interposed " "))))] (function (_ input) ($_ text#composite ..xml_header text.new_line diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index 29d2d0ca8..922f1da3c 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -69,8 +69,8 @@ (def: .public (last_index part text) (-> Text Text (Maybe Nat)) (loop [offset 0 - output (: (Maybe Nat) - {.#None})] + output (is (Maybe Nat) + {.#None})] (let [output' ("lux text index" offset part text)] (case output' {.#None} @@ -165,7 +165,7 @@ (def: .public (all_split_by token sample) (-> Text Text (List Text)) (loop [input sample - output (: (List Text) (list))] + output (is (List Text) (list))] (case (..split_by token input) {.#Some [pre post]} (|> output @@ -221,34 +221,34 @@ {.#None} ("lux text concat" left right)))] (for @.old - (:as Text - ("jvm invokevirtual:java.lang.String:replace:java.lang.CharSequence,java.lang.CharSequence" - (:as (Primitive "java.lang.String") template) - (:as (Primitive "java.lang.CharSequence") pattern) - (:as (Primitive "java.lang.CharSequence") replacement))) + (as Text + ("jvm invokevirtual:java.lang.String:replace:java.lang.CharSequence,java.lang.CharSequence" + (as (Primitive "java.lang.String") template) + (as (Primitive "java.lang.CharSequence") pattern) + (as (Primitive "java.lang.CharSequence") replacement))) @.jvm - (:as Text - ("jvm member invoke virtual" [] "java.lang.String" "replace" [] - (:as (Primitive "java.lang.String") template) - ["Ljava/lang/CharSequence;" (:as (Primitive "java.lang.CharSequence") pattern)] - ["Ljava/lang/CharSequence;" (:as (Primitive "java.lang.CharSequence") replacement)])) + (as Text + ("jvm member invoke virtual" [] "java.lang.String" "replace" [] + (as (Primitive "java.lang.String") template) + ["Ljava/lang/CharSequence;" (as (Primitive "java.lang.CharSequence") pattern)] + ["Ljava/lang/CharSequence;" (as (Primitive "java.lang.CharSequence") replacement)])) @.js ... TODO: Remove this when Nashorn is no longer being used. (..if_nashorn <default> - (:as Text - ("js object do" "replaceAll" template [pattern replacement]))) + (as Text + ("js object do" "replaceAll" template [pattern replacement]))) @.python - (:as Text - ("python object do" "replace" template [pattern replacement])) + (as Text + ("python object do" "replace" template [pattern replacement])) ... TODO @.lua @.ruby - (:as Text - ("ruby object do" "gsub" template [pattern replacement])) + (as Text + ("ruby object do" "gsub" template [pattern replacement])) @.php - (:as Text - ("php apply" (:expected ("php constant" "str_replace")) - pattern replacement template)) + (as Text + ("php apply" (as_expected ("php constant" "str_replace")) + pattern replacement template)) ... TODO @.scheme ... TODO @.common_lisp ... TODO @.r @@ -286,19 +286,19 @@ (def: (hash input) (for @.old (|> input - (: (Primitive "java.lang.String")) + (is (Primitive "java.lang.String")) "jvm invokevirtual:java.lang.String:hashCode:" "jvm convert int-to-long" - (:as Nat)) + (as Nat)) @.jvm (|> input - (:as (Primitive "java.lang.String")) + (as (Primitive "java.lang.String")) ("jvm member invoke virtual" [] "java.lang.String" "hashCode" []) "jvm conversion int-to-long" "jvm object cast" - (: (Primitive "java.lang.Long")) - (:as Nat)) + (is (Primitive "java.lang.Long")) + (as Nat)) ... Platform-independent default. (let [length ("lux text size" input)] (loop [index 0 @@ -355,45 +355,45 @@ (def: .public (lower_cased value) (-> Text Text) (for @.old - (:as Text - ("jvm invokevirtual:java.lang.String:toLowerCase:" - (:as (Primitive "java.lang.String") value))) + (as Text + ("jvm invokevirtual:java.lang.String:toLowerCase:" + (as (Primitive "java.lang.String") value))) @.jvm - (:as Text - ("jvm member invoke virtual" [] "java.lang.String" "toLowerCase" [] - (:as (Primitive "java.lang.String") value))) + (as Text + ("jvm member invoke virtual" [] "java.lang.String" "toLowerCase" [] + (as (Primitive "java.lang.String") value))) @.js - (:as Text - ("js object do" "toLowerCase" value [])) + (as Text + ("js object do" "toLowerCase" value [])) @.python - (:as Text - ("python object do" "lower" value [])) + (as Text + ("python object do" "lower" value [])) @.lua - (:as Text - ("lua apply" ("lua constant" "string.lower") [value])) + (as Text + ("lua apply" ("lua constant" "string.lower") [value])) @.ruby - (:as Text - ("ruby object do" "downcase" value [])))) + (as Text + ("ruby object do" "downcase" value [])))) (def: .public (upper_cased value) (-> Text Text) (for @.old - (:as Text - ("jvm invokevirtual:java.lang.String:toUpperCase:" - (:as (Primitive "java.lang.String") value))) + (as Text + ("jvm invokevirtual:java.lang.String:toUpperCase:" + (as (Primitive "java.lang.String") value))) @.jvm - (:as Text - ("jvm member invoke virtual" [] "java.lang.String" "toUpperCase" [] - (:as (Primitive "java.lang.String") value))) + (as Text + ("jvm member invoke virtual" [] "java.lang.String" "toUpperCase" [] + (as (Primitive "java.lang.String") value))) @.js - (:as Text - ("js object do" "toUpperCase" value [])) + (as Text + ("js object do" "toUpperCase" value [])) @.python - (:as Text - ("python object do" "upper" value [])) + (as Text + ("python object do" "upper" value [])) @.lua - (:as Text - ("lua apply" ("lua constant" "string.upper") [value])) + (as Text + ("lua apply" ("lua constant" "string.upper") [value])) @.ruby - (:as Text - ("ruby object do" "upcase" value [])))) + (as Text + ("ruby object do" "upcase" value [])))) diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux index 98526e286..eb1cecf59 100644 --- a/stdlib/source/library/lux/data/text/buffer.lux +++ b/stdlib/source/library/lux/data/text/buffer.lux @@ -16,7 +16,7 @@ [number ["n" nat]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" //]) (with_expansions [<jvm> (as_is (import: java/lang/CharSequence @@ -58,78 +58,78 @@ (def: .public empty Buffer - (:abstraction (with_expansions [<jvm> [0 function.identity]] - (for @.old <jvm> - @.jvm <jvm> - @.js [0 function.identity] - @.lua [0 function.identity] - ... default - sequence.empty)))) + (abstraction (with_expansions [<jvm> [0 function.identity]] + (for @.old <jvm> + @.jvm <jvm> + @.js [0 function.identity] + @.lua [0 function.identity] + ... default + sequence.empty)))) (def: .public (then chunk buffer) (-> Text Buffer Buffer) - (with_expansions [<jvm> (let [[capacity transform] (:representation buffer) - then! (: (-> Text java/lang/StringBuilder java/lang/StringBuilder) - (function (_ chunk builder) - (exec - (java/lang/Appendable::append (:as java/lang/CharSequence chunk) - builder) - builder)))] - (:abstraction [(n.+ (//.size chunk) capacity) - (|>> transform (then! chunk))]))] + (with_expansions [<jvm> (let [[capacity transform] (representation buffer) + then! (is (-> Text java/lang/StringBuilder java/lang/StringBuilder) + (function (_ chunk builder) + (exec + (java/lang/Appendable::append (as java/lang/CharSequence chunk) + builder) + builder)))] + (abstraction [(n.+ (//.size chunk) capacity) + (|>> transform (then! chunk))]))] (for @.old <jvm> @.jvm <jvm> - @.js (let [[capacity transform] (:representation buffer) - then! (: (-> (JS_Array Text) (JS_Array Text)) - (function (_ array) - (exec - (JS_Array::push chunk array) - array)))] - (:abstraction [(n.+ (//.size chunk) capacity) - (|>> transform then!)])) - @.lua (let [[capacity transform] (:representation buffer) - then! (: (-> (array.Array Text) (array.Array Text)) + @.js (let [[capacity transform] (representation buffer) + then! (is (-> (JS_Array Text) (JS_Array Text)) (function (_ array) (exec - (table/insert array chunk) + (JS_Array::push chunk array) array)))] - (:abstraction [(n.+ (//.size chunk) capacity) - (|>> transform then!)])) + (abstraction [(n.+ (//.size chunk) capacity) + (|>> transform then!)])) + @.lua (let [[capacity transform] (representation buffer) + then! (is (-> (array.Array Text) (array.Array Text)) + (function (_ array) + (exec + (table/insert array chunk) + array)))] + (abstraction [(n.+ (//.size chunk) capacity) + (|>> transform then!)])) ... default - (|> buffer :representation (sequence.suffix chunk) :abstraction)))) + (|> buffer representation (sequence.suffix chunk) abstraction)))) (def: .public size (-> Buffer Nat) - (with_expansions [<jvm> (|>> :representation product.left)] + (with_expansions [<jvm> (|>> representation product.left)] (for @.old <jvm> @.jvm <jvm> @.js <jvm> @.lua <jvm> ... default - (|>> :representation + (|>> representation (sequence#mix (function (_ chunk total) (n.+ (//.size chunk) total)) 0))))) (def: .public (text buffer) (-> Buffer Text) - (with_expansions [<jvm> (let [[capacity transform] (:representation buffer)] + (with_expansions [<jvm> (let [[capacity transform] (representation buffer)] (|> (java/lang/StringBuilder::new (ffi.as_int (.int capacity))) transform java/lang/StringBuilder::toString ffi.of_string))] (for @.old <jvm> @.jvm <jvm> - @.js (let [[capacity transform] (:representation buffer)] + @.js (let [[capacity transform] (representation buffer)] (|> (array.empty 0) - (:as (JS_Array Text)) + (as (JS_Array Text)) transform (JS_Array::join ""))) - @.lua (let [[capacity transform] (:representation buffer)] + @.lua (let [[capacity transform] (representation buffer)] (table/concat (transform (array.empty 0)) "")) ... default (sequence#mix (function (_ chunk total) (format total chunk)) "" - (:representation buffer))))) + (representation buffer))))) )) diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux index e28dd31f1..10a29ed5c 100644 --- a/stdlib/source/library/lux/data/text/encoding.lux +++ b/stdlib/source/library/lux/data/text/encoding.lux @@ -1,10 +1,10 @@ (.using - [library - [lux "*" - [macro - ["[0]" template]] - [type - abstract]]]) + [library + [lux "*" + [macro + ["[0]" template]] + [type + [abstract {"-" pattern}]]]]) ... https://en.wikipedia.org/wiki/Character_encoding#Common_character_encodings (abstract: .public Encoding @@ -13,7 +13,7 @@ (template [<name> <encoding>] [(`` (def: .public <name> Encoding - (:abstraction <encoding>)))] + (abstraction <encoding>)))] [ascii "ASCII"] @@ -162,5 +162,5 @@ (def: .public name (-> Encoding Text) - (|>> :representation)) + (|>> representation)) ) diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux index a1627c8d2..e618307b4 100644 --- a/stdlib/source/library/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux @@ -75,13 +75,13 @@ @.js (cond ffi.on_nashorn? - (:as Binary ("js object do" "getBytes" value ["utf8"])) + (as Binary ("js object do" "getBytes" value ["utf8"])) ffi.on_node_js? (|> (Buffer::from|encoded value "utf8") ... This coercion is valid as per NodeJS's documentation: ... https://nodejs.org/api/buffer.html#buffer_buffers_and_typedarrays - (:as Uint8Array)) + (as Uint8Array)) ... On the browser (|> (TextEncoder::new (//.name //.utf_8)) @@ -89,14 +89,14 @@ ) @.python - (:as Binary ("python apply" (:expected ("python constant" "bytearray")) [value "utf-8"])) + (as Binary ("python apply" (as_expected ("python constant" "bytearray")) [value "utf-8"])) @.lua ("lua utf8 encode" value) @.ruby (|> value - (:as String) + (as String) (String::encode "UTF-8") (String::bytes)) @@ -104,7 +104,7 @@ (|> (..unpack [..php_byte_array_format value]) ..array_values ("php object new" "ArrayObject") - (:as Binary)) + (as Binary)) @.scheme (..string->utf8 value))) @@ -118,7 +118,7 @@ @.js (cond ffi.on_nashorn? (|> ("js object new" ("js constant" "java.lang.String") [value "utf8"]) - (:as Text) + (as Text) {try.#Success}) ffi.on_node_js? @@ -132,16 +132,16 @@ {try.#Success})) @.python - (try (:as Text ("python object do" "decode" (:expected value) ["utf-8"]))) + (try (as Text ("python object do" "decode" (as_expected value) ["utf-8"]))) @.lua {try.#Success ("lua utf8 decode" value)} @.ruby (|> value - (:as Array) + (as Array) (Array::pack "C*") - (:as String) + (as String) (String::force_encoding "UTF-8") {try.#Success}) diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 0e048bdcd..3ae94415b 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -81,7 +81,7 @@ (-> Text (Parser Code)) (do <>.monad [symbol (<text>.enclosed ["\@<" ">"] (symbol^ current_module))] - (in (` (: ((~! <text>.Parser) Text) (~ (code.symbol symbol))))))) + (in (` (is ((~! <text>.Parser) Text) (~ (code.symbol symbol))))))) (def: re_range^ (Parser Code) @@ -286,38 +286,38 @@ (re_scoped^ current_module))) .let [g!total (code.symbol ["" "0total"]) g!temp (code.symbol ["" "0temp"]) - [_ names steps] (list#mix (: (-> (Either Code [Re_Group Code]) - [Nat (List Code) (List (List Code))] - [Nat (List Code) (List (List Code))]) - (function (_ part [idx names steps]) - (case part - (^.or {.#Left complex} - {.#Right [{#Non_Capturing} complex]}) - [idx - names - (list& (list g!temp complex - (` .let) (` [(~ g!total) (# (~! //.monoid) (~' composite) (~ g!total) (~ g!temp))])) - steps)] - - {.#Right [{#Capturing [?name num_captures]} scoped]} - (let [[idx! name!] (case ?name - {.#Some _name} - [idx (code.symbol ["" _name])] - - {.#None} - [(++ idx) (code.symbol ["" (n#encoded idx)])]) - access (if (n.> 0 num_captures) - (` ((~! product.left) (~ name!))) - name!)] - [idx! - (list& name! names) - (list& (list name! scoped - (` .let) (` [(~ g!total) (# (~! //.monoid) (~' composite) (~ g!total) (~ access))])) - steps)]) - ))) + [_ names steps] (list#mix (is (-> (Either Code [Re_Group Code]) + [Nat (List Code) (List (List Code))] + [Nat (List Code) (List (List Code))]) + (function (_ part [idx names steps]) + (case part + (^.or {.#Left complex} + {.#Right [{#Non_Capturing} complex]}) + [idx + names + (list& (list g!temp complex + (` .let) (` [(~ g!total) (# (~! //.monoid) (~' composite) (~ g!total) (~ g!temp))])) + steps)] + + {.#Right [{#Capturing [?name num_captures]} scoped]} + (let [[idx! name!] (case ?name + {.#Some _name} + [idx (code.symbol ["" _name])] + + {.#None} + [(++ idx) (code.symbol ["" (n#encoded idx)])]) + access (if (n.> 0 num_captures) + (` ((~! product.left) (~ name!))) + name!)] + [idx! + (list& name! names) + (list& (list name! scoped + (` .let) (` [(~ g!total) (# (~! //.monoid) (~' composite) (~ g!total) (~ access))])) + steps)]) + ))) [0 - (: (List Code) (list)) - (: (List (List Code)) (list))] + (is (List Code) (list)) + (is (List (List Code)) (list))] parts)]] (in [(if capturing? (list.size names) diff --git a/stdlib/source/library/lux/data/text/unicode/block.lux b/stdlib/source/library/lux/data/text/unicode/block.lux index feab490e3..d0dec884f 100644 --- a/stdlib/source/library/lux/data/text/unicode/block.lux +++ b/stdlib/source/library/lux/data/text/unicode/block.lux @@ -11,7 +11,7 @@ ["n" nat ("[1]#[0]" interval)] ["[0]" i64]]] [type - abstract]]] + [abstract {"-" pattern}]]]] [/// {"+" Char}]) (abstract: .public Block @@ -21,13 +21,13 @@ (Monoid Block) (def: identity - (:abstraction + (abstraction (interval.between n.enum n#top n#bottom))) (def: (composite left right) - (let [left (:representation left) - right (:representation right)] - (:abstraction + (let [left (representation left) + right (representation right)] + (abstraction (interval.between n.enum (n.min (# left bottom) (# right bottom)) @@ -36,12 +36,12 @@ (def: .public (block start additional) (-> Char Nat Block) - (:abstraction (interval.between n.enum start (n.+ additional start)))) + (abstraction (interval.between n.enum start (n.+ additional start)))) (template [<name> <slot>] [(def: .public <name> (-> Block Char) - (|>> :representation (the <slot>)))] + (|>> representation (the <slot>)))] [start interval.bottom] [end interval.top] @@ -49,13 +49,13 @@ (def: .public (size block) (-> Block Nat) - (let [start (the interval.bottom (:representation block)) - end (the interval.top (:representation block))] + (let [start (the interval.bottom (representation block)) + end (the interval.top (representation block))] (|> end (n.- start) ++))) (def: .public (within? block char) (All (_ a) (-> Block Char Bit)) - (interval.within? (:representation block) char)) + (interval.within? (representation block) char)) ) (implementation: .public equivalence diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index b6b1e06b2..89359273b 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -1,51 +1,51 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}]] - [data - [collection - ["[0]" list ("[1]#[0]" mix functor)] - ["[0]" set ("[1]#[0]" equivalence)] - ["[0]" tree "_" - ["[1]" finger {"+" Tree}]]]] - [type {"+" :by_example} - abstract]]] - ["[0]" / "_" - ["/[1]" // "_" - [// {"+" Char}] - ["[1][0]" block {"+" Block}]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}]] + [data + [collection + ["[0]" list ("[1]#[0]" mix functor)] + ["[0]" set ("[1]#[0]" equivalence)] + ["[0]" tree "_" + ["[1]" finger {"+" Tree}]]]] + [type {"+" by_example} + [abstract {"-" pattern}]]]] + ["[0]" / "_" + ["/[1]" // "_" + [// {"+" Char}] + ["[1][0]" block {"+" Block}]]]) (def: builder (tree.builder //block.monoid)) (def: :@: - (:by_example [@] - (tree.Builder @ Block) - ..builder - - @)) + (by_example [@] + (tree.Builder @ Block) + ..builder + + @)) (abstract: .public Set (Tree :@: Block []) (def: .public (composite left right) (-> Set Set Set) - (:abstraction + (abstraction (# builder branch - (:representation left) - (:representation right)))) + (representation left) + (representation right)))) (def: (singleton block) (-> Block Set) - (:abstraction + (abstraction (# builder leaf block []))) (def: .public (set [head tail]) (-> [Block (List Block)] Set) - (list#mix (: (-> Block Set Set) - (function (_ block set) - (..composite (..singleton block) set))) + (list#mix (is (-> Block Set Set) + (function (_ block set) + (..composite (..singleton block) set))) (..singleton head) tail)) @@ -202,19 +202,19 @@ (def: .public start (-> Set Char) - (|>> :representation + (|>> representation tree.tag //block.start)) (def: .public end (-> Set Char) - (|>> :representation + (|>> representation tree.tag //block.end)) (def: .public (member? set character) (-> Set Char Bit) - (loop [tree (:representation set)] + (loop [tree (representation set)] (if (//block.within? (tree.tag tree) character) (case (tree.root tree) {0 #0 _} @@ -229,8 +229,8 @@ (Equivalence Set) (def: (= reference subject) - (set#= (set.of_list //block.hash (tree.tags (:representation reference))) - (set.of_list //block.hash (tree.tags (:representation subject)))))) + (set#= (set.of_list //block.hash (tree.tags (representation reference))) + (set.of_list //block.hash (tree.tags (representation subject)))))) ) (template [<name> <blocks>] diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index d4665f058..987a25120 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -136,7 +136,7 @@ (-> Inspector Inspector) (with_expansions [<adaption> (for @.lua (~~ (as_is ..tuple_array)) (~~ (as_is)))] - (`` (|>> (:as (array.Array Any)) + (`` (|>> (as (array.Array Any)) <adaption> (array.list {.#None}) (list#each inspection) @@ -145,7 +145,7 @@ (def: .public (inspection value) Inspector - (with_expansions [<jvm> (let [object (:as java/lang/Object value)] + (with_expansions [<jvm> (let [object (as java/lang/Object value)] (`` (<| (~~ (template [<class> <processing>] [(case (ffi.check <class> object) {.#Some value} @@ -160,7 +160,7 @@ )) (case (ffi.check [java/lang/Object] object) {.#Some value} - (let [value (:as (array.Array java/lang/Object) value)] + (let [value (as (array.Array java/lang/Object) value)] (case (array.read! 0 value) (^.multi {.#Some tag} [(ffi.check java/lang/Integer tag) @@ -187,9 +187,9 @@ (^.template [<type_of> <then>] [<type_of> (`` (|> value (~~ (template.spliced <then>))))]) - (["boolean" [(:as .Bit) %.bit]] - ["number" [(:as .Frac) %.frac]] - ["string" [(:as .Text) %.text]] + (["boolean" [(as .Bit) %.bit]] + ["number" [(as .Frac) %.frac]] + ["string" [(as .Text) %.text]] ["undefined" [JSON::stringify]]) "object" @@ -206,7 +206,7 @@ (not (or ("js object undefined?" ("js object get" "_lux_low" value)) ("js object undefined?" ("js object get" "_lux_high" value)))) - (|> value (:as .Int) %.int) + (|> value (as .Int) %.int) (Array::isArray value) (tuple_inspection inspection value) @@ -222,17 +222,17 @@ (^.template [<type_of> <class_of> <then>] [(^.or <type_of> <class_of>) (`` (|> value (~~ (template.spliced <then>))))]) - (["<type 'bool'>" "<class 'bool'>" [(:as .Bit) %.bit]] - ["<type 'int'>" "<class 'int'>" [(:as .Int) %.int]] - ["<type 'float'>" "<class 'float'>" [(:as .Frac) %.frac]] - ["<type 'str'>" "<class 'str'>" [(:as .Text) %.text]] - ["<type 'unicode'>" "<class 'unicode'>" [(:as .Text) %.text]]) + (["<type 'bool'>" "<class 'bool'>" [(as .Bit) %.bit]] + ["<type 'int'>" "<class 'int'>" [(as .Int) %.int]] + ["<type 'float'>" "<class 'float'>" [(as .Frac) %.frac]] + ["<type 'str'>" "<class 'str'>" [(as .Text) %.text]] + ["<type 'unicode'>" "<class 'unicode'>" [(as .Text) %.text]]) (^.or "<type 'list'>" "<class 'list'>") (tuple_inspection inspection value) (^.or "<type 'tuple'>" "<class 'tuple'>") - (let [variant (:as (array.Array Any) value)] + (let [variant (as (array.Array Any) value)] (case (array.size variant) 3 (let [variant_tag ("python array read" 0 variant) variant_flag ("python array read" 1 variant) @@ -240,7 +240,7 @@ (if (or ("python object none?" variant_tag) ("python object none?" variant_value)) (..str value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (|> variant_flag "python object none?" not %.bit) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -254,14 +254,14 @@ (^.template [<type_of> <then>] [<type_of> (`` (|> value (~~ (template.spliced <then>))))]) - (["boolean" [(:as .Bit) %.bit]] - ["string" [(:as .Text) %.text]] + (["boolean" [(as .Bit) %.bit]] + ["string" [(as .Text) %.text]] ["nil" [(pipe.new "nil" [])]]) "number" (case (math::type value) - {.#Some "integer"} (|> value (:as .Int) %.int) - {.#Some "float"} (|> value (:as .Frac) %.frac) + {.#Some "integer"} (|> value (as .Int) %.int) + {.#Some "float"} (|> value (as .Frac) %.frac) _ (..tostring value)) @@ -273,7 +273,7 @@ (if (or ("lua object nil?" variant_tag) ("lua object nil?" variant_value)) (tuple_inspection inspection value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("lua object nil?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -284,17 +284,17 @@ @.ruby (template.let [(class_of <literal>) [(|> <literal> - (:as ..Object) + (as ..Object) Object::class)] (to_s <object>) [(|> <object> - (:as ..Object) + (as ..Object) Object::to_s)]] (let [value_class (class_of value)] (`` (cond (~~ (template [<literal> <type> <format>] [(same? (class_of <literal>) value_class) - (|> value (:as <type>) <format>)] + (|> value (as <type>) <format>)] [#0 Bit %.bit] [#1 Bit %.bit] @@ -311,7 +311,7 @@ (if (or ("ruby object nil?" variant_tag) ("ruby object nil?" variant_value)) (tuple_inspection inspection value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("ruby object nil?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -327,10 +327,10 @@ (^.template [<type_of> <then>] [<type_of> (`` (|> value (~~ (template.spliced <then>))))]) - (["boolean" [(:as .Bit) %.bit]] - ["integer" [(:as .Int) %.int]] - ["double" [(:as .Frac) %.frac]] - ["string" [(:as .Text) %.text]] + (["boolean" [(as .Bit) %.bit]] + ["integer" [(as .Int) %.int]] + ["double" [(as .Frac) %.frac]] + ["string" [(as .Text) %.text]] ["NULL" [(pipe.new "null" [])]] ["array" [(tuple_inspection inspection)]]) @@ -341,7 +341,7 @@ (if (or ("php object null?" variant_tag) ("php object null?" variant_value)) (..strval value) - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("php object null?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"])))) @@ -354,10 +354,10 @@ [(<when> value) (`` (|> value (~~ (template.spliced <then>))))] - [..boolean? [(:as .Bit) %.bit]] - [..integer? [(:as .Int) %.int]] - [..real? [(:as .Frac) %.frac]] - [..string? [(:as .Text) %.text]] + [..boolean? [(as .Bit) %.bit]] + [..integer? [(as .Int) %.int]] + [..real? [(as .Frac) %.frac]] + [..string? [(as .Text) %.text]] ["scheme object nil?" [(pipe.new "()" [])]] [..vector? [(tuple_inspection inspection)]])) @@ -365,11 +365,11 @@ (let [variant_tag (..car value) variant_rest (..cdr value)] (if (and (..integer? variant_tag) - (i.> +0 (:as Int variant_tag)) + (i.> +0 (as Int variant_tag)) (..pair? variant_rest)) (let [variant_flag (..car variant_rest) variant_value (..cdr variant_rest)] - (|> (%.format (|> variant_tag (:as .Nat) %.nat) + (|> (%.format (|> variant_tag (as .Nat) %.nat) " " (%.bit (not ("scheme object nil?" variant_flag))) " " (inspection variant_value)) (text.enclosed ["{" "}"]))) @@ -397,7 +397,7 @@ (~~ (template [<type> <formatter>] [(do <>.monad [_ (<type>.sub <type>)] - (in (|>> (:as <type>) <formatter>)))] + (in (|>> (as <type>) <formatter>)))] [Bit %.bit] [Nat %.nat] @@ -413,7 +413,7 @@ (~~ (template [<type> <formatter>] [(do <>.monad [_ (<type>.sub <type>)] - (in (|>> (:as <type>) <formatter>)))] + (in (|>> (as <type>) <formatter>)))] [Ratio %.ratio] [Symbol %.symbol] @@ -434,12 +434,12 @@ (do <>.monad [[_ elemT] (<type>.applied (<>.and (<type>.exactly List) <type>.any)) elemR (<type>.local (list elemT) representation)] - (in (|>> (:as (List Any)) (%.list elemR)))) + (in (|>> (as (List Any)) (%.list elemR)))) (do <>.monad [[_ elemT] (<type>.applied (<>.and (<type>.exactly Maybe) <type>.any)) elemR (<type>.local (list elemT) representation)] - (in (|>> (:as (Maybe Any)) + (in (|>> (as (Maybe Any)) (%.maybe elemR))))))) (def: (variant_representation representation) @@ -452,7 +452,7 @@ variantV variantV] (case representations {.#Item leftR {.#Item rightR extraR+}} - (case (:as (Or Any Any) variantV) + (case (as (Or Any Any) variantV) {.#Left left} [lefts #0 (leftR left)] @@ -483,7 +483,7 @@ (lastR tupleV) {.#Item headR tailR} - (let [[leftV rightV] (:as [Any Any] tupleV)] + (let [[leftV rightV] (as [Any Any] tupleV)] (%.format (headR leftV) " " (again tailR rightV)))))] (%.format "[" tuple_body "]")))))) @@ -538,7 +538,7 @@ "Location" (%.location location) "Type" (%.type type))) -(syntax: .public (:hole []) +(syntax: .public (hole []) (do meta.monad [location meta.location expectedT meta.expected_type] @@ -558,10 +558,10 @@ (exception.report "Name" (%.text name))) -(syntax: .public (here [targets (: (<code>.Parser (List Target)) - (|> ..target - <>.some - (<>.else (list))))]) +(syntax: .public (here [targets (is (<code>.Parser (List Target)) + (|> ..target + <>.some + (<>.else (list))))]) (do [! meta.monad] [location meta.location locals meta.locals @@ -571,20 +571,20 @@ ... later bindings overshadow earlier ones if they have the same name. list.reversed (dictionary.of_list text.hash))] - targets (: (Meta (List Target)) - (case targets - {.#End} - (|> environment - dictionary.keys - (list#each (function (_ local) [local {.#None}])) - in) - - _ - (monad.each ! (function (_ [name format]) - (if (dictionary.key? environment name) - (in [name format]) - (function.constant (exception.except ..unknown_local_binding [name])))) - targets)))] + targets (is (Meta (List Target)) + (case targets + {.#End} + (|> environment + dictionary.keys + (list#each (function (_ local) [local {.#None}])) + in) + + _ + (monad.each ! (function (_ [name format]) + (if (dictionary.key? environment name) + (in [name format]) + (function.constant (exception.except ..unknown_local_binding [name])))) + targets)))] (in (list (` (..log! ("lux text concat" (~ (code.text (%.format (%.location location) text.new_line))) ((~! exception.report) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index f6640a9b2..3d4cdcced 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -519,11 +519,11 @@ ... Type (let [(~ g!type) ("lux in-module" (~ g!module) - (.:of (~ (code.symbol name))))] + (.type_of (~ (code.symbol name))))] ((~! md.code) "clojure" (~ (if (type#= .Type def_type) (` (|> (~ (code.symbol name)) - (:as .Type) + (as .Type) ((~! type.anonymous)) ((~! ..type_definition) (~ g!module) @@ -582,11 +582,11 @@ (syntax: .public (default [[name parameters] ..declaration]) (let [[_ short] name] - (in (list (` (: (.List ..Definition) - (list [..#definition (~ (code.text short)) - ..#documentation ((~! ..minimal_definition_documentation) - ((~ (code.symbol name)) - (~+ (list#each code.local_symbol parameters))))]))))))) + (in (list (` (is (.List ..Definition) + (list [..#definition (~ (code.text short)) + ..#documentation ((~! ..minimal_definition_documentation) + ((~ (code.symbol name)) + (~+ (list#each code.local_symbol parameters))))]))))))) (syntax: .public (documentation: [[name parameters] ..declaration extra (<>.some <code>.any)]) @@ -630,18 +630,18 @@ subs (<code>.tuple (<>.some <code>.any))]) (do meta.monad [expected (meta.exports name)] - (in (list (` (: (List Module) - (list& [..#module (~ (code.text name)) - ..#description (~ description) - ..#expected ((~! ..expected) - (~ (code.text (|> expected - (list#each product.left) - ..expected_format)))) - ..#definitions ((~! list.together) (list (~+ definitions)))] - ($_ (# (~! list.monoid) (~' composite)) - (: (List Module) - (# (~! list.monoid) (~' identity))) - (~+ subs))))))))) + (in (list (` (is (List Module) + (list& [..#module (~ (code.text name)) + ..#description (~ description) + ..#expected ((~! ..expected) + (~ (code.text (|> expected + (list#each product.left) + ..expected_format)))) + ..#definitions ((~! list.together) (list (~+ definitions)))] + ($_ (# (~! list.monoid) (~' composite)) + (is (List Module) + (# (~! list.monoid) (~' identity))) + (~+ subs))))))))) (def: listing (-> (List Text) (Markdown Block)) @@ -706,5 +706,5 @@ (text#< (the #module right) (the #module left)))) (list#each ..module_documentation) (list.interposed md.horizontal_rule) - (list#mix md.then (: (Markdown Block) md.empty)) + (list#mix md.then (is (Markdown Block) md.empty)) md.markdown)) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index f9d3dd004..446f2e738 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" Primitive Type type int char :as} + [lux {"-" Primitive Type type int char as} ["[0]" meta] [abstract ["[0]" monad {"+" do}]] @@ -115,9 +115,9 @@ (-> (Type Value) Text Code Code) (let [unboxed (..reflection unboxed)] (` (|> (~ raw) - (: (.Primitive (~ (code.text <pre>)))) + (is (.Primitive (~ (code.text <pre>)))) "jvm object cast" - (: (.Primitive (~ (code.text <post>))))))))] + (is (.Primitive (~ (code.text <post>))))))))] [unbox boxed unboxed] [box unboxed boxed] @@ -126,11 +126,11 @@ (template [<name> <op> <from> <to>] [(template: .public (<name> value) [(|> value - (: <from>) + (is <from>) "jvm object cast" <op> "jvm object cast" - (: <to>))])] + (is <to>))])] [byte_to_long "jvm conversion byte-to-long" ..Byte ..Long] @@ -424,8 +424,8 @@ (-> Text Text Text (Parser Code)) (do <>.monad [.let [dotted_name (format "::" field_name)] - [_ _ value] (: (Parser [Any Any Code]) - (<code>.form ($_ <>.and (<code>.this! (' :=)) (<code>.this! (code.symbol ["" dotted_name])) <code>.any)))] + [_ _ value] (is (Parser [Any Any Code]) + (<code>.form ($_ <>.and (<code>.this! (' :=)) (<code>.this! (code.symbol ["" dotted_name])) <code>.any)))] (in (`' ("jvm member put virtual" (~ (code.text class_name)) (~ (code.text field_name)) @@ -472,9 +472,9 @@ (def: (constructor_parser class_name arguments) (-> Text (List Argument) (Parser Code)) (do <>.monad - [args (: (Parser (List Code)) - (<code>.form (<>.after (<code>.this! (' ::new!)) - (<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))] + [args (is (Parser (List Code)) + (<code>.form (<>.after (<code>.this! (' ::new!)) + (<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))] (in (` ("jvm member invoke constructor" (~ (code.text class_name)) (~+ (|> args (list.zipped/2 (list#each product.right arguments)) @@ -484,9 +484,9 @@ (-> Text Text (List Argument) (Parser Code)) (do <>.monad [.let [dotted_name (format "::" method_name "!")] - args (: (Parser (List Code)) - (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) - (<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))] + args (is (Parser (List Code)) + (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) + (<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))] (in (` ("jvm member invoke static" (~ (code.text class_name)) (~ (code.text method_name)) (~+ (|> args (list.zipped/2 (list#each product.right arguments)) @@ -497,9 +497,9 @@ (-> (List (Type Var)) Text (List (Type Var)) Text (List Argument) Text (Parser Code)) (do <>.monad [.let [dotted_name (format "::" method_name "!")] - args (: (Parser (List Code)) - (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) - (<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))] + args (is (Parser (List Code)) + (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) + (<code>.tuple (<>.exactly (list.size arguments) <code>.any)))))] (in (` (<jvm_op> [(~+ (list#each (|>> ..signature code.text) class_vars))] (~ (code.text class_name)) (~ (code.text method_name)) [(~+ (list#each (|>> ..signature code.text) type_vars))] @@ -582,10 +582,10 @@ (-> (List (Type Var)) (Parser (Type Class)))) (do <>.monad [.let [class_name^ (..valid_class_name type_vars)] - [name parameters] (: (Parser [External (List (Type Parameter))]) - ($_ <>.either - (<>.and class_name^ (<>#in (list))) - (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] + [name parameters] (is (Parser [External (List (Type Parameter))]) + ($_ <>.either + (<>.and class_name^ (<>#in (list))) + (<code>.form (<>.and class_name^ (<>.some (parameter^ type_vars))))))] (in (jvm.class (name.safe name) parameters)))) (exception: .public (unknown_type_variable [name Text @@ -691,12 +691,12 @@ (def: declaration^ (Parser (Type Declaration)) (do <>.monad - [[name variables] (: (Parser [External (List (Type Var))]) - (<>.either (<>.and (..valid_class_name (list)) - (<>#in (list))) - (<code>.form (<>.and (..valid_class_name (list)) - (<>.some var^))) - ))] + [[name variables] (is (Parser [External (List (Type Var))]) + (<>.either (<>.and (..valid_class_name (list)) + (<>#in (list))) + (<code>.form (<>.and (..valid_class_name (list)) + (<>.some var^))) + ))] (in (jvm.declaration name variables)))) (def: (class^ type_vars) @@ -964,9 +964,9 @@ []]}) )) (<code>.form (do <>.monad - [kind (: (Parser ImportMethodKind) - (<>.or (<code>.this! (' "static")) - (in []))) + [kind (is (Parser ImportMethodKind) + (<>.or (<code>.this! (' "static")) + (in []))) tvars (<>.else (list) ..vars^) name <code>.local_symbol ?alias import_member_alias^ @@ -1209,10 +1209,10 @@ methods (<>.some (..method_def^ class_vars))]) (do meta.monad [.let [fully_qualified_class_name full_class_name - method_parser (: (Parser Code) - (|> methods - (list#each (method->parser class_vars fully_qualified_class_name)) - (list#mix <>.either (<>.failure ""))))]] + method_parser (is (Parser Code) + (|> methods + (list#each (method->parser class_vars fully_qualified_class_name)) + (list#mix <>.either (<>.failure ""))))]] (in (list (` ("jvm class" (~ (declaration$ (jvm.declaration full_class_name class_vars))) (~ (class$ super)) @@ -1278,19 +1278,19 @@ class_type (` (.Primitive (~ (code.text class_name)))) check_type (` (.Maybe (~ class_type))) check_code (` (if ("jvm object instance?" (~ (code.text class_name)) (~ g!unchecked)) - {.#Some (.:as (~ class_type) - (~ g!unchecked))} + {.#Some (.as (~ class_type) + (~ g!unchecked))} {.#None}))] (case unchecked {.#Some unchecked} - (in (list (` (: (~ check_type) - (let [(~ g!unchecked) (~ unchecked)] - (~ check_code)))))) + (in (list (` (is (~ check_type) + (let [(~ g!unchecked) (~ unchecked)] + (~ check_code)))))) {.#None} - (in (list (` (: (-> (.Primitive "java.lang.Object") (~ check_type)) - (function ((~ g!_) (~ g!unchecked)) - (~ check_code)))))) + (in (list (` (is (-> (.Primitive "java.lang.Object") (~ check_type)) + (function ((~ g!_) (~ g!unchecked)) + (~ check_code)))))) )))) (syntax: .public (synchronized [lock <code>.any @@ -1340,18 +1340,18 @@ (let [(open "[0]") commons] (do [! meta.monad] [arg_inputs (monad.each ! - (: (-> [Bit (Type Value)] (Meta [Bit Code])) - (function (_ [maybe? _]) - (with_symbols [arg_name] - (in [maybe? arg_name])))) + (is (-> [Bit (Type Value)] (Meta [Bit Code])) + (function (_ [maybe? _]) + (with_symbols [arg_name] + (in [maybe? arg_name])))) #import_member_args) .let [input_jvm_types (list#each product.right #import_member_args) - arg_types (list#each (: (-> [Bit (Type Value)] Code) - (function (_ [maybe? arg]) - (let [arg_type (value_type (the #import_member_mode commons) arg)] - (if maybe? - (` (Maybe (~ arg_type))) - arg_type)))) + arg_types (list#each (is (-> [Bit (Type Value)] Code) + (function (_ [maybe? arg]) + (let [arg_type (value_type (the #import_member_mode commons) arg)] + (if maybe? + (` (Maybe (~ arg_type))) + arg_type)))) #import_member_args)]] (in [arg_inputs input_jvm_types arg_types]))) @@ -1372,8 +1372,8 @@ ... else (let [g!temp (` ((~' ~') (~ (code.symbol ["" " Ω "]))))] (` (let [(~ g!temp) (~ return_term)] - (if (not (..null? (.:as (.Primitive "java.lang.Object") - (~ g!temp)))) + (if (not (..null? (.as (.Primitive "java.lang.Object") + (~ g!temp)))) (~ g!temp) (panic! "Cannot produce null references from method calls.")))))) @@ -1399,28 +1399,28 @@ (template [<input?> <name> <unbox/box> <special+>] [(def: (<name> mode [unboxed raw]) (-> Primitive_Mode [(Type Value) Code] Code) - (let [[unboxed refined post] (: [(Type Value) Code (List Code)] - (case mode - {#ManualPrM} - [unboxed raw (list)] - - {#AutoPrM} - (with_expansions [<special+>' (template.spliced <special+>) - <cond_cases> (template [<primitive> <pre> <post>] - [(# jvm.equivalence = <primitive> unboxed) - (with_expansions [<post>' (template.spliced <post>)] - [<primitive> - (` (.|> (~ raw) (~+ <pre>))) - (list <post>')])] - - <special+>')] - (cond <cond_cases> - ... else - [unboxed - (if <input?> - (` ("jvm object cast" (~ raw))) - raw) - (list)])))) + (let [[unboxed refined post] (is [(Type Value) Code (List Code)] + (case mode + {#ManualPrM} + [unboxed raw (list)] + + {#AutoPrM} + (with_expansions [<special+>' (template.spliced <special+>) + <cond_cases> (template [<primitive> <pre> <post>] + [(# jvm.equivalence = <primitive> unboxed) + (with_expansions [<post>' (template.spliced <post>)] + [<primitive> + (` (.|> (~ raw) (~+ <pre>))) + (list <post>')])] + + <special+>')] + (cond <cond_cases> + ... else + [unboxed + (if <input?> + (` ("jvm object cast" (~ raw))) + raw) + (list)])))) unboxed/boxed (case (dictionary.value unboxed ..boxes) {.#Some boxed} (<unbox/box> unboxed boxed refined) @@ -1435,23 +1435,23 @@ (` (.|> (~ unboxed/boxed) (~+ post))))))] [#1 with_automatic_input_conversion ..unbox - [[jvm.boolean (list (` (.:as (.Primitive (~ (code.text box.boolean)))))) []] - [jvm.byte (list (` (.:as (.Primitive (~ (code.text box.byte)))))) []] - [jvm.short (list (` (.:as (.Primitive (~ (code.text box.short)))))) []] - [jvm.int (list (` (.: (.Primitive (~ (code.text box.int)))))) []] - [jvm.long (list (` (.:as (.Primitive (~ (code.text box.long)))))) []] - [jvm.char (list (` (.:as (.Primitive (~ (code.text box.char)))))) []] - [jvm.float (list (` (.:as (.Primitive (~ (code.text box.float)))))) []] - [jvm.double (list (` (.:as (.Primitive (~ (code.text box.double)))))) []]]] + [[jvm.boolean (list (` (.as (.Primitive (~ (code.text box.boolean)))))) []] + [jvm.byte (list (` (.as (.Primitive (~ (code.text box.byte)))))) []] + [jvm.short (list (` (.as (.Primitive (~ (code.text box.short)))))) []] + [jvm.int (list (` (.is (.Primitive (~ (code.text box.int)))))) []] + [jvm.long (list (` (.as (.Primitive (~ (code.text box.long)))))) []] + [jvm.char (list (` (.as (.Primitive (~ (code.text box.char)))))) []] + [jvm.float (list (` (.as (.Primitive (~ (code.text box.float)))))) []] + [jvm.double (list (` (.as (.Primitive (~ (code.text box.double)))))) []]]] [#0 with_automatic_output_conversion ..box - [[jvm.boolean (list) [(` (.: (.Primitive (~ (code.text box.boolean)))))]] - [jvm.byte (list) [(` (.: (.Primitive (~ (code.text box.byte)))))]] - [jvm.short (list) [(` (.: (.Primitive (~ (code.text box.short)))))]] - [jvm.int (list) [(` (.: (.Primitive (~ (code.text box.int)))))]] - [jvm.long (list) [(` (.: (.Primitive (~ (code.text box.long)))))]] - [jvm.char (list) [(` (.: (.Primitive (~ (code.text box.char)))))]] - [jvm.float (list) [(` (.: (.Primitive (~ (code.text box.float)))))]] - [jvm.double (list) [(` (.: (.Primitive (~ (code.text box.double)))))]]]] + [[jvm.boolean (list) [(` (.is (.Primitive (~ (code.text box.boolean)))))]] + [jvm.byte (list) [(` (.is (.Primitive (~ (code.text box.byte)))))]] + [jvm.short (list) [(` (.is (.Primitive (~ (code.text box.short)))))]] + [jvm.int (list) [(` (.is (.Primitive (~ (code.text box.int)))))]] + [jvm.long (list) [(` (.is (.Primitive (~ (code.text box.long)))))]] + [jvm.char (list) [(` (.is (.Primitive (~ (code.text box.char)))))]] + [jvm.float (list) [(` (.is (.Primitive (~ (code.text box.float)))))]] + [jvm.double (list) [(` (.is (.Primitive (~ (code.text box.double)))))]]]] ) (def: (un_quoted quoted) @@ -1464,8 +1464,8 @@ (list.zipped/2 classes) (list#each (function (_ [class [maybe? input]]) (|> (if maybe? - (` (: (.Primitive (~ (code.text (..reflection class)))) - ((~! !!!) (~ (..un_quoted input))))) + (` (is (.Primitive (~ (code.text (..reflection class)))) + ((~! !!!) (~ (..un_quoted input))))) (..un_quoted input)) [class] (with_automatic_input_conversion mode)))))) @@ -1489,21 +1489,21 @@ {#EnumDecl enum_members} (with_symbols [g!_] (do meta.monad - [.let [enum_type (: Code - (case class_tvars - {.#End} - (` (.Primitive (~ (code.text full_name)))) - - _ - (let [=class_tvars (list#each ..var$' class_tvars)] - (` (All ((~ g!_) (~+ =class_tvars)) - (.Primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) - getter_interop (: (-> Text Code) - (function (_ name) - (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])] - (` (def: (~ getter_name) - (~ enum_type) - (~ (get_static_field full_name name)))))))]] + [.let [enum_type (is Code + (case class_tvars + {.#End} + (` (.Primitive (~ (code.text full_name)))) + + _ + (let [=class_tvars (list#each ..var$' class_tvars)] + (` (All ((~ g!_) (~+ =class_tvars)) + (.Primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) + getter_interop (is (-> Text Code) + (function (_ name) + (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])] + (` (def: (~ getter_name) + (~ enum_type) + (~ (get_static_field full_name name)))))))]] (in (list#each getter_interop enum_members)))) {#ConstructorDecl [commons _]} @@ -1531,51 +1531,51 @@ [.let [def_name (code.symbol ["" (..import_name import_format method_prefix (the #import_member_alias commons))]) (open "[0]") commons (open "[0]") method - [jvm_op object_ast] (: [Text (List Code)] - (case #import_member_kind - {#StaticIMK} - ["jvm member invoke static" - (list)] - - {#VirtualIMK} - (case kind - {#Class} - ["jvm member invoke virtual" - (list g!obj)] - - {#Interface} - ["jvm member invoke interface" - (list g!obj)] - ))) + [jvm_op object_ast] (is [Text (List Code)] + (case #import_member_kind + {#StaticIMK} + ["jvm member invoke static" + (list)] + + {#VirtualIMK} + (case kind + {#Class} + ["jvm member invoke virtual" + (list g!obj)] + + {#Interface} + ["jvm member invoke interface" + (list g!obj)] + ))) method_return (the #import_method_return method) - callC (: Code - (` ((~ (code.text jvm_op)) - [(~+ (list#each ..var$ class_tvars))] - (~ (code.text full_name)) - (~ (code.text #import_method_name)) - [(~+ (list#each ..var$ (the #import_member_tvars commons)))] - (~+ (|> object_ast - (list#each ..un_quoted) - (list.zipped/2 (list (jvm.class full_name (list)))) - (list#each (with_automatic_input_conversion (the #import_member_mode commons))))) - (~+ (|> (jvm_invoke_inputs (the #import_member_mode commons) input_jvm_types arg_function_inputs) - (list.zipped/2 input_jvm_types) - (list#each ..decorate_input)))))) - jvm_interop (: Code - (case (jvm.void? method_return) - {.#Left method_return} - (|> [method_return - callC] - (with_automatic_output_conversion (the #import_member_mode commons)) - (with_return_maybe member false method_return) - (with_return_try member) - (with_return_io member)) - - - {.#Right method_return} - (|> callC - (with_return_try member) - (with_return_io member))))]] + callC (is Code + (` ((~ (code.text jvm_op)) + [(~+ (list#each ..var$ class_tvars))] + (~ (code.text full_name)) + (~ (code.text #import_method_name)) + [(~+ (list#each ..var$ (the #import_member_tvars commons)))] + (~+ (|> object_ast + (list#each ..un_quoted) + (list.zipped/2 (list (jvm.class full_name (list)))) + (list#each (with_automatic_input_conversion (the #import_member_mode commons))))) + (~+ (|> (jvm_invoke_inputs (the #import_member_mode commons) input_jvm_types arg_function_inputs) + (list.zipped/2 input_jvm_types) + (list#each ..decorate_input)))))) + jvm_interop (is Code + (case (jvm.void? method_return) + {.#Left method_return} + (|> [method_return + callC] + (with_automatic_output_conversion (the #import_member_mode commons)) + (with_return_maybe member false method_return) + (with_return_try member) + (with_return_io member)) + + + {.#Right method_return} + (|> callC + (with_return_try member) + (with_return_io member))))]] (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list#each product.right arg_function_inputs))) (~+ (syntax_inputs object_ast))]) ((~' in) (.list (.` (~ jvm_interop)))))))))) @@ -1602,27 +1602,27 @@ getter_body)] (in (` ((~! syntax:) (~ getter_call) ((~' in) (.list (.` (~ getter_body))))))))) - setter_interop (: (Meta (List Code)) - (if _#import_field_setter? - (with_symbols [g!obj g!value] - (let [setter_call (if _#import_field_static? - (` ((~ setter_name) [(~ g!value) (~! <code>.any)])) - (` ((~ setter_name) [(~ g!value) (~! <code>.any) - (~ g!obj) (~! <code>.any)]))) - setter_value (|> [_#import_field_type (..un_quoted g!value)] - (with_automatic_input_conversion _#import_field_mode)) - setter_value (if _#import_field_maybe? - (` ((~! !!!) (~ setter_value))) - setter_value) - setter_command (format (if _#import_field_static? "jvm putstatic" "jvm putfield") - ":" full_name ":" _#import_field_name) - g!obj+ (: (List Code) - (if _#import_field_static? - (list) - (list (..un_quoted g!obj))))] - (in (list (` ((~! syntax:) (~ setter_call) - ((~' in) (.list (.` ((~! io.io) ((~ (code.text setter_command)) (~+ g!obj+) (~ setter_value)))))))))))) - (in (list))))] + setter_interop (is (Meta (List Code)) + (if _#import_field_setter? + (with_symbols [g!obj g!value] + (let [setter_call (if _#import_field_static? + (` ((~ setter_name) [(~ g!value) (~! <code>.any)])) + (` ((~ setter_name) [(~ g!value) (~! <code>.any) + (~ g!obj) (~! <code>.any)]))) + setter_value (|> [_#import_field_type (..un_quoted g!value)] + (with_automatic_input_conversion _#import_field_mode)) + setter_value (if _#import_field_maybe? + (` ((~! !!!) (~ setter_value))) + setter_value) + setter_command (format (if _#import_field_static? "jvm putstatic" "jvm putfield") + ":" full_name ":" _#import_field_name) + g!obj+ (is (List Code) + (if _#import_field_static? + (list) + (list (..un_quoted g!obj))))] + (in (list (` ((~! syntax:) (~ setter_call) + ((~' in) (.list (.` ((~! io.io) ((~ (code.text setter_command)) (~+ g!obj+) (~ setter_value)))))))))))) + (in (list))))] (in (list& getter_interop setter_interop))) ))) @@ -1638,12 +1638,12 @@ (All (_ a) (-> (.Primitive "java.lang.Class" [a]) Bit)) (|>> ("jvm member invoke virtual" [] "java.lang.Class" "isInterface" []) "jvm object cast" - (: ..Boolean) - (.:as Bit))) + (is ..Boolean) + (.as Bit))) (def: load_class (-> External (Try (.Primitive "java.lang.Class" [Any]))) - (|>> (.:as (.Primitive "java.lang.String")) + (|>> (.as (.Primitive "java.lang.String")) ["Ljava/lang/String;"] ("jvm member invoke static" [] "java.lang.Class" "forName" []) try)) @@ -1674,8 +1674,8 @@ (syntax: .public (array [type (..type^ (list)) size <code>.any]) (let [g!size (` (|> (~ size) - (.: .Nat) - (.:as (.Primitive (~ (code.text box.long)))) + (.is .Nat) + (.as (.Primitive (~ (code.text box.long)))) "jvm object cast" "jvm conversion long-to-int"))] (`` (cond (~~ (template [<primitive> <array_op>] @@ -1691,8 +1691,8 @@ [jvm.double "jvm array new double"] [jvm.char "jvm array new char"])) ... else - (in (list (` (: (~ (value_type {#ManualPrM} (jvm.array type))) - ("jvm array new object" (~ g!size)))))))))) + (in (list (` (is (~ (value_type {#ManualPrM} (jvm.array type))) + ("jvm array new object" (~ g!size)))))))))) (exception: .public (cannot_convert_to_jvm_type [type .Type]) (exception.report @@ -1762,18 +1762,18 @@ ... else (# meta.monad each (jvm.class name) - (: (Meta (List (Type Parameter))) - (monad.each meta.monad - (function (_ paramLT) - (do meta.monad - [paramJT (lux_type->jvm_type context paramLT)] - (case (parser.parameter? paramJT) - {.#Some paramJT} - (in paramJT) - - {.#None} - <failure>))) - params))))) + (is (Meta (List (Type Parameter))) + (monad.each meta.monad + (function (_ paramLT) + (do meta.monad + [paramJT (lux_type->jvm_type context paramLT)] + (case (parser.parameter? paramJT) + {.#Some paramJT} + (in paramJT) + + {.#None} + <failure>))) + params))))) {.#Apply A F} (case (type.applied (list A) F) @@ -1824,8 +1824,8 @@ (in (list (` (.|> ((~ g!extension) (~ array)) "jvm conversion int-to-long" "jvm object cast" - (.: (.Primitive (~ (code.text box.long)))) - (.:as .Nat)))))) + (.is (.Primitive (~ (code.text box.long)))) + (.as .Nat)))))) _ (with_symbols [g!array] @@ -1841,8 +1841,8 @@ context meta.type_context array_jvm_type (lux_type->jvm_type context array_type) .let [g!idx (` (.|> (~ idx) - (.: .Nat) - (.:as (.Primitive (~ (code.text box.long)))) + (.is .Nat) + (.as (.Primitive (~ (code.text box.long)))) "jvm object cast" "jvm conversion long-to-int"))]] (`` (cond (~~ (template [<primitive> <extension> <box>] @@ -1851,7 +1851,7 @@ array_jvm_type) (in (list (` (.|> (<extension> (~ g!idx) (~ array)) "jvm object cast" - (.: (.Primitive (~ (code.text <box>))))))))] + (.is (.Primitive (~ (code.text <box>))))))))] [jvm.boolean "jvm array read boolean" box.boolean] [jvm.byte "jvm array read byte" box.byte] @@ -1880,8 +1880,8 @@ context meta.type_context array_jvm_type (lux_type->jvm_type context array_type) .let [g!idx (` (.|> (~ idx) - (.: .Nat) - (.:as (.Primitive (~ (code.text box.long)))) + (.is .Nat) + (.as (.Primitive (~ (code.text box.long)))) "jvm object cast" "jvm conversion long-to-int"))]] (`` (cond (~~ (template [<primitive> <extension> <box>] @@ -1889,7 +1889,7 @@ (jvm.array <primitive>) array_jvm_type) (let [g!value (` (.|> (~ value) - (.:as (.Primitive (~ (code.text <box>)))) + (.as (.Primitive (~ (code.text <box>)))) "jvm object cast"))] (in (list (` (<extension> (~ g!idx) (~ g!value) (~ array))))))] @@ -1921,23 +1921,23 @@ "Signature" (..signature type) "Reflection" (..reflection type))) -(syntax: .public (:as [type (..type^ (list)) - object <code>.any]) +(syntax: .public (as [type (..type^ (list)) + object <code>.any]) (case [(parser.array? type) (parser.class? type)] (^.or [{.#Some _} _] [_ {.#Some _}]) - (in (list (` (.: (~ (..value_type {#ManualPrM} type)) - ("jvm object cast" (~ object)))))) + (in (list (` (.is (~ (..value_type {#ManualPrM} type)) + ("jvm object cast" (~ object)))))) _ (meta.failure (exception.error ..cannot_cast_to_non_object [type])))) (template [<forward> <from> <to> <backward>] [(template: .public (<forward> it) - [(|> it (: <from>) (:as <to>))]) + [(|> it (is <from>) (as <to>))]) (template: .public (<backward> it) - [(|> it (: <to>) (:as <from>))])] + [(|> it (is <to>) (as <from>))])] [as_boolean .Bit ..Boolean of_boolean] [as_long .Int ..Long of_long] @@ -1947,10 +1947,10 @@ (template [<forward> <from> <$> <mid> <$'> <to> <backward>] [(template: .public (<forward> it) - [(|> it (: <from>) (:as <mid>) <$> (: <to>))]) + [(|> it (is <from>) (as <mid>) <$> (is <to>))]) (template: .public (<backward> it) - [(|> it (: <to>) <$'> (: <mid>) (:as <from>))])] + [(|> it (is <to>) <$'> (is <mid>) (as <from>))])] [as_byte .Int ..long_to_byte ..Long ..byte_to_long ..Byte of_byte] [as_short .Int ..long_to_short ..Long ..short_to_long ..Short of_short] diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index f5b578b62..6554a4082 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -264,7 +264,7 @@ <lux_?> <host_?>] [(def: .public (<lux_it> _) (-> Any Nothing) - (:expected (<host_it>))) + (as_expected (<host_it>))) (def: .public <lux_?> (-> Any Bit) @@ -385,10 +385,10 @@ (..input_type input))))) (.exec (~+ import!) - (.:expected + (.as_expected (~ (<| (..input_term input) (..lux_optional :output:) - (` (<apply> (.:expected (~ source)) + (` (<apply> (.as_expected (~ source)) [(~+ (list#each ..host_optional g!parameters))])))))))))) (def: (namespaced namespace class alias member) @@ -409,8 +409,8 @@ {.#Item head tail} (list#mix (.function (_ sub super) (` (<get> (~ (code.text sub)) - (.:as (..Object .Any) - (~ super))))) + (.as (..Object .Any) + (~ super))))) (` (<import> (~ (code.text head)))) tail) @@ -427,7 +427,7 @@ (~ (..output_type :output:)) (.exec (~+ import!) - (.:expected + (.as_expected (~ (<| (lux_optional :output:) (` (<constant> (~ (code.text (..host_path (the #name it)))))))))))))) @@ -455,12 +455,12 @@ (~ (|> :output: ..output_type (..input_type input))))) - (.:expected + (.as_expected (~ (<| (..input_term input) (..lux_optional :output:) (` (<new> (~ (for @.js (` (<constant> (~ (code.text (..host_path class_name))))) - @.python (` (.:as ..Function - (~ (..imported class_name)))))) + @.python (` (.as ..Function + (~ (..imported class_name)))))) [(~+ (list#each ..host_optional g!parameters))])))))))))) (def: (static_field_definition import! [class_name class_parameters] alias namespace it) @@ -475,12 +475,12 @@ (.# (~! meta.monad) (~' in) (.list (`' (.exec (~+ import!) - (.:as (~ (..output_type :field:)) - (~ (<| (lux_optional :field:) - (for @.js (` (<constant> (~ (code.text (%.format (..host_path class_name) "." field))))) - @.ruby (` (<constant> (~ (code.text (%.format (..host_path class_name) "::" field))))) - (` (<get> (~ (code.text field)) - (~ (..imported class_name)))))))))))))))) + (.as (~ (..output_type :field:)) + (~ (<| (lux_optional :field:) + (for @.js (` (<constant> (~ (code.text (%.format (..host_path class_name) "." field))))) + @.ruby (` (<constant> (~ (code.text (%.format (..host_path class_name) "::" field))))) + (` (<get> (~ (code.text field)) + (~ (..imported class_name)))))))))))))))) (def: (virtual_field_definition [class_name class_parameters] alias namespace it) (-> Declaration Alias Namespace (Named Output) Code) @@ -497,7 +497,7 @@ (.All ((~ g!it) (~+ g!variables)) (.-> (~ g!class) (~ (..output_type :field:)))) - (.:expected + (.as_expected (~ (<| (lux_optional :field:) (` (<get> (~ (code.text name)) (~ g!it)))))))))) @@ -519,8 +519,8 @@ (for @.js (` (<constant> (~ (code.text (%.format (..host_path class_name) "." method))))) @.ruby (` (<constant> (~ (code.text (%.format (..host_path class_name) "::" method))))) (` (<get> (~ (code.text method)) - (.:as (..Object .Any) - (~ (..imported class_name)))))))))) + (.as (..Object .Any) + (~ (..imported class_name)))))))))) (def: (virtual_method_definition [class_name class_parameters] alias namespace it) (-> Declaration Alias Namespace (Named Procedure) Code) @@ -544,7 +544,7 @@ (~ (|> :output: ..output_type (..input_type input))))) - (.:expected + (.as_expected (~ (<| (..input_term input) (..lux_optional :output:) (` (<do> (~ (code.text method)) @@ -559,13 +559,13 @@ (syntax: .public (import: [host_module (<>.maybe <code>.text) it ..import]) - (let [host_module_import! (: (List Code) - (case host_module - {.#Some host_module} - (list (` (<import> (~ (code.text host_module))))) + (let [host_module_import! (is (List Code) + (case host_module + {.#Some host_module} + (list (` (<import> (~ (code.text host_module))))) - {.#None} - (list)))] + {.#None} + (list)))] (case it {#Global it} (in (list (..global_definition host_module_import! it))) @@ -608,12 +608,12 @@ (<code>.tuple (<>.some (<>.and <code>.any <code>.any))))) type <code>.any term <code>.any]) - (in (list (` (.<| (.:as ..Function) + (in (list (` (.<| (.as ..Function) (<function> (~ (code.nat (list.size inputs)))) - (.:as (.-> [(~+ (list.repeated (list.size inputs) (` .Any)))] - .Any)) - (.: (.-> [(~+ (list#each product.right inputs))] - (~ type))) + (.as (.-> [(~+ (list.repeated (list.size inputs) (` .Any)))] + .Any)) + (.is (.-> [(~+ (list#each product.right inputs))] + (~ type))) (.function ((~ (code.local_symbol self)) [(~+ (list#each product.left inputs))]) (~ term)))))))) @@ -626,24 +626,24 @@ (let [global (` ("js constant" (~ (code.text head))))] (case tail {.#End} - (in (list (` (: (.Maybe (~ type)) - (case (..type_of (~ global)) - "undefined" - {.#None} + (in (list (` (is (.Maybe (~ type)) + (case (..type_of (~ global)) + "undefined" + {.#None} - (~ g!_) - {.#Some (:as (~ type) (~ global))}))))) + (~ g!_) + {.#Some (as (~ type) (~ global))}))))) {.#Item [next tail]} (let [separator "."] - (in (list (` (: (.Maybe (~ type)) - (case (..type_of (~ global)) - "undefined" - {.#None} + (in (list (` (is (.Maybe (~ type)) + (case (..type_of (~ global)) + "undefined" + {.#None} - (~ g!_) - (..global (~ type) [(~ (code.local_symbol (%.format head "." next))) - (~+ (list#each code.local_symbol tail))]))))))))))) + (~ g!_) + (..global (~ type) [(~ (code.local_symbol (%.format head "." next))) + (~+ (list#each code.local_symbol tail))]))))))))))) (template: (!defined? <global>) [(.case (..global Any <global>) @@ -667,7 +667,7 @@ (|> (..global (Object Any) [process]) (maybe#each (|>> [] ("js apply" ("js constant" "Object.prototype.toString.call")) - (:as Text) + (as Text) (text#= "[object process]"))) (maybe.else false))) ) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 2cd19ade0..697177697 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" :as type} + [lux {"-" as type} ["[0]" type ("[1]#[0]" equivalence)] [abstract ["[0]" monad {"+" Monad do}] @@ -65,10 +65,10 @@ (template [<forward> <from> <to> <backward>] [(template: .public (<forward> it) - [(|> it (: <from>) (.:as (Primitive <to>)))]) + [(|> it (is <from>) (.as (Primitive <to>)))]) (template: .public (<backward> it) - [(|> it (: (Primitive <to>)) (.:as <from>))])] + [(|> it (is (Primitive <to>)) (.as <from>))])] [as_boolean .Bit "java.lang.Boolean" of_boolean] [as_long .Int "java.lang.Long" of_long] @@ -78,10 +78,10 @@ (template [<forward> <from> <$> <mid> <$'> <to> <backward>] [(template: .public (<forward> it) - [(|> it (: <from>) (.:as (Primitive <mid>)) <$> (: (Primitive <to>)))]) + [(|> it (is <from>) (.as (Primitive <mid>)) <$> (is (Primitive <to>)))]) (template: .public (<backward> it) - [(|> it (: (Primitive <to>)) <$'> (: (Primitive <mid>)) (.:as <from>))])] + [(|> it (is (Primitive <to>)) <$'> (is (Primitive <mid>)) (.as <from>))])] [as_byte .Int ..long_to_byte "java.lang.Long" ..byte_to_long "java.lang.Byte" of_byte] [as_short .Int ..long_to_short "java.lang.Long" ..short_to_long "java.lang.Short" of_short] @@ -380,14 +380,14 @@ (def: (class_decl_type$ (open "[0]")) (-> Class_Declaration Code) - (let [=params (list#each (: (-> Type_Parameter Code) - (function (_ [pname pbounds]) - (case pbounds - {.#End} - (code.symbol ["" pname]) - - {.#Item bound1 _} - (class_type {#ManualPrM} #class_params bound1)))) + (let [=params (list#each (is (-> Type_Parameter Code) + (function (_ [pname pbounds]) + (case pbounds + {.#End} + (code.symbol ["" pname]) + + {.#Item bound1 _} + (class_type {#ManualPrM} #class_params bound1)))) #class_params)] (` (Primitive (~ (code.text (safe #class_name))) [(~+ =params)])))) @@ -457,8 +457,8 @@ (-> Text Text (Parser Code)) (do <>.monad [.let [dotted_name (format "::" field_name)] - [_ _ value] (: (Parser [Any Any Code]) - (<code>.form ($_ <>.and (<code>.this! (' :=)) (<code>.this! (code.symbol ["" dotted_name])) <code>.any)))] + [_ _ value] (is (Parser [Any Any Code]) + (<code>.form ($_ <>.and (<code>.this! (' :=)) (<code>.this! (code.symbol ["" dotted_name])) <code>.any)))] (in (`' ((~ (code.text (format "jvm putfield" ":" class_name ":" field_name))) _jvm_this (~ value)))))) (def: (pre_walk_replace f input) @@ -497,10 +497,10 @@ (def: (constructor_parser params class_name arg_decls) (-> (List Type_Parameter) Text (List ArgDecl) (Parser Code)) (do <>.monad - [args (: (Parser (List Code)) - (<code>.form (<>.after (<code>.this! (' ::new!)) - (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))))) - .let [arg_decls' (: (List Text) (list#each (|>> product.right (simple_class$ params)) arg_decls))]] + [args (is (Parser (List Code)) + (<code>.form (<>.after (<code>.this! (' ::new!)) + (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))))) + .let [arg_decls' (is (List Text) (list#each (|>> product.right (simple_class$ params)) arg_decls))]] (in (` ((~ (code.text (format "jvm new" ":" class_name ":" (text.interposed "," arg_decls')))) (~+ args)))))) @@ -508,10 +508,10 @@ (-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code)) (do <>.monad [.let [dotted_name (format "::" method_name "!")] - args (: (Parser (List Code)) - (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) - (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))))) - .let [arg_decls' (: (List Text) (list#each (|>> product.right (simple_class$ params)) arg_decls))]] + args (is (Parser (List Code)) + (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) + (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))))) + .let [arg_decls' (is (List Text) (list#each (|>> product.right (simple_class$ params)) arg_decls))]] (in (`' ((~ (code.text (format "jvm invokestatic" ":" class_name ":" method_name ":" (text.interposed "," arg_decls')))) (~+ args)))))) @@ -520,10 +520,10 @@ (-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code)) (do <>.monad [.let [dotted_name (format "::" method_name "!")] - args (: (Parser (List Code)) - (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) - (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))))) - .let [arg_decls' (: (List Text) (list#each (|>> product.right (simple_class$ params)) arg_decls))]] + args (is (Parser (List Code)) + (<code>.form (<>.after (<code>.this! (code.symbol ["" dotted_name])) + (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))))) + .let [arg_decls' (is (List Text) (list#each (|>> product.right (simple_class$ params)) arg_decls))]] (in (`' ((~ (code.text (format <jvm_op> ":" class_name ":" method_name ":" (text.interposed "," arg_decls')))) (~' _jvm_this) (~+ args))))))] @@ -933,9 +933,9 @@ #import_member_io? io?] []]}))) (<code>.form (do <>.monad - [kind (: (Parser ImportMethodKind) - (<>.or (<code>.this! (' "static")) - (in []))) + [kind (is (Parser ImportMethodKind) + (<>.or (<code>.this! (' "static")) + (in []))) tvars ..type_params^ name <code>.local_symbol ?alias import_member_alias^ @@ -1128,8 +1128,8 @@ (let [super_replacer (parser_replacer (<code>.form (do <>.monad [_ (<code>.this! (' ::super!)) args (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any)) - .let [arg_decls' (: (List Text) (list#each (|>> product.right (simple_class$ (list))) - arg_decls))]] + .let [arg_decls' (is (List Text) (list#each (|>> product.right (simple_class$ (list))) + arg_decls))]] (in (`' ((~ (code.text (format "jvm invokespecial" ":" (the #super_class_name super_class) ":" name @@ -1284,19 +1284,19 @@ class_type (` (.Primitive (~ (code.text class_name)))) check_type (` (.Maybe (~ class_type))) check_code (` (if ((~ (code.text (format "jvm instanceof" ":" class_name))) (~ g!unchecked)) - {.#Some (.:as (~ class_type) - (~ g!unchecked))} + {.#Some (.as (~ class_type) + (~ g!unchecked))} {.#None}))] (case unchecked {.#Some unchecked} - (in (list (` (: (~ check_type) - (let [(~ g!unchecked) (~ unchecked)] - (~ check_code)))))) + (in (list (` (is (~ check_type) + (let [(~ g!unchecked) (~ unchecked)] + (~ check_code)))))) {.#None} - (in (list (` (: (-> (Primitive "java.lang.Object") (~ check_type)) - (function ((~ g!_) (~ g!unchecked)) - (~ check_code)))))) + (in (list (` (is (-> (Primitive "java.lang.Object") (~ check_type)) + (function ((~ g!_) (~ g!unchecked)) + (~ check_code)))))) )))) (syntax: .public (synchronized [lock <code>.any @@ -1344,20 +1344,20 @@ (let [(open "[0]") commons] (do [! meta.monad] [arg_inputs (monad.each ! - (: (-> [Bit GenericType] (Meta [Bit Code])) - (function (_ [maybe? _]) - (with_symbols [arg_name] - (in [maybe? arg_name])))) + (is (-> [Bit GenericType] (Meta [Bit Code])) + (function (_ [maybe? _]) + (with_symbols [arg_name] + (in [maybe? arg_name])))) #import_member_args) - .let [arg_classes (: (List Text) - (list#each (|>> product.right (simple_class$ (list#composite type_params #import_member_tvars))) - #import_member_args)) - arg_types (list#each (: (-> [Bit GenericType] Code) - (function (_ [maybe? arg]) - (let [arg_type (class_type (the #import_member_mode commons) type_params arg)] - (if maybe? - (` (Maybe (~ arg_type))) - arg_type)))) + .let [arg_classes (is (List Text) + (list#each (|>> product.right (simple_class$ (list#composite type_params #import_member_tvars))) + #import_member_args)) + arg_types (list#each (is (-> [Bit GenericType] Code) + (function (_ [maybe? arg]) + (let [arg_type (class_type (the #import_member_mode commons) type_params arg)] + (if maybe? + (` (Maybe (~ arg_type))) + arg_type)))) #import_member_args)]] (in [arg_inputs arg_classes arg_types]))) @@ -1372,8 +1372,8 @@ (` (??? (~ return_term))) (let [g!temp (` ((~' ~') (~ (code.symbol ["" " Ω "]))))] (` (let [(~ g!temp) (~ return_term)] - (if (not (..null? (.:as (Primitive "java.lang.Object") - (~ g!temp)))) + (if (not (..null? (.as (Primitive "java.lang.Object") + (~ g!temp)))) (~ g!temp) (panic! (~ (code.text (format "Cannot produce null references from method calls @ " (the #class_name class) @@ -1459,22 +1459,22 @@ {#EnumDecl enum_members} (macro.with_symbols [g!_] (do [! meta.monad] - [.let [enum_type (: Code - (case class_tvars - {.#End} - (` (Primitive (~ (code.text full_name)))) - - _ - (let [=class_tvars (|> class_tvars - (list.only free_type_param?) - (list#each lux_type_parameter))] - (` (All ((~ g!_) (~+ =class_tvars)) (Primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) - getter_interop (: (-> Text Code) - (function (_ name) - (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])] - (` (def: (~ getter_name) - (~ enum_type) - ((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]] + [.let [enum_type (is Code + (case class_tvars + {.#End} + (` (Primitive (~ (code.text full_name)))) + + _ + (let [=class_tvars (|> class_tvars + (list.only free_type_param?) + (list#each lux_type_parameter))] + (` (All ((~ g!_) (~+ =class_tvars)) (Primitive (~ (code.text full_name)) [(~+ =class_tvars)])))))) + getter_interop (is (-> Text Code) + (function (_ name) + (let [getter_name (code.symbol ["" (..import_name import_format method_prefix name)])] + (` (def: (~ getter_name) + (~ enum_type) + ((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]] (in (list#each getter_interop enum_members)))) {#ConstructorDecl [commons _]} @@ -1495,22 +1495,22 @@ [.let [def_name (code.symbol ["" (..import_name import_format method_prefix (the #import_member_alias commons))]) (open "[0]") commons (open "[0]") method - [jvm_op object_ast] (: [Text (List Code)] - (case #import_member_kind - {#StaticIMK} - ["invokestatic" - (list)] - - {#VirtualIMK} - (case kind - {#Class} - ["invokevirtual" - (list g!obj)] - - {#Interface} - ["invokeinterface" - (list g!obj)] - ))) + [jvm_op object_ast] (is [Text (List Code)] + (case #import_member_kind + {#StaticIMK} + ["invokestatic" + (list)] + + {#VirtualIMK} + (case kind + {#Class} + ["invokevirtual" + (list g!obj)] + + {#Interface} + ["invokeinterface" + (list g!obj)] + ))) jvm_extension (code.text (format "jvm " jvm_op ":" full_name ":" #import_method_name ":" (text.interposed "," arg_classes))) jvm_interop (|> [(simple_class$ (list) (the #import_method_return method)) (` ((~ jvm_extension) (~+ (list#each un_quote object_ast)) @@ -1531,10 +1531,10 @@ typeC (if #import_field_maybe? (` (Maybe (~ base_gtype))) base_gtype) - tvar_asts (: (List Code) - (|> class_tvars - (list.only free_type_param?) - (list#each lux_type_parameter))) + tvar_asts (is (List Code) + (|> class_tvars + (list.only free_type_param?) + (list#each lux_type_parameter))) getter_name (code.symbol ["" (..import_name import_format method_prefix #import_field_name)]) setter_name (code.symbol ["" (..import_name import_format method_prefix (format #import_field_name "!"))])] getter_interop (with_symbols [g!obj] @@ -1556,27 +1556,27 @@ getter_body)] (in (` ((~! syntax:) (~ getter_call) ((~' in) (.list (.` (~ getter_body))))))))) - setter_interop (: (Meta (List Code)) - (if #import_field_setter? - (with_symbols [g!obj g!value] - (let [setter_call (if #import_field_static? - (` ((~ setter_name) [(~ g!value) (~! <code>.any)])) - (` ((~ setter_name) [(~ g!value) (~! <code>.any) - (~ g!obj) (~! <code>.any)]))) - setter_value (auto_convert_input #import_field_mode - [(simple_class$ (list) #import_field_type) (un_quote g!value)]) - setter_value (if #import_field_maybe? - (` ((~! !!!) (~ setter_value))) - setter_value) - setter_command (format (if #import_field_static? "jvm putstatic" "jvm putfield") - ":" full_name ":" #import_field_name) - g!obj+ (: (List Code) - (if #import_field_static? - (list) - (list (un_quote g!obj))))] - (in (list (` ((~! syntax:) (~ setter_call) - ((~' in) (.list (.` ((~! io.io) ((~ (code.text setter_command)) (~+ g!obj+) (~ setter_value)))))))))))) - (in (list))))] + setter_interop (is (Meta (List Code)) + (if #import_field_setter? + (with_symbols [g!obj g!value] + (let [setter_call (if #import_field_static? + (` ((~ setter_name) [(~ g!value) (~! <code>.any)])) + (` ((~ setter_name) [(~ g!value) (~! <code>.any) + (~ g!obj) (~! <code>.any)]))) + setter_value (auto_convert_input #import_field_mode + [(simple_class$ (list) #import_field_type) (un_quote g!value)]) + setter_value (if #import_field_maybe? + (` ((~! !!!) (~ setter_value))) + setter_value) + setter_command (format (if #import_field_static? "jvm putstatic" "jvm putfield") + ":" full_name ":" #import_field_name) + g!obj+ (is (List Code) + (if #import_field_static? + (list) + (list (un_quote g!obj))))] + (in (list (` ((~! syntax:) (~ setter_call) + ((~' in) (.list (.` ((~! io.io) ((~ (code.text setter_command)) (~+ g!obj+) (~ setter_value)))))))))))) + (in (list))))] (in (list& getter_interop setter_interop))) ))) @@ -1727,5 +1727,5 @@ (syntax: .public (type [type (..generic_type^ (list))]) (in (list (..class_type {#ManualPrM} (list) type)))) -(template: .public (:as type term) - [(.:as type term)]) +(template: .public (as type term) + [(.as type term)]) diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index cfcfec9f8..cb2c6a615 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -1,27 +1,27 @@ (.using - [library - [lux {"-" Alias} - ["@" target] - ["[0]" meta] - [abstract - [monad {"+" do}]] - [control - ["[0]" io] - ["[0]" maybe] - ["<>" parser ("[1]#[0]" monad) - ["<[0]>" code {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [type - abstract] - [macro {"+" with_symbols} - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]]) + [library + [lux {"-" Alias} + ["@" target] + ["[0]" meta] + [abstract + [monad {"+" do}]] + [control + ["[0]" io] + ["[0]" maybe] + ["<>" parser ("[1]#[0]" monad) + ["<[0]>" code {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [type + abstract] + [macro {"+" with_symbols} + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]]) (abstract: .public (Object brand) Any) @@ -228,12 +228,12 @@ (~ (|> (nullable_type outputT) (try_type try?) (io_type io?)))) - (:expected + (as_expected (~ (<| (with_io io?) (with_try try?) (without_null g!temp outputT) (` ("php apply" - (:as ..Function (~ source)) + (as ..Function (~ source)) (~+ (list#each (with_null g!temp) g!inputs))))))))))) (syntax: .public (import: [import ..import]) @@ -241,12 +241,12 @@ (case import {#Class [class alias format members]} (with_symbols [g!object] - (let [qualify (: (-> Text Code) - (function (_ member_name) - (|> format - (text.replaced "[1]" (maybe.else class alias)) - (text.replaced "[0]" member_name) - code.local_symbol))) + (let [qualify (is (-> Text Code) + (function (_ member_name) + (|> format + (text.replaced "[1]" (maybe.else class alias)) + (text.replaced "[0]" member_name) + code.local_symbol))) g!type (code.local_symbol (maybe.else class alias)) class_import (` ("php constant" (~ (code.text class))))] (in (list& (` (type: (~ g!type) @@ -257,15 +257,15 @@ (if static? (` ((~! syntax:) ((~ (qualify (maybe.else field alias))) []) (# (~! meta.monad) (~' in) - (list (` (.:as (~ (nullable_type fieldT)) - ("php constant" (~ (code.text (%.format class "::" field)))))))))) + (list (` (.as (~ (nullable_type fieldT)) + ("php constant" (~ (code.text (%.format class "::" field)))))))))) (` (def: ((~ (qualify field)) (~ g!object)) (-> (~ g!type) (~ (nullable_type fieldT))) - (:expected + (as_expected (~ (without_null g!temp fieldT (` ("php object get" (~ (code.text field)) - (:as (..Object .Any) (~ g!object)))))))))) + (as (..Object .Any) (~ g!object)))))))))) {#Method method} (case method @@ -273,8 +273,8 @@ (..make_function (qualify (maybe.else method alias)) g!temp (` ("php object get" (~ (code.text method)) - (:as (..Object .Any) - ("php constant" (~ (code.text (%.format class "::" method))))))) + (as (..Object .Any) + ("php constant" (~ (code.text (%.format class "::" method))))))) inputsT io? try? @@ -290,7 +290,7 @@ (~ (|> (nullable_type outputT) (try_type try?) (io_type io?)))) - (:expected + (as_expected (~ (<| (with_io io?) (with_try try?) (without_null g!temp outputT) @@ -314,5 +314,5 @@ (let [imported (` ("php constant" (~ (code.text name))))] (in (list (` ((~! syntax:) ((~ (code.local_symbol (maybe.else name alias))) []) (# (~! meta.monad) (~' in) - (list (` (.:as (~ (nullable_type fieldT)) (~ imported)))))))))) + (list (` (.as (~ (nullable_type fieldT)) (~ imported)))))))))) ))) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 8beef44d5..93fe11d15 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -1,27 +1,27 @@ (.using - [library - [lux {"-" Alias} - ["@" target] - ["[0]" meta] - [abstract - [monad {"+" do}]] - [control - ["[0]" io] - ["[0]" maybe] - ["<>" parser ("[1]#[0]" monad) - ["<[0]>" code {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [type - abstract] - [macro {"+" with_symbols} - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]]]]) + [library + [lux {"-" Alias} + ["@" target] + ["[0]" meta] + [abstract + [monad {"+" do}]] + [control + ["[0]" io] + ["[0]" maybe] + ["<>" parser ("[1]#[0]" monad) + ["<[0]>" code {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [type + abstract] + [macro {"+" with_symbols} + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]]]]) (abstract: .public (Object brand) Any) @@ -193,12 +193,12 @@ (~ (|> (nilable_type outputT) (try_type try?) (io_type io?)))) - (:expected + (as_expected (~ (<| (with_io io?) (with_try try?) (without_nil g!temp outputT) (` ("scheme apply" - (:as ..Function (~ source)) + (as ..Function (~ source)) (~+ (list#each (with_nil g!temp) g!inputs))))))))))) (syntax: .public (import: [import ..import]) @@ -218,5 +218,5 @@ (let [imported (` ("scheme constant" (~ (code.text name))))] (in (list (` ((~! syntax:) ((~ (code.local_symbol (maybe.else name alias)))) (# (~! meta.monad) (~' in) - (list (` (.:as (~ (nilable_type fieldT)) (~ imported)))))))))) + (list (` (.as (~ (nilable_type fieldT)) (~ imported)))))))))) ))) diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux index 7473ae233..3368f1671 100644 --- a/stdlib/source/library/lux/ffi/export.jvm.lux +++ b/stdlib/source/library/lux/ffi/export.jvm.lux @@ -66,15 +66,15 @@ (syntax: .public (export: [api <code>.local_symbol exports (<>.many ..export)]) - (let [initialization (: (List (API Constant)) - (list.all (.function (_ it) - (case it - {#Constant it} - {.#Some it} - - _ - {.#None})) - exports))] + (let [initialization (is (List (API Constant)) + (list.all (.function (_ it) + (case it + {#Constant it} + {.#Some it} + + _ + {.#None})) + exports))] (in (list (` (//.class: "final" (~ (code.local_symbol api)) (~+ (list#each (.function (_ it) (case it diff --git a/stdlib/source/library/lux/locale.lux b/stdlib/source/library/lux/locale.lux index 89d77b0e7..59b9e26e6 100644 --- a/stdlib/source/library/lux/locale.lux +++ b/stdlib/source/library/lux/locale.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}] - ["[0]" hash {"+" Hash}]] - [control - ["[0]" maybe ("[1]#[0]" functor)]] - [data - ["[0]" text - ["%" format {"+" format}] - ["[0]" encoding {"+" Encoding}]]] - [type - abstract]]] - [/ - ["[0]" language {"+" Language}] - ["[0]" territory {"+" Territory}]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}] + ["[0]" hash {"+" Hash}]] + [control + ["[0]" maybe ("[1]#[0]" functor)]] + [data + ["[0]" text + ["%" format {"+" format}] + ["[0]" encoding {"+" Encoding}]]] + [type + [abstract {"-" pattern}]]]] + [/ + ["[0]" language {"+" Language}] + ["[0]" territory {"+" Territory}]]) (abstract: .public Locale Text @@ -24,17 +24,17 @@ (def: .public (locale language territory encoding) (-> Language (Maybe Territory) (Maybe Encoding) Locale) - (:abstraction (format (language.code language) - (|> territory - (maybe#each (|>> territory.long_code (format ..territory_separator))) - (maybe.else "")) - (|> encoding - (maybe#each (|>> encoding.name (format ..encoding_separator))) - (maybe.else ""))))) + (abstraction (format (language.code language) + (|> territory + (maybe#each (|>> territory.long_code (format ..territory_separator))) + (maybe.else "")) + (|> encoding + (maybe#each (|>> encoding.name (format ..encoding_separator))) + (maybe.else ""))))) (def: .public code (-> Locale Text) - (|>> :representation)) + (|>> representation)) (def: .public hash (Hash Locale) diff --git a/stdlib/source/library/lux/locale/language.lux b/stdlib/source/library/lux/locale/language.lux index 50604e065..3685740da 100644 --- a/stdlib/source/library/lux/locale/language.lux +++ b/stdlib/source/library/lux/locale/language.lux @@ -7,7 +7,7 @@ [data ["[0]" text]] [type - abstract] + [abstract {"-" pattern}]] [macro ["[0]" template]]]]) @@ -20,7 +20,7 @@ (template [<name> <tag>] [(def: .public <name> (-> Language Text) - (|>> :representation (the <tag>)))] + (|>> representation (the <tag>)))] [name #name] [code #code] @@ -31,8 +31,8 @@ (template [<code> <name> <definition> <alias>+] [(def: .public <definition> Language - (:abstraction [#name <name> - #code <code>])) + (abstraction [#name <name> + #code <code>])) (`` (template [<alias>] [(def: .public <alias> Language diff --git a/stdlib/source/library/lux/locale/territory.lux b/stdlib/source/library/lux/locale/territory.lux index 8df6f861d..dcbf207e7 100644 --- a/stdlib/source/library/lux/locale/territory.lux +++ b/stdlib/source/library/lux/locale/territory.lux @@ -7,7 +7,7 @@ [data ["[0]" text]] [type - abstract] + [abstract {"-" pattern}]] [macro ["[0]" template]]]]) @@ -22,7 +22,7 @@ (template [<name> <field> <type>] [(def: .public <name> (-> Territory <type>) - (|>> :representation + (|>> representation (the <field>)))] [name #name Text] @@ -34,10 +34,10 @@ (template [<short> <long> <number> <name> <main> <neighbor>+] [(def: .public <main> Territory - (:abstraction [#name <name> - #short <short> - #long <long> - #code <number>])) + (abstraction [#name <name> + #short <short> + #long <long> + #code <number>])) (`` (template [<neighbor>] [(def: .public <neighbor> Territory <main>)] @@ -307,7 +307,7 @@ (def: &equivalence ..equivalence) (def: hash - (|>> :representation + (|>> representation (the #long) (# text.hash hash)))) ) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index 60df4a57f..eb8fd2531 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -26,7 +26,7 @@ [?macro (//.macro name)] (case ?macro {.#Some macro} - ((:as Macro' macro) args) + ((as Macro' macro) args) {.#None} (# //.monad in (list syntax)))) @@ -43,7 +43,7 @@ (case ?macro {.#Some macro} (do [! //.monad] - [top_level_expansion ((:as Macro' macro) args)] + [top_level_expansion ((as Macro' macro) args)] (|> top_level_expansion (monad.each //.monad expansion) (# ! each list#conjoint))) @@ -63,7 +63,7 @@ (case ?macro {.#Some macro} (do //.monad - [expansion ((:as Macro' macro) args) + [expansion ((as Macro' macro) args) expansion' (monad.each //.monad full_expansion expansion)] (in (list#conjoint expansion'))) @@ -76,7 +76,7 @@ (do //.monad [harg+ (full_expansion harg) targs+ (monad.each //.monad full_expansion targs)] - (in (list (code.form (list#composite harg+ (list#conjoint (: (List (List Code)) targs+))))))) + (in (list (code.form (list#composite harg+ (list#conjoint (is (List (List Code)) targs+))))))) [_ {.#Variant members}] (do //.monad @@ -120,8 +120,8 @@ (pattern (list [_ {.#Tuple symbols}] body)) (do [! //.monad] [symbol_names (monad.each ! ..local_symbol symbols) - .let [symbol_defs (list#conjoint (list#each (: (-> Text (List Code)) - (function (_ name) (list (code.symbol ["" name]) (` (..symbol (~ (code.text name))))))) + .let [symbol_defs (list#conjoint (list#each (is (-> Text (List Code)) + (function (_ name) (list (code.symbol ["" name]) (` (..symbol (~ (code.text name))))))) symbol_names))]] (in (list (` ((~! do) (~! //.monad) [(~+ symbol_defs)] @@ -146,17 +146,17 @@ (let [[module _] (.symbol .._) [_ short] (.symbol <macro>) macro_name [module short]] - (case (: (Maybe [Bit Code]) - (case tokens - (pattern (list [_ {.#Text "omit"}] - token)) - {.#Some [#1 token]} + (case (is (Maybe [Bit Code]) + (case tokens + (pattern (list [_ {.#Text "omit"}] + token)) + {.#Some [#1 token]} - (pattern (list token)) - {.#Some [#0 token]} + (pattern (list token)) + {.#Some [#0 token]} - _ - {.#None})) + _ + {.#None})) {.#Some [omit? token]} (do //.monad [location //.location diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index 0e9bd029b..f1060fed1 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -52,9 +52,9 @@ (-> [Symbol Macro] (Meta Any)) (do meta.monad [[module_name definition_name] (meta.normal name) - .let [definition (: Global {.#Definition [false .Macro macro]}) - add_macro! (: (-> (PList Global) (PList Global)) - (plist.has definition_name definition))]] + .let [definition (is Global {.#Definition [false .Macro macro]}) + add_macro! (is (-> (PList Global) (PList Global)) + (plist.has definition_name definition))]] (..with_module module_name (function (_ module) (case (|> module (the .#definitions) (plist.value definition_name)) @@ -69,8 +69,8 @@ (-> Symbol (Meta Any)) (do meta.monad [[module_name definition_name] (meta.normal name) - .let [lacks_macro! (: (-> (PList Global) (PList Global)) - (plist.lacks definition_name))]] + .let [lacks_macro! (is (-> (PList Global) (PList Global)) + (plist.lacks definition_name))]] (..with_module module_name (function (_ module) (case (|> module (the .#definitions) (plist.value definition_name)) @@ -102,7 +102,7 @@ [_ (monad.each meta.monad ..push_one macros) seed meta.seed g!pop (//.symbol "pop") - _ (let [g!pop (: Symbol - ["" (//code.format g!pop)])] + _ (let [g!pop (is Symbol + ["" (//code.format g!pop)])] (..push_one [g!pop (..pop_all (list#each product.left macros) g!pop)]))] (in (` ((~ g!pop)))))) diff --git a/stdlib/source/library/lux/macro/pattern.lux b/stdlib/source/library/lux/macro/pattern.lux index b789e1f19..1b237996e 100644 --- a/stdlib/source/library/lux/macro/pattern.lux +++ b/stdlib/source/library/lux/macro/pattern.lux @@ -89,20 +89,20 @@ [_ {.#Tuple templates}])}] [_ {.#Form data}] branches)) - (case (: (Maybe (List Code)) - (do maybe_monad - [bindings' (monad#each maybe_monad symbol_short bindings) - data' (monad#each maybe_monad tuple_list data)] - (.let [num_bindings (list#size bindings')] - (if (every? (|>> ("lux i64 =" num_bindings)) - (list#each list#size data')) - (.let [apply (: (-> Replacement_Environment (List Code)) - (function (_ env) (list#each (realized_template env) templates)))] - (.|> data' - (list#each (function#composite apply (replacement_environment bindings'))) - list#conjoint - in)) - {.#None})))) + (case (is (Maybe (List Code)) + (do maybe_monad + [bindings' (monad#each maybe_monad symbol_short bindings) + data' (monad#each maybe_monad tuple_list data)] + (.let [num_bindings (list#size bindings')] + (if (every? (|>> ("lux i64 =" num_bindings)) + (list#each list#size data')) + (.let [apply (is (-> Replacement_Environment (List Code)) + (function (_ env) (list#each (realized_template env) templates)))] + (.|> data' + (list#each (function#composite apply (replacement_environment bindings'))) + list#conjoint + in)) + {.#None})))) {.#Some output} (meta#in (list#composite output branches)) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 46fb3b98d..8530307be 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -1,29 +1,29 @@ (.using - [library - [lux "*" - ["[0]" macro {"+" with_symbols}] - ["[0]" meta] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" maybe] - ["[0]" try] - ["<>" parser - ["</>" code {"+" Parser}]]] - [data - ["[0]" text ("[1]#[0]" monoid)] - [collection - ["[0]" list]]] - [math - [number - ["[0]" nat] - ["[0]" int] - ["[0]" rev] - ["[0]" frac]]]]] - [// - ["[0]" code]] - ["[0]" / "_" - ["[1][0]" export]]) + [library + [lux "*" + ["[0]" macro {"+" with_symbols}] + ["[0]" meta] + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" maybe] + ["[0]" try] + ["<>" parser + ["</>" code {"+" Parser}]]] + [data + ["[0]" text ("[1]#[0]" monoid)] + [collection + ["[0]" list]]] + [math + [number + ["[0]" nat] + ["[0]" int] + ["[0]" rev] + ["[0]" frac]]]]] + [// + ["[0]" code]] + ["[0]" / "_" + ["[1][0]" export]]) (def: (self_documenting binding parser) (All (_ a) (-> Code (Parser a) (Parser a))) @@ -60,20 +60,20 @@ [vars+parsers (case (list.pairs args) {.#Some args} (monad.each ! - (: (-> [Code Code] (Meta [Code Code])) - (function (_ [var parser]) - (with_expansions [<default> (in [var - (` ((~! ..self_documenting) (' (~ var)) - (~ parser)))])] - (case var - [_ {.#Symbol ["" _]}] - <default> + (is (-> [Code Code] (Meta [Code Code])) + (function (_ [var parser]) + (with_expansions [<default> (in [var + (` ((~! ..self_documenting) (' (~ var)) + (~ parser)))])] + (case var + [_ {.#Symbol ["" _]}] + <default> - [_ {.#Symbol _}] - (in [var parser]) + [_ {.#Symbol _}] + (in [var parser]) - _ - <default>)))) + _ + <default>)))) args) _ @@ -83,10 +83,10 @@ error_msg (code.text (macro.wrong_syntax_error [this_module name]))]] (in (list (` (.macro: (~ export_policy) ((~ (code.symbol ["" name])) (~ g!tokens) (~ g!state)) (.case ((~! </>.result) - (: ((~! </>.Parser) (Meta (List Code))) - ((~! do) (~! <>.monad) - [(~+ (..un_paired vars+parsers))] - ((~' in) (~ body)))) + (is ((~! </>.Parser) (Meta (List Code))) + ((~! do) (~! <>.monad) + [(~+ (..un_paired vars+parsers))] + ((~' in) (~ body)))) (~ g!tokens)) {try.#Success (~ g!body)} ((~ g!body) (~ g!state)) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index 247c752c7..d2260f584 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -136,9 +136,9 @@ (.let [parameters_amount (list.size _#parameters) inputs_amount (list.size inputs)] (if (nat.= parameters_amount inputs_amount) - (.let [environment (: Environment - (|> (list.zipped/2 _#parameters inputs) - (dictionary.of_list text.hash)))] + (.let [environment (is Environment + (|> (list.zipped/2 _#parameters inputs) + (dictionary.of_list text.hash)))] {.#Right [compiler (list#each (..applied environment) _#template)]}) (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) @@ -156,14 +156,14 @@ body <code>.any]) (do meta.monad [here_name meta.current_module_name - expression? (: (Meta Bit) - (function (_ lux) - {try.#Success [lux (case (the .#expected lux) - {.#None} - false - - {.#Some _} - true)]})) + expression? (is (Meta Bit) + (function (_ lux) + {try.#Success [lux (case (the .#expected lux) + {.#None} + false + + {.#Some _} + true)]})) g!pop (local.push (list#each (function (_ local) [[here_name (the #name local)] (..macro local)]) diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index f556c1404..8f4ef73a8 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -23,7 +23,7 @@ [number ["i" int ("[1]#[0]" decimal)]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // "_" ["[1]" modulus {"+" Modulus}]]) @@ -34,13 +34,13 @@ (def: .public (modular modulus value) (All (_ %) (-> (Modulus %) Int (Mod %))) - (:abstraction [#modulus modulus - #value (i.mod (//.divisor modulus) value)])) + (abstraction [#modulus modulus + #value (i.mod (//.divisor modulus) value)])) (template [<name> <type> <side>] [(def: .public <name> (All (_ %) (-> (Mod %) <type>)) - (|>> :representation <side>))] + (|>> representation <side>))] [modulus (Modulus %) product.left] [value Int product.right] @@ -64,7 +64,7 @@ (All (_ %) (-> (Modulus %) (Codec Text (Mod %)))) (def: (encoded modular) - (let [[_ value] (:representation modular)] + (let [[_ value] (representation modular)] ($_ text#composite (i#encoded value) ..separator @@ -81,8 +81,8 @@ (template [<name> <op>] [(def: .public (<name> reference subject) (All (_ %) (-> (Mod %) (Mod %) Bit)) - (let [[_ reference] (:representation reference) - [_ subject] (:representation subject)] + (let [[_ reference] (representation reference) + [_ subject] (representation subject)] (<op> reference subject)))] [= i.=] @@ -106,12 +106,12 @@ (template [<name> <op>] [(def: .public (<name> param subject) (All (_ %) (-> (Mod %) (Mod %) (Mod %))) - (let [[modulus param] (:representation param) - [_ subject] (:representation subject)] - (:abstraction [#modulus modulus - #value (|> subject - (<op> param) - (i.mod (//.divisor modulus)))])))] + (let [[modulus param] (representation param) + [_ subject] (representation subject)] + (abstraction [#modulus modulus + #value (|> subject + (<op> param) + (i.mod (//.divisor modulus)))])))] [+ i.+] [- i.-] @@ -133,7 +133,7 @@ (def: .public (inverse modular) (All (_ %) (-> (Mod %) (Maybe (Mod %)))) - (let [[modulus value] (:representation modular) + (let [[modulus value] (representation modular) [[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))] (case gcd +1 {.#Some (..modular modulus vk)} diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index 4a8daaa97..6a08451e1 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["[0]" meta] - [abstract - [monad {"+" do}]] - [control - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - [parser - ["<[0]>" code]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["i" int]]] - [type - abstract]]]) + [library + [lux "*" + ["[0]" meta] + [abstract + [monad {"+" do}]] + [control + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + [parser + ["<[0]>" code]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["i" int]]] + [type + [abstract {"-" pattern}]]]]) (exception: .public zero_cannot_be_a_modulus) @@ -27,22 +27,22 @@ (Ex (_ %) (-> Int (Try (Modulus %)))) (if (i.= +0 value) (exception.except ..zero_cannot_be_a_modulus []) - {try.#Success (:abstraction value)})) + {try.#Success (abstraction value)})) (def: .public divisor (All (_ %) (-> (Modulus %) Int)) - (|>> :representation)) + (|>> representation)) (def: .public (= reference subject) (All (_ %r %s) (-> (Modulus %r) (Modulus %s) Bit)) - (i.= (:representation reference) - (:representation subject))) + (i.= (representation reference) + (representation subject))) (def: .public (congruent? modulus reference subject) (All (_ %) (-> (Modulus %) Int Int Bit)) (|> subject (i.- reference) - (i.% (:representation modulus)) + (i.% (representation modulus)) (i.= +0))) ) diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index 511b0fef9..6d81a958b 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -64,14 +64,14 @@ @.jvm (as_is (template: (!double value) [(|> value - (:as (Primitive "java.lang.Double")) + (as (Primitive "java.lang.Double")) "jvm object cast")]) (template: (!frac value) [(|> value "jvm object cast" - (: (Primitive "java.lang.Double")) - (:as Frac))]) + (is (Primitive "java.lang.Double")) + (as Frac))]) (template [<name> <method>] [(def: .public <name> @@ -111,7 +111,7 @@ (-> Frac Frac) (|>> [] ("js apply" ("js constant" <method>)) - (:as Frac)))] + (as Frac)))] [cos "Math.cos"] [sin "Math.sin"] @@ -133,7 +133,7 @@ (def: .public (pow param subject) (-> Frac Frac Frac) - (:as Frac ("js apply" ("js constant" "Math.pow") [subject param])))) + (as Frac ("js apply" ("js constant" "Math.pow") [subject param])))) @.python (as_is (template [<name> <method>] @@ -141,7 +141,7 @@ (-> Frac Frac) (|>> [] ("python object do" <method> ("python import" "math")) - (:as Frac)))] + (as Frac)))] [cos "cos"] [sin "sin"] @@ -162,7 +162,7 @@ (def: .public (pow param subject) (-> Frac Frac Frac) - (:as Frac ("python object do" "pow" ("python import" "math") [subject param]))) + (as Frac ("python object do" "pow" ("python import" "math") [subject param]))) (def: .public (root/3 it) (-> Frac Frac) @@ -180,7 +180,7 @@ (-> Frac Frac) (|>> [] ("lua apply" ("lua constant" <method>)) - (:as Frac)))] + (as Frac)))] [cos "math.cos"] [sin "math.sin"] @@ -219,7 +219,7 @@ (-> Frac Frac) (|>> [] ("ruby apply" ("ruby constant" <method>)) - (:as Frac)))] + (as Frac)))] [cos "Math.cos"] [sin "Math.sin"] @@ -240,7 +240,7 @@ [(def: .public (<name> it) (-> Frac Frac) (|> ("ruby object do" <method> it []) - (:as Int) + (as Int) ("lux i64 f64")))] [ceil "ceil"] @@ -249,14 +249,14 @@ (def: .public (pow param subject) (-> Frac Frac Frac) - (:as Frac ("ruby object do" "**" subject [param])))) + (as Frac ("ruby object do" "**" subject [param])))) @.php (as_is (template [<name> <method>] [(def: .public <name> (-> Frac Frac) (|>> ("php apply" ("php constant" <method>)) - (:as Frac)))] + (as Frac)))] [cos "cos"] [sin "sin"] @@ -277,7 +277,7 @@ (def: .public (pow param subject) (-> Frac Frac Frac) - (:as Frac ("php apply" ("php constant" "pow") subject param))) + (as Frac ("php apply" ("php constant" "pow") subject param))) (def: .public root/3 (-> Frac Frac) @@ -288,7 +288,7 @@ [(def: .public <name> (-> Frac Frac) (|>> ("scheme apply" ("scheme constant" <method>)) - (:as Frac)))] + (as Frac)))] [cos "cos"] [sin "sin"] @@ -309,7 +309,7 @@ (def: .public (pow param subject) (-> Frac Frac Frac) - (:as Frac ("scheme apply" ("scheme constant" "expt") subject param))) + (as Frac ("scheme apply" ("scheme constant" "expt") subject param))) (def: .public root/3 (-> Frac Frac) @@ -713,9 +713,9 @@ (def: .public (of_bits it) (-> I64 Frac) - (case [(: Nat (..exponent it)) - (: Nat (..mantissa it)) - (: Nat (..sign it))] + (case [(is Nat (..exponent it)) + (is Nat (..mantissa it)) + (is Nat (..sign it))] (pattern [(static ..special_exponent_bits) 0 0]) ..positive_infinity diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux index 467fa363f..06a52afa5 100644 --- a/stdlib/source/library/lux/math/number/i16.lux +++ b/stdlib/source/library/lux/math/number/i16.lux @@ -1,24 +1,32 @@ (.using - [library - [lux {"-" i64} - [abstract - [equivalence {"+" Equivalence}]] - [control - ["[0]" maybe]] - [type {"+" :by_example}]]] - [// - ["[0]" i64 {"+" Sub}]]) + [library + [lux {"-" i64} + [abstract + [equivalence {"+" Equivalence}]] + [control + ["[0]" maybe]] + [type {"+" by_example}]]] + [// + ["[0]" i64 {"+" Sub}]]) (def: sub (maybe.trusted (i64.sub 16))) (def: .public I16 Type - (:by_example [size] - (Sub size) - ..sub - - (I64 size))) + ... TODO: Switch to the cleaner approach ASAP. + (case (type_of ..sub) + {.#Apply :size: :sub:} + (type (I64 :size:)) + + _ + (undefined)) + ... (by_example [size] + ... (Sub size) + ... ..sub + + ... (I64 size)) + ) (def: .public equivalence (Equivalence I16) (# ..sub &equivalence)) (def: .public width Nat (# ..sub bits)) diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux index e8967c412..6ddbcf015 100644 --- a/stdlib/source/library/lux/math/number/i32.lux +++ b/stdlib/source/library/lux/math/number/i32.lux @@ -1,7 +1,7 @@ (.using [library [lux {"-" i64} - [type {"+" :by_example}] + [type {"+" by_example}] [abstract [equivalence {"+" Equivalence}]] [control @@ -11,16 +11,24 @@ (def: sub ... TODO: Stop needing this coercion. - (:as (Sub (I64 (Primitive "#I32"))) - (maybe.trusted (i64.sub 32)))) + (as (Sub (I64 (Primitive "#I32"))) + (maybe.trusted (i64.sub 32)))) (def: .public I32 Type - (:by_example [size] - (Sub size) - ..sub - - (I64 size))) + ... TODO: Switch to the cleaner approach ASAP. + (case (type_of ..sub) + {.#Apply :size: :sub:} + (type (I64 :size:)) + + _ + (undefined)) + ... (by_example [size] + ... (Sub size) + ... ..sub + + ... (I64 size)) + ) (def: .public equivalence (Equivalence I32) (# ..sub &equivalence)) (def: .public width Nat (# ..sub bits)) diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 281ea025e..3dcd42f8b 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -1,14 +1,14 @@ (.using - [library - [lux {"-" and or not false true} - [abstract - [equivalence {"+" Equivalence}] - [hash {"+" Hash}] - [monoid {"+" Monoid}]] - [control - ["[0]" try]]]] - [// - ["n" nat]]) + [library + [lux {"-" and or not false true} + [abstract + [equivalence {"+" Equivalence}] + [hash {"+" Hash}] + [monoid {"+" Monoid}]] + [control + ["[0]" try]]]] + [// + ["n" nat]]) (def: .public bits_per_byte 8) @@ -97,7 +97,7 @@ (def: .public (one? index input) (-> Nat (I64 Any) Bit) - (|> input (:as I64) (..and (..bit index)) (n.= 0) .not)) + (|> input .i64 (..and (..bit index)) (n.= 0) .not)) (def: .public (zero? index input) (-> Nat (I64 Any) Bit) @@ -143,27 +143,27 @@ (def: .public reversed (All (_ a) (-> (I64 a) (I64 a))) - (let [swapper (: (-> Nat (All (_ a) (-> (I64 a) (I64 a)))) - (function (_ power) - (let [size (..left_shifted power 1) - repetitions (: (-> Nat Text Text) - (function (_ times char) - (loop [iterations 1 - output char] - (if (n.< times iterations) - (again (++ iterations) - ("lux text concat" char output)) - output)))) - pattern (repetitions (n./ (n.+ size size) ..width) - ("lux text concat" - (repetitions size "1") - (repetitions size "0"))) - - high (try.trusted (# n.binary decoded pattern)) - low (..right_rotated size high)] - (function (_ value) - (..or (..right_shifted size (..and high value)) - (..left_shifted size (..and low value))))))) + (let [swapper (is (-> Nat (All (_ a) (-> (I64 a) (I64 a)))) + (function (_ power) + (let [size (..left_shifted power 1) + repetitions (is (-> Nat Text Text) + (function (_ times char) + (loop [iterations 1 + output char] + (if (n.< times iterations) + (again (++ iterations) + ("lux text concat" char output)) + output)))) + pattern (repetitions (n./ (n.+ size size) ..width) + ("lux text concat" + (repetitions size "1") + (repetitions size "0"))) + + high (try.trusted (# n.binary decoded pattern)) + low (..right_rotated size high)] + (function (_ value) + (..or (..right_shifted size (..and high value)) + (..left_shifted size (..and low value))))))) swap/01 (swapper 0) swap/02 (swapper 1) @@ -180,14 +180,14 @@ (type: .public (Sub size) (Interface - (: (Equivalence (I64 size)) - &equivalence) - (: Nat - bits) - (: (-> I64 (I64 size)) - narrow) - (: (-> (I64 size) I64) - wide))) + (is (Equivalence (I64 size)) + &equivalence) + (is Nat + bits) + (is (-> I64 (I64 size)) + narrow) + (is (-> (I64 size) I64) + wide))) (def: .public (sub width) (Ex (_ size) (-> Nat (Maybe (Sub size)))) @@ -197,15 +197,15 @@ sign (..bit (-- width)) mantissa (..mask (-- width)) co_mantissa (..xor (.i64 -1) mantissa)] - {.#Some (: Sub - (implementation - (def: &equivalence ..equivalence) - (def: bits width) - (def: (narrow value) - (..or (|> value (..and ..sign) (..right_shifted sign_shift)) - (|> value (..and mantissa)))) - (def: (wide value) - (.i64 (case (.nat (..and sign value)) - 0 value - _ (..or co_mantissa value))))))}) + {.#Some (is Sub + (implementation + (def: &equivalence ..equivalence) + (def: bits width) + (def: (narrow value) + (..or (|> value (..and ..sign) (..right_shifted sign_shift)) + (|> value (..and mantissa)))) + (def: (wide value) + (.i64 (case (.nat (..and sign value)) + 0 value + _ (..or co_mantissa value))))))}) {.#None})) diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux index 469796261..15dc8c13a 100644 --- a/stdlib/source/library/lux/math/number/i8.lux +++ b/stdlib/source/library/lux/math/number/i8.lux @@ -1,24 +1,32 @@ (.using - [library - [lux {"-" i64} - [abstract - [equivalence {"+" Equivalence}]] - [control - ["[0]" maybe]] - [type {"+" :by_example}]]] - [// - ["[0]" i64 {"+" Sub}]]) + [library + [lux {"-" i64} + [type {"+" by_example}] + [abstract + [equivalence {"+" Equivalence}]] + [control + ["[0]" maybe]]]] + [// + ["[0]" i64 {"+" Sub}]]) (def: sub (maybe.trusted (i64.sub 8))) (def: .public I8 Type - (:by_example [size] - (Sub size) - ..sub - - (I64 size))) + ... TODO: Switch to the cleaner approach ASAP. + (case (type_of ..sub) + {.#Apply :size: :sub:} + (type (I64 :size:)) + + _ + (undefined)) + ... (by_example [size] + ... (Sub size) + ... ..sub + + ... (I64 size)) + ) (def: .public equivalence (Equivalence I8) (# ..sub &equivalence)) (def: .public width Nat (# ..sub bits)) diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index 9ead2ee82..31537c887 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -74,24 +74,23 @@ (def: .public (* parameter subject) (-> Nat Nat Nat) - (:as Nat - ("lux i64 *" - (:as Int parameter) - (:as Int subject)))) + (.nat ("lux i64 *" + (.int parameter) + (.int subject)))) (def: .public (/ parameter subject) (-> Nat Nat Nat) - (if ("lux i64 <" +0 (:as Int parameter)) + (if ("lux i64 <" +0 (.int parameter)) (if (..< parameter subject) 0 1) (let [quotient (|> subject ("lux i64 right-shift" 1) - ("lux i64 /" (:as Int parameter)) + ("lux i64 /" (.int parameter)) ("lux i64 left-shift" 1)) flat ("lux i64 *" - (:as Int parameter) - (:as Int quotient)) + (.int parameter) + (.int quotient)) remainder ("lux i64 -" flat subject)] (if (..< parameter remainder) quotient @@ -101,15 +100,15 @@ (-> Nat Nat [Nat Nat]) (let [quotient (../ parameter subject) flat ("lux i64 *" - (:as Int parameter) - (:as Int quotient))] + (.int parameter) + (.int quotient))] [quotient ("lux i64 -" flat subject)])) (def: .public (% parameter subject) (-> Nat Nat Nat) (let [flat ("lux i64 *" - (:as Int parameter) - (:as Int (../ parameter subject)))] + (.int parameter) + (.int (../ parameter subject)))] ("lux i64 -" flat subject))) (def: .public (gcd a b) @@ -298,7 +297,7 @@ (let [output' ("lux text concat" (<to_character> ("lux i64 and" mask input)) output)] - (case (: Nat ("lux i64 right-shift" <shift> input)) + (case (is Nat ("lux i64 right-shift" <shift> input)) 0 output' diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index f00cc8dd7..9a6e9c826 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -127,7 +127,7 @@ (with_expansions [<least_significant_bit> 1] (def: .public (reciprocal numerator) (-> Nat Rev) - (.rev (case (: Nat ("lux i64 and" <least_significant_bit> numerator)) + (.rev (case (is Nat ("lux i64 and" <least_significant_bit> numerator)) 0 (..even_reciprocal numerator) _ (..odd_reciprocal numerator)))) @@ -135,7 +135,7 @@ (-> Rev Rev Rev) (if ("lux i64 =" +0 param) (panic! "Cannot divide Rev by zero!") - (let [reciprocal (case (: Nat ("lux i64 and" <least_significant_bit> param)) + (let [reciprocal (case (is Nat ("lux i64 and" <least_significant_bit> param)) 0 (..even_reciprocal (.nat param)) _ (..odd_reciprocal (.nat param)))] (.rev (//nat.* reciprocal (.nat subject))))))) @@ -234,13 +234,13 @@ 0 0 _ 1)) raw_size ("lux text size" raw_output) - zero_padding (: Text - (loop [zeroes_left (: Nat (//nat.- raw_size max_num_chars)) - output (: Text "")] - (if (//nat.= 0 zeroes_left) - output - (again (-- zeroes_left) - ("lux text concat" "0" output)))))] + zero_padding (is Text + (loop [zeroes_left (is Nat (//nat.- raw_size max_num_chars)) + output (is Text "")] + (if (//nat.= 0 zeroes_left) + output + (again (-- zeroes_left) + ("lux text concat" "0" output)))))] (|> raw_output ("lux text concat" zero_padding) ("lux text concat" ".")))) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 2d21ae951..c172e5c98 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -152,8 +152,8 @@ (let [start (unicode.start set) end (unicode.end set) size (n.- start end) - in_range (: (-> Char Char) - (|>> (n.% size) (n.+ start)))] + in_range (is (-> Char Char) + (|>> (n.% size) (n.+ start)))] (|> ..nat (# ..functor each in_range) (..only (unicode.member? set))))) @@ -375,10 +375,10 @@ ... http://xorshift.di.unimi.it/splitmix64.c (def: .public split_mix_64 (-> Nat PRNG) - (let [twist (: (-> Nat Nat Nat) - (function (_ shift value) - (i64.xor (i64.right_shifted shift value) - value))) + (let [twist (is (-> Nat Nat Nat) + (function (_ shift value) + (i64.xor (i64.right_shifted shift value) + value))) mix n.*] (..prng (n.+ (hex "9E,37,79,B9,7F,4A,7C,15")) (|>> (twist 30) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 6b78550a3..e349785f3 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -166,41 +166,41 @@ (-> Symbol (Meta (Maybe Macro))) (do ..monad [[module name] (..normal full_name)] - (: (Meta (Maybe Macro)) - (function (_ lux) - {try.#Success [lux - (case (..current_module_name lux) - {try.#Failure error} - {.#None} - - {try.#Success [_ this_module]} - (let [modules (the .#modules lux)] - (loop [module module - name name] - (do maybe.monad - [$module (plist.value module modules) - definition (: (Maybe Global) - (|> $module - (: Module) - (the .#definitions) - (plist.value name)))] - (case definition - {.#Alias [r_module r_name]} - (again r_module r_name) - - {.#Definition [exported? def_type def_value]} - (if (macro_type? def_type) - {.#Some (:as Macro def_value)} - {.#None}) - - {.#Type [exported? type labels]} - {.#None} - - {.#Tag _} - {.#None} - - {.#Slot _} - {.#None})))))]})))) + (is (Meta (Maybe Macro)) + (function (_ lux) + {try.#Success [lux + (case (..current_module_name lux) + {try.#Failure error} + {.#None} + + {try.#Success [_ this_module]} + (let [modules (the .#modules lux)] + (loop [module module + name name] + (do maybe.monad + [$module (plist.value module modules) + definition (is (Maybe Global) + (|> $module + (is Module) + (the .#definitions) + (plist.value name)))] + (case definition + {.#Alias [r_module r_name]} + (again r_module r_name) + + {.#Definition [exported? def_type def_value]} + (if (macro_type? def_type) + {.#Some (as Macro def_value)} + {.#None}) + + {.#Type [exported? type labels]} + {.#None} + + {.#Tag _} + {.#None} + + {.#Slot _} + {.#None})))))]})))) (def: .public seed (Meta Nat) @@ -256,20 +256,20 @@ (def: .public (var_type name) (-> Text (Meta Type)) (function (_ lux) - (let [test (: (-> [Text [Type Any]] Bit) - (|>> product.left (text#= name)))] + (let [test (is (-> [Text [Type Any]] Bit) + (|>> product.left (text#= name)))] (case (do maybe.monad [scope (list.example (function (_ env) - (or (list.any? test (: (List [Text [Type Any]]) - (the [.#locals .#mappings] env))) - (list.any? test (: (List [Text [Type Any]]) - (the [.#captured .#mappings] env))))) + (or (list.any? test (is (List [Text [Type Any]]) + (the [.#locals .#mappings] env))) + (list.any? test (is (List [Text [Type Any]]) + (the [.#captured .#mappings] env))))) (the .#scopes lux)) [_ [type _]] (on_either (list.example test) - (: (List [Text [Type Any]]) - (the [.#locals .#mappings] scope)) - (: (List [Text [Type Any]]) - (the [.#captured .#mappings] scope)))] + (is (List [Text [Type Any]]) + (the [.#locals .#mappings] scope)) + (is (List [Text [Type Any]]) + (the [.#captured .#mappings] scope)))] (in type)) {.#Some var_type} ((clean_type var_type) lux) @@ -299,12 +299,12 @@ [name (..normal name) .let [[normal_module normal_short] name]] (function (_ lux) - (case (: (Maybe Global) - (do maybe.monad - [(open "[0]") (|> lux - (the .#modules) - (plist.value normal_module))] - (plist.value normal_short #definitions))) + (case (is (Maybe Global) + (do maybe.monad + [(open "[0]") (|> lux + (the .#modules) + (plist.value normal_module))] + (plist.value normal_short #definitions))) {.#Some definition} {try.#Success [lux definition]} @@ -440,7 +440,7 @@ (# code.equivalence = (type_code .Type) (type_code def_type))) - (in (:as Type def_value)) + (in (as Type def_value)) (..failure ($_ text#composite "Definition is not a type: " (symbol#encoded name))))) {.#Type [exported? type labels]} diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux index 372189c39..54bb66630 100644 --- a/stdlib/source/library/lux/meta/configuration.lux +++ b/stdlib/source/library/lux/meta/configuration.lux @@ -61,10 +61,10 @@ (def: .public parser (Parser Configuration) - (let [parser' (: (Parser Text) - (<| (<>.after (<text>.this ..start)) - (<>.before (<text>.this ..end)) - (<text>.slice (<text>.some! (<text>.none_of! ..end)))))] + (let [parser' (is (Parser Text) + (<| (<>.after (<text>.this ..start)) + (<>.before (<text>.this ..end)) + (<text>.slice (<text>.some! (<text>.none_of! ..end)))))] (<>.some (<>.and parser' parser')))) (exception: .public invalid) diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index 1080669a2..b1448bf9e 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -23,10 +23,10 @@ {.#End} (let [location (the .#location compiler)] {.#Right [compiler - (list (` (.: .Location - [.#module (~ [..dummy {.#Text (the .#module location)}]) - .#line (~ [..dummy {.#Nat (the .#line location)}]) - .#column (~ [..dummy {.#Nat (the .#column location)}])])))]}) + (list (` (.is .Location + [.#module (~ [..dummy {.#Text (the .#module location)}]) + .#line (~ [..dummy {.#Nat (the .#line location)}]) + .#column (~ [..dummy {.#Nat (the .#column location)}])])))]}) _ {.#Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (symbol ..here)))})) diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index 253bf9b54..4b25a55b2 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -44,11 +44,11 @@ {#Parsed args} (` (.function ((~ g!program) (~ g!args)) - (case ((~! <cli>.result) (: (~! (<cli>.Parser (io.IO .Any))) - ((~! do) (~! <>.monad) - [(~+ args) - (~ g!_) (~! <cli>.end)] - ((~' in) (~ initialization+event_loop)))) + (case ((~! <cli>.result) (.is (~! (<cli>.Parser (io.IO .Any))) + ((~! do) (~! <>.monad) + [(~+ args) + (~ g!_) (~! <cli>.end)] + ((~' in) (~ initialization+event_loop)))) (~ g!args)) {.#Right (~ g!output)} (~ g!output) diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux index e4ccd2c3c..3f1e535ad 100644 --- a/stdlib/source/library/lux/static.lux +++ b/stdlib/source/library/lux/static.lux @@ -20,7 +20,7 @@ (template [<name> <type> <format>] [(syntax: .public (<name> [expression <code>.any]) (# meta.monad each - (|>> (:as <type>) <format> list) + (|>> (as <type>) <format> list) (meta.eval <type> expression)))] [bit .Bit code.bit] @@ -43,7 +43,7 @@ (do meta.monad [pair (meta.eval (.type <type>) (` [(~ format) (~ expression)])) - .let [[format expression] (:as <type> pair)]] + .let [[format expression] (as <type> pair)]] (in (list (format expression)))))) (with_expansions [<type> (Ex (_ a) @@ -54,7 +54,7 @@ (do meta.monad [pair (meta.eval (.type <type>) (` [(~ format) (~ expression)])) - .let [[format expression] (:as <type> pair)]] + .let [[format expression] (as <type> pair)]] (in (list#each format expression))))) (syntax: .public (seed []) @@ -83,7 +83,7 @@ (do meta.monad [pair (meta.eval (type <type>) (` [(~ format) (~ random)])) - .let [[format random] (:as <type> pair)] + .let [[format random] (as <type> pair)] seed meta.seed .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) random)]] @@ -97,7 +97,7 @@ (do meta.monad [pair (meta.eval (type <type>) (` [(~ format) (~ random)])) - .let [[format random] (:as <type> pair)] + .let [[format random] (as <type> pair)] seed meta.seed .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) random)]] @@ -108,7 +108,7 @@ else <code>.any]) (do meta.monad [test (meta.eval .Bit test)] - (in (list (.if (:as .Bit test) + (in (list (.if (as .Bit test) then else))))) @@ -125,6 +125,6 @@ then <code>.any]) (do meta.monad [test (meta.eval .Bit test)] - (in (.if (:as .Bit test) + (in (.if (as .Bit test) (list then) (list))))) diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index 6c98c57e0..15d35df29 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -14,7 +14,7 @@ [number ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: as_form (-> Text Text) @@ -25,11 +25,11 @@ (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] @@ -64,12 +64,12 @@ (def: .public nil Literal - (:abstraction "()")) + (abstraction "()")) (template [<prefix> <name>] [(def: .public <name> (-> Text Literal) - (|>> (format <prefix>) :abstraction))] + (|>> (format <prefix>) abstraction))] ["'" symbol] [":" keyword]) @@ -82,7 +82,7 @@ (def: .public int (-> Int Literal) - (|>> %.int :abstraction)) + (|>> %.int abstraction)) (def: .public float (-> Frac Literal) @@ -97,11 +97,11 @@ ... else [%.frac]) - :abstraction)) + abstraction)) (def: .public (double value) (-> Frac Literal) - (:abstraction + (abstraction (.cond (f.= f.positive_infinity value) "(/ 1.0d0 0.0d0)" @@ -138,18 +138,18 @@ (-> Text Literal) (|>> ..safe (text.enclosed' text.double_quote) - :abstraction)) + abstraction)) (def: .public var (-> Text Var/1) - (|>> :abstraction)) + (|>> abstraction)) (def: .public args (-> (List Var/1) Var/*) (|>> (list#each ..code) (text.interposed " ") ..as_form - :abstraction)) + abstraction)) (def: .public (args& singles rest) (-> (List Var/1) Var/1 Var/*) @@ -162,16 +162,16 @@ (list#each ..code) (text.interposed " ") (text.suffix " "))) - (format "&rest " (:representation rest)) + (format "&rest " (representation rest)) ..as_form - :abstraction)) + abstraction)) (def: form (-> (List (Expression Any)) Expression) (|>> (list#each ..code) (text.interposed " ") ..as_form - :abstraction)) + abstraction)) (def: .public (call/* func) (-> (Expression Any) (-> (List (Expression Any)) (Computation Any))) @@ -190,14 +190,14 @@ (-> (List [Var/1 Lambda]) (Expression Any) (Computation Any)) (..form (list (..var "labels") (..form (list#each (function (_ [def_name [def_args def_body]]) - (..form (list def_name (:transmutation def_args) def_body))) + (..form (list def_name (transmutation def_args) def_body))) definitions)) body))) (def: .public (destructuring_bind [bindings expression] body) (-> [Var/* (Expression Any)] (List (Expression Any)) (Computation Any)) (..form (list& (..var "destructuring-bind") - (:transmutation bindings) expression + (transmutation bindings) expression body))) (template [<call> <input_var>+ <input_type>+ <function>+] @@ -266,7 +266,7 @@ [(`` (template [<lux_name> <host_name>] [(def: .public (<lux_name> args) (-> [(~~ (template.spliced <input_type>+))] (Access Any)) - (:transmutation (<call> args (..var <host_name>))))] + (transmutation (<call> args (..var <host_name>))))] (~~ (template.spliced <function>+))))] @@ -342,7 +342,7 @@ (def: .public (lambda input body) (-> Var/* (Expression Any) Literal) - (..form (list (..var "lambda") (:transmutation input) body))) + (..form (list (..var "lambda") (transmutation input) body))) (template [<lux_name> <host_name>] [(def: .public (<lux_name> bindings body) @@ -364,7 +364,7 @@ (def: .public (defun name inputs body) (-> Var/1 Var/* (Expression Any) (Expression Any)) - (..form (list (..var "defun") name (:transmutation inputs) body))) + (..form (list (..var "defun") name (transmutation inputs) body))) (template [<name> <symbol>] [(def: .public <name> @@ -396,7 +396,7 @@ body (list#each (function (_ [type condition handler]) (..form (list type - (:transmutation (..args (list condition))) + (transmutation (..args (list condition))) handler))) handlers)))) @@ -408,30 +408,30 @@ expression {.#Item single {.#End}} - (:abstraction - (format <prefix> single " " (:representation expression))) + (abstraction + (format <prefix> single " " (representation expression))) _ - (:abstraction + (abstraction (format <prefix> (|> conditions (list#each ..symbol) (list& (..symbol "or")) ..form - :representation) - " " (:representation expression)))))] + representation) + " " (representation expression)))))] [conditional+ "#+"] [conditional- "#-"]) (def: .public label (-> Text Label) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (block name body) (-> Label (List (Expression Any)) (Computation Any)) - (..form (list& (..var "block") (:transmutation name) body))) + (..form (list& (..var "block") (transmutation name) body))) (def: .public (return_from target value) (-> Label (Expression Any) (Computation Any)) - (..form (list (..var "return-from") (:transmutation target) value))) + (..form (list (..var "return-from") (transmutation target) value))) (def: .public (return value) (-> (Expression Any) (Computation Any)) @@ -447,7 +447,7 @@ (def: .public tag (-> Text Tag) - (|>> :abstraction)) + (|>> abstraction)) (def: .public go (-> Tag (Expression Any)) @@ -462,7 +462,7 @@ (def: .public (multiple_value_setq bindings values) (-> Var/* (Expression Any) (Expression Any)) (..form (list (..var "multiple-value-setq") - (:transmutation bindings) + (transmutation bindings) values))) ) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index e227d6806..6243e3f11 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" Location Code Label or and function if undefined for comment not int try ++ -- the} + [lux {"-" Location Code Label or and function if undefined for comment not int try ++ -- the type_of} [control ["[0]" pipe]] [data @@ -15,7 +15,7 @@ ["i" int] ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: expression (text.enclosed ["(" ")"])) @@ -38,7 +38,7 @@ (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] @@ -64,7 +64,7 @@ ) (template [<name> <literal>] - [(def: .public <name> Literal (:abstraction <literal>))] + [(def: .public <name> Literal (abstraction <literal>))] [null "null"] [undefined "undefined"] @@ -75,11 +75,11 @@ (|>> (pipe.case #0 "false" #1 "true") - :abstraction)) + abstraction)) (def: .public (number value) (-> Frac Literal) - (:abstraction + (abstraction (cond (f.not_a_number? value) "NaN" @@ -114,7 +114,7 @@ (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) - :abstraction)) + abstraction)) (def: argument_separator ", ") (def: field_separator ": ") @@ -125,19 +125,19 @@ (|>> (list#each ..code) (text.interposed ..argument_separator) ..element - :abstraction)) + abstraction)) (def: .public var (-> Text Var) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (at index array_or_object) (-> Expression Expression Access) - (:abstraction (format (:representation array_or_object) (..element (:representation index))))) + (abstraction (format (representation array_or_object) (..element (representation index))))) (def: .public (the field object) (-> Text Expression Access) - (:abstraction (format (:representation object) "." field))) + (abstraction (format (representation object) "." field))) (def: .public (apply/* function inputs) (-> Expression (List Expression) Computation) @@ -145,8 +145,8 @@ (list#each ..code) (text.interposed ..argument_separator) ..expression - (format (:representation function)) - :abstraction)) + (format (representation function)) + abstraction)) (def: .public (do method inputs object) (-> Text (List Expression) Expression Computation) @@ -155,28 +155,28 @@ (def: .public object (-> (List [Text Expression]) Computation) (|>> (list#each (.function (_ [key val]) - (format (:representation (..string key)) ..field_separator (:representation val)))) + (format (representation (..string key)) ..field_separator (representation val)))) (text.interposed ..argument_separator) (text.enclosed ["{" "}"]) ..expression - :abstraction)) + abstraction)) (def: .public (, pre post) (-> Expression Expression Computation) - (|> (format (:representation pre) ..argument_separator (:representation post)) + (|> (format (representation pre) ..argument_separator (representation post)) ..expression - :abstraction)) + abstraction)) (def: .public (then pre post) (-> Statement Statement Statement) - (:abstraction (format (:representation pre) - \n+ - (:representation post)))) + (abstraction (format (representation pre) + \n+ + (representation post)))) (def: block (-> Statement Text) (let [close (format \n+ "}")] - (|>> :representation + (|>> representation ..nested (text.enclosed ["{" close])))) @@ -185,20 +185,20 @@ (-> Var (List Var) Statement Statement) (|> body ..block - (format "function " (:representation name) + (format "function " (representation name) (|> inputs (list#each ..code) (text.interposed ..argument_separator) ..expression) " ") - :abstraction)) + abstraction)) (def: .public (function name inputs body) (-> Var (List Var) Statement Computation) (|> (..function! name inputs body) - :representation + representation ..expression - :abstraction)) + abstraction)) (def: .public (closure inputs body) (-> (List Var) Statement Computation) @@ -211,14 +211,14 @@ ..expression) " ") ..expression - :abstraction)) + abstraction)) (template [<name> <op>] [(def: .public (<name> param subject) (-> Expression Expression Computation) - (|> (format (:representation subject) " " <op> " " (:representation param)) + (|> (format (representation subject) " " <op> " " (representation param)) ..expression - :abstraction))] + abstraction))] [= "==="] [< "<"] @@ -246,7 +246,7 @@ (template [<prefix> <name>] [(def: .public <name> (-> Expression Computation) - (|>> :representation (text.prefix <prefix>) ..expression :abstraction))] + (|>> representation (text.prefix <prefix>) ..expression abstraction))] ["!" not] ["~" bit_not] @@ -257,131 +257,131 @@ [... A 32-bit integer expression. (def: .public (<name> value) (-> <input> Computation) - (:abstraction (..expression (format (<format> value) "|0"))))] + (abstraction (..expression (format (<format> value) "|0"))))] - [to_i32 Expression :representation] + [to_i32 Expression representation] [i32 Int %.int] ) (def: .public (int value) (-> Int Literal) - (:abstraction (.if (i.< +0 value) - (%.int value) - (%.nat (.nat value))))) + (abstraction (.if (i.< +0 value) + (%.int value) + (%.nat (.nat value))))) (def: .public (? test then else) (-> Expression Expression Expression Computation) - (|> (format (:representation test) - " ? " (:representation then) - " : " (:representation else)) + (|> (format (representation test) + " ? " (representation then) + " : " (representation else)) ..expression - :abstraction)) + abstraction)) (def: .public type_of (-> Expression Computation) - (|>> :representation + (|>> representation (format "typeof ") ..expression - :abstraction)) + abstraction)) (def: .public (new constructor inputs) (-> Expression (List Expression) Computation) - (|> (format "new " (:representation constructor) + (|> (format "new " (representation constructor) (|> inputs (list#each ..code) (text.interposed ..argument_separator) ..expression)) ..expression - :abstraction)) + abstraction)) (def: .public statement (-> Expression Statement) - (|>> :representation (text.suffix ..statement_suffix) :abstraction)) + (|>> representation (text.suffix ..statement_suffix) abstraction)) (def: .public use_strict Statement - (:abstraction (format text.double_quote "use strict" text.double_quote ..statement_suffix))) + (abstraction (format text.double_quote "use strict" text.double_quote ..statement_suffix))) (def: .public (declare name) (-> Var Statement) - (:abstraction (format "var " (:representation name) ..statement_suffix))) + (abstraction (format "var " (representation name) ..statement_suffix))) (def: .public (define name value) (-> Var Expression Statement) - (:abstraction (format "var " (:representation name) " = " (:representation value) ..statement_suffix))) + (abstraction (format "var " (representation name) " = " (representation value) ..statement_suffix))) (def: .public (set name value) (-> Location Expression Statement) - (:abstraction (format (:representation name) " = " (:representation value) ..statement_suffix))) + (abstraction (format (representation name) " = " (representation value) ..statement_suffix))) (def: .public (throw message) (-> Expression Statement) - (:abstraction (format "throw " (:representation message) ..statement_suffix))) + (abstraction (format "throw " (representation message) ..statement_suffix))) (def: .public (return value) (-> Expression Statement) - (:abstraction (format "return " (:representation value) ..statement_suffix))) + (abstraction (format "return " (representation value) ..statement_suffix))) (def: .public delete (-> Location Expression) - (|>> :representation + (|>> representation (format "delete ") ..expression - :abstraction)) + abstraction)) (def: .public (if test then! else!) (-> Expression Statement Statement Statement) - (:abstraction (format "if(" (:representation test) ") " - (..block then!) - " else " - (..block else!)))) + (abstraction (format "if(" (representation test) ") " + (..block then!) + " else " + (..block else!)))) (def: .public (when test then!) (-> Expression Statement Statement) - (:abstraction (format "if(" (:representation test) ") " - (..block then!)))) + (abstraction (format "if(" (representation test) ") " + (..block then!)))) (def: .public (while test body) (-> Expression Statement Loop) - (:abstraction (format "while(" (:representation test) ") " - (..block body)))) + (abstraction (format "while(" (representation test) ") " + (..block body)))) (def: .public (do_while test body) (-> Expression Statement Loop) - (:abstraction (format "do " (..block body) - " while(" (:representation test) ")" ..statement_suffix))) + (abstraction (format "do " (..block body) + " while(" (representation test) ")" ..statement_suffix))) (def: .public (try body [exception catch]) (-> Statement [Var Statement] Statement) - (:abstraction (format "try " - (..block body) - " catch(" (:representation exception) ") " - (..block catch)))) + (abstraction (format "try " + (..block body) + " catch(" (representation exception) ") " + (..block catch)))) (def: .public (for var init condition update iteration) (-> Var Expression Expression Expression Statement Loop) - (:abstraction (format "for(" (:representation (..define var init)) - " " (:representation condition) - ..statement_suffix " " (:representation update) - ")" - (..block iteration)))) + (abstraction (format "for(" (representation (..define var init)) + " " (representation condition) + ..statement_suffix " " (representation update) + ")" + (..block iteration)))) (def: .public label (-> Text Label) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (with_label label loop) (-> Label Loop Statement) - (:abstraction (format (:representation label) ": " (:representation loop)))) + (abstraction (format (representation label) ": " (representation loop)))) (template [<keyword> <0> <1>] [(def: .public <0> Statement - (:abstraction (format <keyword> ..statement_suffix))) + (abstraction (format <keyword> ..statement_suffix))) (def: .public (<1> label) (-> Label Statement) - (:abstraction (format <keyword> " " (:representation label) ..statement_suffix)))] + (abstraction (format <keyword> " " (representation label) ..statement_suffix)))] ["break" break break_at] ["continue" continue continue_at] @@ -390,9 +390,9 @@ (template [<name> <js>] [(def: .public <name> (-> Location Expression) - (|>> :representation + (|>> representation (text.suffix <js>) - :abstraction))] + abstraction))] [++ "++"] [-- "--"] @@ -400,28 +400,28 @@ (def: .public (comment commentary on) (All (_ kind) (-> Text (Code kind) (Code kind))) - (:abstraction (format "/* " commentary " */" " " (:representation on)))) + (abstraction (format "/* " commentary " */" " " (representation on)))) (def: .public (switch input cases default) (-> Expression (List [(List Literal) Statement]) (Maybe Statement) Statement) - (:abstraction (format "switch (" (:representation input) ") " - (|> (format (|> cases - (list#each (.function (_ [when then]) - (format (|> when - (list#each (|>> :representation (text.enclosed ["case " ":"]))) - (text.interposed \n+)) - (..nested (:representation then))))) - (text.interposed \n+)) - \n+ - (case default - {.#Some default} - (format "default:" - (..nested (:representation default))) - - {.#None} - "")) - :abstraction - ..block)))) + (abstraction (format "switch (" (representation input) ") " + (|> (format (|> cases + (list#each (.function (_ [when then]) + (format (|> when + (list#each (|>> representation (text.enclosed ["case " ":"]))) + (text.interposed \n+)) + (..nested (representation then))))) + (text.interposed \n+)) + \n+ + (case default + {.#Some default} + (format "default:" + (..nested (representation default))) + + {.#None} + "")) + abstraction + ..block)))) ) (template [<apply> <arg>+ <type>+ <function>+] diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 895d84f7a..a58bce01c 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -88,7 +88,7 @@ <then> failure - (:expected failure))]) + (as_expected failure))]) (template: (try|in <it>) [{try.#Success <it>}]) @@ -213,7 +213,7 @@ ... {try.#Failure error} failure - (:expected failure))))) + (as_expected failure))))) (implementation: .public monad (Monad Bytecode) @@ -234,11 +234,11 @@ ... {try.#Failure error} failure - (:expected failure)) + (as_expected failure)) ... {try.#Failure error} failure - (:expected failure))))) + (as_expected failure))))) (def: .public (when_continuous it) (-> (Bytecode Any) (Bytecode Any)) @@ -611,17 +611,17 @@ (-> java/lang/Float Int) (|>> java/lang/Float::floatToRawIntBits ffi.int_to_long - (:as Int))) + (as Int))) (def: negative_zero_float_bits - (|> -0.0 (:as java/lang/Double) ffi.double_to_float ..float_bits)) + (|> -0.0 (as java/lang/Double) ffi.double_to_float ..float_bits)) (def: .public (float value) (-> java/lang/Float (Bytecode Any)) (if (i.= ..negative_zero_float_bits (..float_bits value)) (..arbitrary_float value) - (case (|> value ffi.float_to_double (:as Frac)) + (case (|> value ffi.float_to_double (as Frac)) (^.template [<special> <instruction>] [<special> (..bytecode $0 $1 @_ <instruction> [])]) ([+0.0 _.fconst_0] @@ -651,23 +651,23 @@ (def: (arbitrary_double value) (-> java/lang/Double (Bytecode Any)) (do ..monad - [index (..lifted (//constant/pool.double (//constant.double (:as Frac value))))] + [index (..lifted (//constant/pool.double (//constant.double (as Frac value))))] (..bytecode $0 $2 @_ _.ldc2_w/double [index]))) (def: double_bits (-> java/lang/Double Int) (|>> java/lang/Double::doubleToRawLongBits - (:as Int))) + (as Int))) (def: negative_zero_double_bits - (..double_bits (:as java/lang/Double -0.0))) + (..double_bits (as java/lang/Double -0.0))) (def: .public (double value) (-> java/lang/Double (Bytecode Any)) (if (i.= ..negative_zero_double_bits (..double_bits value)) (..arbitrary_double value) - (case (:as Frac value) + (case (as Frac value) (^.template [<special> <instruction>] [<special> (..bytecode $0 $2 @_ <instruction> [])]) ([+0.0 _.dconst_0] @@ -950,9 +950,9 @@ (|> (list#mix (..acknowledge_label actual) tracker (list& default at_minimum afterwards)) (has #program_counter program_counter'))] [(function (_ resolver) - (let [get (: (-> Label (Maybe [Stack (Maybe Address)])) - (function (_ label) - (dictionary.value label resolver)))] + (let [get (is (-> Label (Maybe [Stack (Maybe Address)])) + (function (_ label) + (dictionary.value label resolver)))] (case (do [! maybe.monad] [@default (|> default get (monad.then ! product.right)) @at_minimum (|> at_minimum get (monad.then ! product.right))] @@ -992,9 +992,9 @@ (|> (list#mix (..acknowledge_label actual) tracker (list& default (list#each product.right cases))) (has #program_counter program_counter'))] [(function (_ resolver) - (let [get (: (-> Label (Maybe [Stack (Maybe Address)])) - (function (_ label) - (dictionary.value label resolver)))] + (let [get (is (-> Label (Maybe [Stack (Maybe Address)])) + (function (_ label) + (dictionary.value label resolver)))] (case (do [! maybe.monad] [@default (|> default get (monad.then ! product.right))] (|> cases @@ -1045,10 +1045,10 @@ (def: .public (multianewarray class dimensions) (-> (Type Object) U1 (Bytecode Any)) (do ..monad - [_ (: (Bytecode Any) - (case (|> dimensions //unsigned.value) - 0 (..except ..multiarray_cannot_be_zero_dimensional [class]) - _ (in []))) + [_ (is (Bytecode Any) + (case (|> dimensions //unsigned.value) + 0 (..except ..multiarray_cannot_be_zero_dimensional [class]) + _ (in []))) index (..lifted (//constant/pool.class (//name.internal (..reflection class))))] (..bytecode (//unsigned.lifted/2 dimensions) $1 @_ _.multianewarray [index dimensions]))) @@ -1170,4 +1170,4 @@ ... {try.#Failure error} failure - (:expected failure)))) + (as_expected failure)))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/address.lux b/stdlib/source/library/lux/target/jvm/bytecode/address.lux index f91c4025f..f0df22eb4 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/address.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/address.lux @@ -1,48 +1,48 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}] - [monad {"+" do}]] - [control - ["[0]" try {"+" Try}]] - [data - [format - [binary {"+" Writer}]] - [text - ["%" format {"+" Format}]]] - [math - [number - ["n" nat]]] - [type - abstract]]] - ["[0]" // "_" - [jump {"+" Big_Jump}] - ["/[1]" // "_" - [encoding - ["[1][0]" unsigned {"+" U2}] - ["[1][0]" signed {"+" S4}]]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}] + [monad {"+" do}]] + [control + ["[0]" try {"+" Try}]] + [data + [format + [binary {"+" Writer}]] + [text + ["%" format {"+" Format}]]] + [math + [number + ["n" nat]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + [jump {"+" Big_Jump}] + ["/[1]" // "_" + [encoding + ["[1][0]" unsigned {"+" U2}] + ["[1][0]" signed {"+" S4}]]]]) (abstract: .public Address U2 (def: .public value (-> Address U2) - (|>> :representation)) + (|>> representation)) (def: .public start Address - (|> 0 ///unsigned.u2 try.trusted :abstraction)) + (|> 0 ///unsigned.u2 try.trusted abstraction)) (def: .public (move distance) (-> U2 (-> Address (Try Address))) - (|>> :representation + (|>> representation (///unsigned.+/2 distance) - (# try.functor each (|>> :abstraction)))) + (# try.functor each (|>> abstraction)))) (def: with_sign (-> Address (Try S4)) - (|>> :representation ///unsigned.value .int ///signed.s4)) + (|>> representation ///unsigned.value .int ///signed.s4)) (def: .public (jump from to) (-> Address Address (Try Big_Jump)) @@ -53,22 +53,22 @@ (def: .public (after? reference subject) (-> Address Address Bit) - (n.> (|> reference :representation ///unsigned.value) - (|> subject :representation ///unsigned.value))) + (n.> (|> reference representation ///unsigned.value) + (|> subject representation ///unsigned.value))) (implementation: .public equivalence (Equivalence Address) (def: (= reference subject) (# ///unsigned.equivalence = - (:representation reference) - (:representation subject)))) + (representation reference) + (representation subject)))) (def: .public writer (Writer Address) - (|>> :representation ///unsigned.writer/2)) + (|>> representation ///unsigned.writer/2)) (def: .public format (Format Address) - (|>> :representation ///unsigned.value %.nat)) + (|>> representation ///unsigned.value %.nat)) ) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux index 4f42ccffc..b7952504e 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux @@ -14,7 +14,7 @@ [number ["n" nat]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" ///// "_" [encoding ["[1][0]" unsigned {"+" U1 U2}]] @@ -33,7 +33,7 @@ (def: .public registry (-> U2 Registry) - (|>> :abstraction)) + (|>> abstraction)) (def: (minimal type) (-> (Type Method) Nat) @@ -61,18 +61,18 @@ (def: .public equivalence (Equivalence Registry) (# equivalence.functor each - (|>> :representation) + (|>> representation) /////unsigned.equivalence)) (def: .public writer (Writer Registry) - (|>> :representation /////unsigned.writer/2)) + (|>> representation /////unsigned.writer/2)) (def: .public (has needed) (-> Registry Registry Registry) - (|>> :representation - (/////unsigned.max/2 (:representation needed)) - :abstraction)) + (|>> representation + (/////unsigned.max/2 (representation needed)) + abstraction)) (template [<name> <extra>] [(def: .public <name> @@ -81,7 +81,7 @@ (|>> /////unsigned.lifted/2 (/////unsigned.+/2 extra) try.trusted - :abstraction)))] + abstraction)))] [for ..normal] [for_wide ..wide] diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux index e67bb157b..4b7b29804 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/stack.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - [abstract - ["[0]" equivalence {"+" Equivalence}]] - [control - ["[0]" maybe] - ["[0]" try {"+" Try}]] - [data - [text - ["%" format {"+" Format}]] - [format - [binary {"+" Writer}]]] - [type - abstract]]] - ["[0]" ///// "_" - [encoding - ["[1][0]" unsigned {"+" U2}]]]) + [library + [lux "*" + [abstract + ["[0]" equivalence {"+" Equivalence}]] + [control + ["[0]" maybe] + ["[0]" try {"+" Try}]] + [data + [text + ["%" format {"+" Format}]] + [format + [binary {"+" Writer}]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" ///// "_" + [encoding + ["[1][0]" unsigned {"+" U2}]]]) (abstract: .public Stack U2 @@ -23,7 +23,7 @@ (template [<frames> <name>] [(def: .public <name> Stack - (|> <frames> /////unsigned.u2 maybe.trusted :abstraction))] + (|> <frames> /////unsigned.u2 maybe.trusted abstraction))] [0 empty] [1 catch] @@ -32,21 +32,21 @@ (def: .public equivalence (Equivalence Stack) (# equivalence.functor each - (|>> :representation) + (|>> representation) /////unsigned.equivalence)) (def: .public writer (Writer Stack) - (|>> :representation /////unsigned.writer/2)) + (|>> representation /////unsigned.writer/2)) (def: stack (-> U2 Stack) - (|>> :abstraction)) + (|>> abstraction)) (template [<op> <name>] [(def: .public (<name> amount) (-> U2 (-> Stack (Try Stack))) - (|>> :representation + (|>> representation (<op> amount) (# try.functor each ..stack)))] @@ -56,13 +56,13 @@ (def: .public (max left right) (-> Stack Stack Stack) - (:abstraction - (/////unsigned.max/2 (:representation left) - (:representation right)))) + (abstraction + (/////unsigned.max/2 (representation left) + (representation right)))) (def: .public format (Format Stack) - (|>> :representation /////unsigned.value %.nat)) + (|>> representation /////unsigned.value %.nat)) ) (def: .public length diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 4f371461a..237901cf1 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -23,7 +23,7 @@ [number {"+" hex} ["n" nat]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // "_" ["[1][0]" address {"+" Address}] ["[1][0]" jump {"+" Jump Big_Jump}] @@ -227,11 +227,11 @@ (def: code (-> Primitive_Array_Type U1) - (|>> :representation)) + (|>> representation)) (template [<code> <name>] [(def: .public <name> - (|> <code> ///unsigned.u1 try.trusted :abstraction))] + (|> <code> ///unsigned.u1 try.trusted abstraction))] [04 t_boolean] [05 t_char] @@ -576,18 +576,18 @@ (def: .public tableswitch [(-> Nat Estimator) (-> S4 Big_Jump [Big_Jump (List Big_Jump)] Instruction)] - (let [estimator (: (-> Nat Estimator) - (function (_ amount_of_afterwards offset) - (|> ($_ n.+ - (///unsigned.value ..opcode_size) - (switch_padding (///unsigned.value (//address.value offset))) - (///unsigned.value ..big_jump_size) - (///unsigned.value ..integer_size) - (///unsigned.value ..integer_size) - (n.* (///unsigned.value ..big_jump_size) - (++ amount_of_afterwards))) - ///unsigned.u2 - try.trusted)))] + (let [estimator (is (-> Nat Estimator) + (function (_ amount_of_afterwards offset) + (|> ($_ n.+ + (///unsigned.value ..opcode_size) + (switch_padding (///unsigned.value (//address.value offset))) + (///unsigned.value ..big_jump_size) + (///unsigned.value ..integer_size) + (///unsigned.value ..integer_size) + (n.* (///unsigned.value ..big_jump_size) + (++ amount_of_afterwards))) + ///unsigned.u2 + try.trusted)))] [estimator (function (_ minimum default [at_minimum afterwards]) (let [amount_of_afterwards (list.size afterwards) @@ -599,40 +599,40 @@ [size (///unsigned.u2 size)] (# ! each (|>> estimator ///unsigned.value) (//address.move size //address.start)))) - tableswitch_mutation (: Mutation - (function (_ [offset binary]) - [(n.+ tableswitch_size offset) - (try.trusted - (do [! try.monad] - [amount_of_afterwards (|> amount_of_afterwards .int ///signed.s4) - maximum (///signed.+/4 minimum amount_of_afterwards)] - (in (let [_ (binary.with/1! offset (hex "AA") binary) - offset (n.+ (///unsigned.value ..opcode_size) offset) - _ (case padding - 3 (|> binary - (binary.with/1! offset 0) - (binary.with/2! (++ offset) 0)) - 2 (binary.with/2! offset 0 binary) - 1 (binary.with/1! offset 0 binary) - _ binary) - offset (n.+ padding offset) - _ (binary.with/4! offset (///signed.value default) binary) - offset (n.+ (///unsigned.value ..big_jump_size) offset) - _ (binary.with/4! offset (///signed.value minimum) binary) - offset (n.+ (///unsigned.value ..integer_size) offset) - _ (binary.with/4! offset (///signed.value maximum) binary)] - (loop [offset (n.+ (///unsigned.value ..integer_size) offset) - afterwards (: (List Big_Jump) - {.#Item at_minimum afterwards})] - (case afterwards - {.#End} - binary - - {.#Item head tail} - (exec - (binary.with/4! offset (///signed.value head) binary) - (again (n.+ (///unsigned.value ..big_jump_size) offset) - tail))))))))]))] + tableswitch_mutation (is Mutation + (function (_ [offset binary]) + [(n.+ tableswitch_size offset) + (try.trusted + (do [! try.monad] + [amount_of_afterwards (|> amount_of_afterwards .int ///signed.s4) + maximum (///signed.+/4 minimum amount_of_afterwards)] + (in (let [_ (binary.with/1! offset (hex "AA") binary) + offset (n.+ (///unsigned.value ..opcode_size) offset) + _ (case padding + 3 (|> binary + (binary.with/1! offset 0) + (binary.with/2! (++ offset) 0)) + 2 (binary.with/2! offset 0 binary) + 1 (binary.with/1! offset 0 binary) + _ binary) + offset (n.+ padding offset) + _ (binary.with/4! offset (///signed.value default) binary) + offset (n.+ (///unsigned.value ..big_jump_size) offset) + _ (binary.with/4! offset (///signed.value minimum) binary) + offset (n.+ (///unsigned.value ..integer_size) offset) + _ (binary.with/4! offset (///signed.value maximum) binary)] + (loop [offset (n.+ (///unsigned.value ..integer_size) offset) + afterwards (is (List Big_Jump) + {.#Item at_minimum afterwards})] + (case afterwards + {.#End} + binary + + {.#Item head tail} + (exec + (binary.with/4! offset (///signed.value head) binary) + (again (n.+ (///unsigned.value ..big_jump_size) offset) + tail))))))))]))] [(n.+ tableswitch_size size) (|>> mutation tableswitch_mutation)]))))])) @@ -642,16 +642,16 @@ (-> Big_Jump (List [S4 Big_Jump]) Instruction)] (let [case_size (n.+ (///unsigned.value ..integer_size) (///unsigned.value ..big_jump_size)) - estimator (: (-> Nat Estimator) - (function (_ amount_of_cases offset) - (|> ($_ n.+ - (///unsigned.value ..opcode_size) - (switch_padding (///unsigned.value (//address.value offset))) - (///unsigned.value ..big_jump_size) - (///unsigned.value ..integer_size) - (n.* amount_of_cases case_size)) - ///unsigned.u2 - try.trusted)))] + estimator (is (-> Nat Estimator) + (function (_ amount_of_cases offset) + (|> ($_ n.+ + (///unsigned.value ..opcode_size) + (switch_padding (///unsigned.value (//address.value offset))) + (///unsigned.value ..big_jump_size) + (///unsigned.value ..integer_size) + (n.* amount_of_cases case_size)) + ///unsigned.u2 + try.trusted)))] [estimator (function (_ default cases) (let [amount_of_cases (list.size cases) @@ -663,34 +663,34 @@ [size (///unsigned.u2 size)] (# ! each (|>> estimator ///unsigned.value) (//address.move size //address.start)))) - lookupswitch_mutation (: Mutation - (function (_ [offset binary]) - [(n.+ lookupswitch_size offset) - (let [_ (binary.with/1! offset (hex "AB") binary) - offset (n.+ (///unsigned.value ..opcode_size) offset) - _ (case padding - 3 (|> binary - (binary.with/1! offset 0) - (binary.with/2! (++ offset) 0)) - 2 (binary.with/2! offset 0 binary) - 1 (binary.with/1! offset 0 binary) - _ binary) - offset (n.+ padding offset) - _ (binary.with/4! offset (///signed.value default) binary) - offset (n.+ (///unsigned.value ..big_jump_size) offset) - _ (binary.with/4! offset amount_of_cases binary)] - (loop [offset (n.+ (///unsigned.value ..integer_size) offset) - cases cases] - (case cases - {.#End} - binary - - {.#Item [value jump] tail} - (exec - (binary.with/4! offset (///signed.value value) binary) - (binary.with/4! (n.+ (///unsigned.value ..integer_size) offset) (///signed.value jump) binary) - (again (n.+ case_size offset) - tail)))))]))] + lookupswitch_mutation (is Mutation + (function (_ [offset binary]) + [(n.+ lookupswitch_size offset) + (let [_ (binary.with/1! offset (hex "AB") binary) + offset (n.+ (///unsigned.value ..opcode_size) offset) + _ (case padding + 3 (|> binary + (binary.with/1! offset 0) + (binary.with/2! (++ offset) 0)) + 2 (binary.with/2! offset 0 binary) + 1 (binary.with/1! offset 0 binary) + _ binary) + offset (n.+ padding offset) + _ (binary.with/4! offset (///signed.value default) binary) + offset (n.+ (///unsigned.value ..big_jump_size) offset) + _ (binary.with/4! offset amount_of_cases binary)] + (loop [offset (n.+ (///unsigned.value ..integer_size) offset) + cases cases] + (case cases + {.#End} + binary + + {.#Item [value jump] tail} + (exec + (binary.with/4! offset (///signed.value value) binary) + (binary.with/4! (n.+ (///unsigned.value ..integer_size) offset) (///signed.value jump) binary) + (again (n.+ case_size offset) + tail)))))]))] [(n.+ lookupswitch_size size) (|>> mutation lookupswitch_mutation)]))))])) diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux index 73966259f..4d2cf203c 100644 --- a/stdlib/source/library/lux/target/jvm/class.lux +++ b/stdlib/source/library/lux/target/jvm/class.lux @@ -77,13 +77,13 @@ (do [! //pool.monad] [@this (//pool.class this) @super (//pool.class super) - @interfaces (: (Resource (Sequence (Index //constant.Class))) - (monad.mix ! (function (_ interface @interfaces) - (do ! - [@interface (//pool.class interface)] - (in (sequence.suffix @interface @interfaces)))) - sequence.empty - interfaces))] + @interfaces (is (Resource (Sequence (Index //constant.Class))) + (monad.mix ! (function (_ interface @interfaces) + (do ! + [@interface (//pool.class interface)] + (in (sequence.suffix @interface @interfaces)))) + sequence.empty + interfaces))] (in [@this @super @interfaces]))) (def: .public (class version modifier diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index 71aab1ed3..1afa70f79 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -22,7 +22,7 @@ ["[0]" int] ["[0]" frac]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" / "_" ["[1][0]" tag] ["/[1]" // "_" @@ -45,11 +45,11 @@ (def: .public index (-> Class (Index UTF8)) - (|>> :representation)) + (|>> representation)) (def: .public class (-> (Index UTF8) Class) - (|>> :abstraction)) + (|>> abstraction)) (def: .public class_equivalence (Equivalence Class) @@ -59,7 +59,7 @@ (def: class_writer (Writer Class) - (|>> :representation //index.writer)) + (|>> representation //index.writer)) ) (import: java/lang/Float @@ -87,14 +87,14 @@ (def: .public value (All (_ kind) (-> (Value kind) kind)) - (|>> :representation)) + (|>> representation)) (def: .public (value_equivalence Equivalence<kind>) (All (_ kind) (-> (Equivalence kind) (Equivalence (Value kind)))) (# equivalence.functor each - (|>> :representation) + (|>> representation) Equivalence<kind>)) (template [<constructor> <type> <marker>] @@ -103,7 +103,7 @@ (def: .public <constructor> (-> <marker> <type>) - (|>> :abstraction))] + (|>> abstraction))] [integer Integer I32] [float Float java/lang/Float] @@ -115,7 +115,7 @@ (template [<writer_name> <type> <write> <writer>] [(def: <writer_name> (Writer <type>) - (`` (|>> :representation + (`` (|>> representation (~~ (template.spliced <write>)) (~~ (template.spliced <writer>)))))] diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index 666531963..e2fcfd655 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -55,7 +55,7 @@ ... {try.#Failure error} failure - (:expected failure))))) + (as_expected failure))))) (implementation: .public monad (Monad Resource) @@ -74,7 +74,7 @@ ... {try.#Failure error} failure - (:expected failure))))) + (as_expected failure))))) (template: (try|each <binding> <value> <body>) [(case <value> @@ -83,7 +83,7 @@ ... {try.#Failure error} failure - (:expected failure))]) + (as_expected failure))]) (template: (try|in <it>) [{try.#Success <it>}]) @@ -108,11 +108,11 @@ {try.#Failure _} (<| (let [new {<tag> <value>'}]) (try|each @new (//unsigned.u2 (//.size new))) - (try|each next (: (Try Index) - (|> current - //index.value - (//unsigned.+/2 @new) - (# try.monad each //index.index)))) + (try|each next (is (Try Index) + (|> current + //index.value + (//unsigned.+/2 @new) + (# try.monad each //index.index)))) (try|in [[next (sequence.suffix [current new] pool)] current]))))))]) @@ -128,7 +128,7 @@ ... {try.#Failure error} failure - (:expected failure))]) + (as_expected failure))]) (type: (Adder of) (-> of (Resource (Index of)))) diff --git a/stdlib/source/library/lux/target/jvm/constant/tag.lux b/stdlib/source/library/lux/target/jvm/constant/tag.lux index 8d8d162aa..36acb163f 100644 --- a/stdlib/source/library/lux/target/jvm/constant/tag.lux +++ b/stdlib/source/library/lux/target/jvm/constant/tag.lux @@ -1,18 +1,18 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}]] - [control - ["[0]" try]] - [data - [format - [binary {"+" Writer}]]] - [type - abstract]]] - ["[0]" /// "_" - [encoding - ["[1][0]" unsigned {"+" U1} ("u1//[0]" equivalence)]]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}]] + [control + ["[0]" try]] + [data + [format + [binary {"+" Writer}]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" /// "_" + [encoding + ["[1][0]" unsigned {"+" U1} ("u1//[0]" equivalence)]]]) (abstract: .public Tag U1 @@ -20,13 +20,13 @@ (implementation: .public equivalence (Equivalence Tag) (def: (= reference sample) - (u1//= (:representation reference) - (:representation sample)))) + (u1//= (representation reference) + (representation sample)))) (template [<code> <name>] [(def: .public <name> Tag - (|> <code> ///unsigned.u1 try.trusted :abstraction))] + (|> <code> ///unsigned.u1 try.trusted abstraction))] [01 utf8] [03 integer] @@ -46,5 +46,5 @@ (def: .public writer (Writer Tag) - (|>> :representation ///unsigned.writer/1)) + (|>> representation ///unsigned.writer/1)) ) diff --git a/stdlib/source/library/lux/target/jvm/encoding/name.lux b/stdlib/source/library/lux/target/jvm/encoding/name.lux index c935d07b0..247300884 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/name.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/name.lux @@ -1,11 +1,11 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}]]] - [type - abstract]]]) + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}]]] + [type + [abstract {"-" pattern}]]]]) (def: .public internal_separator "/") (def: .public external_separator ".") @@ -20,15 +20,15 @@ (-> External Internal) (|>> (text.replaced ..external_separator ..internal_separator) - :abstraction)) + abstraction)) (def: .public read (-> Internal Text) - (|>> :representation)) + (|>> representation)) (def: .public external (-> Internal External) - (|>> :representation + (|>> representation (text.replaced ..internal_separator ..external_separator)))) diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index dba35fc11..981d8c3f7 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -20,26 +20,26 @@ ["n" nat] ["i" int]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Signed brand) Int (def: .public value (-> (Signed Any) Int) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (All (_ brand) (Equivalence (Signed brand))) (def: (= reference sample) - (i.= (:representation reference) (:representation sample)))) + (i.= (representation reference) (representation sample)))) (implementation: .public order (All (_ brand) (Order (Signed brand))) (def: &equivalence ..equivalence) (def: (< reference sample) - (i.< (:representation reference) (:representation sample)))) + (i.< (representation reference) (representation sample)))) (exception: .public (value_exceeds_the_scope [value Int scope Nat]) @@ -56,31 +56,31 @@ (def: .public <maximum> <name> - (|> <bytes> (n.* i64.bits_per_byte) -- i64.mask :abstraction)) + (|> <bytes> (n.* i64.bits_per_byte) -- i64.mask abstraction)) (def: .public <minimum> <name> - (let [it (:representation <maximum>)] - (:abstraction (-- (i.- it +0))))) + (let [it (representation <maximum>)] + (abstraction (-- (i.- it +0))))) (def: .public <constructor> (-> Int (Try <name>)) - (let [positive (:representation <maximum>) + (let [positive (representation <maximum>) negative (i64.not positive)] (function (_ value) (if (i.= (if (i.< +0 value) (i64.or negative value) (i64.and positive value)) value) - {try.#Success (:abstraction value)} + {try.#Success (abstraction value)} (exception.except ..value_exceeds_the_scope [value <size>]))))) (template [<abstract_operation> <concrete_operation>] [(def: .public (<abstract_operation> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> - (<concrete_operation> (:representation parameter) - (:representation subject))))] + (<concrete_operation> (representation parameter) + (representation subject))))] [<+> i.+] [<-> i.-] @@ -94,7 +94,7 @@ (template [<name> <from> <to>] [(def: .public <name> (-> <from> <to>) - (|>> :transmutation))] + (|>> transmutation))] [lifted/2 S1 S2] [lifted/4 S2 S4] @@ -103,7 +103,7 @@ (template [<writer_name> <type> <writer>] [(def: .public <writer_name> (Writer <type>) - (|>> :representation <writer>))] + (|>> representation <writer>))] [writer/1 S1 format.bits/8] [writer/2 S2 format.bits/16] diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index 795f30716..d733b0480 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -19,28 +19,28 @@ ["n" nat] ["[0]" i64]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Unsigned brand) Nat (def: .public value (-> (Unsigned Any) Nat) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (All (_ brand) (Equivalence (Unsigned brand))) (def: (= reference sample) - (n.= (:representation reference) - (:representation sample)))) + (n.= (representation reference) + (representation sample)))) (implementation: .public order (All (_ brand) (Order (Unsigned brand))) (def: &equivalence ..equivalence) (def: (< reference sample) - (n.< (:representation reference) - (:representation sample)))) + (n.< (representation reference) + (representation sample)))) (exception: .public (value_exceeds_the_maximum [type Symbol value Nat @@ -48,7 +48,7 @@ (exception.report "Type" (%.symbol type) "Value" (%.nat value) - "Maximum" (%.nat (:representation maximum)))) + "Maximum" (%.nat (representation maximum)))) (exception: .public [brand] (subtraction_cannot_yield_negative_value [type Symbol @@ -56,8 +56,8 @@ subject (Unsigned brand)]) (exception.report "Type" (%.symbol type) - "Parameter" (%.nat (:representation parameter)) - "Subject" (%.nat (:representation subject)))) + "Parameter" (%.nat (representation parameter)) + "Subject" (%.nat (representation subject)))) (template [<bytes> <name> <size> <constructor> <maximum> <+> <-> <max>] [(with_expansions [<raw> (template.symbol [<name> "'"])] @@ -68,32 +68,32 @@ (def: .public <maximum> <name> - (|> <bytes> (n.* i64.bits_per_byte) i64.mask :abstraction)) + (|> <bytes> (n.* i64.bits_per_byte) i64.mask abstraction)) (def: .public (<constructor> value) (-> Nat (Try <name>)) - (if (n.> (:representation <maximum>) value) + (if (n.> (representation <maximum>) value) (exception.except ..value_exceeds_the_maximum [(symbol <name>) value <maximum>]) - {try.#Success (:abstraction value)})) + {try.#Success (abstraction value)})) (def: .public (<+> parameter subject) (-> <name> <name> (Try <name>)) (<constructor> - (n.+ (:representation parameter) - (:representation subject)))) + (n.+ (representation parameter) + (representation subject)))) (def: .public (<-> parameter subject) (-> <name> <name> (Try <name>)) - (let [parameter' (:representation parameter) - subject' (:representation subject)] + (let [parameter' (representation parameter) + subject' (representation subject)] (if (n.> subject' parameter') (exception.except ..subtraction_cannot_yield_negative_value [(symbol <name>) parameter subject]) - {try.#Success (:abstraction (n.- parameter' subject'))}))) + {try.#Success (abstraction (n.- parameter' subject'))}))) (def: .public (<max> left right) (-> <name> <name> <name>) - (:abstraction (n.max (:representation left) - (:representation right))))] + (abstraction (n.max (representation left) + (representation right))))] [1 U1 bytes/1 u1 maximum/1 +/1 -/1 max/1] [2 U2 bytes/2 u2 maximum/2 +/2 -/2 max/2] @@ -103,7 +103,7 @@ (template [<name> <from> <to>] [(def: .public <name> (-> <from> <to>) - (|>> :transmutation))] + (|>> transmutation))] [lifted/2 U1 U2] [lifted/4 U2 U4] @@ -112,7 +112,7 @@ (template [<writer_name> <type> <writer>] [(def: .public <writer_name> (Writer <type>) - (|>> :representation <writer>))] + (|>> representation <writer>))] [writer/1 U1 format.bits/8] [writer/2 U2 format.bits/16] diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux index 8b339bc89..b6a0eb318 100644 --- a/stdlib/source/library/lux/target/jvm/index.lux +++ b/stdlib/source/library/lux/target/jvm/index.lux @@ -1,16 +1,16 @@ (.using - [library - [lux "*" - [abstract - ["[0]" equivalence {"+" Equivalence}]] - [data - [format - [binary {"+" Writer}]]] - [type - abstract]]] - ["[0]" // "_" - [encoding - ["[1][0]" unsigned {"+" U2}]]]) + [library + [lux "*" + [abstract + ["[0]" equivalence {"+" Equivalence}]] + [data + [format + [binary {"+" Writer}]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + [encoding + ["[1][0]" unsigned {"+" U2}]]]) (def: .public length //unsigned.bytes/2) @@ -20,11 +20,11 @@ (def: .public index (All (_ kind) (-> U2 (Index kind))) - (|>> :abstraction)) + (|>> abstraction)) (def: .public value (-> (Index Any) U2) - (|>> :representation)) + (|>> representation)) (def: .public equivalence (All (_ kind) (Equivalence (Index kind))) @@ -34,5 +34,5 @@ (def: .public writer (All (_ kind) (Writer (Index kind))) - (|>> :representation //unsigned.writer/2)) + (|>> representation //unsigned.writer/2)) ) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index 71d6dc712..bff3cb325 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -68,13 +68,13 @@ (def: java/lang/ClassLoader::defineClass java/lang/reflect/Method (let [signature (|> (ffi.array <elemT> 4) - (ffi.write! 0 (:as <elemT> - (ffi.class_for java/lang/String))) + (ffi.write! 0 (as <elemT> + (ffi.class_for java/lang/String))) (ffi.write! 1 (java/lang/Object::getClass (ffi.array byte 0))) - (ffi.write! 2 (:as <elemT> - (java/lang/Integer::TYPE))) - (ffi.write! 3 (:as <elemT> - (java/lang/Integer::TYPE))))] + (ffi.write! 2 (as <elemT> + (java/lang/Integer::TYPE))) + (ffi.write! 3 (as <elemT> + (java/lang/Integer::TYPE))))] (do_to (java/lang/Class::getDeclaredMethod (ffi.as_string "defineClass") signature (ffi.class_for java/lang/ClassLoader)) @@ -82,19 +82,19 @@ (def: .public (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) - (let [signature (array.of_list (list (:as java/lang/Object - class_name) - (:as java/lang/Object - bytecode) - (:as java/lang/Object - (|> 0 - (:as (Primitive "java.lang.Long")) - ffi.long_to_int)) - (:as java/lang/Object - (|> bytecode - binary.size - (:as (Primitive "java.lang.Long")) - ffi.long_to_int))))] + (let [signature (array.of_list (list (as java/lang/Object + class_name) + (as java/lang/Object + bytecode) + (as java/lang/Object + (|> 0 + (as (Primitive "java.lang.Long")) + ffi.long_to_int)) + (as java/lang/Object + (|> bytecode + binary.size + (as (Primitive "java.lang.Long")) + ffi.long_to_int))))] (java/lang/reflect/Method::invoke loader signature java/lang/ClassLoader::defineClass))) (def: .public (new_library _) @@ -114,13 +114,13 @@ (java/lang/ClassLoader (findClass self [class_name java/lang/String]) (java/lang/Class [? < java/lang/Object]) "throws" [java/lang/ClassNotFoundException] - (let [class_name (:as Text class_name) + (let [class_name (as Text class_name) classes (|> library atom.read! io.run!)] (case (dictionary.value class_name classes) {.#Some bytecode} (case (..define class_name bytecode (<| <cast> self)) {try.#Success class} - (:expected class) + (as_expected class) {try.#Failure error} (panic! (exception.error ..cannot_define [class_name error]))) diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index bf5d79aa2..24e442a21 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -1,52 +1,52 @@ (.using - [library - [lux "*" - [abstract - ["[0]" equivalence {"+" Equivalence}] - ["[0]" monoid {"+" Monoid}]] - [control - ["[0]" try] - ["<>" parser - ["<[0]>" code]]] - [data - [format - ["[0]F" binary {"+" Writer}]]] - [macro {"+" with_symbols} - [syntax {"+" syntax:}] - ["[0]" code]] - [math - ["[0]" number {"+" hex} - ["[0]" i64]]] - [type - abstract]]] - ["[0]" // "_" - [encoding - ["[1][0]" unsigned]]]) + [library + [lux "*" + [abstract + ["[0]" equivalence {"+" Equivalence}] + ["[0]" monoid {"+" Monoid}]] + [control + ["[0]" try] + ["<>" parser + ["<[0]>" code]]] + [data + [format + ["[0]F" binary {"+" Writer}]]] + [macro {"+" with_symbols} + [syntax {"+" syntax:}] + ["[0]" code]] + [math + ["[0]" number {"+" hex} + ["[0]" i64]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + [encoding + ["[1][0]" unsigned]]]) (abstract: .public (Modifier of) //unsigned.U2 (def: .public code (-> (Modifier Any) //unsigned.U2) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (All (_ of) (Equivalence (Modifier of))) (def: (= reference sample) (# //unsigned.equivalence = - (:representation reference) - (:representation sample)))) + (representation reference) + (representation sample)))) (template: (!wrap value) [(|> value //unsigned.u2 try.trusted - :abstraction)]) + abstraction)]) (template: (!unwrap value) [(|> value - :representation + representation //unsigned.value)]) (def: .public (has? sub super) @@ -71,7 +71,7 @@ (def: .public writer (All (_ of) (Writer (Modifier of))) - (|>> :representation //unsigned.writer/2)) + (|>> representation //unsigned.writer/2)) (def: modifier (-> Nat Modifier) diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index c8daea629..29776163c 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -133,7 +133,7 @@ (<| (case (ffi.check java/lang/Class reflection) {.#Some class} (let [class_name (|> class - (:as (java/lang/Class java/lang/Object)) + (as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] (`` (if (or (~~ (template [<reflection>] [(text#= (/reflection.reflection <reflection>) @@ -162,7 +162,7 @@ (array.list {.#None}) (monad.each ! parameter) (# ! each (/.class (|> raw' - (:as (java/lang/Class java/lang/Object)) + (as (java/lang/Class java/lang/Object)) java/lang/Class::getName))) (exception.with ..cannot_convert_to_a_lux_type [reflection]))) @@ -224,7 +224,7 @@ (<| (case (ffi.check java/lang/Class reflection) {.#Some reflection} (let [class_name (|> reflection - (:as (java/lang/Class java/lang/Object)) + (as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] (`` (cond (~~ (template [<reflection> <type>] [(text#= (/reflection.reflection <reflection>) @@ -257,7 +257,7 @@ (case (ffi.check java/lang/Class reflection) {.#Some class} (let [class_name (|> reflection - (:as (java/lang/Class java/lang/Object)) + (as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] (if (text#= (/reflection.reflection /reflection.void) class_name) diff --git a/stdlib/source/library/lux/target/jvm/type.lux b/stdlib/source/library/lux/target/jvm/type.lux index c4de519c3..4343e6ff0 100644 --- a/stdlib/source/library/lux/target/jvm/type.lux +++ b/stdlib/source/library/lux/target/jvm/type.lux @@ -1,29 +1,29 @@ (.using - [library - [lux {"-" Primitive Type int char} - [abstract - [equivalence {"+" Equivalence}] - [hash {"+" Hash}]] - [control - ["[0]" maybe]] - [data - ["[0]" text - ["%" format {"+" Format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - [number - ["n" nat]]] - [type - abstract]]] - ["[0]" // "_" - [encoding - ["[1][0]" name {"+" External}]]] - ["[0]" / "_" - [category {"+" Void Value' Value Return' Return Method Primitive Object Class Array Var Parameter Declaration}] - ["[1][0]" signature {"+" Signature}] - ["[1][0]" descriptor {"+" Descriptor}] - ["[1][0]" reflection {"+" Reflection}]]) + [library + [lux {"-" Primitive Type int char} + [abstract + [equivalence {"+" Equivalence}] + [hash {"+" Hash}]] + [control + ["[0]" maybe]] + [data + ["[0]" text + ["%" format {"+" Format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + [number + ["n" nat]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + [encoding + ["[1][0]" name {"+" External}]]] + ["[0]" / "_" + [category {"+" Void Value' Value Return' Return Method Primitive Object Class Array Var Parameter Declaration}] + ["[1][0]" signature {"+" Signature}] + ["[1][0]" descriptor {"+" Descriptor}] + ["[1][0]" reflection {"+" Reflection}]]) (abstract: .public (Type category) [(Signature category) @@ -45,7 +45,7 @@ (template [<name> <style>] [(def: .public (<name> type) (All (_ category) (-> (Type category) (<style> category))) - (let [[signature descriptor reflection] (:representation type)] + (let [[signature descriptor reflection] (representation type)] <name>))] [signature Signature] @@ -56,13 +56,13 @@ (All (_ category) (-> (Type (<| Return' Value' category)) (Reflection (<| Return' Value' category)))) - (let [[signature descriptor reflection] (:representation type)] + (let [[signature descriptor reflection] (representation type)] reflection)) (template [<category> <name> <signature> <descriptor> <reflection>] [(def: .public <name> (Type <category>) - (:abstraction [<signature> <descriptor> <reflection>]))] + (abstraction [<signature> <descriptor> <reflection>]))] [Void void /signature.void /descriptor.void /reflection.void] [Primitive boolean /signature.boolean /descriptor.boolean /reflection.boolean] @@ -77,59 +77,59 @@ (def: .public (array type) (-> (Type Value) (Type Array)) - (:abstraction + (abstraction [(/signature.array (..signature type)) (/descriptor.array (..descriptor type)) (/reflection.array (..reflection type))])) (def: .public (class name parameters) (-> External (List (Type Parameter)) (Type Class)) - (:abstraction + (abstraction [(/signature.class name (list#each ..signature parameters)) (/descriptor.class name) (/reflection.class name)])) (def: .public (declaration name variables) (-> External (List (Type Var)) (Type Declaration)) - (:abstraction + (abstraction [(/signature.declaration name (list#each ..signature variables)) (/descriptor.declaration name) (/reflection.declaration name)])) (def: .public (as_class type) (-> (Type Declaration) (Type Class)) - (:abstraction - (let [[signature descriptor reflection] (:representation type)] + (abstraction + (let [[signature descriptor reflection] (representation type)] [(/signature.as_class signature) (/descriptor.as_class descriptor) (/reflection.as_class reflection)]))) (def: .public wildcard (Type Parameter) - (:abstraction + (abstraction [/signature.wildcard /descriptor.wildcard /reflection.wildcard])) (def: .public (var name) (-> Text (Type Var)) - (:abstraction + (abstraction [(/signature.var name) /descriptor.var /reflection.var])) (def: .public (lower bound) (-> (Type Parameter) (Type Parameter)) - (:abstraction - (let [[signature descriptor reflection] (:representation bound)] + (abstraction + (let [[signature descriptor reflection] (representation bound)] [(/signature.lower signature) (/descriptor.lower descriptor) (/reflection.lower reflection)]))) (def: .public (upper bound) (-> (Type Parameter) (Type Parameter)) - (:abstraction - (let [[signature descriptor reflection] (:representation bound)] + (abstraction + (let [[signature descriptor reflection] (representation bound)] [(/signature.upper signature) (/descriptor.upper descriptor) (/reflection.upper reflection)]))) @@ -140,14 +140,14 @@ (Type Return) (List (Type Class))] (Type Method)) - (:abstraction + (abstraction [(/signature.method [(list#each ..signature type_variables) (list#each ..signature inputs) (..signature output) (list#each ..signature exceptions)]) (/descriptor.method [(list#each ..descriptor inputs) (..descriptor output)]) - (:expected ..void)])) + (as_expected ..void)])) (implementation: .public equivalence (All (_ category) (Equivalence (Type category))) @@ -167,7 +167,7 @@ (-> (Type Value) (Either (Type Object) (Type Primitive))) (if (`` (or (~~ (template [<type>] - [(# ..equivalence = (: (Type Value) <type>) type)] + [(# ..equivalence = (is (Type Value) <type>) type)] [..boolean] [..byte] @@ -177,18 +177,18 @@ [..float] [..double] [..char])))) - (|> type (:as (Type Primitive)) {.#Right}) - (|> type (:as (Type Object)) {.#Left}))) + (|> type (as (Type Primitive)) {.#Right}) + (|> type (as (Type Object)) {.#Left}))) (def: .public (void? type) (-> (Type Return) (Either (Type Value) (Type Void))) (if (`` (or (~~ (template [<type>] - [(# ..equivalence = (: (Type Return) <type>) type)] + [(# ..equivalence = (is (Type Return) <type>) type)] [..void])))) - (|> type (:as (Type Void)) {.#Right}) - (|> type (:as (Type Value)) {.#Left}))) + (|> type (as (Type Void)) {.#Right}) + (|> type (as (Type Value)) {.#Left}))) ) (def: .public (class? type) diff --git a/stdlib/source/library/lux/target/jvm/type/category.lux b/stdlib/source/library/lux/target/jvm/type/category.lux index 45128d756..0b740dae1 100644 --- a/stdlib/source/library/lux/target/jvm/type/category.lux +++ b/stdlib/source/library/lux/target/jvm/type/category.lux @@ -1,10 +1,10 @@ (.using - [library - [lux {"-" Primitive} - [macro - ["[0]" template]] - [type - abstract]]]) + [library + [lux {"-" Primitive} + [macro + ["[0]" template]] + [type + [abstract {"-" pattern}]]]]) (abstract: Void' Any) (abstract: .public (Value' kind) Any) diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux index d09a5d94f..c8c8f6f49 100644 --- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux +++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux @@ -1,37 +1,37 @@ (.using - [library - [lux {"-" Primitive int char} - [abstract - [equivalence {"+" Equivalence}]] - [control - ["[0]" maybe]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - [number - ["n" nat]]] - [type - abstract]]] - ["[0]" // "_" - [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration}] - ["/[1]" // "_" - [encoding - ["[1][0]" name {"+" Internal External}]]]]) + [library + [lux {"-" Primitive int char} + [abstract + [equivalence {"+" Equivalence}]] + [control + ["[0]" maybe]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + [number + ["n" nat]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration}] + ["/[1]" // "_" + [encoding + ["[1][0]" name {"+" Internal External}]]]]) (abstract: .public (Descriptor category) Text (def: .public descriptor (-> (Descriptor Any) Text) - (|>> :representation)) + (|>> representation)) (template [<sigil> <category> <name>] [(def: .public <name> (Descriptor <category>) - (:abstraction <sigil>))] + (abstraction <sigil>))] ["V" Void void] ["Z" Primitive boolean] @@ -52,20 +52,20 @@ (|>> ///name.internal ///name.read (text.enclosed [..class_prefix ..class_suffix]) - :abstraction)) + abstraction)) (def: .public (declaration name) (-> External (Descriptor Declaration)) - (:transmutation (..class name))) + (transmutation (..class name))) (def: .public as_class (-> (Descriptor Declaration) (Descriptor Class)) - (|>> :transmutation)) + (|>> transmutation)) (template [<name> <category>] [(def: .public <name> (Descriptor <category>) - (:transmutation + (transmutation (..class "java.lang.Object")))] [var Var] @@ -78,40 +78,40 @@ (def: .public upper (-> (Descriptor Parameter) (Descriptor Parameter)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public array_prefix "[") (def: .public array (-> (Descriptor Value) (Descriptor Array)) - (|>> :representation + (|>> representation (format ..array_prefix) - :abstraction)) + abstraction)) (def: .public (method [inputs output]) (-> [(List (Descriptor Value)) (Descriptor Return)] (Descriptor Method)) - (:abstraction + (abstraction (format (|> inputs (list#each ..descriptor) text.together (text.enclosed ["(" ")"])) - (:representation output)))) + (representation output)))) (implementation: .public equivalence (All (_ category) (Equivalence (Descriptor category))) (def: (= parameter subject) - (text#= (:representation parameter) (:representation subject)))) + (text#= (representation parameter) (representation subject)))) (def: .public class_name (-> (Descriptor Object) Internal) (let [prefix_size (text.size ..class_prefix) suffix_size (text.size ..class_suffix)] (function (_ descriptor) - (let [repr (:representation descriptor)] + (let [repr (representation descriptor)] (if (text.starts_with? ..array_prefix repr) (///name.internal repr) (|> repr diff --git a/stdlib/source/library/lux/target/jvm/type/parser.lux b/stdlib/source/library/lux/target/jvm/type/parser.lux index 8c896e9f1..a1bea32fc 100644 --- a/stdlib/source/library/lux/target/jvm/type/parser.lux +++ b/stdlib/source/library/lux/target/jvm/type/parser.lux @@ -221,18 +221,18 @@ (List (Type Value)) (Type Return) (List (Type Class))]) - (let [parser (: (Parser [(List (Type Var)) - (List (Type Value)) - (Type Return) - (List (Type Class))]) - ($_ <>.and - (|> (<>.some (<>#each product.left ..var_declaration)) - (<>.after (<text>.this //signature.parameters_start)) - (<>.before (<text>.this //signature.parameters_end)) - (<>.else (list))) - ..inputs - ..return - (<>.some ..exception)))] + (let [parser (is (Parser [(List (Type Var)) + (List (Type Value)) + (Type Return) + (List (Type Class))]) + ($_ <>.and + (|> (<>.some (<>#each product.left ..var_declaration)) + (<>.after (<text>.this //signature.parameters_start)) + (<>.before (<text>.this //signature.parameters_end)) + (<>.else (list))) + ..inputs + ..return + (<>.some ..exception)))] (|>> //.signature //signature.signature (<text>.result parser) diff --git a/stdlib/source/library/lux/target/jvm/type/reflection.lux b/stdlib/source/library/lux/target/jvm/type/reflection.lux index f4df7e88b..37d7e0dde 100644 --- a/stdlib/source/library/lux/target/jvm/type/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/type/reflection.lux @@ -1,37 +1,37 @@ (.using - [library - [lux {"-" Primitive int char} - [abstract - [equivalence {"+" Equivalence}]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [type - abstract]]] - ["[0]" // "_" - [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration}] - ["[1][0]" descriptor] - [// - [encoding - ["[1][0]" name {"+" External}]]]]) + [library + [lux {"-" Primitive int char} + [abstract + [equivalence {"+" Equivalence}]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration}] + ["[1][0]" descriptor] + [// + [encoding + ["[1][0]" name {"+" External}]]]]) (abstract: .public (Reflection category) Text (def: .public reflection (-> (Reflection Any) Text) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (All (_ category) (Equivalence (Reflection category))) (def: (= parameter subject) - (text#= (:representation parameter) (:representation subject)))) + (text#= (representation parameter) (representation subject)))) (template [<category> <name> <reflection>] [(def: .public <name> (Reflection <category>) - (:abstraction <reflection>))] + (abstraction <reflection>))] [Void void "void"] [Primitive boolean "boolean"] @@ -46,19 +46,19 @@ (def: .public class (-> External (Reflection Class)) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (declaration name) (-> External (Reflection Declaration)) - (:transmutation (..class name))) + (transmutation (..class name))) (def: .public as_class (-> (Reflection Declaration) (Reflection Class)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public (array element) (-> (Reflection Value) (Reflection Array)) - (let [element' (:representation element) + (let [element' (representation element) elementR (`` (cond (text.starts_with? //descriptor.array_prefix element') element' @@ -82,12 +82,12 @@ //name.external_separator))))] (|> elementR (format //descriptor.array_prefix) - :abstraction))) + abstraction))) (template [<name> <category>] [(def: .public <name> (Reflection <category>) - (:transmutation + (transmutation (..class "java.lang.Object")))] [var Var] @@ -100,5 +100,5 @@ (def: .public upper (-> (Reflection Parameter) (Reflection Parameter)) - (|>> :transmutation)) + (|>> transmutation)) ) diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux index e2b00d292..a5b710c59 100644 --- a/stdlib/source/library/lux/target/jvm/type/signature.lux +++ b/stdlib/source/library/lux/target/jvm/type/signature.lux @@ -12,7 +12,7 @@ [collection ["[0]" list ("[1]#[0]" functor)]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // "_" [category {"+" Void Value Return Method Primitive Object Class Array Var Parameter Declaration Inheritance}] ["[1][0]" descriptor] @@ -25,12 +25,12 @@ (def: .public signature (-> (Signature Any) Text) - (|>> :representation)) + (|>> representation)) (template [<category> <name> <descriptor>] [(def: .public <name> (Signature <category>) - (:abstraction (//descriptor.descriptor <descriptor>)))] + (abstraction (//descriptor.descriptor <descriptor>)))] [Void void //descriptor.void] [Primitive boolean //descriptor.boolean] @@ -45,13 +45,13 @@ (def: .public array (-> (Signature Value) (Signature Array)) - (|>> :representation + (|>> representation (format //descriptor.array_prefix) - :abstraction)) + abstraction)) (def: .public wildcard (Signature Parameter) - (:abstraction "*")) + (abstraction "*")) (template [<char> <name>] [(def: .public <name> <char>)] @@ -72,7 +72,7 @@ (template [<name> <prefix>] [(def: .public <name> (-> (Signature Parameter) (Signature Parameter)) - (|>> :representation (format <prefix>) :abstraction))] + (|>> representation (format <prefix>) abstraction))] [lower ..lower_prefix] [upper ..upper_prefix] @@ -81,17 +81,17 @@ (def: .public var (-> Text (Signature Var)) (|>> (text.enclosed [..var_prefix //descriptor.class_suffix]) - :abstraction)) + abstraction)) (def: .public var_name (-> (Signature Var) Text) - (|>> :representation + (|>> representation (text.replaced ..var_prefix "") (text.replaced //descriptor.class_suffix ""))) (def: .public (class name parameters) (-> External (List (Signature Parameter)) (Signature Class)) - (:abstraction + (abstraction (format //descriptor.class_prefix (|> name ///name.internal ///name.read) (case parameters @@ -108,7 +108,7 @@ (def: .public (declaration name variables) (-> External (List (Signature Var)) (Signature Declaration)) - (:transmutation (..class name variables))) + (transmutation (..class name variables))) (def: class_bound (|> (..class "java.lang.Object" (list)) @@ -138,16 +138,16 @@ (def: .public (inheritance variables super interfaces) (-> (List (Signature Var)) (Signature Class) (List (Signature Class)) (Signature Inheritance)) - (:abstraction + (abstraction (format (var_declaration/* variables) - (:representation super) + (representation super) (|> interfaces (list#each ..signature) text.together)))) (def: .public as_class (-> (Signature Declaration) (Signature Class)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public (method [type_variables inputs output exceptions]) (-> [(List (Signature Var)) @@ -155,28 +155,28 @@ (Signature Return) (List (Signature Class))] (Signature Method)) - (:abstraction + (abstraction (format (var_declaration/* type_variables) (|> inputs (list#each ..signature) text.together (text.enclosed [..arguments_start ..arguments_end])) - (:representation output) + (representation output) (|> exceptions - (list#each (|>> :representation (format ..exception_prefix))) + (list#each (|>> representation (format ..exception_prefix))) text.together)))) (implementation: .public equivalence (All (_ category) (Equivalence (Signature category))) (def: (= parameter subject) - (text#= (:representation parameter) - (:representation subject)))) + (text#= (representation parameter) + (representation subject)))) (implementation: .public hash (All (_ category) (Hash (Signature category))) (def: &equivalence ..equivalence) - (def: hash (|>> :representation text#hash))) + (def: hash (|>> representation text#hash))) ) diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index 069e5d2a7..2269e015b 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -25,7 +25,7 @@ ["i" int] ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) ... Added the carriage return for better Windows compatibility. (def: \n+ @@ -47,21 +47,21 @@ (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) - (# text.equivalence = (:representation reference) (:representation subject)))) + (# text.equivalence = (representation reference) (representation subject)))) (implementation: .public hash (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) - (def: hash (|>> :representation (# text.hash hash)))) + (def: hash (|>> representation (# text.hash hash)))) (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] @@ -87,14 +87,14 @@ (def: .public nil Literal - (:abstraction "nil")) + (abstraction "nil")) (def: .public boolean (-> Bit Literal) (|>> (pipe.case #0 "false" #1 "true") - :abstraction)) + abstraction)) (def: .public int (-> Int Literal) @@ -104,7 +104,7 @@ (|>> .nat to_hex (format "0x") - :abstraction))) + abstraction))) (def: .public float (-> Frac Literal) @@ -119,7 +119,7 @@ ... else [%.frac (text.replaced "+" "")]) - :abstraction)) + abstraction)) (def: safe (-> Text Text) @@ -140,42 +140,42 @@ (def: .public string (-> Text Literal) - (|>> ..safe (text.enclosed' text.double_quote) :abstraction)) + (|>> ..safe (text.enclosed' text.double_quote) abstraction)) (def: .public multi (-> (List Expression) Expression) (|>> (list#each ..code) (text.interposed ..input_separator) - :abstraction)) + abstraction)) (def: .public array (-> (List Expression) Literal) (|>> (list#each ..code) (text.interposed ..input_separator) (text.enclosed ["{" "}"]) - :abstraction)) + abstraction)) (def: .public table (-> (List [Text Expression]) Literal) (|>> (list#each (.function (_ [key value]) - (format key " = " (:representation value)))) + (format key " = " (representation value)))) (text.interposed ..input_separator) (text.enclosed ["({" "})"]) - :abstraction)) + abstraction)) (def: .public (item idx array) (-> Expression Expression Access) - (:abstraction (format "(" (:representation array) ")[" (:representation idx) "]"))) + (abstraction (format "(" (representation array) ")[" (representation idx) "]"))) (def: .public (the field table) (-> Text Expression Access) - (:abstraction (format (:representation table) "." field))) + (abstraction (format (representation table) "." field))) (def: .public length (-> Expression Computation) - (|>> :representation + (|>> representation (text.enclosed ["#(" ")"]) - :abstraction)) + abstraction)) (def: .public (apply args func) (-> (List Expression) Expression Computation) @@ -183,8 +183,8 @@ (list#each ..code) (text.interposed ..input_separator) (text.enclosed ["(" ")"]) - (format (:representation func)) - :abstraction)) + (format (representation func)) + abstraction)) (def: .public (do method args table) (-> Text (List Expression) Expression Computation) @@ -192,17 +192,17 @@ (list#each ..code) (text.interposed ..input_separator) (text.enclosed ["(" ")"]) - (format (:representation table) ":" method) - :abstraction)) + (format (representation table) ":" method) + abstraction)) (template [<op> <name>] [(def: .public (<name> parameter subject) (-> Expression Expression Expression) - (:abstraction (format "(" - (:representation subject) - " " <op> " " - (:representation parameter) - ")")))] + (abstraction (format "(" + (representation subject) + " " <op> " " + (representation parameter) + ")")))] ["==" =] ["<" <] @@ -231,7 +231,7 @@ (template [<name> <unary>] [(def: .public (<name> subject) (-> Expression Expression) - (:abstraction (format "(" <unary> " " (:representation subject) ")")))] + (abstraction (format "(" <unary> " " (representation subject) ")")))] [not "not"] [opposite "-"] @@ -240,7 +240,7 @@ (template [<name> <type>] [(def: .public <name> (-> Text <type>) - (|>> :abstraction))] + (|>> abstraction))] [var Var] [label Label] @@ -248,14 +248,14 @@ (def: .public statement (-> Expression Statement) - (|>> :representation :abstraction)) + (|>> representation abstraction)) (def: .public (then pre! post!) (-> Statement Statement Statement) - (:abstraction - (format (:representation pre!) + (abstraction + (format (representation pre!) \n+ - (:representation post!)))) + (representation post!)))) (def: locations (-> (List Location) Text) @@ -264,91 +264,91 @@ (def: .public (local vars) (-> (List Var) Statement) - (:abstraction (format "local " (..locations vars)))) + (abstraction (format "local " (..locations vars)))) (def: .public (set vars value) (-> (List Location) Expression Statement) - (:abstraction (format (..locations vars) " = " (:representation value)))) + (abstraction (format (..locations vars) " = " (representation value)))) (def: .public (let vars value) (-> (List Var) Expression Statement) - (:abstraction (format "local " (..locations vars) " = " (:representation value)))) + (abstraction (format "local " (..locations vars) " = " (representation value)))) (def: .public (local/1 var value) (-> Var Expression Statement) - (:abstraction (format "local " (:representation var) " = " (:representation value)))) + (abstraction (format "local " (representation var) " = " (representation value)))) (def: .public (if test then! else!) (-> Expression Statement Statement Statement) - (:abstraction (format "if " (:representation test) - \n+ "then" (..nested (:representation then!)) - \n+ "else" (..nested (:representation else!)) - \n+ "end"))) + (abstraction (format "if " (representation test) + \n+ "then" (..nested (representation then!)) + \n+ "else" (..nested (representation else!)) + \n+ "end"))) (def: .public (when test then!) (-> Expression Statement Statement) - (:abstraction (format "if " (:representation test) - \n+ "then" (..nested (:representation then!)) - \n+ "end"))) + (abstraction (format "if " (representation test) + \n+ "then" (..nested (representation then!)) + \n+ "end"))) (def: .public (while test body!) (-> Expression Statement Statement) - (:abstraction - (format "while " (:representation test) " do" - (..nested (:representation body!)) + (abstraction + (format "while " (representation test) " do" + (..nested (representation body!)) \n+ "end"))) (def: .public (repeat until body!) (-> Expression Statement Statement) - (:abstraction + (abstraction (format "repeat" - (..nested (:representation body!)) - \n+ "until " (:representation until)))) + (..nested (representation body!)) + \n+ "until " (representation until)))) (def: .public (for_in vars source body!) (-> (List Var) Expression Statement Statement) - (:abstraction + (abstraction (format "for " (|> vars (list#each ..code) (text.interposed ..input_separator)) - " in " (:representation source) " do" - (..nested (:representation body!)) + " in " (representation source) " do" + (..nested (representation body!)) \n+ "end"))) (def: .public (for_step var from to step body!) (-> Var Expression Expression Expression Statement Statement) - (:abstraction - (format "for " (:representation var) - " = " (:representation from) - ..input_separator (:representation to) - ..input_separator (:representation step) " do" - (..nested (:representation body!)) + (abstraction + (format "for " (representation var) + " = " (representation from) + ..input_separator (representation to) + ..input_separator (representation step) " do" + (..nested (representation body!)) \n+ "end"))) (def: .public (return value) (-> Expression Statement) - (:abstraction (format "return " (:representation value)))) + (abstraction (format "return " (representation value)))) (def: .public (closure args body!) (-> (List Var) Statement Expression) (|> (format "function " (|> args ..locations (text.enclosed ["(" ")"])) - (..nested (:representation body!)) + (..nested (representation body!)) \n+ "end") (text.enclosed ["(" ")"]) - :abstraction)) + abstraction)) (template [<name> <code> <binding>] [(def: .public (<name> name args body!) (-> <binding> (List Var) Statement Statement) - (:abstraction - (format <code> " " (:representation name) + (abstraction + (format <code> " " (representation name) (|> args ..locations (text.enclosed ["(" ")"])) - (..nested (:representation body!)) + (..nested (representation body!)) \n+ "end")))] [function "function" Location] @@ -357,20 +357,20 @@ (def: .public break Statement - (:abstraction "break")) + (abstraction "break")) (def: .public (set_label label) (-> Label Statement) - (:abstraction (format "::" (:representation label) "::"))) + (abstraction (format "::" (representation label) "::"))) (def: .public (go_to label) (-> Label Statement) - (:abstraction (format "goto " (:representation label)))) + (abstraction (format "goto " (representation label)))) ... https://www.lua.org/pil/1.3.html (def: .public (comment commentary on) (All (_ kind) (-> Text (Code kind) (Code kind))) - (:abstraction (format "-- " commentary \n+ (:representation on)))) + (abstraction (format "-- " commentary \n+ (representation on)))) ) (syntax: (arity_inputs [arity <code>.nat]) diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 6f5b171c9..1dd67843b 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -24,7 +24,7 @@ ["n" nat] ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: input_separator ", ") (def: statement_suffix ";") @@ -55,21 +55,21 @@ (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) - (# text.equivalence = (:representation reference) (:representation subject)))) + (# text.equivalence = (representation reference) (representation subject)))) (implementation: .public hash (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) - (def: hash (|>> :representation (# text.hash hash)))) + (def: hash (|>> representation (# text.hash hash)))) (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] @@ -102,18 +102,18 @@ (def: .public ; (-> Expression Statement) - (|>> :representation + (|>> representation (text.suffix ..statement_suffix) - :abstraction)) + abstraction)) (def: .public var (-> Text Var) - (|>> (format "$") :abstraction)) + (|>> (format "$") abstraction)) (template [<name> <type>] [(def: .public <name> (-> Text <type>) - (|>> :abstraction))] + (|>> abstraction))] [constant Constant] [label Label] @@ -121,23 +121,23 @@ (def: .public (set_label label) (-> Label Statement) - (:abstraction (format (:representation label) ":"))) + (abstraction (format (representation label) ":"))) (def: .public (go_to label) (-> Label Statement) - (:abstraction - (format "goto " (:representation label) ..statement_suffix))) + (abstraction + (format "goto " (representation label) ..statement_suffix))) (def: .public null Literal - (:abstraction "NULL")) + (abstraction "NULL")) (def: .public bool (-> Bit Literal) (|>> (pipe.case #0 "false" #1 "true") - :abstraction)) + abstraction)) (def: .public int (-> Int Literal) @@ -145,7 +145,7 @@ (|>> .nat to_hex (format "0x") - :abstraction))) + abstraction))) (def: .public float (-> Frac Literal) @@ -160,7 +160,7 @@ ... else [%.frac]) - :abstraction)) + abstraction)) (def: safe (-> Text Text) @@ -184,7 +184,7 @@ (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) - :abstraction)) + abstraction)) (def: arguments (-> (List Expression) Text) @@ -192,8 +192,8 @@ (def: .public (apply/* args func) (-> (List Expression) Expression Computation) - (|> (format (:representation func) (..arguments args)) - :abstraction)) + (|> (format (representation func) (..arguments args)) + abstraction)) ... TODO: Remove when no longer using JPHP. (def: .public (apply/*' args func) @@ -204,8 +204,8 @@ (-> (List Argument) Text) (|>> (list#each (function (_ [reference? var]) (.if reference? - (format "&" (:representation var)) - (:representation var)))) + (format "&" (representation var)) + (representation var)))) (text.interposed ..input_separator) ..group)) @@ -228,9 +228,9 @@ (format "use " (..parameters uses)))] (|> (format "function " (..parameters arguments) " " uses " " - (..block (:representation body!))) + (..block (representation body!))) ..group - :abstraction))) + abstraction))) (syntax: (arity_inputs [arity <code>.nat]) (in (case arity @@ -309,7 +309,7 @@ (def: .public (key_value key value) (-> Expression Expression Expression) - (:abstraction (format (:representation key) " => " (:representation value)))) + (abstraction (format (representation key) " => " (representation value)))) (def: .public (array/* values) (-> (List Expression) Literal) @@ -318,7 +318,7 @@ (text.interposed ..input_separator) ..group (format "array") - :abstraction)) + abstraction)) (def: .public (array_merge/+ required optionals) (-> Expression (List Expression) Computation) @@ -328,51 +328,51 @@ (-> (List [Expression Expression]) Literal) (|> kvs (list#each (function (_ [key value]) - (format (:representation key) " => " (:representation value)))) + (format (representation key) " => " (representation value)))) (text.interposed ..input_separator) ..group (format "array") - :abstraction)) + abstraction)) (def: .public (new constructor inputs) (-> Constant (List Expression) Computation) - (|> (format "new " (:representation constructor) (arguments inputs)) - :abstraction)) + (|> (format "new " (representation constructor) (arguments inputs)) + abstraction)) (def: .public (the field object) (-> Text Expression Computation) - (|> (format (:representation object) "->" field) - :abstraction)) + (|> (format (representation object) "->" field) + abstraction)) (def: .public (do method inputs object) (-> Text (List Expression) Expression Computation) - (|> (format (:representation (..the method object)) + (|> (format (representation (..the method object)) (..arguments inputs)) - :abstraction)) + abstraction)) (def: .public (item idx array) (-> Expression Expression Access) - (|> (format (:representation array) "[" (:representation idx) "]") - :abstraction)) + (|> (format (representation array) "[" (representation idx) "]") + abstraction)) (def: .public (global name) (-> Text Global) - (|> (..var "GLOBALS") (..item (..string name)) :transmutation)) + (|> (..var "GLOBALS") (..item (..string name)) transmutation)) (def: .public (? test then else) (-> Expression Expression Expression Computation) - (|> (format (..group (:representation test)) " ? " - (..group (:representation then)) " : " - (..group (:representation else))) + (|> (format (..group (representation test)) " ? " + (..group (representation then)) " : " + (..group (representation else))) ..group - :abstraction)) + abstraction)) (template [<name> <op>] [(def: .public (<name> parameter subject) (-> Expression Expression Computation) - (|> (format (:representation subject) " " <op> " " (:representation parameter)) + (|> (format (representation subject) " " <op> " " (representation parameter)) ..group - :abstraction))] + abstraction))] [or "||"] [and "&&"] @@ -398,7 +398,7 @@ (template [<unary> <name>] [(def: .public <name> (-> Computation Computation) - (|>> :representation (format <unary>) :abstraction))] + (|>> representation (format <unary>) abstraction))] ["!" not] ["~" bit_not] @@ -407,13 +407,13 @@ (def: .public (set var value) (-> Location Expression Computation) - (|> (format (:representation var) " = " (:representation value)) + (|> (format (representation var) " = " (representation value)) ..group - :abstraction)) + abstraction)) (def: .public (set! var value) (-> Location Expression Statement) - (:abstraction (format (:representation var) " = " (:representation value) ";"))) + (abstraction (format (representation var) " = " (representation value) ";"))) (def: .public (set? var) (-> Var Computation) @@ -422,7 +422,7 @@ (template [<name> <modifier>] [(def: .public <name> (-> Var Statement) - (|>> :representation (format <modifier> " ") (text.suffix ..statement_suffix) :abstraction))] + (|>> representation (format <modifier> " ") (text.suffix ..statement_suffix) abstraction))] [define_global "global"] ) @@ -430,9 +430,9 @@ (template [<name> <modifier> <location>] [(def: .public (<name> location value) (-> <location> Expression Statement) - (:abstraction (format <modifier> " " (:representation location) - " = " (:representation value) - ..statement_suffix)))] + (abstraction (format <modifier> " " (representation location) + " = " (representation value) + ..statement_suffix)))] [define_static "static" Var] [define_constant "const" Constant] @@ -440,44 +440,44 @@ (def: .public (if test then! else!) (-> Expression Statement Statement Statement) - (:abstraction - (format "if" (..group (:representation test)) " " - (..block (:representation then!)) + (abstraction + (format "if" (..group (representation test)) " " + (..block (representation then!)) " else " - (..block (:representation else!))))) + (..block (representation else!))))) (def: .public (when test then!) (-> Expression Statement Statement) - (:abstraction - (format "if" (..group (:representation test)) " " - (..block (:representation then!))))) + (abstraction + (format "if" (..group (representation test)) " " + (..block (representation then!))))) (def: .public (then pre! post!) (-> Statement Statement Statement) - (:abstraction - (format (:representation pre!) + (abstraction + (format (representation pre!) \n+ - (:representation post!)))) + (representation post!)))) (def: .public (while test body!) (-> Expression Statement Statement) - (:abstraction - (format "while" (..group (:representation test)) " " - (..block (:representation body!))))) + (abstraction + (format "while" (..group (representation test)) " " + (..block (representation body!))))) (def: .public (do_while test body!) (-> Expression Statement Statement) - (:abstraction - (format "do " (..block (:representation body!)) - " while" (..group (:representation test)) + (abstraction + (format "do " (..block (representation body!)) + " while" (..group (representation test)) ..statement_suffix))) (def: .public (for_each array value body!) (-> Expression Var Statement Statement) - (:abstraction - (format "foreach(" (:representation array) - " as " (:representation value) - ") " (..block (:representation body!))))) + (abstraction + (format "foreach(" (representation array) + " as " (representation value) + ") " (..block (representation body!))))) (type: .public Except (Record @@ -487,15 +487,15 @@ (def: (catch except) (-> Except Text) - (let [declaration (format (:representation (.the #class except)) - " " (:representation (.the #exception except)))] + (let [declaration (format (representation (.the #class except)) + " " (representation (.the #exception except)))] (format "catch" (..group declaration) " " - (..block (:representation (.the #handler except)))))) + (..block (representation (.the #handler except)))))) (def: .public (try body! excepts) (-> Statement (List Except) Statement) - (:abstraction - (format "try " (..block (:representation body!)) + (abstraction + (format "try " (..block (representation body!)) \n+ (|> excepts (list#each catch) @@ -504,7 +504,7 @@ (template [<name> <keyword>] [(def: .public <name> (-> Expression Statement) - (|>> :representation (format <keyword> " ") (text.suffix ..statement_suffix) :abstraction))] + (|>> representation (format <keyword> " ") (text.suffix ..statement_suffix) abstraction))] [throw "throw"] [return "return"] @@ -514,23 +514,23 @@ (def: .public (define name value) (-> Constant Expression Expression) (..apply/2 (..constant "define") - [(|> name :representation ..string) + [(|> name representation ..string) value])) (def: .public (define_function name arguments body!) (-> Constant (List Argument) Statement Statement) - (:abstraction - (format "function " (:representation name) + (abstraction + (format "function " (representation name) (..parameters arguments) " " - (..block (:representation body!))))) + (..block (representation body!))))) (template [<name> <keyword>] [(def: .public <name> Statement (|> <keyword> (text.suffix ..statement_suffix) - :abstraction))] + abstraction))] [break "break"] [continue "continue"] @@ -538,7 +538,7 @@ (def: .public splat (-> Expression Expression) - (|>> :representation (format "...") :abstraction)) + (|>> representation (format "...") abstraction)) ) (def: .public (cond clauses else!) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 1b5ecd2ee..0e4e279cb 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" Location Code not or and list if int comment exec try the} + [lux {"-" Location Code not or and list if int comment exec try the is} ["@" target] ["[0]" ffi] [abstract @@ -25,7 +25,7 @@ ["n" nat] ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: input_separator ", ") @@ -51,9 +51,9 @@ (-> Text Text) (.let [nested_new_line (format text.new_line text.tab)] (for @.old (|>> (format \n+) - (:as java/lang/String) - (java/lang/String::replace (:as java/lang/CharSequence text.new_line) - (:as java/lang/CharSequence nested_new_line))) + (as java/lang/String) + (java/lang/String::replace (as java/lang/CharSequence text.new_line) + (as java/lang/CharSequence nested_new_line))) (|>> (format \n+) (text.replaced text.new_line nested_new_line))))) @@ -64,21 +64,21 @@ (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) - (# text.equivalence = (:representation reference) (:representation subject)))) + (# text.equivalence = (representation reference) (representation subject)))) (implementation: .public hash (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) - (def: hash (|>> :representation (# text.hash hash)))) + (def: hash (|>> representation (# text.hash hash)))) (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (template [<type> <super>] [(with_expansions [<brand> (template.symbol [<type> "'"])] @@ -115,12 +115,12 @@ (def: .public var (-> Text SVar) - (|>> :abstraction)) + (|>> abstraction)) (template [<name> <brand> <prefix>] [(def: .public <name> (-> SVar (Var <brand>)) - (|>> :representation (format <prefix>) :abstraction))] + (|>> representation (format <prefix>) abstraction))] [poly Poly "*"] [keyword Keyword "**"] @@ -128,22 +128,22 @@ (def: .public none Literal - (:abstraction "None")) + (abstraction "None")) (def: .public bool (-> Bit Literal) (|>> (pipe.case #0 "False" #1 "True") - :abstraction)) + abstraction)) (def: .public int (-> Int Literal) - (|>> %.int :abstraction)) + (|>> %.int abstraction)) (def: .public (long value) (-> Int Literal) - (:abstraction (format (%.int value) "L"))) + (abstraction (format (%.int value) "L"))) (def: .public float (-> Frac Literal) @@ -158,7 +158,7 @@ ... else [%.frac]) - :abstraction))) + abstraction))) (def: safe (-> Text Text) @@ -181,21 +181,21 @@ (-> Text Literal) (|>> ..safe (text.enclosed [text.double_quote text.double_quote]) - :abstraction)) + abstraction)) (def: .public unicode (-> Text Literal) (|>> ..string - :representation + representation (format "u") - :abstraction)) + abstraction)) (def: (composite_literal left_delimiter right_delimiter entry_serializer) (All (_ a) (-> Text Text (-> a Text) (-> (List a) Literal))) (function (_ entries) - (<| :abstraction + (<| abstraction ... ..expression (format left_delimiter (|> entries @@ -214,25 +214,25 @@ (def: .public (slice from to list) (-> (Expression Any) (Expression Any) (Expression Any) Access) - (<| :abstraction + (<| abstraction ... ..expression - (format (:representation list) "[" (:representation from) ":" (:representation to) "]"))) + (format (representation list) "[" (representation from) ":" (representation to) "]"))) (def: .public (slice_from from list) (-> (Expression Any) (Expression Any) Access) - (<| :abstraction + (<| abstraction ... ..expression - (format (:representation list) "[" (:representation from) ":]"))) + (format (representation list) "[" (representation from) ":]"))) (def: .public dict (-> (List [(Expression Any) (Expression Any)]) (Computation Any)) - (composite_literal "{" "}" (.function (_ [k v]) (format (:representation k) " : " (:representation v))))) + (composite_literal "{" "}" (.function (_ [k v]) (format (representation k) " : " (representation v))))) (def: .public (apply/* args func) (-> (List (Expression Any)) (Expression Any) (Computation Any)) - (<| :abstraction + (<| abstraction ... ..expression - (format (:representation func) + (format (representation func) "(" (|> args (list#each ..code) (text.interposed ..input_separator)) ")"))) @@ -240,9 +240,9 @@ (template [<name> <brand> <prefix>] [(def: .public <name> (-> (Expression Any) (Expression Any)) - (|>> :representation + (|>> representation (format <prefix>) - :abstraction))] + abstraction))] [splat_poly Poly "*"] [splat_keyword Keyword "**"] @@ -250,7 +250,7 @@ (def: .public (the name object) (-> Text (Expression Any) Access) - (:abstraction (format (:representation object) "." name))) + (abstraction (format (representation object) "." name))) (def: .public (do method args object) (-> Text (List (Expression Any)) (Expression Any) (Computation Any)) @@ -260,20 +260,20 @@ (def: .public (item idx array) (-> (Expression Any) (Expression Any) Access) - (:abstraction (format (:representation array) "[" (:representation idx) "]"))) + (abstraction (format (representation array) "[" (representation idx) "]"))) (def: .public (? test then else) (-> (Expression Any) (Expression Any) (Expression Any) (Computation Any)) - (<| :abstraction + (<| abstraction ..expression - (format (:representation then) " if " (:representation test) " else " (:representation else)))) + (format (representation then) " if " (representation test) " else " (representation else)))) (template [<name> <op>] [(def: .public (<name> param subject) (-> (Expression Any) (Expression Any) (Computation Any)) - (<| :abstraction + (<| abstraction ..expression - (format (:representation subject) " " <op> " " (:representation param))))] + (format (representation subject) " " <op> " " (representation param))))] [is "is"] [= "=="] @@ -303,9 +303,9 @@ (template [<name> <unary>] [(def: .public (<name> subject) (-> (Expression Any) (Computation Any)) - (<| :abstraction + (<| abstraction ... ..expression - (format <unary> " " (:representation subject))))] + (format <unary> " " (representation subject))))] [not "not"] [opposite "-"] @@ -313,53 +313,53 @@ (def: .public (lambda arguments body) (-> (List (Var Any)) (Expression Any) (Computation Any)) - (<| :abstraction + (<| abstraction ..expression (format "lambda " (|> arguments (list#each ..code) (text.interposed ..input_separator)) - ": " (:representation body)))) + ": " (representation body)))) (def: .public (set vars value) (-> (List (Location Any)) (Expression Any) (Statement Any)) - (:abstraction + (abstraction (format (|> vars (list#each ..code) (text.interposed ..input_separator)) " = " - (:representation value)))) + (representation value)))) (def: .public multi (-> (List (Expression Any)) (Expression Any)) (|>> (list#each ..code) (text.interposed ..input_separator) - :abstraction)) + abstraction)) (def: .public (delete where) (-> (Location Any) (Statement Any)) - (:abstraction (format "del " (:representation where)))) + (abstraction (format "del " (representation where)))) (def: .public (if test then! else!) (-> (Expression Any) (Statement Any) (Statement Any) (Statement Any)) - (:abstraction - (format "if " (:representation test) ":" - (..nested (:representation then!)) + (abstraction + (format "if " (representation test) ":" + (..nested (representation then!)) \n+ "else:" - (..nested (:representation else!))))) + (..nested (representation else!))))) (def: .public (when test then!) (-> (Expression Any) (Statement Any) (Statement Any)) - (:abstraction - (format "if " (:representation test) ":" - (..nested (:representation then!))))) + (abstraction + (format "if " (representation test) ":" + (..nested (representation then!))))) (def: .public (then pre! post!) (-> (Statement Any) (Statement Any) (Statement Any)) - (:abstraction - (format (:representation pre!) + (abstraction + (format (representation pre!) \n+ - (:representation post!)))) + (representation post!)))) (template [<keyword> <0>] [(def: .public <0> (Statement Any) - (:abstraction <keyword>))] + (abstraction <keyword>))] ["break" break] ["continue" continue] @@ -367,30 +367,30 @@ (def: .public (while test body! else!) (-> (Expression Any) (Statement Any) (Maybe (Statement Any)) Loop) - (:abstraction - (format "while " (:representation test) ":" - (..nested (:representation body!)) + (abstraction + (format "while " (representation test) ":" + (..nested (representation body!)) (case else! {.#Some else!} (format \n+ "else:" - (..nested (:representation else!))) + (..nested (representation else!))) {.#None} "")))) (def: .public (for_in var inputs body!) (-> SVar (Expression Any) (Statement Any) Loop) - (:abstraction - (format "for " (:representation var) " in " (:representation inputs) ":" - (..nested (:representation body!))))) + (abstraction + (format "for " (representation var) " in " (representation inputs) ":" + (..nested (representation body!))))) (def: .public statement (-> (Expression Any) (Statement Any)) - (|>> :transmutation)) + (|>> transmutation)) (def: .public pass (Statement Any) - (:abstraction "pass")) + (abstraction "pass")) (type: .public Except (Record @@ -400,21 +400,21 @@ (def: .public (try body! excepts) (-> (Statement Any) (List Except) (Statement Any)) - (:abstraction + (abstraction (format "try:" - (..nested (:representation body!)) + (..nested (representation body!)) (|> excepts (list#each (function (_ [classes exception catch!]) (format \n+ "except (" (text.interposed ..input_separator classes) - ") as " (:representation exception) ":" - (..nested (:representation catch!))))) + ") as " (representation exception) ":" + (..nested (representation catch!))))) text.together)))) (template [<name> <keyword> <pre>] [(def: .public (<name> value) (-> (Expression Any) (Statement Any)) - (:abstraction - (format <keyword> (<pre> (:representation value)))))] + (abstraction + (format <keyword> (<pre> (representation value)))))] [raise "raise " |>] [return "return " |>] @@ -429,26 +429,26 @@ {.#None} (.list))] - (:abstraction - (format "exec" (:representation (..tuple (list& code extra))))))) + (abstraction + (format "exec" (representation (..tuple (list& code extra))))))) (def: .public (def name args body) (-> SVar (List (Ex (_ k) (Var k))) (Statement Any) (Statement Any)) - (:abstraction - (format "def " (:representation name) + (abstraction + (format "def " (representation name) "(" (|> args (list#each ..code) (text.interposed ..input_separator)) "):" - (..nested (:representation body))))) + (..nested (representation body))))) (def: .public (import module_name) (-> Text (Statement Any)) - (:abstraction (format "import " module_name))) + (abstraction (format "import " module_name))) (def: .public (comment commentary on) (All (_ brand) (-> Text (Code brand) (Code brand))) - (:abstraction (format "# " (text.replaced text.\n "\n" commentary) \n+ - (:representation on)))) + (abstraction (format "# " (text.replaced text.\n "\n" commentary) \n+ + (representation on)))) ) (syntax: (arity_inputs [arity <code>.nat]) diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index ad23a3e20..c4fa1d87a 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -20,7 +20,7 @@ [number ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Code kind) Text @@ -51,23 +51,23 @@ (def: .public var (-> Text SVar) - (|>> :abstraction)) + (|>> abstraction)) (def: .public var_args PVar - (:abstraction "...")) + (abstraction "...")) (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (def: (self_contained code) (-> Text Expression) - (:abstraction + (abstraction (format "(" code ")"))) ... Added the carriage return for better Windows compatibility. @@ -89,15 +89,15 @@ (def: .public (block expression) (-> Expression Expression) - (:abstraction + (abstraction (format "{" - (..nested (:representation expression)) + (..nested (representation expression)) \n+ "}"))) (template [<name> <r>] [(def: .public <name> Expression - (:abstraction <r>))] + (abstraction <r>))] [null "NULL"] [n/a "NA"] @@ -116,11 +116,11 @@ (|>> (pipe.case #0 "FALSE" #1 "TRUE") - :abstraction)) + abstraction)) (def: .public int (-> Int Expression) - (|>> %.int :abstraction)) + (|>> %.int abstraction)) (def: .public float (-> Frac Expression) @@ -155,27 +155,27 @@ (def: .public string (-> Text Expression) - (|>> ..safe %.text :abstraction)) + (|>> ..safe %.text abstraction)) (def: .public (slice from to list) (-> Expression Expression Expression Expression) (..self_contained - (format (:representation list) - "[" (:representation from) ":" (:representation to) "]"))) + (format (representation list) + "[" (representation from) ":" (representation to) "]"))) (def: .public (slice_from from list) (-> Expression Expression Expression) (..self_contained - (format (:representation list) - "[-1" ":-" (:representation from) "]"))) + (format (representation list) + "[-1" ":-" (representation from) "]"))) (def: .public (apply args func) (-> (List Expression) Expression Expression) - (let [func (:representation func) + (let [func (representation func) spacing (|> " " (list.repeated (text.size func)) text.together)] - (:abstraction + (abstraction (format func "(" (|> args (list#each ..code) @@ -195,17 +195,17 @@ (def: .public named_list (-> (List [Text Expression]) Expression) (|>> (list#each (.function (_ [key value]) - (:abstraction (format key "=" (:representation value))))) + (abstraction (format key "=" (representation value))))) ..list)) (def: .public (apply_kw args kw_args func) (-> (List Expression) (List [Text Expression]) Expression Expression) (..self_contained - (format (:representation func) + (format (representation func) (format "(" (text.interposed "," (list#each ..code args)) "," (text.interposed "," (list#each (.function (_ [key val]) - (format key "=" (:representation val))) + (format key "=" (representation val))) kw_args)) ")")))) @@ -250,20 +250,20 @@ (def: .public (item idx list) (-> Expression Expression Expression) (..self_contained - (format (:representation list) "[[" (:representation idx) "]]"))) + (format (representation list) "[[" (representation idx) "]]"))) (def: .public (if test then else) (-> Expression Expression Expression Expression) - (:abstraction - (format "if(" (:representation test) ")" - " " (.._block (:representation then)) - " else " (.._block (:representation else))))) + (abstraction + (format "if(" (representation test) ")" + " " (.._block (representation then)) + " else " (.._block (representation else))))) (def: .public (when test then) (-> Expression Expression Expression) - (:abstraction - (format "if(" (:representation test) ") {" - (.._block (:representation then)) + (abstraction + (format "if(" (representation test) ") {" + (.._block (representation then)) \n+ "}"))) (def: .public (cond clauses else) @@ -277,9 +277,9 @@ [(def: .public (<name> param subject) (-> Expression Expression Expression) (..self_contained - (format (:representation subject) + (format (representation subject) " " <op> " " - (:representation param))))] + (representation param))))] [= "=="] [< "<"] @@ -315,7 +315,7 @@ (template [<name> <op>] [(def: .public <name> (-> Expression Expression) - (|>> :representation (format <op>) ..self_contained))] + (|>> representation (format <op>) ..self_contained))] [not "!"] [negate "-"] @@ -328,25 +328,25 @@ (def: .public (range from to) (-> Expression Expression Expression) (..self_contained - (format (:representation from) ":" (:representation to)))) + (format (representation from) ":" (representation to)))) (def: .public (function inputs body) (-> (List (Ex (_ k) (Var k))) Expression Expression) (let [args (|> inputs (list#each ..code) (text.interposed ", "))] (..self_contained (format "function(" args ") " - (.._block (:representation body)))))) + (.._block (representation body)))))) (def: .public (try body warning error finally) (-> Expression (Maybe Expression) (Maybe Expression) (Maybe Expression) Expression) - (let [optional (: (-> Text (Maybe Expression) (-> Text Text) Text) - (.function (_ parameter value preparation) - (|> value - (maybe#each (|>> :representation preparation (format ", " parameter " = "))) - (maybe.else ""))))] + (let [optional (is (-> Text (Maybe Expression) (-> Text Text) Text) + (.function (_ parameter value preparation) + (|> value + (maybe#each (|>> representation preparation (format ", " parameter " = "))) + (maybe.else ""))))] (..self_contained (format "tryCatch(" - (.._block (:representation body)) + (.._block (representation body)) (optional "warning" warning function.identity) (optional "error" error function.identity) (optional "finally" finally .._block) @@ -355,14 +355,14 @@ (def: .public (while test body) (-> Expression Expression Expression) (..self_contained - (format "while (" (:representation test) ") " - (.._block (:representation body))))) + (format "while (" (representation test) ") " + (.._block (representation body))))) (def: .public (for_in var inputs body) (-> SVar Expression Expression Expression) (..self_contained - (format "for (" (:representation var) " in " (:representation inputs) ")" - (.._block (:representation body))))) + (format "for (" (representation var) " in " (representation inputs) ")" + (.._block (representation body))))) (template [<name> <keyword>] [(def: .public (<name> message) @@ -376,17 +376,17 @@ (def: .public (set! var value) (-> SVar Expression Expression) (..self_contained - (format (:representation var) " <- " (:representation value)))) + (format (representation var) " <- " (representation value)))) (def: .public (set_item! idx value list) (-> Expression Expression SVar Expression) (..self_contained - (format (:representation list) "[[" (:representation idx) "]] <- " (:representation value)))) + (format (representation list) "[[" (representation idx) "]] <- " (representation value)))) (def: .public (then pre post) (-> Expression Expression Expression) - (:abstraction - (format (:representation pre) + (abstraction + (format (representation pre) \n+ - (:representation post)))) + (representation post)))) ) diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index a5949aab0..a89537de1 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -24,7 +24,7 @@ ["n" nat] ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: input_separator ", ") (def: statement_suffix ";") @@ -47,15 +47,15 @@ (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) - (# text.equivalence = (:representation reference) (:representation subject)))) + (# text.equivalence = (representation reference) (representation subject)))) (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (template [<type> <super>+] [(with_expansions [<brand> (template.symbol [<type> "'"])] @@ -88,7 +88,7 @@ (template [<var> <prefix> <constructor>] [(def: .public <constructor> (-> Text <var>) - (|>> (format <prefix>) :abstraction))] + (|>> (format <prefix>) abstraction))] [LVar "l_" local] [CVar "C_" constant] @@ -101,7 +101,7 @@ [(template [<name> <input> <output>] [(def: .public <name> (-> <input> <output>) - (|>> :representation (format <prefix>) :abstraction))] + (|>> representation (format <prefix>) abstraction))] [<modifier> LVar <var>] [<unpacker> Expression Computation] @@ -145,18 +145,18 @@ (-> (List Expression) Expression) (|>> (list#each ..code) (text.interposed ..input_separator) - :abstraction)) + abstraction)) (def: .public nil Literal - (:abstraction "nil")) + (abstraction "nil")) (def: .public bool (-> Bit Literal) (|>> (pipe.case #0 "false" #1 "true") - :abstraction)) + abstraction)) (def: safe (-> Text Text) @@ -178,7 +178,7 @@ (template [<format> <name> <type> <prep>] [(def: .public <name> (-> <type> Literal) - (|>> <prep> <format> :abstraction))] + (|>> <prep> <format> abstraction))] [%.int int Int (<|)] [%.text string Text ..safe] @@ -198,29 +198,29 @@ ... else [%.frac]) - :abstraction)) + abstraction)) (def: .public (array_range from to array) (-> Expression Expression Expression Computation) - (|> (format (:representation from) ".." (:representation to)) + (|> (format (representation from) ".." (representation to)) (text.enclosed ["[" "]"]) - (format (:representation array)) - :abstraction)) + (format (representation array)) + abstraction)) (def: .public array (-> (List Expression) Computation) - (|>> (list#each (|>> :representation (text.suffix ..input_separator))) + (|>> (list#each (|>> representation (text.suffix ..input_separator))) text.together (text.enclosed ["[" "]"]) - :abstraction)) + abstraction)) (def: .public hash (-> (List [Expression Expression]) Computation) (|>> (list#each (.function (_ [k v]) - (format (:representation k) " => " (:representation v) ..input_separator))) + (format (representation k) " => " (representation v) ..input_separator))) text.together (text.enclosed ["{" "}"]) - :abstraction)) + abstraction)) (def: (control_structure content) (-> Text Text) @@ -235,16 +235,16 @@ (def: (block it) (-> Block Text) (|> (format (|> (.the #parameters it) - (list#each (|>> :representation)) + (list#each (|>> representation)) (text.interposed ..input_separator) (text.enclosed' "|")) - (..nested (:representation (.the #body it)))) + (..nested (representation (.the #body it)))) (text.enclosed ["{" "}"]))) (def: .public (apply/* arguments block func) (-> (List Expression) (Maybe Block) Expression Computation) (let [arguments (|> arguments - (list#each (|>> :representation)) + (list#each (|>> representation)) (text.interposed ..input_separator) (text.enclosed ["(" ")"])) block (case block @@ -253,72 +253,72 @@ {.#Some [inputs block]} (|> block - :representation + representation nested control_structure (format " do " (|> inputs - (list#each (|>> :representation)) + (list#each (|>> representation)) (text.interposed ..input_separator) (text.enclosed' "|")))))] - (:abstraction (format (:representation func) arguments block)))) + (abstraction (format (representation func) arguments block)))) (def: .public (the field object) (-> Text Expression Access) - (:abstraction (format (:representation object) "." field))) + (abstraction (format (representation object) "." field))) (def: .public (item idx array) (-> Expression Expression Access) - (|> (:representation idx) + (|> (representation idx) (text.enclosed ["[" "]"]) - (format (:representation array)) - :abstraction)) + (format (representation array)) + abstraction)) (def: .public (? test then else) (-> Expression Expression Expression Computation) - (|> (format (:representation test) " ? " - (:representation then) " : " - (:representation else)) + (|> (format (representation test) " ? " + (representation then) " : " + (representation else)) (text.enclosed ["(" ")"]) - :abstraction)) + abstraction)) (def: .public statement (-> Expression Statement) - (|>> :representation + (|>> representation (text.suffix ..statement_suffix) - :abstraction)) + abstraction)) (def: .public (then pre! post!) (-> Statement Statement Statement) - (:abstraction - (format (:representation pre!) + (abstraction + (format (representation pre!) \n+ - (:representation post!)))) + (representation post!)))) (def: .public (set vars value) (-> (List Location) Expression Statement) - (:abstraction + (abstraction (format (|> vars - (list#each (|>> :representation)) + (list#each (|>> representation)) (text.interposed ..input_separator)) - " = " (:representation value) ..statement_suffix))) + " = " (representation value) ..statement_suffix))) (def: .public (if test then! else!) (-> Expression Statement Statement Statement) - (<| :abstraction + (<| abstraction ..control_structure - (format "if " (:representation test) - (..nested (:representation then!)) + (format "if " (representation test) + (..nested (representation then!)) \n+ "else" - (..nested (:representation else!))))) + (..nested (representation else!))))) (template [<name> <control_structure>] [(def: .public (<name> test then!) (-> Expression Statement Statement) - (<| :abstraction + (<| abstraction ..control_structure - (format <control_structure> " " (:representation test) - (..nested (:representation then!)))))] + (format <control_structure> " " (representation test) + (..nested (representation then!)))))] [when "if"] [while "while"] @@ -326,12 +326,12 @@ (def: .public (for_in var array iteration!) (-> LVar Expression Statement Statement) - (<| :abstraction + (<| abstraction ..control_structure - (format "for " (:representation var) - " in " (:representation array) + (format "for " (representation var) + " in " (representation array) " do " - (..nested (:representation iteration!))))) + (..nested (representation iteration!))))) (type: .public Rescue (Record @@ -341,36 +341,36 @@ (def: .public (begin body! rescues) (-> Statement (List Rescue) Statement) - (<| :abstraction + (<| abstraction ..control_structure - (format "begin" (..nested (:representation body!)) + (format "begin" (..nested (representation body!)) (|> rescues (list#each (.function (_ [classes exception rescue]) (format \n+ "rescue " (text.interposed ..input_separator classes) - " => " (:representation exception) - (..nested (:representation rescue))))) + " => " (representation exception) + (..nested (representation rescue))))) (text.interposed \n+))))) (def: .public (catch expectation block) (-> Expression Block Expression) - (<| :abstraction - (format "catch(" (:representation expectation) ") " + (<| abstraction + (format "catch(" (representation expectation) ") " (..block block)))) (def: .public (return value) (-> Expression Statement) - (:abstraction (format "return " (:representation value) ..statement_suffix))) + (abstraction (format "return " (representation value) ..statement_suffix))) (def: .public (raise message) (-> Expression Expression) - (:abstraction (format "raise " (:representation message)))) + (abstraction (format "raise " (representation message)))) (template [<name> <keyword>] [(def: .public <name> Statement (|> <keyword> (text.suffix ..statement_suffix) - :abstraction))] + abstraction))] [next "next"] [redo "redo"] @@ -383,14 +383,14 @@ (def: .public (function name args body!) (-> LVar (List LVar) Statement Statement) - (<| :abstraction + (<| abstraction ..control_structure - (format "def " (:representation name) + (format "def " (representation name) (|> args - (list#each (|>> :representation)) + (list#each (|>> representation)) (text.interposed ..input_separator) (text.enclosed ["(" ")"])) - (..nested (:representation body!))))) + (..nested (representation body!))))) (def: .public (lambda name block) (-> (Maybe LVar) Block Literal) @@ -400,14 +400,14 @@ proc {.#Some name} - (format (:representation name) " = " proc)) + (format (representation name) " = " proc)) (text.enclosed ["(" ")"]) - :abstraction))) + abstraction))) (template [<op> <name>] [(def: .public (<name> parameter subject) (-> Expression Expression Computation) - (:abstraction (format "(" (:representation subject) " " <op> " " (:representation parameter) ")")))] + (abstraction (format "(" (representation subject) " " <op> " " (representation parameter) ")")))] ["==" =] [ "<" <] @@ -435,7 +435,7 @@ (template [<unary> <name>] [(def: .public (<name> subject) (-> Expression Computation) - (:abstraction (format "(" <unary> (:representation subject) ")")))] + (abstraction (format "(" <unary> (representation subject) ")")))] ["!" not] ["~" bit_not] @@ -444,8 +444,8 @@ (def: .public (comment commentary on) (All (_ brand) (-> Text (Code brand) (Code brand))) - (:abstraction (format "# " (..safe commentary) \n+ - (:representation on)))) + (abstraction (format "# " (..safe commentary) \n+ + (representation on)))) (template [<name>] [(`` (def: .public ((~~ (template.symbol [<name> "/*"])) attributes) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 2ea9a66e8..3bd2b22ce 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -19,7 +19,7 @@ ["n" nat] ["f" frac]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) ... Added the carriage return for better Windows compatibility. (def: \n+ @@ -38,13 +38,13 @@ (All (_ brand) (Equivalence (Code brand))) (def: (= reference subject) - (# text.equivalence = (:representation reference) (:representation subject)))) + (# text.equivalence = (representation reference) (representation subject)))) (implementation: .public hash (All (_ brand) (Hash (Code brand))) (def: &equivalence ..equivalence) - (def: hash (|>> :representation (# text.hash hash)))) + (def: hash (|>> representation (# text.hash hash)))) (template [<type> <brand> <super>+] [(abstract: .public (<brand> brand) Any) @@ -68,15 +68,15 @@ (def: .public manual (-> Text Code) - (|>> :abstraction)) + (|>> abstraction)) (def: .public code (-> (Code Any) Text) - (|>> :representation)) + (|>> representation)) (def: .public var (-> Text Var) - (|>> :abstraction)) + (|>> abstraction)) (def: (arguments [mandatory rest]) (-> Arguments (Code Any)) @@ -87,34 +87,34 @@ rest _ - (|> (format " . " (:representation rest)) + (|> (format " . " (representation rest)) (format (|> mandatory (list#each ..code) (text.interposed " "))) (text.enclosed ["(" ")"]) - :abstraction)) + abstraction)) {.#None} (|> mandatory (list#each ..code) (text.interposed " ") (text.enclosed ["(" ")"]) - :abstraction))) + abstraction))) (def: .public nil Computation - (:abstraction "'()")) + (abstraction "'()")) (def: .public bool (-> Bit Computation) (|>> (pipe.case #0 "#f" #1 "#t") - :abstraction)) + abstraction)) (def: .public int (-> Int Computation) - (|>> %.int :abstraction)) + (|>> %.int abstraction)) (def: .public float (-> Frac Computation) @@ -129,7 +129,7 @@ ... else [%.frac]) - :abstraction)) + abstraction)) (def: .public positive_infinity Computation (..float f.positive_infinity)) (def: .public negative_infinity Computation (..float f.negative_infinity)) @@ -153,26 +153,26 @@ (def: .public string (-> Text Computation) - (|>> ..safe %.text :abstraction)) + (|>> ..safe %.text abstraction)) (def: .public symbol (-> Text Computation) - (|>> (format "'") :abstraction)) + (|>> (format "'") abstraction)) (def: form (-> (List (Code Any)) Code) (.let [nested_new_line (format \n+ text.tab)] (|>> (pipe.case {.#End} - (:abstraction "()") + (abstraction "()") {.#Item head tail} (|> tail - (list#each (|>> :representation ..nested)) - {.#Item (:representation head)} + (list#each (|>> representation ..nested)) + {.#Item (representation head)} (text.interposed nested_new_line) (text.enclosed ["(" ")"]) - :abstraction))))) + 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 b4dea2627..09b549d09 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -85,9 +85,9 @@ (def: .public (and' left right) (-> Assertion Assertion Assertion) - (let [[read! write!] (: [(Async [Tally Text]) - (async.Resolver [Tally Text])] - (async.async [])) + (let [[read! write!] (is [(Async [Tally Text]) + (async.Resolver [Tally Text])] + (async.async [])) _ (|> left (async.upon! (function (_ [l_tally l_documentation]) (async.upon! (function (_ [r_tally r_documentation]) @@ -193,10 +193,10 @@ (the #expected_coverage tally)) unexpected (set.difference (the #expected_coverage tally) (the #actual_coverage tally)) - report (: (-> (Set Symbol) Text) - (|>> set.list - (list.sorted (# symbol.order <)) - (exception.listing %.symbol))) + report (is (-> (Set Symbol) Text) + (|>> set.list + (list.sorted (# symbol.order <)) + (exception.listing %.symbol))) expected_definitions_to_cover (set.size (the #expected_coverage tally)) unexpected_definitions_covered (set.size unexpected) actual_definitions_covered (n.- unexpected_definitions_covered @@ -339,8 +339,8 @@ (` ((~! ..reference) (~ definition)))) coverage)] (in (list (` ((~! <function>) - (: (.List .Symbol) - (.list (~+ coverage))) + (is (.List .Symbol) + (.list (~+ coverage))) (~ condition)))))))] [cover' ..|cover'|] @@ -353,8 +353,8 @@ (` ((~! ..reference) (~ definition)))) coverage)] (in (list (` ((~! ..|for|) - (: (.List .Symbol) - (.list (~+ coverage))) + (is (.List .Symbol) + (.list (~+ coverage))) (~ test))))))) (def: (covering' module coverage test) @@ -398,22 +398,22 @@ (do random.monad [seed random.nat .let [prng (random.pcg_32 [..pcg_32_magic_inc seed]) - run! (: (-> Test Assertion) - (|>> (random.result prng) - product.right - (function (_ _)) - "lux try" - (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 - (async.Resolver [Tally Text])] - (async.async [])) + run! (is (-> Test Assertion) + (|>> (random.result prng) + product.right + (function (_ _)) + "lux try" + (pipe.case + {try.#Success output} + output + + {try.#Failure error} + (..assertion (exception.error ..error_during_execution [error]) false)))) + state (is (Atom (Dictionary Nat [Tally Text])) + (atom.atom (dictionary.empty n.order))) + [read! write!] (is [Assertion + (async.Resolver [Tally Text])] + (async.async [])) _ (list#mix (function (_ test index) (exec (|> (run! test) diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index 425c1300b..b0bf5c94c 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -19,7 +19,7 @@ [number ["n" nat ("[1]#[0]" decimal)]]] [type - abstract]]] + [abstract {"-" pattern}]]]] [/ ["[0]" duration {"+" Duration}]]) @@ -81,23 +81,23 @@ (def: .public midnight Time - (:abstraction 0)) + (abstraction 0)) (def: .public (of_millis milli_seconds) (-> Nat (Try Time)) (if (n.< ..limit milli_seconds) - {try.#Success (:abstraction milli_seconds)} + {try.#Success (abstraction milli_seconds)} (exception.except ..time_exceeds_a_day [milli_seconds]))) (def: .public millis (-> Time Nat) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (Equivalence Time) (def: (= param subject) - (n.= (:representation param) (:representation subject)))) + (n.= (representation param) (representation subject)))) (implementation: .public order (Order Time) @@ -105,7 +105,7 @@ (def: &equivalence ..equivalence) (def: (< param subject) - (n.< (:representation param) (:representation subject)))) + (n.< (representation param) (representation subject)))) (`` (implementation: .public enum (Enum Time) @@ -113,20 +113,20 @@ (def: &order ..order) (def: succ - (|>> :representation ++ (n.% ..limit) :abstraction)) + (|>> representation ++ (n.% ..limit) abstraction)) (def: pred - (|>> :representation + (|>> representation (pipe.case 0 ..limit millis millis) -- - :abstraction)))) + abstraction)))) (def: .public parser (Parser Time) - (let [millis (: (-> Duration Nat) - (|>> duration.millis .nat)) + (let [millis (is (-> Duration Nat) + (|>> duration.millis .nat)) hour (millis duration.hour) minute (millis duration.minute) second (millis duration.second) @@ -138,7 +138,7 @@ _ (<text>.this ..separator) utc_second ..second_parser utc_millis ..millis_parser] - (in (:abstraction + (in (abstraction ($_ n.+ (n.* utc_hour hour) (n.* utc_minute minute) diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index 50d190331..c79e12d32 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -23,7 +23,7 @@ ["n" nat ("[1]#[0]" decimal)] ["i" int]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // "_" ["[1][0]" year {"+" Year}] ["[1][0]" month {"+" Month}]]) @@ -80,7 +80,7 @@ (if (..invalid_day? year month day_of_month) (exception.except ..invalid_day [year month day_of_month]) {try.#Success - (:abstraction + (abstraction [#year year #month month #day day_of_month])})) @@ -95,7 +95,7 @@ (template [<name> <type> <field>] [(def: .public <name> (-> Date <type>) - (|>> :representation (the <field>)))] + (|>> representation (the <field>)))] [year Year #year] [month Month #month] @@ -106,8 +106,8 @@ (Equivalence Date) (def: (= reference sample) - (let [reference (:representation reference) - sample (:representation sample)] + (let [reference (representation reference) + sample (representation sample)] (and (# //year.equivalence = (the #year reference) (the #year sample)) @@ -123,8 +123,8 @@ (def: &equivalence ..equivalence) (def: (< reference sample) - (let [reference (:representation reference) - sample (:representation sample)] + (let [reference (representation reference) + sample (representation sample)] (or (# //year.order < (the #year reference) (the #year sample)) @@ -277,7 +277,7 @@ (def: (civil_year utc_month utc_year) (-> Nat Year Int) (let [... Coercing, because the year is already in external form. - utc_year (:as Int utc_year)] + utc_year (as Int utc_year)] (if (n.< ..first_month_of_civil_year utc_month) (-- utc_year) utc_year))) @@ -336,7 +336,7 @@ year)] ... Coercing, because the year is already in internal form. (try.trusted - (..date (:as Year year) + (..date (as Year year) (maybe.trusted (dictionary.value month ..month_by_number)) day)))) diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index dc2e66fc2..2a2d00771 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -1,43 +1,43 @@ (.using - [library - [lux "*" - [abstract - [equivalence {"+" Equivalence}] - [order {"+" Order}] - [enum {"+" Enum}] - [codec {"+" Codec}] - [monoid {"+" Monoid}] - [monad {"+" do}]] - [control - ["[0]" try] - ["<>" parser - ["<[0]>" text {"+" Parser}]]] - [data - ["[0]" text ("[1]#[0]" monoid)]] - [math - [number - ["i" int] - ["[0]" nat ("[1]#[0]" decimal)]]] - [type - abstract]]] - ["[0]" // "_" - ["[1][0]" year]]) + [library + [lux "*" + [abstract + [equivalence {"+" Equivalence}] + [order {"+" Order}] + [enum {"+" Enum}] + [codec {"+" Codec}] + [monoid {"+" Monoid}] + [monad {"+" do}]] + [control + ["[0]" try] + ["<>" parser + ["<[0]>" text {"+" Parser}]]] + [data + ["[0]" text ("[1]#[0]" monoid)]] + [math + [number + ["i" int] + ["[0]" nat ("[1]#[0]" decimal)]]] + [type + [abstract {"-" pattern}]]]] + ["[0]" // "_" + ["[1][0]" year]]) (abstract: .public Duration Int (def: .public of_millis (-> Int Duration) - (|>> :abstraction)) + (|>> abstraction)) (def: .public millis (-> Duration Int) - (|>> :representation)) + (|>> representation)) (template [<op> <name>] [(def: .public (<name> param subject) (-> Duration Duration Duration) - (:abstraction (<op> (:representation param) (:representation subject))))] + (abstraction (<op> (representation param) (representation subject))))] [i.+ merged] [i.% framed] @@ -46,7 +46,7 @@ (template [<op> <name>] [(def: .public (<name> scalar) (-> Nat Duration Duration) - (|>> :representation (<op> (.int scalar)) :abstraction))] + (|>> representation (<op> (.int scalar)) abstraction))] [i.* up] [i./ down] @@ -54,29 +54,29 @@ (def: .public inverse (-> Duration Duration) - (|>> :representation (i.* -1) :abstraction)) + (|>> representation (i.* -1) abstraction)) (def: .public (ticks param subject) (-> Duration Duration Int) - (i./ (:representation param) (:representation subject))) + (i./ (representation param) (representation subject))) (implementation: .public equivalence (Equivalence Duration) (def: (= param subject) - (i.= (:representation param) (:representation subject)))) + (i.= (representation param) (representation subject)))) (implementation: .public order (Order Duration) (def: &equivalence ..equivalence) (def: (< param subject) - (i.< (:representation param) (:representation subject)))) + (i.< (representation param) (representation subject)))) (template [<op> <name>] [(def: .public <name> (-> Duration Bit) - (|>> :representation (<op> +0)))] + (|>> representation (<op> +0)))] [i.> positive?] [i.< negative?] @@ -154,15 +154,15 @@ (def: parser (Parser Duration) - (let [section (: (-> Text Text (Parser Nat)) - (function (_ suffix false_suffix) - (|> (<text>.many <text>.decimal) - (<>.codec nat.decimal) - (<>.before (case false_suffix - "" (<text>.this suffix) - _ (<>.after (<>.not (<text>.this false_suffix)) - (<text>.this suffix)))) - (<>.else 0))))] + (let [section (is (-> Text Text (Parser Nat)) + (function (_ suffix false_suffix) + (|> (<text>.many <text>.decimal) + (<>.codec nat.decimal) + (<>.before (case false_suffix + "" (<text>.this suffix) + _ (<>.after (<>.not (<text>.this false_suffix)) + (<text>.this suffix)))) + (<>.else 0))))] (do <>.monad [sign (<>.or (<text>.this ..negative_sign) (<text>.this ..positive_sign)) diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index c83d994e4..b48836c7e 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -22,7 +22,7 @@ ["i" int] ["f" frac]]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // {"+" Time} ["[0]" duration {"+" Duration}] ["[0]" year {"+" Year}] @@ -35,40 +35,40 @@ (def: .public of_millis (-> Int Instant) - (|>> :abstraction)) + (|>> abstraction)) (def: .public millis (-> Instant Int) - (|>> :representation)) + (|>> representation)) (def: .public (span from to) (-> Instant Instant Duration) - (duration.of_millis (i.- (:representation from) (:representation to)))) + (duration.of_millis (i.- (representation from) (representation to)))) (def: .public (after duration instant) (-> Duration Instant Instant) - (:abstraction (i.+ (duration.millis duration) (:representation instant)))) + (abstraction (i.+ (duration.millis duration) (representation instant)))) (def: .public (relative instant) (-> Instant Duration) - (|> instant :representation duration.of_millis)) + (|> instant representation duration.of_millis)) (def: .public (absolute offset) (-> Duration Instant) - (|> offset duration.millis :abstraction)) + (|> offset duration.millis abstraction)) (implementation: .public equivalence (Equivalence Instant) (def: (= param subject) - (# i.equivalence = (:representation param) (:representation subject)))) + (# i.equivalence = (representation param) (representation subject)))) (implementation: .public order (Order Instant) (def: &equivalence ..equivalence) (def: (< param subject) - (# i.order < (:representation param) (:representation subject)))) + (# i.order < (representation param) (representation subject)))) (`` (implementation: .public enum (Enum Instant) @@ -76,7 +76,7 @@ (def: &order ..order) (~~ (template [<name>] [(def: <name> - (|>> :representation (# i.enum <name>) :abstraction))] + (|>> representation (# i.enum <name>) abstraction))] [succ] [pred] )))) @@ -153,38 +153,38 @@ (io (..of_millis (for @.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") @.jvm (|> ("jvm member invoke static" [] "java.lang.System" "currentTimeMillis" []) ("jvm object cast") - (: (Primitive "java.lang.Long")) - (:as Int)) + (is (Primitive "java.lang.Long")) + (as Int)) @.js (let [date ("js object new" ("js constant" "Date") [])] (|> ("js object do" "getTime" date []) - (:as Frac) + (as Frac) "lux f64 i64")) @.python (let [time ("python import" "time")] (|> ("python object do" "time" time []) - (:as Frac) + (as Frac) (f.* +1,000.0) "lux f64 i64")) @.lua (|> ("lua apply" ("lua constant" "os.time") []) - (:as Int) + (as Int) (i.* +1,000)) @.ruby (let [% ("ruby constant" "Time") % ("ruby object do" "now" % [])] (|> ("ruby object do" "to_f" % []) - (:as Frac) + (as Frac) (f.* +1,000.0) "lux f64 i64")) @.php (|> ("php constant" "time") "php apply" - (:as Int) + (as Int) (i.* +1,000)) @.scheme (|> ("scheme constant" "current-second") - (:as Int) + (as Int) (i.* +1,000) ("scheme apply" ("scheme constant" "exact")) ("scheme apply" ("scheme constant" "truncate"))) @.common_lisp (|> ("common_lisp constant" "get-universal-time") "common_lisp apply" - (:as Int) + (as Int) (i.* +1,000)) )))) diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux index 09ad9e42d..26924080e 100644 --- a/stdlib/source/library/lux/time/year.lux +++ b/stdlib/source/library/lux/time/year.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}] - [codec {"+" Codec}] - [equivalence {"+" Equivalence}] - [order {"+" Order}]] - [control - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["<>" parser - ["<[0]>" text {"+" Parser}]]] - [data - ["[0]" text ("[1]#[0]" monoid)]] - [math - [number - ["n" nat ("[1]#[0]" decimal)] - ["i" int ("[1]#[0]" decimal)]]] - [type - abstract]]]) + [library + [lux "*" + [abstract + [monad {"+" do}] + [codec {"+" Codec}] + [equivalence {"+" Equivalence}] + [order {"+" Order}]] + [control + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + ["<>" parser + ["<[0]>" text {"+" Parser}]]] + [data + ["[0]" text ("[1]#[0]" monoid)]] + [math + [number + ["n" nat ("[1]#[0]" decimal)] + ["i" int ("[1]#[0]" decimal)]]] + [type + [abstract {"-" pattern}]]]]) (def: (internal year) (-> Int Int) @@ -42,15 +42,15 @@ (-> Int (Try Year)) (case value +0 (exception.except ..there_is_no_year_0 []) - _ {try.#Success (:abstraction (..internal value))})) + _ {try.#Success (abstraction (..internal value))})) (def: .public value (-> Year Int) - (|>> :representation ..external)) + (|>> representation ..external)) (def: .public epoch Year - (:abstraction +1970)) + (abstraction +1970)) ) (def: .public days diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 48a1fb475..9f615c86e 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -146,7 +146,7 @@ (do ///phase.monad [_ (///directive.lifted_analysis (moduleA.set_compiled module)) - analysis_module (<| (: (Operation .Module)) + analysis_module (<| (is (Operation .Module)) ///directive.lifted_analysis extension.lifted meta.current_module) @@ -276,7 +276,7 @@ ///.#process (function (_ state archive) (again (<| (///phase.result' state) (do [! ///phase.monad] - [analysis_module (<| (: (Operation .Module)) + [analysis_module (<| (is (Operation .Module)) ///directive.lifted_analysis extension.lifted meta.current_module) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index b4c2a8be8..0a69b7995 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -29,7 +29,7 @@ ["_" binary {"+" Writer}]]] ["[0]" meta ["[0]" configuration {"+" Configuration}]] - [type {"+" :sharing} + [type {"+" sharing} ["[0]" check]] [world ["[0]" file {"+" Path}] @@ -89,8 +89,8 @@ ... TODO: Get rid of this (def: monad - (:as (Monad Action) - (try.with async.monad))) + (as (Monad Action) + (try.with async.monad))) (with_expansions [<Platform> (as_is (Platform <type_vars>)) <State+> (as_is (///directive.State+ <type_vars>)) @@ -113,23 +113,23 @@ (-> context.Context <Platform> module.ID (Key document) (Writer document) (archive.Entry document) (Async (Try Any)))) (let [system (the #&file_system platform) - write_artifact! (: (-> [artifact.ID (Maybe Text) Binary] (Action Any)) - (function (_ [artifact_id custom content]) - (cache/artifact.cache! system context @module artifact_id content)))] + write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] (Action Any)) + (function (_ [artifact_id custom content]) + (cache/artifact.cache! system context @module artifact_id content)))] (do [! ..monad] - [_ (: (Async (Try Any)) - (cache/module.enable! async.monad system context @module)) + [_ (is (Async (Try Any)) + (cache/module.enable! async.monad system context @module)) _ (for @.python (|> entry (the archive.#output) sequence.list (list.sub 128) (monad.each ! (monad.each ! write_artifact!)) - (: (Action (List (List Any))))) + (is (Action (List (List Any))))) (|> entry (the archive.#output) sequence.list (monad.each ..monad write_artifact!) - (: (Action (List Any))))) + (is (Action (List Any))))) document (# async.monad in (document.marked? key (the [archive.#module module.#document] entry)))] (|> [(|> entry @@ -203,22 +203,22 @@ .Lux <State+> (Try <State+>))) - (|> (:sharing [<type_vars>] - <State+> - state - - (///directive.Operation <type_vars> Any) - (do [! ///phase.monad] - [_ (///directive.lifted_analysis - (do ! - [_ (///analysis.set_state analysis_state)] - (extension.with extender analysers))) - _ (///directive.lifted_synthesis - (extension.with extender synthesizers)) - _ (///directive.lifted_generation - (extension.with extender (:expected generators))) - _ (extension.with extender (:expected directives))] - (in []))) + (|> (sharing [<type_vars>] + <State+> + state + + (///directive.Operation <type_vars> Any) + (do [! ///phase.monad] + [_ (///directive.lifted_analysis + (do ! + [_ (///analysis.set_state analysis_state)] + (extension.with extender analysers))) + _ (///directive.lifted_synthesis + (extension.with extender synthesizers)) + _ (///directive.lifted_generation + (extension.with extender (as_expected generators))) + _ (extension.with extender (as_expected directives))] + (in []))) (///phase.result' state) (# try.monad each product.left))) @@ -270,23 +270,23 @@ (the #host platform) (the #phase platform) generation_bundle)] - _ (: (Async (Try Any)) - (cache.enable! async.monad (the #&file_system platform) context)) + _ (is (Async (Try Any)) + (cache.enable! async.monad (the #&file_system platform) context)) [archive analysis_state bundles] (ioW.thaw (list) compilation_configuration (the #host platform) (the #&file_system platform) context import compilation_sources) .let [with_missing_extensions - (: (All (_ <type_vars>) - (-> <Platform> (Program expression directive) <State+> - (Async (Try [///phase.Wrapper <State+>])))) - (function (_ platform program state) - (async#in - (do try.monad - [[state phase_wrapper] (..phase_wrapper archive platform state)] - (|> state - (initialize_state (extender phase_wrapper) - (:expected (..complete_extensions host_directive_bundle phase_wrapper (:expected bundles))) - analysis_state) - (try#each (|>> (//init.with_default_directives expander host_analysis program anchorT,expressionT,directiveT (extender phase_wrapper)) - [phase_wrapper])))))))]] + (is (All (_ <type_vars>) + (-> <Platform> (Program expression directive) <State+> + (Async (Try [///phase.Wrapper <State+>])))) + (function (_ platform program state) + (async#in + (do try.monad + [[state phase_wrapper] (..phase_wrapper archive platform state)] + (|> state + (initialize_state (extender phase_wrapper) + (as_expected (..complete_extensions host_directive_bundle phase_wrapper (as_expected bundles))) + analysis_state) + (try#each (|>> (//init.with_default_directives expander host_analysis program anchorT,expressionT,directiveT (extender phase_wrapper)) + [phase_wrapper])))))))]] (if (archive.archived? archive descriptor.runtime) (do ! [[phase_wrapper state] (with_missing_extensions platform program state)] @@ -345,26 +345,26 @@ (def: (depend module import dependence) (-> descriptor.Module descriptor.Module Dependence Dependence) - (let [transitive_dependency (: (-> (-> Dependence Mapping) descriptor.Module (Set descriptor.Module)) - (function (_ lens module) - (|> dependence - lens - (dictionary.value module) - (maybe.else ..empty)))) + (let [transitive_dependency (is (-> (-> Dependence Mapping) descriptor.Module (Set descriptor.Module)) + (function (_ lens module) + (|> dependence + lens + (dictionary.value module) + (maybe.else ..empty)))) transitive_depends_on (transitive_dependency (the #depends_on) import) transitive_depended_by (transitive_dependency (the #depended_by) module) - update_dependence (: (-> [descriptor.Module (Set descriptor.Module)] [descriptor.Module (Set descriptor.Module)] - (-> Mapping Mapping)) - (function (_ [source forward] [target backward]) - (function (_ mapping) - (let [with_dependence+transitives - (|> mapping - (dictionary.revised' source ..empty (set.has target)) - (dictionary.revised source (set.union forward)))] - (list#mix (function (_ previous) - (dictionary.revised' previous ..empty (set.has target))) - with_dependence+transitives - (set.list backward))))))] + update_dependence (is (-> [descriptor.Module (Set descriptor.Module)] [descriptor.Module (Set descriptor.Module)] + (-> Mapping Mapping)) + (function (_ [source forward] [target backward]) + (function (_ mapping) + (let [with_dependence+transitives + (|> mapping + (dictionary.revised' source ..empty (set.has target)) + (dictionary.revised source (set.union forward)))] + (list#mix (function (_ previous) + (dictionary.revised' previous ..empty (set.has target))) + with_dependence+transitives + (set.list backward))))))] (|> dependence (revised #depends_on (update_dependence @@ -377,13 +377,13 @@ (def: (circular_dependency? module import dependence) (-> descriptor.Module descriptor.Module Dependence Bit) - (let [dependence? (: (-> descriptor.Module (-> Dependence Mapping) descriptor.Module Bit) - (function (_ from relationship to) - (let [targets (|> dependence - relationship - (dictionary.value from) - (maybe.else ..empty))] - (set.member? targets to))))] + (let [dependence? (is (-> descriptor.Module (-> Dependence Mapping) descriptor.Module Bit) + (function (_ from relationship to) + (let [targets (|> dependence + relationship + (dictionary.value from) + (maybe.else ..empty))] + (set.member? targets to))))] (or (dependence? import (the #depends_on) module) (dependence? module (the #depended_by) import)))) @@ -495,74 +495,74 @@ (-> Lux_Context (-> Lux_Compiler Lux_Importer))) (let [current (stm.var initial) - pending (:sharing [<type_vars>] - Lux_Context - initial - - (Var (Dictionary descriptor.Module Lux_Pending)) - (:expected (stm.var (dictionary.empty text.hash)))) - dependence (: (Var Dependence) - (stm.var ..independence))] + pending (sharing [<type_vars>] + Lux_Context + initial + + (Var (Dictionary descriptor.Module Lux_Pending)) + (as_expected (stm.var (dictionary.empty text.hash)))) + dependence (is (Var Dependence) + (stm.var ..independence))] (function (_ compile) (function (import! customs importer module) (do [! async.monad] - [[return signal] (:sharing [<type_vars>] - Lux_Context - initial - - (Async [Lux_Return (Maybe [Lux_Context - module.ID - Lux_Signal])]) - (:expected - (stm.commit! - (do [! stm.monad] - [dependence (if (text#= descriptor.runtime importer) - (stm.read dependence) - (do ! - [[_ dependence] (stm.update (..depend importer module) dependence)] - (in dependence)))] - (case (..verify_dependencies importer module dependence) - {try.#Failure error} - (in [(async.resolved {try.#Failure error}) - {.#None}]) - - {try.#Success _} - (do ! - [[archive state] (stm.read current)] - (if (archive.archived? archive module) - (in [(async#in {try.#Success [archive state]}) - {.#None}]) - (do ! - [@pending (stm.read pending)] - (case (dictionary.value module @pending) - {.#Some [return signal]} - (in [return - {.#None}]) - - {.#None} - (case (if (archive.reserved? archive module) - (do try.monad - [@module (archive.id module archive)] - (in [@module archive])) - (archive.reserve module archive)) - {try.#Success [@module archive]} - (do ! - [_ (stm.write [archive state] current) - .let [[return signal] (:sharing [<type_vars>] - Lux_Context - initial - - Lux_Pending - (async.async []))] - _ (stm.update (dictionary.has module [return signal]) pending)] - (in [return - {.#Some [[archive state] - @module - signal]}])) - - {try.#Failure error} - (in [(async#in {try.#Failure error}) - {.#None}]))))))))))) + [[return signal] (sharing [<type_vars>] + Lux_Context + initial + + (Async [Lux_Return (Maybe [Lux_Context + module.ID + Lux_Signal])]) + (as_expected + (stm.commit! + (do [! stm.monad] + [dependence (if (text#= descriptor.runtime importer) + (stm.read dependence) + (do ! + [[_ dependence] (stm.update (..depend importer module) dependence)] + (in dependence)))] + (case (..verify_dependencies importer module dependence) + {try.#Failure error} + (in [(async.resolved {try.#Failure error}) + {.#None}]) + + {try.#Success _} + (do ! + [[archive state] (stm.read current)] + (if (archive.archived? archive module) + (in [(async#in {try.#Success [archive state]}) + {.#None}]) + (do ! + [@pending (stm.read pending)] + (case (dictionary.value module @pending) + {.#Some [return signal]} + (in [return + {.#None}]) + + {.#None} + (case (if (archive.reserved? archive module) + (do try.monad + [@module (archive.id module archive)] + (in [@module archive])) + (archive.reserve module archive)) + {try.#Success [@module archive]} + (do ! + [_ (stm.write [archive state] current) + .let [[return signal] (sharing [<type_vars>] + Lux_Context + initial + + Lux_Pending + (async.async []))] + _ (stm.update (dictionary.has module [return signal]) pending)] + (in [return + {.#Some [[archive state] + @module + signal]}])) + + {try.#Failure error} + (in [(async#in {try.#Failure error}) + {.#None}]))))))))))) _ (case signal {.#None} (in []) @@ -600,23 +600,23 @@ .let [additions (|> modules (list#each product.left) (set.of_list text.hash)) - with_modules (: (All (_ <type_vars>) - (-> <State+> <State+>)) - (revised [extension.#state - ///directive.#analysis - ///directive.#state - extension.#state] - (: (All (_ a) (-> a a)) - (function (_ analysis_state) - (|> analysis_state - (:as .Lux) - (revised .#modules (function (_ current) - (list#composite (list.only (|>> product.left - (set.member? additions) - not) - current) - modules))) - :expected)))))] + with_modules (is (All (_ <type_vars>) + (-> <State+> <State+>)) + (revised [extension.#state + ///directive.#analysis + ///directive.#state + extension.#state] + (is (All (_ a) (-> a a)) + (function (_ analysis_state) + (|> analysis_state + (as .Lux) + (revised .#modules (function (_ current) + (list#composite (list.only (|>> product.left + (set.member? additions) + not) + current) + modules))) + as_expected)))))] state (monad.mix ! with_all_extensions state extended_states)] (in (with_modules state)))) @@ -633,18 +633,18 @@ ... This might not be the case in the future. (def: (with_new_dependencies new_dependencies all_dependencies) (-> (List descriptor.Module) (Set descriptor.Module) [(Set descriptor.Module) (Set descriptor.Module)]) - (let [[all_dependencies duplicates _] (: [(Set descriptor.Module) (Set descriptor.Module) Bit] - (list#mix (function (_ new [all duplicates seen_prelude?]) - (if (set.member? all new) - (if (text#= .prelude_module new) - (if seen_prelude? - [all (set.has new duplicates) seen_prelude?] - [all duplicates true]) - [all (set.has new duplicates) seen_prelude?]) - [(set.has new all) duplicates seen_prelude?])) - (: [(Set descriptor.Module) (Set descriptor.Module) Bit] - [all_dependencies ..empty (set.empty? all_dependencies)]) - new_dependencies))] + (let [[all_dependencies duplicates _] (is [(Set descriptor.Module) (Set descriptor.Module) Bit] + (list#mix (function (_ new [all duplicates seen_prelude?]) + (if (set.member? all new) + (if (text#= .prelude_module new) + (if seen_prelude? + [all (set.has new duplicates) seen_prelude?] + [all duplicates true]) + [all (set.has new duplicates) seen_prelude?]) + [(set.has new all) duplicates seen_prelude?])) + (is [(Set descriptor.Module) (Set descriptor.Module) Bit] + [all_dependencies ..empty (set.empty? all_dependencies)]) + new_dependencies))] [all_dependencies duplicates])) (def: (any|after_imports customs import! module duplicates new_dependencies archive) @@ -713,8 +713,8 @@ (function (_ customs importer import! @module [archive state] module) (loop [[archive state] [archive state] compilation custom_compilation - all_dependencies (: (Set descriptor.Module) - (set.of_list text.hash (list)))] + all_dependencies (is (Set descriptor.Module) + (set.of_list text.hash (list)))] (do [! (try.with async.monad)] [.let [new_dependencies (the ///.#dependencies compilation) [all_dependencies duplicates] (with_new_dependencies new_dependencies all_dependencies)] @@ -723,13 +723,13 @@ {try.#Success [state more|done]} (case more|done {.#Left more} - (let [continue! (:sharing [state document object] - (///.Compilation state document object) - custom_compilation - - (-> (..Context state) (///.Compilation state document object) (Set descriptor.Module) - (..Return state)) - (:expected again))] + (let [continue! (sharing [state document object] + (///.Compilation state document object) + custom_compilation + + (-> (..Context state) (///.Compilation state document object) (Set descriptor.Module) + (..Return state)) + (as_expected again))] (continue! [archive state] more all_dependencies)) {.#Right entry} @@ -753,8 +753,8 @@ (function (_ customs importer import! @module [archive state] module) (loop [[archive state] [archive (..set_current_module module state)] compilation compilation - all_dependencies (: (Set descriptor.Module) - (set.of_list text.hash (list)))] + all_dependencies (is (Set descriptor.Module) + (set.of_list text.hash (list)))] (do [! (try.with async.monad)] [.let [new_dependencies (the ///.#dependencies compilation) [all_dependencies duplicates] (with_new_dependencies new_dependencies all_dependencies)] @@ -763,13 +763,13 @@ {try.#Success [state more|done]} (case more|done {.#Left more} - (let [continue! (:sharing [<type_vars>] - <Platform> - platform - - (-> Lux_Context (///.Compilation <State+> .Module Any) (Set descriptor.Module) - (Action [Archive <State+>])) - (:expected again))] + (let [continue! (sharing [<type_vars>] + <Platform> + platform + + (-> Lux_Context (///.Compilation <State+> .Module Any) (Set descriptor.Module) + (Action [Archive <State+>])) + (as_expected again))] (continue! [archive state] more all_dependencies)) {.#Right entry} @@ -784,7 +784,7 @@ (console.write_line report console)) <else>))) .let [entry (has [archive.#module module.#descriptor descriptor.#references] all_dependencies entry)] - _ (..cache_module context platform @module $.key $.writer (:as (archive.Entry .Module) entry))] + _ (..cache_module context platform @module $.key $.writer (as (archive.Entry .Module) entry))] (async#in (do try.monad [archive (archive.has module entry archive)] (in [archive @@ -820,8 +820,8 @@ compilation_sources (the context.#host_module_extension context) module)] - (loop [customs (for @.old (:as (List (///.Custom Fake_State Fake_Document Fake_Object)) - all_customs) + (loop [customs (for @.old (as (List (///.Custom Fake_State Fake_Document Fake_Object)) + all_customs) all_customs)] (case customs {.#End} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index d5b883eed..f237ebeae 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -22,24 +22,24 @@ ... TODO: Not just from this parser, but from the lux.Module type. (def: .public writer (Writer .Module) - (let [definition (: (Writer Definition) - ($_ _.and _.bit _.type _.any)) - labels (: (Writer [Text (List Text)]) - (_.and _.text (_.list _.text))) - global_type (: (Writer [Bit Type (Either [Text (List Text)] - [Text (List Text)])]) - ($_ _.and _.bit _.type (_.or labels labels))) - global_label (: (Writer .Label) - ($_ _.and _.bit _.type (_.list _.text) _.nat)) - alias (: (Writer Alias) - (_.and _.text _.text)) - global (: (Writer Global) - ($_ _.or - definition - global_type - global_label - global_label - alias))] + (let [definition (is (Writer Definition) + ($_ _.and _.bit _.type _.any)) + labels (is (Writer [Text (List Text)]) + (_.and _.text (_.list _.text))) + global_type (is (Writer [Bit Type (Either [Text (List Text)] + [Text (List Text)])]) + ($_ _.and _.bit _.type (_.or labels labels))) + global_label (is (Writer .Label) + ($_ _.and _.bit _.type (_.list _.text) _.nat)) + alias (is (Writer Alias) + (_.and _.text _.text)) + global (is (Writer Global) + ($_ _.or + definition + global_type + global_label + global_label + alias))] ($_ _.and ... #module_hash _.nat @@ -54,38 +54,38 @@ (def: .public parser (Parser .Module) - (let [definition (: (Parser Definition) - ($_ <>.and - <binary>.bit - <binary>.type - <binary>.any)) - labels (: (Parser [Text (List Text)]) - ($_ <>.and - <binary>.text - (<binary>.list <binary>.text))) - global_type (: (Parser [Bit Type (Either [Text (List Text)] - [Text (List Text)])]) + (let [definition (is (Parser Definition) ($_ <>.and <binary>.bit <binary>.type - (<binary>.or labels labels))) - global_label (: (Parser .Label) + <binary>.any)) + labels (is (Parser [Text (List Text)]) + ($_ <>.and + <binary>.text + (<binary>.list <binary>.text))) + global_type (is (Parser [Bit Type (Either [Text (List Text)] + [Text (List Text)])]) ($_ <>.and <binary>.bit <binary>.type - (<binary>.list <binary>.text) - <binary>.nat)) - alias (: (Parser Alias) - ($_ <>.and - <binary>.text - <binary>.text)) - global (: (Parser Global) - ($_ <binary>.or - definition - global_type - global_label - global_label - alias))] + (<binary>.or labels labels))) + global_label (is (Parser .Label) + ($_ <>.and + <binary>.bit + <binary>.type + (<binary>.list <binary>.text) + <binary>.nat)) + alias (is (Parser Alias) + ($_ <>.and + <binary>.text + <binary>.text)) + global (is (Parser Global) + ($_ <binary>.or + definition + global_type + global_label + global_label + alias))] ($_ <>.and ... #module_hash <binary>.nat diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index 1828747ab..24c60d5fa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -160,8 +160,8 @@ (def: .public (reification analysis) (-> Analysis (Reification Analysis)) (loop [abstraction analysis - inputs (: (List Analysis) - (list))] + inputs (is (List Analysis) + (list))] (.case abstraction {#Apply input next} (again next {.#Item input inputs}) @@ -377,5 +377,5 @@ .#seed 0 .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux index 9c2aa022e..0484b5941 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/coverage.lux @@ -367,26 +367,26 @@ ... merges can be done. [_ {#Alt leftS rightS}] (do [! try.monad] - [.let [fuse_once (: (-> Coverage (List Coverage) - (Try [(Maybe Coverage) - (List Coverage)])) - (function (_ coverageA possibilitiesSF) - (loop [altsSF possibilitiesSF] - (case altsSF - {.#End} - (in [{.#None} (list coverageA)]) - - {.#Item altSF altsSF'} - (do ! - [altMSF (composite coverageA altSF)] - (case altMSF - {#Alt _} - (do ! - [[success altsSF+] (again altsSF')] - (in [success {.#Item altSF altsSF+}])) - - _ - (in [{.#Some altMSF} altsSF'])))))))]] + [.let [fuse_once (is (-> Coverage (List Coverage) + (Try [(Maybe Coverage) + (List Coverage)])) + (function (_ coverageA possibilitiesSF) + (loop [altsSF possibilitiesSF] + (case altsSF + {.#End} + (in [{.#None} (list coverageA)]) + + {.#Item altSF altsSF'} + (do ! + [altMSF (composite coverageA altSF)] + (case altMSF + {#Alt _} + (do ! + [[success altsSF+] (again altsSF')] + (in [success {.#Item altSF altsSF+}])) + + _ + (in [{.#Some altMSF} altsSF'])))))))]] (loop [addition addition possibilitiesSF (alternatives so_far)] (do ! diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux index 3ca408bea..de22db2db 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/evaluation.lux @@ -1,7 +1,7 @@ (.using [library [lux "*" - [type {"+" :sharing}] + [type {"+" sharing}] ["[0]" meta] [abstract [monad {"+" do}]] @@ -62,12 +62,12 @@ [exprS (|> exprA (synthesisP.phase archive) (phase.result synthesis_state))]) (phase.result generation_state) (do phase.monad - [@module (:sharing [anchor expression artifact] - (generation.Phase anchor expression artifact) - generate + [@module (sharing [anchor expression artifact] + (generation.Phase anchor expression artifact) + generate - (generation.Operation anchor expression artifact module.ID) - (generation.module_id module archive)) + (generation.Operation anchor expression artifact module.ID) + (generation.module_id module archive)) .let [[evals _] (io.run! (atom.update! (dictionary.revised' @module 0 ++) ..evals)) @eval (maybe.else 0 (dictionary.value @module evals))] exprO (<| (generation.with_registry_shift (|> @module 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 0d22a6790..1a95a5a2c 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 @@ -99,8 +99,8 @@ [self_name meta.current_module_name] (function (_ state) {try.#Success [(revised .#modules - (plist.revised self_name (revised .#module_aliases (: (-> (List [Text Text]) (List [Text Text])) - (|>> {.#Item [alias module]})))) + (plist.revised self_name (revised .#module_aliases (is (-> (List [Text Text]) (List [Text Text])) + (|>> {.#Item [alias module]})))) state) []]})))) @@ -127,8 +127,8 @@ {try.#Success [(revised .#modules (plist.has self_name (revised .#definitions - (: (-> (List [Text Global]) (List [Text Global])) - (|>> {.#Item [name definition]})) + (is (-> (List [Text Global]) (List [Text Global])) + (|>> {.#Item [name definition]})) self)) state) []]} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux index 42ccf412d..6902cd718 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/scope.lux @@ -90,15 +90,15 @@ {.#Item top_outer _} (let [[ref_type init_ref] (maybe.else (undefined) (..reference name top_outer)) - [ref inner'] (list#mix (: (-> Scope [Variable (List Scope)] [Variable (List Scope)]) - (function (_ scope ref+inner) - [{variable.#Foreign (the [.#captured .#counter] scope)} - {.#Item (revised .#captured - (: (-> Foreign Foreign) - (|>> (revised .#counter ++) - (revised .#mappings (plist.has name [ref_type (product.left ref+inner)])))) - scope) - (product.right ref+inner)}])) + [ref inner'] (list#mix (is (-> Scope [Variable (List Scope)] [Variable (List Scope)]) + (function (_ scope ref+inner) + [{variable.#Foreign (the [.#captured .#counter] scope)} + {.#Item (revised .#captured + (is (-> Foreign Foreign) + (|>> (revised .#counter ++) + (revised .#mappings (plist.has name [ref_type (product.left ref+inner)])))) + scope) + (product.right ref+inner)}])) [init_ref {.#End}] (list.reversed inner)) scopes (list#composite inner' outer)] @@ -117,9 +117,9 @@ (let [old_mappings (the [.#locals .#mappings] head) new_var_id (the [.#locals .#counter] head) new_head (revised .#locals - (: (-> Local Local) - (|>> (revised .#counter ++) - (revised .#mappings (plist.has name [type new_var_id])))) + (is (-> Local Local) + (|>> (revised .#counter ++) + (revised .#mappings (plist.has name [type new_var_id])))) head)] (case (phase.result' [bundle (has .#scopes {.#Item new_head tail} state)] action) @@ -142,9 +142,9 @@ (def: empty Scope - (let [bindings (: Bindings - [.#counter 0 - .#mappings (list)])] + (let [bindings (is Bindings + [.#counter 0 + .#mappings (list)])] [.#name (list) .#inner 0 .#locals bindings diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux index 724d85a24..b215fa8b0 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/type.lux @@ -84,7 +84,7 @@ ... (if (n.< (the .#var_counter post) ... pre#var_counter) ... (do ! - ... [.let [new! (: (-> [Nat (Maybe Type)] (Maybe Nat)) + ... [.let [new! (is (-> [Nat (Maybe Type)] (Maybe Nat)) ... (function (_ [id _]) ... (if (n.< id pre#var_counter) ... {.#Some id} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux index 706603273..2b9f8b598 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -57,19 +57,19 @@ (type: .public (Host expression directive) (Interface - (: (-> unit.ID [(Maybe unit.ID) expression] (Try Any)) - evaluate) - (: (-> directive (Try Any)) - execute) - (: (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Try [Text Any directive])) - define) - - (: (-> unit.ID Binary directive) - ingest) - (: (-> unit.ID (Maybe Text) directive (Try Any)) - re_learn) - (: (-> unit.ID (Maybe Text) directive (Try Any)) - re_load))) + (is (-> unit.ID [(Maybe unit.ID) expression] (Try Any)) + evaluate) + (is (-> directive (Try Any)) + execute) + (is (-> unit.ID (Maybe Text) [(Maybe unit.ID) expression] (Try [Text Any directive])) + define) + + (is (-> unit.ID Binary directive) + ingest) + (is (-> unit.ID (Maybe Text) directive (Try Any)) + re_learn) + (is (-> unit.ID (Maybe Text) directive (Try Any)) + re_load))) (type: .public (State anchor expression directive) (Record diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux index c999697dd..a35c61eb3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -89,8 +89,8 @@ ... type-check the input with respect to the patterns. (def: .public (tuple :it:) (-> Type (Check [(List check.Var) Type])) - (loop [envs (: (List (List Type)) - (list)) + (loop [envs (is (List (List Type)) + (list)) :it: :it:] (.case :it: {.#Var id} @@ -167,8 +167,8 @@ {.#Product _} (let [matches (loop [types (type.flat_tuple :input:') patterns sub_patterns - output (: (List [Type Code]) - {.#End})] + output (is (List [Type Code]) + {.#End})] (.case [types patterns] [{.#End} {.#End}] output @@ -188,15 +188,15 @@ _ (undefined)))] (do ! - [[memberP+ thenA] (list#mix (: (All (_ a) - (-> [Type Code] (Operation [(List Pattern) a]) - (Operation [(List Pattern) a]))) - (function (_ [memberT memberC] then) - (do ! - [[memberP [memberP+ thenA]] ((:as (All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) + [[memberP+ thenA] (list#mix (is (All (_ a) + (-> [Type Code] (Operation [(List Pattern) a]) + (Operation [(List Pattern) a]))) + (function (_ [memberT memberC] then) + (do ! + [[memberP [memberP+ thenA]] ((as (All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) pattern_analysis) - {.#None} memberT memberC then)] - (in [(list& memberP memberP+) thenA])))) + {.#None} memberT memberC then)] + (in [(list& memberP memberP+) thenA])))) (do ! [nextA next] (in [(list) nextA])) @@ -253,13 +253,13 @@ (/.with_location location (do [! ///.monad] [record (//complex.normal true sub_patterns) - record_size,members,recordT (: (Operation (Maybe [Nat (List Code) Type])) - (.case record - {.#Some record} - (//complex.order true record) + record_size,members,recordT (is (Operation (Maybe [Nat (List Code) Type])) + (.case record + {.#Some record} + (//complex.order true record) - {.#None} - (in {.#None})))] + {.#None} + (in {.#None})))] (.case record_size,members,recordT {.#Some [record_size members recordT]} (do ! diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux index eb34d19c2..2a8279ae8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/complex.lux @@ -192,7 +192,7 @@ (-> Phase Type Archive (List Code) (Operation Analysis)) (<| (let [! ///.monad]) (# ! each (|>> /.tuple)) - (: (Operation (List Analysis))) + (is (Operation (List Analysis))) (loop [membersT+ (type.flat_tuple expectedT) membersC+ members] (case [membersT+ membersC+] @@ -293,8 +293,8 @@ (def: .public (normal pattern_matching? record) (-> Bit (List Code) (Operation (Maybe (List [Symbol Code])))) (loop [input record - output (: (List [Symbol Code]) - {.#End})] + output (is (List [Symbol Code]) + {.#End})] (case input (pattern (list& [_ {.#Symbol ["" slotH]}] valueH tail)) (if pattern_matching? @@ -352,8 +352,8 @@ {.#None} (/.except ..slot_does_not_belong_to_record [key recordT])))) - (: (Dictionary Nat Code) - (dictionary.empty n.hash)) + (is (Dictionary Nat Code) + (dictionary.empty n.hash)) record) .let [ordered_tuple (list#each (function (_ idx) (maybe.trusted (dictionary.value idx idx->val))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux index bfd85814a..eb3cfa9ba 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux @@ -87,7 +87,7 @@ (the [//extension.#state /.#synthesis /.#state] state) (the [//extension.#state /.#generation /.#state] state) (the [//extension.#state /.#generation /.#phase] state))) - extension_eval (:as Eval (wrapper (:expected compiler_eval)))] + extension_eval (as Eval (wrapper (as_expected compiler_eval)))] _ (//.with (has [//extension.#state /.#analysis /.#state //extension.#state .#eval] extension_eval state))] (case code (pattern [_ {.#Form (list& [_ {.#Text name}] inputs)}]) 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 6a8793379..ea51560df 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 @@ -416,18 +416,18 @@ {.#None} (do [! phase.monad] - [parametersJT (: (Operation (List (Type Parameter))) - (monad.each ! - (function (_ parameterT) - (do phase.monad - [parameterJT (jvm_type parameterT)] - (case (parser.parameter? parameterJT) - {.#Some parameterJT} - (in parameterJT) - - {.#None} - (/////analysis.except ..non_parameter parameterT)))) - parametersT))] + [parametersJT (is (Operation (List (Type Parameter))) + (monad.each ! + (function (_ parameterT) + (do phase.monad + [parameterJT (jvm_type parameterT)] + (case (parser.parameter? parameterJT) + {.#Some parameterJT} + (in parameterJT) + + {.#None} + (/////analysis.except ..non_parameter parameterT)))) + parametersT))] (in (jvm.class class parametersJT)))) {.#Ex _} @@ -869,10 +869,10 @@ (analyse archive exceptionC)) [exception_class _] (check_object exceptionT) ? (phase.lifted (reflection!.sub? class_loader "java.lang.Throwable" exception_class)) - _ (: (Operation Any) - (if ? - (in []) - (/////analysis.except non_throwable exception_class)))] + _ (is (Operation Any) + (if ? + (in []) + (/////analysis.except non_throwable exception_class)))] (in {/////analysis.#Extension extension_name (list exceptionA)})) _ @@ -932,7 +932,7 @@ {.#None} (if (java/lang/reflect/Modifier::isInterface (java/lang/Class::getModifiers source_class)) - {.#Item (:as java/lang/reflect/Type (ffi.class_for java/lang/Object)) + {.#Item (as java/lang/reflect/Type (ffi.class_for java/lang/Object)) (array.list {.#None} (java/lang/Class::getGenericInterfaces source_class))} (array.list {.#None} (java/lang/Class::getGenericInterfaces source_class))))))) @@ -963,50 +963,50 @@ [fromT fromA] (typeA.inferring (analyse archive fromC)) source_name (# ! each ..reflection (check_jvm fromT)) - can_cast? (: (Operation Bit) - (`` (cond (~~ (template [<primitive> <object>] - [(let [=primitive (reflection.reflection <primitive>)] - (or (and (text#= =primitive source_name) - (or (text#= <object> target_name) - (text#= =primitive target_name))) - (and (text#= <object> source_name) - (text#= =primitive target_name)))) - (in true)] - - [reflection.boolean box.boolean] - [reflection.byte box.byte] - [reflection.short box.short] - [reflection.int box.int] - [reflection.long box.long] - [reflection.float box.float] - [reflection.double box.double] - [reflection.char box.char])) - - ... else - (do ! - [_ (phase.assertion ..primitives_are_not_objects [source_name] - (not (dictionary.key? ..boxes source_name))) - _ (phase.assertion ..primitives_are_not_objects [target_name] - (not (dictionary.key? ..boxes target_name))) - target_class (phase.lifted (reflection!.load class_loader target_name)) - _ (do ! - [source_class (phase.lifted (reflection!.load class_loader source_name))] - (phase.assertion ..cannot_cast [fromT toT fromC] - (java/lang/Class::isAssignableFrom source_class target_class)))] - (loop [[current_name currentT] [source_name fromT]] - (if (text#= target_name current_name) - (in true) - (do ! - [candidate_parents (: (Operation (List [[Text .Type] Bit])) - (class_candidate_parents class_loader current_name currentT target_name target_class))] - (case (|> candidate_parents - (list.only product.right) - (list#each product.left)) - {.#Item [next_name nextT] _} - (again [next_name nextT]) - - {.#End} - (in false)))))))))] + can_cast? (is (Operation Bit) + (`` (cond (~~ (template [<primitive> <object>] + [(let [=primitive (reflection.reflection <primitive>)] + (or (and (text#= =primitive source_name) + (or (text#= <object> target_name) + (text#= =primitive target_name))) + (and (text#= <object> source_name) + (text#= =primitive target_name)))) + (in true)] + + [reflection.boolean box.boolean] + [reflection.byte box.byte] + [reflection.short box.short] + [reflection.int box.int] + [reflection.long box.long] + [reflection.float box.float] + [reflection.double box.double] + [reflection.char box.char])) + + ... else + (do ! + [_ (phase.assertion ..primitives_are_not_objects [source_name] + (not (dictionary.key? ..boxes source_name))) + _ (phase.assertion ..primitives_are_not_objects [target_name] + (not (dictionary.key? ..boxes target_name))) + target_class (phase.lifted (reflection!.load class_loader target_name)) + _ (do ! + [source_class (phase.lifted (reflection!.load class_loader source_name))] + (phase.assertion ..cannot_cast [fromT toT fromC] + (java/lang/Class::isAssignableFrom source_class target_class)))] + (loop [[current_name currentT] [source_name fromT]] + (if (text#= target_name current_name) + (in true) + (do ! + [candidate_parents (is (Operation (List [[Text .Type] Bit])) + (class_candidate_parents class_loader current_name currentT target_name target_class))] + (case (|> candidate_parents + (list.only product.right) + (list#each product.left)) + {.#Item [next_name nextT] _} + (again [next_name nextT]) + + {.#End} + (in false)))))))))] (if can_cast? (in {/////analysis.#Extension extension_name (list (/////analysis.text source_name) (/////analysis.text target_name) @@ -1150,13 +1150,13 @@ (case (parser.class? it) {.#Some [name parameters]} (|> parameters - (list#each (|>> again (:as (Type Parameter)))) + (list#each (|>> again (as (Type Parameter)))) (jvm.class name)) {.#None}) (~~ (template [<read> <as> <write>] [(case (<read> it) {.#Some :sub:} - (<write> (:as (Type <as>) (again :sub:))) + (<write> (as (Type <as>) (again :sub:))) {.#None})] [parser.array? Value jvm.array] @@ -1381,17 +1381,17 @@ java/lang/Class::getDeclaredMethods (array.list {.#None}) (list.only (|>> java/lang/reflect/Method::getName (text#= method_name))) - (monad.each ! (: (-> java/lang/reflect/Method (Operation Evaluation)) - (function (_ method) - (do ! - [.let [expected_method_tvars (method_type_variables method) - aliasing (dictionary.merged (..aliasing expected_class_tvars actual_class_tvars) - (..aliasing expected_method_tvars actual_method_tvars))] - passes? (check_method aliasing class method_name method_style inputsJT method)] - (# ! each (if passes? - (|>> {#Pass}) - (|>> {#Hint})) - (method_signature method_style method)))))))] + (monad.each ! (is (-> java/lang/reflect/Method (Operation Evaluation)) + (function (_ method) + (do ! + [.let [expected_method_tvars (method_type_variables method) + aliasing (dictionary.merged (..aliasing expected_class_tvars actual_class_tvars) + (..aliasing expected_method_tvars actual_method_tvars))] + passes? (check_method aliasing class method_name method_style inputsJT method)] + (# ! each (if passes? + (|>> {#Pass}) + (|>> {#Hint})) + (method_signature method_style method)))))))] (case (list.all pass! candidates) {.#Item method {.#End}} (in method) @@ -1732,9 +1732,9 @@ (template [<name>] [(exception: .public (<name> [expected (List [(Type Class) Text (Type Method)]) actual (List [(Type Class) Text (Type Method)])]) - (let [%method (: (%.Format [(Type Class) Text (Type Method)]) - (function (_ [super name type]) - (format (..signature super) " :: " (%.text name) " " (..signature type))))] + (let [%method (is (%.Format [(Type Class) Text (Type Method)]) + (function (_ [super name type]) + (format (..signature super) " :: " (%.text name) " " (..signature type))))] (exception.report "Expected Methods" (exception.listing %method expected) "Actual Methods" (exception.listing %method actual))))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 6c3e7c9fc..a85e87d85 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -167,7 +167,7 @@ (case args (pattern (list typeC valueC)) (do [! ////.monad] - [actualT (# ! each (|>> (:as Type)) + [actualT (# ! each (|>> (as Type)) (eval archive Type typeC)) _ (typeA.inference actualT)] (<| (typeA.expecting actualT) @@ -182,7 +182,7 @@ (case args (pattern (list typeC valueC)) (do [! ////.monad] - [actualT (# ! each (|>> (:as Type)) + [actualT (# ! each (|>> (as Type)) (eval archive Type typeC)) _ (typeA.inference actualT) [valueT valueA] (typeA.inferring @@ -219,7 +219,7 @@ (case input_type (^.or {.#Definition [exported? def_type def_value]} {.#Type [exported? def_value labels]}) - (in (:as Type def_value)) + (in (as Type def_value)) (^.or {.#Tag _} {.#Slot _}) 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 a35443c11..0ec22f549 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 @@ -452,7 +452,7 @@ (list#mix (function (_ [lux_register type] [jvm_register before]) (let [[jvm_register' after] (method_argument (n.+ offset lux_register) type jvm_register)] [jvm_register' ($_ _.composite before after)])) - (: [Register (Bytecode Any)] [offset (_#in [])])) + (is [Register (Bytecode Any)] [offset (_#in [])])) product.right)) (def: (constructor_method_generation archive super_class method) @@ -645,26 +645,26 @@ (-> (Method_Definition Code) (Operation [(Set unit.ID) (Resource Method)]))) (function (_ methodC) (do phase.monad - [methodA (: (Operation Analysis) - (directive.lifted_analysis - (case methodC - {#Constructor method} - (jvm.analyse_constructor_method analyse archive selfT mapping method) - - {#Virtual_Method method} - (jvm.analyse_virtual_method analyse archive selfT mapping method) - - {#Static_Method method} - (jvm.analyse_static_method analyse archive mapping method) - - {#Overriden_Method method} - (jvm.analyse_overriden_method analyse archive selfT mapping (list& super interfaces) method) - - {#Abstract_Method method} - (jvm.analyse_abstract_method analyse archive method)))) - methodS (: (Operation Synthesis) - (directive.lifted_synthesis - (synthesize archive methodA))) + [methodA (is (Operation Analysis) + (directive.lifted_analysis + (case methodC + {#Constructor method} + (jvm.analyse_constructor_method analyse archive selfT mapping method) + + {#Virtual_Method method} + (jvm.analyse_virtual_method analyse archive selfT mapping method) + + {#Static_Method method} + (jvm.analyse_static_method analyse archive mapping method) + + {#Overriden_Method method} + (jvm.analyse_overriden_method analyse archive selfT mapping (list& super interfaces) method) + + {#Abstract_Method method} + (jvm.analyse_abstract_method analyse archive method)))) + methodS (is (Operation Synthesis) + (directive.lifted_synthesis + (synthesize archive methodA))) dependencies (directive.lifted_generation (cache.dependencies archive methodS)) methodS' (|> methodS diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index a76c39427..16bd430fa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -28,7 +28,7 @@ [math [number ["n" nat]]] - ["[0]" type {"+" :sharing} ("[1]#[0]" equivalence) + ["[0]" type {"+" sharing} ("[1]#[0]" equivalence) ["[0]" check]]]] ["[0]" /// {"+" Extender} ["[1][0]" bundle] @@ -230,10 +230,10 @@ previous_analysis_extensions (the [/////directive.#analysis /////directive.#state ///.#bundle] state)]] (phase.with [bundle (revised [/////directive.#analysis /////directive.#state] - (: (-> /////analysis.State+ /////analysis.State+) - (|>> product.right - [(|> previous_analysis_extensions - (dictionary.merged (///analysis.bundle eval host_analysis)))])) + (is (-> /////analysis.State+ /////analysis.State+) + (|>> product.right + [(|> previous_analysis_extensions + (dictionary.merged (///analysis.bundle eval host_analysis)))])) state)]))) (def: (announce_definition! short type) @@ -254,7 +254,7 @@ [type valueT value] (..definition archive full_name {.#None} valueC) [_ _ exported?] (evaluate! archive Bit exported?C) _ (/////directive.lifted_analysis - (moduleA.define short_name {.#Definition [(:as Bit exported?) type value]})) + (moduleA.define short_name {.#Definition [(as Bit exported?) type value]})) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] (in /////directive.no_requirements)) @@ -284,7 +284,7 @@ (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [_ _ exported?] (evaluate! archive Bit exported?C) - .let [exported? (:as Bit exported?)] + .let [exported? (as Bit exported?)] [type valueT value] (..definition archive full_name {.#Some .Type} valueC) labels (/////directive.lifted_analysis (do phase.monad @@ -299,14 +299,14 @@ (moduleA.define short_name {.#Definition [exported? type value]}) {.#Item labels} - (moduleA.define short_name {.#Type [exported? (:as .Type value) (if record? - {.#Right labels} - {.#Left labels})]})) - _ (moduleA.declare_labels record? labels exported? (:as .Type value))] + (moduleA.define short_name {.#Type [exported? (as .Type value) (if record? + {.#Right labels} + {.#Left labels})]})) + _ (moduleA.declare_labels record? labels exported? (as .Type value))] (in labels))) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type) - _ (..announce_labels! labels (:as Type value))] + _ (..announce_labels! labels (as Type value))] (in /////directive.no_requirements)))])) (def: imports @@ -431,7 +431,7 @@ [target_platform (/////directive.lifted_analysis (///.lifted meta.target)) [_ _ name] (evaluate! archive Text nameC) - [_ handlerV] (<definer> archive (:as Text name) + [_ handlerV] (<definer> archive (as Text name) (let [raw_type (type <def_type>)] (case target_platform (^.or (pattern (static @.jvm)) @@ -445,15 +445,15 @@ (swapped binary.Binary Binary|DEFAULT raw_type))) valueC) _ (<| <scope> - (///.install extender (:as Text name)) - (:sharing [anchor expression directive] - (Handler anchor expression directive) - handler - - <type> - (:expected handlerV))) + (///.install extender (as Text name)) + (sharing [anchor expression directive] + (Handler anchor expression directive) + handler + + <type> + (as_expected handlerV))) _ (/////directive.lifted_generation - (/////generation.log! (format <description> " " (%.text (:as Text name)))))] + (/////generation.log! (format <description> " " (%.text (as Text name)))))] (in /////directive.no_requirements)) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux index 61f03e588..987ae0104 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux @@ -1,42 +1,42 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["[0]" try] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" dictionary] - ["[0]" set] - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - [number - ["f" frac]]] - ["@" target - ["_" common_lisp {"+" Expression}]]]] - ["[0]" //// "_" - ["/" bundle] - ["/[1]" // "_" - ["[0]" extension] - [generation - [extension {"+" Nullary Unary Binary Trinary - nullary unary binary trinary}] - ["[0]" reference] - ["//" common_lisp "_" - ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] - ["[1][0]" case]]] - [// - ["[0]" synthesis {"+" %synthesis}] - ["[0]" generation] - [/// - ["[1]" phase]]]]]) + [library + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["[0]" try] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" dictionary] + ["[0]" set] + ["[0]" list ("[1]#[0]" functor mix)]]] + [math + [number + ["f" frac]]] + ["@" target + ["_" common_lisp {"+" Expression}]]]] + ["[0]" //// "_" + ["/" bundle] + ["/[1]" // "_" + ["[0]" extension] + [generation + [extension {"+" Nullary Unary Binary Trinary + nullary unary binary trinary}] + ["[0]" reference] + ["//" common_lisp "_" + ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] + ["[1][0]" case]]] + [// + ["[0]" synthesis {"+" %synthesis}] + ["[0]" generation] + [/// + ["[1]" phase]]]]]) (def: .public (custom [parser handler]) (All (_ s) @@ -67,7 +67,7 @@ ... [@input (# ! each _.var (generation.symbol "input")) ... inputG (phase archive input) ... elseG (phase archive else) -... conditionalsG (: (Operation (List [Expression Expression])) +... conditionalsG (is (Operation (List [Expression Expression])) ... (monad.each ! (function (_ [chars branch]) ... (do ! ... [branchG (phase archive branch)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux index 8f4bec35c..121fd29fa 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/common.lux @@ -105,7 +105,7 @@ {synthesis.#Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] - (in (:as Statement body))) + (in (as Statement body))) (^.template [<tag>] [(pattern (<tag> value)) @@ -159,21 +159,21 @@ (do [! /////.monad] [inputG (phase archive input) else! (..statement phase archive else) - conditionals! (: (Operation (List [(List Literal) - Statement])) - (monad.each ! (function (_ [chars branch]) - (do ! - [branch! (..statement phase archive branch)] - (in [(list#each (|>> .int _.int) chars) - branch!]))) - conditionals))] + conditionals! (is (Operation (List [(List Literal) + Statement])) + (monad.each ! (function (_ [chars branch]) + (do ! + [branch! (..statement phase archive branch)] + (in [(list#each (|>> .int _.int) chars) + branch!]))) + conditionals))] ... (in (_.apply/* (_.closure (list) ... (_.switch (_.the //runtime.i64_low_field inputG) ... conditionals! ... {.#Some (_.return else!)})) ... (list))) - (in (<| (:as Expression) - (: Statement) + (in (<| (as Expression) + (is Statement) (_.switch (_.the //runtime.i64_low_field inputG) conditionals! {.#Some else!})))))])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux index 9f6f59ab9..77908df35 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/js/host.lux @@ -132,9 +132,9 @@ (function (_ extension phase archive [arity abstractionS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) - .let [variable (: (-> Text (Operation Var)) - (|>> generation.symbol - (# ! each _.var)))] + .let [variable (is (-> Text (Operation Var)) + (|>> generation.symbol + (# ! each _.var)))] g!inputs (monad.each ! (function (_ _) (variable "input")) (list.repeated (.nat arity) [])) g!abstraction (variable "abstraction")] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux index aa59d8b01..becc799b6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/common.lux @@ -106,20 +106,20 @@ [@end ///runtime.forge_label inputG (phase archive inputS) elseG (phase archive elseS) - conditionalsG+ (: (Operation (List [(List [S4 Label]) - (Bytecode Any)])) - (monad.each ! (function (_ [chars branch]) - (do ! - [branchG (phase archive branch) - @branch ///runtime.forge_label] - (in [(list#each (function (_ char) - [(try.trusted (signed.s4 (.int char))) @branch]) - chars) - ($_ _.composite - (_.set_label @branch) - branchG - (_.when_continuous (_.goto @end)))]))) - conditionalsS)) + conditionalsG+ (is (Operation (List [(List [S4 Label]) + (Bytecode Any)])) + (monad.each ! (function (_ [chars branch]) + (do ! + [branchG (phase archive branch) + @branch ///runtime.forge_label] + (in [(list#each (function (_ char) + [(try.trusted (signed.s4 (.int char))) @branch]) + chars) + ($_ _.composite + (_.set_label @branch) + branchG + (_.when_continuous (_.goto @end)))]))) + conditionalsS)) .let [table (|> conditionalsG+ (list#each product.left) list#conjoint) @@ -154,7 +154,7 @@ (def: bundle::lux Bundle - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "syntax char case!" ..lux::syntax_char_case!) (/////bundle.install "is" (binary ..lux::is)) (/////bundle.install "try" (unary ..lux::try)))) @@ -266,7 +266,7 @@ (def: bundle::i64 Bundle (<| (/////bundle.prefix "i64") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "and" (binary ..i64::and)) (/////bundle.install "or" (binary ..i64::or)) (/////bundle.install "xor" (binary ..i64::xor)) @@ -285,7 +285,7 @@ (def: bundle::f64 Bundle (<| (/////bundle.prefix "f64") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "+" (binary ..f64::+)) (/////bundle.install "-" (binary ..f64::-)) (/////bundle.install "*" (binary ..f64::*)) @@ -368,7 +368,7 @@ (def: bundle::text Bundle (<| (/////bundle.prefix "text") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "=" (binary ..text::=)) (/////bundle.install "<" (binary ..text::<)) (/////bundle.install "concat" (binary ..text::concat)) @@ -400,7 +400,7 @@ (def: bundle::io Bundle (<| (/////bundle.prefix "io") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "log" (unary ..io::log)) (/////bundle.install "error" (unary ..io::error))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux index a89e094ea..081984baf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/jvm/host.lux @@ -135,7 +135,7 @@ (def: bundle::conversion Bundle (<| (/////bundle.prefix "conversion") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "double-to-float" (unary conversion::double_to_float)) (/////bundle.install "double-to-int" (unary conversion::double_to_int)) (/////bundle.install "double-to-long" (unary conversion::double_to_long)) @@ -271,7 +271,7 @@ (def: bundle::int Bundle (<| (/////bundle.prefix (reflection.reflection reflection.int)) - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "+" (binary int::+)) (/////bundle.install "-" (binary int::-)) (/////bundle.install "*" (binary int::*)) @@ -290,7 +290,7 @@ (def: bundle::long Bundle (<| (/////bundle.prefix (reflection.reflection reflection.long)) - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "+" (binary long::+)) (/////bundle.install "-" (binary long::-)) (/////bundle.install "*" (binary long::*)) @@ -309,7 +309,7 @@ (def: bundle::float Bundle (<| (/////bundle.prefix (reflection.reflection reflection.float)) - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "+" (binary float::+)) (/////bundle.install "-" (binary float::-)) (/////bundle.install "*" (binary float::*)) @@ -322,7 +322,7 @@ (def: bundle::double Bundle (<| (/////bundle.prefix (reflection.reflection reflection.double)) - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "+" (binary double::+)) (/////bundle.install "-" (binary double::-)) (/////bundle.install "*" (binary double::*)) @@ -335,7 +335,7 @@ (def: bundle::char Bundle (<| (/////bundle.prefix (reflection.reflection reflection.char)) - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "=" (binary char::=)) (/////bundle.install "<" (binary char::<)) ))) @@ -634,7 +634,7 @@ (def: bundle::object Bundle (<| (/////bundle.prefix "object") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "null" (nullary object::null)) (/////bundle.install "null?" (unary object::null?)) (/////bundle.install "synchronized" (binary object::synchronized)) @@ -790,17 +790,17 @@ (def: bundle::member Bundle (<| (/////bundle.prefix "member") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (dictionary.merged (<| (/////bundle.prefix "get") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "static" get::static) (/////bundle.install "virtual" get::virtual)))) (dictionary.merged (<| (/////bundle.prefix "put") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "static" put::static) (/////bundle.install "virtual" put::virtual)))) (dictionary.merged (<| (/////bundle.prefix "invoke") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "static" invoke::static) (/////bundle.install "virtual" invoke::virtual) (/////bundle.install "special" invoke::special) @@ -832,7 +832,7 @@ hidden [_ {//////synthesis.#Control {//////synthesis.#Branch {//////synthesis.#Case _ path}}}] - (loop [path (: Path path)] + (loop [path (is Path path)] (case path {//////synthesis.#Seq _ next} (again next) @@ -1133,9 +1133,9 @@ ($_ _.composite before after)])) - (: [Register (Bytecode Any)] - [offset - (_#in [])])) + (is [Register (Bytecode Any)] + [offset + (_#in [])])) product.right)) (def: (normalized_method global_mapping [environment method]) @@ -1241,7 +1241,7 @@ (def: bundle::class Bundle (<| (/////bundle.prefix "class") - (|> (: Bundle /////bundle.empty) + (|> (is Bundle /////bundle.empty) (/////bundle.install "anonymous" class::anonymous) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux index e8be23f6c..bb9c71927 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux @@ -66,7 +66,7 @@ {synthesis.#Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] - (in (:as Statement body))) + (in (as Statement body))) (^.template [<tag>] [(pattern (<tag> value)) @@ -138,7 +138,7 @@ {synthesis.#Then else}) [input] (//case.case! statement phase archive) - (# /////.monad each (|>> (:as Expression)))))])) + (# /////.monad each (|>> (as Expression)))))])) (def: lux_procs Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux index 23469d067..74540b895 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/host.lux @@ -1,37 +1,37 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - [collection - ["[0]" dictionary] - ["[0]" list]] - [text - ["%" format {"+" format}]]] - [target - ["_" lua {"+" Var Expression}]]]] - ["[0]" // "_" - ["[1][0]" common {"+" custom}] - ["//[1]" /// "_" - ["/" bundle] + [library + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + [collection + ["[0]" dictionary] + ["[0]" list]] + [text + ["%" format {"+" format}]]] + [target + ["_" lua {"+" Var Expression}]]]] + ["[0]" // "_" + ["[1][0]" common {"+" custom}] + ["//[1]" /// "_" + ["/" bundle] + ["/[1]" // "_" + ["[0]" extension] + [generation + [extension {"+" Nullary Unary Binary Trinary + nullary unary binary trinary}] + ["[0]" reference] + ["//" lua "_" + ["[1][0]" runtime {"+" Operation Phase Handler Bundle + with_vars}]]] ["/[1]" // "_" - ["[0]" extension] - [generation - [extension {"+" Nullary Unary Binary Trinary - nullary unary binary trinary}] - ["[0]" reference] - ["//" lua "_" - ["[1][0]" runtime {"+" Operation Phase Handler Bundle - with_vars}]]] - ["/[1]" // "_" - ["[0]" generation] - ["//[1]" /// "_" - ["[1][0]" phase]]]]]]) + ["[0]" generation] + ["//[1]" /// "_" + ["[1][0]" phase]]]]]]) (def: array::new (Unary Expression) @@ -170,9 +170,9 @@ (function (_ extension phase archive [arity abstractionS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) - .let [variable (: (-> Text (Operation Var)) - (|>> generation.symbol - (# ! each _.var)))] + .let [variable (is (-> Text (Operation Var)) + (|>> generation.symbol + (# ! each _.var)))] g!inputs (monad.each ! (function (_ _) (variable "input")) (list.repeated (.nat arity) []))] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux index 503b85252..2e6338e37 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux @@ -1,42 +1,42 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["[0]" try] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" dictionary] - ["[0]" set] - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - [number - ["f" frac]]] - ["@" target - ["_" php {"+" Expression}]]]] - ["[0]" //// "_" - ["/" bundle] - ["/[1]" // "_" - ["[0]" extension] - [generation - [extension {"+" Nullary Unary Binary Trinary - nullary unary binary trinary}] - ["[0]" reference] - ["//" php "_" - ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] - ["[1][0]" case]]] - [// - ["[0]" synthesis {"+" %synthesis}] - ["[0]" generation] - [/// - ["[1]" phase]]]]]) + [library + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["[0]" try] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" dictionary] + ["[0]" set] + ["[0]" list ("[1]#[0]" functor mix)]]] + [math + [number + ["f" frac]]] + ["@" target + ["_" php {"+" Expression}]]]] + ["[0]" //// "_" + ["/" bundle] + ["/[1]" // "_" + ["[0]" extension] + [generation + [extension {"+" Nullary Unary Binary Trinary + nullary unary binary trinary}] + ["[0]" reference] + ["//" php "_" + ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] + ["[1][0]" case]]] + [// + ["[0]" synthesis {"+" %synthesis}] + ["[0]" generation] + [/// + ["[1]" phase]]]]]) (def: .public (custom [parser handler]) (All (_ s) @@ -68,19 +68,19 @@ [[context_module context_artifact] elseG] (generation.with_new_context archive (phase archive else)) @input (# ! each _.var (generation.symbol "input")) - conditionalsG (: (Operation (List [Expression Expression])) - (monad.each ! (function (_ [chars branch]) - (do ! - [branchG (phase archive branch)] - (in [(|> chars - (list#each (|>> .int _.int (_.=== @input))) - (list#mix (function (_ clause total) - (if (same? _.null total) - clause - (_.or clause total))) - _.null)) - branchG]))) - conditionals)) + conditionalsG (is (Operation (List [Expression Expression])) + (monad.each ! (function (_ [chars branch]) + (do ! + [branchG (phase archive branch)] + (in [(|> chars + (list#each (|>> .int _.int (_.=== @input))) + (list#mix (function (_ clause total) + (if (same? _.null total) + clause + (_.or clause total))) + _.null)) + branchG]))) + conditionals)) .let [foreigns (|> conditionals (list#each (|>> product.right synthesis.path/then //case.dependencies)) (list& (//case.dependencies (synthesis.path/then else))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux index 481eefce0..dc6845bc8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux @@ -52,7 +52,7 @@ {synthesis.#Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] - (in (:as (Statement Any) body))) + (in (as (Statement Any) body))) (^.template [<tag>] [(pattern (<tag> value)) @@ -114,20 +114,20 @@ [inputG (phase archive input) else! (..statement phase archive else) @input (# ! each _.var (generation.symbol "input")) - conditionals! (: (Operation (List [(Expression Any) - (Statement Any)])) - (monad.each ! (function (_ [chars branch]) - (do ! - [branch! (..statement phase archive branch)] - (in [(|> chars - (list#each (|>> .int _.int (_.= @input))) - (list#mix (function (_ clause total) - (if (same? _.none total) - clause - (_.or clause total))) - _.none)) - branch!]))) - conditionals)) + conditionals! (is (Operation (List [(Expression Any) + (Statement Any)])) + (monad.each ! (function (_ [chars branch]) + (do ! + [branch! (..statement phase archive branch)] + (in [(|> chars + (list#each (|>> .int _.int (_.= @input))) + (list#mix (function (_ clause total) + (if (same? _.none total) + clause + (_.or clause total))) + _.none)) + branch!]))) + conditionals)) ... .let [dependencies (//case.dependencies (list#mix (function (_ right left) ... (synthesis.path/seq left right)) ... (synthesis.path/then input) @@ -147,8 +147,8 @@ ... _ (generation.save! (product.right artifact_id) {.#None} closure) ] ... (in (_.apply/* @closure dependencies)) - (in (<| (:as (Expression Any)) - (: (Statement Any)) + (in (<| (as (Expression Any)) + (is (Statement Any)) ($_ _.then (_.set (list @input) inputG) (list#mix (function (_ [test then!] else!) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux index fa18710f9..72ade0f7d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/host.lux @@ -132,9 +132,9 @@ (function (_ extension phase archive [arity abstractionS]) (do [! ////////phase.monad] [abstractionG (phase archive abstractionS) - .let [variable (: (-> Text (Operation SVar)) - (|>> generation.symbol - (# ! each _.var)))] + .let [variable (is (-> Text (Operation SVar)) + (|>> generation.symbol + (# ! each _.var)))] g!inputs (monad.each ! (function (_ _) (variable "input")) (list.repeated (.nat arity) []))] (in (_.lambda g!inputs diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux index 492d9954f..e3beeba75 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux @@ -1,42 +1,42 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["[0]" try] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" dictionary] - ["[0]" set] - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - [number - ["f" frac]]] - ["@" target - ["_" r {"+" Expression}]]]] - ["[0]" //// "_" - ["/" bundle] - ["/[1]" // "_" - ["[0]" extension] - [generation - [extension {"+" Nullary Unary Binary Trinary - nullary unary binary trinary}] - ["[0]" reference] - ["//" r "_" - ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] - ["[1][0]" case]]] - [// - ["[0]" synthesis {"+" %synthesis}] - ["[0]" generation] - [/// - ["[1]" phase]]]]]) + [library + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["[0]" try] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" dictionary] + ["[0]" set] + ["[0]" list ("[1]#[0]" functor mix)]]] + [math + [number + ["f" frac]]] + ["@" target + ["_" r {"+" Expression}]]]] + ["[0]" //// "_" + ["/" bundle] + ["/[1]" // "_" + ["[0]" extension] + [generation + [extension {"+" Nullary Unary Binary Trinary + nullary unary binary trinary}] + ["[0]" reference] + ["//" r "_" + ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] + ["[1][0]" case]]] + [// + ["[0]" synthesis {"+" %synthesis}] + ["[0]" generation] + [/// + ["[1]" phase]]]]]) (def: .public (custom [parser handler]) (All (_ s) @@ -67,7 +67,7 @@ ... ... [@input (# ! each _.var (generation.symbol "input")) ... ... inputG (phase archive input) ... ... elseG (phase archive else) -... ... conditionalsG (: (Operation (List [Expression Expression])) +... ... conditionalsG (is (Operation (List [Expression Expression])) ... ... (monad.each ! (function (_ [chars branch]) ... ... (do ! ... ... [branchG (phase archive branch)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux index 7f71e4292..37a202c9f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux @@ -63,8 +63,8 @@ {synthesis.#Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] - (in (:as Statement - body))) + (in (as Statement + body))) (^.template [<tag>] [(pattern (<tag> value)) @@ -113,19 +113,19 @@ [inputG (phase archive input) else! (statement phase archive else) @input (# ! each _.local (generation.symbol "input")) - conditionals! (: (Operation (List [Expression Statement])) - (monad.each ! (function (_ [chars branch]) - (do ! - [branch! (statement phase archive branch)] - (in [(|> chars - (list#each (|>> .int _.int (_.= @input))) - (list#mix (function (_ clause total) - (if (same? _.nil total) - clause - (_.or clause total))) - _.nil)) - branch!]))) - conditionals)) + conditionals! (is (Operation (List [Expression Statement])) + (monad.each ! (function (_ [chars branch]) + (do ! + [branch! (statement phase archive branch)] + (in [(|> chars + (list#each (|>> .int _.int (_.= @input))) + (list#mix (function (_ clause total) + (if (same? _.nil total) + clause + (_.or clause total))) + _.nil)) + branch!]))) + conditionals)) ... .let [closure (_.lambda {.#None} (list @input) ... (list#mix (function (_ [test then] else) ... (_.if test (_.return then) else)) @@ -133,8 +133,8 @@ ... conditionals!))] ] ... (in (_.apply_lambda/* (list inputG) closure)) - (in (<| (:as Expression) - (: Statement) + (in (<| (as Expression) + (is Statement) ($_ _.then (_.set (list @input) inputG) (list#mix (function (_ [test then!] else!) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux index e11fc7aa6..53b71239f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/host.lux @@ -1,41 +1,41 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - [collection - ["[0]" dictionary] - ["[0]" list]] - [text - ["%" format {"+" format}]]] - [target - ["_" ruby {"+" Var Expression}]]]] - ["[0]" // "_" - ["[1][0]" common {"+" custom}] - ["//[1]" /// "_" - ["/" bundle] + [library + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + [collection + ["[0]" dictionary] + ["[0]" list]] + [text + ["%" format {"+" format}]]] + [target + ["_" ruby {"+" Var Expression}]]]] + ["[0]" // "_" + ["[1][0]" common {"+" custom}] + ["//[1]" /// "_" + ["/" bundle] + ["/[1]" // "_" + ["[0]" extension] + [generation + [extension {"+" Nullary Unary Binary Trinary + nullary unary binary trinary}] + ["[0]" reference] + ["//" ruby "_" + ["[1][0]" runtime {"+" Operation Phase Handler Bundle + with_vars}]]] ["/[1]" // "_" - ["[0]" extension] - [generation - [extension {"+" Nullary Unary Binary Trinary - nullary unary binary trinary}] - ["[0]" reference] - ["//" ruby "_" - ["[1][0]" runtime {"+" Operation Phase Handler Bundle - with_vars}]]] - ["/[1]" // "_" - ["[0]" generation] - ["//[1]" /// "_" - ["[1][0]" phase]]]]]]) + ["[0]" generation] + ["//[1]" /// "_" + ["[1][0]" phase]]]]]]) (def: (array::new [size]) (Unary Expression) - (_.do "new" (list size) {.#None} (: _.CVar (_.manual "Array")))) + (_.do "new" (list size) {.#None} (is _.CVar (_.manual "Array")))) (def: array::length (Unary Expression) @@ -104,7 +104,7 @@ (custom [<s>.text (function (_ extension phase archive name) - (# ////////phase.monad in (: _.CVar (_.manual name))))])) + (# ////////phase.monad in (is _.CVar (_.manual name))))])) (def: ruby::apply (custom diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux index d55e5056a..6aa4e52b1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux @@ -1,42 +1,42 @@ (.using - [library - [lux "*" - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["[0]" try] - ["<>" parser - ["<s>" synthesis {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" dictionary] - ["[0]" set] - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - [number - ["f" frac]]] - ["@" target - ["_" scheme {"+" Expression}]]]] - ["[0]" //// "_" - ["/" bundle] - ["/[1]" // "_" - ["[0]" extension] - [generation - [extension {"+" Nullary Unary Binary Trinary - nullary unary binary trinary}] - ["[0]" reference] - ["//" scheme "_" - ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] - ["[1][0]" case]]] - [// - ["[0]" synthesis {"+" %synthesis}] - ["[0]" generation] - [/// - ["[1]" phase]]]]]) + [library + [lux "*" + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["[0]" try] + ["<>" parser + ["<s>" synthesis {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" dictionary] + ["[0]" set] + ["[0]" list ("[1]#[0]" functor mix)]]] + [math + [number + ["f" frac]]] + ["@" target + ["_" scheme {"+" Expression}]]]] + ["[0]" //// "_" + ["/" bundle] + ["/[1]" // "_" + ["[0]" extension] + [generation + [extension {"+" Nullary Unary Binary Trinary + nullary unary binary trinary}] + ["[0]" reference] + ["//" scheme "_" + ["[1][0]" runtime {"+" Operation Phase Handler Bundle Generator}] + ["[1][0]" case]]] + [// + ["[0]" synthesis {"+" %synthesis}] + ["[0]" generation] + [/// + ["[1]" phase]]]]]) (def: .public (custom [parser handler]) (All (_ s) @@ -67,13 +67,13 @@ [@input (# ! each _.var (generation.symbol "input")) inputG (phase archive input) elseG (phase archive else) - conditionalsG (: (Operation (List [Expression Expression])) - (monad.each ! (function (_ [chars branch]) - (do ! - [branchG (phase archive branch)] - (in [(|> chars (list#each (|>> .int _.int (_.=/2 @input))) _.or) - branchG]))) - conditionals))] + conditionalsG (is (Operation (List [Expression Expression])) + (monad.each ! (function (_ [chars branch]) + (do ! + [branchG (phase archive branch)] + (in [(|> chars (list#each (|>> .int _.int (_.=/2 @input))) _.or) + branchG]))) + conditionals))] (in (_.let (list [@input inputG]) (list#mix (function (_ [test then] else) (_.if test then else)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux index 60b9cd96e..fbad56663 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux @@ -39,11 +39,11 @@ (def: .public register (-> Register Var/1) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register Var/1) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux index 2d18193e7..d91f824ad 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux @@ -1,33 +1,33 @@ (.using - [library - [lux {"-" function} - [abstract - ["[0]" monad {"+" do}]] - [control - pipe] - [data - ["[0]" product] - [text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [target - ["_" common_lisp {"+" Expression Var/1}]]]] - ["[0]" // "_" - ["[1][0]" runtime {"+" Operation Phase Generator}] + [library + [lux {"-" function} + [abstract + ["[0]" monad {"+" do}]] + [control + pipe] + [data + ["[0]" product] + [text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [target + ["_" common_lisp {"+" Expression Var/1}]]]] + ["[0]" // "_" + ["[1][0]" runtime {"+" Operation Phase Generator}] + ["[1][0]" reference] + ["[1][0]" case] + ["/[1]" // "_" ["[1][0]" reference] - ["[1][0]" case] - ["/[1]" // "_" - ["[1][0]" reference] + ["//[1]" /// "_" + [analysis {"+" Variant Tuple Abstraction Application Analysis}] + [synthesis {"+" Synthesis}] + ["[1][0]" generation {"+" Context}] ["//[1]" /// "_" - [analysis {"+" Variant Tuple Abstraction Application Analysis}] - [synthesis {"+" Synthesis}] - ["[1][0]" generation {"+" Context}] - ["//[1]" /// "_" - [arity {"+" Arity}] - ["[1][0]" phase ("[1]#[0]" monad)] - [reference - [variable {"+" Register Variable}]]]]]]) + [arity {"+" Arity}] + ["[1][0]" phase ("[1]#[0]" monad)] + [reference + [variable {"+" Register Variable}]]]]]]) (def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) @@ -38,7 +38,7 @@ (def: capture (-> Register Var/1) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: (with_closure inits function_definition) (-> (List (Expression Any)) (Expression Any) (Operation (Expression Any))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux index cca5cda23..4c3e03ca3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux @@ -38,7 +38,7 @@ (def: .public register (-> Register Var) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public (exec expression archive [this that]) (Generator [Synthesis Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux index a3fa9317d..26ac01808 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux @@ -42,7 +42,7 @@ (def: capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: (with_closure @self inits body!) (-> Var (List Expression) Statement [Statement Expression]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux index 85e221b18..5caa9c817 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/debug.lux @@ -1,17 +1,17 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - ["[0]" io {"+" IO}] - ["[0]" try {"+" Try}]] - [data - [binary {"+" Binary}] - [text - ["%" format {"+" format}]]] - [world - ["[0]" file {"+" File}]]]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + ["[0]" io {"+" IO}] + ["[0]" try {"+" Try}]] + [data + [binary {"+" Binary}] + [text + ["%" format {"+" format}]]] + [world + ["[0]" file {"+" File}]]]]) (def: extension ".class") @@ -20,8 +20,8 @@ (let [file_path (format name ..extension)] (do io.monad [outcome (do (try.with @) - [file (: (IO (Try (File IO))) - (file.get_file io.monad file.default file_path))] + [file (is (IO (Try (File IO))) + (file.get_file io.monad file.default file_path))] (# file over_write bytecode))] (in (case outcome {try.#Success definition} diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux index 1a0569fbc..7fd639b8f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function.lux @@ -73,19 +73,19 @@ (List (Resource Method)) (Bytecode Any)])) (let [classT (type.class class (list)) - fields (: (List (Resource Field)) - (list#composite (/foreign.variables environment) - (/partial.variables arity))) - methods (: (List (Resource Method)) - (list& (/init.method classT environment arity) - (/reset.method classT environment arity) - (if (arity.multiary? arity) - (|> (n.min arity /arity.maximum) - list.indices - (list#each (|>> ++ (/apply.method classT environment arity @begin body))) - (list& (/implementation.method classT arity @begin body))) - (list (/implementation.method classT arity @begin body) - (/apply.method classT environment arity @begin body 1)))))] + fields (is (List (Resource Field)) + (list#composite (/foreign.variables environment) + (/partial.variables arity))) + methods (is (List (Resource Method)) + (list& (/init.method classT environment arity) + (/reset.method classT environment arity) + (if (arity.multiary? arity) + (|> (n.min arity /arity.maximum) + list.indices + (list#each (|>> ++ (/apply.method classT environment arity @begin body))) + (list& (/implementation.method classT arity @begin body))) + (list (/implementation.method classT arity @begin body) + (/apply.method classT environment arity @begin body 1)))))] (do phase.monad [instance (/new.instance generate archive classT environment arity)] (in [fields methods instance])))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux index 14d2fdc03..e6734dfcb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/init.lux @@ -87,12 +87,12 @@ (def: .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) (let [environment_size (list.size environment) - offset_foreign (: (-> Register Register) - (n.+ 1)) - offset_arity (: (-> Register Register) - (|>> offset_foreign (n.+ environment_size))) - offset_partial (: (-> Register Register) - (|>> offset_arity (n.+ 1)))] + offset_foreign (is (-> Register Register) + (n.+ 1)) + offset_arity (is (-> Register Register) + (|>> offset_foreign (n.+ environment_size))) + offset_partial (is (-> Register Register) + (|>> offset_arity (n.+ 1)))] (method.method //.modifier ..name #0 (..type environment arity) (list) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux index 3edbe1e05..5087f0357 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/new.lux @@ -60,13 +60,13 @@ (def: .public (method class environment arity) (-> (Type Class) (Environment Synthesis) Arity (Resource Method)) - (let [after_this (: (-> Nat Nat) - (n.+ 1)) + (let [after_this (is (-> Nat Nat) + (n.+ 1)) environment_size (list.size environment) - after_environment (: (-> Nat Nat) - (|>> after_this (n.+ environment_size))) - after_arity (: (-> Nat Nat) - (|>> after_environment (n.+ 1)))] + after_environment (is (-> Nat Nat) + (|>> after_this (n.+ environment_size))) + after_arity (is (-> Nat Nat) + (|>> after_environment (n.+ 1)))] (method.method //.modifier //init.name #0 (//init.type environment arity) (list) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index ced3ea64a..d512d7050 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -147,7 +147,7 @@ (# io.monad each (function (_ library) (dictionary.key? library class_name))) (try.lifted io.monad) - (: (IO (Try Bit)))) + (is (IO (Try Bit)))) _ (if existing_class? (in []) (loader.store class_name class_bytecode library))] @@ -166,30 +166,30 @@ (io (let [library (loader.new_library []) loader (loader.memory library)] [loader - (: //runtime.Host - (implementation - (def: (evaluate context @it,valueG) - (# try.monad each product.left - (..evaluate! library loader (format "E" (//runtime.class_name context)) @it,valueG))) - - (def: execute - (..execute! library loader)) - - (def: define - (..define! library loader)) - - (def: (ingest context bytecode) - [(//runtime.class_name context) bytecode]) - - (def: (re_learn context custom [_ bytecode]) - (io.run! (loader.store (maybe.else (//runtime.class_name context) custom) bytecode library))) - - (def: (re_load context custom [directive_name bytecode]) - (io.run! - (do (try.with io.monad) - [.let [class_name (maybe.else (//runtime.class_name context) - custom)] - _ (loader.store class_name bytecode library) - class (loader.load class_name loader)] - (# io.monad in (..class_value class_name class))))) - ))]))) + (is //runtime.Host + (implementation + (def: (evaluate context @it,valueG) + (# try.monad each product.left + (..evaluate! library loader (format "E" (//runtime.class_name context)) @it,valueG))) + + (def: execute + (..execute! library loader)) + + (def: define + (..define! library loader)) + + (def: (ingest context bytecode) + [(//runtime.class_name context) bytecode]) + + (def: (re_learn context custom [_ bytecode]) + (io.run! (loader.store (maybe.else (//runtime.class_name context) custom) bytecode library))) + + (def: (re_load context custom [directive_name bytecode]) + (io.run! + (do (try.with io.monad) + [.let [class_name (maybe.else (//runtime.class_name context) + custom)] + _ (loader.store class_name bytecode library) + class (loader.load class_name loader)] + (# io.monad in (..class_value class_name class))))) + ))]))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux index 10f11edd9..21a10ad06 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/primitive.lux @@ -122,7 +122,7 @@ _ (let [constantI (if (i.= ..d0_bits - (java/lang/Double::doubleToRawLongBits (:as java/lang/Double value))) + (java/lang/Double::doubleToRawLongBits (as java/lang/Double value))) _.dconst_0 (_.double value))] (do _.monad diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux index 23ec9402e..2b761e907 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/program.lux @@ -92,16 +92,16 @@ _.iconst_2 (_.anewarray ^Object) ) - set_side! (: (-> (Bytecode Any) (Bytecode Any)) - (function (_ index) - ($_ _.composite - ... ?P - _.dup_x1 ... P?P - _.swap ... PP? - index ... PP?I - _.swap ... PPI? - _.aastore ... P - )))] + set_side! (is (-> (Bytecode Any) (Bytecode Any)) + (function (_ index) + ($_ _.composite + ... ?P + _.dup_x1 ... P?P + _.swap ... PP? + index ... PP?I + _.swap ... PPI? + _.aastore ... P + )))] ($_ _.composite ... RL empty_pair ... RLP diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux index 6031ed1db..789884c63 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/runtime.lux @@ -337,13 +337,13 @@ _.isub (_.int (i32.i32 (.i64 +1))) _.isub) - again (: (-> Label (Bytecode Any)) - (function (_ @) - ($_ _.composite - ... lefts, sumT - update_$variant ... lefts, sumT - update_$lefts ... sub_lefts - (_.goto @))))]] + again (is (-> Label (Bytecode Any)) + (function (_ @) + ($_ _.composite + ... lefts, sumT + update_$variant ... lefts, sumT + update_$lefts ... sub_lefts + (_.goto @))))]] ($_ _.composite $lefts (_.set_label @loop) @@ -399,12 +399,12 @@ update_$tuple ($_ _.composite $tuple $last_right _.aaload (_.checkcast //type.tuple) _.astore_0) - recur (: (-> Label (Bytecode Any)) - (function (_ @loop) - ($_ _.composite - update_$lefts - update_$tuple - (_.goto @loop)))) + recur (is (-> Label (Bytecode Any)) + (function (_ @loop) + ($_ _.composite + update_$lefts + update_$tuple + (_.goto @loop)))) left_projection::method (method.method ..modifier ..left_projection::name @@ -542,10 +542,10 @@ (def: generate_runtime (Operation [artifact.ID (Maybe Text) Binary]) (let [class (..reflection ..class) - modifier (: (Modifier Class) - ($_ modifier#composite - class.public - class.final)) + modifier (is (Modifier Class) + ($_ modifier#composite + class.public + class.final)) bytecode (<| (format.result class.writer) try.trusted (class.class jvm/version.v6_0 @@ -609,16 +609,16 @@ $partials (_.putfield //function.class //function/count.field //function/count.type) _.return))}) - modifier (: (Modifier Class) - ($_ modifier#composite - class.public - class.abstract)) + modifier (is (Modifier Class) + ($_ modifier#composite + class.public + class.abstract)) class (..reflection //function.class) - partial_count (: (Resource Field) - (field.field (modifier#composite field.public field.final) - //function/count.field - #0 //function/count.type - sequence.empty)) + partial_count (is (Resource Field) + (field.field (modifier#composite field.public field.final) + //function/count.field + #0 //function/count.type + sequence.empty)) bytecode (<| (format.result class.writer) try.trusted (class.class jvm/version.v6_0 diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux index 6d79e0750..2c35a85bd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux @@ -36,11 +36,11 @@ (def: .public register (-> Register Var) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (exec expression archive [this that]) (Generator [Synthesis Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux index ef4118721..bc3e2210d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux @@ -44,7 +44,7 @@ (def: capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: (with_closure inits @self @args body!) (-> (List Expression) Var (List Var) Statement [Statement Expression]) @@ -93,9 +93,9 @@ initialize_self! (list.indices arity)) pack (|>> (list) _.array) - unpack (: (-> Expression Expression) - (.function (_ it) - (_.apply (list it) (_.var "table.unpack")))) + unpack (is (-> Expression Expression) + (.function (_ it) + (_.apply (list it) (_.var "table.unpack")))) @var_args (_.var "...")] .let [[definition instantiation] (with_closure closureO+ @self (list @var_args) ($_ _.then diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux index 9409ab00f..57e35ab75 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/loop.lux @@ -91,26 +91,26 @@ locals (|> initsO+ list.enumeration (list#each (|>> product.left (n.+ start) //case.register))) - [directive instantiation] (: [Statement Expression] - (case (|> (synthesis.path/then bodyS) - //case.dependencies - (set.of_list _.hash) - (set.difference (set.of_list _.hash locals)) - set.list) - {.#End} - [(_.function @loop locals - scope!) - @loop] + [directive instantiation] (is [Statement Expression] + (case (|> (synthesis.path/then bodyS) + //case.dependencies + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) + set.list) + {.#End} + [(_.function @loop locals + scope!) + @loop] - foreigns - (let [@context (_.var (format (_.code @loop) "_context"))] - [(_.function @context foreigns - ($_ _.then - (<| (_.local_function @loop locals) - scope!) - (_.return @loop) - )) - (_.apply foreigns @context)])))] + foreigns + (let [@context (_.var (format (_.code @loop) "_context"))] + [(_.function @context foreigns + ($_ _.then + (<| (_.local_function @loop locals) + scope!) + (_.return @loop) + )) + (_.apply foreigns @context)])))] _ (/////generation.execute! directive) _ (/////generation.save! artifact_id {.#None} directive)] (in (_.apply initsO+ instantiation))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux index 595c313cf..761b34fab 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux @@ -38,11 +38,11 @@ (def: .public register (-> Register Var) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux index add7ae3e5..bd95510e2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux @@ -1,33 +1,33 @@ (.using - [library - [lux {"-" Global function} - [abstract - ["[0]" monad {"+" do}]] - [control - pipe] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [target - ["_" php {"+" Var Global Expression Argument Label Statement}]]]] - ["[0]" // "_" - ["[1][0]" runtime {"+" Operation Phase Phase! Generator}] + [library + [lux {"-" Global function} + [abstract + ["[0]" monad {"+" do}]] + [control + pipe] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + [target + ["_" php {"+" Var Global Expression Argument Label Statement}]]]] + ["[0]" // "_" + ["[1][0]" runtime {"+" Operation Phase Phase! Generator}] + ["[1][0]" reference] + ["[1][0]" case] + ["/[1]" // "_" ["[1][0]" reference] - ["[1][0]" case] - ["/[1]" // "_" - ["[1][0]" reference] + ["//[1]" /// "_" + [analysis {"+" Variant Tuple Abstraction Application Analysis}] + [synthesis {"+" Synthesis}] + ["[1][0]" generation {"+" Context}] ["//[1]" /// "_" - [analysis {"+" Variant Tuple Abstraction Application Analysis}] - [synthesis {"+" Synthesis}] - ["[1][0]" generation {"+" Context}] - ["//[1]" /// "_" - [arity {"+" Arity}] - ["[1][0]" phase ("[1]#[0]" monad)] - [reference - [variable {"+" Register Variable}]]]]]]) + [arity {"+" Arity}] + ["[1][0]" phase ("[1]#[0]" monad)] + [reference + [variable {"+" Register Variable}]]]]]]) (def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) @@ -38,7 +38,7 @@ (def: capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: input (|>> ++ //case.register)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux index 7fc0e8c4d..1f2d6253c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux @@ -1,37 +1,37 @@ (.using - [library - [lux {"-" Scope} - [abstract - ["[0]" monad {"+" do}]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor mix)] - ["[0]" set {"+" Set}]]] - [math - [number - ["n" nat]]] - [target - ["_" php {"+" Var Expression Label Statement}]]]] - ["[0]" // "_" - [runtime {"+" Operation Phase Phase! Generator Generator!}] - ["[1][0]" case] + [library + [lux {"-" Scope} + [abstract + ["[0]" monad {"+" do}]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor mix)] + ["[0]" set {"+" Set}]]] + [math + [number + ["n" nat]]] + [target + ["_" php {"+" Var Expression Label Statement}]]]] + ["[0]" // "_" + [runtime {"+" Operation Phase Phase! Generator Generator!}] + ["[1][0]" case] + ["/[1]" // "_" + ["[1][0]" reference] ["/[1]" // "_" - ["[1][0]" reference] + [synthesis + ["[0]" case]] ["/[1]" // "_" - [synthesis - ["[0]" case]] - ["/[1]" // "_" - ["[0]"synthesis {"+" Scope Synthesis}] - ["[1][0]" generation] - ["//[1]" /// "_" - ["[1][0]" phase] - [meta - [archive {"+" Archive}]] - [reference - [variable {"+" Register}]]]]]]]) + ["[0]"synthesis {"+" Scope Synthesis}] + ["[1][0]" generation] + ["//[1]" /// "_" + ["[1][0]" phase] + [meta + [archive {"+" Archive}]] + [reference + [variable {"+" Register}]]]]]]]) (def: @scope (-> Nat Label) @@ -84,23 +84,23 @@ (list#each (|>> product.left (n.+ start) //case.register _.parameter))) @loop (_.constant (///reference.artifact [loop_module loop_artifact])) loop_variables (set.of_list _.hash (list#each product.right locals)) - referenced_variables (: (-> Synthesis (Set Var)) - (|>> synthesis.path/then - //case.dependencies - (set.of_list _.hash))) - [directive instantiation] (: [Statement Expression] - (case (|> (list#each referenced_variables initsS+) - (list#mix set.union (referenced_variables bodyS)) - (set.difference loop_variables) - set.list) - {.#End} - [(_.define_function @loop (list) scope!) - @loop] + referenced_variables (is (-> Synthesis (Set Var)) + (|>> synthesis.path/then + //case.dependencies + (set.of_list _.hash))) + [directive instantiation] (is [Statement Expression] + (case (|> (list#each referenced_variables initsS+) + (list#mix set.union (referenced_variables bodyS)) + (set.difference loop_variables) + set.list) + {.#End} + [(_.define_function @loop (list) scope!) + @loop] - foreigns - [(<| (_.define_function @loop (list#each _.parameter foreigns)) - (_.return (_.closure (list#each _.parameter foreigns) (list) scope!))) - (_.apply/* foreigns @loop)]))] + foreigns + [(<| (_.define_function @loop (list#each _.parameter foreigns)) + (_.return (_.closure (list#each _.parameter foreigns) (list) scope!))) + (_.apply/* foreigns @loop)]))] _ (/////generation.execute! directive) _ (/////generation.save! loop_artifact directive)] (in (_.apply/* (list) instantiation))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux index 3e4699361..aed266e9f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux @@ -48,11 +48,11 @@ (def: .public register (-> Register SVar) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register SVar) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux index 9692d6ee7..efbefac6b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux @@ -43,7 +43,7 @@ (def: .public capture (-> Register SVar) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: (with_closure function_id @function inits function_definition) (-> artifact.ID SVar (List (Expression Any)) (Statement Any) (Operation (Expression Any))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux index 36762f8cc..5c6d545f1 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux @@ -89,23 +89,23 @@ actual_loop (<| (_.def @loop locals) ..set_scope body!) - [directive instantiation] (: [(Statement Any) (Expression Any)] - (case (|> (synthesis.path/then bodyS) - //case.dependencies - (set.of_list _.hash) - (set.difference (set.of_list _.hash locals)) - set.list) - {.#End} - [actual_loop - @loop] + [directive instantiation] (is [(Statement Any) (Expression Any)] + (case (|> (synthesis.path/then bodyS) + //case.dependencies + (set.of_list _.hash) + (set.difference (set.of_list _.hash locals)) + set.list) + {.#End} + [actual_loop + @loop] - foreigns - [(_.def @loop foreigns - ($_ _.then - actual_loop - (_.return @loop) - )) - (_.apply/* foreigns @loop)]))] + foreigns + [(_.def @loop foreigns + ($_ _.then + actual_loop + (_.return @loop) + )) + (_.apply/* foreigns @loop)]))] _ (/////generation.execute! directive) _ (/////generation.save! loop_artifact {.#None} directive)] (in (_.apply/* initsO+ instantiation))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux index 2b849271b..d75170250 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux @@ -39,11 +39,11 @@ (def: .public register (-> Register SVar) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register SVar) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index 8a56bf21a..6968c5618 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -1,45 +1,45 @@ (.using - [library - [lux {"-" Location ++ i64} - ["[0]" meta] - [abstract - ["[0]" monad {"+" do}]] - [control - ["[0]" function] - ["<>" parser - ["<[0]>" code]]] - [data - ["[0]" product] - ["[0]" text ("[1]#[0]" hash) - ["%" format {"+" format}] - [encoding - ["[0]" utf8]]] - [collection - ["[0]" list ("[1]#[0]" functor)] - ["[0]" sequence]]] - ["[0]" macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number {"+" hex} - ["n" nat] - ["i" int ("[1]#[0]" interval)] - ["[0]" i64]]] - ["@" target - ["_" r {"+" SVar Expression}]]]] - ["[0]" /// "_" - ["[1][0]" reference] - ["//[1]" /// "_" - [analysis {"+" Variant}] - ["[1][0]" synthesis {"+" Synthesis}] - ["[1][0]" generation] - ["//[1]" /// - ["[1][0]" phase] - [reference - [variable {"+" Register}]] - [meta - [archive {"+" Output Archive} - ["[0]" artifact {"+" Registry}]]]]]]) + [library + [lux {"-" Location ++ i64} + ["[0]" meta] + [abstract + ["[0]" monad {"+" do}]] + [control + ["[0]" function] + ["<>" parser + ["<[0]>" code]]] + [data + ["[0]" product] + ["[0]" text ("[1]#[0]" hash) + ["%" format {"+" format}] + [encoding + ["[0]" utf8]]] + [collection + ["[0]" list ("[1]#[0]" functor)] + ["[0]" sequence]]] + ["[0]" macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number {"+" hex} + ["n" nat] + ["i" int ("[1]#[0]" interval)] + ["[0]" i64]]] + ["@" target + ["_" r {"+" SVar Expression}]]]] + ["[0]" /// "_" + ["[1][0]" reference] + ["//[1]" /// "_" + [analysis {"+" Variant}] + ["[1][0]" synthesis {"+" Synthesis}] + ["[1][0]" generation] + ["//[1]" /// + ["[1][0]" phase] + [reference + [variable {"+" Register}]] + [meta + [archive {"+" Output Archive} + ["[0]" artifact {"+" Registry}]]]]]]) (def: module_id 0) @@ -271,11 +271,11 @@ (_.apply (list value) (_.var "is.na"))) isTRUE? (function (_ value) (_.apply (list value) (_.var "isTRUE"))) - comparison (: (-> (-> Expression Expression) Expression) - (function (_ field) - (|> (|> (field sample) (_.= (field reference))) - (_.or (|> (n/a? (field sample)) - (_.and (n/a? (field reference))))))))] + comparison (is (-> (-> Expression Expression) Expression) + (function (_ field) + (|> (|> (field sample) (_.= (field reference))) + (_.or (|> (n/a? (field sample)) + (_.and (n/a? (field reference))))))))] (|> (comparison i64_high) (_.and (comparison i64_low)) isTRUE?))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux index 50fae65d9..79ed4680c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/reference.lux @@ -55,10 +55,10 @@ (type: .public (System expression) (Interface - (: (-> Text expression) - constant') - (: (-> Text expression) - variable'))) + (is (-> Text expression) + constant') + (is (-> Text expression) + variable'))) (def: .public (constant system archive name) (All (_ anchor expression directive) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux index 1d513b57b..284fa79c6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux @@ -46,11 +46,11 @@ (def: .public register (-> Register LVar) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register LVar) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (exec expression archive [this that]) (Generator [Synthesis Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux index 6d4193788..f6b20a5d6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux @@ -41,7 +41,7 @@ (def: .public capture (-> Register LVar) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: (with_closure inits self function_definition) (-> (List Expression) Text Expression [Statement Expression]) @@ -77,13 +77,13 @@ arityO (|> arity .int _.int) limitO (|> arity -- .int _.int) @num_args (_.local "num_args") - @self (: _.Location - (case closureO+ - {.#End} - (_.global function_name) + @self (is _.Location + (case closureO+ + {.#End} + (_.global function_name) - _ - (_.local function_name))) + _ + (_.local function_name))) initialize_self! (_.set (list (//case.register 0)) @self) initialize! (list#mix (.function (_ post pre!) ($_ _.then diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux index aeed6ea59..e5cc0a650 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux @@ -39,11 +39,11 @@ (def: .public register (-> Register Var) - (|>> (///reference.local //reference.system) :expected)) + (|>> (///reference.local //reference.system) as_expected)) (def: .public capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: .public (let expression archive [valueS register bodyS]) (Generator [Synthesis Register Synthesis]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux index 2c5cf5a82..9ff5b8f94 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux @@ -1,33 +1,33 @@ (.using - [library - [lux {"-" function} - [abstract - ["[0]" monad {"+" do}]] - [control - pipe] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [target - ["_" scheme {"+" Expression Computation Var}]]]] - ["[0]" // "_" - ["[1][0]" runtime {"+" Operation Phase Generator}] + [library + [lux {"-" function} + [abstract + ["[0]" monad {"+" do}]] + [control + pipe] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [target + ["_" scheme {"+" Expression Computation Var}]]]] + ["[0]" // "_" + ["[1][0]" runtime {"+" Operation Phase Generator}] + ["[1][0]" reference] + ["[1][0]" case] + ["/[1]" // "_" ["[1][0]" reference] - ["[1][0]" case] - ["/[1]" // "_" - ["[1][0]" reference] + ["//[1]" /// "_" + [analysis {"+" Variant Tuple Abstraction Application Analysis}] + [synthesis {"+" Synthesis}] + ["[1][0]" generation {"+" Context}] ["//[1]" /// "_" - [analysis {"+" Variant Tuple Abstraction Application Analysis}] - [synthesis {"+" Synthesis}] - ["[1][0]" generation {"+" Context}] - ["//[1]" /// "_" - [arity {"+" Arity}] - ["[1][0]" phase ("[1]#[0]" monad)] - [reference - [variable {"+" Register Variable}]]]]]]) + [arity {"+" Arity}] + ["[1][0]" phase ("[1]#[0]" monad)] + [reference + [variable {"+" Register Variable}]]]]]]) (def: .public (apply expression archive [functionS argsS+]) (Generator (Application Synthesis)) @@ -38,7 +38,7 @@ (def: capture (-> Register Var) - (|>> (///reference.foreign //reference.system) :expected)) + (|>> (///reference.foreign //reference.system) as_expected)) (def: (with_closure inits function_definition) (-> (List Expression) Computation (Operation Computation)) 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 13d591126..87abcaff0 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 @@ -65,17 +65,17 @@ [locals /.locals] (in (|> functionS (//loop.optimization true locals argsS) - (maybe#each (: (-> [Nat (List Synthesis) Synthesis] Synthesis) - (function (_ [start inits iteration]) - (case iteration - (pattern (/.loop/scope [start' inits' output])) - (if (and (n.= start start') - (list.empty? inits')) - (/.loop/scope [start inits output]) - (/.loop/scope [start inits iteration])) + (maybe#each (is (-> [Nat (List Synthesis) Synthesis] Synthesis) + (function (_ [start inits iteration]) + (case iteration + (pattern (/.loop/scope [start' inits' output])) + (if (and (n.= start start') + (list.empty? inits')) + (/.loop/scope [start inits output]) + (/.loop/scope [start inits iteration])) - _ - (/.loop/scope [start inits iteration]))))) + _ + (/.loop/scope [start inits iteration]))))) (maybe.else <apply>)))) (in <apply>)) @@ -261,20 +261,20 @@ bodyS (/.with_currying? true (/.with_locals 2 (phase archive bodyA))) - abstraction (: (Operation Abstraction) - (case bodyS - (pattern (/.function/abstraction [env' down_arity' bodyS'])) - (|> bodyS' - (grow env') - (# ! each (function (_ body) - [/.#environment environment - /.#arity (++ down_arity') - /.#body body]))) - - _ - (in [/.#environment environment - /.#arity 1 - /.#body bodyS]))) + abstraction (is (Operation Abstraction) + (case bodyS + (pattern (/.function/abstraction [env' down_arity' bodyS'])) + (|> bodyS' + (grow env') + (# ! each (function (_ body) + [/.#environment environment + /.#arity (++ down_arity') + /.#body body]))) + + _ + (in [/.#environment environment + /.#arity 1 + /.#body bodyS]))) currying? /.currying?] (in (/.function/abstraction (if currying? diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 85e4d28af..5429a8f0c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -278,11 +278,11 @@ [{<tag> [[test then] elses]} (do [! try.monad] [[redundancy then] (again [redundancy then]) - [redundancy elses] (..list_optimization (: (Optimization [<type> Path]) - (function (_ [redundancy [else_test else_then]]) - (do ! - [[redundancy else_then] (again [redundancy else_then])] - (in [redundancy [else_test else_then]])))) + [redundancy elses] (..list_optimization (is (Optimization [<type> Path]) + (function (_ [redundancy [else_test else_then]]) + (do ! + [[redundancy else_then] (again [redundancy else_then])] + (in [redundancy [else_test else_then]])))) [redundancy elses])] (in [redundancy {<tag> [[test then] elses]}]))]) ([/.#I64_Fork I64] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index a2a47c775..dbe91632a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -186,8 +186,8 @@ (-> Source (Either [Source Text] [Source a]))) (template: (!with_char+ @source_code_size @source_code @offset @char @else @body) - [(if (!i/< (:as Int @source_code_size) - (:as Int @offset)) + [(if (!i/< (as Int @source_code_size) + (as Int @offset)) (let [@char ("lux text char" @offset @source_code)] @body) @else)]) @@ -202,7 +202,7 @@ ... {.#Left error} <<otherwise>> - (:expected <<otherwise>>))]) + (as_expected <<otherwise>>))]) (template: (!horizontal where offset source_code) [[(revised .#column ++ where) @@ -228,8 +228,8 @@ [(inline: (<name> parse where offset source_code) (-> (Parser Code) Location Offset Text (Either [Source Text] [Source Code])) - (loop [source (: Source [(!forward 1 where) offset source_code]) - stack (: (List Code) {.#End})] + (loop [source (is Source [(!forward 1 where) offset source_code]) + stack (is (List Code) {.#End})] (case (parse source) {.#Right [source' top]} (again source' {.#Item top stack}) 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 3fd47f828..3b1a2ad84 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -428,7 +428,7 @@ (# (list.equivalence (product.equivalence <equivalence> =)) = {.#Item reference_item} {.#Item sample_item})]) - ([#I64_Fork (: (Equivalence I64) i64.equivalence)] + ([#I64_Fork (is (Equivalence I64) i64.equivalence)] [#F64_Fork f.equivalence] [#Text_Fork text.equivalence]) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index fbcb3c0f9..b1397ef8c 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -27,7 +27,7 @@ [number ["n" nat ("[1]#[0]" equivalence)]]] [type - abstract]]] + [abstract {"-" pattern}]]]] [/ ["[0]" artifact] ["[0]" registry {"+" Registry}] @@ -79,16 +79,16 @@ (def: next (-> Archive module.ID) - (|>> :representation (the #next))) + (|>> representation (the #next))) (def: .public empty Archive - (:abstraction [#next 0 - #resolver (dictionary.empty text.hash)])) + (abstraction [#next 0 + #resolver (dictionary.empty text.hash)])) (def: .public (id module archive) (-> descriptor.Module Archive (Try module.ID)) - (let [(open "/[0]") (:representation archive)] + (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) {.#Some [id _]} {try.#Success id} @@ -99,7 +99,7 @@ (def: .public (reserve module archive) (-> descriptor.Module Archive (Try [module.ID Archive])) - (let [(open "/[0]") (:representation archive)] + (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) {.#Some _} (exception.except ..module_has_already_been_reserved [module]) @@ -107,20 +107,20 @@ {.#None} {try.#Success [/#next (|> archive - :representation - (revised #resolver (dictionary.has module [/#next (: (Maybe (Entry Any)) {.#None})])) + representation + (revised #resolver (dictionary.has module [/#next (is (Maybe (Entry Any)) {.#None})])) (revised #next ++) - :abstraction)]}))) + abstraction)]}))) (def: .public (has module entry archive) (-> descriptor.Module (Entry Any) Archive (Try Archive)) - (let [(open "/[0]") (:representation archive)] + (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) {.#Some [id {.#None}]} {try.#Success (|> archive - :representation + representation (revised ..#resolver (dictionary.has module [id {.#Some entry}])) - :abstraction)} + abstraction)} {.#Some [id {.#Some [existing_module existing_output existing_registry]}]} (if (same? (the module.#document existing_module) @@ -134,7 +134,7 @@ (def: .public entries (-> Archive (List [descriptor.Module [module.ID (Entry Any)]])) - (|>> :representation + (|>> representation (the #resolver) dictionary.entries (list.all (function (_ [module [module_id entry]]) @@ -142,7 +142,7 @@ (def: .public (find module archive) (-> descriptor.Module Archive (Try (Entry Any))) - (let [(open "/[0]") (:representation archive)] + (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) {.#Some [id {.#Some entry}]} {try.#Success entry} @@ -164,7 +164,7 @@ (def: .public archived (-> Archive (List descriptor.Module)) - (|>> :representation + (|>> representation (the #resolver) dictionary.entries (list.all (function (_ [module [id descriptor+document]]) @@ -174,7 +174,7 @@ (def: .public (reserved? archive module) (-> Archive descriptor.Module Bit) - (let [(open "/[0]") (:representation archive)] + (let [(open "/[0]") (representation archive)] (case (dictionary.value module /#resolver) {.#Some [id _]} true @@ -184,13 +184,13 @@ (def: .public reserved (-> Archive (List descriptor.Module)) - (|>> :representation + (|>> representation (the #resolver) dictionary.keys)) (def: .public reservations (-> Archive (List [descriptor.Module module.ID])) - (|>> :representation + (|>> representation (the #resolver) dictionary.entries (list#each (function (_ [module [id _]]) @@ -198,9 +198,9 @@ (def: .public (merged additions archive) (-> Archive Archive Archive) - (let [[+next +resolver] (:representation additions)] + (let [[+next +resolver] (representation additions)] (|> archive - :representation + representation (revised #next (n.max +next)) (revised #resolver (function (_ resolver) (list#mix (function (_ [module [id entry]] resolver) @@ -212,7 +212,7 @@ resolver)) resolver (dictionary.entries +resolver)))) - :abstraction))) + abstraction))) (type: Reservation [descriptor.Module module.ID]) @@ -236,7 +236,7 @@ (def: .public (export version archive) (-> Version Archive Binary) - (let [(open "/[0]") (:representation archive)] + (let [(open "/[0]") (representation archive)] (|> /#resolver dictionary.entries (list.all (function (_ [module [id descriptor+document]]) @@ -258,10 +258,10 @@ [[actual next reservations] (<binary>.result ..reader binary) _ (exception.assertion ..version_mismatch [expected actual] (n#= expected actual))] - (in (:abstraction + (in (abstraction [#next next #resolver (list#mix (function (_ [module id] archive) - (dictionary.has module [id (: (Maybe (Entry Any)) {.#None})] archive)) - (the #resolver (:representation ..empty)) + (dictionary.has module [id (is (Maybe (Entry Any)) {.#None})] archive)) + (the #resolver (representation ..empty)) reservations)])))) ) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux index a124fae6a..7ae44b175 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/key.lux @@ -2,7 +2,7 @@ [library [lux "*" [type - abstract]]] + [abstract {"-" pattern}]]]] [// [signature {"+" Signature}]]) @@ -11,9 +11,9 @@ (def: .public signature (All (_ ?) (-> (Key ?) Signature)) - (|>> :representation)) + (|>> representation)) (def: .public (key signature sample) (All (_ d) (-> Signature d (Key d))) - (:abstraction signature)) + (abstraction signature)) ) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux index bc74b9c3c..73214b2ab 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/module/document.lux @@ -13,8 +13,8 @@ ["[0]" dictionary {"+" Dictionary}]] [format ["[0]" binary {"+" Writer}]]] - [type {"+" :sharing} - abstract]]] + [type {"+" sharing} + [abstract {"-" pattern}]]]] [/// ["[0]" signature {"+" Signature} ("[1]#[0]" equivalence)] ["[0]" key {"+" Key}]]) @@ -32,40 +32,40 @@ (def: .public (content key document) (All (_ d) (-> (Key d) (Document Any) (Try d))) - (let [[document//signature document//content] (:representation document)] + (let [[document//signature document//content] (representation document)] (if (# signature.equivalence = (key.signature key) document//signature) - {try.#Success (:sharing [e] - (Key e) - key - - e - (:expected document//content))} + {try.#Success (sharing [e] + (Key e) + key + + e + (as_expected document//content))} (exception.except ..invalid_signature [(key.signature key) document//signature])))) (def: .public (document key content) (All (_ d) (-> (Key d) d (Document d))) - (:abstraction [#signature (key.signature key) - #content content])) + (abstraction [#signature (key.signature key) + #content content])) (def: .public (marked? key document) (All (_ d) (-> (Key d) (Document Any) (Try (Document d)))) (do try.monad [_ (..content key document)] - (in (:expected document)))) + (in (as_expected document)))) (def: .public signature (-> (Document Any) Signature) - (|>> :representation (the #signature))) + (|>> representation (the #signature))) (def: .public (writer content) (All (_ d) (-> (Writer d) (Writer (Document d)))) (let [writer ($_ binary.and signature.writer content)] - (|>> :representation writer))) + (|>> representation writer))) (def: .public (parser key it) (All (_ d) (-> (Key d) (Parser d) (Parser (Document d)))) @@ -76,5 +76,5 @@ (in []) (<>.lifted (exception.except ..invalid_signature [expected actual]))) it it] - (in (:abstraction [actual it])))) + (in (abstraction [actual it])))) ) 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 d2921be2e..3e9726924 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/registry.lux @@ -23,7 +23,7 @@ [macro ["^" pattern]] [type - abstract]]] + [abstract {"-" pattern}]]]] ["[0]" // "_" ["[0]" unit] ["[1]" artifact {"+" Artifact ID} @@ -36,12 +36,12 @@ (def: .public empty Registry - (:abstraction [#artifacts sequence.empty - #resolver (dictionary.empty text.hash)])) + (abstraction [#artifacts sequence.empty + #resolver (dictionary.empty text.hash)])) (def: .public artifacts (-> Registry (Sequence [Artifact (Set unit.ID)])) - (|>> :representation (the #artifacts))) + (|>> representation (the #artifacts))) (def: next (-> Registry ID) @@ -52,12 +52,12 @@ (let [id (..next registry)] [id (|> registry - :representation + representation (revised #artifacts (sequence.suffix [[//.#id id //.#category {//category.#Anonymous} //.#mandatory? mandatory?] dependencies])) - :abstraction)])) + abstraction)])) (template [<tag> <create> <fetch> <type> <name> <+resolver>] [(def: .public (<create> it mandatory? dependencies registry) @@ -65,18 +65,18 @@ (let [id (..next registry)] [id (|> registry - :representation + representation (revised #artifacts (sequence.suffix [[//.#id id //.#category {<tag> it} //.#mandatory? mandatory?] dependencies])) - (revised #resolver (dictionary.has (<name> it) [id (: (Maybe //category.Definition) <+resolver>)])) - :abstraction)])) + (revised #resolver (dictionary.has (<name> it) [id (is (Maybe //category.Definition) <+resolver>)])) + abstraction)])) (def: .public (<fetch> registry) (-> Registry (List <type>)) (|> registry - :representation + representation (the #artifacts) sequence.list (list.all (|>> product.left @@ -96,7 +96,7 @@ (def: .public (find_definition name registry) (-> Text Registry (Maybe [ID (Maybe //category.Definition)])) - (|> (:representation registry) + (|> (representation registry) (the #resolver) (dictionary.value name))) @@ -106,37 +106,37 @@ (def: .public writer (Writer Registry) - (let [definition (: (Writer //category.Definition) - ($_ binary.and - binary.text - (binary.maybe - ($_ binary.and - binary.nat - binary.nat - binary.nat - )) - )) - category (: (Writer Category) - (function (_ value) - (case value - (^.template [<nat> <tag> <writer>] - [{<tag> value} - ((binary.and binary.nat <writer>) [<nat> value])]) - ([0 //category.#Anonymous binary.any] - [1 //category.#Definition definition] - [2 //category.#Analyser binary.text] - [3 //category.#Synthesizer binary.text] - [4 //category.#Generator binary.text] - [5 //category.#Directive binary.text] - [6 //category.#Custom binary.text])))) + (let [definition (is (Writer //category.Definition) + ($_ binary.and + binary.text + (binary.maybe + ($_ binary.and + binary.nat + binary.nat + binary.nat + )) + )) + category (is (Writer Category) + (function (_ value) + (case value + (^.template [<nat> <tag> <writer>] + [{<tag> value} + ((binary.and binary.nat <writer>) [<nat> value])]) + ([0 //category.#Anonymous binary.any] + [1 //category.#Definition definition] + [2 //category.#Analyser binary.text] + [3 //category.#Synthesizer binary.text] + [4 //category.#Generator binary.text] + [5 //category.#Directive binary.text] + [6 //category.#Custom binary.text])))) mandatory? binary.bit - dependency (: (Writer unit.ID) - (binary.and binary.nat binary.nat)) - dependencies (: (Writer (Set unit.ID)) - (binary.set dependency)) - artifacts (: (Writer (Sequence [Category Bit (Set unit.ID)])) - (binary.sequence/64 ($_ binary.and category mandatory? dependencies)))] - (|>> :representation + dependency (is (Writer unit.ID) + (binary.and binary.nat binary.nat)) + dependencies (is (Writer (Set unit.ID)) + (binary.set dependency)) + artifacts (is (Writer (Sequence [Category Bit (Set unit.ID)])) + (binary.sequence/64 ($_ binary.and category mandatory? dependencies)))] + (|>> representation (the #artifacts) (sequence#each (function (_ [it dependencies]) [(the //.#category it) @@ -150,37 +150,37 @@ (def: .public parser (Parser Registry) - (let [definition (: (Parser //category.Definition) - ($_ <>.and - <binary>.text - (<binary>.maybe - ($_ <>.and - <binary>.nat - <binary>.nat - <binary>.nat - )) - )) - category (: (Parser Category) - (do [! <>.monad] - [tag <binary>.nat] - (case tag - (^.template [<nat> <tag> <parser>] - [<nat> - (# ! each (|>> {<tag>}) <parser>)]) - ([0 //category.#Anonymous <binary>.any] - [1 //category.#Definition definition] - [2 //category.#Analyser <binary>.text] - [3 //category.#Synthesizer <binary>.text] - [4 //category.#Generator <binary>.text] - [5 //category.#Directive <binary>.text] - [6 //category.#Custom <binary>.text]) - - _ (<>.failure (exception.error ..invalid_category [tag]))))) + (let [definition (is (Parser //category.Definition) + ($_ <>.and + <binary>.text + (<binary>.maybe + ($_ <>.and + <binary>.nat + <binary>.nat + <binary>.nat + )) + )) + category (is (Parser Category) + (do [! <>.monad] + [tag <binary>.nat] + (case tag + (^.template [<nat> <tag> <parser>] + [<nat> + (# ! each (|>> {<tag>}) <parser>)]) + ([0 //category.#Anonymous <binary>.any] + [1 //category.#Definition definition] + [2 //category.#Analyser <binary>.text] + [3 //category.#Synthesizer <binary>.text] + [4 //category.#Generator <binary>.text] + [5 //category.#Directive <binary>.text] + [6 //category.#Custom <binary>.text]) + + _ (<>.failure (exception.error ..invalid_category [tag]))))) mandatory? <binary>.bit - dependency (: (Parser unit.ID) - (<>.and <binary>.nat <binary>.nat)) - dependencies (: (Parser (Set unit.ID)) - (<binary>.set unit.hash dependency))] + dependency (is (Parser unit.ID) + (<>.and <binary>.nat <binary>.nat)) + dependencies (is (Parser (Set unit.ID)) + (<binary>.set unit.hash dependency))] (|> (<binary>.sequence/64 ($_ <>.and category mandatory? dependencies)) (# <>.monad each (sequence#mix (function (_ [category mandatory? dependencies] registry) (product.right diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux index 4fd7fdebf..2db68a99d 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency/module.lux @@ -54,17 +54,17 @@ (def: (ancestry archive) (-> Archive Graph) - (let [memo (: (Memo descriptor.Module Ancestry) - (function (_ again module) - (do [! state.monad] - [.let [parents (case (archive.find module archive) - {try.#Success [module output registry]} - (the [module.#descriptor descriptor.#references] module) - - {try.#Failure error} - ..fresh)] - ancestors (monad.each ! again (set.list parents))] - (in (list#mix set.union parents ancestors))))) + (let [memo (is (Memo descriptor.Module Ancestry) + (function (_ again module) + (do [! state.monad] + [.let [parents (case (archive.find module archive) + {try.#Success [module output registry]} + (the [module.#descriptor descriptor.#references] module) + + {try.#Failure error} + ..fresh)] + ancestors (monad.each ! again (set.list parents))] + (in (list#mix set.union parents ancestors))))) ancestry (memo.open memo)] (list#mix (function (_ module memory) (if (dictionary.key? memory module) 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 4d593aeda..869aa2019 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/module.lux @@ -98,5 +98,5 @@ (|> path (# fs read) (# ! each (|>> [name]))))))] - (in (dictionary.of_list text.hash (for @.old (:as (List [Text Binary]) pairs) + (in (dictionary.of_list text.hash (for @.old (as (List [Text Binary]) pairs) pairs))))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux index e393253e1..55701b3f3 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/purge.lux @@ -68,8 +68,8 @@ (def: .public (purge caches load_order) (-> (List Cache) (dependency.Order Any) Purge) (list#mix (function (_ [module_name [@module entry]] purge) - (let [purged? (: (Predicate descriptor.Module) - (dictionary.key? purge))] + (let [purged? (is (Predicate descriptor.Module) + (dictionary.key? purge))] (if (purged? module_name) purge (if (|> entry diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli.lux b/stdlib/source/library/lux/tool/compiler/meta/cli.lux index bbc2735e7..99f7da67a 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli.lux @@ -86,15 +86,15 @@ (def: .public service (Parser Service) - (let [compilation (: (Parser Compilation) - ($_ <>.and - (<>.some ..host_dependency_parser) - (<>.some ..library_parser) - (<>.some ..compiler_parser) - (<>.some ..source_parser) - ..target_parser - ..module_parser - (<>.else configuration.empty ..configuration_parser)))] + (let [compilation (is (Parser Compilation) + ($_ <>.and + (<>.some ..host_dependency_parser) + (<>.some ..library_parser) + (<>.some ..compiler_parser) + (<>.some ..source_parser) + ..target_parser + ..module_parser + (<>.else configuration.empty ..configuration_parser)))] ($_ <>.or (<>.after (<cli>.this "build") compilation) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux index 9bc446b4d..09eef4deb 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cli/compiler.lux @@ -50,10 +50,10 @@ (def: .public parser (Parser Compiler) - (let [parameter (: (Parser Text) - (<| (<>.after (<text>.this ..start)) - (<>.before (<text>.this ..end)) - (<text>.slice (<text>.many! (<text>.none_of! ..end)))))] + (let [parameter (is (Parser Text) + (<| (<>.after (<text>.this ..start)) + (<>.before (<text>.this ..end)) + (<text>.slice (<text>.many! (<text>.none_of! ..end)))))] (do <>.monad [module parameter short parameter diff --git a/stdlib/source/library/lux/tool/compiler/meta/export.lux b/stdlib/source/library/lux/tool/compiler/meta/export.lux index 9b21de75b..7eb36ad62 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/export.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/export.lux @@ -38,9 +38,9 @@ (def: .public ownership tar.Ownership - (let [commons (: tar.Owner - [tar.#name tar.anonymous - tar.#id tar.no_id])] + (let [commons (is tar.Owner + [tar.#name tar.anonymous + tar.#id tar.no_id])] [tar.#user commons tar.#group commons])) diff --git a/stdlib/source/library/lux/tool/compiler/meta/import.lux b/stdlib/source/library/lux/tool/compiler/meta/import.lux index c485cb5f7..f0c390e3a 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/import.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/import.lux @@ -67,8 +67,8 @@ (def: .public (import system libraries) (-> (file.System Async) (List Library) (Action Import)) - (monad.mix (: (Monad Action) - (try.with async.monad)) + (monad.mix (is (Monad Action) + (try.with async.monad)) (..import_library system) (dictionary.empty text.hash) libraries)) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index 95d9a5e1a..05f766d5d 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -78,15 +78,15 @@ (def: (analysis_state host configuration archive) (-> Target Configuration Archive (Try .Lux)) (do [! try.monad] - [modules (: (Try (List [descriptor.Module .Module])) - (monad.each ! (function (_ module) - (do ! - [entry (archive.find module archive) - content (|> entry - (the [archive.#module module.#document]) - (document.content $.key))] - (in [module content]))) - (archive.archived archive)))] + [modules (is (Try (List [descriptor.Module .Module])) + (monad.each ! (function (_ module) + (do ! + [entry (archive.find module archive) + content (|> entry + (the [archive.#module module.#document]) + (document.content $.key))] + (in [module content]))) + (archive.archived archive)))] (in (has .#modules modules (fresh_analysis_state host configuration))))) (type: Definitions (Dictionary Text Any)) @@ -113,111 +113,111 @@ (-> Text (generation.Host expression directive) module.ID (Sequence [Artifact (Set unit.ID)]) (Dictionary Text Binary) (Document .Module) (Try [(Document .Module) Bundles Output]))) (do [! try.monad] - [[definitions bundles] (: (Try [Definitions Bundles Output]) - (loop [input (sequence.list expected) - definitions (: Definitions - (dictionary.empty text.hash)) - bundles ..empty_bundles - output (: Output sequence.empty)] - (let [[analysers synthesizers generators directives] bundles] - (case input - {.#Item [[[@artifact artifact_category mandatory_artifact?] artifact_dependencies] input']} - (case (do ! - [data (try.of_maybe (dictionary.value (format (%.nat @artifact) extension) actual)) - .let [context [@module @artifact] - directive (# host ingest context data)]] - (case artifact_category - {category.#Anonymous} - (do ! - [.let [output (sequence.suffix [@artifact {.#None} data] output)] - _ (# host re_learn context {.#None} directive)] - (in [definitions - [analysers - synthesizers - generators - directives] - output])) - - {category.#Definition [name function_artifact]} - (let [output (sequence.suffix [@artifact {.#None} data] output)] - (if (text#= $/program.name name) - (in [definitions - [analysers - synthesizers - generators - directives] - output]) - (do ! - [value (# host re_load context {.#None} directive)] - (in [(dictionary.has name value definitions) - [analysers - synthesizers - generators - directives] - output])))) + [[definitions bundles] (is (Try [Definitions Bundles Output]) + (loop [input (sequence.list expected) + definitions (is Definitions + (dictionary.empty text.hash)) + bundles ..empty_bundles + output (is Output sequence.empty)] + (let [[analysers synthesizers generators directives] bundles] + (case input + {.#Item [[[@artifact artifact_category mandatory_artifact?] artifact_dependencies] input']} + (case (do ! + [data (try.of_maybe (dictionary.value (format (%.nat @artifact) extension) actual)) + .let [context [@module @artifact] + directive (# host ingest context data)]] + (case artifact_category + {category.#Anonymous} + (do ! + [.let [output (sequence.suffix [@artifact {.#None} data] output)] + _ (# host re_learn context {.#None} directive)] + (in [definitions + [analysers + synthesizers + generators + directives] + output])) + + {category.#Definition [name function_artifact]} + (let [output (sequence.suffix [@artifact {.#None} data] output)] + (if (text#= $/program.name name) + (in [definitions + [analysers + synthesizers + generators + directives] + output]) + (do ! + [value (# host re_load context {.#None} directive)] + (in [(dictionary.has name value definitions) + [analysers + synthesizers + generators + directives] + output])))) - {category.#Analyser extension} - (do ! - [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (# host re_load context {.#None} directive)] - (in [definitions - [(dictionary.has extension (:as analysis.Handler value) analysers) - synthesizers - generators - directives] - output])) + {category.#Analyser extension} + (do ! + [.let [output (sequence.suffix [@artifact {.#None} data] output)] + value (# host re_load context {.#None} directive)] + (in [definitions + [(dictionary.has extension (as analysis.Handler value) analysers) + synthesizers + generators + directives] + output])) - {category.#Synthesizer extension} - (do ! - [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (# host re_load context {.#None} directive)] - (in [definitions - [analysers - (dictionary.has extension (:as synthesis.Handler value) synthesizers) - generators - directives] - output])) + {category.#Synthesizer extension} + (do ! + [.let [output (sequence.suffix [@artifact {.#None} data] output)] + value (# host re_load context {.#None} directive)] + (in [definitions + [analysers + (dictionary.has extension (as synthesis.Handler value) synthesizers) + generators + directives] + output])) - {category.#Generator extension} - (do ! - [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (# host re_load context {.#None} directive)] - (in [definitions - [analysers - synthesizers - (dictionary.has extension (:as generation.Handler value) generators) - directives] - output])) + {category.#Generator extension} + (do ! + [.let [output (sequence.suffix [@artifact {.#None} data] output)] + value (# host re_load context {.#None} directive)] + (in [definitions + [analysers + synthesizers + (dictionary.has extension (as generation.Handler value) generators) + directives] + output])) - {category.#Directive extension} - (do ! - [.let [output (sequence.suffix [@artifact {.#None} data] output)] - value (# host re_load context {.#None} directive)] - (in [definitions - [analysers - synthesizers - generators - (dictionary.has extension (:as directive.Handler value) directives)] - output])) + {category.#Directive extension} + (do ! + [.let [output (sequence.suffix [@artifact {.#None} data] output)] + value (# host re_load context {.#None} directive)] + (in [definitions + [analysers + synthesizers + generators + (dictionary.has extension (as directive.Handler value) directives)] + output])) - {category.#Custom name} - (do ! - [.let [output (sequence.suffix [@artifact {.#Some name} data] output)] - _ (# host re_learn context {.#Some name} directive)] - (in [definitions - [analysers - synthesizers - generators - directives] - output])))) - {try.#Success [definitions' bundles' output']} - (again input' definitions' bundles' output') + {category.#Custom name} + (do ! + [.let [output (sequence.suffix [@artifact {.#Some name} data] output)] + _ (# host re_learn context {.#Some name} directive)] + (in [definitions + [analysers + synthesizers + generators + directives] + output])))) + {try.#Success [definitions' bundles' output']} + (again input' definitions' bundles' output') - failure - failure) - - {.#End} - {try.#Success [definitions bundles output]})))) + failure + failure) + + {.#End} + {try.#Success [definitions bundles output]})))) content (document.content $.key document) definitions (monad.each ! (function (_ [def_name def_global]) (case def_global @@ -241,7 +241,7 @@ (dictionary.value def_name) try.of_maybe (# ! each (function (_ def_value) - [def_name {.#Type [exported? (:as .Type def_value) labels]}]))))) + [def_name {.#Type [exported? (as .Type def_value) labels]}]))))) (the .#definitions content))] (in [(document.document $.key (has .#definitions definitions content)) bundles]))) @@ -252,8 +252,8 @@ (archive.Entry .Module) (Async (Try [(archive.Entry .Module) Bundles])))) (do (try.with async.monad) - [actual (: (Async (Try (Dictionary Text Binary))) - (cache/module.artifacts async.monad fs context @module)) + [actual (is (Async (Try (Dictionary Text Binary))) + (cache/module.artifacts async.monad fs context @module)) .let [expected (registry.artifacts (the archive.#registry entry))] [document bundles output] (|> (the [archive.#module module.#document] entry) (loaded_document (the context.#artifact_extension context) host_environment @module expected actual) @@ -269,8 +269,8 @@ (def: (cache_parser customs) (-> (List Custom) (Parser [(module.Module Any) Registry])) - (case (for @.old (:as (List (Custom Any Any Any)) - customs) + (case (for @.old (as (List (Custom Any Any Any)) + customs) customs) {.#End} (..parser $.key $.parser) @@ -287,8 +287,8 @@ (Async (Try Cache))) (with_expansions [<cache> (as_is module_name @module module registry)] (do [! (try.with async.monad)] - [data (: (Async (Try Binary)) - (cache/module.cache fs context @module)) + [data (is (Async (Try Binary)) + (cache/module.cache fs context @module)) [module registry] (async#in (<binary>.result (..cache_parser customs) data))] (if (text#= descriptor.runtime module_name) (in [true <cache>]) @@ -314,7 +314,7 @@ (function (_ [_ [module @module |module| registry]] archive) (archive.has module [archive.#module |module| - archive.#output (: Output sequence.empty) + archive.#output (is Output sequence.empty) archive.#registry registry] archive)) archive) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux index 00288e42b..3abcfbf5a 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -173,8 +173,8 @@ (def: .public (listing fs contexts) (-> (file.System Async) (List Context) (Action Enumeration)) - (let [! (: (Monad Action) - (try.with async.monad))] + (let [! (is (Monad Action) + (try.with async.monad))] (monad.mix ! (function (_ context enumeration) (do ! @@ -183,6 +183,6 @@ (format context (# fs separator)) context enumeration))) - (: Enumeration - (dictionary.empty text.hash)) + (is Enumeration + (dictionary.empty text.hash)) contexts))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux index df7f11ce0..ed360caec 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/ruby.lux @@ -1,7 +1,7 @@ (.using [library [lux "*" - [type {"+" :sharing}] + [type {"+" sharing}] [abstract ["[0]" monad {"+" do}]] [control @@ -62,12 +62,12 @@ (|> content (# utf8.codec decoded) (# ! each - (|>> :expected - (:sharing [directive] - directive - so_far - - directive) + (|>> as_expected + (sharing [directive] + directive + so_far + + directive) (_.then so_far))))) (_.comment "Lux module" (_.statement (_.string ""))) @@ -84,8 +84,8 @@ (List [module.ID [Text Binary]]) (Try (List [module.ID [Text Binary]]))) (do [! try.monad] - [bundle (: (Try (Maybe _.Statement)) - (..bundle_module module module_id necessary_dependencies (the archive.#output entry)))] + [bundle (is (Try (Maybe _.Statement)) + (..bundle_module module module_id necessary_dependencies (the archive.#output entry)))] (case bundle {.#None} (in sink) @@ -93,7 +93,7 @@ {.#Some bundle} (let [entry_content (|> (list) (list#mix _.then bundle) - (: _.Statement) + (is _.Statement) _.code (# utf8.codec encoded))] (in (list& [module_id [(..module_file module_id) entry_content]] @@ -127,11 +127,11 @@ (let [relative_path (_.do "gsub" (list (_.string main_file) (_.string (..module_file module_id))) {.#None} - (: _.CVar (_.manual "__FILE__")))] + (is _.CVar (_.manual "__FILE__")))] (_.statement (_.require/1 relative_path))))) (list#mix _.then (_.comment "Lux program" (_.statement (_.string "")))) - (: _.Statement) + (is _.Statement) _.code (# utf8.codec encoded))]] (in (|> entries diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux index f1dfb0189..c7548669a 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -1,7 +1,7 @@ (.using [library [lux {"-" Module} - [type {"+" :sharing}] + [type {"+" sharing}] [abstract ["[0]" monad {"+" do}]] [control @@ -63,14 +63,14 @@ (|> content (# encoding.utf8 decoded) (# try.monad each - (|>> :expected - (:sharing [directive] - directive - so_far - - directive) + (|>> as_expected + (sharing [directive] + directive + so_far + + directive) (..then so_far))))) - (: _.Expression (_.manual ""))))) + (is _.Expression (_.manual ""))))) (def: module_file (-> archive.ID file.Path) @@ -100,19 +100,19 @@ [Module [archive.ID [Descriptor (Document .Module) Output]]] (Try tar.Entry)) (do [! try.monad] - [bundle (: (Try _.Expression) - (..bundle_module output)) - entry_content (: (Try tar.Content) - (|> descriptor - (the descriptor.#references) - set.list - (list.all (function (_ module) (dictionary.value module mapping))) - (list#each (|>> ..module_file _.string _.load_relative/1)) - (list#mix ..then bundle) - (: _.Expression) - _.code - (# encoding.utf8 encoded) - tar.content)) + [bundle (is (Try _.Expression) + (..bundle_module output)) + entry_content (is (Try tar.Content) + (|> descriptor + (the descriptor.#references) + set.list + (list.all (function (_ module) (dictionary.value module mapping))) + (list#each (|>> ..module_file _.string _.load_relative/1)) + (list#mix ..then bundle) + (is _.Expression) + _.code + (# encoding.utf8 encoded) + tar.content)) module_file (tar.path (..module_file module_id))] (in {tar.#Normal [module_file now ..mode ..ownership entry_content]}))) @@ -125,7 +125,7 @@ (list#each (function (_ [module [module_id [descriptor document output]]]) [module module_id])) (dictionary.of_list text.hash) - (: (Dictionary Module archive.ID)))] + (is (Dictionary Module archive.ID)))] entries (monad.each ! (..write_module now mapping) order)] (in (|> entries sequence.of_list diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux index 1b867cd4f..37db58b89 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux @@ -1,7 +1,7 @@ (.using [library [lux "*" - [type {"+" :sharing}] + [type {"+" sharing}] [abstract ["[0]" monad {"+" Monad do}]] [control @@ -49,12 +49,12 @@ (|> content (# utf8.codec decoded) (# try.monad each - (|>> :expected - (:sharing [directive] - directive - so_far - - directive) + (|>> as_expected + (sharing [directive] + directive + so_far + + directive) (sequence so_far))))) so_far))) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index a5e907a52..7fc7687be 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -8,7 +8,7 @@ [data ["[0]" text ("[1]#[0]" equivalence) ["%" format {"+" format}]]] - [type {"+" :sharing} + [type {"+" sharing} ["[0]" check]] [compiler ["[0]" phase @@ -129,24 +129,24 @@ (-> Configuration Code <Interpretation>)) (function (_ state) (case (<| (phase.result' state) - (:sharing [anchor expression directive] - (State+ anchor expression directive) - state + (sharing [anchor expression directive] + (State+ anchor expression directive) + state - <Interpretation> - (interpret_directive code))) + <Interpretation> + (interpret_directive code))) {try.#Success [state' output]} {try.#Success [state' output]} {try.#Failure error} (if (ex.match? total.not_a_directive error) (<| (phase.result' state) - (:sharing [anchor expression directive] - (State+ anchor expression directive) - state - - <Interpretation> - (interpret_expression code))) + (sharing [anchor expression directive] + (State+ anchor expression directive) + state + + <Interpretation> + (interpret_expression code))) {try.#Failure error})))) ) @@ -177,20 +177,20 @@ [.let [[_where _offset _code] (the #source context)] [source' input] (syntax.parse ..module syntax.no_aliases (text.size _code) (the #source context)) [state' representation] (let [... TODO: Simplify ASAP - state (:sharing [anchor expression directive] - <Context> - context - - (State+ anchor expression directive) - (the #state context))] + state (sharing [anchor expression directive] + <Context> + context + + (State+ anchor expression directive) + (the #state context))] (<| (phase.result' state) ... TODO: Simplify ASAP - (:sharing [anchor expression directive] - <Context> - context - - (Operation anchor expression directive Text) - (execute (the #configuration context) input))))] + (sharing [anchor expression directive] + <Context> + context + + (Operation anchor expression directive Text) + (execute (the #configuration context) input))))] (in [(|> context (has #state state') (has #source source')) diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index 55fa0b166..8e7541755 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" function :as} + [lux {"-" function as let} ["@" target] [abstract [equivalence {"+" Equivalence}] @@ -16,7 +16,7 @@ ["[0]" text ("[1]#[0]" monoid equivalence)] [collection ["[0]" array] - ["[0]" list ("[1]#[0]" functor monoid mix)]]] + ["[0]" list ("[1]#[0]" monad monoid mix)]]] ["[0]" macro [syntax {"+" syntax:}] ["^" pattern] @@ -48,7 +48,7 @@ (-> Type [(List Type) Type]) (case type {.#Function in out'} - (let [[ins out] (flat_function out')] + (.let [[ins out] (flat_function out')] [(list& in ins) out]) _ @@ -58,7 +58,7 @@ (-> Type [Type (List Type)]) (case type {.#Apply arg func'} - (let [[func args] (flat_application func')] + (.let [[func args] (flat_application func')] [func (list#composite args (list arg))]) _ @@ -103,7 +103,7 @@ [.#Product "[" "]" flat_tuple]) {.#Function input output} - (let [[ins out] (flat_function type)] + (.let [[ins out] (flat_function type)] ($_ text#composite "(-> " (|> ins (list#each format) @@ -122,7 +122,7 @@ ($_ text#composite "+" (n#encoded id)) {.#Apply param fun} - (let [[type_func type_args] (flat_application type)] + (.let [[type_func type_args] (flat_application type)] ($_ text#composite "(" (format type_func) " " (|> type_args (list#each format) list.reversed (list.interposed " ") (list#mix text#composite "")) ")")) (^.template [<tag> <desc>] @@ -370,7 +370,7 @@ (case type (^.multi (pattern {.#Primitive name (list element_type)}) (text#= array.type_name name)) - (let [[depth element_type] (flat_array element_type)] + (.let [[depth element_type] (flat_array element_type)] [(++ depth) element_type]) _ @@ -389,9 +389,9 @@ (def: secret_marker (`` (symbol (~~ (new_secret_marker))))) -(syntax: .public (:log! [input (<>.or (<>.and <code>.symbol - (<>.maybe (<>.after (<code>.symbol! ..secret_marker) <code>.any))) - <code>.any)]) +(syntax: .public (log! [input (<>.or (<>.and <code>.symbol + (<>.maybe (<>.after (<code>.symbol! ..secret_marker) <code>.any))) + <code>.any)]) (case input {.#Left [valueN valueC]} (do meta.monad @@ -399,7 +399,7 @@ valueT (meta.type valueN) .let [_ ("lux io log" ($_ text#composite - (symbol#encoded (symbol ..:log!)) " " (location.format location) text.new_line + (symbol#encoded (symbol ..log!)) " " (location.format location) text.new_line "Expression: " (case valueC {.#Some valueC} (code.format valueC) @@ -413,20 +413,20 @@ {.#Right valueC} (macro.with_symbols [g!value] (in (list (` (.let [(~ g!value) (~ valueC)] - (..:log! (~ valueC) (~ (code.symbol ..secret_marker)) (~ g!value))))))))) + (..log! (~ valueC) (~ (code.symbol ..secret_marker)) (~ g!value))))))))) (def: type_parameters (Parser (List Text)) (<code>.tuple (<>.some <code>.local_symbol))) -(syntax: .public (:as [type_vars type_parameters - input <code>.any - output <code>.any - value (<>.maybe <code>.any)]) +(syntax: .public (as [type_vars type_parameters + input <code>.any + output <code>.any + value (<>.maybe <code>.any)]) (macro.with_symbols [g!_] - (let [casterC (` (: (All ((~ g!_) (~+ (list#each code.local_symbol type_vars))) - (-> (~ input) (~ output))) - (|>> :expected)))] + (.let [casterC (` (is (All ((~ g!_) (~+ (list#each code.local_symbol type_vars))) + (-> (~ input) (~ output))) + (|>> as_expected)))] (case value {.#None} (in (list casterC)) @@ -444,30 +444,30 @@ (<>.and <code>.any <code>.any)) ... TODO: Make sure the generated code always gets optimized away. -(syntax: .public (:sharing [type_vars ..type_parameters - exemplar ..typed - computation ..typed]) +(syntax: .public (sharing [type_vars ..type_parameters + exemplar ..typed + computation ..typed]) (macro.with_symbols [g!_] - (let [typeC (` (All ((~ g!_) (~+ (list#each code.local_symbol type_vars))) - (-> (~ (the #type exemplar)) - (~ (the #type computation))))) - shareC (` (: (~ typeC) - (.function ((~ g!_) (~ g!_)) - (~ (the #expression computation)))))] + (.let [typeC (` (All ((~ g!_) (~+ (list#each code.local_symbol type_vars))) + (-> (~ (the #type exemplar)) + (~ (the #type computation))))) + shareC (` (is (~ typeC) + (.function ((~ g!_) (~ g!_)) + (~ (the #expression computation)))))] (in (list (` ((~ shareC) (~ (the #expression exemplar))))))))) -(syntax: .public (:by_example [type_vars ..type_parameters - exemplar ..typed - extraction <code>.any]) - (in (list (` (:of ((~! ..:sharing) - [(~+ (list#each code.local_symbol type_vars))] +(syntax: .public (by_example [type_vars ..type_parameters + exemplar ..typed + extraction <code>.any]) + (in (list (` (.type_of ((~! ..sharing) + [(~+ (list#each code.local_symbol type_vars))] - (~ (the #type exemplar)) - (~ (the #expression exemplar)) - - (~ extraction) - ... The value of this expression will never be relevant, so it doesn't matter what it is. - (.:as .Nothing []))))))) + (~ (the #type exemplar)) + (~ (the #expression exemplar)) + + (~ extraction) + ... The value of this expression will never be relevant, so it doesn't matter what it is. + (.as .Nothing []))))))) (def: .public (replaced before after) (-> Type Type Type Type) @@ -497,3 +497,11 @@ {.#Ex _} {.#Named _}) it)))) + +(syntax: .public (let [bindings (<code>.tuple (<>.some (<>.and <code>.any <code>.any))) + bodyT <code>.any]) + (in (list (` (..with_expansions [(~+ (|> bindings + (list#each (.function (_ [localT valueT]) + (list localT (` (..as_is (~ valueT)))))) + list#conjoint))] + (~ bodyT)))))) diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index 7f5f73fee..8ef8c93a1 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" pattern} ["[0]" meta] [abstract [monad {"+" Monad do}]] @@ -63,7 +63,7 @@ (!peek source reference (case head {.#Definition [exported? frame_type frame_value]} - (:as (Stack Frame) frame_value) + (as (Stack Frame) frame_value) (^.or {.#Type _} {.#Alias _} @@ -125,7 +125,7 @@ {.#Definition [exported? frames_type frames_value]} {.#Definition [exported? frames_type - (..push frame (:as (Stack Frame) frames_value))]} + (..push frame (as (Stack Frame) frames_value))]} (^.or {.#Type _} {.#Alias _} @@ -153,7 +153,7 @@ {.#Definition [exported? frames_type frames_value]} {.#Definition [exported? frames_type - (let [current_frames (:as (Stack Frame) frames_value)] + (let [current_frames (as (Stack Frame) frames_value)] (case (..pop current_frames) {.#Some current_frames'} current_frames' @@ -188,11 +188,11 @@ [(syntax: .public (<name> [[frame value] ..cast]) (do meta.monad [[name type_vars abstraction representation] (peek! frame)] - (in (list (` ((~! //.:as) [(~+ type_vars)] (~ <from>) (~ <to>) + (in (list (` ((~! //.as) [(~+ type_vars)] (~ <from>) (~ <to>) (~ value)))))))] - [:abstraction representation abstraction] - [:representation abstraction representation] + [abstraction representation abstraction] + [representation abstraction representation] ) (def: abstraction_type_name @@ -220,7 +220,7 @@ ))) ... TODO: Make sure the generated code always gets optimized away. -... (This applies to uses of ":abstraction" and ":representation") +... (This applies to uses of "abstraction" and "representation") (syntax: .public (abstract: [[export_policy [name type_vars] representation_type primitives] ..abstract]) (do meta.monad @@ -252,30 +252,30 @@ (<>.or (<>.and <code>.any parser) parser)) -(syntax: .public (:transmutation [selection (..selection <code>.any)]) +(syntax: .public (transmutation [selection (..selection <code>.any)]) (case selection {#Specific specific value} (in (list (` (.|> (~ value) - (..:representation (~ specific)) - (..:abstraction (~ specific)))))) + (..representation (~ specific)) + (..abstraction (~ specific)))))) {#Current value} - (in (list (` (.|> (~ value) ..:representation ..:abstraction)))))) + (in (list (` (.|> (~ value) ..representation ..abstraction)))))) -(syntax: .public (^:representation [selection (<code>.form (..selection <code>.local_symbol)) - body <code>.any - branches (<>.some <code>.any)]) +(syntax: .public (pattern [selection (<code>.form (..selection <code>.local_symbol)) + body <code>.any + branches (<>.some <code>.any)]) (case selection {#Specific specific name} (let [g!var (code.local_symbol name)] (in (list& g!var - (` (.let [(~ g!var) (..:representation (~ specific) (~ g!var))] + (` (.let [(~ g!var) (..representation (~ specific) (~ g!var))] (~ body))) branches))) {#Current name} (let [g!var (code.local_symbol name)] (in (list& g!var - (` (.let [(~ g!var) (..:representation (~ g!var))] + (` (.let [(~ g!var) (..representation (~ g!var))] (~ body))) branches))))) diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index a4312b3e8..541134b70 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -366,17 +366,17 @@ (-> Var (Check Any)) (function (_ context) {try.#Success [(revised .#var_bindings - (list#mix (: (:let [binding [Nat (Maybe Type)]] - (-> binding - (List binding) - (List binding))) - (function (_ in out) - (let [[@var :var:] in] - (if (n.= @ @var) - out - (list& in out))))) - (: (List [Nat (Maybe Type)]) - (list))) + (list#mix (is (//.let [binding [Nat (Maybe Type)]] + (-> binding + (List binding) + (List binding))) + (function (_ in out) + (let [[@var :var:] in] + (if (n.= @ @var) + out + (list& in out))))) + (is (List [Nat (Maybe Type)]) + (list))) context) []]})) diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index 28c9b7e35..d4f06d136 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/type/dynamic.lux @@ -1,6 +1,6 @@ (.using [library - [lux "*" + [lux {"-" static} ["[0]" debug] [control ["[0]" try {"+" Try}] @@ -13,7 +13,7 @@ [macro {"+" with_symbols} ["[0]" syntax {"+" syntax:}]] ["[0]" type - abstract]]]) + ["[0]" abstract {"+" abstract:}]]]]) (exception: .public (wrong_type [expected Type actual Type]) @@ -26,29 +26,29 @@ (def: abstraction (-> [Type Any] Dynamic) - (|>> :abstraction)) + (|>> abstract.abstraction)) (def: representation (-> Dynamic [Type Any]) - (|>> :representation)) + (|>> abstract.representation)) - (syntax: .public (:dynamic [value <code>.any]) + (syntax: .public (dynamic [value <code>.any]) (with_symbols [g!value] - (in (list (` (let [(~ g!value) (~ value)] - ((~! ..abstraction) [(:of (~ g!value)) (~ g!value)]))))))) + (in (list (` (.let [(~ g!value) (~ value)] + ((~! ..abstraction) [(.type_of (~ g!value)) (~ g!value)]))))))) - (syntax: .public (:static [type <code>.any - value <code>.any]) + (syntax: .public (static [type <code>.any + value <code>.any]) (with_symbols [g!type g!value] - (in (list (` (let [[(~ g!type) (~ g!value)] ((~! ..representation) (~ value))] - (: ((~! try.Try) (~ type)) - (if (# (~! type.equivalence) (~' =) - (.type (~ type)) (~ g!type)) - {try.#Success (:as (~ type) (~ g!value))} - ((~! exception.except) ..wrong_type [(.type (~ type)) (~ g!type)]))))))))) + (in (list (` (.let [[(~ g!type) (~ g!value)] ((~! ..representation) (~ value))] + (.is ((~! try.Try) (~ type)) + (.if (.# (~! type.equivalence) (~' =) + (.type (~ type)) (~ g!type)) + {try.#Success (.as (~ type) (~ g!value))} + ((~! exception.except) ..wrong_type [(.type (~ type)) (~ g!type)]))))))))) (def: .public (format value) (-> Dynamic (Try Text)) - (let [[type value] (:representation value)] + (let [[type value] (abstract.representation value)] (debug.representation type value))) ) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index 25678f37a..828656a46 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -150,8 +150,8 @@ [local_batches meta.locals .let [total_locals (list#mix (function (_ [name type] table) (try.else table (dictionary.has' name type table))) - (: (Dictionary Text Type) - (dictionary.empty text.hash)) + (is (Dictionary Text Type) + (dictionary.empty text.hash)) (list#conjoint local_batches))]] (in (|> total_locals dictionary.entries diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux index 7f31f5187..de4a5ac58 100644 --- a/stdlib/source/library/lux/type/poly.lux +++ b/stdlib/source/library/lux/type/poly.lux @@ -38,11 +38,11 @@ (in (.list (` ((~! syntax:) (~ export_policy) ((~ g!name) [(~ g!type) (~! <code>.any)]) ((~! do) (~! meta.monad) [(~ g!type) ((~! meta.eval) .Type (~ g!type))] - (case (: (.Either .Text .Code) - ((~! <type>.result) ((~! <>.rec) - (function ((~ g!_) (~ g!name)) - (~ body))) - (.:as .Type (~ g!type)))) + (case (is (.Either .Text .Code) + ((~! <type>.result) ((~! <>.rec) + (function ((~ g!_) (~ g!name)) + (~ body))) + (.as .Type (~ g!type)))) {.#Left (~ g!output)} ((~! meta.failure) (~ g!output)) diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux index 591734219..bd190b7b5 100644 --- a/stdlib/source/library/lux/type/quotient.lux +++ b/stdlib/source/library/lux/type/quotient.lux @@ -9,7 +9,7 @@ [macro {"+" with_symbols} [syntax {"+" syntax:}]] ["[0]" type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Class t c %) (-> t c) @@ -18,7 +18,7 @@ (All (_ t c) (Ex (_ %) (-> (-> t c) (Class t c %)))) - (|>> :abstraction)) + (|>> abstraction)) (abstract: .public (Quotient t c %) (Record @@ -29,13 +29,13 @@ (All (_ t c %) (-> (Class t c %) t (Quotient t c %))) - (:abstraction [#value value - #label ((:representation Class class) value)])) + (abstraction [#value value + #label ((representation Class class) value)])) (template [<name> <output> <slot>] [(def: .public <name> (All (_ t c %) (-> (Quotient t c %) <output>)) - (|>> :representation (the <slot>)))] + (|>> representation (the <slot>)))] [value t #value] [label c #label] @@ -44,14 +44,26 @@ ) (syntax: .public (type [class <code>.any]) - (with_symbols [g!t g!c g!%] - (in (list (` ((~! type.:by_example) - [(~ g!t) (~ g!c) (~ g!%)] - - (..Class (~ g!t) (~ g!c) (~ g!%)) - (~ class) - - (..Quotient (~ g!t) (~ g!c) (~ g!%)))))))) + ... TODO: Switch to the cleaner approach ASAP. + (with_symbols [g!t g!c g!% g!_ g!:quotient:] + (in (list (` (let [... (~ g!_) (.is (.Ex ((~ g!_) (~ g!t) (~ g!c) (~ g!%)) + ... (..Class (~ g!t) (~ g!c) (~ g!%))) + ... (~ class)) + ] + (.case (.type_of (~ class)) + {.#Apply (~ g!%) {.#Apply (~ g!c) {.#Apply (~ g!t) (~ g!:quotient:)}}} + (.type (..Quotient (~ g!t) (~ g!c) (~ g!%))) + + (~ g!_) + (.undefined)))) + ... (` ((~! type.by_example) + ... [(~ g!t) (~ g!c) (~ g!%)] + + ... (..Class (~ g!t) (~ g!c) (~ g!%)) + ... (~ class) + + ... (..Quotient (~ g!t) (~ g!c) (~ g!%)))) + )))) (implementation: .public (equivalence super) (All (_ t c %) (-> (Equivalence c) (Equivalence (..Quotient t c %)))) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 304d7a07b..c4ac00c29 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -9,7 +9,7 @@ ["[0]" macro [syntax {"+" syntax:}]] ["[0]" type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Refined t %) (Record @@ -25,14 +25,14 @@ (-> (Predicate t) (Refiner t %)))) (function (_ value) (if (predicate value) - {.#Some (:abstraction [#value value - #predicate predicate])} + {.#Some (abstraction [#value value + #predicate predicate])} {.#None}))) (template [<name> <output> <slot>] [(def: .public <name> (All (_ t %) (-> (Refined t %) <output>)) - (|>> :representation (the <slot>)))] + (|>> representation (the <slot>)))] [value t #value] [predicate (Predicate t) #predicate] @@ -43,11 +43,11 @@ (-> (-> t t) (-> (Refined t %) (Maybe (Refined t %))))) (function (_ refined) - (let [(open "_[0]") (:representation refined) + (let [(open "_[0]") (representation refined) value' (transform _#value)] (if (_#predicate value') - {.#Some (:abstraction [..#value value' - ..#predicate _#predicate])} + {.#Some (abstraction [..#value value' + ..#predicate _#predicate])} {.#None})))) ) @@ -85,9 +85,21 @@ {.#Item head no}])))) (syntax: .public (type [refiner <code>.any]) - (macro.with_symbols [g!t g!%] - (in (list (` ((~! type.:by_example) [(~ g!t) (~ g!%)] - (..Refiner (~ g!t) (~ g!%)) - (~ refiner) - - (..Refined (~ g!t) (~ g!%)))))))) + ... TODO: Switch to the cleaner approach ASAP. + (macro.with_symbols [g!t g!% g!_ g!:refiner:] + (in (list (` (let [... (~ g!_) (.is (.Ex ((~ g!_) (~ g!t) (~ g!%)) + ... (..Refined (~ g!t) (~ g!%))) + ... (~ refiner)) + ] + (.case (.type_of (~ refiner)) + {.#Apply (~ g!%) {.#Apply (~ g!t) (~ g!:refiner:)}} + (.type (..Refined (~ g!t) (~ g!%))) + + (~ g!_) + (.undefined)))) + ... (` ((~! type.by_example) [(~ g!t) (~ g!%)] + ... (..Refiner (~ g!t) (~ g!%)) + ... (~ refiner) + + ... (..Refined (~ g!t) (~ g!%)))) + )))) diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index 4ac5a17c0..5ed5a5f7e 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -23,7 +23,7 @@ [number ["n" nat]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (type: .public (Procedure monad input output value) (-> input (monad [output value]))) @@ -75,7 +75,7 @@ (template [<name> <mode>] [(def: <name> (Ex (_ k) (-> Any (Key <mode> k))) - (|>> :abstraction))] + (|>> abstraction))] [ordered_key Ordered] [commutative_key Commutative] @@ -88,7 +88,7 @@ [(def: .public (<name> monad value) (All (_ ! v) (Ex (_ k) (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v))))) (function (_ keys) - (# monad in [[(<key> []) keys] (:abstraction value)])))] + (# monad in [[(<key> []) keys] (abstraction value)])))] [ordered Ordered ..ordered_key] [commutative Commutative ..commutative_key] @@ -98,7 +98,7 @@ (All (_ ! v k m) (-> (Monad !) (Res k v) (Relevant ! (Key m k) v))) (function (_ [key keys]) - (# monad in [keys (:representation resource)]))) + (# monad in [keys (representation resource)]))) ) (exception: .public (index_cannot_be_repeated [index Nat]) @@ -141,20 +141,20 @@ (do maybe.monad [input (list.item from g!inputs)] (in (sequence.suffix input to)))) - (: (Sequence Code) sequence.empty) + (is (Sequence Code) sequence.empty) swaps) maybe.trusted sequence.list) g!inputsT+ (list#each (|>> (~) (..Key ..Commutative) (`)) g!inputs) g!outputsT+ (list#each (|>> (~) (..Key ..Commutative) (`)) g!outputs)]] - (in (list (` (: (All ((~ g!_) (~ g!!) (~+ g!inputs) (~ g!context)) - (-> ((~! monad.Monad) (~ g!!)) - (Procedure (~ g!!) - [(~+ g!inputsT+) (~ g!context)] - [(~+ g!outputsT+) (~ g!context)] - .Any))) - (function ((~ g!_) (~ g!!) [(~+ g!inputs) (~ g!context)]) - (# (~ g!!) (~' in) [[(~+ g!outputs) (~ g!context)] []])))))))))) + (in (list (` (is (All ((~ g!_) (~ g!!) (~+ g!inputs) (~ g!context)) + (-> ((~! monad.Monad) (~ g!!)) + (Procedure (~ g!!) + [(~+ g!inputsT+) (~ g!context)] + [(~+ g!outputsT+) (~ g!context)] + .Any))) + (function ((~ g!_) (~ g!!) [(~+ g!inputs) (~ g!context)]) + (# (~ g!!) (~' in) [[(~+ g!outputs) (~ g!context)] []])))))))))) (def: amount (Parser Nat) @@ -171,14 +171,14 @@ [g!keys (|> (macro.symbol "keys") (list.repeated amount) (monad.all !))] - (in (list (` (: (All ((~ g!_) (~ g!!) (~+ g!keys) (~ g!context)) - (-> ((~! monad.Monad) (~ g!!)) - (Procedure (~ g!!) - [<from> (~ g!context)] - [<to> (~ g!context)] - .Any))) - (function ((~ g!_) (~ g!!) [<from> (~ g!context)]) - (# (~ g!!) (~' in) [[<to> (~ g!context)] []])))))))))] + (in (list (` (is (All ((~ g!_) (~ g!!) (~+ g!keys) (~ g!context)) + (-> ((~! monad.Monad) (~ g!!)) + (Procedure (~ g!!) + [<from> (~ g!context)] + [<to> (~ g!context)] + .Any))) + (function ((~ g!_) (~ g!!) [<from> (~ g!context)]) + (# (~ g!!) (~' in) [[<to> (~ g!context)] []])))))))))] [group (~+ g!keys) [(~+ g!keys)]] [un_group [(~+ g!keys)] (~+ g!keys)] diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index 6da16af7e..08fc7770f 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -24,24 +24,24 @@ ["i" int] ["[0]" ratio {"+" Ratio}]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (abstract: .public (Qty unit) Int (def: in' (All (_ unit) (-> Int (Qty unit))) - (|>> :abstraction)) + (|>> abstraction)) (def: out' (All (_ unit) (-> (Qty unit) Int)) - (|>> :representation)) + (|>> representation)) (template [<name> <op>] [(def: .public (<name> param subject) (All (_ unit) (-> (Qty unit) (Qty unit) (Qty unit))) - (:abstraction (<op> (:representation param) - (:representation subject))))] + (abstraction (<op> (representation param) + (representation subject))))] [+ i.+] [- i.-] @@ -50,8 +50,8 @@ (template [<name> <op> <p> <s> <p*s>] [(def: .public (<name> param subject) (All (_ p s) (-> (Qty <p>) (Qty <s>) (Qty <p*s>))) - (:abstraction (<op> (:representation param) - (:representation subject))))] + (abstraction (<op> (representation param) + (representation subject))))] [* i.* p s [p s]] [/ i./ p [p s] s] @@ -60,19 +60,19 @@ (type: .public (Unit a) (Interface - (: (-> Int (Qty a)) - in) - (: (-> (Qty a) Int) - out))) + (is (-> Int (Qty a)) + in) + (is (-> (Qty a) Int) + out))) (type: .public (Scale s) (Interface - (: (All (_ u) (-> (Qty u) (Qty (s u)))) - scale) - (: (All (_ u) (-> (Qty (s u)) (Qty u))) - de_scale) - (: Ratio - ratio))) + (is (All (_ u) (-> (Qty u) (Qty (s u)))) + scale) + (is (All (_ u) (-> (Qty (s u)) (Qty u))) + de_scale) + (is Ratio + ratio))) (type: .public Pure (Qty Any)) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index 5f0fef818..74700b18b 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -19,14 +19,14 @@ (type: .public (Console !) (Interface - (: (-> [] (! (Try Char))) - read) - (: (-> [] (! (Try Text))) - read_line) - (: (-> Text (! (Try Any))) - write) - (: (-> [] (! (Try Any))) - close))) + (is (-> [] (! (Try Char))) + read) + (is (-> [] (! (Try Text))) + read_line) + (is (-> Text (! (Try Any))) + write) + (is (-> [] (! (Try Any))) + close))) (def: .public (async console) (-> (Console IO) (Console Async)) @@ -78,7 +78,7 @@ jvm_output (java/lang/System::out)] (<| in {try.#Success} - (: (Console IO)) ... TODO: Remove ASAP + (is (Console IO)) ... TODO: Remove ASAP (implementation (def: (read _) (|> jvm_input @@ -123,8 +123,8 @@ (case (Readable_Stream::read it) {.#Some buffer} (let [input (Buffer::toString buffer)] - (case (: (Maybe [<type> Text]) - <query>) + (case (is (Maybe [<type> Text]) + <query>) {.#Some [head tail]} (exec (Readable_Stream::unshift|String tail it) @@ -152,8 +152,8 @@ (!read Text (text.split_by text.\n input))) (def: (write it) - (let [[read! write!] (: [(async.Async (Try [])) (async.Resolver (Try []))] - (async.async []))] + (let [[read! write!] (is [(async.Async (Try [])) (async.Resolver (Try []))] + (async.async []))] (exec (Writable_Stream::write it (ffi.function (_ []) Any (io.run! (write! {try.#Success []}))) (process::stdout)) @@ -170,14 +170,14 @@ (type: .public (Mock s) (Interface - (: (-> s (Try [s Char])) - on_read) - (: (-> s (Try [s Text])) - on_read_line) - (: (-> Text s (Try s)) - on_write) - (: (-> s (Try s)) - on_close))) + (is (-> s (Try [s Char])) + on_read) + (is (-> s (Try [s Text])) + on_read_line) + (is (-> Text s (Try s)) + on_write) + (is (-> s (Try s)) + on_close))) (def: .public (mock mock init) (All (_ s) (-> (Mock s) s (Console IO))) diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux index 25a29b3b3..748f2955d 100644 --- a/stdlib/source/library/lux/world/db/jdbc.lux +++ b/stdlib/source/library/lux/world/db/jdbc.lux @@ -81,14 +81,14 @@ (type: .public (DB !) (Interface - (: (Can_Execute !) - execute) - (: (Can_Insert !) - insert) - (: (Can_Query !) - query) - (: (Can_Close !) - close))) + (is (Can_Execute !) + execute) + (is (Can_Insert !) + insert) + (is (Can_Query !) + query) + (is (Can_Close !) + close))) (def: (with_statement statement conn action) (All (_ i a) @@ -121,41 +121,41 @@ [connection (java/sql/DriverManager::getConnection (the #url creds) (the #user creds) (the #password creds))] - (in (: (DB IO) - (implementation - (def: execute - (..can_execute - (function (execute statement) - (with_statement statement connection - (function (_ prepared) - (do (try.with io.monad) - [row_count (java/sql/PreparedStatement::executeUpdate prepared)] - (in (.nat row_count)))))))) - - (def: insert - (..can_insert - (function (insert statement) - (with_statement statement connection - (function (_ prepared) - (do (try.with io.monad) - [_ (java/sql/PreparedStatement::executeUpdate prepared) - result_set (io.io (java/sql/Statement::getGeneratedKeys prepared))] - (/output.rows /output.long result_set))))))) - - (def: close - (..can_close - (function (close _) - (java/sql/Connection::close connection)))) - - (def: query - (..can_query - (function (query [statement output]) - (with_statement statement connection - (function (_ prepared) - (do (try.with io.monad) - [result_set (java/sql/PreparedStatement::executeQuery prepared)] - (/output.rows output result_set))))))) - ))))) + (in (is (DB IO) + (implementation + (def: execute + (..can_execute + (function (execute statement) + (with_statement statement connection + (function (_ prepared) + (do (try.with io.monad) + [row_count (java/sql/PreparedStatement::executeUpdate prepared)] + (in (.nat row_count)))))))) + + (def: insert + (..can_insert + (function (insert statement) + (with_statement statement connection + (function (_ prepared) + (do (try.with io.monad) + [_ (java/sql/PreparedStatement::executeUpdate prepared) + result_set (io.io (java/sql/Statement::getGeneratedKeys prepared))] + (/output.rows /output.long result_set))))))) + + (def: close + (..can_close + (function (close _) + (java/sql/Connection::close connection)))) + + (def: query + (..can_query + (function (query [statement output]) + (with_statement statement connection + (function (_ prepared) + (do (try.with io.monad) + [result_set (java/sql/PreparedStatement::executeQuery prepared)] + (/output.rows output result_set))))))) + ))))) (def: .public (with_db creds action) (All (_ a) diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux index d3cb4856f..f43d12af6 100644 --- a/stdlib/source/library/lux/world/db/sql.lux +++ b/stdlib/source/library/lux/world/db/sql.lux @@ -1,19 +1,19 @@ (.using - [library - [lux {"-" Source Definition function and or not type int} - [control - [monad {"+" do}]] - [data - [number - ["i" int]] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [macro - ["[0]" template]] - [type - abstract]]]) + [library + [lux {"-" Source Definition function and or not type int} + [control + [monad {"+" do}]] + [data + [number + ["i" int]] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [macro + ["[0]" template]] + [type + [abstract {"-" pattern}]]]]) (def: parenthesize (-> Text Text) @@ -104,23 +104,23 @@ ... Do not use this function to actually execute SQL code. (def: .public read (-> (SQL Any) Text) - (|>> :representation)) + (|>> representation)) (def: .public (sql action) (-> Statement Text) - (format (:representation action) ";")) + (format (representation action) ";")) (def: listing (-> (List (SQL Any)) Text) - (|>> (list#each (|>> :representation)) + (|>> (list#each (|>> representation)) (text.interposed ", "))) ... Value - (def: .public ? Placeholder (:abstraction "?")) + (def: .public ? Placeholder (abstraction "?")) (def: literal (-> Text Literal) - (|>> :abstraction)) + (|>> abstraction)) (def: .public null Literal (..literal "NULL")) @@ -132,22 +132,22 @@ (def: .public function (-> Text Function) - (|>> :abstraction)) + (|>> abstraction)) (def: .public (call function parameters) (-> Function (List Value) Value) - (:abstraction (format (:representation function) - (..parenthesize (..listing parameters))))) + (abstraction (format (representation function) + (..parenthesize (..listing parameters))))) ... Condition (template [<name> <sql_op>] [(def: .public (<name> reference sample) (-> Value Value Condition) - (:abstraction + (abstraction (..parenthesize - (format (:representation sample) + (format (representation sample) " " <sql_op> " " - (:representation reference)))))] + (representation reference)))))] [= "="] [<> "<>"] @@ -162,26 +162,26 @@ (def: .public (between from to sample) (-> Value Value Value Condition) - (:abstraction + (abstraction (..parenthesize - (format (:representation sample) - " BETWEEN " (:representation from) - " AND " (:representation to))))) + (format (representation sample) + " BETWEEN " (representation from) + " AND " (representation to))))) (def: .public (in options value) (-> (List Value) Value Condition) - (:abstraction - (format (:representation value) + (abstraction + (format (representation value) " IN " (..parenthesize (listing options))))) (template [<func_name> <sql_op>] [(def: .public (<func_name> left right) (-> Condition Condition Condition) - (:abstraction - (format (..parenthesize (:representation left)) + (abstraction + (format (..parenthesize (representation left)) " " <sql_op> " " - (..parenthesize (:representation right)))))] + (..parenthesize (representation right)))))] [and "AND"] [or "OR"] @@ -190,7 +190,7 @@ (template [<name> <type> <sql>] [(def: .public <name> (-> <type> Condition) - (|>> :representation ..parenthesize (format <sql> " ") :abstraction))] + (|>> representation ..parenthesize (format <sql> " ") abstraction))] [not Condition "NOT"] [exists Any_Query "EXISTS"] @@ -200,7 +200,7 @@ (template [<name> <type> <decoration>] [(def: .public <name> (-> <type> Source) - (|>> :representation <decoration> :abstraction))] + (|>> representation <decoration> abstraction))] [from_table Table (<|)] [from_view View (<|)] @@ -210,7 +210,7 @@ (template [<func_name> <op>] [(def: .public (<func_name> columns source) (-> (List [Column Alias]) Source Base_Query) - (:abstraction + (abstraction (format <op> " " (case columns @@ -221,10 +221,10 @@ (|> columns (list#each (.function (_ [column alias]) (if (text#= ..no_alias alias) - (:representation column) - (format (:representation column) " AS " alias)))) + (representation column) + (format (representation column) " AS " alias)))) (text.interposed ", "))) - " FROM " (:representation source))))] + " FROM " (representation source))))] [select "SELECT"] @@ -234,11 +234,11 @@ (template [<name> <join_text>] [(def: .public (<name> table condition prev) (-> Table Condition Base_Query Base_Query) - (:abstraction - (format (:representation prev) + (abstraction + (format (representation prev) " " <join_text> " " - (:representation table) - " ON " (:representation condition))))] + (representation table) + " ON " (representation condition))))] [inner_join "INNER JOIN"] [left_join "LEFT JOIN"] @@ -249,10 +249,10 @@ (template [<function> <sql_op>] [(def: .public (<function> left right) (-> Any_Query Any_Query (Query Without_Where Without_Having No_Order No_Group No_Limit No_Offset)) - (:abstraction - (format (:representation left) + (abstraction + (format (representation left) " " <sql_op> " " - (:representation right))))] + (representation right))))] [union "UNION"] [union_all "UNION ALL"] @@ -263,8 +263,8 @@ [(`` (def: .public (<name> value query) (All (_ (~~ (template.spliced <variables>))) (-> Nat <input> <output>)) - (:abstraction - (format (:representation query) + (abstraction + (format (representation query) " " <sql> " " (%.nat value)))))] @@ -280,7 +280,7 @@ (template [<name> <sql>] [(def: .public <name> Order - (:abstraction <sql>))] + (abstraction <sql>))] [ascending "ASC"] [descending "DESC"] @@ -293,15 +293,15 @@ (Query where having With_Order group limit offset))) (case pairs {.#End} - (|> query :representation :abstraction) + (|> query representation abstraction) _ - (:abstraction - (format (:representation query) + (abstraction + (format (representation query) " ORDER BY " (|> pairs (list#each (.function (_ [value order]) - (format (:representation value) " " (:representation order)))) + (format (representation value) " " (representation order)))) (text.interposed ", ")))))) (def: .public (group_by pairs query) @@ -311,19 +311,19 @@ (Query where having order With_Group limit offset))) (case pairs {.#End} - (|> query :representation :abstraction) + (|> query representation abstraction) _ - (:abstraction - (format (:representation query) + (abstraction + (format (representation query) " GROUP BY " (..listing pairs))))) ... Command (def: .public (insert table columns rows) (-> Table (List Column) (List (List Value)) (Command Without_Where Without_Having)) - (:abstraction - (format "INSERT INTO " (:representation table) " " + (abstraction + (format "INSERT INTO " (representation table) " " (..parenthesize (..listing columns)) " VALUES " (|> rows @@ -333,48 +333,48 @@ (def: .public (update table pairs) (-> Table (List [Column Value]) (Command No_Where No_Having)) - (:abstraction (format "UPDATE " (:representation table) - (case pairs - {.#End} - "" - - _ - (format " SET " (|> pairs - (list#each (.function (_ [column value]) - (format (:representation column) "=" (:representation value)))) - (text.interposed ", "))))))) + (abstraction (format "UPDATE " (representation table) + (case pairs + {.#End} + "" + + _ + (format " SET " (|> pairs + (list#each (.function (_ [column value]) + (format (representation column) "=" (representation value)))) + (text.interposed ", "))))))) (def: .public delete (-> Table (Command No_Where No_Having)) - (|>> :representation (format "DELETE FROM ") :abstraction)) + (|>> representation (format "DELETE FROM ") abstraction)) ... Action (def: .public (where condition prev) (All (_ kind having) (-> Condition (Action No_Where having kind) (Action With_Where having kind))) - (:abstraction - (format (:representation prev) + (abstraction + (format (representation prev) " WHERE " - (:representation condition)))) + (representation condition)))) (def: .public (having condition prev) (All (_ where kind) (-> Condition (Action where No_Having kind) (Action where With_Having kind))) - (:abstraction - (format (:representation prev) + (abstraction + (format (representation prev) " HAVING " - (:representation condition)))) + (representation condition)))) ... Schema (def: .public type (-> Text (Schema Value)) - (|>> :abstraction)) + (|>> abstraction)) (template [<name> <attr>] [(def: .public (<name> attr) (-> (Schema Value) (Schema Value)) - (:abstraction - (format (:representation attr) " " <attr>)))] + (abstraction + (format (representation attr) " " <attr>)))] [unique "UNIQUE"] [not_null "NOT NULL"] @@ -383,38 +383,38 @@ (def: .public (default value attr) (-> Value (Schema Value) (Schema Value)) - (:abstraction - (format (:representation attr) " DEFAULT " (:representation value)))) + (abstraction + (format (representation attr) " DEFAULT " (representation value)))) (def: .public (define_column name type) (-> Column (Schema Value) (Schema Column)) - (:abstraction - (format (:representation name) " " (:representation type)))) + (abstraction + (format (representation name) " " (representation type)))) (def: .public (auto_increment offset column) (-> Int (Schema Column) (Schema Column)) - (:abstraction - (format (:representation column) " AUTO_INCREMENT=" (:representation (..int offset))))) + (abstraction + (format (representation column) " AUTO_INCREMENT=" (representation (..int offset))))) (def: .public (create_table or_replace? table columns) (-> Bit Table (List (Schema Column)) Definition) (let [command (if or_replace? "CREATE OR REPLACE TABLE" "CREATE TABLE IF NOT EXISTS")] - (:abstraction - (format command " " (:representation table) + (abstraction + (format command " " (representation table) (..parenthesize (..listing columns)))))) (def: .public (create_table_as table query) (-> Table Any_Query Definition) - (:abstraction - (format "CREATE TABLE " (:representation table) " AS " (:representation query)))) + (abstraction + (format "CREATE TABLE " (representation table) " AS " (representation query)))) (template [<name> <sql>] [(def: .public (<name> table) (-> Table Definition) - (:abstraction - (format <sql> " TABLE " (:representation table))))] + (abstraction + (format <sql> " TABLE " (representation table))))] [drop "DROP"] [truncate "TRUNCATE"] @@ -422,18 +422,18 @@ (def: .public (add_column table column) (-> Table (Schema Column) Definition) - (:abstraction - (format "ALTER TABLE " (:representation table) " ADD " (:representation column)))) + (abstraction + (format "ALTER TABLE " (representation table) " ADD " (representation column)))) (def: .public (drop_column table column) (-> Table Column Definition) - (:abstraction - (format "ALTER TABLE " (:representation table) " DROP COLUMN " (:representation column)))) + (abstraction + (format "ALTER TABLE " (representation table) " DROP COLUMN " (representation column)))) (template [<name> <type>] [(def: .public (<name> name) (-> Text <type>) - (:abstraction name))] + (abstraction name))] [column Column] [table Table] @@ -445,7 +445,7 @@ (template [<name> <type> <sql>] [(def: .public <name> (-> <type> Definition) - (|>> :representation (format <sql> " ") :abstraction))] + (|>> representation (format <sql> " ") abstraction))] [create_db DB "CREATE DATABASE"] [drop_db DB "DROP DATABASE"] @@ -455,8 +455,8 @@ (template [<name> <sql>] [(def: .public (<name> view query) (-> View Any_Query Definition) - (:abstraction - (format <sql> " " (:representation view) " AS " (:representation query))))] + (abstraction + (format <sql> " " (representation view) " AS " (representation query))))] [create_view "CREATE VIEW"] [create_or_replace_view "CREATE OR REPLACE VIEW"] @@ -464,17 +464,17 @@ (def: .public (create_index index table unique? columns) (-> Index Table Bit (List Column) Definition) - (:abstraction - (format "CREATE " (if unique? "UNIQUE" "") " INDEX " (:representation index) - " ON " (:representation table) " " (..parenthesize (..listing columns))))) + (abstraction + (format "CREATE " (if unique? "UNIQUE" "") " INDEX " (representation index) + " ON " (representation table) " " (..parenthesize (..listing columns))))) (def: .public (with alias query body) (All (_ where having order group limit offset) (-> Table Any_Query (Query where having order group limit offset) (Query where having order group limit offset))) - (:abstraction - (format "WITH " (:representation alias) - " AS " (..parenthesize (:representation query)) - " " (:representation body)))) + (abstraction + (format "WITH " (representation alias) + " AS " (..parenthesize (representation query)) + " " (representation body)))) ) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index b50da2586..4e47a182b 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -43,20 +43,20 @@ (`` (type: .public (System !) (Interface - (: Text - separator) + (is Text + separator) (~~ (template [<name> <output>] - [(: (-> Path (! <output>)) - <name>)] + [(is (-> Path (! <output>)) + <name>)] [file? Bit] [directory? Bit] )) (~~ (template [<name> <output>] - [(: (-> Path (! (Try <output>))) - <name>)] + [(is (-> Path (! (Try <output>))) + <name>)] [make_directory Any] [directory_files (List Path)] @@ -70,8 +70,8 @@ )) (~~ (template [<name> <input>] - [(: (-> <input> Path (! (Try Any))) - <name>)] + [(is (-> <input> Path (! (Try Any))) + <name>)] [modify Instant] [write Binary] @@ -330,8 +330,8 @@ (template: (with_async <write> <type> <body>) [(template.with_locals [<read>] - (let [[<read> <write>] (: [(Async <type>) (async.Resolver <type>)] - (async.async []))] + (let [[<read> <write>] (is [(Async <type>) (async.Resolver <type>)] + (async.async []))] (exec <body> <read>)))]) @@ -366,7 +366,7 @@ io.run! write! (if (ffi.null? error) - {try.#Success (:expected datum)} + {try.#Success (as_expected datum)} {try.#Failure (Error::toString error)}))) (ffi.import: JsPath @@ -378,135 +378,135 @@ (do maybe.monad [node_fs (node_js.require "fs") node_path (node_js.require "path") - .let [node_fs (:as ..Fs node_fs) + .let [node_fs (as ..Fs node_fs) js_separator (if ffi.on_node_js? - (JsPath::sep (:as ..JsPath node_path)) + (JsPath::sep (as ..JsPath node_path)) "/")]] - (in (: (System Async) - (`` (implementation - (def: separator - js_separator) - - (~~ (template [<name> <method>] - [(def: (<name> path) - (do async.monad - [?stats (with_async write! (Try Stats) - (Fs::stat path (..value_callback write!) - node_fs))] - (in (case ?stats - {try.#Success stats} - (<method> stats) - - {try.#Failure _} - false))))] - - [file? Stats::isFile] - [directory? Stats::isDirectory] - )) - - (def: (make_directory path) - (do async.monad - [outcome (with_async write! (Try Any) - (Fs::access path - (|> node_fs Fs::constants FsConstants::F_OK) - (..any_callback write!) - node_fs))] - (case outcome - {try.#Success _} - (in (exception.except ..cannot_make_directory [path])) - - {try.#Failure _} + (in (is (System Async) + (`` (implementation + (def: separator + js_separator) + + (~~ (template [<name> <method>] + [(def: (<name> path) + (do async.monad + [?stats (with_async write! (Try Stats) + (Fs::stat path (..value_callback write!) + node_fs))] + (in (case ?stats + {try.#Success stats} + (<method> stats) + + {try.#Failure _} + false))))] + + [file? Stats::isFile] + [directory? Stats::isDirectory] + )) + + (def: (make_directory path) + (do async.monad + [outcome (with_async write! (Try Any) + (Fs::access path + (|> node_fs Fs::constants FsConstants::F_OK) + (..any_callback write!) + node_fs))] + (case outcome + {try.#Success _} + (in (exception.except ..cannot_make_directory [path])) + + {try.#Failure _} + (with_async write! (Try Any) + (Fs::mkdir path (..any_callback write!) node_fs))))) + + (~~ (template [<name> <method>] + [(def: (<name> path) + (do [! (try.with async.monad)] + [subs (with_async write! (Try (Array ffi.String)) + (Fs::readdir path (..value_callback write!) node_fs))] + (|> subs + (array.list {.#None}) + (list#each (|>> (format path js_separator))) + (monad.each ! (function (_ sub) + (# ! each (|>> <method> [sub]) + (with_async write! (Try Stats) + (Fs::stat sub (..value_callback write!) node_fs))))) + (# ! each (|>> (list.only product.right) + (list#each product.left))))))] + + [directory_files Stats::isFile] + [sub_directories Stats::isDirectory] + )) + + (def: (file_size path) + (do (try.with async.monad) + [stats (with_async write! (Try Stats) + (Fs::stat path (..value_callback write!) + node_fs))] + (in (|> stats + Stats::size + f.nat)))) + + (def: (last_modified path) + (do (try.with async.monad) + [stats (with_async write! (Try Stats) + (Fs::stat path (..value_callback write!) + node_fs))] + (in (|> stats + Stats::mtimeMs + f.int + duration.of_millis + instant.absolute)))) + + (def: (can_execute? path) + (# async.monad each + (|>> (pipe.case + {try.#Success _} + true + + {try.#Failure _} + false) + {try.#Success}) (with_async write! (Try Any) - (Fs::mkdir path (..any_callback write!) node_fs))))) - - (~~ (template [<name> <method>] - [(def: (<name> path) - (do [! (try.with async.monad)] - [subs (with_async write! (Try (Array ffi.String)) - (Fs::readdir path (..value_callback write!) node_fs))] - (|> subs - (array.list {.#None}) - (list#each (|>> (format path js_separator))) - (monad.each ! (function (_ sub) - (# ! each (|>> <method> [sub]) - (with_async write! (Try Stats) - (Fs::stat sub (..value_callback write!) node_fs))))) - (# ! each (|>> (list.only product.right) - (list#each product.left))))))] - - [directory_files Stats::isFile] - [sub_directories Stats::isDirectory] - )) - - (def: (file_size path) - (do (try.with async.monad) - [stats (with_async write! (Try Stats) - (Fs::stat path (..value_callback write!) - node_fs))] - (in (|> stats - Stats::size - f.nat)))) - - (def: (last_modified path) - (do (try.with async.monad) - [stats (with_async write! (Try Stats) - (Fs::stat path (..value_callback write!) - node_fs))] - (in (|> stats - Stats::mtimeMs - f.int - duration.of_millis - instant.absolute)))) - - (def: (can_execute? path) - (# async.monad each - (|>> (pipe.case - {try.#Success _} - true - - {try.#Failure _} - false) - {try.#Success}) + (Fs::access path + (|> node_fs Fs::constants FsConstants::X_OK) + (..any_callback write!) + node_fs)))) + + (def: (read path) + (with_async write! (Try Binary) + (Fs::readFile path (..value_callback write!) + node_fs))) + + (def: (delete path) + (do (try.with async.monad) + [stats (with_async write! (Try Stats) + (Fs::stat path (..value_callback write!) node_fs))] (with_async write! (Try Any) - (Fs::access path - (|> node_fs Fs::constants FsConstants::X_OK) - (..any_callback write!) + (if (Stats::isFile stats) + (Fs::unlink path (..any_callback write!) node_fs) + (Fs::rmdir path (..any_callback write!) node_fs))))) + + (def: (modify time_stamp path) + (with_async write! (Try Any) + (let [when (|> time_stamp instant.relative duration.millis i.frac)] + (Fs::utimes path when when (..any_callback write!) node_fs)))) - (def: (read path) - (with_async write! (Try Binary) - (Fs::readFile path (..value_callback write!) - node_fs))) - - (def: (delete path) - (do (try.with async.monad) - [stats (with_async write! (Try Stats) - (Fs::stat path (..value_callback write!) node_fs))] - (with_async write! (Try Any) - (if (Stats::isFile stats) - (Fs::unlink path (..any_callback write!) node_fs) - (Fs::rmdir path (..any_callback write!) node_fs))))) - - (def: (modify time_stamp path) - (with_async write! (Try Any) - (let [when (|> time_stamp instant.relative duration.millis i.frac)] - (Fs::utimes path when when (..any_callback write!) - node_fs)))) - - (~~ (template [<name> <method>] - [(def: (<name> data path) - (with_async write! (Try Any) - (<method> path (Buffer::from data) (..any_callback write!) - node_fs)))] - - [write Fs::writeFile] - [append Fs::appendFile] - )) - - (def: (move destination origin) - (with_async write! (Try Any) - (Fs::rename origin destination (..any_callback write!) - node_fs)))))))))) + (~~ (template [<name> <method>] + [(def: (<name> data path) + (with_async write! (Try Any) + (<method> path (Buffer::from data) (..any_callback write!) + node_fs)))] + + [write Fs::writeFile] + [append Fs::appendFile] + )) + + (def: (move destination origin) + (with_async write! (Try Any) + (Fs::rename origin destination (..any_callback write!) + node_fs)))))))))) @.python (as_is (type: (Tuple/2 left right) @@ -699,8 +699,8 @@ output (loop [input (|> children (array.list {.#None}) (list#each (|>> (format path ..ruby_separator)))) - output (: (List ..Path) - (list))] + output (is (List ..Path) + (list))] (case input {.#End} (in output) @@ -824,7 +824,7 @@ ... [(def: (<name> data) ... (do [! (try.with io.monad)] ... [outcome (..file_put_contents [path ("php pack" ..byte_array_format data) <mode>])] - ... (if (bit#= false (:as Bit outcome)) + ... (if (bit#= false (as Bit outcome)) ... (# io.monad in (exception.except ..cannot_write_to_file [path])) ... (in []))))] @@ -835,7 +835,7 @@ ... (def: (content _) ... (do [! (try.with io.monad)] ... [data (..file_get_contents [path])] - ... (if (bit#= false (:as Bit data)) + ... (if (bit#= false (as Bit data)) ... (# io.monad in (exception.except ..cannot_find_file [path])) ... (in (..unpack [..byte_array_format data]))))) @@ -846,7 +846,7 @@ ... [(def: (<name> _) ... (do [! (try.with io.monad)] ... [value (<ffi> [path])] - ... (if (bit#= false (:as Bit value)) + ... (if (bit#= false (as Bit value)) ... (# io.monad in (exception.except ..cannot_find_file [path])) ... (in (`` (|> value (~~ (template.spliced <pipeline>))))))))] @@ -860,21 +860,21 @@ ... (def: (modify moment) ... (do [! (try.with io.monad)] ... [verdict (..touch [path (|> moment instant.relative duration.millis (i./ +1,000))])] - ... (if (bit#= false (:as Bit verdict)) + ... (if (bit#= false (as Bit verdict)) ... (# io.monad in (exception.except ..cannot_find_file [path])) ... (in [])))) ... (def: (move destination) ... (do [! (try.with io.monad)] ... [verdict (..rename [path destination])] - ... (if (bit#= false (:as Bit verdict)) + ... (if (bit#= false (as Bit verdict)) ... (# io.monad in (exception.except ..cannot_find_file [path])) ... (in (file destination))))) ... (def: (delete _) ... (do (try.with io.monad) ... [verdict (..unlink [path])] - ... (if (bit#= false (:as Bit verdict)) + ... (if (bit#= false (as Bit verdict)) ... (# io.monad in (exception.except ..cannot_find_file [path])) ... (in [])))) ... )) @@ -894,7 +894,7 @@ ... (list.only (function (_ child) ... (not (or (text#= "." child) ... (text#= ".." child)))))) - ... output (: (List (<capability> IO)) + ... output (is (List (<capability> IO)) ... (list))] ... (case input ... {.#End} @@ -914,7 +914,7 @@ ... (def: (discard _) ... (do (try.with io.monad) ... [verdict (..rmdir [path])] - ... (if (bit#= false (:as Bit verdict)) + ... (if (bit#= false (as Bit verdict)) ... (# io.monad in (exception.except ..cannot_find_directory [path])) ... (in [])))) ... )) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index 8b100638b..645c4e99e 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -29,7 +29,7 @@ [time ["[0]" instant {"+" Instant} ("[1]#[0]" equivalence)]] [type - [abstract {"+" abstract: :representation :abstraction}]]]] + [abstract {"+" abstract: representation abstraction}]]]] ["[0]" //]) (abstract: .public Concern @@ -40,7 +40,7 @@ (def: none Concern - (:abstraction + (abstraction [#creation false #modification false #deletion false])) @@ -48,14 +48,14 @@ (template [<concern> <predicate> <event> <create> <modify> <delete>] [(def: .public <concern> Concern - (:abstraction + (abstraction [#creation <create> #modification <modify> #deletion <delete>])) (def: .public <predicate> (Predicate Concern) - (|>> :representation (the <event>)))] + (|>> representation (the <event>)))] [creation creation? #creation true false false] @@ -67,7 +67,7 @@ (def: .public (also left right) (-> Concern Concern Concern) - (:abstraction + (abstraction [#creation (or (..creation? left) (..creation? right)) #modification (or (..modification? left) (..modification? right)) #deletion (or (..deletion? left) (..deletion? right))])) @@ -83,14 +83,14 @@ (type: .public (Watcher !) (Interface - (: (-> Concern //.Path (! (Try Any))) - start) - (: (-> //.Path (! (Try Concern))) - concern) - (: (-> //.Path (! (Try Concern))) - stop) - (: (-> [] (! (Try (List [Concern //.Path])))) - poll))) + (is (-> Concern //.Path (! (Try Any))) + start) + (is (-> //.Path (! (Try Concern))) + concern) + (is (-> //.Path (! (Try Concern))) + stop) + (is (-> [] (! (Try (List [Concern //.Path])))) + poll))) (template [<name>] [(exception: .public (<name> [path //.Path]) @@ -129,8 +129,8 @@ (do ! [last_modified (# fs last_modified file)] (in (dictionary.has file last_modified tracker)))) - (: File_Tracker - (dictionary.empty text.hash)) + (is File_Tracker + (dictionary.empty text.hash)) files))) (def: (available_files fs directory) @@ -186,8 +186,8 @@ (def: .public (polling fs) (-> (//.System Async) (Watcher Async)) - (let [tracker (: (Var Directory_Tracker) - (stm.var (dictionary.empty text.hash)))] + (let [tracker (is (Var Directory_Tracker) + (stm.var (dictionary.empty text.hash)))] (implementation (def: (start new_concern path) (do [! async.monad] @@ -308,8 +308,8 @@ (def: (default_event_concern event) (All (_ a) (-> (java/nio/file/WatchEvent a) Concern)) - (let [kind (:as (java/nio/file/WatchEvent$Kind java/nio/file/Path) - (java/nio/file/WatchEvent::kind event))] + (let [kind (as (java/nio/file/WatchEvent$Kind java/nio/file/Path) + (java/nio/file/WatchEvent::kind event))] (cond (same? (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE) kind) ..creation @@ -374,8 +374,8 @@ (def: (default_poll watcher) (-> java/nio/file/WatchService (IO (Try (List [Concern //.Path])))) - (loop [output (: (List [Concern //.Path]) - (list))] + (loop [output (is (List [Concern //.Path]) + (list))] (do (try.with io.monad) [?key (java/nio/file/WatchService::poll watcher)] (case ?key @@ -386,10 +386,10 @@ (do ! [.let [path (|> key java/nio/file/WatchKey::watchable - (:as java/nio/file/Path) + (as java/nio/file/Path) java/nio/file/Path::toString ffi.of_string - (:as //.Path))] + (as //.Path))] the_concern (..default_key_concern key)] (again {.#Item [the_concern path] output})) @@ -402,13 +402,13 @@ (-> Concern (List Watch_Event)) ($_ list#composite (if (..creation? concern) - (list (:as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE))) + (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_CREATE))) (list)) (if (..modification? concern) - (list (:as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_MODIFY))) + (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_MODIFY))) (list)) (if (..deletion? concern) - (list (:as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_DELETE))) + (list (as Watch_Event (java/nio/file/StandardWatchEventKinds::ENTRY_DELETE))) (list)) )) @@ -417,49 +417,49 @@ (do (try.with io.monad) [watcher (java/nio/file/FileSystem::newWatchService (java/nio/file/FileSystems::getDefault)) - .let [tracker (stm.var (: (Dictionary //.Path [Concern java/nio/file/WatchKey]) - (dictionary.empty text.hash))) - - stop (: (-> //.Path (Async (Try Concern))) - (function (_ path) - (do [! async.monad] - [@tracker (stm.commit! (stm.read tracker))] - (case (dictionary.value path @tracker) - {.#Some [the_concern key]} - (do ! - [_ (async.future - (java/nio/file/WatchKey::cancel key)) - _ (stm.commit! (stm.update (dictionary.lacks path) tracker))] - (in {try.#Success the_concern})) - - {.#None} - (in (exception.except ..not_being_watched [path]))))))]] - (in (: (Watcher Async) - (implementation - (def: (start the_concern path) - (do async.monad - [?concern (stop path)] - (do (try.with async.monad) - [key (..default_start (..watch_events (..also (try.else ..none ?concern) - the_concern)) - watcher - path)] - (do async.monad - [_ (stm.commit! (stm.update (dictionary.has path [the_concern key]) tracker))] - (in {try.#Success []}))))) - (def: (concern path) - (do async.monad - [@tracker (stm.commit! (stm.read tracker))] - (case (dictionary.value path @tracker) - {.#Some [it key]} - (in {try.#Success it}) - - {.#None} - (in (exception.except ..not_being_watched [path]))))) - (def: stop stop) - (def: (poll _) - (async.future (..default_poll watcher))) - ))))) + .let [tracker (stm.var (is (Dictionary //.Path [Concern java/nio/file/WatchKey]) + (dictionary.empty text.hash))) + + stop (is (-> //.Path (Async (Try Concern))) + (function (_ path) + (do [! async.monad] + [@tracker (stm.commit! (stm.read tracker))] + (case (dictionary.value path @tracker) + {.#Some [the_concern key]} + (do ! + [_ (async.future + (java/nio/file/WatchKey::cancel key)) + _ (stm.commit! (stm.update (dictionary.lacks path) tracker))] + (in {try.#Success the_concern})) + + {.#None} + (in (exception.except ..not_being_watched [path]))))))]] + (in (is (Watcher Async) + (implementation + (def: (start the_concern path) + (do async.monad + [?concern (stop path)] + (do (try.with async.monad) + [key (..default_start (..watch_events (..also (try.else ..none ?concern) + the_concern)) + watcher + path)] + (do async.monad + [_ (stm.commit! (stm.update (dictionary.has path [the_concern key]) tracker))] + (in {try.#Success []}))))) + (def: (concern path) + (do async.monad + [@tracker (stm.commit! (stm.read tracker))] + (case (dictionary.value path @tracker) + {.#Some [it key]} + (in {try.#Success it}) + + {.#None} + (in (exception.except ..not_being_watched [path]))))) + (def: stop stop) + (def: (poll _) + (async.future (..default_poll watcher))) + ))))) )] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 6ad98c38c..4702436f2 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -32,9 +32,9 @@ (type: .public (Client !) (Interface - (: (-> //.Method URL //.Headers (Maybe Binary) - (! (Try (//.Response !)))) - request))) + (is (-> //.Method URL //.Headers (Maybe Binary) + (! (Try (//.Response !)))) + request))) (syntax: (method_function [[_ name] <code>.symbol]) (in (list (code.local_symbol (text.replaced "#" "" (text.lower_cased name)))))) @@ -191,34 +191,34 @@ (Client IO) (def: (request method url headers data) - (: (IO (Try (//.Response IO))) - (do [! (try.with io.monad)] - [connection (|> url ffi.as_string java/net/URL::new java/net/URL::openConnection) - .let [connection (:as java/net/HttpURLConnection connection)] - _ (java/net/HttpURLConnection::setRequestMethod (ffi.as_string (..jvm_method method)) connection) - _ (monad.each ! (function (_ [name value]) - (java/net/URLConnection::setRequestProperty (ffi.as_string name) (ffi.as_string value) connection)) - (dictionary.entries headers)) - _ (case data - {.#Some data} - (do ! - [_ (java/net/URLConnection::setDoOutput true connection) - stream (java/net/URLConnection::getOutputStream connection) - _ (java/io/OutputStream::write data stream) - _ (java/io/OutputStream::flush stream) - _ (java/lang/AutoCloseable::close stream)] - (in [])) - - {.#None} - (in [])) - status (java/net/HttpURLConnection::getResponseCode connection) - headers (..default_headers connection) - input (|> connection - java/net/URLConnection::getInputStream - (# ! each (|>> java/io/BufferedInputStream::new)))] - (in [(.nat (ffi.of_int status)) - [//.#headers headers - //.#body (..default_body input)]]))))))] + (is (IO (Try (//.Response IO))) + (do [! (try.with io.monad)] + [connection (|> url ffi.as_string java/net/URL::new java/net/URL::openConnection) + .let [connection (as java/net/HttpURLConnection connection)] + _ (java/net/HttpURLConnection::setRequestMethod (ffi.as_string (..jvm_method method)) connection) + _ (monad.each ! (function (_ [name value]) + (java/net/URLConnection::setRequestProperty (ffi.as_string name) (ffi.as_string value) connection)) + (dictionary.entries headers)) + _ (case data + {.#Some data} + (do ! + [_ (java/net/URLConnection::setDoOutput true connection) + stream (java/net/URLConnection::getOutputStream connection) + _ (java/io/OutputStream::write data stream) + _ (java/io/OutputStream::flush stream) + _ (java/lang/AutoCloseable::close stream)] + (in [])) + + {.#None} + (in [])) + status (java/net/HttpURLConnection::getResponseCode connection) + headers (..default_headers connection) + input (|> connection + java/net/URLConnection::getInputStream + (# ! each (|>> java/io/BufferedInputStream::new)))] + (in [(.nat (ffi.of_int status)) + [//.#headers headers + //.#body (..default_body input)]]))))))] (for @.old (as_is <jvm>) @.jvm (as_is <jvm>) (as_is))) @@ -232,9 +232,9 @@ (# async.monad each (|>> (pipe.case {try.#Success [status message]} - {try.#Success [status (revised //.#body (: (-> (//.Body IO) (//.Body Async)) - (function (_ body) - (|>> body async.future))) + {try.#Success [status (revised //.#body (is (-> (//.Body IO) (//.Body Async)) + (function (_ body) + (|>> body async.future))) message)]} {try.#Failure error} diff --git a/stdlib/source/library/lux/world/net/http/mime.lux b/stdlib/source/library/lux/world/net/http/mime.lux index 531173176..b9e9b8505 100644 --- a/stdlib/source/library/lux/world/net/http/mime.lux +++ b/stdlib/source/library/lux/world/net/http/mime.lux @@ -1,23 +1,23 @@ (.using - [library - [lux "*" - [data - ["[0]" text - ["%" format {"+" format}] - ["[0]" encoding {"+" Encoding}]]] - [type - abstract]]]) + [library + [lux "*" + [data + ["[0]" text + ["%" format {"+" format}] + ["[0]" encoding {"+" Encoding}]]] + [type + [abstract {"-" pattern}]]]]) (abstract: .public MIME Text (def: .public mime (-> Text MIME) - (|>> :abstraction)) + (|>> abstraction)) (def: .public name (-> MIME Text) - (|>> :representation)) + (|>> representation)) ) ... https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index 2da3bad68..9bdba0392 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -31,9 +31,7 @@ ["[0]" template]] [math [number - ["i" int]]] - [type - abstract]]] + ["i" int]]]]] [// [file {"+" Path}] [shell {"+" Exit}]]))) @@ -44,16 +42,16 @@ (type: .public (Program !) (Interface - (: (-> Any (! (List Text))) - available_variables) - (: (-> Text (! (Try Text))) - variable) - (: Path - home) - (: Path - directory) - (: (-> Exit (! Nothing)) - exit))) + (is (-> Any (! (List Text))) + available_variables) + (is (-> Text (! (Try Text))) + variable) + (is Path + home) + (is Path + directory) + (is (-> Exit (! Nothing)) + exit))) (def: .public (environment monad program) (All (_ !) (-> (Monad !) (Program !) (! Environment))) @@ -317,7 +315,7 @@ ... ..array_keys ... (array.list {.#None}) ... (list#each (function (_ variable) - ... [variable ("php array read" (:as Nat variable) environment)])) + ... [variable ("php array read" (as Nat variable) environment)])) ... (dictionary.of_list text.hash)))) ... @.scheme (do io.monad ... [input (..get-environment-variables [])] @@ -346,8 +344,8 @@ @.js (io.io (if ffi.on_node_js? (case (do maybe.monad [process/env (ffi.global Object [process env])] - (array.read! (:as Nat name) - (:as (Array Text) process/env))) + (array.read! (as Nat name) + (as (Array Text) process/env))) {.#Some value} {try.#Success value} @@ -371,7 +369,7 @@ @.js (if ffi.on_node_js? (|> (node_js.require "os") maybe.trusted - (:as NodeJs_OS) + (as NodeJs_OS) NodeJs_OS::homedir) <default>) @.python (os/path::expanduser "~") @@ -379,7 +377,7 @@ @.ruby (io.io (Dir::home)) ... @.php (do io.monad ... [output (..getenv/1 ["HOME"])] - ... (in (if (bit#= false (:as Bit output)) + ... (in (if (bit#= false (as Bit output)) ... "~" ... output))) @@ -413,7 +411,7 @@ @.ruby (io.io (FileUtils::pwd)) ... @.php (do io.monad ... [output (..getcwd [])] - ... (in (if (bit#= false (:as Bit output)) + ... (in (if (bit#= false (as Bit output)) ... "." ... output))) diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index c9092ae35..1881054bd 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -47,16 +47,16 @@ (type: .public (Process !) (Interface - (: (-> [] (! (Try Text))) - read) - (: (-> [] (! (Try Text))) - fail) - (: (-> Text (! (Try Any))) - write) - (: (-> [] (! (Try Any))) - destroy) - (: (-> [] (! (Try Exit))) - await))) + (is (-> [] (! (Try Text))) + read) + (is (-> [] (! (Try Text))) + fail) + (is (-> Text (! (Try Any))) + write) + (is (-> [] (! (Try Any))) + destroy) + (is (-> [] (! (Try Exit))) + await))) (def: (async_process process) (-> (Process IO) (Process Async)) @@ -81,8 +81,8 @@ (type: .public (Shell !) (Interface - (: (-> [Environment Path Command (List Argument)] (! (Try (Process !)))) - execute))) + (is (-> [Environment Path Command (List Argument)] (! (Try (Process !)))) + execute))) (def: .public (async shell) (-> (Shell IO) (Shell Async)) @@ -96,12 +96,12 @@ ... https://en.wikipedia.org/wiki/Code_injection#Shell_injection (type: (Policy ?) (Interface - (: (-> Command (Safe Command ?)) - command) - (: (-> Argument (Safe Argument ?)) - argument) - (: (All (_ a) (-> (Safe a ?) a)) - value))) + (is (-> Command (Safe Command ?)) + command) + (is (-> Argument (Safe Argument ?)) + argument) + (is (All (_ a) (-> (Safe a ?) a)) + value))) (type: (Sanitizer a) (-> a a)) @@ -139,35 +139,35 @@ (def: (policy safe_command safe_argument) (Ex (_ ?) (-> (Sanitizer Command) (Sanitizer Argument) (Policy ?))) (?.with_policy - (: (Context Safety Policy) - (function (_ (open "?[0]")) - (implementation - (def: command (|>> safe_command ?#can_upgrade)) - (def: argument (|>> safe_argument ?#can_upgrade)) - (def: value ?#can_downgrade)))))) + (is (Context Safety Policy) + (function (_ (open "?[0]")) + (implementation + (def: command (|>> safe_command ?#can_upgrade)) + (def: argument (|>> safe_argument ?#can_upgrade)) + (def: value ?#can_downgrade)))))) (def: unix_policy - (let [replacer (: Replacer - (|>> (format "\"))) - safe_command (: (Sanitizer Command) - (..safe_common_command replacer)) - safe_argument (: (Sanitizer Argument) - (|>> (..replaced "'" replacer) - (text.enclosed' "'")))] + (let [replacer (is Replacer + (|>> (format "\"))) + safe_command (is (Sanitizer Command) + (..safe_common_command replacer)) + safe_argument (is (Sanitizer Argument) + (|>> (..replaced "'" replacer) + (text.enclosed' "'")))] (..policy safe_command safe_argument))) (def: windows_policy - (let [replacer (: Replacer - (function.constant " ")) - safe_command (: (Sanitizer Command) - (|>> (..safe_common_command replacer) - (..replaced "%" replacer) - (..replaced "!" replacer))) - safe_argument (: (Sanitizer Argument) - (|>> (..replaced "%" replacer) - (..replaced "!" replacer) - (..replaced text.double_quote replacer) - (text.enclosed' text.double_quote)))] + (let [replacer (is Replacer + (function.constant " ")) + safe_command (is (Sanitizer Command) + (|>> (..safe_common_command replacer) + (..replaced "%" replacer) + (..replaced "!" replacer))) + safe_argument (is (Sanitizer Argument) + (|>> (..replaced "%" replacer) + (..replaced "!" replacer) + (..replaced text.double_quote replacer) + (text.enclosed' text.double_quote)))] (..policy safe_command safe_argument))) (with_expansions [<jvm> (as_is (import: java/lang/String @@ -194,8 +194,8 @@ (java/util/Map java/lang/String java/lang/String)) (list#mix (function (_ [key value] target') (exec - (java/util/Map::put (:as java/lang/String key) - (:as java/lang/String value) + (java/util/Map::put (as java/lang/String key) + (as java/lang/String value) target') target')) target @@ -243,31 +243,31 @@ jvm_error (|> jvm_error java/io/InputStreamReader::new java/io/BufferedReader::new)]] - (in (: (Process IO) - (`` (implementation - (~~ (template [<name> <stream>] - [(def: (<name> _) - (do ! - [output (java/io/BufferedReader::readLine <stream>)] - (case output - {.#Some output} - (in (ffi.of_string output)) - - {.#None} - (# io.monad in (exception.except ..no_more_output [])))))] - - [read jvm_input] - [fail jvm_error] - )) - (def: (write message) - (java/io/OutputStream::write (# utf8.codec encoded message) jvm_output)) - (~~ (template [<name> <method>] - [(def: (<name> _) - (|> process <method>))] - - [destroy java/lang/Process::destroy] - [await (<| (# ! each (|>> ffi.of_int)) java/lang/Process::waitFor)] - )))))))) + (in (is (Process IO) + (`` (implementation + (~~ (template [<name> <stream>] + [(def: (<name> _) + (do ! + [output (java/io/BufferedReader::readLine <stream>)] + (case output + {.#Some output} + (in (ffi.of_string output)) + + {.#None} + (# io.monad in (exception.except ..no_more_output [])))))] + + [read jvm_input] + [fail jvm_error] + )) + (def: (write message) + (java/io/OutputStream::write (# utf8.codec encoded message) jvm_output)) + (~~ (template [<name> <method>] + [(def: (<name> _) + (|> process <method>))] + + [destroy java/lang/Process::destroy] + [await (<| (# ! each (|>> ffi.of_int)) java/lang/Process::waitFor)] + )))))))) (import: java/io/File "[1]::[0]" @@ -313,16 +313,16 @@ (type: .public (Mock s) (Interface - (: (-> s (Try [s Text])) - on_read) - (: (-> s (Try [s Text])) - on_fail) - (: (-> Text s (Try s)) - on_write) - (: (-> s (Try s)) - on_destroy) - (: (-> s (Try [s Exit])) - on_await))) + (is (-> s (Try [s Text])) + on_read) + (is (-> s (Try [s Text])) + on_fail) + (is (-> Text s (Try s)) + on_write) + (is (-> s (Try s)) + on_destroy) + (is (-> s (Try [s Exit])) + on_await))) (`` (implementation: (mock_process state mock) (All (_ s) (-> (Atom s) (Mock s) (Process IO))) diff --git a/stdlib/source/poly/lux/abstract/equivalence.lux b/stdlib/source/poly/lux/abstract/equivalence.lux index fab913843..e531aa9dd 100644 --- a/stdlib/source/poly/lux/abstract/equivalence.lux +++ b/stdlib/source/poly/lux/abstract/equivalence.lux @@ -1,61 +1,61 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" Monad do}]] - [control - ["[0]" maybe] - ["<>" parser - ["<[0]>" type]]] - [data - ["[0]" product] - ["[0]" bit] - ["[0]" text ("[1]#[0]" monoid) - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" monad)] - ["[0]" sequence] - ["[0]" array] - ["[0]" queue] - ["[0]" set] - ["[0]" dictionary {"+" Dictionary}] - ["[0]" tree]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["[0]" nat ("[1]#[0]" decimal)] - ["[0]" int] - ["[0]" rev] - ["[0]" frac]]] - [time - ["[0]" duration] - ["[0]" date] - ["[0]" instant] - ["[0]" day] - ["[0]" month]] - ["[0]" type - ["[0]" poly {"+" poly:}] - ["[0]" unit]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + [abstract + [monad {"+" Monad do}]] + [control + ["[0]" maybe] + ["<>" parser + ["<[0]>" type]]] + [data + ["[0]" product] + ["[0]" bit] + ["[0]" text ("[1]#[0]" monoid) + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" monad)] + ["[0]" sequence] + ["[0]" array] + ["[0]" queue] + ["[0]" set] + ["[0]" dictionary {"+" Dictionary}] + ["[0]" tree]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["[0]" nat ("[1]#[0]" decimal)] + ["[0]" int] + ["[0]" rev] + ["[0]" frac]]] + [time + ["[0]" duration] + ["[0]" date] + ["[0]" instant] + ["[0]" day] + ["[0]" month]] + ["[0]" type + ["[0]" poly {"+" poly:}] + ["[0]" unit]]]] + [\\library + ["[0]" /]]) (poly: .public equivalence (`` (do [! <>.monad] [.let [g!_ (code.local_symbol "_____________")] *env* <type>.env inputT <type>.next - .let [@Equivalence (: (-> Type Code) - (function (_ type) - (` ((~! /.Equivalence) (~ (poly.code *env* type))))))]] + .let [@Equivalence (is (-> Type Code) + (function (_ type) + (` ((~! /.Equivalence) (~ (poly.code *env* type))))))]] ($_ <>.either ... Basic types (~~ (template [<matcher> <eq>] [(do ! [_ <matcher>] - (in (` (: (~ (@Equivalence inputT)) - <eq>))))] + (in (` (is (~ (@Equivalence inputT)) + <eq>))))] [(<type>.exactly Any) (function ((~ g!_) (~ g!_) (~ g!_)) #1)] [(<type>.sub Bit) (~! bit.equivalence)] @@ -69,8 +69,8 @@ [(do ! [[_ argC] (<type>.applied (<>.and (<type>.exactly <name>) equivalence))] - (in (` (: (~ (@Equivalence inputT)) - (<eq> (~ argC))))))] + (in (` (is (~ (@Equivalence inputT)) + (<eq> (~ argC))))))] [.Maybe (~! maybe.equivalence)] [.List (~! list.equivalence)] @@ -85,14 +85,14 @@ (<type>.exactly dictionary.Dictionary) <type>.any equivalence))] - (in (` (: (~ (@Equivalence inputT)) - ((~! dictionary.equivalence) (~ valC)))))) + (in (` (is (~ (@Equivalence inputT)) + ((~! dictionary.equivalence) (~ valC)))))) ... Models (~~ (template [<type> <eq>] [(do ! [_ (<type>.exactly <type>)] - (in (` (: (~ (@Equivalence inputT)) - <eq>))))] + (in (` (is (~ (@Equivalence inputT)) + <eq>))))] [duration.Duration duration.equivalence] [instant.Instant instant.equivalence] @@ -103,8 +103,8 @@ (do ! [_ (<type>.applied (<>.and (<type>.exactly unit.Qty) <type>.any))] - (in (` (: (~ (@Equivalence inputT)) - unit.equivalence)))) + (in (` (is (~ (@Equivalence inputT)) + unit.equivalence)))) ... Variants (do ! [members (<type>.variant (<>.many equivalence)) @@ -112,20 +112,20 @@ g!_ (code.local_symbol "_____________") g!left (code.local_symbol "_____________left") g!right (code.local_symbol "_____________right")]] - (in (` (: (~ (@Equivalence inputT)) - (function ((~ g!_) (~ g!left) (~ g!right)) - (case [(~ g!left) (~ g!right)] - (~+ (list#conjoint (list#each (function (_ [tag g!eq]) - (if (nat.= last tag) - (list (` [{(~ (code.nat (-- tag))) #1 (~ g!left)} - {(~ (code.nat (-- tag))) #1 (~ g!right)}]) - (` ((~ g!eq) (~ g!left) (~ g!right)))) - (list (` [{(~ (code.nat tag)) #0 (~ g!left)} - {(~ (code.nat tag)) #0 (~ g!right)}]) - (` ((~ g!eq) (~ g!left) (~ g!right)))))) - (list.enumeration members)))) - (~ g!_) - #0)))))) + (in (` (is (~ (@Equivalence inputT)) + (function ((~ g!_) (~ g!left) (~ g!right)) + (case [(~ g!left) (~ g!right)] + (~+ (list#conjoint (list#each (function (_ [tag g!eq]) + (if (nat.= last tag) + (list (` [{(~ (code.nat (-- tag))) #1 (~ g!left)} + {(~ (code.nat (-- tag))) #1 (~ g!right)}]) + (` ((~ g!eq) (~ g!left) (~ g!right)))) + (list (` [{(~ (code.nat tag)) #0 (~ g!left)} + {(~ (code.nat tag)) #0 (~ g!right)}]) + (` ((~ g!eq) (~ g!left) (~ g!right)))))) + (list.enumeration members)))) + (~ g!_) + #0)))))) ... Tuples (do ! [g!eqs (<type>.tuple (<>.many equivalence)) @@ -133,18 +133,18 @@ indices (list.indices (list.size g!eqs)) g!lefts (list#each (|>> nat#encoded (text#composite "left") code.local_symbol) indices) g!rights (list#each (|>> nat#encoded (text#composite "right") code.local_symbol) indices)]] - (in (` (: (~ (@Equivalence inputT)) - (function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)]) - (and (~+ (|> (list.zipped/3 g!eqs g!lefts g!rights) - (list#each (function (_ [g!eq g!left g!right]) - (` ((~ g!eq) (~ g!left) (~ g!right))))))))))))) + (in (` (is (~ (@Equivalence inputT)) + (function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)]) + (and (~+ (|> (list.zipped/3 g!eqs g!lefts g!rights) + (list#each (function (_ [g!eq g!left g!right]) + (` ((~ g!eq) (~ g!left) (~ g!right))))))))))))) ... Type recursion (do ! [[g!self bodyC] (<type>.recursive equivalence) .let [g!_ (code.local_symbol "_____________")]] - (in (` (: (~ (@Equivalence inputT)) - ((~! /.rec) (.function ((~ g!_) (~ g!self)) - (~ bodyC))))))) + (in (` (is (~ (@Equivalence inputT)) + ((~! /.rec) (.function ((~ g!_) (~ g!self)) + (~ bodyC))))))) <type>.recursive_self ... Type applications (do ! @@ -155,11 +155,11 @@ ... Polymorphism (do ! [[funcC varsC bodyC] (<type>.polymorphic equivalence)] - (in (` (: (All ((~ g!_) (~+ varsC)) - (-> (~+ (list#each (|>> (~) ((~! /.Equivalence)) (`)) varsC)) - ((~! /.Equivalence) ((~ (poly.code *env* inputT)) (~+ varsC))))) - (function ((~ funcC) (~+ varsC)) - (~ bodyC)))))) + (in (` (is (All ((~ g!_) (~+ varsC)) + (-> (~+ (list#each (|>> (~) ((~! /.Equivalence)) (`)) varsC)) + ((~! /.Equivalence) ((~ (poly.code *env* inputT)) (~+ varsC))))) + (function ((~ funcC) (~+ varsC)) + (~ bodyC)))))) <type>.recursive_call ... If all else fails... (|> <type>.any diff --git a/stdlib/source/poly/lux/abstract/functor.lux b/stdlib/source/poly/lux/abstract/functor.lux index 65fb23ec6..52f237a54 100644 --- a/stdlib/source/poly/lux/abstract/functor.lux +++ b/stdlib/source/poly/lux/abstract/functor.lux @@ -1,28 +1,28 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" Monad do}]] - [control - ["p" parser - ["<[0]>" type] - ["s" code {"+" Parser}]]] - [data - ["[0]" product] - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" monad monoid)]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["n" nat]]] - ["[0]" type - ["[0]" poly {"+" poly:}]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + [abstract + [monad {"+" Monad do}]] + [control + ["p" parser + ["<[0]>" type] + ["s" code {"+" Parser}]]] + [data + ["[0]" product] + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" monad monoid)]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["n" nat]]] + ["[0]" type + ["[0]" poly {"+" poly:}]]]] + [\\library + ["[0]" /]]) (poly: .public functor (do [! p.monad] @@ -35,77 +35,77 @@ [polyC varsC non_functorT] (<type>.local (list inputT) (<type>.polymorphic <type>.any)) .let [num_vars (list.size varsC)] - .let [@Functor (: (-> Type Code) - (function (_ unwrappedT) - (if (n.= 1 num_vars) - (` ((~! /.Functor) (~ (poly.code *env* unwrappedT)))) - (let [paramsC (|> num_vars -- list.indices (list#each (|>> %.nat code.local_symbol)))] - (` (All ((~ g!_) (~+ paramsC)) - ((~! /.Functor) ((~ (poly.code *env* unwrappedT)) (~+ paramsC))))))))) - Arg<?> (: (-> Code (<type>.Parser Code)) - (function (Arg<?> valueC) - ($_ p.either - ... Type-var - (do p.monad - [.let [varI (|> num_vars (n.* 2) --)] - _ (<type>.parameter! varI)] - (in (` ((~ funcC) (~ valueC))))) - ... Variants - (do ! - [_ (in []) - membersC (<type>.variant (p.many (Arg<?> valueC))) - .let [last (-- (list.size membersC))]] - (in (` (case (~ valueC) - (~+ (list#conjoint (list#each (function (_ [tag memberC]) - (if (n.= last tag) - (list (` {(~ (code.nat (-- tag))) #1 (~ valueC)}) - (` {(~ (code.nat (-- tag))) #1 (~ memberC)})) - (list (` {(~ (code.nat tag)) #0 (~ valueC)}) - (` {(~ (code.nat tag)) #0 (~ memberC)})))) - (list.enumeration membersC)))))))) - ... Tuples - (do p.monad - [pairsCC (: (<type>.Parser (List [Code Code])) - (<type>.tuple (loop [idx 0 - pairsCC (: (List [Code Code]) - (list))] - (p.either (let [slotC (|> idx %.nat (format "____________slot") code.local_symbol)] - (do ! - [_ (in []) - memberC (Arg<?> slotC)] - (again (++ idx) - (list#composite pairsCC (list [slotC memberC]))))) - (in pairsCC)))))] - (in (` (case (~ valueC) - [(~+ (list#each product.left pairsCC))] - [(~+ (list#each product.right pairsCC))])))) - ... Functions - (do ! - [_ (in []) - .let [g! (code.local_symbol "____________") - outL (code.local_symbol "____________outL")] - [inT+ outC] (<type>.function (p.many <type>.any) - (Arg<?> outL)) - .let [inC+ (|> (list.size inT+) - list.indices - (list#each (|>> %.nat (format "____________inC") code.local_symbol)))]] - (in (` (function ((~ g!) (~+ inC+)) - (let [(~ outL) ((~ valueC) (~+ inC+))] - (~ outC)))))) - ... Recursion - (do p.monad - [_ <type>.recursive_call] - (in (` ((~' each) (~ funcC) (~ valueC))))) - ... Parameters - (do p.monad - [_ <type>.any] - (in valueC)) - )))] - [_ _ outputC] (: (<type>.Parser [Code (List Code) Code]) - (p.either (<type>.polymorphic - (Arg<?> inputC)) - (p.failure (format "Cannot create Functor for: " (%.type inputT)))))] - (in (` (: (~ (@Functor inputT)) - (implementation - (def: ((~' each) (~ funcC) (~ inputC)) - (~ outputC)))))))) + .let [@Functor (is (-> Type Code) + (function (_ unwrappedT) + (if (n.= 1 num_vars) + (` ((~! /.Functor) (~ (poly.code *env* unwrappedT)))) + (let [paramsC (|> num_vars -- list.indices (list#each (|>> %.nat code.local_symbol)))] + (` (All ((~ g!_) (~+ paramsC)) + ((~! /.Functor) ((~ (poly.code *env* unwrappedT)) (~+ paramsC))))))))) + Arg<?> (is (-> Code (<type>.Parser Code)) + (function (Arg<?> valueC) + ($_ p.either + ... Type-var + (do p.monad + [.let [varI (|> num_vars (n.* 2) --)] + _ (<type>.parameter! varI)] + (in (` ((~ funcC) (~ valueC))))) + ... Variants + (do ! + [_ (in []) + membersC (<type>.variant (p.many (Arg<?> valueC))) + .let [last (-- (list.size membersC))]] + (in (` (case (~ valueC) + (~+ (list#conjoint (list#each (function (_ [tag memberC]) + (if (n.= last tag) + (list (` {(~ (code.nat (-- tag))) #1 (~ valueC)}) + (` {(~ (code.nat (-- tag))) #1 (~ memberC)})) + (list (` {(~ (code.nat tag)) #0 (~ valueC)}) + (` {(~ (code.nat tag)) #0 (~ memberC)})))) + (list.enumeration membersC)))))))) + ... Tuples + (do p.monad + [pairsCC (is (<type>.Parser (List [Code Code])) + (<type>.tuple (loop [idx 0 + pairsCC (is (List [Code Code]) + (list))] + (p.either (let [slotC (|> idx %.nat (format "____________slot") code.local_symbol)] + (do ! + [_ (in []) + memberC (Arg<?> slotC)] + (again (++ idx) + (list#composite pairsCC (list [slotC memberC]))))) + (in pairsCC)))))] + (in (` (case (~ valueC) + [(~+ (list#each product.left pairsCC))] + [(~+ (list#each product.right pairsCC))])))) + ... Functions + (do ! + [_ (in []) + .let [g! (code.local_symbol "____________") + outL (code.local_symbol "____________outL")] + [inT+ outC] (<type>.function (p.many <type>.any) + (Arg<?> outL)) + .let [inC+ (|> (list.size inT+) + list.indices + (list#each (|>> %.nat (format "____________inC") code.local_symbol)))]] + (in (` (function ((~ g!) (~+ inC+)) + (let [(~ outL) ((~ valueC) (~+ inC+))] + (~ outC)))))) + ... Recursion + (do p.monad + [_ <type>.recursive_call] + (in (` ((~' each) (~ funcC) (~ valueC))))) + ... Parameters + (do p.monad + [_ <type>.any] + (in valueC)) + )))] + [_ _ outputC] (is (<type>.Parser [Code (List Code) Code]) + (p.either (<type>.polymorphic + (Arg<?> inputC)) + (p.failure (format "Cannot create Functor for: " (%.type inputT)))))] + (in (` (is (~ (@Functor inputT)) + (implementation + (def: ((~' each) (~ funcC) (~ inputC)) + (~ outputC)))))))) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index 0985eb5ed..67f6fb464 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -1,43 +1,43 @@ (.using - [library - [lux "*" - ["[0]" debug] - [abstract - [monad {"+" do}] - ["[0]" codec]] - [control - ["[0]" try] - ["<>" parser - ["</>" json] - ["<[0]>" type] - ["<[0]>" code]]] - [data - ["[0]" text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]#[0]" monad)] - ["[0]" sequence {"+" sequence}] - ["[0]" dictionary]]] - [macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - [number - ["n" nat ("[1]#[0]" decimal)] - ["[0]" i64] - ["[0]" int] - ["[0]" frac]]] - [time - ... ["[0]" instant] - ... ["[0]" duration] - ["[0]" date] - ["[0]" day] - ["[0]" month]] - ["[0]" type - ["[0]" unit] - ["[0]" poly {"+" poly:}]]]] - [\\library - ["[0]" / {"+" JSON}]]) + [library + [lux "*" + ["[0]" debug] + [abstract + [monad {"+" do}] + ["[0]" codec]] + [control + ["[0]" try] + ["<>" parser + ["</>" json] + ["<[0]>" type] + ["<[0]>" code]]] + [data + ["[0]" text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]#[0]" monad)] + ["[0]" sequence {"+" sequence}] + ["[0]" dictionary]]] + [macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + [number + ["n" nat ("[1]#[0]" decimal)] + ["[0]" i64] + ["[0]" int] + ["[0]" frac]]] + [time + ... ["[0]" instant] + ... ["[0]" duration] + ["[0]" date] + ["[0]" day] + ["[0]" month]] + ["[0]" type + ["[0]" unit] + ["[0]" poly {"+" poly:}]]]] + [\\library + ["[0]" / {"+" JSON}]]) (def: tag (-> Nat Frac) @@ -102,8 +102,8 @@ [(do ! [.let [g!_ (code.local_symbol "_______")] _ <matcher>] - (in (` (: (~ (@JSON#encoded inputT)) - <encoder>))))] + (in (` (is (~ (@JSON#encoded inputT)) + <encoder>))))] [(<type>.exactly Any) (function ((~ g!_) (~ (code.symbol ["" "0"]))) {/.#Null})] [(<type>.sub Bit) (|>> {/.#Boolean})] @@ -114,8 +114,8 @@ <time> (template [<type> <codec>] [(do ! [_ (<type>.exactly <type>)] - (in (` (: (~ (@JSON#encoded inputT)) - (|>> (# (~! <codec>) (~' encoded)) {/.#String})))))] + (in (` (is (~ (@JSON#encoded inputT)) + (|>> (# (~! <codec>) (~' encoded)) {/.#String})))))] ... [duration.Duration duration.codec] ... [instant.Instant instant.codec] @@ -125,9 +125,9 @@ (do [! <>.monad] [*env* <type>.env .let [g!_ (code.local_symbol "_______") - @JSON#encoded (: (-> Type Code) - (function (_ type) - (` (-> (~ (poly.code *env* type)) /.JSON))))] + @JSON#encoded (is (-> Type Code) + (function (_ type) + (` (-> (~ (poly.code *env* type)) /.JSON))))] inputT <type>.next] ($_ <>.either <basic> @@ -135,8 +135,8 @@ (do ! [unitT (<type>.applied (<>.after (<type>.exactly unit.Qty) <type>.any))] - (in (` (: (~ (@JSON#encoded inputT)) - (# (~! qty_codec) (~' encoded)))))) + (in (` (is (~ (@JSON#encoded inputT)) + (# (~! qty_codec) (~' encoded)))))) (do ! [.let [g!_ (code.local_symbol "_______") g!key (code.local_symbol "_______key") @@ -145,61 +145,61 @@ (<type>.exactly dictionary.Dictionary) (<type>.exactly .Text) encoded))] - (in (` (: (~ (@JSON#encoded inputT)) - (|>> ((~! dictionary.entries)) - ((~! list#each) (function ((~ g!_) [(~ g!key) (~ g!val)]) - [(~ g!key) ((~ =val=) (~ g!val))])) - ((~! dictionary.of_list) (~! text.hash)) - {/.#Object}))))) + (in (` (is (~ (@JSON#encoded inputT)) + (|>> ((~! dictionary.entries)) + ((~! list#each) (function ((~ g!_) [(~ g!key) (~ g!val)]) + [(~ g!key) ((~ =val=) (~ g!val))])) + ((~! dictionary.of_list) (~! text.hash)) + {/.#Object}))))) (do ! [[_ =sub=] (<type>.applied ($_ <>.and (<type>.exactly .Maybe) encoded))] - (in (` (: (~ (@JSON#encoded inputT)) - ((~! ..nullable) (~ =sub=)))))) + (in (` (is (~ (@JSON#encoded inputT)) + ((~! ..nullable) (~ =sub=)))))) (do ! [[_ =sub=] (<type>.applied ($_ <>.and (<type>.exactly .List) encoded))] - (in (` (: (~ (@JSON#encoded inputT)) - (|>> ((~! list#each) (~ =sub=)) ((~! sequence.of_list)) {/.#Array}))))) + (in (` (is (~ (@JSON#encoded inputT)) + (|>> ((~! list#each) (~ =sub=)) ((~! sequence.of_list)) {/.#Array}))))) (do ! [.let [g!_ (code.local_symbol "_______") g!input (code.local_symbol "_______input")] members (<type>.variant (<>.many encoded)) .let [last (-- (list.size members))]] - (in (` (: (~ (@JSON#encoded inputT)) - (function ((~ g!_) (~ g!input)) - (case (~ g!input) - (~+ (list#conjoint (list#each (function (_ [tag g!encoded]) - (if (n.= last tag) - (.list (` {(~ (code.nat (-- tag))) #1 (~ g!input)}) - (` ((~! /.json) [(~ (code.frac (..tag (-- tag)))) - #1 - ((~ g!encoded) (~ g!input))]))) - (.list (` {(~ (code.nat tag)) #0 (~ g!input)}) - (` ((~! /.json) [(~ (code.frac (..tag tag))) - #0 - ((~ g!encoded) (~ g!input))]))))) - (list.enumeration members)))))))))) + (in (` (is (~ (@JSON#encoded inputT)) + (function ((~ g!_) (~ g!input)) + (case (~ g!input) + (~+ (list#conjoint (list#each (function (_ [tag g!encoded]) + (if (n.= last tag) + (.list (` {(~ (code.nat (-- tag))) #1 (~ g!input)}) + (` ((~! /.json) [(~ (code.frac (..tag (-- tag)))) + #1 + ((~ g!encoded) (~ g!input))]))) + (.list (` {(~ (code.nat tag)) #0 (~ g!input)}) + (` ((~! /.json) [(~ (code.frac (..tag tag))) + #0 + ((~ g!encoded) (~ g!input))]))))) + (list.enumeration members)))))))))) (do ! [g!encoders (<type>.tuple (<>.many encoded)) .let [g!_ (code.local_symbol "_______") g!members (|> (list.size g!encoders) list.indices (list#each (|>> n#encoded code.local_symbol)))]] - (in (` (: (~ (@JSON#encoded inputT)) - (function ((~ g!_) [(~+ g!members)]) - ((~! /.json) [(~+ (list#each (function (_ [g!member g!encoded]) - (` ((~ g!encoded) (~ g!member)))) - (list.zipped/2 g!members g!encoders)))])))))) + (in (` (is (~ (@JSON#encoded inputT)) + (function ((~ g!_) [(~+ g!members)]) + ((~! /.json) [(~+ (list#each (function (_ [g!member g!encoded]) + (` ((~ g!encoded) (~ g!member)))) + (list.zipped/2 g!members g!encoders)))])))))) ... Type recursion (do ! [[selfC non_recC] (<type>.recursive encoded) .let [g! (code.local_symbol "____________")]] - (in (` (: (~ (@JSON#encoded inputT)) - ((~! ..rec_encoded) (.function ((~ g!) (~ selfC)) - (~ non_recC))))))) + (in (` (is (~ (@JSON#encoded inputT)) + ((~! ..rec_encoded) (.function ((~ g!) (~ selfC)) + (~ non_recC))))))) <type>.recursive_self ... Type applications (do ! @@ -208,13 +208,13 @@ ... Polymorphism (do ! [[funcC varsC bodyC] (<type>.polymorphic encoded)] - (in (` (: (All ((~ g!_) (~+ varsC)) - (-> (~+ (list#each (function (_ varC) (` (-> (~ varC) /.JSON))) - varsC)) - (-> ((~ (poly.code *env* inputT)) (~+ varsC)) - /.JSON))) - (function ((~ funcC) (~+ varsC)) - (~ bodyC)))))) + (in (` (is (All ((~ g!_) (~+ varsC)) + (-> (~+ (list#each (function (_ varC) (` (-> (~ varC) /.JSON))) + varsC)) + (-> ((~ (poly.code *env* inputT)) (~+ varsC)) + /.JSON))) + (function ((~ funcC) (~+ varsC)) + (~ bodyC)))))) <type>.parameter <type>.recursive_call ... If all else fails... @@ -226,8 +226,8 @@ [<basic> (template [<matcher> <decoder>] [(do ! [_ <matcher>] - (in (` (: (~ (@JSON#decoded inputT)) - (~! <decoder>)))))] + (in (` (is (~ (@JSON#decoded inputT)) + (~! <decoder>)))))] [(<type>.exactly Any) </>.null] [(<type>.sub Bit) </>.boolean] @@ -238,8 +238,8 @@ <time> (template [<type> <codec>] [(do ! [_ (<type>.exactly <type>)] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! <>.codec) (~! <codec>) (~! </>.string))))))] + (in (` (is (~ (@JSON#decoded inputT)) + ((~! <>.codec) (~! <codec>) (~! </>.string))))))] ... [duration.Duration duration.codec] ... [instant.Instant instant.codec] @@ -249,9 +249,9 @@ (do [! <>.monad] [*env* <type>.env .let [g!_ (code.local_symbol "_______") - @JSON#decoded (: (-> Type Code) - (function (_ type) - (` (</>.Parser (~ (poly.code *env* type))))))] + @JSON#decoded (is (-> Type Code) + (function (_ type) + (` (</>.Parser (~ (poly.code *env* type))))))] inputT <type>.next] ($_ <>.either <basic> @@ -259,52 +259,52 @@ (do ! [unitT (<type>.applied (<>.after (<type>.exactly unit.Qty) <type>.any))] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! <>.codec) (~! qty_codec) (~! </>.any)))))) + (in (` (is (~ (@JSON#decoded inputT)) + ((~! <>.codec) (~! qty_codec) (~! </>.any)))))) (do ! [[_ _ valC] (<type>.applied ($_ <>.and (<type>.exactly dictionary.Dictionary) (<type>.exactly .Text) decoded))] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! </>.dictionary) (~ valC)))))) + (in (` (is (~ (@JSON#decoded inputT)) + ((~! </>.dictionary) (~ valC)))))) (do ! [[_ subC] (<type>.applied (<>.and (<type>.exactly .Maybe) decoded))] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! </>.nullable) (~ subC)))))) + (in (` (is (~ (@JSON#decoded inputT)) + ((~! </>.nullable) (~ subC)))))) (do ! [[_ subC] (<type>.applied (<>.and (<type>.exactly .List) decoded))] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! </>.array) ((~! <>.some) (~ subC))))))) + (in (` (is (~ (@JSON#decoded inputT)) + ((~! </>.array) ((~! <>.some) (~ subC))))))) (do ! [members (<type>.variant (<>.many decoded)) .let [last (-- (list.size members))]] - (in (` (: (~ (@JSON#decoded inputT)) - ($_ ((~! <>.or)) - (~+ (list#each (function (_ [tag memberC]) - (if (n.= last tag) - (` (|> (~ memberC) - ((~! <>.after) ((~! </>.boolean!) (~ (code.bit #1)))) - ((~! <>.after) ((~! </>.number!) (~ (code.frac (..tag (-- tag)))))) - ((~! </>.array)))) - (` (|> (~ memberC) - ((~! <>.after) ((~! </>.boolean!) (~ (code.bit #0)))) - ((~! <>.after) ((~! </>.number!) (~ (code.frac (..tag tag))))) - ((~! </>.array)))))) - (list.enumeration members)))))))) + (in (` (is (~ (@JSON#decoded inputT)) + ($_ ((~! <>.or)) + (~+ (list#each (function (_ [tag memberC]) + (if (n.= last tag) + (` (|> (~ memberC) + ((~! <>.after) ((~! </>.boolean!) (~ (code.bit #1)))) + ((~! <>.after) ((~! </>.number!) (~ (code.frac (..tag (-- tag)))))) + ((~! </>.array)))) + (` (|> (~ memberC) + ((~! <>.after) ((~! </>.boolean!) (~ (code.bit #0)))) + ((~! <>.after) ((~! </>.number!) (~ (code.frac (..tag tag))))) + ((~! </>.array)))))) + (list.enumeration members)))))))) (do ! [g!decoders (<type>.tuple (<>.many decoded))] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! </>.array) ($_ ((~! <>.and)) (~+ g!decoders))))))) + (in (` (is (~ (@JSON#decoded inputT)) + ((~! </>.array) ($_ ((~! <>.and)) (~+ g!decoders))))))) ... Type recursion (do ! [[selfC bodyC] (<type>.recursive decoded) .let [g! (code.local_symbol "____________")]] - (in (` (: (~ (@JSON#decoded inputT)) - ((~! <>.rec) (.function ((~ g!) (~ selfC)) - (~ bodyC))))))) + (in (` (is (~ (@JSON#decoded inputT)) + ((~! <>.rec) (.function ((~ g!) (~ selfC)) + (~ bodyC))))))) <type>.recursive_self ... Type applications (do ! @@ -313,11 +313,11 @@ ... Polymorphism (do ! [[funcC varsC bodyC] (<type>.polymorphic decoded)] - (in (` (: (All ((~ g!_) (~+ varsC)) - (-> (~+ (list#each (|>> (~) </>.Parser (`)) varsC)) - (</>.Parser ((~ (poly.code *env* inputT)) (~+ varsC))))) - (function ((~ funcC) (~+ varsC)) - (~ bodyC)))))) + (in (` (is (All ((~ g!_) (~+ varsC)) + (-> (~+ (list#each (|>> (~) </>.Parser (`)) varsC)) + (</>.Parser ((~ (poly.code *env* inputT)) (~+ varsC))))) + (function ((~ funcC) (~+ varsC)) + (~ bodyC)))))) <type>.parameter <type>.recursive_call ... If all else fails... @@ -325,10 +325,10 @@ )))) (syntax: .public (codec [inputT <code>.any]) - (in (.list (` (: (codec.Codec /.JSON (~ inputT)) - (implementation - (def: (~' encoded) - ((~! ..encoded) (~ inputT))) - (def: (~' decoded) - ((~! </>.result) ((~! ..decoded) (~ inputT)))) - )))))) + (in (.list (` (is (codec.Codec /.JSON (~ inputT)) + (implementation + (def: (~' encoded) + ((~! ..encoded) (~ inputT))) + (def: (~' decoded) + ((~! </>.result) ((~! ..decoded) (~ inputT)))) + )))))) diff --git a/stdlib/source/program/aedifex/action.lux b/stdlib/source/program/aedifex/action.lux index 4990dfed9..d9e168e9f 100644 --- a/stdlib/source/program/aedifex/action.lux +++ b/stdlib/source/program/aedifex/action.lux @@ -1,16 +1,16 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" Monad}]] - [control - ["[0]" try {"+" Try}] - [concurrency - ["[0]" async {"+" Async}]]]]]) + [library + [lux "*" + [abstract + [monad {"+" Monad}]] + [control + ["[0]" try {"+" Try}] + [concurrency + ["[0]" async {"+" Async}]]]]]) (type: .public (Action a) (Async (Try a))) (def: .public monad (Monad Action) - (:expected (try.with async.monad))) + (as_expected (try.with async.monad))) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 8189c6978..862eeec23 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -21,7 +21,7 @@ ["[0]" year] ["[0]" month]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) (def: .public (pad value) (-> Nat Text) @@ -43,7 +43,7 @@ (def: .public epoch Date - (:abstraction date.epoch)) + (abstraction date.epoch)) (def: .public (date raw) (-> date.Date (Try Date)) @@ -51,24 +51,24 @@ (if (or (i.< ..min_year year) (i.> ..max_year year)) (exception.except ..year_is_out_of_range [(date.year raw)]) - {try.#Success (:abstraction raw)}))) + {try.#Success (abstraction raw)}))) (def: .public value (-> Date date.Date) - (|>> :representation)) + (|>> representation)) (implementation: .public equivalence (Equivalence Date) (def: (= reference subject) - (date#= (:representation reference) - (:representation subject)))) + (date#= (representation reference) + (representation subject)))) (def: .public (format value) (%.Format Date) - (%.format (|> value :representation date.year year.value .nat %.nat) - (|> value :representation date.month month.number ..pad) - (|> value :representation date.day_of_month ..pad))) + (%.format (|> value representation date.year year.value .nat %.nat) + (|> value representation date.month month.number ..pad) + (|> value representation date.day_of_month ..pad))) (def: .public parser (Parser Date) @@ -79,4 +79,4 @@ month (<>.lifted (month.by_number month)) day_of_month (<>.codec n.decimal (<text>.exactly 2 <text>.decimal)) date (<>.lifted (date.date year month day_of_month))] - (in (:abstraction date))))) + (in (abstraction date))))) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index b9211ceb0..f55d026a3 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -184,8 +184,8 @@ {.#None} (dictionary.has identity [version dependency] uniques)))) - (: (Dictionary [Group Name] [Version Dependency]) - (dictionary.empty (product.hash text.hash text.hash)))) + (is (Dictionary [Group Name] [Version Dependency]) + (dictionary.empty (product.hash text.hash text.hash)))) dictionary.values (list#each (|>> product.right (..path fs home))))) @@ -209,9 +209,9 @@ ... eventually led to the function hanging/freezing. ... I'm not sure why it happened, but I got this weirder implementation to work. ... TODO: Improve this implementation. - (let [[read! write!] (: [(Async (Try Any)) - (async.Resolver (Try Any))] - (async.async [])) + (let [[read! write!] (is [(Async (Try Any)) + (async.Resolver (Try Any))] + (async.async [])) _ (|> (# process <capability> []) (async.upon! (function (again ?line) (case ?line diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index f55520ec1..735ec1ebd 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -44,12 +44,12 @@ (-> (Repository Async) ///artifact.Version Dependency [Binary Status] (Async (Try Any))) (let [artifact (format (///artifact.uri version_template artifact) (///artifact/extension.extension type)) - deploy_hash (: (All (_ h) (-> (Codec Text (Hash h)) Extension (Hash h) (Async (Try Any)))) - (function (_ codec extension hash) - (|> hash - (# codec encoded) - (# utf8.codec encoded) - (# repository upload (format artifact extension)))))] + deploy_hash (is (All (_ h) (-> (Codec Text (Hash h)) Extension (Hash h) (Async (Try Any)))) + (function (_ codec extension hash) + (|> hash + (# codec encoded) + (# utf8.codec encoded) + (# repository upload (format artifact extension)))))] (do [! (try.with async.monad)] [_ (# repository upload artifact data)] (case status @@ -89,8 +89,8 @@ (def: (update_snapshot [artifact type] now snapshot) (-> Dependency Instant Metadata (Try Metadata)) (do try.monad - [now (: (Try ///artifact/time.Time) - (///artifact/time.of_instant now)) + [now (is (Try ///artifact/time.Time) + (///artifact/time.of_instant now)) .let [version_template (the ///artifact.#version artifact) snapshot (|> snapshot (revised [///metadata/snapshot.#versioning ///artifact/versioning.#snapshot] diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index 67dbfc37c..45d275527 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -204,8 +204,8 @@ (List Dependency) Resolution])) (loop [repositories repositories - successes (: (List Dependency) (list)) - failures (: (List Dependency) (list)) + successes (is (List Dependency) (list)) + failures (is (List Dependency) (list)) dependencies dependencies resolution resolution] (case dependencies @@ -231,9 +231,9 @@ (case ?package {try.#Success package} (do ! - [.let [redundant? (: (Predicate Dependency) - (predicate.or (# //.equivalence = head) - (dictionary.key? resolution))) + [.let [redundant? (is (Predicate Dependency) + (predicate.or (# //.equivalence = head) + (dictionary.key? resolution))) sub_dependencies (|> package ///package.dependencies (try#each (|>> set.list diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index d45c8bb6e..e0548920f 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -21,7 +21,7 @@ ["n" nat] ["[0]" i64]]] [type - abstract]]]) + [abstract {"-" pattern}]]]]) ... TODO: Replace with pure-Lux implementations of these algorithms ... https://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode @@ -42,14 +42,14 @@ (def: .public data (All (_ h) (-> (Hash h) Binary)) - (|>> :representation)) + (|>> representation)) (template [<name> <kind> <algorithm>] [(def: .public (<name> value) (-> Binary (Hash <kind>)) (|> (java/security/MessageDigest::getInstance [(ffi.as_string <algorithm>)]) (java/security/MessageDigest::digest [value]) - :abstraction))] + abstraction))] [sha-1 ..SHA-1 "SHA-1"] [md5 ..MD5 "MD5"] @@ -102,7 +102,7 @@ [(def: .public (<name> data) (-> Binary (Try (Hash <kind>))) (if (n.= <size> (binary.size data)) - {try.#Success (:abstraction data)} + {try.#Success (abstraction data)} (exception.except <exception> [data])))] [as_sha-1 SHA-1 ..sha-1::size ..not_a_sha-1] @@ -153,7 +153,7 @@ [(implementation: .public <codec> (Codec Text (Hash <hash>)) - (def: encoded (|>> :representation ..encoded)) + (def: encoded (|>> representation ..encoded)) (def: decoded (..decoded <nat> <constructor>)))] [sha-1_codec SHA-1 ..sha-1::size ..as_sha-1] @@ -165,6 +165,6 @@ (def: (= reference subject) (# binary.equivalence = - (:representation reference) - (:representation subject)))) + (representation reference) + (representation subject)))) ) diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index cc41be0b5..a6552ee00 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -97,14 +97,14 @@ (|> (<xml>.somewhere ///artifact/versioning.parser) (# ! each (revised ///artifact/versioning.#versions - (: (-> (List ///artifact/snapshot/version.Version) - (List ///artifact/snapshot/version.Version)) - (|>> (pipe.case - (pattern (list)) - (list <default_version>) + (is (-> (List ///artifact/snapshot/version.Version) + (List ///artifact/snapshot/version.Version)) + (|>> (pipe.case + (pattern (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>)])))] diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 097373529..7b1447b8c 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -202,51 +202,51 @@ (dictionary.of_list text.hash) (<code>.tuple (<>.some (<>.and <code>.text <code>.any)))) - .let [^parents (: (Parser (List /.Name)) - (<>.else (list) - (..plural input "parents" <code>.text))) - ^identity (: (Parser (Maybe Artifact)) - (<>.maybe - (..singular input "identity" ..artifact))) - ^info (: (Parser (Maybe /.Info)) - (<>.maybe - (..singular input "info" ..info))) - ^repositories (: (Parser (Set //repository.Address)) - (|> (..plural input "repositories" ..repository) - (# ! each (set.of_list text.hash)) - (<>.else (set.empty text.hash)) - (# ! each (set.has /.default_repository)))) - ^dependencies (: (Parser (Set //dependency.Dependency)) - (|> (..plural input "dependencies" ..dependency) - (# ! each (set.of_list //dependency.hash)) - (<>.else (set.empty //dependency.hash)))) + .let [^parents (is (Parser (List /.Name)) + (<>.else (list) + (..plural input "parents" <code>.text))) + ^identity (is (Parser (Maybe Artifact)) + (<>.maybe + (..singular input "identity" ..artifact))) + ^info (is (Parser (Maybe /.Info)) + (<>.maybe + (..singular input "info" ..info))) + ^repositories (is (Parser (Set //repository.Address)) + (|> (..plural input "repositories" ..repository) + (# ! each (set.of_list text.hash)) + (<>.else (set.empty text.hash)) + (# ! each (set.has /.default_repository)))) + ^dependencies (is (Parser (Set //dependency.Dependency)) + (|> (..plural input "dependencies" ..dependency) + (# ! each (set.of_list //dependency.hash)) + (<>.else (set.empty //dependency.hash)))) ^lux (|> ..dependency (..singular input //format.lux_compiler_label) (<>.else /.default_compiler)) ^compilers (|> ..compiler (..plural input "compilers") (<>.else (list))) - ^sources (: (Parser (Set /.Source)) - (|> (..plural input "sources" ..source) - (# ! each (set.of_list text.hash)) - (<>.else (set.of_list text.hash (list /.default_source))))) - ^target (: (Parser /.Target) - (|> ..target - (..singular input "target") - (<>.else /.default_target))) - ^program (: (Parser (Maybe Module)) - (<>.maybe - (..singular input "program" ..module))) - ^test (: (Parser (Maybe Module)) - (<>.maybe - (..singular input "test" ..module))) - ^deploy_repositories (: (Parser (Dictionary Text //repository.Address)) - (<| (# ! each (dictionary.of_list text.hash)) - (<>.else (list)) - (..plural input "deploy_repositories" ..deploy_repository))) - ^configuration (: (Parser (PList Text)) - (<| (<>.else (list)) - (..plural input "configuration" ..configuration/1))) + ^sources (is (Parser (Set /.Source)) + (|> (..plural input "sources" ..source) + (# ! each (set.of_list text.hash)) + (<>.else (set.of_list text.hash (list /.default_source))))) + ^target (is (Parser /.Target) + (|> ..target + (..singular input "target") + (<>.else /.default_target))) + ^program (is (Parser (Maybe Module)) + (<>.maybe + (..singular input "program" ..module))) + ^test (is (Parser (Maybe Module)) + (<>.maybe + (..singular input "test" ..module))) + ^deploy_repositories (is (Parser (Dictionary Text //repository.Address)) + (<| (# ! each (dictionary.of_list text.hash)) + (<>.else (list)) + (..plural input "deploy_repositories" ..deploy_repository))) + ^configuration (is (Parser (PList Text)) + (<| (<>.else (list)) + (..plural input "configuration" ..configuration/1))) ^java (|> ..runtime (..singular input "java") (<>.else //runtime.default_java)) diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index b373db4f8..b44be720f 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -1,28 +1,28 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [control - [io {"+" IO}] - ["[0]" try {"+" Try}] - [concurrency - ["[0]" async {"+" Async}] - ["[0]" stm]]] - [data - [binary {"+" Binary}]] - [world - [net - [uri {"+" URI}]]]]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [control + [io {"+" IO}] + ["[0]" try {"+" Try}] + [concurrency + ["[0]" async {"+" Async}] + ["[0]" stm]]] + [data + [binary {"+" Binary}]] + [world + [net + [uri {"+" URI}]]]]]) (type: .public (Repository !) (Interface - (: Text - description) - (: (-> URI (! (Try Binary))) - download) - (: (-> URI Binary (! (Try Any))) - upload))) + (is Text + description) + (is (-> URI (! (Try Binary))) + download) + (is (-> URI Binary (! (Try Any))) + upload))) (def: .public (async repository) (-> (Repository IO) (Repository Async)) @@ -38,12 +38,12 @@ (type: .public (Mock s) (Interface - (: Text - the_description) - (: (-> URI s (Try [s Binary])) - on_download) - (: (-> URI Binary s (Try s)) - on_upload))) + (is Text + the_description) + (is (-> URI s (Try [s Binary])) + on_download) + (is (-> URI Binary s (Try s)) + on_upload))) (def: .public (mock mock init) (All (_ s) (-> (Mock s) s (Repository Async))) diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index efe3263a4..782b872f1 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -61,11 +61,11 @@ address) (def: (download uri) (do [! (try.with io.monad)] - [[status message] (: (IO (Try (@http.Response IO))) - (http.get (format address uri) - (http.headers ..base_headers) - {.#None} - http))] + [[status message] (is (IO (Try (@http.Response IO))) + (http.get (format address uri) + (http.headers ..base_headers) + {.#None} + http))] (case status (pattern (static http/status.ok)) (# ! each product.right ((the @http.#body message) {.#None})) @@ -77,17 +77,17 @@ (def: (upload uri content) (do (try.with io.monad) - [[status message] (: (IO (Try (@http.Response IO))) - (http.put (format address uri) - (http.headers (case identity - {.#None} - ..base_headers - - {.#Some [user password]} - (list& ["Authorization" (//identity.basic_auth user password)] - ..base_headers))) - {.#Some content} - http)) + [[status message] (is (IO (Try (@http.Response IO))) + (http.put (format address uri) + (http.headers (case identity + {.#None} + ..base_headers + + {.#Some [user password]} + (list& ["Authorization" (//identity.basic_auth user password)] + ..base_headers))) + {.#Some content} + http)) _ ((the @http.#body message) {.#Some 0})] (case status (pattern (static http/status.created)) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index 13b2e434e..e67c28d0d 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -1,7 +1,7 @@ (.using [library [lux {"-" Module} - [type {"+" :sharing}] + [type {"+" sharing}] ["@" target] ["[0]" debug] [abstract @@ -117,8 +117,8 @@ (do [! (try.with async.monad)] [] (loop [pending host_dependencies - output (: (Dictionary file.Path Binary) - (dictionary.empty text.hash))] + output (is (Dictionary file.Path Binary) + (dictionary.empty text.hash))] (case pending {.#End} (in output) @@ -157,21 +157,21 @@ (do (try.with async.monad) [.let [[compilation_host_dependencies compilation_libraries compilation_compilers compilation_sources compilation_target compilation_module compilation_configuration] compilation] import (import.import (the platform.#&file_system platform) compilation_libraries) - [state archive phase_wrapper] (:sharing [<parameters>] - (Platform <parameters>) - platform - - (Async (Try [(directive.State+ <parameters>) - Archive - phase.Wrapper])) - (:expected (platform.initialize file_context compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender - import compilation_sources compilation_configuration))) - [archive state] (:sharing [<parameters>] - (Platform <parameters>) - platform - - (Async (Try [Archive (directive.State+ <parameters>)])) - (:expected (platform.compile lux_compiler phase_wrapper import file_context expander platform compilation [archive state]))) + [state archive phase_wrapper] (sharing [<parameters>] + (Platform <parameters>) + platform + + (Async (Try [(directive.State+ <parameters>) + Archive + phase.Wrapper])) + (as_expected (platform.initialize file_context compilation_module expander host_analysis platform generation_bundle host_directive_bundle program anchorT,expressionT,directiveT extender + import compilation_sources compilation_configuration))) + [archive state] (sharing [<parameters>] + (Platform <parameters>) + platform + + (Async (Try [Archive (directive.State+ <parameters>)])) + (as_expected (platform.compile lux_compiler phase_wrapper import file_context expander platform compilation [archive state]))) _ (cache.cache! (the platform.#&file_system platform) file_context archive) host_dependencies (..load_host_dependencies (the platform.#&file_system platform) compilation_host_dependencies) _ (..package! (for @.old (file.async file.default) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index 46fd92eb2..80faa246f 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -42,7 +42,7 @@ (-> Frac (Try Any) Bit) (|>> (pipe.case {try.#Success actual} - (f.= expected (:as Frac actual)) + (f.= expected (as Frac actual)) {try.#Failure _} false))) @@ -140,38 +140,38 @@ (def: special_input Synthesis - (let [_cursor_ (: Synthesis - (synthesis.tuple (list (synthesis.text .prelude_module) - (synthesis.i64 +901) - (synthesis.i64 +13)))) - _code_ (: (-> Synthesis Synthesis) - (function (_ content) - (synthesis.tuple (list _cursor_ content)))) - _end_ (: Synthesis - (synthesis.variant [0 #0 (synthesis.text "")])) - _item_ (: (-> Synthesis Synthesis Synthesis) - (function (_ head tail) - (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) - _list_ (: (-> (List Synthesis) Synthesis) - (list#mix _item_ _end_))] - (let [__tuple__ (: (-> (List Synthesis) Synthesis) - (|>> list.reversed _list_ [9 #0] synthesis.variant _code_)) - __form__ (: (-> (List Synthesis) Synthesis) - (|>> list.reversed _list_ [7 #0] synthesis.variant _code_)) - __text__ (: (-> Text Synthesis) - (function (_ value) - (_code_ (synthesis.variant [5 #0 (synthesis.text value)])))) - __symbol__ (: (-> Symbol Synthesis) - (function (_ [module short]) - (_code_ (synthesis.variant [6 #0 (synthesis.tuple (list (synthesis.text module) - (synthesis.text short)))])))) - __list__ (: (-> (List Synthesis) Synthesis) - (list#mix (function (_ head tail) - (__form__ (list (__tag__ ["" "Item"]) head tail))) - (__tag__ ["" "End"]))) - __apply__ (: (-> Synthesis Synthesis Synthesis) - (function (_ func arg) - (__form__ (list func arg))))] + (let [_cursor_ (is Synthesis + (synthesis.tuple (list (synthesis.text .prelude_module) + (synthesis.i64 +901) + (synthesis.i64 +13)))) + _code_ (is (-> Synthesis Synthesis) + (function (_ content) + (synthesis.tuple (list _cursor_ content)))) + _end_ (is Synthesis + (synthesis.variant [0 #0 (synthesis.text "")])) + _item_ (is (-> Synthesis Synthesis Synthesis) + (function (_ head tail) + (synthesis.variant [0 #1 (synthesis.tuple (list head tail))]))) + _list_ (is (-> (List Synthesis) Synthesis) + (list#mix _item_ _end_))] + (let [__tuple__ (is (-> (List Synthesis) Synthesis) + (|>> list.reversed _list_ [9 #0] synthesis.variant _code_)) + __form__ (is (-> (List Synthesis) Synthesis) + (|>> list.reversed _list_ [7 #0] synthesis.variant _code_)) + __text__ (is (-> Text Synthesis) + (function (_ value) + (_code_ (synthesis.variant [5 #0 (synthesis.text value)])))) + __symbol__ (is (-> Symbol Synthesis) + (function (_ [module short]) + (_code_ (synthesis.variant [6 #0 (synthesis.tuple (list (synthesis.text module) + (synthesis.text short)))])))) + __list__ (is (-> (List Synthesis) Synthesis) + (list#mix (function (_ head tail) + (__form__ (list (__tag__ ["" "Item"]) head tail))) + (__tag__ ["" "End"]))) + __apply__ (is (-> Synthesis Synthesis Synthesis) + (function (_ func arg) + (__form__ (list func arg))))] (|> _end_ (_item_ (__apply__ (__symbol__ ["" "form$"]) (__list__ (list (__apply__ (__symbol__ ["" "tag$"]) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index cf94de3a9..dc2bf6ec7 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -46,7 +46,7 @@ (run (..safe <extension>)) (pipe.case {try.#Success valueT} - (n.= (<reference> param subject) (:as Nat valueT)) + (n.= (<reference> param subject) (as Nat valueT)) {try.#Failure _} false) @@ -69,7 +69,7 @@ {try.#Success valueT} ("lux i64 =" (i64.arithmetic_right_shifted param subject) - (:as I64 valueT)) + (as I64 valueT)) {try.#Failure _} false) @@ -88,17 +88,17 @@ (run (..safe <extension>)) (pipe.case {try.#Success valueT} - (<comp> (<prepare> subject) (:as <type> valueT)) + (<comp> (<prepare> subject) (as <type> valueT)) {try.#Failure _} false) (let [subject <subject_expr>])))] ["lux i64 f64" Frac i.frac f.= subject] - ["lux i64 char" Text (|>> (:as Nat) text.from_code) text#= (|> subject - (:as Nat) - (n.% (i64.left_shifted 8 1)) - (:as Int))] + ["lux i64 char" Text (|>> (as Nat) text.from_code) text#= (|> subject + (as Nat) + (n.% (i64.left_shifted 8 1)) + (as Int))] )) (~~ (template [<extension> <reference> <outputT> <comp>] [(_.test <extension> @@ -107,7 +107,7 @@ (run (..safe <extension>)) (pipe.case {try.#Success valueT} - (<comp> (<reference> param subject) (:as <outputT> valueT)) + (<comp> (<reference> param subject) (as <outputT> valueT)) {try.#Failure _} false)))] @@ -153,7 +153,7 @@ (pipe.case {try.#Success valueV} (bit#= (<text> param subject) - (:as Bit valueV)) + (as Bit valueV)) _ false)))] @@ -202,7 +202,7 @@ (run (..safe "lux text =")) (pipe.case {try.#Success valueV} - (:as Bit valueV) + (as Bit valueV) _ false)) @@ -210,7 +210,7 @@ (run (..safe "lux text =")) (pipe.case {try.#Success valueV} - (not (:as Bit valueV)) + (not (as Bit valueV)) _ false)))) @@ -219,7 +219,7 @@ (run (..safe "lux text <")) (pipe.case {try.#Success valueV} - (:as Bit valueV) + (as Bit valueV) {try.#Failure _} false))) @@ -228,7 +228,7 @@ (run (..safe "lux text size")) (pipe.case {try.#Success valueV} - (n.= sample_size (:as Nat valueV)) + (n.= sample_size (as Nat valueV)) _ false))) @@ -237,7 +237,7 @@ (run (..safe "lux text size")) (pipe.case {try.#Success valueV} - (n.= (n.* 2 sample_size) (:as Nat valueV)) + (n.= (n.* 2 sample_size) (as Nat valueV)) _ false))) @@ -248,7 +248,7 @@ (run (..safe "lux text index")) (pipe.case (^.multi {try.#Success valueV} - [(:as (Maybe Nat) valueV) + [(as (Maybe Nat) valueV) {.#Some valueV}]) (n.= 0 valueV) @@ -260,27 +260,27 @@ (run (..safe "lux text index")) (pipe.case (^.multi {try.#Success valueV} - [(:as (Maybe Nat) valueV) + [(as (Maybe Nat) valueV) {.#Some valueV}]) (n.= sample_size valueV) _ false)))) - (let [test_clip (: (-> (I64 Any) (I64 Any) Text Bit) - (function (_ offset length expected) - (|> {synthesis.#Extension "lux text clip" - (list concatenatedS - (synthesis.i64 offset) - (synthesis.i64 length))} - (run (..safe "lux text clip")) - (pipe.case - (^.multi {try.#Success valueV} - [(:as (Maybe Text) valueV) - {.#Some valueV}]) - (text#= expected valueV) - - _ - false))))] + (let [test_clip (is (-> (I64 Any) (I64 Any) Text Bit) + (function (_ offset length expected) + (|> {synthesis.#Extension "lux text clip" + (list concatenatedS + (synthesis.i64 offset) + (synthesis.i64 length))} + (run (..safe "lux text clip")) + (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)))) @@ -291,7 +291,7 @@ (run (..safe "lux text char")) (pipe.case (^.multi {try.#Success valueV} - [(:as (Maybe Int) valueV) + [(as (Maybe Int) valueV) {.#Some valueV}]) (text.contains? ("lux i64 char" valueV) sample_lower) @@ -325,7 +325,7 @@ (run (..safe "lux try")) (pipe.case (^.multi {try.#Success valueV} - [(:as (Try Text) valueV) + [(as (Try Text) valueV) {try.#Failure error}]) (text.contains? message error) @@ -339,7 +339,7 @@ (run (..safe "lux try")) (pipe.case (^.multi {try.#Success valueV} - [(:as (Try Text) valueV) + [(as (Try Text) valueV) {try.#Success valueV}]) (text#= message valueV) @@ -351,7 +351,7 @@ (run (..safe "lux io current-time")) (pipe.case {try.#Success valueV} - (let [[pre post] (:as [Nat Nat] valueV)] + (let [[pre post] (as [Nat Nat] valueV)] (n.>= pre post)) {try.#Failure _} diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index a193aa16f..db50dc185 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -36,7 +36,7 @@ (|> (run <evaluation_name> (<synthesis> expected)) (pipe.case {try.#Success actual} - (<test> expected (:expected actual)) + (<test> expected (as_expected actual)) {try.#Failure _} false))))] diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index 87c7b605b..687c3ef88 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -33,7 +33,7 @@ (|> (define name (synthesis.f64 expected)) (pipe.case {try.#Success actual} - (f.= expected (:as Frac actual)) + (f.= expected (as Frac actual)) {try.#Failure _} false))))) @@ -50,7 +50,7 @@ (run "variable") (pipe.case {try.#Success actual} - (f.= expected (:as Frac actual)) + (f.= expected (as Frac actual)) {try.#Failure _} false))))) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index 5fe2a809f..cf12ae152 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -44,19 +44,19 @@ (run "variant") (pipe.case {try.#Success valueT} - (let [valueT (:as (Array Any) 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))) + (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)) + 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'))) + (and last?_in (text#= "" (as Text last?_out'))) {.#None} (not last?_in)) - same_value? (|> value_out (:as Int) (i.= value_in))] + same_value? (|> value_out (as Int) (i.= value_in))] (and same_tag? same_flag? same_value?)))) @@ -74,10 +74,10 @@ (run "tuple") (pipe.case {try.#Success tuple_out} - (let [tuple_out (:as (Array Any) 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))) + (i.= left (as Int right))) (list.zipped/2 tuple_in (array.list tuple_out))))) {try.#Failure _} diff --git a/stdlib/source/specification/lux/abstract/apply.lux b/stdlib/source/specification/lux/abstract/apply.lux index fe61d1a33..fb4ddd758 100644 --- a/stdlib/source/specification/lux/abstract/apply.lux +++ b/stdlib/source/specification/lux/abstract/apply.lux @@ -2,6 +2,7 @@ [library [lux "*" ["_" test {"+" Test}] + ["[0]" type] [abstract [monad {"+" do}]] [control @@ -42,22 +43,22 @@ (_.test "Interchange." ((comparison n.=) (/#on (injection sample) (injection increase)) - (/#on (injection increase) (injection (: (-> (-> Nat Nat) Nat) - (function (_ f) (f sample))))))))) + (/#on (injection increase) (injection (is (-> (-> Nat Nat) Nat) + (function (_ f) (f sample))))))))) (def: (composition injection comparison (open "/#[0]")) (All (_ f) (-> (Injection f) (Comparison f) (Apply f) Test)) - (:let [:$/1: (-> Nat Nat)] + (type.let [:$/1: (-> Nat Nat)] (do [! random.monad] [sample random.nat - increase (: (Random :$/1:) - (# ! each n.+ random.nat)) - decrease (: (Random :$/1:) - (# ! each n.- random.nat))] + increase (is (Random :$/1:) + (# ! each n.+ random.nat)) + decrease (is (Random :$/1:) + (# ! each n.- random.nat))] (_.test "Composition." ((comparison n.=) - (|> (injection (: (-> :$/1: :$/1: :$/1:) - function.composite)) + (|> (injection (is (-> :$/1: :$/1: :$/1:) + function.composite)) (/#on (injection increase)) (/#on (injection decrease)) (/#on (injection sample))) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index 9888e2f58..09e022c89 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -104,8 +104,8 @@ [[dependency expected_package] ..package home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - .let [fs (: (file.System Async) - (file.mock (# file.default separator))) + .let [fs (is (file.System Async) + (file.mock (# file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad [wrote! (/.write_one program fs dependency expected_package) @@ -125,8 +125,8 @@ [expected ..resolution home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - .let [fs (: (file.System Async) - (file.mock (# file.default separator))) + .let [fs (is (file.System Async) + (file.mock (# file.default separator))) program (program.async (program.mock environment.empty home working_directory))]] (in (do async.monad [wrote! (/.write_all program fs expected) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index bfdbb789e..001bfcab3 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -48,8 +48,8 @@ (-> Nat Text (file.System Async) file.Path [(Atom Nat) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any]))]) - (let [@runs (: (Atom Nat) - (atom.atom 0))] + (let [@runs (is (Atom Nat) + (atom.atom 0))] [@runs (function (_ console program fs shell resolution profile) (do [! async.monad] @@ -74,12 +74,12 @@ program (random.ascii/alpha 5) target (random.ascii/alpha 5) source (random.ascii/alpha 5) - .let [empty_profile (: Profile - (# ///.monoid identity)) - with_target (: (-> Profile Profile) - (has ///.#target target)) - with_program (: (-> Profile Profile) - (has ///.#program {.#Some program})) + .let [empty_profile (is Profile + (# ///.monoid identity)) + with_target (is (-> Profile Profile) + (has ///.#target target)) + with_program (is (-> Profile Profile) + (has ///.#program {.#Some program})) profile (|> empty_profile with_program diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index f8d2d46ec..987d35506 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -42,68 +42,68 @@ (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) {try.#Success - (: (shell.Mock []) - (implementation - (def: (on_read state) - (exception.except shell.no_more_output [])) - (def: (on_fail state) - (exception.except shell.no_more_output [])) - (def: (on_write input state) - {try.#Failure "on_write"}) - (def: (on_destroy state) - {try.#Failure "on_destroy"}) - (def: (on_await state) - {try.#Success [state shell.normal]})))}))) + (is (shell.Mock []) + (implementation + (def: (on_read state) + (exception.except shell.no_more_output [])) + (def: (on_fail state) + (exception.except shell.no_more_output [])) + (def: (on_write input state) + {try.#Failure "on_write"}) + (def: (on_destroy state) + {try.#Failure "on_destroy"}) + (def: (on_await state) + {try.#Success [state shell.normal]})))}))) (def: .public bad_shell (-> Any (Shell IO)) (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) {try.#Success - (: (shell.Mock []) - (implementation - (def: (on_read state) - (exception.except shell.no_more_output [])) - (def: (on_fail state) - (exception.except shell.no_more_output [])) - (def: (on_write input state) - {try.#Failure "on_write"}) - (def: (on_destroy state) - {try.#Failure "on_destroy"}) - (def: (on_await state) - {try.#Success [state shell.error]})))}))) + (is (shell.Mock []) + (implementation + (def: (on_read state) + (exception.except shell.no_more_output [])) + (def: (on_fail state) + (exception.except shell.no_more_output [])) + (def: (on_write input state) + {try.#Failure "on_write"}) + (def: (on_destroy state) + {try.#Failure "on_destroy"}) + (def: (on_await state) + {try.#Success [state shell.error]})))}))) (def: .public (reader_shell error?) (-> Bit (-> (List Text) (Shell IO))) (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) {try.#Success - (: (shell.Mock (List Text)) - (implementation - (def: (on_read state) - (if error? - (exception.except shell.no_more_output []) - (case state - {.#Item head tail} - {try.#Success [tail head]} - - {.#End} - (exception.except shell.no_more_output [])))) - (def: (on_error state) - (if error? - (case state - {.#Item head tail} - {try.#Success [tail head]} - - {.#End} - (exception.except shell.no_more_output [])) - (exception.except shell.no_more_output []))) - (def: (on_write input state) - {try.#Failure "on_write"}) - (def: (on_destroy state) - {try.#Failure "on_destroy"}) - (def: (on_await state) - {try.#Success [state shell.error]})))}))) + (is (shell.Mock (List Text)) + (implementation + (def: (on_read state) + (if error? + (exception.except shell.no_more_output []) + (case state + {.#Item head tail} + {try.#Success [tail head]} + + {.#End} + (exception.except shell.no_more_output [])))) + (def: (on_error state) + (if error? + (case state + {.#Item head tail} + {try.#Success [tail head]} + + {.#End} + (exception.except shell.no_more_output [])) + (exception.except shell.no_more_output []))) + (def: (on_write input state) + {try.#Failure "on_write"}) + (def: (on_destroy state) + {try.#Failure "on_destroy"}) + (def: (on_await state) + {try.#Success [state shell.error]})))}))) (def: compiler (Random Dependency) @@ -148,12 +148,12 @@ target (random.ascii/alpha 5) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - .let [empty_profile (: Profile - (# ///.monoid identity)) - with_target (: (-> Profile Profile) - (has ///.#target target)) - with_program (: (-> Profile Profile) - (has ///.#program {.#Some program})) + .let [empty_profile (is Profile + (# ///.monoid identity)) + with_target (is (-> Profile Profile) + (has ///.#target target)) + with_program (is (-> Profile Profile) + (has ///.#program {.#Some program})) profile (|> empty_profile with_program diff --git a/stdlib/source/test/aedifex/command/clean.lux b/stdlib/source/test/aedifex/command/clean.lux index 6a2210f1b..21372ef80 100644 --- a/stdlib/source/test/aedifex/command/clean.lux +++ b/stdlib/source/test/aedifex/command/clean.lux @@ -56,8 +56,8 @@ (def: (create_directory! fs path files) (-> (file.System Async) Path (List [Path Binary]) (Async (Try Any))) (do [! (try.with async.monad)] - [_ (: (Async (Try Any)) - (file.make_directories async.monad fs path)) + [_ (is (Async (Try Any)) + (file.make_directories async.monad fs path)) _ (monad.each ! (..create_file! fs) files)] (in []))) @@ -73,10 +73,10 @@ (-> (file.System Async) Path (List [Path Binary]) (Async (Try Bit))) (do [! (try.with async.monad)] [directory_exists? (..directory_exists? fs directory_path) - files_exist? (: (Action (List Bit)) - (|> files - (list#each product.left) - (monad.each ///action.monad (..file_exists? fs))))] + files_exist? (is (Action (List Bit)) + (|> files + (list#each product.left) + (monad.each ///action.monad (..file_exists? fs))))] (in (and directory_exists? (list.every? (|>>) files_exist?))))) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index fd4780195..414d104d8 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -47,10 +47,10 @@ set.list (monad.each ! (function (_ head) (do ! - [_ (: (Async (Try Any)) - (file.make_directories async.monad fs head))] - (: (Async (Try Any)) - (file.make_file async.monad fs (binary.empty 0) (format head / head ".lux"))))))))) + [_ (is (Async (Try Any)) + (file.make_directories async.monad fs head))] + (is (Async (Try Any)) + (file.make_file async.monad fs (binary.empty 0) (format head / head ".lux"))))))))) (def: (execute! program fs sample) (-> (Program Async) (file.System Async) ///.Profile (Async (Try Text))) diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index e992f87bc..4f6cfcdc4 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -47,12 +47,12 @@ target (random.ascii/alpha 5) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) - .let [empty_profile (: Profile - (# ///.monoid identity)) - with_target (: (-> Profile Profile) - (has ///.#target target)) - with_test (: (-> Profile Profile) - (has ///.#test {.#Some test})) + .let [empty_profile (is Profile + (# ///.monoid identity)) + with_target (is (-> Profile Profile) + (has ///.#target target)) + with_test (is (-> Profile Profile) + (has ///.#test {.#Some test})) profile (|> empty_profile with_test @@ -84,20 +84,20 @@ [.let [bad_shell (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) {try.#Success - (: (shell.Mock []) - (implementation - (def: (on_read state) - (exception.except shell.no_more_output [])) - (def: (on_error state) - (exception.except shell.no_more_output [])) - (def: (on_write input state) - {try.#Failure "on_write"}) - (def: (on_destroy state) - {try.#Failure "on_destroy"}) - (def: (on_await state) - {try.#Success [state (if (list.any? (text#= "build") actual_arguments) - shell.normal - shell.error)]})))}) + (is (shell.Mock []) + (implementation + (def: (on_read state) + (exception.except shell.no_more_output [])) + (def: (on_error state) + (exception.except shell.no_more_output [])) + (def: (on_write input state) + {try.#Failure "on_write"}) + (def: (on_destroy state) + {try.#Failure "on_destroy"}) + (def: (on_await state) + {try.#Success [state (if (list.any? (text#= "build") actual_arguments) + shell.normal + shell.error)]})))}) [])] _ (/.do! console (program.async (program.mock environment.empty home working_directory)) fs (shell.async bad_shell) resolution diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index c22121755..ed834c759 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -66,19 +66,19 @@ (implementation (def: (request method url headers input) (do io.monad - [_ (: (IO Any) - (case [method input] - [{@http.#Put} {.#Some input}] - (atom.update! (dictionary.has url input) cache) - - _ - (in [])))] + [_ (is (IO Any) + (case [method input] + [{@http.#Put} {.#Some input}] + (atom.update! (dictionary.has url input) cache) + + _ + (in [])))] (in {try.#Success ..good_upload}))))) (def: (verify_one expected_deployments address package cache expected_artifact actual_artifact) (-> Nat URL Package (Dictionary URL Binary) Artifact Artifact Bit) - (let [url (: (-> URI URL) - (|>> (format address))) + (let [url (is (-> URI URL) + (|>> (format address))) library_url (url (format (artifact.uri (the artifact.#version expected_artifact) expected_artifact) artifact/extension.lux_library)) @@ -138,9 +138,9 @@ .let [artifact (|> profile (the profile.#identity) maybe.trusted) - dependency (: Dependency - [artifact - artifact/type.lux_library])]] + dependency (is Dependency + [artifact + artifact/type.lux_library])]] (in [dependency artifact package]))) (def: .public test @@ -152,8 +152,8 @@ ($_ _.and (do [! random.monad] [[dependency expected_artifact package] ..bundle - .let [cache (: Cache - (atom.atom (dictionary.empty text.hash))) + .let [cache (is Cache + (atom.atom (dictionary.empty text.hash))) http (..http cache) repository (repository.async (remote.repository http {.#None} address))]] (in (do async.monad @@ -164,9 +164,9 @@ (try#each (verify_one 1 address package cache expected_artifact)) (try.else false)))))) (do [! random.monad] - [.let [hash (: (Hash [Dependency Artifact Package]) - (# hash.functor each (|>> product.right product.left product.left) - text.hash))] + [.let [hash (is (Hash [Dependency Artifact Package]) + (# hash.functor each (|>> product.right product.left product.left) + text.hash))] num_bundles (# ! each (n.% 10) random.nat) bundles (|> ..bundle (random.set hash num_bundles) @@ -175,8 +175,8 @@ (dictionary.has dependency package resolution)) resolution.empty bundles) - cache (: Cache - (atom.atom (dictionary.empty text.hash))) + cache (is Cache + (atom.atom (dictionary.empty text.hash))) http (..http cache) repository (repository.async (remote.repository http {.#None} address))]] (in (do async.monad diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 5ea995021..c7f81d3c3 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -104,16 +104,16 @@ "[1]") (def: (on_download uri state) (if (text.contains? expected uri) - (let [library (: Binary - (|> package - (the ///package.#library) - product.left)) - pom (: Binary - (|> package - (the ///package.#pom) - product.left - (# xml.codec encoded) - (# utf8.codec encoded)))] + (let [library (is Binary + (|> package + (the ///package.#library) + product.left)) + pom (is Binary + (|> package + (the ///package.#pom) + product.left + (# xml.codec encoded) + (# utf8.codec encoded)))] (cond (text.ends_with? ///artifact/extension.lux_library uri) {try.#Success [state library]} diff --git a/stdlib/source/test/aedifex/input.lux b/stdlib/source/test/aedifex/input.lux index dedb9b33c..4a7100296 100644 --- a/stdlib/source/test/aedifex/input.lux +++ b/stdlib/source/test/aedifex/input.lux @@ -46,8 +46,8 @@ (<| (_.covering /._) (do [! random.monad] [expected (# ! each (has //.#parents (list)) $profile.random) - .let [fs (: (file.System Async) - (file.mock (# file.default separator)))]] + .let [fs (is (file.System Async) + (file.mock (# file.default separator)))]] (in (do async.monad [verdict (do //action.monad [.let [profile (|> expected @@ -56,8 +56,8 @@ %.code (# utf8.codec encoded))] _ (# fs write profile //project.file) - actual (: (Async (Try Profile)) - (/.read async.monad fs (list //.default)))] + actual (is (Async (Try Profile)) + (/.read async.monad fs (list //.default)))] (in (# //.equivalence = (|> expected (revised //.#sources ..with_default_source) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index f529c2d0a..af642f65b 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -56,11 +56,11 @@ (def: with_default_sources (-> //.Profile //.Profile) (revised //.#sources - (: (-> (Set //.Source) (Set //.Source)) - (function (_ sources) - (if (set.empty? sources) - (set.of_list text.hash (list //.default_source)) - sources))))) + (is (-> (Set //.Source) (Set //.Source)) + (function (_ sources) + (if (set.empty? sources) + (set.of_list text.hash (list //.default_source)) + sources))))) (def: with_default_repository (-> //.Profile //.Profile) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 751655065..2cccd5878 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -193,8 +193,8 @@ (type: (Returner a) (/.Interface - (: (-> Any a) - return))) + (is (-> Any a) + return))) (/.implementation: (global_returner value) (All (_ a) (-> a (Returner a))) @@ -210,10 +210,10 @@ Test (do random.monad [expected random.nat - .let [local_returner (: (Returner Nat) - (/.implementation - (def: (return _) - expected)))]] + .let [local_returner (is (Returner Nat) + (/.implementation + (def: (return _) + expected)))]] (_.for [/.Interface] ($_ _.and (_.cover [/.implementation:] @@ -404,22 +404,22 @@ (def: for_macro Test - (let [macro (: /.Macro' - (function (_ tokens lux) - {.#Right [lux (list)]}))] + (let [macro (is /.Macro' + (function (_ tokens lux) + {.#Right [lux (list)]}))] (do random.monad [expected random.nat] (`` (`` ($_ _.and (_.cover [/.Macro'] (|> macro - (: /.Macro') + (is /.Macro') (same? macro))) (_.cover [/.Macro] (|> macro "lux macro" - (: /.Macro) - (: Any) - (same? (: Any macro)))) + (is /.Macro) + (is Any) + (same? (is Any macro)))) (_.cover [/.macro:] (same? expected (..identity_macro expected))) (~~ (for @.old (~~ (as_is)) @@ -452,23 +452,23 @@ <open/0> (template.text [<module/0> "#[0]"])] (and (~~ (template [<input> <module> <referrals>] [(with_expansions [<input>' (macro.final <input>)] - (let [scenario (: (-> Any Bit) - (function (_ _) - ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. - (`` (for @.python (case (' [<input>']) - (^.` [<module> - ("lux def" (~ [_ {.#Symbol ["" _]}]) [] #0) - (~~ (template.spliced <referrals>))]) - true - - _ - false) - (case (' [<input>']) - (^.` [<module> (~~ (template.spliced <referrals>))]) - true - - _ - false)))))] + (let [scenario (is (-> Any Bit) + (function (_ _) + ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. + (`` (for @.python (case (' [<input>']) + (^.` [<module> + ("lux def" (~ [_ {.#Symbol ["" _]}]) [] #0) + (~~ (template.spliced <referrals>))]) + true + + _ + false) + (case (' [<input>']) + (^.` [<module> (~~ (template.spliced <referrals>))]) + true + + _ + false)))))] (scenario [])))] [(.using [<module/0>']) @@ -563,30 +563,23 @@ expected/1 existential_type] (<| (_.for [/.Type]) ($_ _.and - (_.cover [/.:] + (_.cover [/.is] (|> expected - (/.: Any) - (same? (/.: Any expected)))) - (_.cover [/.:as] + (/.is Any) + (same? (/.is Any expected)))) + (_.cover [/.as] (|> expected - (/.: Any) - (/.:as /.Nat) + (/.is Any) + (/.as /.Nat) (same? expected))) - (_.cover [/.:expected] + (_.cover [/.as_expected] (|> expected - (/.: Any) - /.:expected - (/.: /.Nat) + (/.is Any) + /.as_expected + (/.is /.Nat) (same? expected))) - (_.cover [/.:let] - (let [[actual_left actual_right] - (: (/.:let [side /.Nat] - [side side]) - [expected_left expected_right])] - (and (same? expected_left actual_left) - (same? expected_right actual_right)))) - (_.cover [/.:of] - (same? /.Nat (/.:of expected))) + (_.cover [/.type_of] + (same? /.Nat (/.type_of expected))) (_.cover [/.Primitive] (case (/.Primitive "foo" [expected/0 expected/1]) (pattern {.#Primitive "foo" (list actual/0 actual/1)}) @@ -626,20 +619,20 @@ false))) (_.cover [/.type:] (exec - (: /.Type ..for_type/variant) - (: /.Type ..for_type/record) - (: /.Type ..for_type/all) + (is /.Type ..for_type/variant) + (is /.Type ..for_type/record) + (is /.Type ..for_type/all) true)) (_.cover [/.Variant] (exec - (: for_type/variant - {#Case/1 expected_left}) + (is for_type/variant + {#Case/1 expected_left}) true)) (_.cover [/.Record] (exec - (: for_type/record - [#slot/0 (n.= expected_left expected_right) - #slot/1 (.rev expected_right)]) + (is for_type/record + [#slot/0 (n.= expected_left expected_right) + #slot/1 (.rev expected_right)]) true)) )))) @@ -649,17 +642,17 @@ [expected random.i64] ($_ _.and (_.cover [/.i64] - (same? (: Any expected) - (: Any (/.i64 expected)))) + (same? (is Any expected) + (is Any (/.i64 expected)))) (_.cover [/.nat] - (same? (: Any expected) - (: Any (/.nat expected)))) + (same? (is Any expected) + (is Any (/.nat expected)))) (_.cover [/.int] - (same? (: Any expected) - (: Any (/.int expected)))) + (same? (is Any expected) + (is Any (/.int expected)))) (_.cover [/.rev] - (same? (: Any expected) - (: Any (/.rev expected)))) + (same? (is Any expected) + (is Any (/.rev expected)))) (_.cover [/.++] (n.= 1 (n.- expected (/.++ expected)))) @@ -674,14 +667,14 @@ [expected_left random.nat expected_right random.nat] (_.cover [/.-> /.function] - (and (let [actual (: (/.-> Nat Nat Nat) - (/.function (_ actual_left actual_right) - (n.* (++ actual_left) (-- actual_right))))] + (and (let [actual (is (/.-> Nat Nat Nat) + (/.function (_ actual_left actual_right) + (n.* (++ actual_left) (-- actual_right))))] (n.= (n.* (++ expected_left) (-- expected_right)) (actual expected_left expected_right))) - (let [actual (: (/.-> [Nat Nat] Nat) - (/.function (_ [actual_left actual_right]) - (n.* (++ actual_left) (-- actual_right))))] + (let [actual (is (/.-> [Nat Nat] Nat) + (/.function (_ [actual_left actual_right]) + (n.* (++ actual_left) (-- actual_right))))] (n.= (n.* (++ expected_left) (-- expected_right)) (actual [expected_left expected_right]))))))) @@ -801,8 +794,8 @@ (/.the #big_left) (n.= expected/b)) (|> sample - ((: (-> (-> Nat Nat) (-> Big Big)) - (/.revised #big_left)) + ((is (-> (-> Nat Nat) (-> Big Big)) + (/.revised #big_left)) (n.+ shift/b)) (/.the #big_left) (n.= expected/b))) @@ -815,8 +808,8 @@ (/.the [#big_right #small_left]) (n.= expected/s)) (|> sample - ((: (-> (-> Nat Nat) (-> Big Big)) - (/.revised [#big_right #small_left])) + ((is (-> (-> Nat Nat) (-> Big Big)) + (/.revised [#big_right #small_left])) (n.+ shift/s)) (/.the [#big_right #small_left]) (n.= expected/s))))) @@ -896,52 +889,52 @@ ($_ _.and (_.cover [/.Either] (and (exec - (: (/.Either Nat Text) - {.#Left left}) + (is (/.Either Nat Text) + {.#Left left}) true) (exec - (: (/.Either Nat Text) - {.#Right right}) + (is (/.Either Nat Text) + {.#Right right}) true))) (_.cover [/.Any] (and (exec - (: /.Any - left) + (is /.Any + left) true) (exec - (: /.Any - right) + (is /.Any + right) true))) (_.cover [/.Nothing] (and (exec - (: (-> /.Any /.Nothing) - (function (_ _) - (undefined))) + (is (-> /.Any /.Nothing) + (function (_ _) + (undefined))) true) (exec - (: (-> /.Any /.Int) - (function (_ _) - (: /.Int (undefined)))) + (is (-> /.Any /.Int) + (function (_ _) + (is /.Int (undefined)))) true))) (_.for [/.__adjusted_quantified_type__] ($_ _.and (_.cover [/.All] - (let [identity (: (/.All (_ a) (-> a a)) - (|>>))] + (let [identity (is (/.All (_ a) (-> a a)) + (|>>))] (and (exec - (: Nat - (identity left)) + (is Nat + (identity left)) true) (exec - (: Text - (identity right)) + (is Text + (identity right)) true)))) (_.cover [/.Ex] - (let [hide (: (/.Ex (_ a) (-> Nat a)) - (|>>))] + (let [hide (is (/.Ex (_ a) (-> Nat a)) + (|>>))] (exec - (: /.Any - (hide left)) + (is /.Any + (hide left)) true))))) (_.cover [/.same?] (let [not_left (atom.atom left) @@ -950,12 +943,12 @@ (/.same? not_left not_left) (not (/.same? left not_left))))) (_.cover [/.Rec] - (let [list (: (/.Rec NList - (Maybe [Nat NList])) - {.#Some [item/0 - {.#Some [item/1 - {.#Some [item/2 - {.#None}]}]}]})] + (let [list (is (/.Rec NList + (Maybe [Nat NList])) + {.#Some [item/0 + {.#Some [item/1 + {.#Some [item/2 + {.#None}]}]}]})] (case list {.#Some [actual/0 {.#Some [actual/1 {.#Some [actual/2 {.#None}]}]}]} (and (same? item/0 actual/0) @@ -1012,10 +1005,10 @@ (/.case [..#left expected_nat ..#right expected_int] [..#left 0 ..#right +0] true _ false) - (/.case (: (Either Nat Int) {.#Left expected_nat}) + (/.case (is (Either Nat Int) {.#Left expected_nat}) {.#Left 0} true _ false) - (/.case (: (Either Nat Int) {.#Right expected_int}) + (/.case (is (Either Nat Int) {.#Right expected_int}) {.#Right +0} true _ false) )) @@ -1154,20 +1147,20 @@ captured/2 (the .#captured scope/2) - local? (: (-> Ref Bit) - (function (_ ref) - (case ref - {.#Local _} true - {.#Captured _} false))) - captured? (: (-> Ref Bit) - (|>> local? not)) - binding? (: (-> (-> Ref Bit) Text Bit) - (function (_ is? name) - (|> captured/2 - (the .#mappings) - (plist.value name) - (maybe#each (|>> product.right is?)) - (maybe.else false)))) + local? (is (-> Ref Bit) + (function (_ ref) + (case ref + {.#Local _} true + {.#Captured _} false))) + captured? (is (-> Ref Bit) + (|>> local? not)) + binding? (is (-> (-> Ref Bit) Text Bit) + (function (_ is? name) + (|> captured/2 + (the .#mappings) + (plist.value name) + (maybe#each (|>> product.right is?)) + (maybe.else false)))) correct_closure! (and (n.= 6 (the .#counter captured/2)) diff --git a/stdlib/source/test/lux/abstract/comonad.lux b/stdlib/source/test/lux/abstract/comonad.lux index 2fb455145..5d5cb6857 100644 --- a/stdlib/source/test/lux/abstract/comonad.lux +++ b/stdlib/source/test/lux/abstract/comonad.lux @@ -1,17 +1,17 @@ (.using - [library - [lux "*" - [abstract - [monad {"+" do}]] - [data - ["[0]" identity {"+" Identity}]] - [math - ["[0]" random] - [number - ["n" nat]]] - ["_" test {"+" Test}]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + [abstract + [monad {"+" do}]] + [data + ["[0]" identity {"+" Identity}]] + [math + ["[0]" random] + [number + ["n" nat]]] + ["_" test {"+" Test}]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -21,8 +21,8 @@ ($_ _.and (_.cover [/.be] (n.= (++ sample) - (: (Identity Nat) - (/.be identity.comonad - [value (out sample)] - (out (++ value)))))) + (is (Identity Nat) + (/.be identity.comonad + [value (out sample)] + (out (++ value)))))) )))) diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/cofree.lux index 02a722274..eb748e87b 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/cofree.lux @@ -1,23 +1,23 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [functor {"+" Functor}] - [comonad {"+" CoMonad}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" comonad]]] - [control - ["//" continuation]] - [data - [collection - ["[0]" list] - ["[0]" stream {"+" Stream} ("[1]#[0]" comonad)]]] - [math - ["[0]" random]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [functor {"+" Functor}] + [comonad {"+" CoMonad}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" comonad]]] + [control + ["//" continuation]] + [data + [collection + ["[0]" list] + ["[0]" stream {"+" Stream} ("[1]#[0]" comonad)]]] + [math + ["[0]" random]]]] + [\\library + ["[0]" /]]) (def: (injection value) (Injection (/.CoFree Stream)) @@ -43,9 +43,9 @@ (_.for [/.CoFree]) ($_ _.and (_.for [/.functor] - ($functor.spec ..injection ..comparison (: (Functor (/.CoFree Stream)) - (/.functor stream.functor)))) + ($functor.spec ..injection ..comparison (is (Functor (/.CoFree Stream)) + (/.functor stream.functor)))) (_.for [/.comonad] - ($comonad.spec ..injection ..comparison (: (CoMonad (/.CoFree Stream)) - (/.comonad stream.functor)))) + ($comonad.spec ..injection ..comparison (is (CoMonad (/.CoFree Stream)) + (/.comonad stream.functor)))) ))) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 11056a9a6..a4910e4c3 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe ("[1]#[0]" functor)]] - [data - ["[0]" product] - [collection - ["[0]" list ("[1]#[0]" mix)]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe ("[1]#[0]" functor)]] + [data + ["[0]" product] + [collection + ["[0]" list ("[1]#[0]" mix)]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public test Test - (let [limit (: (Random Nat) - (# random.monad each (n.% 20) random.nat))] + (let [limit (is (Random Nat) + (# random.monad each (n.% 20) random.nat))] (do random.monad [start limit end limit diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index db242434c..649d7a96b 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - [functor - ["$[0]" contravariant]]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat] - ["i" int]]]]] - [\\library - ["[0]" / {"+" Equivalence}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + [functor + ["$[0]" contravariant]]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat] + ["i" int]]]]] + [\\library + ["[0]" / {"+" Equivalence}]]) (def: .public test Test @@ -26,34 +26,34 @@ rightI random.int sample random.nat different (|> random.nat (random.only (|>> (n.= sample) not))) - .let [equivalence (: (Equivalence (Equivalence Nat)) - (implementation - (def: (= left right) - (and (bit#= (# left = leftN leftN) - (# right = leftN leftN)) - (bit#= (# left = rightN rightN) - (# right = rightN rightN)) - (bit#= (# left = leftN rightN) - (# right = leftN rightN))))))]] + .let [equivalence (is (Equivalence (Equivalence Nat)) + (implementation + (def: (= left right) + (and (bit#= (# left = leftN leftN) + (# right = leftN leftN)) + (bit#= (# left = rightN rightN) + (# right = rightN rightN)) + (bit#= (# left = leftN rightN) + (# right = leftN rightN))))))]] (<| (_.covering /._) ($_ _.and (_.for [/.functor] ($contravariant.spec equivalence n.equivalence /.functor)) (_.cover [/.rec] - (let [equivalence (: (Equivalence (List Nat)) - (/.rec (function (_ equivalence) - (implementation - (def: (= left right) - (case [left right] - [{.#End} {.#End}] - true + (let [equivalence (is (Equivalence (List Nat)) + (/.rec (function (_ equivalence) + (implementation + (def: (= left right) + (case [left right] + [{.#End} {.#End}] + true - [{.#Item leftH lefT} {.#Item rightH rightT}] - (and (n.= leftH rightH) - (# equivalence = lefT rightT)) + [{.#Item leftH lefT} {.#Item rightH rightT}] + (and (n.= leftH rightH) + (# equivalence = lefT rightT)) - _ - false))))))] + _ + false))))))] (and (# equivalence = (list sample sample) (list sample sample)) (not (# equivalence = (list sample sample) (list sample))) (not (# equivalence = (list sample sample) (list different different)))))) diff --git a/stdlib/source/test/lux/abstract/hash.lux b/stdlib/source/test/lux/abstract/hash.lux index 635476226..dd0fd6732 100644 --- a/stdlib/source/test/lux/abstract/hash.lux +++ b/stdlib/source/test/lux/abstract/hash.lux @@ -23,15 +23,15 @@ (do random.monad [leftN random.nat rightN random.nat - .let [hash (: (Equivalence (/.Hash Nat)) - (implementation - (def: (= (open "left#[0]") (open "right#[0]")) - (and (bit#= (left#= (left#hash leftN) (left#hash leftN)) - (right#= (right#hash leftN) (right#hash leftN))) - (bit#= (left#= (left#hash rightN) (left#hash rightN)) - (right#= (right#hash rightN) (right#hash rightN))) - (bit#= (left#= (left#hash leftN) (left#hash rightN)) - (right#= (right#hash leftN) (right#hash rightN)))))))]] + .let [hash (is (Equivalence (/.Hash Nat)) + (implementation + (def: (= (open "left#[0]") (open "right#[0]")) + (and (bit#= (left#= (left#hash leftN) (left#hash leftN)) + (right#= (right#hash leftN) (right#hash leftN))) + (bit#= (left#= (left#hash rightN) (left#hash rightN)) + (right#= (right#hash rightN) (right#hash rightN))) + (bit#= (left#= (left#hash leftN) (left#hash rightN)) + (right#= (right#hash leftN) (right#hash rightN)))))))]] (<| (_.covering /._) ($_ _.and (_.for [/.functor] diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index cb5654aed..93d060041 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -1,17 +1,17 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [data - ["[0]" identity {"+" Identity}] - [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Monad do}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [data + ["[0]" identity {"+" Identity}] + [collection + ["[0]" list ("[1]#[0]" functor mix)]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Monad do}]]) (def: .public test Test @@ -22,36 +22,36 @@ ($_ _.and (_.cover [/.do] (n.= (++ mono) - (: (Identity Nat) - (/.do identity.monad - [sample (in mono)] - (in (++ sample)))))) + (is (Identity Nat) + (/.do identity.monad + [sample (in mono)] + (in (++ sample)))))) (_.cover [/.then] (n.= (++ mono) - (: (Identity Nat) - (/.then identity.monad - (|>> ++ (# identity.monad in)) - (# identity.monad in mono))))) + (is (Identity Nat) + (/.then identity.monad + (|>> ++ (# identity.monad in)) + (# identity.monad in mono))))) (_.cover [/.all] (# (list.equivalence n.equivalence) = (list#each ++ poly) (|> poly (list#each (|>> ++ (# identity.monad in))) - (: (List (Identity Nat))) + (is (List (Identity Nat))) (/.all identity.monad) - (: (Identity (List Nat)))))) + (is (Identity (List Nat)))))) (_.cover [/.each] (# (list.equivalence n.equivalence) = (list#each ++ poly) (|> poly (/.each identity.monad (|>> ++ (# identity.monad in))) - (: (Identity (List Nat)))))) + (is (Identity (List Nat)))))) (_.cover [/.only] (# (list.equivalence n.equivalence) = (list.only n.even? poly) (|> poly (/.only identity.monad (|>> n.even? (# identity.monad in))) - (: (Identity (List Nat)))))) + (is (Identity (List Nat)))))) (_.cover [/.mix] (n.= (list#mix n.+ 0 poly) (|> poly @@ -60,5 +60,5 @@ (# identity.monad in (n.+ part whole))) 0) - (: (Identity Nat))))) + (is (Identity Nat))))) )))) diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 0afb69708..82bd8e2df 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [functor {"+" Functor}] - [apply {"+" Apply}] - [monad {"+" Monad do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [data - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["[0]" random]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [functor {"+" Functor}] + [apply {"+" Apply}] + [monad {"+" Monad do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [data + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["[0]" random]]]] + [\\library + ["[0]" /]]) (def: injection (Injection (/.Free List)) @@ -46,12 +46,12 @@ (_.for [/.Free]) ($_ _.and (_.for [/.functor] - ($functor.spec ..injection ..comparison (: (Functor (/.Free List)) - (/.functor list.functor)))) + ($functor.spec ..injection ..comparison (is (Functor (/.Free List)) + (/.functor list.functor)))) (_.for [/.apply] - ($apply.spec ..injection ..comparison (: (Apply (/.Free List)) - (/.apply list.functor)))) + ($apply.spec ..injection ..comparison (is (Apply (/.Free List)) + (/.apply list.functor)))) (_.for [/.monad] - ($monad.spec ..injection ..comparison (: (Monad (/.Free List)) - (/.monad list.functor)))) + ($monad.spec ..injection ..comparison (is (Monad (/.Free List)) + (/.monad list.functor)))) ))) diff --git a/stdlib/source/test/lux/abstract/order.lux b/stdlib/source/test/lux/abstract/order.lux index 867e5ec3c..0092ab8bb 100644 --- a/stdlib/source/test/lux/abstract/order.lux +++ b/stdlib/source/test/lux/abstract/order.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - [functor - ["$[0]" contravariant]]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / - [// - [equivalence {"+" Equivalence}]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + [functor + ["$[0]" contravariant]]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / + [// + [equivalence {"+" Equivalence}]]]]) (def: .public test Test @@ -24,15 +24,15 @@ (do random.monad [left random.nat right (|> random.nat (random.only (|>> (n.= left) not))) - .let [equivalence (: (Equivalence (/.Order Nat)) - (implementation - (def: (= leftO rightO) - (and (bit#= (# leftO < left left) - (# rightO < left left)) - (bit#= (# leftO < right right) - (# rightO < right right)) - (bit#= (# leftO < left right) - (# rightO < left right))))))]]) + .let [equivalence (is (Equivalence (/.Order Nat)) + (implementation + (def: (= leftO rightO) + (and (bit#= (# leftO < left left) + (# rightO < left left)) + (bit#= (# leftO < right right) + (# rightO < right right)) + (bit#= (# leftO < left right) + (# rightO < left right))))))]]) ($_ _.and (_.for [/.functor] ($contravariant.spec equivalence n.order /.functor)) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index 379041a60..e61708ed4 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [equivalence {"+" Equivalence}] - [monad {"+" do}] - [\\specification - ["$[0]" monoid] - [functor - ["$[0]" contravariant]]]] - [control - ["[0]" function]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [equivalence {"+" Equivalence}] + [monad {"+" do}] + [\\specification + ["$[0]" monoid] + [functor + ["$[0]" contravariant]]]] + [control + ["[0]" function]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: (multiple? factor) (-> Nat (/.Predicate Nat)) @@ -34,19 +34,19 @@ (do [! random.monad] [sample random.nat samples (random.list 10 random.nat) - .let [equivalence (: (Equivalence (/.Predicate Nat)) - (implementation - (def: (= left right) - (bit#= (left sample) - (right sample)))))]]) + .let [equivalence (is (Equivalence (/.Predicate Nat)) + (implementation + (def: (= left right) + (bit#= (left sample) + (right sample)))))]]) (_.for [/.Predicate]) ($_ _.and (_.for [/.functor] ($contravariant.spec equivalence (multiple? 2) /.functor)) - (let [generator (: (Random (/.Predicate Nat)) - (|> random.nat - (random.only (|>> (n.= 0) not)) - (# ! each multiple?)))] + (let [generator (is (Random (/.Predicate Nat)) + (|> random.nat + (random.only (|>> (n.= 0) not)) + (# ! each multiple?)))] ($_ _.and (_.for [/.union] ($monoid.spec equivalence /.union generator)) @@ -76,16 +76,16 @@ ((/.difference /3? /2?) sample)))) (_.cover [/.rec] (let [even? (multiple? 2) - any_even? (: (/.Predicate (List Nat)) - (/.rec (function (_ again) - (function (_ values) - (case values - {.#End} - false + any_even? (is (/.Predicate (List Nat)) + (/.rec (function (_ again) + (function (_ values) + (case values + {.#End} + false - {.#Item head tail} - (or (even? head) - (again tail)))))))] + {.#Item head tail} + (or (even? head) + (again tail)))))))] (bit#= (list.any? even? samples) (any_even? samples)))) ))) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 85a1f4ac8..f6c5cb00f 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -1,23 +1,23 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [data - ["[0]" sum] - ["[0]" bit ("[1]#[0]" equivalence)]] - [macro - ["[0]" template]] - [math - ["[0]" random] - [number - ["n" nat] - ["i" int] - ["r" rev] - ["f" frac]]]]] - [\\library - ["[0]" / {"+" word: => ||>}]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [data + ["[0]" sum] + ["[0]" bit ("[1]#[0]" equivalence)]] + [macro + ["[0]" template]] + [math + ["[0]" random] + [number + ["n" nat] + ["i" int] + ["r" rev] + ["f" frac]]]]] + [\\library + ["[0]" / {"+" word: => ||>}]]) (def: stack_shuffling Test @@ -92,30 +92,30 @@ )))) (template: (!numerical <=> <generator> <only> <arithmetic> <order>) - [(: Test - (with_expansions [<arithmetic>' (template.spliced <arithmetic>) - <order>' (template.spliced <order>)] - (do random.monad - [parameter (|> <generator> (random.only <only>)) - subject <generator>] - (`` ($_ _.and - (~~ (template [<concatenative> <functional>] - [(_.cover [<concatenative>] - (<=> (<functional> parameter subject) - (||> (/.push subject) - (/.push parameter) - <concatenative>)))] + [(is Test + (with_expansions [<arithmetic>' (template.spliced <arithmetic>) + <order>' (template.spliced <order>)] + (do random.monad + [parameter (|> <generator> (random.only <only>)) + subject <generator>] + (`` ($_ _.and + (~~ (template [<concatenative> <functional>] + [(_.cover [<concatenative>] + (<=> (<functional> parameter subject) + (||> (/.push subject) + (/.push parameter) + <concatenative>)))] - <arithmetic>')) - (~~ (template [<concatenative> <functional>] - [(_.cover [<concatenative>] - (bit#= (<functional> parameter subject) - (||> (/.push subject) - (/.push parameter) - <concatenative>)))] + <arithmetic>')) + (~~ (template [<concatenative> <functional>] + [(_.cover [<concatenative>] + (bit#= (<functional> parameter subject) + (||> (/.push subject) + (/.push parameter) + <concatenative>)))] - <order>')) - )))))]) + <order>')) + )))))]) (def: numerical Test @@ -141,10 +141,10 @@ sample random.nat start random.nat .let [distance 10 - |++| (: (/.=> [Nat] [Nat]) - (/.apply/1 ++)) - |test| (: (/.=> [Nat] [Bit]) - (/.apply/1 (|>> (n.- start) (n.< distance))))]] + |++| (is (/.=> [Nat] [Nat]) + (/.apply/1 ++)) + |test| (is (/.=> [Nat] [Bit]) + (/.apply/1 (|>> (n.- start) (n.< distance))))]] ($_ _.and (_.cover [/.call /.apply/1] (n.= (++ sample) @@ -246,21 +246,21 @@ (_.cover [/.loop] (n.= (n.+ distance start) (||> (/.push start) - (/.push (: (/.=> [Nat] [Nat Bit]) - (|>> |++| /.dup |test|))) + (/.push (is (/.=> [Nat] [Nat Bit]) + (|>> |++| /.dup |test|))) /.loop))) (_.cover [/.while] (n.= (n.+ distance start) (||> (/.push start) - (/.push (: (/.=> [Nat] [Nat Bit]) - (|>> /.dup |test|))) + (/.push (is (/.=> [Nat] [Nat Bit]) + (|>> /.dup |test|))) (/.push |++|) /.while))) (_.cover [/.do] (n.= (++ sample) (||> (/.push sample) - (/.push (: (/.=> [] [Bit]) - (|>> (/.push false)))) + (/.push (is (/.=> [] [Bit]) + (|>> (/.push false)))) (/.push |++|) /.do /.while))) (_.cover [/.compose] diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 5f96bbe35..73ff15702 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -49,12 +49,12 @@ Test (do [! random.monad] [initial_state random.nat - .let [as_mail (: (All (_ a) (-> (-> a a) (/.Mail a))) - (function (_ transform) - (function (_ state actor) - (|> state transform {try.#Success} async#in)))) - ++! (: (/.Mail Nat) (as_mail ++)) - --! (: (/.Mail Nat) (as_mail --))]] + .let [as_mail (is (All (_ a) (-> (-> a a) (/.Mail a))) + (function (_ transform) + (function (_ state actor) + (|> state transform {try.#Success} async#in)))) + ++! (is (/.Mail Nat) (as_mail ++)) + --! (is (/.Mail Nat) (as_mail --))]] (<| (_.covering /._) (_.for [/.Actor]) ($_ _.and @@ -82,23 +82,23 @@ (and poisoned_actors_die! cannot_poison_more_than_once!))) - (let [[read write] (: [(Async Text) (Resolver Text)] - (async.async []))] + (let [[read write] (is [(Async Text) (Resolver Text)] + (async.async []))] (in (do async.monad [_ (async.future (do io.monad - [actor (/.spawn! (: (/.Behavior Any Any) - [/.#on_init (|>>) - /.#on_mail (function (_ message state self) - (do [! async.monad] - [outcome (message state self)] - (case outcome - {try.#Failure cause} - (do ! - [_ (async.future (write cause))] - (in outcome)) - - {try.#Success _} - (in outcome))))]) + [actor (/.spawn! (is (/.Behavior Any Any) + [/.#on_init (|>>) + /.#on_mail (function (_ message state self) + (do [! async.monad] + [outcome (message state self)] + (case outcome + {try.#Failure cause} + (do ! + [_ (async.future (write cause))] + (in outcome)) + + {try.#Success _} + (in outcome))))]) [])] (/.poison! actor))) _ (async.delay 100) @@ -133,9 +133,9 @@ {try.#Failure error} (exception.match? /.dead error))))) - (let [die! (: (/.Mail Nat) - (function (_ state actor) - (async#in (exception.except ..got_wrecked []))))] + (let [die! (is (/.Mail Nat) + (function (_ state actor) + (async#in (exception.except ..got_wrecked []))))] (in (do async.monad [result (async.future (do io.monad [actor (/.spawn! /.default initial_state) @@ -202,8 +202,8 @@ events (random.list num_events random.nat) num_observations (# ! each (n.% num_events) random.nat) .let [expected (list.first num_observations events) - sink (: (Atom (Sequence Nat)) - (atom.atom sequence.empty))]] + sink (is (Atom (Sequence Nat)) + (atom.atom sequence.empty))]] (in (do async.monad [agent (async.future (do [! io.monad] diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index faff80b79..7a61769b8 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -67,8 +67,8 @@ ($monad.spec ..injection ..comparison /.monad)) (in (do /.monad - [.let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] + [.let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] resolved? (/.future (resolver expected)) actual async] (_.cover' [/.Async /.Resolver /.async] @@ -134,8 +134,8 @@ (n.+ leftA rightA))))) (in (do /.monad [?actual (/.future (/.value (/.resolved expected))) - .let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] + .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] ?never (/.future (/.value async))] (_.cover' [/.value] (case [?actual ?never] @@ -146,8 +146,8 @@ false)))) (in (do /.monad [yep (/.future (/.resolved? (/.resolved expected))) - .let [[async resolver] (: [(/.Async Nat) (/.Resolver Nat)] - (/.async []))] + .let [[async resolver] (is [(/.Async Nat) (/.Resolver Nat)] + (/.async []))] nope (/.future (/.resolved? async))] (_.cover' [/.resolved?] (and yep @@ -163,8 +163,8 @@ _ false)))) (in (do /.monad - [.let [box (: (Atom Nat) - (atom.atom dummy))] + [.let [box (is (Atom Nat) + (atom.atom dummy))] _ (/.future (/.upon! (function (_ value) (atom.write! value box)) (/.resolved expected))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index c7b5922f3..7eb54cf9a 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -86,8 +86,8 @@ (_.cover [/.Channel /.Sink /.channel] (case (io.run! (do (try.with io.monad) - [.let [[channel sink] (: [(/.Channel Nat) (/.Sink Nat)] - (/.channel []))] + [.let [[channel sink] (is [(/.Channel Nat) (/.Sink Nat)] + (/.channel []))] _ (# sink feed sample) _ (# sink close)] (in channel))) @@ -107,8 +107,8 @@ (_.cover [/.channel_is_already_closed] (case (io.run! (do (try.with io.monad) - [.let [[channel sink] (: [(/.Channel Nat) (/.Sink Nat)] - (/.channel []))] + [.let [[channel sink] (is [(/.Channel Nat) (/.Sink Nat)] + (/.channel []))] _ (# sink close)] (# sink feed sample))) {try.#Success _} @@ -140,10 +140,10 @@ (list#= (list.only n.even? inputs) output)))) (in (do [! async.monad] - [.let [[?signal !signal] (: [(async.Async Any) (async.Resolver Any)] - (async.async [])) - sink (: (Atom (Sequence Nat)) - (atom.atom sequence.empty))] + [.let [[?signal !signal] (is [(async.Async Any) (async.Resolver Any)] + (async.async [])) + sink (is (Atom (Sequence Nat)) + (atom.atom sequence.empty))] _ (async.future (/.subscribe! (function (_ value) (do [! io.monad] [current (atom.read! sink) @@ -195,7 +195,7 @@ amount_of_polls (# ! each (|>> (n.% 10) ++) random.nat)] ($_ _.and (in (do [! async.monad] - [actual (..take_amount amount_of_polls (/.poll polling_delay (: (IO Nat) (io.io sample)))) + [actual (..take_amount amount_of_polls (/.poll polling_delay (is (IO Nat) (io.io sample)))) .let [correct_values! (list.every? (n.= sample) actual) diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 6514b1332..bcf401329 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -68,29 +68,29 @@ (_.cover [/.shift /.reset] (let [(open "_#[0]") /.monad (open "list#[0]") (list.equivalence n.equivalence) - visit (: (-> (List Nat) - (/.Cont (List Nat) (List Nat))) - (function (visit xs) - (case xs - {.#End} - (_#in {.#End}) + visit (is (-> (List Nat) + (/.Cont (List Nat) (List Nat))) + (function (visit xs) + (case xs + {.#End} + (_#in {.#End}) - {.#Item x xs'} - (do [! /.monad] - [output (/.shift (function (_ k) - (do ! - [tail (k xs')] - (in {.#Item x tail}))))] - (visit output)))))] + {.#Item x xs'} + (do [! /.monad] + [output (/.shift (function (_ k) + (do ! + [tail (k xs')] + (in {.#Item x tail}))))] + (visit output)))))] (list#= elems (/.result (/.reset (visit elems)))))) (_.cover [/.continued] (/.continued (same? sample) - (: (/.Cont Nat Bit) - (function (_ next) - (next sample))))) + (is (/.Cont Nat Bit) + (function (_ next) + (next sample))))) (_.cover [/.pending] (/.continued (same? sample) - (: (/.Cont Nat Bit) - (/.pending sample)))) + (is (/.Cont Nat Bit) + (/.pending sample)))) ))) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 9c778e7b2..ad9ef59fb 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -95,8 +95,8 @@ {try.#Success _} false {try.#Failure message} (text#= message (/.error ..an_exception []))) (case (/.with ..an_exception [] - (: (Try Nat) - (/.except ..another_exception []))) + (is (Try Nat) + (/.except ..another_exception []))) {try.#Success _} false diff --git a/stdlib/source/test/lux/control/function.lux b/stdlib/source/test/lux/control/function.lux index eed6c9635..b1e00106a 100644 --- a/stdlib/source/test/lux/control/function.lux +++ b/stdlib/source/test/lux/control/function.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [equivalence {"+" Equivalence}] - [monad {"+" do}] - [\\specification - ["$[0]" monoid]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]] - ["[0]" / "_" - ["[1][0]" contract] - ["[1][0]" memo] - ["[1][0]" mixin] - ["[1][0]" mutual] - ["[1][0]" inline]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [equivalence {"+" Equivalence}] + [monad {"+" do}] + [\\specification + ["$[0]" monoid]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]] + ["[0]" / "_" + ["[1][0]" contract] + ["[1][0]" memo] + ["[1][0]" mixin] + ["[1][0]" mutual] + ["[1][0]" inline]]) (def: .public test Test @@ -30,13 +30,13 @@ extra (|> random.nat (random.only (|>> (n.= expected) not)))] (<| (_.covering /._) ($_ _.and - (let [equivalence (: (Equivalence (-> Nat Nat)) - (implementation - (def: (= left right) - (n.= (left extra) - (right extra))))) - generator (: (Random (-> Nat Nat)) - (# ! each n.- random.nat))] + (let [equivalence (is (Equivalence (-> Nat Nat)) + (implementation + (def: (= left right) + (n.= (left extra) + (right extra))))) + generator (is (Random (-> Nat Nat)) + (# ! each n.- random.nat))] (_.for [/.monoid] ($monoid.spec equivalence /.monoid generator))) diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index b36688fbb..d1be1c598 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -105,13 +105,13 @@ (_.cover [/.memoization] (let [memo (<| //.fixed (//.mixed /.memoization) - (: (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) - (function (factorial delegate again input) - (case input - (^.or 0 1) (# state.monad in 1) - _ (do state.monad - [output' (again (-- input))] - (in (n.* input output'))))))) + (is (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) + (function (factorial delegate again input) + (case input + (^.or 0 1) (# state.monad in 1) + _ (do state.monad + [output' (again (-- input))] + (in (n.* input output'))))))) expected (|> (list.indices input) (list#each ++) (list#mix n.* 1)) diff --git a/stdlib/source/test/lux/control/function/mixin.lux b/stdlib/source/test/lux/control/function/mixin.lux index 7ec7c8c09..9dd982afd 100644 --- a/stdlib/source/test/lux/control/function/mixin.lux +++ b/stdlib/source/test/lux/control/function/mixin.lux @@ -30,16 +30,16 @@ [input (|> random.nat (# ! each (|>> (n.% 6) (n.+ 20)))) dummy random.nat shift (|> random.nat (random.only (|>> (n.= dummy) not))) - .let [equivalence (: (Equivalence (/.Mixin Nat Nat)) - (implementation - (def: (= left right) - (n.= ((/.fixed left) input) - ((/.fixed right) input))))) - generator (: (Random (/.Mixin Nat Nat)) - (do ! - [output random.nat] - (in (function (_ delegate again input) - output)))) + .let [equivalence (is (Equivalence (/.Mixin Nat Nat)) + (implementation + (def: (= left right) + (n.= ((/.fixed left) input) + ((/.fixed right) input))))) + generator (is (Random (/.Mixin Nat Nat)) + (do ! + [output random.nat] + (in (function (_ delegate again input) + output)))) expected (|> (list.indices input) (list#each ++) (list#mix n.* 1))]]) @@ -58,23 +58,23 @@ (n.= expected (factorial input)))) (_.cover [/.mixed] - (let [bottom (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (case input - (^.or 0 1) 1 - _ (delegate input)))) - multiplication (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (n.* input (again (-- input))))) + (let [bottom (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (case input + (^.or 0 1) 1 + _ (delegate input)))) + multiplication (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (n.* input (again (-- input))))) factorial (/.fixed (/.mixed bottom multiplication))] (n.= expected (factorial input)))) (_.cover [/.nothing] - (let [loop (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (case input - (^.or 0 1) 1 - _ (n.* input (delegate (-- input)))))) + (let [loop (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (case input + (^.or 0 1) 1 + _ (n.* input (delegate (-- input)))))) left (/.fixed (/.mixed /.nothing loop)) right (/.fixed (/.mixed loop /.nothing))] (and (n.= expected @@ -82,43 +82,43 @@ (n.= expected (right input))))) (_.cover [/.advice] - (let [bottom (: (/.Mixin Nat Nat) - (function (_ delegate again input) - 1)) - bottom? (: (Predicate Nat) - (function (_ input) - (case input - (^.or 0 1) true - _ false))) - multiplication (: (/.Mixin Nat Nat) - (function (_ delegate again input) - (n.* input (again (-- input))))) + (let [bottom (is (/.Mixin Nat Nat) + (function (_ delegate again input) + 1)) + bottom? (is (Predicate Nat) + (function (_ input) + (case input + (^.or 0 1) true + _ false))) + multiplication (is (/.Mixin Nat Nat) + (function (_ delegate again input) + (n.* input (again (-- input))))) factorial (/.fixed (/.mixed (/.advice bottom? bottom) multiplication))] (n.= expected (factorial input)))) (_.cover [/.before] - (let [implant (: (-> Nat (State Nat [])) - (function (_ input) - (function (_ state) - [shift []]))) - meld (: (/.Mixin Nat (State Nat Nat)) - (function (_ delegate again input) - (function (_ state) - [state (n.+ state input)]))) + (let [implant (is (-> Nat (State Nat [])) + (function (_ input) + (function (_ state) + [shift []]))) + meld (is (/.Mixin Nat (State Nat Nat)) + (function (_ delegate again input) + (function (_ state) + [state (n.+ state input)]))) function (/.fixed (/.mixed (/.before state.monad implant) meld))] (n.= (n.+ shift input) (|> input function (state.result dummy) product.right)))) (_.cover [/.after] - (let [implant (: (-> Nat Nat (State Nat [])) - (function (_ input output) - (function (_ state) - [shift []]))) - meld (: (/.Mixin Nat (State Nat Nat)) - (function (_ delegate again input) - (function (_ state) - [state (n.+ state input)]))) + (let [implant (is (-> Nat Nat (State Nat [])) + (function (_ input output) + (function (_ state) + [shift []]))) + meld (is (/.Mixin Nat (State Nat Nat)) + (function (_ delegate again input) + (function (_ state) + [state (n.+ state input)]))) function (/.fixed (/.mixed (/.after state.monad implant) meld))] (n.= (n.+ dummy input) diff --git a/stdlib/source/test/lux/control/lazy.lux b/stdlib/source/test/lux/control/lazy.lux index 8955a580d..1f1a9f0e1 100644 --- a/stdlib/source/test/lux/control/lazy.lux +++ b/stdlib/source/test/lux/control/lazy.lux @@ -33,9 +33,9 @@ (def: .public test Test - (with_expansions [<eager> (: [Nat Nat] - [(n.+ left right) - (n.* left right)])] + (with_expansions [<eager> (is [Nat Nat] + [(n.+ left right) + (n.* left right)])] (<| (_.covering /._) (do random.monad [left random.nat diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index 9563e44ce..665577be9 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -66,8 +66,8 @@ value random.nat] (_.cover [/.else] (and (same? default (/.else default - (: (Maybe Nat) - {.#None}))) + (is (Maybe Nat) + {.#None}))) (same? value (/.else default {.#Some value}))))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index 02da11358..8941a8137 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -271,8 +271,8 @@ (/.either <code>.nat (<code>.tuple self)))) level_0 (code.nat expected) - level_up (: (-> Code Code) - (|>> list code.tuple))] + level_up (is (-> Code Code) + (|>> list code.tuple))] (and (|> (list level_0) (/.result parser) (match actual (n.= expected actual))) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 00ff979d9..330349078 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -99,19 +99,19 @@ (random.list size again))] ($_ random.and ..random_location - (: (Random (Code' (Ann Location))) - ($_ random.or - random.bit - random.nat - random.int - random.rev - random.safe_frac - ..random_text - ..random_symbol - random_sequence - random_sequence - random_sequence - ))))))) + (is (Random (Code' (Ann Location))) + ($_ random.or + random.bit + random.nat + random.int + random.rev + random.safe_frac + ..random_text + ..random_symbol + random_sequence + random_sequence + random_sequence + ))))))) (def: random_type (Random Type) @@ -282,8 +282,8 @@ (_.cover [/.or format.or] (|> expected (format.result (format.or format.bit format.nat)) - (/.result (: (/.Parser (Either Bit Nat)) - (/.or /.bit /.nat))) + (/.result (is (/.Parser (Either Bit Nat)) + (/.or /.bit /.nat))) (!expect (^.multi {try.#Success actual} (# (sum.equivalence bit.equivalence n.equivalence) = expected @@ -296,8 +296,8 @@ (_.cover [/.invalid_tag] (|> [tag value] (format.result (format.and format.bits/8 format.bit)) - (/.result (: (/.Parser (Either Bit Nat)) - (/.or /.bit /.nat))) + (/.result (is (/.Parser (Either Bit Nat)) + (/.or /.bit /.nat))) (!expect (^.multi {try.#Failure error} (exception.match? /.invalid_tag error)))))) (do [! random.monad] @@ -306,12 +306,12 @@ (|> expected (format.result (format.rec (|>> (format.and format.nat) (format.or format.any)))) - (/.result (: (/.Parser (List Nat)) - (/.rec - (function (_ again) - (/.or /.any - (<>.and /.nat - again)))))) + (/.result (is (/.Parser (List Nat)) + (/.rec + (function (_ again) + (/.or /.any + (<>.and /.nat + again)))))) (!expect (^.multi {try.#Success actual} (# (list.equivalence n.equivalence) = expected diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 0a3bf5945..93020e506 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -153,19 +153,19 @@ {.#Parameter 0}) (!expect {try.#Success [quantification##binding argument##binding _]}))) (_.cover [/.argument] - (let [argument? (: (-> Nat Nat Bit) - (function (_ @ expected) - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.with_extension quantification) - (/.with_extension argument) - (do //.monad - [env /.env - _ /.any] - (in (/.argument env @)))) - not_parameter) - (!expect (^.multi {try.#Success [_ _ _ _ actual]} - (n.= expected actual))))))] + (let [argument? (is (-> Nat Nat Bit) + (function (_ @ expected) + (|> (/.result (<| (/.with_extension quantification) + (/.with_extension argument) + (/.with_extension quantification) + (/.with_extension argument) + (do //.monad + [env /.env + _ /.any] + (in (/.argument env @)))) + not_parameter) + (!expect (^.multi {try.#Success [_ _ _ _ actual]} + (n.= expected actual))))))] (and (argument? 0 2) (argument? 1 3) (argument? 2 0)))) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 40582948d..c3acb66ba 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -147,9 +147,9 @@ (/.attribute [expected expected])) {xml.#Text expected}]]) (do [! random.monad] - [.let [node (: (-> xml.Tag (List xml.XML) xml.XML) - (function (_ tag children) - {xml.#Node tag (dictionary.empty symbol.hash) children}))] + [.let [node (is (-> xml.Tag (List xml.XML) xml.XML) + (function (_ tag children) + {xml.#Node tag (dictionary.empty symbol.hash) children}))] parent ..random_tag right ..random_tag wrong (random.only (|>> (symbol#= right) not) diff --git a/stdlib/source/test/lux/control/reader.lux b/stdlib/source/test/lux/control/reader.lux index 7b2c8e43f..c20b2acbe 100644 --- a/stdlib/source/test/lux/control/reader.lux +++ b/stdlib/source/test/lux/control/reader.lux @@ -50,11 +50,11 @@ (/.result sample (/.local (n.* factor) /.read)))) (let [(open "io#[0]") io.monad] (_.cover [/.with /.lifted] - (|> (: (/.Reader Any (IO Nat)) - (do (/.with io.monad) - [a (/.lifted (io#in sample)) - b (in factor)] - (in (n.* b a)))) + (|> (is (/.Reader Any (IO Nat)) + (do (/.with io.monad) + [a (/.lifted (io#in sample)) + b (in factor)] + (in (n.* b a)))) (/.result []) io.run! (n.= (n.* factor sample))))))))) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index e4492b7f4..3cd12740a 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - [type {"+" :sharing}] - ["_" test {"+" Test}] - [abstract - [equivalence {"+" Equivalence}] - [functor {"+" Functor}] - [apply {"+" Apply}] - ["[0]" monad {"+" Monad do}] - ["[0]" enum] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [control - ["[0]" try {"+" Try}]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Region} - [// - ["[0]" thread {"+" Thread}] - ["[0]" exception {"+" Exception exception:}]]]]) + [library + [lux "*" + [type {"+" sharing}] + ["_" test {"+" Test}] + [abstract + [equivalence {"+" Equivalence}] + [functor {"+" Functor}] + [apply {"+" Apply}] + ["[0]" monad {"+" Monad do}] + ["[0]" enum] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [control + ["[0]" try {"+" Try}]] + [data + [collection + ["[0]" list]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Region} + [// + ["[0]" thread {"+" Thread}] + ["[0]" exception {"+" Exception exception:}]]]]) (exception: oops) @@ -58,18 +58,18 @@ (def: comparison (Comparison (All (_ a) (All (_ ! r) (Region r (Thread !) a)))) (function (_ == left right) - (case [(:sharing [a] - (Equivalence a) - == - - (Try a) - (thread.result (:expected (/.run! thread.monad left)))) - (:sharing [a] - (Equivalence a) - == - - (Try a) - (thread.result (:expected (/.run! thread.monad right))))] + (case [(sharing [a] + (Equivalence a) + == + + (Try a) + (thread.result (as_expected (/.run! thread.monad left)))) + (sharing [a] + (Equivalence a) + == + + (Try a) + (thread.result (as_expected (/.run! thread.monad right))))] [{try.#Success left} {try.#Success right}] (== left right) @@ -84,17 +84,17 @@ [expected_clean_ups (|> random.nat (# ! each (|>> (n.% 100) (n.max 1))))] ($_ _.and (_.for [/.functor] - ($functor.spec ..injection ..comparison (: (All (_ ! r) - (Functor (Region r (thread.Thread !)))) - (/.functor thread.functor)))) + ($functor.spec ..injection ..comparison (is (All (_ ! r) + (Functor (Region r (thread.Thread !)))) + (/.functor thread.functor)))) (_.for [/.apply] - ($apply.spec ..injection ..comparison (: (All (_ ! r) - (Apply (Region r (thread.Thread !)))) - (/.apply thread.monad)))) + ($apply.spec ..injection ..comparison (is (All (_ ! r) + (Apply (Region r (thread.Thread !)))) + (/.apply thread.monad)))) (_.for [/.monad] - ($monad.spec ..injection ..comparison (: (All (_ ! r) - (Monad (Region r (thread.Thread !)))) - (/.monad thread.monad)))) + ($monad.spec ..injection ..comparison (is (All (_ ! r) + (Monad (Region r (thread.Thread !)))) + (/.monad thread.monad)))) (_.cover [/.run!] (thread.result @@ -160,8 +160,8 @@ count_clean_up (function (_ value) (do ! [_ (thread.update! ++ clean_up_counter)] - (in (: (Try Any) - (exception.except ..oops [])))))] + (in (is (Try Any) + (exception.except ..oops [])))))] outcome (/.run! ! (do [! (/.monad !)] [_ (monad.each ! (/.acquire! //@ count_clean_up) diff --git a/stdlib/source/test/lux/control/security/policy.lux b/stdlib/source/test/lux/control/security/policy.lux index 6ced1e85c..6d72ff177 100644 --- a/stdlib/source/test/lux/control/security/policy.lux +++ b/stdlib/source/test/lux/control/security/policy.lux @@ -37,37 +37,37 @@ (type: (Policy %) (Interface - (: (Hash (Password %)) - &hash) + (is (Hash (Password %)) + &hash) - (: (-> Text (Password %)) - password) + (is (-> Text (Password %)) + password) - (: (Privilege Privacy %) - privilege))) + (is (Privilege Privacy %) + privilege))) (def: (policy _) (Ex (_ %) (-> Any (Policy %))) (/.with_policy - (: (Context Privacy Policy) - (function (_ (^.let privilege (open "%[0]"))) - (implementation - (def: &hash - (implementation - (def: &equivalence - (implementation - (def: (= reference sample) - (text#= (%#can_downgrade reference) - (%#can_downgrade sample))))) - (def: hash - (|>> %#can_downgrade - (# text.hash hash))))) - - (def: password - %#can_upgrade) + (is (Context Privacy Policy) + (function (_ (^.let privilege (open "%[0]"))) + (implementation + (def: &hash + (implementation + (def: &equivalence + (implementation + (def: (= reference sample) + (text#= (%#can_downgrade reference) + (%#can_downgrade sample))))) + (def: hash + (|>> %#can_downgrade + (# text.hash hash))))) + + (def: password + %#can_upgrade) - (def: privilege - privilege)))))) + (def: privilege + privilege)))))) (def: .public test Test diff --git a/stdlib/source/test/lux/control/state.lux b/stdlib/source/test/lux/control/state.lux index 9cc2cac76..f7e7161be 100644 --- a/stdlib/source/test/lux/control/state.lux +++ b/stdlib/source/test/lux/control/state.lux @@ -108,11 +108,11 @@ right random.nat] (let [(open "io#[0]") io.monad] (_.cover [/.+State /.with /.lifted /.result'] - (|> (: (/.+State io.IO Nat Nat) - (do (/.with io.monad) - [a (/.lifted io.monad (io#in left)) - b (in right)] - (in (n.+ a b)))) + (|> (is (/.+State io.IO Nat Nat) + (do (/.with io.monad) + [a (/.lifted io.monad (io#in left)) + b (in right)] + (in (n.+ a b)))) (/.result' state) io.run! (pipe.let [state' output'] diff --git a/stdlib/source/test/lux/control/thread.lux b/stdlib/source/test/lux/control/thread.lux index 7e6468a8c..5da8a5e95 100644 --- a/stdlib/source/test/lux/control/thread.lux +++ b/stdlib/source/test/lux/control/thread.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" functor {"+" Injection Comparison}] - ["$[0]" apply] - ["$[0]" monad]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" / {"+" Thread} - [// - ["[0]" io]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" functor {"+" Injection Comparison}] + ["$[0]" apply] + ["$[0]" monad]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" / {"+" Thread} + [// + ["[0]" io]]]]) (def: (injection value) (Injection (All (_ a !) (Thread ! a))) @@ -59,24 +59,24 @@ ($_ _.and (_.cover [/.read!] (n.= sample - (/.result (: (All (_ !) (Thread ! Nat)) - (do /.monad - [box (/.box sample)] - (/.read! box)))))) + (/.result (is (All (_ !) (Thread ! Nat)) + (do /.monad + [box (/.box sample)] + (/.read! box)))))) (_.cover [/.write!] (n.= factor - (/.result (: (All (_ !) (Thread ! Nat)) - (do /.monad - [box (/.box sample) - _ (/.write! factor box)] - (/.read! box)))))) + (/.result (is (All (_ !) (Thread ! Nat)) + (do /.monad + [box (/.box sample) + _ (/.write! factor box)] + (/.read! box)))))) (_.cover [/.update!] (n.= (n.* factor sample) - (/.result (: (All (_ !) (Thread ! Nat)) - (do /.monad - [box (/.box sample) - old (/.update! (n.* factor) box)] - (/.read! box)))))))) + (/.result (is (All (_ !) (Thread ! Nat)) + (do /.monad + [box (/.box sample) + old (/.update! (n.* factor) box)] + (/.read! box)))))))) )))) diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index a606da407..aeb49df81 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -68,7 +68,7 @@ false)) (_.cover [/.maybe] (case [(/.maybe {/.#Success expected}) - (/.maybe (: (/.Try Nat) {/.#Failure error}))] + (/.maybe (is (/.Try Nat) {/.#Failure error}))] [{.#Some actual} {.#None}] (n.= expected actual) @@ -78,7 +78,7 @@ (and (n.= expected (/.else alternative {/.#Success expected})) (n.= alternative - (/.else alternative (: (Try Nat) {/.#Failure error}))))) + (/.else alternative (is (Try Nat) {/.#Failure error}))))) (_.cover [/.with /.lifted] (let [lifted (/.lifted io.monad)] (|> (do (/.with io.monad) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index 631a72b76..07ec343ce 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -24,10 +24,10 @@ ... TODO: Get rid of this ASAP (template: (!bundle body) - [(: Test - (do random.monad - [_ (in [])] - body))]) + [(is Test + (do random.monad + [_ (in [])] + body))]) (def: format Test diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index d179058fd..650ee562a 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -121,10 +121,10 @@ [3 !.bytes/8 !.with/8!])) (_.cover [!.slice] (let [random_slice (!.slice offset length sample) - idxs (: (List Nat) - (case length - 0 (list) - _ (enum.range n.enum 0 (-- length)))) + idxs (is (List Nat) + (case length + 0 (list) + _ (enum.range n.enum 0 (-- length)))) reader (function (_ binary idx) (!.bytes/1 idx binary))] (and (n.= length (!.size random_slice)) @@ -182,10 +182,10 @@ (..binary_io 3 /.read/64! /.write/64! value)))) (_.cover [/.slice] (let [random_slice (try.trusted (/.slice offset length sample)) - idxs (: (List Nat) - (case length - 0 (list) - _ (enum.range n.enum 0 (-- length)))) + idxs (is (List Nat) + (case length + 0 (list) + _ (enum.range n.enum 0 (-- length)))) reader (function (_ binary idx) (/.read/8! idx binary))] (and (n.= length (/.size random_slice)) diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index b41a178d2..1d0d95f34 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -63,11 +63,11 @@ evens (random.array size (random.only n.even? random.nat))] ($_ _.and (let [(open "/#[0]") /.functor - choose (: (-> Nat (Maybe Text)) - (function (_ value) - (if (n.even? value) - {.#Some (# n.decimal encoded value)} - {.#None})))] + choose (is (-> Nat (Maybe Text)) + (function (_ value) + (if (n.even? value) + {.#Some (# n.decimal encoded value)} + {.#None})))] (_.cover [/.one] (case [(|> evens (/#each (# n.decimal encoded)) @@ -144,16 +144,16 @@ (!.each $ it)))) (_.for [!.mix] ($mix.spec ..injection /.equivalence - (: (Mix !.Array) - (function (_ $ init it) - (!.mix (function (_ index item output) - ($ item output)) - init - it))))) + (is (Mix !.Array) + (function (_ $ init it) + (!.mix (function (_ index item output) + ($ item output)) + init + it))))) (_.cover [!.empty !.size] - (n.= size (!.size (: (Array Nat) - (!.empty size))))) + (n.= size (!.size (is (Array Nat) + (!.empty size))))) (_.cover [!.type] (case !.Array (pattern (<| {.#Named (symbol !.Array)} @@ -165,44 +165,44 @@ false)) (_.cover [!.lacks?] (let [the_array (|> (!.empty 2) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 expected))] (and (not (!.lacks? 0 the_array)) (!.lacks? 1 the_array)))) (_.cover [!.item !.has!] (|> (!.empty 2) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 expected) (!.item 0) (n.= expected))) (_.cover [!.lacks!] (|> (!.empty 1) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 expected) (!.lacks! 0) (!.lacks? 0))) (_.cover [!.lacks?] (let [the_array (|> (!.empty 2) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 expected))] (and (not (!.lacks? 0 the_array)) (!.lacks? 1 the_array)))) (_.cover [!.has?] (let [the_array (|> (!.empty 2) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 expected))] (and (!.has? 0 the_array) (not (!.has? 1 the_array))))) (_.cover [!.revised!] (|> (!.empty 1) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 base) (!.revised! 0 (n.+ shift)) (!.item 0) (n.= expected))) (_.cover [!.upsert!] (let [the_array (|> (!.empty 2) - (: (Array Nat)) + (is (Array Nat)) (!.has! 0 base) (!.upsert! 0 dummy (n.+ shift)) (!.upsert! 1 base (n.+ shift)))] @@ -211,8 +211,8 @@ (do ! [occupancy (# ! each (n.% (++ size)) random.nat)] (_.cover [!.occupancy !.vacancy] - (let [the_array (loop [output (: (Array Nat) - (!.empty size)) + (let [the_array (loop [output (is (Array Nat) + (!.empty size)) idx 0] (if (n.< occupancy idx) (again (!.has! idx expected output) @@ -243,8 +243,8 @@ (do ! [amount (# ! each (n.% (++ size)) random.nat)] (_.cover [!.copy!] - (let [copy (: (Array Nat) - (!.empty size))] + (let [copy (is (Array Nat) + (!.empty size))] (exec (!.copy! amount 0 the_array 0 copy) (# (list.equivalence n.equivalence) = (list.first amount (!.list {.#None} the_array)) @@ -263,11 +263,11 @@ (|> the_array (!.list {.#None}) (# (list.equivalence n.equivalence) = evens)))))) - (let [choose (: (-> Nat (Maybe Text)) - (function (_ value) - (if (n.even? value) - {.#Some (# n.decimal encoded value)} - {.#None})))] + (let [choose (is (-> Nat (Maybe Text)) + (function (_ value) + (if (n.even? value) + {.#Some (# n.decimal encoded value)} + {.#None})))] (_.cover [!.one] (|> evens (!.one choose) @@ -320,8 +320,8 @@ ..search (_.cover [/.empty /.size] - (n.= size (/.size (: (Array Nat) - (/.empty size))))) + (n.= size (/.size (is (Array Nat) + (/.empty size))))) (_.cover [/.type_name] (case /.Array (pattern (<| {.#Named (symbol /.Array)} @@ -334,7 +334,7 @@ false)) (_.cover [/.read! /.write!] (let [the_array (|> (/.empty 2) - (: (Array Nat)) + (is (Array Nat)) (/.write! 0 expected))] (case [(/.read! 0 the_array) (/.read! 1 the_array)] @@ -345,7 +345,7 @@ false))) (_.cover [/.delete!] (let [the_array (|> (/.empty 1) - (: (Array Nat)) + (is (Array Nat)) (/.write! 0 expected))] (case [(/.read! 0 the_array) (/.read! 0 (/.delete! 0 the_array))] @@ -356,19 +356,19 @@ false))) (_.cover [/.lacks?] (let [the_array (|> (/.empty 2) - (: (Array Nat)) + (is (Array Nat)) (/.write! 0 expected))] (and (not (/.lacks? 0 the_array)) (/.lacks? 1 the_array)))) (_.cover [/.contains?] (let [the_array (|> (/.empty 2) - (: (Array Nat)) + (is (Array Nat)) (/.write! 0 expected))] (and (/.contains? 0 the_array) (not (/.contains? 1 the_array))))) (_.cover [/.update!] (let [the_array (|> (/.empty 1) - (: (Array Nat)) + (is (Array Nat)) (/.write! 0 base) (/.update! 0 (n.+ shift)))] (case (/.read! 0 the_array) @@ -379,7 +379,7 @@ false))) (_.cover [/.upsert!] (let [the_array (|> (/.empty 2) - (: (Array Nat)) + (is (Array Nat)) (/.write! 0 base) (/.upsert! 0 dummy (n.+ shift)) (/.upsert! 1 base (n.+ shift)))] @@ -394,8 +394,8 @@ (do ! [occupancy (# ! each (n.% (++ size)) random.nat)] (_.cover [/.occupancy /.vacancy] - (let [the_array (loop [output (: (Array Nat) - (/.empty size)) + (let [the_array (loop [output (is (Array Nat) + (/.empty size)) idx 0] (if (n.< occupancy idx) (again (/.write! idx expected output) @@ -426,8 +426,8 @@ (do ! [amount (# ! each (n.% (++ size)) random.nat)] (_.cover [/.copy!] - (let [copy (: (Array Nat) - (/.empty size))] + (let [copy (is (Array Nat) + (/.empty size))] (exec (/.copy! amount 0 the_array 0 copy) (# (list.equivalence n.equivalence) = (list.first amount (/.list {.#None} the_array)) diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 1054e5248..0a1f9d295 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -54,11 +54,11 @@ (do ! [constant random.nat - .let [hash (: (Hash Nat) - (implementation - (def: &equivalence n.equivalence) - (def: (hash _) - constant)))]] + .let [hash (is (Hash Nat) + (implementation + (def: &equivalence n.equivalence) + (def: (hash _) + constant)))]] (_.cover [/.key_hash] (same? hash (/.key_hash (/.empty hash))))) diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 3e628ec45..c20a3b480 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -57,10 +57,10 @@ (n.< left right)) pairs) sorted_values (list#each product.right sorted_pairs) - (open "list#[0]") (list.equivalence (: (Equivalence [Nat Nat]) - (function (_ [kr vr] [ks vs]) - (and (n.= kr ks) - (n.= vr vs))))) + (open "list#[0]") (list.equivalence (is (Equivalence [Nat Nat]) + (function (_ [kr vr] [ks vs]) + (and (n.= kr ks) + (n.= vr vs))))) (open "/#[0]") (/.equivalence n.equivalence)]] ($_ _.and (_.for [/.equivalence] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 88ce2f5b9..c1440d110 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -281,12 +281,12 @@ (open "/#[0]") /.functor (open "/#[0]") /.monoid - +/2 (: (-> Nat Nat Nat) - (function (_ left right) - ($_ n.+ left right))) - +/3 (: (-> Nat Nat Nat Nat) - (function (_ left mid right) - ($_ n.+ left mid right)))] + +/2 (is (-> Nat Nat Nat) + (function (_ left right) + ($_ n.+ left right))) + +/3 (is (-> Nat Nat Nat Nat) + (function (_ left mid right) + ($_ n.+ left mid right)))] (do [! random.monad] [sample/0 ..random sample/1 ..random @@ -374,11 +374,11 @@ Test (let [(open "/#[0]") /.functor - choice (: (-> Nat (Maybe Text)) - (function (_ value) - (if (n.even? value) - {.#Some (# n.decimal encoded value)} - {.#None})))] + choice (is (-> Nat (Maybe Text)) + (function (_ value) + (if (n.even? value) + {.#Some (# n.decimal encoded value)} + {.#None})))] (do [! random.monad] [sample ..random] ($_ _.and diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 125dfaac9..34e1b13c2 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -116,14 +116,14 @@ (and (/.within_bounds? sample good_index) (not (/.within_bounds? sample bad_index)))) (_.cover [/.index_out_of_bounds] - (let [fails! (: (All (_ a) (-> (Try a) Bit)) - (function (_ situation) - (case situation - {try.#Success member} - false - - {try.#Failure error} - (exception.match? /.index_out_of_bounds error))))] + (let [fails! (is (All (_ a) (-> (Try a) Bit)) + (function (_ situation) + (case situation + {try.#Success member} + false + + {try.#Failure error} + (exception.match? /.index_out_of_bounds error))))] (and (fails! (/.item bad_index sample)) (fails! (/.has bad_index non_member sample)) (fails! (/.revised bad_index ++ sample))))) @@ -195,11 +195,11 @@ (/.size negatives)))))) (_.cover [/.one] (let [(open "/#[0]") /.functor - choice (: (-> Nat (Maybe Text)) - (function (_ value) - (if (n.even? value) - {.#Some (# n.decimal encoded value)} - {.#None})))] + choice (is (-> Nat (Maybe Text)) + (function (_ value) + (if (n.even? value) + {.#Some (# n.decimal encoded value)} + {.#None})))] (case [(|> sample (/.only n.even?) (/#each (# n.decimal encoded)) diff --git a/stdlib/source/test/lux/data/collection/set.lux b/stdlib/source/test/lux/data/collection/set.lux index dee48cc02..0d6f31475 100644 --- a/stdlib/source/test/lux/data/collection/set.lux +++ b/stdlib/source/test/lux/data/collection/set.lux @@ -1,24 +1,24 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [hash {"+" Hash}] - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] - [data - ["[0]" bit ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / ("#[0]" equivalence)]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [hash {"+" Hash}] + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash] + ["$[0]" monoid]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / ("#[0]" equivalence)]]) (def: gen_nat (Random Nat) @@ -53,12 +53,12 @@ (/.empty? (/.empty n.hash))) (do ! [hash (# ! each (function (_ constant) - (: (Hash Nat) - (implementation - (def: &equivalence n.equivalence) - - (def: (hash _) - constant)))) + (is (Hash Nat) + (implementation + (def: &equivalence n.equivalence) + + (def: (hash _) + constant)))) random.nat)] (_.cover [/.member_hash] (same? hash (/.member_hash (/.empty hash))))) diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index 804bed4bb..06c77591e 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" maybe ("[1]#[0]" functor)]] - [data - ["[0]" text ("[1]#[0]" equivalence monoid)] - [collection - ["[0]" list ("[1]#[0]" mix)]]] - [math - ["[0]" random] - [number - ["n" nat]]] - [type {"+" :by_example}]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" maybe ("[1]#[0]" functor)]] + [data + ["[0]" text ("[1]#[0]" equivalence monoid)] + [collection + ["[0]" list ("[1]#[0]" mix)]]] + [math + ["[0]" random] + [number + ["n" nat]]] + [type {"+" by_example}]]] + [\\library + ["[0]" /]]) (def: builder (/.builder text.monoid)) (def: :@: - (:by_example [@] - (/.Builder @ Text) - ..builder - - @)) + (by_example [@] + (/.Builder @ Text) + ..builder + + @)) (def: .public test Test diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 055c76259..e7be0c11e 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [data - [collection - ["[0]" list] - ["[0]" set]]] - [macro - ["[0]" template]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" / - ["/[1]" //]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [data + [collection + ["[0]" list] + ["[0]" set]]] + [macro + ["[0]" template]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" / + ["/[1]" //]]]) (with_expansions [<colors> (as_is [letter/a [/.alice_blue @@ -202,9 +202,9 @@ )] (def: all_colors (list.together (`` (list (~~ (template [<definition> <by_letter>] - [((: (-> Any (List //.Color)) - (function (_ _) - (`` (list (~~ (template.spliced <by_letter>)))))) + [((is (-> Any (List //.Color)) + (function (_ _) + (`` (list (~~ (template.spliced <by_letter>)))))) 123)] <colors>)))))) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index f09796461..d38efe7ec 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -205,8 +205,8 @@ (<b>.result /.parser))] (in (case (sequence.list tar) (pattern (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]})) - (let [seconds (: (-> Instant Int) - (|>> instant.relative (duration.ticks duration.second)))] + (let [seconds (is (-> Instant Int) + (|>> instant.relative (duration.ticks duration.second)))] (and (text#= (/.from_path expected_path) (/.from_path actual_path)) (i.= (seconds expected_moment) diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index 6dc6eeb9e..6d9e6cc5e 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -38,32 +38,32 @@ (_.cover [/.left] (|> (/.left expected) - (: (Or Nat Nat)) + (is (Or Nat Nat)) (pipe.case {0 #0 actual} (n.= expected actual) _ false))) (_.cover [/.right] (|> (/.right expected) - (: (Or Nat Nat)) + (is (Or Nat Nat)) (pipe.case {0 #1 actual} (n.= expected actual) _ false))) (_.cover [/.either] (and (|> (/.left expected) - (: (Or Nat Nat)) + (is (Or Nat Nat)) (/.either (n.+ shift) (n.- shift)) (n.= (n.+ shift expected))) (|> (/.right expected) - (: (Or Nat Nat)) + (is (Or Nat Nat)) (/.either (n.+ shift) (n.- shift)) (n.= (n.- shift expected))))) (_.cover [/.then] (and (|> (/.left expected) - (: (Or Nat Nat)) + (is (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) (pipe.case {0 #0 actual} (n.= (n.+ shift expected) actual) _ false)) (|> (/.right expected) - (: (Or Nat Nat)) + (is (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) (pipe.case {0 #1 actual} (n.= (n.- shift expected) actual) _ false)))) (do ! @@ -71,8 +71,8 @@ expected (random.list size random.nat)] ($_ _.and (_.cover [/.lefts] - (let [actual (: (List (Or Nat Nat)) - (list#each /.left expected))] + (let [actual (is (List (Or Nat Nat)) + (list#each /.left expected))] (and (# (list.equivalence n.equivalence) = expected (/.lefts actual)) @@ -80,8 +80,8 @@ (list) (/.rights actual))))) (_.cover [/.rights] - (let [actual (: (List (Or Nat Nat)) - (list#each /.right expected))] + (let [actual (is (List (Or Nat Nat)) + (list#each /.right expected))] (and (# (list.equivalence n.equivalence) = expected (/.rights actual)) @@ -94,7 +94,7 @@ (if (n.even? value) (/.left value) (/.right value)))) - (: (List (Or Nat Nat))) + (is (List (Or Nat Nat))) /.partition)] (and (# (list.equivalence n.equivalence) = (list.only n.even? expected) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index c848511a9..c8410b813 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -1,29 +1,29 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" codec]]] - [control - ["[0]" maybe] - ["[0]" try]] - [data - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" list ("[1]#[0]" mix)] - ["[0]" set]]] - [macro - ["[0]" template]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]] - ["[0]" / "_" - ["[1][0]" utf8]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" codec]]] + [control + ["[0]" maybe] + ["[0]" try]] + [data + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" list ("[1]#[0]" mix)] + ["[0]" set]]] + [macro + ["[0]" template]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]] + ["[0]" / "_" + ["[1][0]" utf8]]) (with_expansions [<encodings> (as_is [all/a [/.ascii]] @@ -183,9 +183,9 @@ /.koi8_u]] ) <named> (template [<definition> <by_letter>] - [((: (-> Any (List /.Encoding)) - (function (_ _) - (`` (list (~~ (template.spliced <by_letter>)))))) + [((is (-> Any (List /.Encoding)) + (function (_ _) + (`` (list (~~ (template.spliced <by_letter>)))))) [])] <encodings>)] diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index fa2ef3756..b54ec0d9c 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -1,26 +1,26 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] - [data - ["[0]" text] - [collection - ["[0]" set] - ["[0]" list]]] - [macro - ["[0]" template]] - [math - ["[0]" random {"+" Random}] - [number {"+" hex} - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash] + ["$[0]" monoid]]] + [data + ["[0]" text] + [collection + ["[0]" set] + ["[0]" list]]] + [macro + ["[0]" template]] + [math + ["[0]" random {"+" Random}] + [number {"+" hex} + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public random (Random /.Block) @@ -147,9 +147,9 @@ /.basic_latin/lower]] ) <named> (template [<definition> <part>] - [((: (-> Any (List /.Block)) - (function (_ _) - (`` (list (~~ (template.spliced <part>)))))) + [((is (-> Any (List /.Block)) + (function (_ _) + (`` (list (~~ (template.spliced <part>)))))) [])] <blocks>)] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 9f619b3c0..fdf83aaa7 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -90,7 +90,7 @@ ... TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants ... (~~ (template [<lefts> <right?> <value> <format>] ... [(|> (/.representation (type (Or Bit Int Frac)) - ... (: (Or Bit Int Frac) + ... (is (Or Bit Int Frac) ... (<lefts> <right?> <value>))) ... (try#each (text#= (format "(" (%.nat <lefts>) ... " " (%.bit <right?>) @@ -171,11 +171,11 @@ (|> (/.representation .Any sample_frac) (try#each (text#= "[]")) (try.else false)) - (|> (/.representation (type (List Nat)) (: (List Nat) (list sample_nat))) + (|> (/.representation (type (List Nat)) (is (List Nat) (list sample_nat))) (try#each (text#= (%.list %.nat (list sample_nat)))) (try.else false)) (~~ (template [<sample>] - [(|> (/.representation (type (Maybe Nat)) (: (Maybe Nat) <sample>)) + [(|> (/.representation (type (Maybe Nat)) (is (Maybe Nat) <sample>)) (try#each (text#= (%.maybe %.nat <sample>))) (try.else false))] @@ -209,7 +209,7 @@ [%.text sample_text] )) (text#= (|> (list sample_bit sample_int sample_frac sample_text) - (: (List Any)) + (is (List Any)) (list#each /.inspection) (text.interposed " ") (text.enclosed ["[" "]"])) @@ -236,8 +236,8 @@ ($_ _.and ..inspection ..representation - (_.cover [/.:hole /.type_hole] - (let [error (: My_Text (..macro_error (/.:hole)))] + (_.cover [/.hole /.type_hole] + (let [error (is My_Text (..macro_error (/.hole)))] (and (exception.match? /.type_hole error) (text.contains? (%.type My_Text) error)))) (do random.monad @@ -257,8 +257,8 @@ (..macro_error (/.here yolo)))) (_.cover [/.private] (exec - (: (/.private /.Inspector) - /.inspection) + (is (/.private /.Inspector) + /.inspection) true)) (_.cover [/.log!] (exec diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux index 2a30d0464..e015ea5e8 100644 --- a/stdlib/source/test/lux/ffi.js.lux +++ b/stdlib/source/test/lux/ffi.js.lux @@ -52,8 +52,8 @@ number (# ! each (|>> (nat.% 100) nat.frac) random.nat) string (random.ascii 5) function (# ! each (function (_ shift) - (: (-> Nat Nat) - (nat.+ shift))) + (is (-> Nat Nat) + (nat.+ shift))) random.nat) ... I64s get compiled as JavaScript objects with a specific structure. object random.nat] @@ -62,7 +62,7 @@ (~~ (template [<type> <value>] [(_.cover [<type>] (exec - (: <type> <value>) + (is <type> <value>) true))] [/.Boolean boolean] @@ -74,9 +74,9 @@ (~~ (template [<type>] [(_.cover [<type>] (exec - (: (Ex (_ a) (/.Object a)) - (: <type> - (:expected []))) + (is (Ex (_ a) (/.Object a)) + (is <type> + (as_expected []))) true))] [/.Function] @@ -87,9 +87,9 @@ )) (_.cover [/.null] (exec - (: Nat (/.null [])) - (: Text (/.null [])) - (: (All (_ a) (-> a a)) (/.null [])) + (is Nat (/.null [])) + (is Text (/.null [])) + (is (All (_ a) (-> a a)) (/.null [])) true)) (_.cover [/.null?] (and (/.null? (/.null [])) @@ -129,9 +129,9 @@ (let [encoding "utf8"] (text#= string (cond /.on_nashorn? - (let [binary (java/lang/String::getBytes encoding (:as java/lang/String string))] + (let [binary (java/lang/String::getBytes encoding (as java/lang/String string))] (|> (java/lang/String::new binary encoding) - (:as Text))) + (as Text))) /.on_node_js? (|> (Buffer::from string encoding) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 0cc809a70..cab7732cb 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -58,8 +58,8 @@ (template [<name> <type> <conversion> <lux> <=>] [(def: (<name> left right) (-> <type> <type> Bit) - (<=> (:as <lux> (<conversion> left)) - (:as <lux> (<conversion> right))))] + (<=> (as <lux> (<conversion> left)) + (as <lux> (<conversion> right))))] [boolean#= /.Boolean <| Bit bit#=] [byte#= /.Byte /.byte_to_long Int i#=] @@ -136,8 +136,8 @@ /.of_long (i.= (/.of_long value)))) (_.cover [/.cannot_convert_to_jvm_type] - (let [array (:as (Array Nothing) - (array.empty 1))] + (let [array (as (Array Nothing) + (array.empty 1))] (|> array /.length ..macro_error @@ -146,7 +146,7 @@ (def: for_miscellaneous Test (`` (do [! random.monad] - [sample (# ! each (|>> (:as java/lang/Object)) + [sample (# ! each (|>> (as java/lang/Object)) (random.ascii 1)) boolean (# ! each (|>> /.as_boolean) random.bit) byte (# ! each (|>> /.as_byte) random.int) @@ -179,12 +179,12 @@ (not (/.null? sample)))) (_.cover [/.???] (and (|> (/.??? (/.null)) - (: (Maybe java/lang/Object)) + (is (Maybe java/lang/Object)) (pipe.case {.#None} #1 {.#Some _} #0)) (|> (/.??? sample) - (: (Maybe java/lang/Object)) + (is (Maybe java/lang/Object)) (pipe.case {.#Some _} #1 {.#None} #0)))) @@ -200,11 +200,11 @@ <lux#value> <as> <of> <lux#=>] [(_.cover [<object> <primitive>] (|> <jvm#value> - (: <object>) + (is <object>) "jvm object cast" - (: <primitive>) + (is <primitive>) "jvm object cast" - (: <object>) + (is <object>) (<jvm#=> <jvm#value>))) (_.cover [<as> <of>] (|> <lux#value> @@ -237,11 +237,11 @@ (text#= it)))) (_.cover [/.cannot_cast_to_non_object] (text.contains? (the exception.#label /.cannot_cast_to_non_object) - (macro_error (/.:as boolean (: /.Boolean boolean))))) - (_.cover [/.:as] + (macro_error (/.as boolean (is /.Boolean boolean))))) + (_.cover [/.as] (|> string - (/.:as java/lang/Object) - (same? (:as java/lang/Object string)))) + (/.as java/lang/Object) + (same? (as java/lang/Object string)))) (_.cover [/.type] (and (and (type#= /.Boolean (/.type java/lang/Boolean)) (type#= /.Boolean (/.type boolean))) @@ -309,8 +309,8 @@ java/lang/Long (/.as_long (.int expected)))) example/0! - (same? (: Any expected) - (: Any (test/TestInterface0::actual0 object/0))) + (same? (is Any expected) + (is Any (test/TestInterface0::actual0 object/0))) object/1 (/.object [] [test/TestInterface1] [] @@ -324,8 +324,8 @@ example/1! (and (case (test/TestInterface1::actual1 (/.as_boolean false) object/1) {try.#Success actual} - (same? (: Any expected) - (: Any actual)) + (same? (is Any expected) + (is Any actual)) {try.#Failure error} false) @@ -343,8 +343,8 @@ a input)) example/2! - (same? (: Any expected) - (: Any (test/TestInterface2::actual2 (/.as_long (.int expected)) object/2))) + (same? (is Any expected) + (is Any (test/TestInterface2::actual2 (/.as_long (.int expected)) object/2))) object/3 (/.object [] [(test/TestInterface3 java/lang/Long)] [] @@ -353,8 +353,8 @@ a (/.as_long (.int expected)))) example/3! - (same? (: Any expected) - (: Any (test/TestInterface3::actual3 object/3))) + (same? (is Any expected) + (is Any (test/TestInterface3::actual3 object/3))) example/4! (let [expected (i.+ left right) @@ -558,8 +558,8 @@ (n.= expected (.nat (/.of_long (test/TestInterface2::actual2 (/.as_long (.int expected)) object/2)))) - object/3 (: (test/TestClass3 java/lang/Long) - (test/TestClass3::new (/.as_long (.int expected)))) + object/3 (is (test/TestClass3 java/lang/Long) + (test/TestClass3::new (/.as_long (.int expected)))) example/3! (n.= expected (.nat (/.of_long (test/TestInterface3::actual3 object/3)))) @@ -584,14 +584,14 @@ (i.= expected (/.of_long (test/TestInterface4::actual4 (/.as_long left) (/.as_long right) object/8))))] - .let [random_long (: (Random java/lang/Long) - (# ! each (|>> /.as_long) - random.int))] + .let [random_long (is (Random java/lang/Long) + (# ! each (|>> /.as_long) + random.int))] dummy/0 random_long dummy/1 random_long dummy/2 random_long - .let [object/9 (/.do_to (: (test/TestClass9 java/lang/Long) - (test/TestClass9::new dummy/0)) + .let [object/9 (/.do_to (is (test/TestClass9 java/lang/Long) + (test/TestClass9::new dummy/0)) (test/TestClass9::set_actual9 dummy/1) (test/TestClass9::set_actual9 dummy/2)) diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 4c0a6aed0..75faa3349 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -27,7 +27,7 @@ (~~ (template [<type> <sample>] [(_.cover [<type>] (exec - (: <type> <sample>) + (is <type> <sample>) true))] [/.Boolean boolean] @@ -41,8 +41,8 @@ [(_.cover [<type>] (exec (|> [] - (:as <type>) - (: (Ex (_ a) (/.Object a)))) + (as <type>) + (is (Ex (_ a) (/.Object a)))) true))] [/.Nil] @@ -53,8 +53,8 @@ (|> (/.function (_ [input/0 Nat]) Int (.int input/0)) - (: /.Function) - (: (Ex (_ a) (/.Object a)))) + (is /.Function) + (is (Ex (_ a) (/.Object a)))) true)) (_.cover [/.import:] (case (io.run! (..os/getenv string)) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 39a86642e..f452cf5a1 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -181,11 +181,11 @@ (and (/.null? (/.null)) (not (/.null? sample)))) (_.cover [/.???] - (and (|> (: (Maybe java/lang/Object) (/.??? (/.null))) + (and (|> (is (Maybe java/lang/Object) (/.??? (/.null))) (pipe.case {.#None} #1 _ #0)) - (|> (: (Maybe java/lang/Object) (/.??? sample)) + (|> (is (Maybe java/lang/Object) (/.??? sample)) (pipe.case {.#Some _} #1 _ #0)))) diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux index ec8381e92..b3e8f9fa6 100644 --- a/stdlib/source/test/lux/ffi.py.lux +++ b/stdlib/source/test/lux/ffi.py.lux @@ -30,7 +30,7 @@ (~~ (template [<type> <sample>] [(_.cover [<type>] (exec - (: <type> <sample>) + (is <type> <sample>) true))] [/.Boolean boolean] @@ -44,8 +44,8 @@ [(_.cover [<type>] (exec (|> [] - (:as <type>) - (: (Ex (_ a) (/.Object a)))) + (as <type>) + (is (Ex (_ a) (/.Object a)))) true))] [/.None] @@ -56,8 +56,8 @@ (|> (/.function (_ [input/0 Nat]) Int (.int input/0)) - (: /.Function) - (: (Ex (_ a) (/.Object a)))) + (is /.Function) + (is (Ex (_ a) (/.Object a)))) true)) (_.cover [/.import:] (and (i.= (os::R_OK) (os::R_OK)) diff --git a/stdlib/source/test/lux/ffi.rb.lux b/stdlib/source/test/lux/ffi.rb.lux index 75a89c833..49833b639 100644 --- a/stdlib/source/test/lux/ffi.rb.lux +++ b/stdlib/source/test/lux/ffi.rb.lux @@ -27,7 +27,7 @@ (~~ (template [<type> <sample>] [(_.cover [<type>] (exec - (: <type> <sample>) + (is <type> <sample>) true))] [/.Boolean boolean] @@ -41,8 +41,8 @@ [(_.cover [<type>] (exec (|> [] - (:as <type>) - (: (Ex (_ a) (/.Object a)))) + (as <type>) + (is (Ex (_ a) (/.Object a)))) true))] [/.Nil] diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index f3bf54cad..bf61cbc92 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -35,8 +35,8 @@ [(def: <bundle> Bundle (let [amount (template.amount <languages>) - languages (: (List /.Language) - (`` (list (~~ (template.spliced <languages>)))))] + languages (is (List /.Language) + (`` (list (~~ (template.spliced <languages>)))))] [#amount amount #names (|> languages (list#each /.name) (set.of_list text.hash)) #codes (|> languages (list#each /.code) (set.of_list text.hash)) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 5cb684336..e1927eedb 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -42,8 +42,8 @@ _ false)]) (template: (!global <definition>) - [(: [Text .Global] - [(template.text [<definition>]) {.#Definition [true .Macro <definition>]}])]) + [(is [Text .Global] + [(template.text [<definition>]) {.#Definition [true .Macro <definition>]}])]) (syntax: (pow/2 [number <code>.any]) (in (list (` (n.* (~ number) (~ number)))))) @@ -79,19 +79,19 @@ .#modules (list [macro_module [.#module_hash 0 .#module_aliases (list) - .#definitions (: (List [Text .Global]) - (list (!global /.log_single_expansion!) - (!global /.log_expansion!) - (!global /.log_full_expansion!))) + .#definitions (is (List [Text .Global]) + (list (!global /.log_single_expansion!) + (!global /.log_expansion!) + (!global /.log_full_expansion!))) .#imports (list) .#module_state {.#Active}]] [current_module [.#module_hash 0 .#module_aliases (list) - .#definitions (: (List [Text .Global]) - (list (!global ..pow/2) - (!global ..pow/4) - (!global ..repeated))) + .#definitions (is (List [Text .Global]) + (list (!global ..pow/2) + (!global ..pow/4) + (!global ..repeated))) .#imports (list) .#module_state {.#Active}]]) .#scopes (list) @@ -102,7 +102,7 @@ .#seed seed .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]]))) (syntax: (iterated [cycle <code>.nat diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index ffa65358b..81c17f991 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -63,8 +63,8 @@ (let [parse (syntax.parse "" syntax.no_aliases (text.size source_code)) - start (: Source - [location.dummy 0 source_code])] + start (is Source + [location.dummy 0 source_code])] (case (parse start) {.#Left [end error]} {try.#Failure error} @@ -76,13 +76,13 @@ (-> [Code Code] (Random [Code Code])) (random.rec (function (_ replacement_simulation) - (let [for_sequence (: (-> (-> (List Code) Code) (Random [Code Code])) - (function (_ to_code) - (random.only (|>> product.left (# /.equivalence = original) not) - (do [! random.monad] - [parts (..random_sequence replacement_simulation)] - (in [(to_code (list#each product.left parts)) - (to_code (list#each product.right parts))])))))] + (let [for_sequence (is (-> (-> (List Code) Code) (Random [Code Code])) + (function (_ to_code) + (random.only (|>> product.left (# /.equivalence = original) not) + (do [! random.monad] + [parts (..random_sequence replacement_simulation)] + (in [(to_code (list#each product.left parts)) + (to_code (list#each product.right parts))])))))] ($_ random.either (random#in [original substitute]) (do [! random.monad] diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index b9b996461..88840d364 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -51,8 +51,8 @@ [pop! (/.push (list [name (..constant constant)])) [module short] (meta.normal name) _ (if pre_remove - (let [remove_macro! (: (-> .Module .Module) - (revised .#definitions (plist.lacks short)))] + (let [remove_macro! (is (-> .Module .Module) + (revised .#definitions (plist.lacks short)))] (function (_ lux) {try.#Success [(revised .#modules (plist.revised module remove_macro!) lux) []]})) diff --git a/stdlib/source/test/lux/macro/pattern.lux b/stdlib/source/test/lux/macro/pattern.lux index d5b7b9dcb..a0d4be149 100644 --- a/stdlib/source/test/lux/macro/pattern.lux +++ b/stdlib/source/test/lux/macro/pattern.lux @@ -60,16 +60,16 @@ (/.or "+0.5" "+1.25") true _ false))) (_.cover [/.let] - (let [expected_pair (: (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] + (let [expected_pair (is (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] (/.case expected_pair (/.let actual_pair (/.pattern (!pair actual_left actual_right))) (and (/.same? expected_pair actual_pair) (/.same? expected_nat actual_left) (/.same? expected_int actual_right))))) (_.cover [/.multi] - (let [expected_pair (: (Pair Nat Int) - [..#left expected_nat ..#right expected_int])] + (let [expected_pair (is (Pair Nat Int) + [..#left expected_nat ..#right expected_int])] (and (/.case expected_pair (/.multi (/.pattern (!pair 0 actual_right)) [actual_right diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux index bd8e41b38..d0b3cceb3 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -50,7 +50,7 @@ .#seed 0 .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]) (def: .public test diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index 3c7b34b10..a79d72805 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -339,11 +339,11 @@ (do random.monad [sample random.rev [_ fuzzy] ..gradient - .let [equivalence (: (Equivalence (/.Fuzzy Rev)) - (implementation - (def: (= left right) - (r.= (left sample) - (right sample)))))]] + .let [equivalence (is (Equivalence (/.Fuzzy Rev)) + (implementation + (def: (= left right) + (r.= (left sample) + (right sample)))))]] ($_ _.and (_.for [/.functor] ($contravariant.spec equivalence fuzzy /.functor)) diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index e19c662d4..243603132 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" type ("[1]#[0]" equivalence)] - [abstract - [monad {"+" do}] - ["[0]" predicate] - [\\specification - ["$[0]" equivalence] - ["$[0]" order] - ["$[0]" monoid] - ["$[0]" codec]]] - [control - ["[0]" try] - ["[0]" exception]] - [data - ["[0]" product] - ["[0]" bit ("[1]#[0]" equivalence)]] - [math - ["[0]" random {"+" Random}] - [number - ["i" int]]]]] - ["$[0]" // "_" - ["[1]" modulus]] - [\\library - ["[0]" / - ["/[1]" // "_" - ["[1]" modulus]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" type ("[1]#[0]" equivalence)] + [abstract + [monad {"+" do}] + ["[0]" predicate] + [\\specification + ["$[0]" equivalence] + ["$[0]" order] + ["$[0]" monoid] + ["$[0]" codec]]] + [control + ["[0]" try] + ["[0]" exception]] + [data + ["[0]" product] + ["[0]" bit ("[1]#[0]" equivalence)]] + [math + ["[0]" random {"+" Random}] + [number + ["i" int]]]]] + ["$[0]" // "_" + ["[1]" modulus]] + [\\library + ["[0]" / + ["/[1]" // "_" + ["[1]" modulus]]]]) (def: .public (random modulus) (All (_ %) (-> (//.Modulus %) (Random (/.Mod %)))) @@ -72,10 +72,10 @@ {try.#Success _} false)) (_.cover [/.modulus] - (and (type#= (:of (/.modulus subject)) - (:of (/.modulus subject))) - (not (type#= (:of (/.modulus subject)) - (:of (/.modulus param)))))) + (and (type#= (type_of (/.modulus subject)) + (type_of (/.modulus subject))) + (not (type#= (type_of (/.modulus subject)) + (type_of (/.modulus param)))))) (_.cover [/.modular /.value] (/.= subject (/.modular (/.modulus subject) (/.value subject)))) diff --git a/stdlib/source/test/lux/math/number/frac.lux b/stdlib/source/test/lux/math/number/frac.lux index 77453c6f2..9f1064796 100644 --- a/stdlib/source/test/lux/math/number/frac.lux +++ b/stdlib/source/test/lux/math/number/frac.lux @@ -332,10 +332,10 @@ (/.mod left right)))))) )) (with_expansions [<jvm> ($_ _.and - (let [test (: (-> Frac Bit) - (function (_ value) - (n.= (.nat (ffi.of_long (java/lang/Double::doubleToRawLongBits (ffi.as_double value)))) - (/.bits value))))] + (let [test (is (-> Frac Bit) + (function (_ value) + (n.= (.nat (ffi.of_long (java/lang/Double::doubleToRawLongBits (ffi.as_double value)))) + (/.bits value))))] (do random.monad [sample random.frac] (_.cover [/.bits] @@ -356,12 +356,12 @@ )] (for @.old <jvm> @.jvm <jvm> - (let [test (: (-> Frac Bit) - (function (_ expected) - (let [actual (|> expected /.bits /.of_bits)] - (or (/.= expected actual) - (and (/.not_a_number? expected) - (/.not_a_number? actual))))))] + (let [test (is (-> Frac Bit) + (function (_ expected) + (let [actual (|> expected /.bits /.of_bits)] + (or (/.= expected actual) + (and (/.not_a_number? expected) + (/.not_a_number? actual))))))] (do random.monad [sample random.frac] (_.cover [/.bits /.of_bits] diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 118c94870..561ab0f04 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -1,22 +1,22 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [data - ["[0]" bit ("[1]#[0]" equivalence)]] - [abstract - [monad {"+" do}] - [\\specification - ["$[0]" equivalence] - ["$[0]" hash] - ["$[0]" monoid]]] - [math - ["[0]" random {"+" Random}]]]] - [\\library - ["[0]" / ("#[0]" equivalence) - [// {"+" hex} - ["n" nat] - ["i" int]]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [data + ["[0]" bit ("[1]#[0]" equivalence)]] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence] + ["$[0]" hash] + ["$[0]" monoid]]] + [math + ["[0]" random {"+" Random}]]]] + [\\library + ["[0]" / ("#[0]" equivalence) + [// {"+" hex} + ["n" nat] + ["i" int]]]]) (def: bit Test @@ -135,10 +135,10 @@ .int ++)] expected (# ! each (i.% limit) random.int) - .let [random (: (All (_ size) - (-> (-> I64 (I64 size)) (Random (I64 size)))) - (function (_ narrow) - (# random.functor each narrow random.i64)))]] + .let [random (is (All (_ size) + (-> (-> I64 (I64 size)) (Random (I64 size)))) + (function (_ narrow) + (# random.functor each narrow random.i64)))]] ($_ _.and ($equivalence.spec (# sub &equivalence) (random (# sub narrow))) (_.cover [/.sub] diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 8a4f63425..33e22c581 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -73,7 +73,7 @@ .#seed expected_seed .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]]] ($_ _.and (_.cover [/.result] @@ -132,19 +132,19 @@ .#seed expected_seed .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]]] ($_ _.and (_.cover [/.failure] (|> (/.failure expected_error) - (: (Meta Any)) + (is (Meta Any)) (/.result expected_lux) (!expect (^.multi {try.#Failure actual_error} (text#= (location.with location.dummy expected_error) actual_error))))) (_.cover [/.assertion] (and (|> (/.assertion expected_error true) - (: (Meta Any)) + (is (Meta Any)) (/.result expected_lux) (!expect {try.#Success []})) (|> (/.assertion expected_error false) @@ -153,21 +153,21 @@ (text#= expected_error actual_error)))))) (_.cover [/.either] (and (|> (/.either (# /.monad in expected) - (: (Meta Nat) - (/.failure expected_error))) + (is (Meta Nat) + (/.failure expected_error))) (/.result expected_lux) (!expect (^.multi {try.#Success actual} (n.= expected actual)))) - (|> (/.either (: (Meta Nat) - (/.failure expected_error)) + (|> (/.either (is (Meta Nat) + (/.failure expected_error)) (# /.monad in expected)) (/.result expected_lux) (!expect (^.multi {try.#Success actual} (n.= expected actual)))) - (|> (/.either (: (Meta Nat) - (/.failure expected_error)) - (: (Meta Nat) - (/.failure expected_error))) + (|> (/.either (is (Meta Nat) + (/.failure expected_error)) + (is (Meta Nat) + (/.failure expected_error))) (/.result expected_lux) (!expect (^.multi {try.#Failure actual_error} (text#= (location.with location.dummy expected_error) @@ -238,7 +238,7 @@ .#seed expected_seed .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]]] (<| (_.for [.Module]) ($_ _.and @@ -338,7 +338,7 @@ .#seed expected_seed .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]]] ($_ _.and (_.cover [/.target] @@ -385,53 +385,53 @@ expected_value (random.either (in .def:) (in .macro:)) .let [expected_lux - (: (-> Bit (Maybe Type) - [(List [Text .Global]) - (List [Text .Global]) - Lux]) - (function (_ exported? def_type) - (let [current_globals (: (List [Text .Global]) - (list [expected_short - {.#Alias [expected_macro_module expected_short]}])) - macro_globals (: (List [Text .Global]) - (case def_type - {.#Some def_type} - (list [expected_short - {.#Definition [exported? def_type expected_value]}]) - - {.#None} - (list)))] - [current_globals - macro_globals - [.#info [.#target "" - .#version "" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#Some expected_current_module} - .#modules (list [expected_current_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions current_globals - .#imports (list) - .#module_state {.#Active}]] - [expected_macro_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions macro_globals - .#imports (list) - .#module_state {.#Active}]]) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed 0 - .#scope_type_vars (list) - .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) - .#host []]])))]] + (is (-> Bit (Maybe Type) + [(List [Text .Global]) + (List [Text .Global]) + Lux]) + (function (_ exported? def_type) + (let [current_globals (is (List [Text .Global]) + (list [expected_short + {.#Alias [expected_macro_module expected_short]}])) + macro_globals (is (List [Text .Global]) + (case def_type + {.#Some def_type} + (list [expected_short + {.#Definition [exported? def_type expected_value]}]) + + {.#None} + (list)))] + [current_globals + macro_globals + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some expected_current_module} + .#modules (list [expected_current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions current_globals + .#imports (list) + .#module_state {.#Active}]] + [expected_macro_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions macro_globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]])))]] ($_ _.and (_.cover [.Global .Alias /.globals] (let [[current_globals macro_globals expected_lux] @@ -501,53 +501,53 @@ expected_value (random.either (in .def:) (in .macro:)) .let [expected_lux - (: (-> Bit (Maybe Type) - [(List [Text .Global]) - (List [Text .Global]) - Lux]) - (function (_ exported? def_type) - (let [current_globals (: (List [Text .Global]) - (list [expected_short - {.#Alias [expected_macro_module expected_short]}])) - macro_globals (: (List [Text .Global]) - (case def_type - {.#Some def_type} - (list [expected_short - {.#Definition [exported? def_type expected_value]}]) - - {.#None} - (list)))] - [current_globals - macro_globals - [.#info [.#target "" - .#version "" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#Some expected_current_module} - .#modules (list [expected_current_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions current_globals - .#imports (list) - .#module_state {.#Active}]] - [expected_macro_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions macro_globals - .#imports (list) - .#module_state {.#Active}]]) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed 0 - .#scope_type_vars (list) - .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) - .#host []]])))]] + (is (-> Bit (Maybe Type) + [(List [Text .Global]) + (List [Text .Global]) + Lux]) + (function (_ exported? def_type) + (let [current_globals (is (List [Text .Global]) + (list [expected_short + {.#Alias [expected_macro_module expected_short]}])) + macro_globals (is (List [Text .Global]) + (case def_type + {.#Some def_type} + (list [expected_short + {.#Definition [exported? def_type expected_value]}]) + + {.#None} + (list)))] + [current_globals + macro_globals + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some expected_current_module} + .#modules (list [expected_current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions current_globals + .#imports (list) + .#module_state {.#Active}]] + [expected_macro_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions macro_globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []]])))]] ($_ _.and (_.cover [/.export] (and (let [[current_globals macro_globals expected_lux] @@ -615,7 +615,7 @@ (!expect (^.multi {try.#Success {.#Definition [actual_exported? actual_type actual_value]}} (and (bit#= expected_exported? actual_exported?) (same? expected_type actual_type) - (same? (:as Any expected_value) actual_value))))) + (same? (as Any expected_value) actual_value))))) alias! (|> (/.definition [expected_current_module expected_short]) @@ -650,13 +650,13 @@ (|> (/.type_definition [expected_macro_module expected_short]) (/.result expected_lux) (!expect (^.multi {try.#Success actual_value} - (same? (:as .Type expected_value) actual_value)))) + (same? (as .Type expected_value) actual_value)))) alias! (|> (/.type_definition [expected_current_module expected_short]) (/.result expected_lux) (!expect (^.multi {try.#Success actual_value} - (same? (:as .Type expected_value) actual_value))))] + (same? (as .Type expected_value) actual_value))))] (and definition! alias!))) ))) @@ -674,14 +674,14 @@ .let [random_tag (# ! each (|>> [label_module]) (random.ascii/upper 1)) - random_labels (: (Random [Text (List Text)]) - (do ! - [head (random.ascii/lower 5)] - (|> (random.ascii/lower 5) - (random.only (|>> (text#= head) not)) - (random.set text.hash 3) - (# ! each set.list) - (random.and (in head)))))] + random_labels (is (Random [Text (List Text)]) + (do ! + [head (random.ascii/lower 5)] + (|> (random.ascii/lower 5) + (random.only (|>> (text#= head) not)) + (random.set text.hash 3) + (# ! each set.list) + (random.and (in head)))))] tags_0 random_labels tags_1 (let [set/0 (set.of_list text.hash {.#Item tags_0})] (random.only (|>> {.#Item} @@ -692,46 +692,46 @@ type_1 {.#Primitive name_1 (list)} expected_lux - (: Lux - [.#info [.#target "" - .#version "" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#Some current_module} - .#modules (list [current_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions (list) - .#imports (list label_module) - .#module_state {.#Active}]] - [label_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions (list& [name_0 {.#Type [true type_0 {.#Left tags_0}]}] - [name_1 {.#Type [true type_1 {.#Right tags_1}]}] - ($_ list#composite - (|> {.#Item tags_0} - list.enumeration - (list#each (function (_ [index short]) - [short {.#Tag [true type_0 {.#Item tags_0} index]}]))) - (|> {.#Item tags_1} - list.enumeration - (list#each (function (_ [index short]) - [short {.#Slot [true type_1 {.#Item tags_1} index]}]))))) - .#imports (list) - .#module_state {.#Active}]]) - .#scopes (list) - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed 0 - .#scope_type_vars (list) - .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) - .#host []])]] + (is Lux + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (list) + .#imports (list label_module) + .#module_state {.#Active}]] + [label_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions (list& [name_0 {.#Type [true type_0 {.#Left tags_0}]}] + [name_1 {.#Type [true type_1 {.#Right tags_1}]}] + ($_ list#composite + (|> {.#Item tags_0} + list.enumeration + (list#each (function (_ [index short]) + [short {.#Tag [true type_0 {.#Item tags_0} index]}]))) + (|> {.#Item tags_1} + list.enumeration + (list#each (function (_ [index short]) + [short {.#Slot [true type_1 {.#Item tags_1} index]}]))))) + .#imports (list) + .#module_state {.#Active}]]) + .#scopes (list) + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []])]] ($_ _.and (_.cover [/.tag_lists] (let [equivalence (list.equivalence @@ -820,9 +820,9 @@ type_3 {.#Primitive name_3 (list)} type_4 {.#Primitive name_4 (list)} - globals (: (List [Text .Global]) - (list [name_4 - {.#Definition [false type_4 []]}])) + globals (is (List [Text .Global]) + (list [name_4 + {.#Definition [false type_4 []]}])) scopes (list [.#name (list) .#inner 0 @@ -844,38 +844,38 @@ .#captured [.#counter 0 .#mappings (list)]])] .let [expected_lux - (: Lux - [.#info [.#target "" - .#version "" - .#mode {.#Build} - .#configuration (list)] - .#source [location.dummy 0 ""] - .#location location.dummy - .#current_module {.#Some current_module} - .#modules (list [current_module - [.#module_hash 0 - .#module_aliases (list) - .#definitions globals - .#imports (list) - .#module_state {.#Active}]]) - .#scopes scopes - .#type_context [.#ex_counter 0 - .#var_counter 0 - .#var_bindings (list)] - .#expected {.#None} - .#seed 0 - .#scope_type_vars (list) - .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) - .#host []])]] + (is Lux + [.#info [.#target "" + .#version "" + .#mode {.#Build} + .#configuration (list)] + .#source [location.dummy 0 ""] + .#location location.dummy + .#current_module {.#Some current_module} + .#modules (list [current_module + [.#module_hash 0 + .#module_aliases (list) + .#definitions globals + .#imports (list) + .#module_state {.#Active}]]) + .#scopes scopes + .#type_context [.#ex_counter 0 + .#var_counter 0 + .#var_bindings (list)] + .#expected {.#None} + .#seed 0 + .#scope_type_vars (list) + .#extensions [] + .#eval (as (-> Type Code (Meta Any)) []) + .#host []])]] ($_ _.and (_.cover [.Scope /.locals] - (let [equivalence (: (Equivalence (List (List [Text Type]))) - (list.equivalence + (let [equivalence (is (Equivalence (List (List [Text Type]))) (list.equivalence - (product.equivalence - text.equivalence - type.equivalence))))] + (list.equivalence + (product.equivalence + text.equivalence + type.equivalence))))] (|> /.locals (/.result expected_lux) (try#each (# equivalence = (list (list [name_3 type_3]) @@ -974,7 +974,7 @@ .#seed expected_seed .#scope_type_vars (list) .#extensions [] - .#eval (:as (-> Type Code (Meta Any)) []) + .#eval (as (-> Type Code (Meta Any)) []) .#host []]]] ($_ _.and (_.for [/.functor] @@ -990,7 +990,7 @@ (_.cover [/.lifted] (and (|> expected_error {try.#Failure} - (: (Try Nat)) + (is (Try Nat)) /.lifted (/.result expected_lux) (!expect (^.multi {try.#Failure actual} @@ -998,7 +998,7 @@ actual)))) (|> expected_value {try.#Success} - (: (Try Nat)) + (is (Try Nat)) /.lifted (/.result expected_lux) (!expect (^.multi {try.#Success actual} diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index f2aafead6..d780d38c9 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -35,10 +35,10 @@ (let [(open "list#[0]") (list.equivalence text.equivalence)] (and (with_expansions [<program> (/.program: all_arguments (io.io all_arguments))] - (let [outcome ((: (-> (List Text) (io.IO Any)) - (..actual_program <program>)) + (let [outcome ((is (-> (List Text) (io.IO Any)) + (..actual_program <program>)) inputs)] - (same? (: Any inputs) + (same? (is Any inputs) (io.run! outcome)))) (with_expansions [<program> (/.program: [arg/0 <cli>.any arg/1 <cli>.any @@ -46,25 +46,25 @@ arg/3 <cli>.any arg/4 <cli>.any] (io.io (list arg/4 arg/3 arg/2 arg/1 arg/0)))] - (let [outcome ((: (-> (List Text) (io.IO Any)) - (..actual_program <program>)) + (let [outcome ((is (-> (List Text) (io.IO Any)) + (..actual_program <program>)) inputs)] (list#= (list.reversed inputs) - (:as (List Text) (io.run! outcome))))) + (as (List Text) (io.run! outcome))))) (with_expansions [<program> (/.program: [all_arguments (<>.many <cli>.any)] (io.io all_arguments))] - (let [outcome ((: (-> (List Text) (io.IO Any)) - (..actual_program <program>)) + (let [outcome ((is (-> (List Text) (io.IO Any)) + (..actual_program <program>)) inputs)] (list#= inputs - (:as (List Text) (io.run! outcome))))) + (as (List Text) (io.run! outcome))))) (with_expansions [<program> (/.program: [arg/0 <cli>.any arg/1 <cli>.any arg/2 <cli>.any arg/3 <cli>.any] (io.io []))] - (case (try ((: (-> (List Text) (io.IO Any)) - (..actual_program <program>)) + (case (try ((is (-> (List Text) (io.IO Any)) + (..actual_program <program>)) inputs)) {try.#Success _} false diff --git a/stdlib/source/test/lux/target/js.lux b/stdlib/source/test/lux/target/js.lux index 8f1da42bb..20a49a462 100644 --- a/stdlib/source/test/lux/target/js.lux +++ b/stdlib/source/test/lux/target/js.lux @@ -83,16 +83,16 @@ {.#Some _} false))) (try.else false))) (_.cover [/.boolean] - (expression (|>> (:as Bit) (bit#= boolean)) + (expression (|>> (as Bit) (bit#= boolean)) (/.boolean boolean))) (_.cover [/.number] - (expression (|>> (:as Frac) (f.= number)) + (expression (|>> (as Frac) (f.= number)) (/.number number))) (_.cover [/.int] - (expression (|>> (:as Frac) f.int (i.= int)) + (expression (|>> (as Frac) f.int (i.= int)) (/.int int))) (_.cover [/.string] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.string string))) ))) @@ -105,14 +105,14 @@ (~~ (template [<js> <lux>] [(_.cover [<js>] (let [expected (<lux> left right)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (<js> (/.boolean left) (/.boolean right)))))] [/.or .or] [/.and .and] )) (_.cover [/.not] - (expression (|>> (:as Bit) (bit#= (not left))) + (expression (|>> (as Bit) (bit#= (not left))) (/.not (/.boolean left)))) )))) @@ -126,7 +126,7 @@ (~~ (template [<js> <lux>] [(_.cover [<js>] (let [expected (<lux> parameter subject)] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (<js> (/.number parameter) (/.number subject)))))] [/.+ f.+] @@ -138,7 +138,7 @@ (~~ (template [<js> <lux>] [(_.cover [<js>] (let [expected (<lux> parameter subject)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (<js> (/.number parameter) (/.number subject)))))] [/.< f.<] @@ -162,7 +162,7 @@ (~~ (template [<js> <lux>] [(_.cover [<js>] (let [expected (<lux> left right)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (<js> (/.int left) (/.int right)))))] [/.bit_or i64.or] @@ -170,35 +170,35 @@ [/.bit_and i64.and] )) (_.cover [/.opposite] - (expression (|>> (:as Frac) f.int (i.= (i.* -1 i32))) + (expression (|>> (as Frac) f.int (i.= (i.* -1 i32))) (/.opposite (/.i32 i32)))) (_.cover [/.i32] - (expression (|>> (:as Frac) f.int (i.= i32)) + (expression (|>> (as Frac) f.int (i.= i32)) (/.i32 i32))) (_.cover [/.to_i32] - (expression (|>> (:as Frac) f.int (i.= i32)) + (expression (|>> (as Frac) f.int (i.= i32)) (/.to_i32 (/.int i32)))) (_.cover [/.left_shift] (let [expected (i64.left_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.left_shift (/.int (.int shift)) (/.i32 i16))))) (_.cover [/.logic_right_shift] (let [expected (i64.right_shifted shift (as_int/32 i16))] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.logic_right_shift (/.int (.int shift)) (/.i32 i16))))) (_.cover [/.arithmetic_right_shift] (let [expected (i.right_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.arithmetic_right_shift (/.int (.int shift)) (/.i32 i16))))) (_.cover [/.bit_not] (let [expected (if (i.< +0 i32) (as_int/32 (i64.not i32)) (i64.not (as_int/32 i32)))] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_not (/.i32 i32))))) )))) @@ -213,10 +213,10 @@ (maybe.else f.not_a_number))]] ($_ _.and (_.cover [/.array /.at] - (and (expression (|>> (:as Frac) (f.= expected)) + (and (expression (|>> (as Frac) (f.= expected)) (/.at (/.int (.int index)) (/.array (list#each /.number items)))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.array (list#each /.number items)) (/.at (/.int (.int size))) (/.= /.undefined))))) @@ -235,17 +235,17 @@ items (random.list size random.safe_frac)] ($_ _.and (_.cover [/.object /.the] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.the field (/.object (list [field (/.number expected)]))))) (let [expected (|> items (list.item index) (maybe.else f.not_a_number))] (_.cover [/.do] - (expression (|>> (:as Frac) f.int (i.= (.int index))) + (expression (|>> (as Frac) f.int (i.= (.int index))) (|> (/.array (list#each /.number items)) (/.do "lastIndexOf" (list (/.number expected))))))) (_.cover [/.undefined] - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.object (list [field (/.number expected)])) (/.the dummy) (/.= /.undefined)))) @@ -271,34 +271,34 @@ ..test|object (_.cover [/.?] (let [expected (if test then else)] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.? (/.boolean test) (/.number then) (/.number else))))) (_.cover [/.not_a_number?] - (and (expression (|>> (:as Bit)) + (and (expression (|>> (as Bit)) (/.not_a_number? (/.number f.not_a_number))) - (expression (|>> (:as Bit) not) + (expression (|>> (as Bit) not) (/.not_a_number? (/.number then))))) (_.cover [/.type_of] - (and (expression (|>> (:as Text) (text#= "boolean")) + (and (expression (|>> (as Text) (text#= "boolean")) (/.type_of (/.boolean boolean))) - (expression (|>> (:as Text) (text#= "number")) + (expression (|>> (as Text) (text#= "number")) (/.type_of (/.number number))) - (expression (|>> (:as Text) (text#= "string")) + (expression (|>> (as Text) (text#= "string")) (/.type_of (/.string string))) - (expression (|>> (:as Text) (text#= "object")) + (expression (|>> (as Text) (text#= "object")) (/.type_of /.null)) - (expression (|>> (:as Text) (text#= "object")) + (expression (|>> (as Text) (text#= "object")) (/.type_of (/.object (list [string (/.number number)])))) - (expression (|>> (:as Text) (text#= "object")) + (expression (|>> (as Text) (text#= "object")) (/.type_of (/.array (list (/.boolean boolean) (/.number number) (/.string string))))) - (expression (|>> (:as Text) (text#= "undefined")) + (expression (|>> (as Text) (text#= "undefined")) (/.type_of /.undefined)))) (_.cover [/.comment] - (expression (|>> (:as Frac) (f.= then)) + (expression (|>> (as Frac) (f.= then)) (/.comment comment (/.number then)))) ))) @@ -314,7 +314,7 @@ (_.for [/.Computation] ..test|computation) (_.cover [/.,] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/., (/.number dummy) (/.number expected)))) )))) @@ -331,18 +331,18 @@ $local (/.var local)]] ($_ _.and (_.cover [/.var] - (expression (|>> (:as Frac) (f.= number/0)) + (expression (|>> (as Frac) (f.= number/0)) (/.apply/* (/.closure (list $foreign) (/.return $foreign)) (list (/.number number/0))))) (_.cover [/.define] - (expression (|>> (:as Frac) (f.= number/1)) + (expression (|>> (as Frac) (f.= number/1)) (/.apply/* (/.closure (list $foreign) ($_ /.then (/.define $local (/.number number/1)) (/.return $local))) (list (/.number number/0))))) (_.cover [/.declare] - (expression (|>> (:as Frac) (f.= number/1)) + (expression (|>> (as Frac) (f.= number/1)) (/.apply/* (/.closure (list $foreign) ($_ /.then (/.declare $local) @@ -360,13 +360,13 @@ field (random.ascii/upper 10)] ($_ _.and (_.cover [/.set] - (and (expression (|>> (:as Frac) (f.= (f.+ number/0 number/0))) + (and (expression (|>> (as Frac) (f.= (f.+ number/0 number/0))) (/.apply/* (/.closure (list $foreign) ($_ /.then (/.set $foreign (/.+ $foreign $foreign)) (/.return $foreign))) (list (/.number number/0)))) - (expression (|>> (:as Frac) (f.= (f.+ number/0 number/0))) + (expression (|>> (as Frac) (f.= (f.+ number/0 number/0))) (let [@ (/.at (/.int +0) $foreign)] (/.apply/* (/.closure (list $foreign) ($_ /.then @@ -374,7 +374,7 @@ (/.set @ (/.+ @ @)) (/.return @))) (list (/.number number/0))))) - (expression (|>> (:as Frac) (f.= (f.+ number/0 number/0))) + (expression (|>> (as Frac) (f.= (f.+ number/0 number/0))) (let [@ (/.the field $foreign)] (/.apply/* (/.closure (list $foreign) ($_ /.then @@ -383,17 +383,17 @@ (/.return @))) (list (/.number number/0))))))) (_.cover [/.delete] - (and (and (expression (|>> (:as Bit)) + (and (and (expression (|>> (as Bit)) (/.apply/* (/.closure (list) ($_ /.then (/.set $foreign (/.number number/0)) (/.return (/.delete $foreign)))) (list))) - (expression (|>> (:as Bit) not) + (expression (|>> (as Bit) not) (/.apply/* (/.closure (list $foreign) (/.return (/.delete $foreign))) (list (/.number number/0))))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (let [@ (/.at (/.int +0) $foreign)] (/.apply/* (/.closure (list $foreign) ($_ /.then @@ -401,7 +401,7 @@ (/.return (|> (/.= (/.boolean true) (/.delete @)) (/.and (/.= /.undefined @)))))) (list (/.number number/0))))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (let [@ (/.the field $foreign)] (/.apply/* (/.closure (list $foreign) ($_ /.then @@ -412,13 +412,13 @@ )) (_.cover [/.Access] (`` (and (~~ (template [<js> <lux>] - [(expression (|>> (:as Frac) f.int (i.= (<lux> int/0))) + [(expression (|>> (as Frac) f.int (i.= (<lux> int/0))) (/.apply/* (/.closure (list $foreign) ($_ /.then (/.statement (<js> $foreign)) (/.return $foreign))) (list (/.int int/0)))) - (expression (|>> (:as Frac) f.int (i.= (<lux> int/0))) + (expression (|>> (as Frac) f.int (i.= (<lux> int/0))) (let [@ (/.at (/.int +0) $foreign)] (/.apply/* (/.closure (list $foreign) ($_ /.then @@ -426,7 +426,7 @@ (/.statement (<js> @)) (/.return @))) (list (/.int int/0))))) - (expression (|>> (:as Frac) f.int (i.= (<lux> int/0))) + (expression (|>> (as Frac) f.int (i.= (<lux> int/0))) (let [@ (/.the field $foreign)] (/.apply/* (/.closure (list $foreign) ($_ /.then @@ -461,7 +461,7 @@ ($_ _.and (_.cover [/.break] (let [expected (i.* (.int expected_inner_iterations) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $inner_index (/.int +0)) @@ -477,7 +477,7 @@ (list (/.int input)))))) (_.cover [/.continue] (let [expected (i.* (.int (n.- expected_inner_iterations full_inner_iterations)) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $inner_index (/.int +0)) @@ -497,7 +497,7 @@ (let [expected (i.* (.int (n.* expected_outer_iterations expected_inner_iterations)) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $output (/.int +0)) @@ -523,7 +523,7 @@ (let [expected (i.* (.int (n.* (n.- expected_outer_iterations full_outer_iterations) (n.- expected_inner_iterations full_inner_iterations))) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $output (/.int +0)) @@ -561,7 +561,7 @@ expected|do_while (i.* (.int (n.max 1 iterations)) input)]] ($_ _.and (_.cover [/.while] - (expression (|>> (:as Frac) f.int (i.= expected|while)) + (expression (|>> (as Frac) f.int (i.= expected|while)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $index (/.int +0)) @@ -574,7 +574,7 @@ (/.return $output))) (list (/.int input))))) (_.cover [/.do_while] - (expression (|>> (:as Frac) f.int (i.= expected|do_while)) + (expression (|>> (as Frac) f.int (i.= expected|do_while)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $index (/.int +0)) @@ -587,7 +587,7 @@ (/.return $output))) (list (/.int input))))) (_.cover [/.for] - (expression (|>> (:as Frac) f.int (i.= expected|while)) + (expression (|>> (as Frac) f.int (i.= expected|while)) (/.apply/* (/.closure (list $input) ($_ /.then (/.define $output (/.int +0)) @@ -610,13 +610,13 @@ $ex (# ! each /.var (random.ascii/lower 10))] ($_ _.and (_.cover [/.try] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.apply/* (/.closure (list) (/.try (/.return (/.number expected)) [$ex (/.return (/.number dummy))])) (list)))) (_.cover [/.throw] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.apply/* (/.closure (list) (/.try ($_ /.then (/.throw (/.number expected)) @@ -636,22 +636,22 @@ $arg/2 (# ! each /.var (random.ascii/lower 12))] (`` ($_ _.and (_.cover [/.apply/1] - (expression (|>> (:as Frac) (f.= number/0)) + (expression (|>> (as Frac) (f.= number/0)) (/.apply/1 (/.closure (list $arg/0) (/.return $arg/0)) (/.number number/0)))) (_.cover [/.apply/2] - (expression (|>> (:as Frac) (f.= ($_ f.+ number/0 number/1))) + (expression (|>> (as Frac) (f.= ($_ f.+ number/0 number/1))) (/.apply/2 (/.closure (list $arg/0 $arg/1) (/.return ($_ /.+ $arg/0 $arg/1))) (/.number number/0) (/.number number/1)))) (_.cover [/.apply/3] - (expression (|>> (:as Frac) (f.= ($_ f.+ number/0 number/1 number/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ number/0 number/1 number/2))) (/.apply/3 (/.closure (list $arg/0 $arg/1 $arg/2) (/.return ($_ /.+ $arg/0 $arg/1 $arg/2))) (/.number number/0) (/.number number/1) (/.number number/2)))) (_.cover [/.apply/*] - (expression (|>> (:as Frac) (f.= ($_ f.+ number/0 number/1 number/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ number/0 number/1 number/2))) (/.apply/* (/.closure (list $arg/0 $arg/1 $arg/2) (/.return ($_ /.+ $arg/0 $arg/1 $arg/2))) (list (/.number number/0) (/.number number/1) @@ -669,18 +669,18 @@ $class (# ! each /.var (random.ascii/upper 4))] ($_ _.and (_.cover [/.closure /.return] - (expression (|>> (:as Frac) (f.= number/0)) + (expression (|>> (as Frac) (f.= number/0)) (/.apply/* (/.closure (list) (/.return (/.number number/0))) (list)))) (_.cover [/.function] - (expression (|>> (:as Frac) f.nat (n.= iterations)) + (expression (|>> (as Frac) f.nat (n.= iterations)) (/.apply/1 (/.function $self (list $arg/0) (/.return (/.? (/.< (/.int (.int iterations)) $arg/0) (/.apply/1 $self (/.+ (/.int +1) $arg/0)) $arg/0))) (/.int +0)))) (_.cover [/.function!] - (expression (|>> (:as Frac) f.nat (n.= iterations)) + (expression (|>> (as Frac) f.nat (n.= iterations)) (/.apply/* (/.closure (list) ($_ /.then (/.function! $self (list $arg/0) @@ -691,7 +691,7 @@ (list)))) (_.cover [/.new] (let [$this (/.var "this")] - (expression (|>> (:as Frac) (f.= number/0)) + (expression (|>> (as Frac) (f.= number/0)) (/.apply/1 (/.closure (list $arg/0) ($_ /.then (/.function! $class (list) @@ -720,14 +720,14 @@ int ..int/16] ($_ _.and (_.cover [/.if] - (expression (|>> (:as Frac) (f.= (if ??? number/0 number/1))) + (expression (|>> (as Frac) (f.= (if ??? number/0 number/1))) (/.apply/* (/.closure (list) (/.if (/.boolean ???) (/.return (/.number number/0)) (/.return (/.number number/1)))) (list)))) (_.cover [/.when] - (expression (|>> (:as Frac) (f.= (if ??? number/0 number/1))) + (expression (|>> (as Frac) (f.= (if ??? number/0 number/1))) (/.apply/* (/.closure (list) ($_ /.then (/.when (/.boolean ???) @@ -738,21 +738,21 @@ (let [number/0' (%.frac number/0) number/1' (%.frac number/1) number/2' (%.frac number/2)] - (and (expression (|>> (:as Text) (text#= number/0')) + (and (expression (|>> (as Text) (text#= number/0')) (/.apply/* (/.closure (list) (/.switch (/.number number/0) (list [(list (/.number number/0)) (/.return (/.string number/0'))] [(list (/.number number/1)) (/.return (/.string number/1'))]) {.#None})) (list))) - (expression (|>> (:as Text) (text#= number/1')) + (expression (|>> (as Text) (text#= number/1')) (/.apply/* (/.closure (list) (/.switch (/.number number/1) (list [(list (/.number number/0)) (/.return (/.string number/0'))] [(list (/.number number/1)) (/.return (/.string number/1'))]) {.#Some (/.return (/.string number/2'))})) (list))) - (expression (|>> (:as Text) (text#= number/2')) + (expression (|>> (as Text) (text#= number/2')) (/.apply/* (/.closure (list) (/.switch (/.number number/2) (list [(list (/.number number/0)) (/.return (/.string number/0'))] @@ -775,7 +775,7 @@ int ..int/16] (`` ($_ _.and (_.cover [/.statement] - (expression (|>> (:as Frac) (f.= number/0)) + (expression (|>> (as Frac) (f.= number/0)) (/.apply/1 (/.closure (list $arg/0) ($_ /.then (/.statement (/.+ $arg/0 $arg/0)) @@ -783,7 +783,7 @@ (/.number number/0)))) (~~ (template [<js> <lux>] [(_.cover [<js>] - (expression (|>> (:as Frac) f.int (i.= (<lux> int))) + (expression (|>> (as Frac) f.int (i.= (<lux> int))) (/.apply/1 (/.closure (list $arg/0) (/.return (/., (<js> $arg/0) $arg/0))) @@ -793,7 +793,7 @@ [/.-- .--] )) (_.cover [/.then] - (expression (|>> (:as Frac) (f.= number/0)) + (expression (|>> (as Frac) (f.= number/0)) (/.apply/2 (/.closure (list $arg/0 $arg/1) ($_ /.then (/.return $arg/0) @@ -801,7 +801,7 @@ (/.number number/0) (/.number number/1)))) (_.cover [/.use_strict] - (and (expression (|>> (:as Frac) (f.= number/0)) + (and (expression (|>> (as Frac) (f.= number/0)) (/.apply/* (/.closure (list) ($_ /.then /.use_strict diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 5a919761c..a665a398c 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -162,12 +162,12 @@ (/type.class "java.lang.Boolean" (list))) (def: $Boolean::wrap (/.invokestatic ..$Boolean "valueOf" (/type.method [(list) (list /type.boolean) ..$Boolean (list)]))) -(def: $Boolean::random (:as (Random java/lang/Boolean) random.bit)) +(def: $Boolean::random (as (Random java/lang/Boolean) random.bit)) (def: !false (|> 0 .i64 i32.i32 /.int)) (def: !true (|> 1 .i64 i32.i32 /.int)) (def: ($Boolean::literal value) (-> java/lang/Boolean (Bytecode Any)) - (if (:as Bit value) + (if (as Bit value) ..!true ..!false)) (def: $Boolean::primitive @@ -184,10 +184,10 @@ (/.invokestatic ..$Byte "valueOf" (/type.method [(list) (list /type.byte) ..$Byte (list)]))) (def: $Byte::random (Random java/lang/Byte) - (# random.monad each (|>> (:as java/lang/Long) ffi.long_to_byte) random.int)) + (# random.monad each (|>> (as java/lang/Long) ffi.long_to_byte) random.int)) (def: $Byte::literal (-> java/lang/Byte (Bytecode Any)) - (|>> ffi.byte_to_long (:as I64) i32.i32 /.int)) + (|>> ffi.byte_to_long (as I64) i32.i32 /.int)) (def: $Byte::primitive (Primitive java/lang/Byte) [#unboxed /type.byte @@ -202,10 +202,10 @@ (/.invokestatic ..$Short "valueOf" (/type.method [(list) (list /type.short) ..$Short (list)]))) (def: $Short::random (Random java/lang/Short) - (# random.monad each (|>> (:as java/lang/Long) ffi.long_to_short) random.int)) + (# random.monad each (|>> (as java/lang/Long) ffi.long_to_short) random.int)) (def: $Short::literal (-> java/lang/Short (Bytecode Any)) - (|>> ffi.short_to_long (:as I64) i32.i32 /.int)) + (|>> ffi.short_to_long (as I64) i32.i32 /.int)) (def: $Short::primitive (Primitive java/lang/Short) [#unboxed /type.short @@ -220,10 +220,10 @@ (/.invokestatic ..$Integer "valueOf" (/type.method [(list) (list /type.int) ..$Integer (list)]))) (def: $Integer::random (Random java/lang/Integer) - (# random.monad each (|>> (:as java/lang/Long) ffi.long_to_int) random.int)) + (# random.monad each (|>> (as java/lang/Long) ffi.long_to_int) random.int)) (def: $Integer::literal (-> java/lang/Integer (Bytecode Any)) - (|>> ffi.int_to_long (:as I64) i32.i32 /.int)) + (|>> ffi.int_to_long (as I64) i32.i32 /.int)) (def: $Integer::primitive (Primitive java/lang/Integer) [#unboxed /type.int @@ -234,8 +234,8 @@ (def: $Long (/type.class "java.lang.Long" (list))) (def: $Long::wrap (/.invokestatic ..$Long "valueOf" (/type.method [(list) (list /type.long) ..$Long (list)]))) -(def: $Long::random (:as (Random java/lang/Long) random.int)) -(def: $Long::literal (-> java/lang/Long (Bytecode Any)) (|>> (:as Int) /.long)) +(def: $Long::random (as (Random java/lang/Long) random.int)) +(def: $Long::literal (-> java/lang/Long (Bytecode Any)) (|>> (as Int) /.long)) (def: $Long::primitive (Primitive java/lang/Long) [#unboxed /type.long @@ -249,12 +249,12 @@ (def: $Float::random (Random java/lang/Float) (# random.monad each - (|>> (:as java/lang/Double) ffi.double_to_float) + (|>> (as java/lang/Double) ffi.double_to_float) random.frac)) (def: $Float::literal /.float) (def: valid_float (Random java/lang/Float) - (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) + (random.only (|>> ffi.float_to_double (as Frac) f.not_a_number? not) ..$Float::random)) (def: $Float::primitive (Primitive java/lang/Float) @@ -266,13 +266,13 @@ (def: $Double (/type.class "java.lang.Double" (list))) (def: $Double::wrap (/.invokestatic ..$Double "valueOf" (/type.method [(list) (list /type.double) ..$Double (list)]))) -(def: $Double::random (:as (Random java/lang/Double) random.frac)) +(def: $Double::random (as (Random java/lang/Double) random.frac)) (def: $Double::literal (-> java/lang/Double (Bytecode Any)) /.double) (def: valid_double (Random java/lang/Double) - (random.only (|>> (:as Frac) f.not_a_number? not) + (random.only (|>> (as Frac) f.not_a_number? not) ..$Double::random)) (def: $Double::primitive (Primitive java/lang/Double) @@ -288,10 +288,10 @@ (/.invokestatic ..$Character "valueOf" (/type.method [(list) (list /type.char) ..$Character (list)]))) (def: $Character::random (Random java/lang/Character) - (# random.monad each (|>> (:as java/lang/Long) ffi.long_to_int ffi.int_to_char) random.int)) + (# random.monad each (|>> (as java/lang/Long) ffi.long_to_int ffi.int_to_char) random.int)) (def: $Character::literal (-> java/lang/Character (Bytecode Any)) - (|>> ffi.char_to_long (:as I64) i32.i32 /.int)) + (|>> ffi.char_to_long (as I64) i32.i32 /.int)) (def: $Character::primitive (Primitive java/lang/Character) [#unboxed /type.char @@ -304,12 +304,12 @@ (/type.class "java.lang.String" (list))) (def: $String::random - (:as (Random java/lang/String) - (random.ascii/alpha 10))) + (as (Random java/lang/String) + (random.ascii/alpha 10))) (def: $String::literal (-> java/lang/String (Bytecode Any)) - (|>> (:as Text) /.string)) + (|>> (as Text) /.string)) (def: $String::primitive (Primitive java/lang/String) @@ -326,10 +326,10 @@ [expected (# ! each (i64.and (i64.mask <bits>)) random.nat)] (<| (_.lifted <message>) (..bytecode (for @.old - (|>> (:as <type>) <to_long> ("jvm leq" expected)) + (|>> (as <type>) <to_long> ("jvm leq" expected)) @.jvm - (|>> (:as <type>) <to_long> "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected)))))) + (|>> (as <type>) <to_long> "jvm object cast" ("jvm long =" ("jvm object cast" (as java/lang/Long expected)))))) (do /.monad [_ (<push> (|> expected .int <signed> try.trusted))] <wrap>))))] @@ -340,15 +340,15 @@ (template [<name> <type>] [(template: (<name> <old_extension> <new_extension>) - [(: (-> <type> <type> <type>) - (function (_ parameter subject) - (for @.old - (<old_extension> subject parameter) - - @.jvm - ("jvm object cast" - (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject))))))])] + [(is (-> <type> <type> <type>) + (function (_ parameter subject) + (for @.old + (<old_extension> subject parameter) + + @.jvm + ("jvm object cast" + (<new_extension> ("jvm object cast" parameter) + ("jvm object cast" subject))))))])] [int/2 java/lang/Integer] [long/2 java/lang/Long] @@ -357,66 +357,66 @@ ) (template: (int+long/2 <old_extension> <new_extension>) - [(: (-> java/lang/Integer java/lang/Long java/lang/Long) - (function (_ parameter subject) - (for @.old - (<old_extension> subject parameter) - - @.jvm - ("jvm object cast" - (<new_extension> ("jvm object cast" parameter) - ("jvm object cast" subject))))))]) + [(is (-> java/lang/Integer java/lang/Long java/lang/Long) + (function (_ parameter subject) + (for @.old + (<old_extension> subject parameter) + + @.jvm + ("jvm object cast" + (<new_extension> ("jvm object cast" parameter) + ("jvm object cast" subject))))))]) (def: int Test - (let [int (: (-> java/lang/Integer (Bytecode Any) (Random Bit)) - (function (_ expected bytecode) - (<| (..bytecode (for @.old - (|>> (:as java/lang/Integer) ("jvm ieq" expected)) - - @.jvm - (|>> (:as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" expected))))) - (do /.monad - [_ bytecode] - ..$Integer::wrap)))) - unary (: (-> (-> java/lang/Integer java/lang/Integer) (Bytecode Any) (Random Bit)) - (function (_ reference instruction) - (do random.monad - [subject ..$Integer::random] - (int (reference subject) - (do /.monad - [_ (..$Integer::literal subject)] - instruction))))) - binary (: (-> (-> java/lang/Integer java/lang/Integer java/lang/Integer) - (Bytecode Any) - (Random Bit)) + (let [int (is (-> java/lang/Integer (Bytecode Any) (Random Bit)) + (function (_ expected bytecode) + (<| (..bytecode (for @.old + (|>> (as java/lang/Integer) ("jvm ieq" expected)) + + @.jvm + (|>> (as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" expected))))) + (do /.monad + [_ bytecode] + ..$Integer::wrap)))) + unary (is (-> (-> java/lang/Integer java/lang/Integer) (Bytecode Any) (Random Bit)) (function (_ reference instruction) (do random.monad - [parameter ..$Integer::random + [subject ..$Integer::random] + (int (reference subject) + (do /.monad + [_ (..$Integer::literal subject)] + instruction))))) + binary (is (-> (-> java/lang/Integer java/lang/Integer java/lang/Integer) + (Bytecode Any) + (Random Bit)) + (function (_ reference instruction) + (do random.monad + [parameter ..$Integer::random + subject ..$Integer::random] + (int (reference parameter subject) + (do /.monad + [_ (..$Integer::literal subject) + _ (..$Integer::literal parameter)] + instruction))))) + shift (is (-> (-> java/lang/Integer java/lang/Integer java/lang/Integer) (Bytecode Any) (Random Bit)) + (function (_ reference instruction) + (do [! random.monad] + [parameter (# ! each (|>> (n.% 32) .int (as java/lang/Long) ffi.long_to_int) random.nat) subject ..$Integer::random] (int (reference parameter subject) (do /.monad [_ (..$Integer::literal subject) _ (..$Integer::literal parameter)] instruction))))) - shift (: (-> (-> java/lang/Integer java/lang/Integer java/lang/Integer) (Bytecode Any) (Random Bit)) - (function (_ reference instruction) - (do [! random.monad] - [parameter (# ! each (|>> (n.% 32) .int (:as java/lang/Long) ffi.long_to_int) random.nat) - subject ..$Integer::random] - (int (reference parameter subject) - (do /.monad - [_ (..$Integer::literal subject) - _ (..$Integer::literal parameter)] - instruction))))) literal ($_ _.and - (_.lifted "ICONST_M1" (int (ffi.long_to_int (:as java/lang/Long -1)) /.iconst_m1)) - (_.lifted "ICONST_0" (int (ffi.long_to_int (:as java/lang/Long +0)) /.iconst_0)) - (_.lifted "ICONST_1" (int (ffi.long_to_int (:as java/lang/Long +1)) /.iconst_1)) - (_.lifted "ICONST_2" (int (ffi.long_to_int (:as java/lang/Long +2)) /.iconst_2)) - (_.lifted "ICONST_3" (int (ffi.long_to_int (:as java/lang/Long +3)) /.iconst_3)) - (_.lifted "ICONST_4" (int (ffi.long_to_int (:as java/lang/Long +4)) /.iconst_4)) - (_.lifted "ICONST_5" (int (ffi.long_to_int (:as java/lang/Long +5)) /.iconst_5)) + (_.lifted "ICONST_M1" (int (ffi.long_to_int (as java/lang/Long -1)) /.iconst_m1)) + (_.lifted "ICONST_0" (int (ffi.long_to_int (as java/lang/Long +0)) /.iconst_0)) + (_.lifted "ICONST_1" (int (ffi.long_to_int (as java/lang/Long +1)) /.iconst_1)) + (_.lifted "ICONST_2" (int (ffi.long_to_int (as java/lang/Long +2)) /.iconst_2)) + (_.lifted "ICONST_3" (int (ffi.long_to_int (as java/lang/Long +3)) /.iconst_3)) + (_.lifted "ICONST_4" (int (ffi.long_to_int (as java/lang/Long +4)) /.iconst_4)) + (_.lifted "ICONST_5" (int (ffi.long_to_int (as java/lang/Long +5)) /.iconst_5)) (_.lifted "LDC_W/INTEGER" (do random.monad [expected ..$Integer::random] @@ -430,7 +430,7 @@ (_.lifted "INEG" (unary (function (_ value) ((int/2 "jvm isub" "jvm int -") value - (ffi.long_to_int (:as java/lang/Long +0)))) + (ffi.long_to_int (as java/lang/Long +0)))) /.ineg))) bitwise ($_ _.and (_.lifted "IAND" (binary (int/2 "jvm iand" "jvm int and") /.iand)) @@ -450,47 +450,47 @@ (def: long Test - (let [long (: (-> java/lang/Long (Bytecode Any) (Random Bit)) - (function (_ expected bytecode) - (<| (..bytecode (for @.old - (|>> (:as Int) (i.= expected)) - - @.jvm - (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected))))) - (do /.monad - [_ bytecode] - ..$Long::wrap)))) - unary (: (-> (-> java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) - (function (_ reference instruction) - (do random.monad - [subject ..$Long::random] - (long (reference subject) - (do /.monad - [_ (..$Long::literal subject)] - instruction))))) - binary (: (-> (-> java/lang/Long java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) + (let [long (is (-> java/lang/Long (Bytecode Any) (Random Bit)) + (function (_ expected bytecode) + (<| (..bytecode (for @.old + (|>> (as Int) (i.= expected)) + + @.jvm + (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected))))) + (do /.monad + [_ bytecode] + ..$Long::wrap)))) + unary (is (-> (-> java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) (function (_ reference instruction) (do random.monad - [parameter ..$Long::random + [subject ..$Long::random] + (long (reference subject) + (do /.monad + [_ (..$Long::literal subject)] + instruction))))) + binary (is (-> (-> java/lang/Long java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) + (function (_ reference instruction) + (do random.monad + [parameter ..$Long::random + subject ..$Long::random] + (long (reference parameter subject) + (do /.monad + [_ (..$Long::literal subject) + _ (..$Long::literal parameter)] + instruction))))) + shift (is (-> (-> java/lang/Integer java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) + (function (_ reference instruction) + (do [! random.monad] + [parameter (# ! each (|>> (n.% 64) (as java/lang/Long)) random.nat) subject ..$Long::random] - (long (reference parameter subject) + (long (reference (ffi.long_to_int parameter) subject) (do /.monad [_ (..$Long::literal subject) - _ (..$Long::literal parameter)] + _ (..$Integer::literal (ffi.long_to_int parameter))] instruction))))) - shift (: (-> (-> java/lang/Integer java/lang/Long java/lang/Long) (Bytecode Any) (Random Bit)) - (function (_ reference instruction) - (do [! random.monad] - [parameter (# ! each (|>> (n.% 64) (:as java/lang/Long)) random.nat) - subject ..$Long::random] - (long (reference (ffi.long_to_int parameter) subject) - (do /.monad - [_ (..$Long::literal subject) - _ (..$Integer::literal (ffi.long_to_int parameter))] - instruction))))) literal ($_ _.and - (_.lifted "LCONST_0" (long (:as java/lang/Long +0) /.lconst_0)) - (_.lifted "LCONST_1" (long (:as java/lang/Long +1) /.lconst_1)) + (_.lifted "LCONST_0" (long (as java/lang/Long +0) /.lconst_0)) + (_.lifted "LCONST_1" (long (as java/lang/Long +1) /.lconst_1)) (_.lifted "LDC2_W/LONG" (do random.monad [expected ..$Long::random] @@ -504,7 +504,7 @@ (_.lifted "LNEG" (unary (function (_ value) ((long/2 "jvm lsub" "jvm long -") value - (:as java/lang/Long +0))) + (as java/lang/Long +0))) /.lneg))) bitwise ($_ _.and (_.lifted "LAND" (binary (long/2 "jvm land" "jvm long and") /.land)) @@ -517,19 +517,19 @@ (do random.monad [reference ..$Long::random subject ..$Long::random - .let [expected (cond (i.= (:as Int reference) (:as Int subject)) - (:as java/lang/Long +0) + .let [expected (cond (i.= (as Int reference) (as Int subject)) + (as java/lang/Long +0) - (i.> (:as Int reference) (:as Int subject)) - (:as java/lang/Long +1) + (i.> (as Int reference) (as Int subject)) + (as java/lang/Long +1) - ... (i.< (:as Int reference) (:as Int subject)) - (:as java/lang/Long -1))]] + ... (i.< (as Int reference) (as Int subject)) + (as java/lang/Long -1))]] (<| (..bytecode (for @.old - (|>> (:as Int) (i.= expected)) + (|>> (as Int) (i.= expected)) @.jvm - (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected))))) + (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" expected))))) (do /.monad [_ (..$Long::literal subject) _ (..$Long::literal reference) @@ -549,48 +549,48 @@ (def: float Test - (let [float (: (-> java/lang/Float (Bytecode Any) (Random Bit)) - (function (_ expected bytecode) - (<| (..bytecode (for @.old - (function (_ actual) - (or (|> actual (:as java/lang/Float) ("jvm feq" expected)) - (and (f.not_a_number? (:as Frac (ffi.float_to_double expected))) - (f.not_a_number? (:as Frac (ffi.float_to_double (:as java/lang/Float actual))))))) - - @.jvm - (function (_ actual) - (or (|> actual (:as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" expected))) - (and (f.not_a_number? (:as Frac (ffi.float_to_double expected))) - (f.not_a_number? (:as Frac (ffi.float_to_double (:as java/lang/Float actual))))))))) - (do /.monad - [_ bytecode] - ..$Float::wrap)))) - unary (: (-> (-> java/lang/Float java/lang/Float) - (Bytecode Any) - (Random Bit)) - (function (_ reference instruction) - (do random.monad - [subject ..$Float::random] - (float (reference subject) - (do /.monad - [_ (..$Float::literal subject)] - instruction))))) - binary (: (-> (-> java/lang/Float java/lang/Float java/lang/Float) + (let [float (is (-> java/lang/Float (Bytecode Any) (Random Bit)) + (function (_ expected bytecode) + (<| (..bytecode (for @.old + (function (_ actual) + (or (|> actual (as java/lang/Float) ("jvm feq" expected)) + (and (f.not_a_number? (as Frac (ffi.float_to_double expected))) + (f.not_a_number? (as Frac (ffi.float_to_double (as java/lang/Float actual))))))) + + @.jvm + (function (_ actual) + (or (|> actual (as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" expected))) + (and (f.not_a_number? (as Frac (ffi.float_to_double expected))) + (f.not_a_number? (as Frac (ffi.float_to_double (as java/lang/Float actual))))))))) + (do /.monad + [_ bytecode] + ..$Float::wrap)))) + unary (is (-> (-> java/lang/Float java/lang/Float) (Bytecode Any) (Random Bit)) (function (_ reference instruction) (do random.monad - [parameter ..$Float::random - subject ..$Float::random] - (float (reference parameter subject) + [subject ..$Float::random] + (float (reference subject) (do /.monad - [_ (..$Float::literal subject) - _ (..$Float::literal parameter)] + [_ (..$Float::literal subject)] instruction))))) + binary (is (-> (-> java/lang/Float java/lang/Float java/lang/Float) + (Bytecode Any) + (Random Bit)) + (function (_ reference instruction) + (do random.monad + [parameter ..$Float::random + subject ..$Float::random] + (float (reference parameter subject) + (do /.monad + [_ (..$Float::literal subject) + _ (..$Float::literal parameter)] + instruction))))) literal ($_ _.and - (_.lifted "FCONST_0" (float (ffi.double_to_float (:as java/lang/Double +0.0)) /.fconst_0)) - (_.lifted "FCONST_1" (float (ffi.double_to_float (:as java/lang/Double +1.0)) /.fconst_1)) - (_.lifted "FCONST_2" (float (ffi.double_to_float (:as java/lang/Double +2.0)) /.fconst_2)) + (_.lifted "FCONST_0" (float (ffi.double_to_float (as java/lang/Double +0.0)) /.fconst_0)) + (_.lifted "FCONST_1" (float (ffi.double_to_float (as java/lang/Double +1.0)) /.fconst_1)) + (_.lifted "FCONST_2" (float (ffi.double_to_float (as java/lang/Double +2.0)) /.fconst_2)) (_.lifted "LDC_W/FLOAT" (do random.monad [expected ..$Float::random] @@ -604,38 +604,38 @@ (_.lifted "FNEG" (unary (function (_ value) ((float/2 "jvm fsub" "jvm float -") value - (ffi.double_to_float (:as java/lang/Double +0.0)))) + (ffi.double_to_float (as java/lang/Double +0.0)))) /.fneg))) - comparison (: (-> (Bytecode Any) (-> java/lang/Float java/lang/Float Bit) (Random Bit)) - (function (_ instruction standard) - (do random.monad - [.let [valid_float (random.only (|>> ffi.float_to_double (:as Frac) f.not_a_number? not) - ..$Float::random)] - reference valid_float - subject valid_float - .let [expected (if (for @.old - ("jvm feq" reference subject) - - @.jvm - ("jvm float =" ("jvm object cast" reference) ("jvm object cast" subject))) - +0 - (if (standard reference subject) - +1 - -1))]] - (<| (..bytecode (|>> (:as Int) (i.= expected))) - (do /.monad - [_ (..$Float::literal subject) - _ (..$Float::literal reference) - _ instruction - _ /.i2l] - ..$Long::wrap))))) - comparison_standard (: (-> java/lang/Float java/lang/Float Bit) - (function (_ reference subject) - (for @.old - ("jvm fgt" subject reference) - - @.jvm - ("jvm float <" ("jvm object cast" subject) ("jvm object cast" reference))))) + comparison (is (-> (Bytecode Any) (-> java/lang/Float java/lang/Float Bit) (Random Bit)) + (function (_ instruction standard) + (do random.monad + [.let [valid_float (random.only (|>> ffi.float_to_double (as Frac) f.not_a_number? not) + ..$Float::random)] + reference valid_float + subject valid_float + .let [expected (if (for @.old + ("jvm feq" reference subject) + + @.jvm + ("jvm float =" ("jvm object cast" reference) ("jvm object cast" subject))) + +0 + (if (standard reference subject) + +1 + -1))]] + (<| (..bytecode (|>> (as Int) (i.= expected))) + (do /.monad + [_ (..$Float::literal subject) + _ (..$Float::literal reference) + _ instruction + _ /.i2l] + ..$Long::wrap))))) + comparison_standard (is (-> java/lang/Float java/lang/Float Bit) + (function (_ reference subject) + (for @.old + ("jvm fgt" subject reference) + + @.jvm + ("jvm float <" ("jvm object cast" subject) ("jvm object cast" reference))))) comparison ($_ _.and (_.lifted "FCMPL" (comparison /.fcmpl comparison_standard)) (_.lifted "FCMPG" (comparison /.fcmpg comparison_standard)))] @@ -650,43 +650,43 @@ (def: double Test - (let [double (: (-> java/lang/Double (Bytecode Any) (Random Bit)) - (function (_ expected bytecode) - (<| (..bytecode (for @.old - (function (_ actual) - (or (|> actual (:as java/lang/Double) ("jvm deq" expected)) - (and (f.not_a_number? (:as Frac expected)) - (f.not_a_number? (:as Frac actual))))) - - @.jvm - (function (_ actual) - (or (|> actual (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))) - (and (f.not_a_number? (:as Frac expected)) - (f.not_a_number? (:as Frac actual))))))) - (do /.monad - [_ bytecode] - ..$Double::wrap)))) - unary (: (-> (-> java/lang/Double java/lang/Double) (Bytecode Any) (Random Bit)) - (function (_ reference instruction) - (do random.monad - [subject ..$Double::random] - (double (reference subject) - (do /.monad - [_ (..$Double::literal subject)] - instruction))))) - binary (: (-> (-> java/lang/Double java/lang/Double java/lang/Double) (Bytecode Any) (Random Bit)) + (let [double (is (-> java/lang/Double (Bytecode Any) (Random Bit)) + (function (_ expected bytecode) + (<| (..bytecode (for @.old + (function (_ actual) + (or (|> actual (as java/lang/Double) ("jvm deq" expected)) + (and (f.not_a_number? (as Frac expected)) + (f.not_a_number? (as Frac actual))))) + + @.jvm + (function (_ actual) + (or (|> actual (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))) + (and (f.not_a_number? (as Frac expected)) + (f.not_a_number? (as Frac actual))))))) + (do /.monad + [_ bytecode] + ..$Double::wrap)))) + unary (is (-> (-> java/lang/Double java/lang/Double) (Bytecode Any) (Random Bit)) (function (_ reference instruction) (do random.monad - [parameter ..$Double::random - subject ..$Double::random] - (double (reference parameter subject) + [subject ..$Double::random] + (double (reference subject) (do /.monad - [_ (..$Double::literal subject) - _ (..$Double::literal parameter)] + [_ (..$Double::literal subject)] instruction))))) + binary (is (-> (-> java/lang/Double java/lang/Double java/lang/Double) (Bytecode Any) (Random Bit)) + (function (_ reference instruction) + (do random.monad + [parameter ..$Double::random + subject ..$Double::random] + (double (reference parameter subject) + (do /.monad + [_ (..$Double::literal subject) + _ (..$Double::literal parameter)] + instruction))))) literal ($_ _.and - (_.lifted "DCONST_0" (double (:as java/lang/Double +0.0) /.dconst_0)) - (_.lifted "DCONST_1" (double (:as java/lang/Double +1.0) /.dconst_1)) + (_.lifted "DCONST_0" (double (as java/lang/Double +0.0) /.dconst_0)) + (_.lifted "DCONST_1" (double (as java/lang/Double +1.0) /.dconst_1)) (_.lifted "LDC2_W/DOUBLE" (do random.monad [expected ..$Double::random] @@ -700,37 +700,37 @@ (_.lifted "DNEG" (unary (function (_ value) ((double/2 "jvm dsub" "jvm double -") value - (:as java/lang/Double +0.0))) + (as java/lang/Double +0.0))) /.dneg))) - comparison (: (-> (Bytecode Any) (-> java/lang/Double java/lang/Double Bit) (Random Bit)) - (function (_ instruction standard) - (do random.monad - [reference ..valid_double - subject ..valid_double - .let [expected (if (for @.old - ("jvm deq" reference subject) - - @.jvm - ("jvm double =" ("jvm object cast" reference) ("jvm object cast" subject))) - +0 - (if (standard reference subject) - +1 - -1))]] - (<| (..bytecode (|>> (:as Int) (i.= expected))) - (do /.monad - [_ (..$Double::literal subject) - _ (..$Double::literal reference) - _ instruction - _ /.i2l] - ..$Long::wrap))))) + comparison (is (-> (Bytecode Any) (-> java/lang/Double java/lang/Double Bit) (Random Bit)) + (function (_ instruction standard) + (do random.monad + [reference ..valid_double + subject ..valid_double + .let [expected (if (for @.old + ("jvm deq" reference subject) + + @.jvm + ("jvm double =" ("jvm object cast" reference) ("jvm object cast" subject))) + +0 + (if (standard reference subject) + +1 + -1))]] + (<| (..bytecode (|>> (as Int) (i.= expected))) + (do /.monad + [_ (..$Double::literal subject) + _ (..$Double::literal reference) + _ instruction + _ /.i2l] + ..$Long::wrap))))) ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.dcmp_op - comparison_standard (: (-> java/lang/Double java/lang/Double Bit) - (function (_ reference subject) - (for @.old - ("jvm dgt" subject reference) - - @.jvm - ("jvm double <" ("jvm object cast" subject) ("jvm object cast" reference))))) + comparison_standard (is (-> java/lang/Double java/lang/Double Bit) + (function (_ reference subject) + (for @.old + ("jvm dgt" subject reference) + + @.jvm + ("jvm double <" ("jvm object cast" subject) ("jvm object cast" reference))))) comparison ($_ _.and (_.lifted "DCMPL" (comparison /.dcmpl comparison_standard)) (_.lifted "DCMPG" (comparison /.dcmpg comparison_standard)))] @@ -762,14 +762,14 @@ (def: object Test - (let [!object (: (Bytecode Any) - (do /.monad - [_ (/.new ..$Object) - _ /.dup] - (/.invokespecial ..$Object "<init>" (/type.method [(list) (list) /type.void (list)]))))] + (let [!object (is (Bytecode Any) + (do /.monad + [_ (/.new ..$Object) + _ /.dup] + (/.invokespecial ..$Object "<init>" (/type.method [(list) (list) /type.void (list)]))))] ($_ _.and (<| (_.lifted "ACONST_NULL") - (..bytecode (|>> (:as Bit) not)) + (..bytecode (|>> (as Bit) not)) (do /.monad [_ /.aconst_null _ (/.instanceof ..$String)] @@ -777,13 +777,13 @@ (<| (_.lifted "INSTANCEOF") (do random.monad [value ..$String::random]) - (..bytecode (|>> (:as Bit))) + (..bytecode (|>> (as Bit))) (do /.monad - [_ (/.string (:as Text value)) + [_ (/.string (as Text value)) _ (/.instanceof ..$String)] ..$Boolean::wrap)) (<| (_.lifted "NEW & CHECKCAST") - (..bytecode (|>> (:as Bit))) + (..bytecode (|>> (as Bit))) (do /.monad [_ !object _ (/.checkcast ..$Object) @@ -792,9 +792,9 @@ (<| (_.lifted "MONITORENTER & MONITOREXIT") (do random.monad [value ..$String::random]) - (..bytecode (|>> (:as Bit))) + (..bytecode (|>> (as Bit))) (do /.monad - [_ (/.string (:as Text value)) + [_ (/.string (as Text value)) _ /.dup _ /.monitorenter _ /.dup _ /.monitorexit _ (/.instanceof ..$String)] @@ -806,20 +806,20 @@ ($_ _.and (<| (_.lifted "INVOKESTATIC") (do random.monad - [expected (random.only (|>> (:as Frac) f.not_a_number? not) + [expected (random.only (|>> (as Frac) f.not_a_number? not) ..$Double::random)]) (..bytecode (for @.old - (|>> (:as java/lang/Double) ("jvm deq" expected)) + (|>> (as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))))) + (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))))) (do /.monad [_ (/.double expected)] (/.invokestatic ..$Double "valueOf" (/type.method [(list) (list /type.double) ..$Double (list)])))) (<| (_.lifted "INVOKEVIRTUAL") (do random.monad [expected ..$Double::random]) - (..bytecode (|>> (:as Bit) (bit#= (f.not_a_number? (:as Frac expected))))) + (..bytecode (|>> (as Bit) (bit#= (f.not_a_number? (as Frac expected))))) (do /.monad [_ (/.double expected) _ ..$Double::wrap @@ -827,13 +827,13 @@ ..$Boolean::wrap)) (<| (_.lifted "INVOKESPECIAL") (do random.monad - [expected (random.only (|>> (:as Frac) f.not_a_number? not) + [expected (random.only (|>> (as Frac) f.not_a_number? not) ..$Double::random)]) (..bytecode (for @.old - (|>> (:as java/lang/Double) ("jvm deq" expected)) + (|>> (as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))))) + (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" expected))))) (do /.monad [_ (/.new ..$Double) _ /.dup @@ -842,9 +842,9 @@ (<| (_.lifted "INVOKEINTERFACE") (do random.monad [subject ..$String::random]) - (..bytecode (|>> (:as Nat) (n.= (text.size (:as Text subject))))) + (..bytecode (|>> (as Nat) (n.= (text.size (as Text subject))))) (do /.monad - [_ (/.string (:as Text subject)) + [_ (/.string (as Text subject)) _ (/.invokeinterface (/type.class "java.lang.CharSequence" (list)) "length" (/type.method [(list) (list) /type.int (list)])) _ /.i2l] ..$Long::wrap)) @@ -856,13 +856,13 @@ [class_name ..class_name part0 ..$Long::random part1 ..$Long::random - .let [expected (: java/lang/Long - (for @.old - ("jvm ladd" part0 part1) - - @.jvm - ("jvm object cast" - ("jvm long +" ("jvm object cast" part0) ("jvm object cast" part1))))) + .let [expected (is java/lang/Long + (for @.old + ("jvm ladd" part0 part1) + + @.jvm + ("jvm object cast" + ("jvm long +" ("jvm object cast" part0) ("jvm object cast" part1))))) $Self (/type.class class_name (list)) class_field "class_field" object_field "object_field" @@ -915,124 +915,124 @@ class (io.run! (/loader.load class_name loader)) method (try (get_method static_method class)) output (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)] - (in (:as Int output))) + (in (as Int output))) {try.#Success actual} - (i.= (:as Int expected) (:as Int actual)) + (i.= (as Int expected) (as Int actual)) {try.#Failure error} false)))) (def: array Test - (let [!length (: (-> Nat (Bytecode Any)) - (function (_ size) - (do /.monad - [_ ($Long::literal (:as java/lang/Long size))] - /.l2i))) - ?length (: (Bytecode Any) - (do /.monad - [_ /.arraylength] - /.i2l)) - length (: (-> Nat (Bytecode Any) (Random Bit)) - (function (_ size constructor) - (<| (..bytecode (|>> (:as Nat) (n.= size))) - (do /.monad - [_ (!length size) - _ constructor - _ ?length] - $Long::wrap)))) - write_and_read (: (All (_ a) - (-> Nat (Bytecode Any) - a (-> a (Bytecode Any)) - [(Bytecode Any) (Bytecode Any) (Bytecode Any)] - (-> a Any Bit) - (Random Bit))) - (function (_ size constructor value literal [*store *load *wrap] test) - (let [!index ($Integer::literal (ffi.long_to_int (:as java/lang/Long +0)))] - (<| (..bytecode (test value)) - (do /.monad - [_ (!length size) - _ constructor - _ /.dup _ !index _ (literal value) _ *store - _ /.dup _ !index _ *load] - *wrap))))) - array (: (All (_ a) - (-> (Bytecode Any) (Random a) (-> a (Bytecode Any)) - [(Bytecode Any) (Bytecode Any) (Bytecode Any)] - (-> a Any Bit) - Test)) - (function (_ constructor random literal [*store *load *wrap] test) - (do [! random.monad] - [size (# ! each (|>> (n.% 1024) (n.max 1)) random.nat) - value random] - ($_ _.and - (<| (_.lifted "length") - (length size constructor)) - (<| (_.lifted "write and read") - (write_and_read size constructor value literal [*store *load *wrap] test))))))] + (let [!length (is (-> Nat (Bytecode Any)) + (function (_ size) + (do /.monad + [_ ($Long::literal (as java/lang/Long size))] + /.l2i))) + ?length (is (Bytecode Any) + (do /.monad + [_ /.arraylength] + /.i2l)) + length (is (-> Nat (Bytecode Any) (Random Bit)) + (function (_ size constructor) + (<| (..bytecode (|>> (as Nat) (n.= size))) + (do /.monad + [_ (!length size) + _ constructor + _ ?length] + $Long::wrap)))) + write_and_read (is (All (_ a) + (-> Nat (Bytecode Any) + a (-> a (Bytecode Any)) + [(Bytecode Any) (Bytecode Any) (Bytecode Any)] + (-> a Any Bit) + (Random Bit))) + (function (_ size constructor value literal [*store *load *wrap] test) + (let [!index ($Integer::literal (ffi.long_to_int (as java/lang/Long +0)))] + (<| (..bytecode (test value)) + (do /.monad + [_ (!length size) + _ constructor + _ /.dup _ !index _ (literal value) _ *store + _ /.dup _ !index _ *load] + *wrap))))) + array (is (All (_ a) + (-> (Bytecode Any) (Random a) (-> a (Bytecode Any)) + [(Bytecode Any) (Bytecode Any) (Bytecode Any)] + (-> a Any Bit) + Test)) + (function (_ constructor random literal [*store *load *wrap] test) + (do [! random.monad] + [size (# ! each (|>> (n.% 1024) (n.max 1)) random.nat) + value random] + ($_ _.and + (<| (_.lifted "length") + (length size constructor)) + (<| (_.lifted "write and read") + (write_and_read size constructor value literal [*store *load *wrap] test))))))] ($_ _.and (_.context "boolean" (array (/.newarray /instruction.t_boolean) $Boolean::random $Boolean::literal [/.bastore /.baload $Boolean::wrap] - (function (_ expected) (|>> (:as Bit) (bit#= (:as Bit expected)))))) + (function (_ expected) (|>> (as Bit) (bit#= (as Bit expected)))))) (_.context "byte" (array (/.newarray /instruction.t_byte) $Byte::random $Byte::literal [/.bastore /.baload $Byte::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) + (|>> (as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) @.jvm - (|>> (:as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (:as java/lang/Byte expected))))))))) + (|>> (as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (as java/lang/Byte expected))))))))) (_.context "short" (array (/.newarray /instruction.t_short) $Short::random $Short::literal [/.sastore /.saload $Short::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) + (|>> (as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) @.jvm - (|>> (:as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (:as java/lang/Short expected))))))))) + (|>> (as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (as java/lang/Short expected))))))))) (_.context "int" (array (/.newarray /instruction.t_int) $Integer::random $Integer::literal [/.iastore /.iaload $Integer::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Integer) ("jvm ieq" (:as java/lang/Integer expected))) + (|>> (as java/lang/Integer) ("jvm ieq" (as java/lang/Integer expected))) @.jvm - (|>> (:as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (:as java/lang/Integer expected)))))))) + (|>> (as java/lang/Integer) "jvm object cast" ("jvm int =" ("jvm object cast" (as java/lang/Integer expected)))))))) (_.context "long" (array (/.newarray /instruction.t_long) $Long::random $Long::literal [/.lastore /.laload $Long::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Long) ("jvm leq" expected)) + (|>> (as java/lang/Long) ("jvm leq" expected)) @.jvm - (|>> (:as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (:as java/lang/Long expected)))))))) + (|>> (as java/lang/Long) "jvm object cast" ("jvm long =" ("jvm object cast" (as java/lang/Long expected)))))))) (_.context "float" (array (/.newarray /instruction.t_float) ..valid_float $Float::literal [/.fastore /.faload $Float::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Float) ("jvm feq" expected)) + (|>> (as java/lang/Float) ("jvm feq" expected)) @.jvm - (|>> (:as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (:as java/lang/Float expected)))))))) + (|>> (as java/lang/Float) "jvm object cast" ("jvm float =" ("jvm object cast" (as java/lang/Float expected)))))))) (_.context "double" (array (/.newarray /instruction.t_double) ..valid_double $Double::literal [/.dastore /.daload $Double::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Double) ("jvm deq" expected)) + (|>> (as java/lang/Double) ("jvm deq" expected)) @.jvm - (|>> (:as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (:as java/lang/Double expected)))))))) + (|>> (as java/lang/Double) "jvm object cast" ("jvm double =" ("jvm object cast" (as java/lang/Double expected)))))))) (_.context "char" (array (/.newarray /instruction.t_char) $Character::random $Character::literal [/.castore /.caload $Character::wrap] (function (_ expected) (for @.old - (|>> (:as java/lang/Character) ("jvm ceq" expected)) + (|>> (as java/lang/Character) ("jvm ceq" expected)) @.jvm - (|>> (:as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (:as java/lang/Character expected)))))))) + (|>> (as java/lang/Character) "jvm object cast" ("jvm char =" ("jvm object cast" (as java/lang/Character expected)))))))) (_.context "object" (array (/.anewarray ..$String) $String::random $String::literal [/.aastore /.aaload /.nop] - (function (_ expected) (|>> (:as Text) (text#= (:as Text expected)))))) + (function (_ expected) (|>> (as Text) (text#= (as Text expected)))))) (<| (_.context "multi") (do [! random.monad] [.let [size (# ! each (|>> (n.% 5) (n.+ 1)) @@ -1041,15 +1041,15 @@ sizesH size sizesT (random.list (-- dimensions) size) .let [type (loop [dimensions dimensions - type (: (Type Object) - ..$Object)] + type (is (Type Object) + ..$Object)] (case dimensions 0 type _ (again (-- dimensions) (/type.array type))))]] (<| (_.lifted "MULTIANEWARRAY") - (..bytecode (|>> (:as Nat) (n.= sizesH))) + (..bytecode (|>> (as Nat) (n.= sizesH))) (do [! /.monad] - [_ (monad.each ! (|>> (:as java/lang/Long) ffi.long_to_int ..$Integer::literal) + [_ (monad.each ! (|>> (as java/lang/Long) ffi.long_to_int ..$Integer::literal) {.#Item sizesH sizesT}) _ (/.multianewarray type (|> dimensions /unsigned.u1 try.trusted)) _ ?length] @@ -1057,27 +1057,27 @@ ))) (template: (!::= <type> <old> <new>) - [(: (-> <type> Any Bit) - (function (_ expected) - (for @.old - (|>> (:as <type>) (<old> expected)) - - @.jvm - (|>> (:as <type>) "jvm object cast" (<new> ("jvm object cast" (:as <type> expected)))))))]) + [(is (-> <type> Any Bit) + (function (_ expected) + (for @.old + (|>> (as <type>) (<old> expected)) + + @.jvm + (|>> (as <type>) "jvm object cast" (<new> ("jvm object cast" (as <type> expected)))))))]) (def: conversion Test - (let [conversion (: (All (_ a z) - (-> (Primitive a) (Primitive z) (Bytecode Any) (-> a z) (-> z Any Bit) (Random Bit))) - (function (_ from to instruction convert test) - (do random.monad - [input (the #random from) - .let [expected (convert input)]] - (..bytecode (test expected) - (do /.monad - [_ ((the #literal from) input) - _ instruction] - (the #wrap to)))))) + (let [conversion (is (All (_ a z) + (-> (Primitive a) (Primitive z) (Bytecode Any) (-> a z) (-> z Any Bit) (Random Bit))) + (function (_ from to instruction convert test) + (do random.monad + [input (the #random from) + .let [expected (convert input)]] + (..bytecode (test expected) + (do /.monad + [_ ((the #literal from) input) + _ instruction] + (the #wrap to)))))) int::= (!::= java/lang/Integer "jvm ieq" "jvm int =") long::= (!::= java/lang/Long "jvm leq" "jvm long =") float::= (!::= java/lang/Float "jvm feq" "jvm float =") @@ -1091,19 +1091,19 @@ (_.lifted "I2B" (conversion ..$Integer::primitive ..$Byte::primitive /.i2b (|>> ffi.int_to_byte) (function (_ expected) (for @.old - (|>> (:as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) + (|>> (as java/lang/Byte) ffi.byte_to_long ("jvm leq" (ffi.byte_to_long expected))) @.jvm - (|>> (:as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (:as java/lang/Byte expected))))))))) + (|>> (as java/lang/Byte) ffi.byte_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.byte_to_long (as java/lang/Byte expected))))))))) (_.lifted "I2C" (conversion ..$Integer::primitive ..$Character::primitive /.i2c (|>> ffi.int_to_char) (!::= java/lang/Character "jvm ceq" "jvm char ="))) (_.lifted "I2S" (conversion ..$Integer::primitive ..$Short::primitive /.i2s (|>> ffi.int_to_short) (function (_ expected) (for @.old - (|>> (:as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) + (|>> (as java/lang/Short) ffi.short_to_long ("jvm leq" (ffi.short_to_long expected))) @.jvm - (|>> (:as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (:as java/lang/Short expected))))))))))) + (|>> (as java/lang/Short) ffi.short_to_long "jvm object cast" ("jvm long =" ("jvm object cast" (ffi.short_to_long (as java/lang/Short expected))))))))))) (<| (_.context "long") ($_ _.and (_.lifted "L2I" (conversion ..$Long::primitive ..$Integer::primitive /.l2i (|>> ffi.long_to_int) int::=)) @@ -1140,21 +1140,21 @@ (def: registry Test - (let [store_and_load (: (All (_ a) - (-> (Random a) (-> a (Bytecode Any)) (Bytecode Any) - [(-> Nat (Bytecode Any)) (-> Nat (Bytecode Any))] - (-> a (-> Any Bit)) - (Random Bit))) - (function (_ random_value literal *wrap [store load] test) - (do [! random.monad] - [expected random_value - register (# ! each (n.% 128) random.nat)] - (<| (..bytecode (test expected)) - (do /.monad - [_ (literal expected) - _ (store register) - _ (load register)] - *wrap)))))] + (let [store_and_load (is (All (_ a) + (-> (Random a) (-> a (Bytecode Any)) (Bytecode Any) + [(-> Nat (Bytecode Any)) (-> Nat (Bytecode Any))] + (-> a (-> Any Bit)) + (Random Bit))) + (function (_ random_value literal *wrap [store load] test) + (do [! random.monad] + [expected random_value + register (# ! each (n.% 128) random.nat)] + (<| (..bytecode (test expected)) + (do /.monad + [_ (literal expected) + _ (store register) + _ (load register)] + *wrap)))))] ($_ _.and (<| (_.context "int") (let [test (!::= java/lang/Integer "jvm ieq" "jvm int =")] @@ -1174,18 +1174,18 @@ [base ..$Byte::random increment (# ! each (|>> (n.% 100) /unsigned.u1 try.trusted) random.nat) - .let [expected (: java/lang/Long - (for @.old - ("jvm ladd" - (ffi.byte_to_long base) - (.int (/unsigned.value increment))) - - @.jvm - ("jvm object cast" - ("jvm long +" - ("jvm object cast" (ffi.byte_to_long base)) - ("jvm object cast" (:as java/lang/Long (/unsigned.value increment)))))))]] - (..bytecode (|>> (:as Int) (i.= (:as Int expected))) + .let [expected (is java/lang/Long + (for @.old + ("jvm ladd" + (ffi.byte_to_long base) + (.int (/unsigned.value increment))) + + @.jvm + ("jvm object cast" + ("jvm long +" + ("jvm object cast" (ffi.byte_to_long base)) + ("jvm object cast" (as java/lang/Long (/unsigned.value increment)))))))]] + (..bytecode (|>> (as Int) (i.= (as Int expected))) (do /.monad [_ (..$Byte::literal base) _ /.istore_0 @@ -1233,9 +1233,9 @@ (_.lifted "DSTORE/DLOAD" (store_and_load ..valid_double ..$Double::literal ..$Double::wrap [/.dstore /.dload] test))))) (<| (_.context "object") - (let [test (: (-> java/lang/String Any Bit) - (function (_ expected actual) - (|> actual (:as Text) (text#= (:as Text expected)))))] + (let [test (is (-> java/lang/String Any Bit) + (function (_ expected actual) + (|> actual (as Text) (text#= (as Text expected)))))] ($_ _.and (_.lifted "ASTORE_0/ALOAD_0" (store_and_load ..$String::random ..$String::literal /.nop [(function.constant /.astore_0) (function.constant /.aload_0)] test)) @@ -1253,8 +1253,8 @@ Test (do random.monad [expected/1 $String::random - .let [object_test (: (-> Any Bit) - (|>> (:as Text) (text#= (:as Text expected/1))))] + .let [object_test (is (-> Any Bit) + (|>> (as Text) (text#= (as Text expected/1))))] dummy/1 $String::random .let [single ($_ _.and (<| (_.lifted "DUP & POP") @@ -1288,8 +1288,8 @@ /.pop)) )] expected/2 $Long::random - .let [long_test (: (-> Any Bit) - (|>> (:as Int) (i.= (:as Int expected/2))))] + .let [long_test (is (-> Any Bit) + (|>> (as Int) (i.= (as Int expected/2))))] dummy/2 $Long::random .let [double ($_ _.and (<| (_.lifted "DUP2") @@ -1336,72 +1336,72 @@ (def: return Test - (let [primitive_return (: (All (_ a) (-> (Primitive a) (Bytecode Any) (Maybe (-> a (Bytecode Any))) (-> a Any Bit) (Random Bit))) - (function (_ primitive return substitute test) - (do random.monad - [class_name ..class_name - primitive_method_name (random.ascii/upper 10) - .let [primitive_method_type (/type.method [(list) (list) (the #unboxed primitive) (list)])] - object_method_name (|> (random.ascii/upper 10) - (random.only (|>> (text#= primitive_method_name) not))) - expected (the #random primitive) - .let [$Self (/type.class class_name (list))]] - (in (case (do try.monad - [class (/class.class /version.v6_0 /class.public - (/name.internal class_name) - {.#None} - (/name.internal "java.lang.Object") - (list) - (list) - (list (/method.method ..method_modifier - primitive_method_name - #0 primitive_method_type - (list) - {.#Some (do /.monad - [_ ((the #literal primitive) expected)] - return)}) - (/method.method ..method_modifier - object_method_name - #0 (/type.method [(list) (list) (the #boxed primitive) (list)]) - (list) - {.#Some (do /.monad - [_ (/.invokestatic $Self primitive_method_name primitive_method_type) - _ (case substitute - {.#None} - (in []) - - {.#Some substitute} - (substitute expected)) - _ (the #wrap primitive)] - /.areturn)})) - (sequence.sequence)) - .let [bytecode (format.result /class.writer class) - loader (/loader.memory (/loader.new_library []))] - _ (/loader.define class_name bytecode loader) - class (io.run! (/loader.load class_name loader)) - method (try (get_method object_method_name class))] - (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) - {try.#Success actual} - (test expected actual) - - {try.#Failure error} - false) - ))))] + (let [primitive_return (is (All (_ a) (-> (Primitive a) (Bytecode Any) (Maybe (-> a (Bytecode Any))) (-> a Any Bit) (Random Bit))) + (function (_ primitive return substitute test) + (do random.monad + [class_name ..class_name + primitive_method_name (random.ascii/upper 10) + .let [primitive_method_type (/type.method [(list) (list) (the #unboxed primitive) (list)])] + object_method_name (|> (random.ascii/upper 10) + (random.only (|>> (text#= primitive_method_name) not))) + expected (the #random primitive) + .let [$Self (/type.class class_name (list))]] + (in (case (do try.monad + [class (/class.class /version.v6_0 /class.public + (/name.internal class_name) + {.#None} + (/name.internal "java.lang.Object") + (list) + (list) + (list (/method.method ..method_modifier + primitive_method_name + #0 primitive_method_type + (list) + {.#Some (do /.monad + [_ ((the #literal primitive) expected)] + return)}) + (/method.method ..method_modifier + object_method_name + #0 (/type.method [(list) (list) (the #boxed primitive) (list)]) + (list) + {.#Some (do /.monad + [_ (/.invokestatic $Self primitive_method_name primitive_method_type) + _ (case substitute + {.#None} + (in []) + + {.#Some substitute} + (substitute expected)) + _ (the #wrap primitive)] + /.areturn)})) + (sequence.sequence)) + .let [bytecode (format.result /class.writer class) + loader (/loader.memory (/loader.new_library []))] + _ (/loader.define class_name bytecode loader) + class (io.run! (/loader.load class_name loader)) + method (try (get_method object_method_name class))] + (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) + {try.#Success actual} + (test expected actual) + + {try.#Failure error} + false) + ))))] ($_ _.and (_.lifted "IRETURN" (primitive_return ..$Integer::primitive /.ireturn {.#None} (!::= java/lang/Integer "jvm ieq" "jvm int ="))) (_.lifted "LRETURN" (primitive_return ..$Long::primitive /.lreturn {.#None} (!::= java/lang/Long "jvm leq" "jvm long ="))) (_.lifted "FRETURN" (primitive_return ..$Float::primitive /.freturn {.#None} (!::= java/lang/Float "jvm feq" "jvm float ="))) (_.lifted "DRETURN" (primitive_return ..$Double::primitive /.dreturn {.#None} (!::= java/lang/Double "jvm deq" "jvm double ="))) - (_.lifted "ARETURN" (primitive_return ..$String::primitive /.areturn {.#None} (function (_ expected actual) (text#= (:as Text expected) (:as Text actual))))) - (_.lifted "RETURN" (primitive_return (: (Primitive java/lang/String) - [#unboxed /type.void - #boxed ..$String - #wrap /.nop - #random ..$String::random - #literal (function.constant /.nop)]) + (_.lifted "ARETURN" (primitive_return ..$String::primitive /.areturn {.#None} (function (_ expected actual) (text#= (as Text expected) (as Text actual))))) + (_.lifted "RETURN" (primitive_return (is (Primitive java/lang/String) + [#unboxed /type.void + #boxed ..$String + #wrap /.nop + #random ..$String::random + #literal (function.constant /.nop)]) /.return {.#Some ..$String::literal} - (function (_ expected actual) (text#= (:as Text expected) (:as Text actual))))) + (function (_ expected actual) (text#= (as Text expected) (as Text actual))))) ))) (def: branching @@ -1409,20 +1409,20 @@ (do random.monad [expected ..$Long::random dummy ..$Long::random - .let [if! (: (-> (-> Label (Bytecode Any)) (Bytecode Any) (Random Bit)) - (function (_ instruction prelude) - (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) - (do /.monad - [@then /.new_label - @end /.new_label - _ prelude - _ (instruction @then) - _ (..$Long::literal dummy) - _ (/.goto @end) - _ (/.set_label @then) - _ (..$Long::literal expected) - _ (/.set_label @end)] - ..$Long::wrap)))) + .let [if! (is (-> (-> Label (Bytecode Any)) (Bytecode Any) (Random Bit)) + (function (_ instruction prelude) + (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (do /.monad + [@then /.new_label + @end /.new_label + _ prelude + _ (instruction @then) + _ (..$Long::literal dummy) + _ (/.goto @end) + _ (/.set_label @then) + _ (..$Long::literal expected) + _ (/.set_label @end)] + ..$Long::wrap)))) comparison_against_zero ($_ _.and (_.lifted "IFEQ" (if! /.ifeq /.iconst_0)) (_.lifted "IFNE" (if! /.ifne /.iconst_1)) @@ -1450,11 +1450,11 @@ (_.lifted "IF_ICMPLE" (if! /.if_icmple (do /.monad [_ (..$Integer::literal lesser)] (..$Integer::literal greater)))) (_.lifted "IF_ICMPGT" (if! /.if_icmpgt (do /.monad [_ (..$Integer::literal greater)] (..$Integer::literal lesser)))) (_.lifted "IF_ICMPGE" (if! /.if_icmpge (do /.monad [_ (..$Integer::literal greater)] (..$Integer::literal lesser))))) - new_object (: (Bytecode Any) - (do /.monad - [_ (/.new ..$Object) - _ /.dup] - (/.invokespecial ..$Object "<init>" (/type.method [(list) (list) /type.void (list)])))) + new_object (is (Bytecode Any) + (do /.monad + [_ (/.new ..$Object) + _ /.dup] + (/.invokespecial ..$Object "<init>" (/type.method [(list) (list) /type.void (list)])))) reference_comparison ($_ _.and (_.lifted "IF_ACMPEQ" (if! /.if_acmpeq (do /.monad [_ new_object] /.dup))) (_.lifted "IF_ACMPNE" (if! /.if_acmpne (do /.monad [_ new_object] new_object))) @@ -1471,21 +1471,21 @@ (do random.monad [expected ..$Long::random dummy ..$Long::random - .let [jump (: (-> (-> Label (Bytecode Any)) (Random Bit)) - (function (_ goto) - (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) - (do /.monad - [@skipped /.new_label - @value /.new_label - @end /.new_label - _ (goto @value) - _ (/.set_label @skipped) - _ (..$Long::literal dummy) - _ (goto @end) - _ (/.set_label @value) - _ (..$Long::literal expected) - _ (/.set_label @end)] - ..$Long::wrap))))]] + .let [jump (is (-> (-> Label (Bytecode Any)) (Random Bit)) + (function (_ goto) + (<| (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) + (do /.monad + [@skipped /.new_label + @value /.new_label + @end /.new_label + _ (goto @value) + _ (/.set_label @skipped) + _ (..$Long::literal dummy) + _ (goto @end) + _ (/.set_label @value) + _ (..$Long::literal expected) + _ (/.set_label @end)] + ..$Long::wrap))))]] ($_ _.and (_.lifted "GOTO" (jump /.goto)) (_.lifted "GOTO_W" (jump /.goto_w))))) @@ -1520,7 +1520,7 @@ random.nat) choice (# ! each (n.% options) random.nat) options (|> random.int - (# ! each (|>> (:as java/lang/Long) ffi.long_to_int ffi.int_to_long (:as Int))) + (# ! each (|>> (as java/lang/Long) ffi.long_to_int ffi.int_to_long (as Int))) (random.set i.hash options) (# ! each set.list)) .let [choice (maybe.trusted (list.item choice options))] @@ -1531,7 +1531,7 @@ [@right /.new_label @wrong /.new_label @return /.new_label - _ (..$Integer::literal (ffi.long_to_int (:as java/lang/Long choice))) + _ (..$Integer::literal (ffi.long_to_int (as java/lang/Long choice))) _ (/.lookupswitch @wrong (list#each (function (_ option) [(|> option /signed.s4 try.trusted) (if (i.= choice option) @right @wrong)]) @@ -1618,11 +1618,11 @@ part3 ..$Long::random part4 ..$Long::random .let [expected ($_ i.+ - (:as Int part0) - (:as Int part1) - (:as Int part2) - (:as Int part3) - (:as Int part4)) + (as Int part0) + (as Int part1) + (as Int part2) + (as Int part3) + (as Int part4)) $Concrete (/type.class concrete_class (list)) $Abstract (/type.class abstract_class (list)) $Interface (/type.class interface_class (list)) @@ -1637,15 +1637,15 @@ virtual_method "virtual_method" static_method "static_method" - method (: (-> Text java/lang/Long (Resource Method)) - (function (_ name value) - (/method.method /method.public - name - #0 method::type - (list) - {.#Some (do /.monad - [_ (..$Long::literal value)] - /.lreturn)}))) + method (is (-> Text java/lang/Long (Resource Method)) + (function (_ name value) + (/method.method /method.public + name + #0 method::type + (list) + {.#Some (do /.monad + [_ (..$Long::literal value)] + /.lreturn)}))) interface_bytecode (|> (/class.class /version.v6_0 ($_ /modifier#composite /class.public /class.abstract /class.interface) (/name.internal interface_class) @@ -1679,11 +1679,11 @@ (sequence.sequence)) try.trusted (format.result /class.writer)) - invoke (: (-> (Type Class) Text (Bytecode Any)) - (function (_ class method) - (do /.monad - [_ /.aload_0] - (/.invokevirtual class method method::type)))) + invoke (is (-> (Type Class) Text (Bytecode Any)) + (function (_ class method) + (do /.monad + [_ /.aload_0] + (/.invokevirtual class method method::type)))) concrete_bytecode (|> (/class.class /version.v6_0 /class.public (/name.internal concrete_class) {.#None} @@ -1736,9 +1736,9 @@ class (io.run! (/loader.load concrete_class loader)) method (try (get_method static_method class)) output (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)] - (in (:as Int output))) + (in (as Int output))) {try.#Success actual} - (i.= (:as Int expected) (:as Int actual)) + (i.= (as Int expected) (as Int actual)) {try.#Failure error} false)))) diff --git a/stdlib/source/test/lux/target/lua.lux b/stdlib/source/test/lux/target/lua.lux index 84cf47b3f..471aeb03a 100644 --- a/stdlib/source/test/lux/target/lua.lux +++ b/stdlib/source/test/lux/target/lua.lux @@ -60,16 +60,16 @@ {.#None} true {.#Some _} false))) (_.cover [/.boolean] - (expression (|>> (:as Bit) (bit#= boolean)) + (expression (|>> (as Bit) (bit#= boolean)) (/.boolean boolean))) (_.cover [/.int] - (expression (|>> (:as Int) (i.= int)) + (expression (|>> (as Int) (i.= int)) (/.int int))) (_.cover [/.float] - (expression (|>> (:as Frac) (f.= float)) + (expression (|>> (as Frac) (f.= float)) (/.float float))) (_.cover [/.string] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.string string))) ))) @@ -82,14 +82,14 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.boolean left) (/.boolean right)))))] [/.or .or] [/.and .and] )) (_.cover [/.not] - (expression (|>> (:as Bit) (bit#= (not left))) + (expression (|>> (as Bit) (bit#= (not left))) (/.not (/.boolean left)))) )))) @@ -117,7 +117,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (</> (/.int left) (/.int right)))))] [/.bit_or i64.or] @@ -125,16 +125,16 @@ [/.bit_and i64.and] )) (_.cover [/.opposite] - (expression (|>> (:as Int) (i.= (i.- left +0))) + (expression (|>> (as Int) (i.= (i.- left +0))) (/.opposite (/.int left)))) (_.cover [/.bit_shl] (let [expected (i64.left_shifted shift left)] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (/.bit_shl (/.int (.int shift)) (/.int left))))) (_.cover [/.bit_shr] (let [expected (i64.right_shifted shift left)] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (/.bit_shr (/.int (.int shift)) (/.int left))))) (_.cover [/.//] @@ -142,7 +142,7 @@ (i.= +0 (i.% parameter subject))) (i./ parameter subject) (-- (i./ parameter subject)))] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (/.// (/.int parameter) (/.int subject))))) )))) @@ -156,7 +156,7 @@ (~~ (template [</> <lux> <pre>] [(_.cover [</>] (let [expected (<lux> (<pre> parameter) (<pre> subject))] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (</> (/.float (<pre> parameter)) (/.float (<pre> subject))))))] [/.+ f.+ |>] @@ -169,7 +169,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> parameter subject)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.float parameter) (/.float subject)))))] [/.< f.<] @@ -188,7 +188,7 @@ .let [expected (format left right)]] ($_ _.and (_.cover [/.concat] - (expression (|>> (:as Text) (text#= expected)) + (expression (|>> (as Text) (text#= expected)) (|> (/.string left) (/.concat (/.string right))))) ))) @@ -204,15 +204,15 @@ maybe.trusted)]] ($_ _.and (_.cover [/.array /.item] - (and (expression (|>> (:as Frac) (f.= expected)) + (and (expression (|>> (as Frac) (f.= expected)) (/.item (/.int (.int (++ index))) (/.array (list#each /.float items)))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.array (list#each /.float items)) (/.item (/.int (.int (++ size)))) (/.= /.nil))))) (_.cover [/.length] - (expression (|>> (:as Int) (i.= (.int size))) + (expression (|>> (as Int) (i.= (.int size))) (/.length (/.array (list#each /.float items))))) ))) @@ -236,14 +236,14 @@ method (random.ascii/upper 6)] ($_ _.and (_.cover [/.table /.the] - (and (expression (|>> (:as Frac) (f.= expected)) + (and (expression (|>> (as Frac) (f.= expected)) (/.the field (/.table (list [field (/.float expected)])))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.table (list [field (/.float expected)])) (/.the non_field) (/.= /.nil))))) (_.cover [/.do /.function] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> ($_ /.then (/.local/1 $table (/.table (list [field (/.float expected)]))) (/.function (/.the method $table) (list $self $arg) @@ -276,30 +276,30 @@ ..test|array ..test|table (_.cover [/.type/1] - (and (expression (|>> (:as Text) (text#= "boolean")) + (and (expression (|>> (as Text) (text#= "boolean")) (/.type/1 (/.boolean boolean))) - (expression (|>> (:as Text) (text#= "number")) + (expression (|>> (as Text) (text#= "number")) (/.type/1 (/.int int))) - (expression (|>> (:as Text) (text#= "number")) + (expression (|>> (as Text) (text#= "number")) (/.type/1 (/.float float))) - (expression (|>> (:as Text) (text#= "string")) + (expression (|>> (as Text) (text#= "string")) (/.type/1 (/.string string))) - (expression (|>> (:as Text) (text#= "nil")) + (expression (|>> (as Text) (text#= "nil")) (/.type/1 /.nil)) - (expression (|>> (:as Text) (text#= "table")) + (expression (|>> (as Text) (text#= "table")) (/.type/1 (/.table (list [string (/.float float)])))) - (expression (|>> (:as Text) (text#= "table")) + (expression (|>> (as Text) (text#= "table")) (/.type/1 (/.array (list (/.boolean boolean) (/.float float) (/.string string))))) )) (_.cover [/.require/1] - (expression (|>> (:as Int) (i.= (i.abs int))) + (expression (|>> (as Int) (i.= (i.abs int))) (|> (/.require/1 (/.string "math")) (/.the "abs") (/.apply (list (/.int int)))))) (_.cover [/.comment] - (expression (|>> (:as Frac) (f.= then)) + (expression (|>> (as Frac) (f.= then)) (/.comment comment (/.float then)))) ))) @@ -326,26 +326,26 @@ $local (/.var local)]] ($_ _.and (_.cover [/.var] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> (/.return $foreign) (/.closure (list $foreign)) (/.apply (list (/.float float/0)))))) (_.cover [/.let] - (expression (|>> (:as Frac) (f.= float/1)) + (expression (|>> (as Frac) (f.= float/1)) (|> ($_ /.then (/.let (list $local) (/.float float/1)) (/.return $local)) (/.closure (list $foreign)) (/.apply (list (/.float float/0)))))) (_.cover [/.local/1] - (expression (|>> (:as Frac) (f.= float/1)) + (expression (|>> (as Frac) (f.= float/1)) (|> ($_ /.then (/.local/1 $local (/.float float/1)) (/.return $local)) (/.closure (list $foreign)) (/.apply (list (/.float float/0)))))) (_.cover [/.local] - (expression (|>> (:as Frac) (f.= float/1)) + (expression (|>> (as Frac) (f.= float/1)) (|> ($_ /.then (/.local (list $local)) (/.set (list $local) (/.float float/1)) @@ -366,27 +366,27 @@ field (random.ascii/upper 10)] ($_ _.and (_.cover [/.set] - (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (|> ($_ /.then (/.set (list $foreign) (/.+ $foreign $foreign)) (/.return $foreign)) (/.closure (list $foreign)) (/.apply (list (/.float float/0)))))) (_.cover [/.multi] - (and (expression (|>> (:as Frac) (f.= float/0)) + (and (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.set (list $arg/0 $arg/1) (/.multi (list (/.float float/0) (/.float float/1)))) (/.return $arg/0)) (/.closure (list)) (/.apply (list)))) - (expression (|>> (:as Frac) (f.= float/1)) + (expression (|>> (as Frac) (f.= float/1)) (|> ($_ /.then (/.set (list $arg/0 $arg/1) (/.multi (list (/.float float/0) (/.float float/1)))) (/.return $arg/1)) (/.closure (list)) (/.apply (list)))))) (_.cover [/.Access] - (and (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (and (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (let [@ (/.item (/.int +1) $foreign)] (|> ($_ /.then (/.set (list $foreign) (/.array (list $foreign))) @@ -394,7 +394,7 @@ (/.return @)) (/.closure (list $foreign)) (/.apply (list (/.float float/0)))))) - (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (let [@ (/.the field $foreign)] (|> ($_ /.then (/.set (list $foreign) (/.table (list [field $foreign]))) @@ -424,7 +424,7 @@ expected_iterations (/.int expected_iterations)]] ($_ _.and (_.cover [/.break] - (let [=for_in (expression (|>> (:as Int) (i.= expected)) + (let [=for_in (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $output (/.int +0)) (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated full_iterations $input))) @@ -437,7 +437,7 @@ (/.apply (list (/.int input))))) full_iterations (/.int (.int full_iterations)) - =while (expression (|>> (:as Int) (i.= expected)) + =while (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $index (/.int +0)) (/.local/1 $output (/.int +0)) @@ -451,7 +451,7 @@ (/.return $output)) (/.closure (list $input)) (/.apply (list (/.int input))))) - =repeat (expression (|>> (:as Int) (i.= expected)) + =repeat (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $index (/.int +0)) (/.local/1 $output (/.int +0)) @@ -465,7 +465,7 @@ (/.return $output)) (/.closure (list $input)) (/.apply (list (/.int input))))) - =for_step (expression (|>> (:as Int) (i.= expected)) + =for_step (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $output (/.int +0)) (/.for_step $index (/.int +0) full_iterations (/.int +1) @@ -481,7 +481,7 @@ =for_step =for_in))) (_.cover [/.label /.set_label /.go_to] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $index (/.int +0)) (/.local/1 $output (/.int +0)) @@ -507,7 +507,7 @@ expected (i.* (.int iterations) input)]] ($_ _.and (_.cover [/.while] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $index (/.int +0)) (/.local/1 $output (/.int +0)) @@ -520,7 +520,7 @@ (/.closure (list $input)) (/.apply (list (/.int input)))))) (_.cover [/.repeat] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $index (/.int +0)) (/.local/1 $output (/.int +0)) @@ -533,7 +533,7 @@ (/.closure (list $input)) (/.apply (list (/.int input)))))) (_.cover [/.for_step] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $output (/.int +0)) (/.for_step $index (/.int +0) (/.int (.int (-- iterations))) (/.int +1) @@ -542,7 +542,7 @@ (/.closure (list $input)) (/.apply (list (/.int input)))))) (_.cover [/.for_in /.ipairs/1] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.local/1 $output (/.int +0)) (/.for_in (list $index $input) (/.ipairs/1 (/.array (list.repeated iterations $input))) @@ -564,7 +564,7 @@ $outcome (# ! each /.var (random.ascii/lower 11))] ($_ _.and (_.cover [/.pcall/1] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> ($_ /.then (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list) (/.return (/.float expected))))) @@ -574,7 +574,7 @@ (/.closure (list)) (/.apply (list))))) (_.cover [/.error/1] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> ($_ /.then (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list) ($_ /.then @@ -586,7 +586,7 @@ (/.closure (list)) (/.apply (list))))) (_.cover [/.error/2] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> ($_ /.then (/.let (list $verdict $outcome) (/.pcall/1 (/.closure (list) ($_ /.then @@ -610,11 +610,11 @@ $class (# ! each /.var (random.ascii/upper 4))] ($_ _.and (_.cover [/.closure /.return] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (/.apply (list) (/.closure (list) (/.return (/.float float/0)))))) (_.cover [/.local_function] - (expression (|>> (:as Int) .nat (n.= iterations)) + (expression (|>> (as Int) .nat (n.= iterations)) (|> ($_ /.then (/.local_function $self (list $arg/0) (/.if (/.< (/.int (.int iterations)) $arg/0) @@ -632,7 +632,7 @@ $arg/2 (# ! each /.var (random.ascii/lower 12))] (`` ($_ _.and (_.cover [/.apply] - (expression (|>> (:as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) (/.apply (list (/.float float/0) (/.float float/1) (/.float float/2)) @@ -648,14 +648,14 @@ ??? random.bit] ($_ _.and (_.cover [/.if] - (expression (|>> (:as Frac) (f.= (if ??? float/0 float/1))) + (expression (|>> (as Frac) (f.= (if ??? float/0 float/1))) (|> (/.if (/.boolean ???) (/.return (/.float float/0)) (/.return (/.float float/1))) (/.closure (list)) (/.apply (list))))) (_.cover [/.when] - (expression (|>> (:as Frac) (f.= (if ??? float/0 float/1))) + (expression (|>> (as Frac) (f.= (if ??? float/0 float/1))) (|> ($_ /.then (/.when (/.boolean ???) (/.return (/.float float/0))) @@ -689,7 +689,7 @@ $arg/1 (# ! each /.var (random.ascii/lower 11))] (`` ($_ _.and (_.cover [/.statement /.then /.print/1] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.statement (/.print/1 $arg/0)) (/.return $arg/0)) @@ -713,7 +713,7 @@ ($hash.spec /.hash random)) (_.cover [/.manual] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (/.manual (/.code (/.int expected))))) (_.for [/.Expression] ..test|expression) diff --git a/stdlib/source/test/lux/target/python.lux b/stdlib/source/test/lux/target/python.lux index 2a9bdb68e..bca258d5e 100644 --- a/stdlib/source/test/lux/target/python.lux +++ b/stdlib/source/test/lux/target/python.lux @@ -61,22 +61,22 @@ {.#Some _} false))) (try.else false))) (_.cover [/.bool] - (expression (|>> (:as Bit) (bit#= bool)) + (expression (|>> (as Bit) (bit#= bool)) (/.bool bool))) (_.cover [/.int] - (expression (|>> (:as Int) (i.= int)) + (expression (|>> (as Int) (i.= int)) (/.int int))) ... (_.cover [/.long] - ... (expression (|>> (:as Int) (i.= int)) + ... (expression (|>> (as Int) (i.= int)) ... (/.long int))) (_.cover [/.float] - (expression (|>> (:as Frac) (f.= float)) + (expression (|>> (as Frac) (f.= float)) (/.float float))) (_.cover [/.string] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.string string))) (_.cover [/.unicode] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.unicode string))) ))) @@ -89,14 +89,14 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.bool left) (/.bool right)))))] [/.or .or] [/.and .and] )) (_.cover [/.not] - (expression (|>> (:as Bit) (bit#= (not left))) + (expression (|>> (as Bit) (bit#= (not left))) (/.not (/.bool left)))) )))) @@ -110,7 +110,7 @@ (~~ (template [</> <lux> <pre>] [(_.cover [</>] (let [expected (<lux> (<pre> parameter) (<pre> subject))] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (</> (/.float (<pre> parameter)) (/.float (<pre> subject))))))] [/.+ f.+ |>] @@ -123,7 +123,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> parameter subject)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.float parameter) (/.float subject)))))] [/.< f.<] @@ -133,10 +133,10 @@ [/.= f.=] )) (_.cover [/.float/1] - (expression (|>> (:as Frac) (f.= subject)) + (expression (|>> (as Frac) (f.= subject)) (/.float/1 (/.string (%.frac subject))))) (_.cover [/.repr/1] - (expression (|>> (:as Text) (text#= (text.replaced "+" "" (%.frac subject)))) + (expression (|>> (as Text) (text#= (text.replaced "+" "" (%.frac subject)))) (/.repr/1 (/.float subject)))) )))) @@ -163,7 +163,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (</> (/.int left) (/.int right)))))] [/.bit_or i64.or] @@ -175,34 +175,34 @@ (let [left (.int shift) right (i.* (.int shift) i16) expected (<lux> left right)] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (</> (/.int left) (/.int right)))))] [/.// i./] )) (_.cover [/.opposite] - (expression (|>> (:as Int) (i.= (i.* -1 left))) + (expression (|>> (as Int) (i.= (i.* -1 left))) (/.opposite (/.int left)))) (_.cover [/.bit_shl] (let [expected (i64.left_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_shl (/.int (.int shift)) (/.int i16))))) (_.cover [/.bit_shr] (let [expected (i.right_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_shr (/.int (.int shift)) (/.int i16))))) (_.cover [/.int/1] - (expression (|>> (:as Int) (i.= left)) + (expression (|>> (as Int) (i.= left)) (/.int/1 (/.string (%.int left))))) (_.cover [/.str/1] - (expression (|>> (:as Text) (text#= (text.replaced "+" "" (%.int left)))) + (expression (|>> (as Text) (text#= (text.replaced "+" "" (%.int left)))) (/.str/1 (/.int left)))) (_.cover [/.long] - (or (expression (|>> (:as Bit)) + (or (expression (|>> (as Bit)) ..python_3?) - (expression (|>> (:as Int) (i.= left)) + (expression (|>> (as Int) (i.= left)) (/.long left)))) )))) @@ -214,11 +214,11 @@ ($_ _.and (_.cover [/.chr/1 /.ord/1 /.unichr/1 /.unicode/1] - (and (expression (|>> (:as Int) .nat (n.= expected_code)) + (and (expression (|>> (as Int) .nat (n.= expected_code)) (/.? python_3? (/.ord/1 (/.chr/1 (/.int (.int expected_code)))) (/.unicode/1 (/.unichr/1 (/.int (.int expected_code)))))) - (expression (|>> (:as Text) (text#= expected_char)) + (expression (|>> (as Text) (text#= expected_char)) (/.? python_3? (/.chr/1 (/.ord/1 (/.string expected_char))) (/.unichr/1 (/.unicode/1 (/.string expected_char))))))) @@ -242,20 +242,20 @@ (_.for [/.item] ($_ _.and (_.cover [/.list] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.item (/.int (.int index)) (/.list (list#each /.float items))))) (_.cover [/.tuple] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.item (/.int (.int index)) (/.tuple (list#each /.float items))))))) (_.cover [/.slice /.len/1] - (expression (|>> (:as Int) (i.= (.int plus))) + (expression (|>> (as Int) (i.= (.int plus))) (|> (/.list (list#each /.float items)) (/.slice from to) /.len/1))) (_.cover [/.slice_from] - (expression (|>> (:as Int) (i.= (.int slice_from|size))) + (expression (|>> (as Int) (i.= (.int slice_from|size))) (|> (/.list (list#each /.float items)) (/.slice_from from) /.len/1))) @@ -272,12 +272,12 @@ dummy (/.string dummy)]] ($_ _.and (_.cover [/.dict] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.item field (/.dict (list [field (/.float expected)]))))) (_.cover [/.in?] - (and (expression (|>> (:as Bit) not) + (and (expression (|>> (as Bit) not) (/.in? (/.dict (list)) field)) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (/.in? (/.dict (list [field (/.float expected)])) field)))) ))) @@ -304,27 +304,27 @@ ..test|dict (_.cover [/.?] (let [expected (if test then else)] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.? (/.bool test) (/.float then) (/.float else))))) (_.cover [/.comment] - (expression (|>> (:as Frac) (f.= then)) + (expression (|>> (as Frac) (f.= then)) (/.comment comment (/.float then)))) (_.cover [/.__import__/1] (expression (function.constant true) (/.__import__/1 (/.string "math")))) (_.cover [/.do] - (expression (|>> (:as Frac) (f.= (math.ceil float))) + (expression (|>> (as Frac) (f.= (math.ceil float))) (|> (/.__import__/1 (/.string "math")) (/.do "ceil" (list (/.float float)))))) (_.cover [/.is] - (and (expression (|>> (:as Bit)) + (and (expression (|>> (as Bit)) (/.apply/* (list (/.string (format string string))) (/.lambda (list $arg/0) (/.is $arg/0 $arg/0)))) - (expression (|>> (:as Bit) not) + (expression (|>> (as Bit) not) (/.apply/* (list (/.string (format string string)) (/.string string)) (/.lambda (list $arg/0 $arg/1) @@ -342,12 +342,12 @@ $arg/2 (# ! each /.var (random.ascii/lower 12))] ($_ _.and (_.cover [/.lambda] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (/.apply/* (list) (/.lambda (list) (/.float float/0))))) (_.cover [/.apply/*] - (expression (|>> (:as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) (/.apply/* (list (/.float float/0) (/.float float/1) (/.float float/2)) (/.lambda (list $arg/0 $arg/1 $arg/2) ($_ /.+ $arg/0 $arg/1 $arg/2))))) @@ -370,20 +370,20 @@ $choice (# ! each (|>> %.nat (format "c") /.var) random.nat)] ($_ _.and (_.cover [/.Single /.SVar /.var] - (expression (|>> (:as Frac) (f.= expected/0)) + (expression (|>> (as Frac) (f.= expected/0)) (/.apply/* (list (/.float expected/0)) (/.lambda (list $var) $var)))) (_.for [/.Poly /.PVar] ($_ _.and (_.cover [/.poly] - (expression (|>> (:as Frac) (f.= expected/?)) + (expression (|>> (as Frac) (f.= expected/?)) (/.apply/* (list (/.int (.int poly_choice)) (/.float expected/0) (/.float expected/1)) (/.lambda (list $choice (/.poly $var)) (/.item $choice $var))))) (_.cover [/.splat_poly] - (expression (|>> (:as Frac) (f.= expected/?)) + (expression (|>> (as Frac) (f.= expected/?)) (/.apply/* (list (/.int (.int poly_choice)) (/.splat_poly (/.list (list (/.float expected/0) @@ -394,7 +394,7 @@ (_.for [/.Keyword /.KVar] ($_ _.and (_.cover [/.keyword] - (expression (|>> (:as Nat) (n.= 2)) + (expression (|>> (as Nat) (n.= 2)) (/.apply/* (list keyword_choice (/.splat_keyword (/.dict (list [keyword/0 (/.float expected/0)] @@ -402,7 +402,7 @@ (/.lambda (list $choice (/.keyword $var)) (/.len/1 $var))))) (_.cover [/.splat_keyword] - (expression (|>> (:as Frac) (f.= expected/?)) + (expression (|>> (as Frac) (f.= expected/?)) (/.apply/* (list keyword_choice (/.splat_keyword (/.dict (list [keyword/0 (/.float expected/0)] @@ -439,7 +439,7 @@ random.nat) environment (..dict [])] (exec - ("python exec" (/.code (it (/.var $output))) (:expected environment)) + ("python exec" (/.code (it (/.var $output))) (as_expected environment)) (Dict::get $output environment)))) (def: test|access @@ -452,7 +452,7 @@ ($_ _.and (_.cover [/.item] (`` (and (~~ (template [<seq>] - [(expression (|>> (:as Frac) (f.= expected/0)) + [(expression (|>> (as Frac) (f.= expected/0)) (/.item (/.int +0) (<seq> (list (/.float expected/0)))))] @@ -465,10 +465,10 @@ (/.set (list $var/0) (/.list (list (/.float dummy/0)))) (/.set (list (/.item (/.int +0) $var/0)) (/.float expected/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) - (expression (|>> (:as Frac) (f.= expected/0)) + (expression (|>> (as Frac) (f.= expected/0)) (/.item field (/.dict (list [field (/.float expected/0)])))) (|> (..statement (function (_ $output) @@ -476,7 +476,7 @@ (/.set (list $var/0) (/.dict (list [field (/.float dummy/0)]))) (/.set (list (/.item field $var/0)) (/.float expected/0)) (/.set (list $output) (/.item field $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0))))) ))) @@ -497,7 +497,7 @@ ($_ /.then (/.set (list $var/0) (/.float expected/0)) (/.set (list $output) $var/0)))) - (:as Frac) + (as Frac) (f.= expected/0))) (_.cover [/.multi] (`` (and (~~ (template [<var> <value>] @@ -506,7 +506,7 @@ ($_ /.then (/.set (list $var/0 $var/1) (/.multi (list (/.float expected/0) (/.float expected/1)))) (/.set (list $output) <var>)))) - (:as Frac) + (as Frac) (f.= <value>))] [$var/0 expected/0] @@ -519,7 +519,7 @@ (/.set (list $var/0) (/.list (list (/.float dummy/0) (/.float expected/0)))) (/.delete (/.item (/.int +0) $var/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) (|> (..statement (function (_ $output) @@ -527,7 +527,7 @@ (/.set (list $var/0) (/.list (list (/.float dummy/0) (/.float expected/0)))) (/.delete (/.slice (/.int +0) (/.int +1) $var/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) (|> (..statement (function (_ $output) @@ -536,7 +536,7 @@ (/.delete (/.slice_from (/.int +0) $var/0)) (/.statement (/.do "append" (list (/.float expected/0)) $var/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) (|> (..statement (function (_ $output) @@ -544,7 +544,7 @@ (/.set (list $var/0) (/.dict (list [field/0 (/.float dummy/0)]))) (/.delete (/.item field/0 $var/0)) (/.set (list $output) (/.in? $var/0 field/0))))) - (:as Bit) + (as Bit) not) (|> (..statement (function (_ $output) @@ -553,7 +553,7 @@ (/.delete $var/0) (/.set (list $output) (/.or (/.in? /.locals/0 (/.string (/.code $var/0))) (/.in? /.globals/0 (/.string (/.code $var/0)))))))) - (:as Bit) + (as Bit) not) )) (_.cover [/.globals/0] @@ -567,7 +567,7 @@ (/.set (list $var/0) (/.float dummy/0)) (/.set (list $output) (/.and $output (/.in? /.globals/0 (/.string (/.code $var/0)))))))) - (:as Bit))) + (as Bit))) (_.cover [/.locals/0] (|> (..statement (function (_ $output) @@ -579,14 +579,14 @@ (/.set (list $var/0) (/.float dummy/0)) (/.set (list $output) (/.and $output (/.in? /.locals/0 (/.string (/.code $var/0)))))))) - (:as Bit))) + (as Bit))) (_.cover [/.import] (|> (..statement (function (_ $output) ($_ /.then (/.import "math") (/.set (list $output) (/.in? /.globals/0 (/.string "math")))))) - (:as Bit))) + (as Bit))) (_.for [/.Access] ..test|access) ))) @@ -620,7 +620,7 @@ (list [/.#classes (list "Exception") /.#exception $ex /.#handler (/.set (list $output) (/.float expected))])))) - (:as Frac) + (as Frac) (f.= expected)) (case (try (..statement (function (_ $output) @@ -661,7 +661,7 @@ $iteration)) ) {.#None})))) - (:as Nat) + (as Nat) (n.= expected)) (|> (..statement (function (_ $output) @@ -676,7 +676,7 @@ $iteration)) ) {.#Some (/.set (list $output) $temp)})))) - (:as Nat) + (as Nat) (n.= expected)))) (_.cover [/.for_in] (|> (..statement @@ -687,7 +687,7 @@ (/.list (list.repeated factor (/.int (.int base)))) (/.set (list $output) (/.+ $iteration $output)))))) - (:as Nat) + (as Nat) (n.= expected))) (_.cover [/.pass] (|> (..statement @@ -704,7 +704,7 @@ $output)) /.pass)) {.#None})))) - (:as Nat) + (as Nat) (n.= expected))) (_.cover [/.continue] (|> (..statement @@ -721,7 +721,7 @@ $output)) /.continue)) {.#None})))) - (:as Nat) + (as Nat) (n.= expected))) (_.cover [/.break] (|> (..statement @@ -738,7 +738,7 @@ (/.set (list $output) (/.+ (/.int (.int base)) $output)))) {.#None})))) - (:as Nat) + (as Nat) (n.= expected))) ))) @@ -760,7 +760,7 @@ (/.def $def (list $input/0) (/.return $input/0)) (/.set (list $output) (/.apply/* (list (/.float expected/0)) $def))))) - (:as Frac) + (as Frac) (f.= expected/0))) (_.cover [/.if] (|> (..statement @@ -771,7 +771,7 @@ (/.return (/.float then)) (/.return (/.float else)))) (/.set (list $output) (/.apply/* (list) $def))))) - (:as Frac) + (as Frac) (f.= expected/?))) (_.cover [/.when /.then] (|> (..statement @@ -783,7 +783,7 @@ (/.return (/.float then))) (/.return (/.float else)))) (/.set (list $output) (/.apply/* (list) $def))))) - (:as Frac) + (as Frac) (f.= expected/?))) (_.cover [/.statement] (|> (..statement @@ -794,14 +794,14 @@ (/.statement (/.+ (/.float expected/0) (/.float expected/0))) (/.return (/.float expected/0)))) (/.set (list $output) (/.apply/* (list) $def))))) - (:as Frac) + (as Frac) (f.= expected/0))) (_.cover [/.exec] (|> (..statement (function (_ $output) (/.exec {.#Some /.globals/0} (/.string (/.code (/.set (list $output) (/.float expected/0))))))) - (:as Frac) + (as Frac) (f.= expected/0))) ..test|exception (_.for [/.Location] @@ -833,7 +833,7 @@ (_.cover [/.code /.manual] (|> (/.manual (/.code expected)) - (: /.Expression) + (is /.Expression) (/#= expected))) (_.for [/.Expression] ..test|expression) diff --git a/stdlib/source/test/lux/target/ruby.lux b/stdlib/source/test/lux/target/ruby.lux index 58cf47c7b..603cded95 100644 --- a/stdlib/source/test/lux/target/ruby.lux +++ b/stdlib/source/test/lux/target/ruby.lux @@ -68,19 +68,19 @@ (_.cover [/.nil] (..nil /.nil)) (_.cover [/.bool] - (expression (|>> (:as Bit) (bit#= bool)) + (expression (|>> (as Bit) (bit#= bool)) (/.bool bool))) (_.cover [/.int] - (expression (|>> (:as Int) (i.= int)) + (expression (|>> (as Int) (i.= int)) (/.int int))) (_.cover [/.float] - (expression (|>> (:as Frac) (f.= float)) + (expression (|>> (as Frac) (f.= float)) (/.float float))) (_.cover [/.string] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.string string))) (_.cover [/.symbol] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.do "id2name" (list) {.#None} (/.symbol string)))) ))) @@ -93,14 +93,14 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.bool left) (/.bool right)))))] [/.or .or] [/.and .and] )) (_.cover [/.not] - (expression (|>> (:as Bit) (bit#= (not left))) + (expression (|>> (as Bit) (bit#= (not left))) (/.not (/.bool left)))) )))) @@ -114,7 +114,7 @@ (~~ (template [</> <lux> <pre>] [(_.cover [</>] (let [expected (<lux> (<pre> parameter) (<pre> subject))] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (</> (/.float (<pre> parameter)) (/.float (<pre> subject))))))] [/.+ f.+ |>] @@ -127,7 +127,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> parameter subject)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.float parameter) (/.float subject)))))] [/.< f.<] @@ -154,7 +154,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (</> (/.int left) (/.int right)))))] [/.bit_or i64.or] @@ -162,19 +162,19 @@ [/.bit_and i64.and] )) (_.cover [/.bit_not] - (expression (|>> (:as Int) (i.= (i64.not left))) + (expression (|>> (as Int) (i.= (i64.not left))) (/.bit_not (/.int left)))) (_.cover [/.opposite] - (expression (|>> (:as Int) (i.= (i.* -1 left))) + (expression (|>> (as Int) (i.= (i.* -1 left))) (/.opposite (/.int left)))) (_.cover [/.bit_shl] (let [expected (i64.left_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_shl (/.int (.int shift)) (/.int i16))))) (_.cover [/.bit_shr] (let [expected (i.right_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_shr (/.int (.int shift)) (/.int i16))))) )))) @@ -194,15 +194,15 @@ from (/.int (.int from))]] ($_ _.and (_.cover [/.array /.item] - (and (expression (|>> (:as Frac) (f.= expected)) + (and (expression (|>> (as Frac) (f.= expected)) (/.item (/.int (.int index)) (/.array (list#each /.float items)))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.array (list#each /.float items)) (/.item (/.int (.int size))) (/.= /.nil))))) (_.cover [/.array_range] - (expression (|>> (:as Int) (i.= (.int (++ plus)))) + (expression (|>> (as Int) (i.= (.int (++ plus)))) (|> (/.array (list#each /.float items)) (/.array_range from to) (/.the "length")))) @@ -219,9 +219,9 @@ dummy (/.string dummy)]] ($_ _.and (_.cover [/.hash] - (and (expression (|>> (:as Frac) (f.= expected)) + (and (expression (|>> (as Frac) (f.= expected)) (/.item field (/.hash (list [field (/.float expected)])))) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.hash (list [field (/.float expected)])) (/.item dummy) (/.= /.nil))))) @@ -251,18 +251,18 @@ (/.return (/.+ $arg/0 $arg/0)))]] ($_ _.and (_.cover [/.the] - (expression (|>> (:as Int) (i.= (.int size))) + (expression (|>> (as Int) (i.= (.int size))) (|> (/.array (list#each /.float items)) (/.the "length")))) (_.cover [/.do] (expression (let [expected (|> items (list.item index) (maybe.else f.not_a_number))] - (|>> (:as Frac) (f.= expected))) + (|>> (as Frac) (f.= expected))) (|> (/.array (list#each /.float items)) (/.do "at" (list (/.int (.int index))) {.#None})))) (_.cover [/.class] - (expression (|>> (:as Frac) (f.= (f.+ single single))) + (expression (|>> (as Frac) (f.= (f.+ single single))) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body double])) @@ -272,7 +272,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.new /.initialize] - (expression (|>> (:as Frac) (f.= single)) + (expression (|>> (as Frac) (f.= single)) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body ($_ /.then @@ -287,7 +287,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.alias_method/2] - (expression (|>> (:as Frac) (f.= (f.+ single single))) + (expression (|>> (as Frac) (f.= (f.+ single single))) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body ($_ /.then @@ -302,7 +302,7 @@ (_.for [/.module] ($_ _.and (_.cover [/.include/1] - (expression (|>> (:as Frac) (f.= (f.+ single single))) + (expression (|>> (as Frac) (f.= (f.+ single single))) (|> ($_ /.then (/.set (list $class) (/.module [/.#parameters (list) /.#body double])) @@ -314,7 +314,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.extend/1] - (expression (|>> (:as Frac) (f.= (f.+ single single))) + (expression (|>> (as Frac) (f.= (f.+ single single))) (|> ($_ /.then (/.set (list $class) (/.module [/.#parameters (list) /.#body double])) @@ -340,7 +340,7 @@ (_.for [/.stdout] ($_ _.and (_.cover [/.print/1] - (expression (|>> (:as Text) (text#= expected)) + (expression (|>> (as Text) (text#= expected)) (|> ($_ /.then (/.statement (/.require/1 (/.string "stringio"))) (/.set (list $old) /.stdout) @@ -353,7 +353,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.print/2] - (expression (|>> (:as Text) (text#= expected)) + (expression (|>> (as Text) (text#= expected)) (|> ($_ /.then (/.statement (/.require/1 (/.string "stringio"))) (/.set (list $old) /.stdout) @@ -368,7 +368,7 @@ (_.for [/.stdin] ($_ _.and (_.cover [/.gets/0] - (expression (|>> (:as Text) (text#= (format left text.\n))) + (expression (|>> (as Text) (text#= (format left text.\n))) (|> ($_ /.then (/.statement (/.require/1 (/.string "stringio"))) (/.set (list $old) /.stdin) @@ -380,7 +380,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.last_string_read] - (expression (|>> (:as Text) (text#= (format right text.\n))) + (expression (|>> (as Text) (text#= (format right text.\n))) (|> ($_ /.then (/.statement (/.require/1 (/.string "stringio"))) (/.set (list $old) /.stdin) @@ -392,7 +392,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.last_line_number_read] - (expression (|>> (:as Nat) (n.= 2)) + (expression (|>> (as Nat) (n.= 2)) /.last_line_number_read)) )) ))) @@ -419,12 +419,12 @@ ..test|io (_.cover [/.?] (let [expected (if test then else)] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.? (/.bool test) (/.float then) (/.float else))))) (_.cover [/.comment] - (expression (|>> (:as Frac) (f.= then)) + (expression (|>> (as Frac) (f.= then)) (/.comment comment (/.float then)))) ))) @@ -437,7 +437,7 @@ pattern (# ! each /.string (random.ascii/lower 11))] ($_ _.and (_.cover [/.global] - (expression (|>> (:as Text) (text#= "global-variable")) + (expression (|>> (as Text) (text#= "global-variable")) (|> ($_ /.then (/.set (list $global) (/.float float/0)) (/.return (/.defined?/1 $global))) @@ -445,26 +445,26 @@ (/.apply_lambda/* (list))))) (_.cover [/.script_name] (expression (let [file (format (# file.default separator) packager.main_file)] - (|>> (:as Text) + (|>> (as Text) (text.ends_with? file))) /.script_name)) (_.cover [/.input_record_separator] - (expression (|>> (:as Text) + (expression (|>> (as Text) (text#= text.\n)) /.input_record_separator)) (_.cover [/.output_record_separator] (..nil /.output_record_separator)) (_.cover [/.process_id] - (expression (|>> (:as Nat) (n.= 0) not) + (expression (|>> (as Nat) (n.= 0) not) /.process_id)) (_.cover [/.case_insensitivity_flag] - (expression (|>> (:as Bit) (bit#= false)) + (expression (|>> (as Bit) (bit#= false)) /.case_insensitivity_flag)) (_.cover [/.command_line_arguments] - (expression (|>> (:as Int) (i.= +0)) + (expression (|>> (as Int) (i.= +0)) (/.the "length" /.command_line_arguments))) (_.cover [/.last_string_matched] - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> ($_ /.then (/.statement (|> (/.manual "Regexp") @@ -474,7 +474,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.last_regexp_match] - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (|> (/.return (|> (/.manual "Regexp") (/.new (list pattern) {.#None}) (/.do "match" (list pattern) {.#None}) @@ -490,12 +490,12 @@ $foreign (# ! each /.local (random.ascii/lower 10))] ($_ _.and (_.cover [/.local] - (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (|> (/.return (/.+ $foreign $foreign)) [(list $foreign)] (/.lambda {.#None}) (/.apply_lambda/* (list (/.float float/0)))))) (_.cover [/.set] - (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (|> ($_ /.then (/.set (list $foreign) (/.float float/0)) (/.return (/.+ $foreign $foreign))) @@ -518,7 +518,7 @@ random.nat)] ($_ _.and (_.cover [/.instance] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body ($_ /.then @@ -533,7 +533,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.attr_reader/*] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body ($_ /.then @@ -547,7 +547,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.attr_writer/*] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body ($_ /.then @@ -563,7 +563,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.attr_accessor/*] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body (/.attr_accessor/* (list instance))])) @@ -590,7 +590,7 @@ random.nat)] ($_ _.and (_.cover [/.static /.class_variable_set /.class_variable_get] - (expression (|>> (:as Int) (i.= int/0)) + (expression (|>> (as Int) (i.= int/0)) (|> ($_ /.then (/.set (list $class) (/.class [/.#parameters (list) /.#body (/.function $method (list) @@ -616,18 +616,18 @@ (<| (_.for [/.LVar*]) ($_ _.and (_.cover [/.variadic] - (expression (|>> (:as Int) .nat (n.= arity)) + (expression (|>> (as Int) .nat (n.= arity)) (|> (/.return (/.the "length" $inputs)) [(list (/.variadic $inputs))] (/.lambda {.#None}) (/.apply_lambda/* vals)))) (_.cover [/.splat] - (expression (|>> (:as Int) .nat (n.= arity)) + (expression (|>> (as Int) .nat (n.= arity)) (|> (/.return (/.the "length" (/.array (list (/.splat $inputs))))) [(list (/.variadic $inputs))] (/.lambda {.#None}) (/.apply_lambda/* vals)))))) (<| (_.for [/.LVar**]) (_.cover [/.variadic_kv /.double_splat] - (expression (|>> (:as Int) .nat (n.= arity)) + (expression (|>> (as Int) .nat (n.= arity)) (|> (/.return (/.the "length" $inputs)) [(list (/.variadic_kv $inputs))] (/.lambda {.#None}) (/.apply_lambda/* (list (/.double_splat (/.hash (list.zipped/2 keys vals))))))))) @@ -642,10 +642,10 @@ $constant (# ! each /.constant (random.ascii/lower 10))] ($_ _.and (_.cover [/.defined?/1] - (and (expression (|>> (:as Bit)) + (and (expression (|>> (as Bit)) (|> (/.defined?/1 $foreign) (/.= /.nil))) - (expression (|>> (:as Text) (text#= "local-variable")) + (expression (|>> (as Text) (text#= "local-variable")) (|> ($_ /.then (/.set (list $foreign) (/.float float/0)) (/.return (/.defined?/1 $foreign))) @@ -653,7 +653,7 @@ (/.apply_lambda/* (list)))))) (_.for [/.CVar] (_.cover [/.constant] - (expression (|>> (:as Text) (text#= "constant")) + (expression (|>> (as Text) (text#= "constant")) (|> ($_ /.then (/.set (list $constant) (/.float float/0)) (/.return (/.defined?/1 $constant))) @@ -680,7 +680,7 @@ (<| (_.for [/.Var]) ..test|var) (_.cover [/.Access] - (and (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (and (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (let [@ (/.item (/.int +0) $foreign)] (|> ($_ /.then (/.set (list $foreign) (/.array (list $foreign))) @@ -688,7 +688,7 @@ (/.return @)) [(list $foreign)] (/.lambda {.#None}) (/.apply_lambda/* (list (/.float float/0)))))) - (expression (|>> (:as Frac) (f.= (f.+ float/0 float/0))) + (expression (|>> (as Frac) (f.= (f.+ float/0 float/0))) (let [@ (/.item field $foreign)] (|> ($_ /.then (/.set (list $foreign) (/.hash (list [field $foreign]))) @@ -731,7 +731,7 @@ ($_ _.and (_.cover [/.break] (let [expected (i.* (.int expected_inner_iterations) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (|> ($_ /.then (/.set (list $inner_index) (/.int +0)) (/.set (list $output) (/.int +0)) @@ -747,7 +747,7 @@ (/.apply_lambda/* (list (/.int input))))))) (_.cover [/.next] (let [expected (i.* (.int (n.- expected_inner_iterations full_inner_iterations)) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (|> ($_ /.then (/.set (list $inner_index) (/.int +0)) (/.set (list $output) (/.int +0)) @@ -763,7 +763,7 @@ (/.apply_lambda/* (list (/.int input))))))) (_.cover [/.redo] (let [expected (i.* (.int (n.- expected_inner_iterations full_inner_iterations)) input)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (|> ($_ /.then (/.set (list $inner_index) (/.int +0)) (/.set (list $output) (/.int +0)) @@ -790,7 +790,7 @@ expected (i.* (.int iterations) input)]] ($_ _.and (_.cover [/.while] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.set (list $index) (/.int +0)) (/.set (list $output) (/.int +0)) @@ -803,7 +803,7 @@ [(list $input)] (/.lambda {.#None}) (/.apply_lambda/* (list (/.int input)))))) (_.cover [/.for_in] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (|> ($_ /.then (/.set (list $output) (/.int +0)) (/.for_in $index (/.array (list.repeated iterations (/.int input))) @@ -835,13 +835,13 @@ dummy_tag (/.int dummy_tag)]] ($_ _.and (_.cover [/.begin] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> (/.begin (/.return (/.float expected)) (list [(list) $ex (/.return (/.float dummy))])) [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.Rescue /.throw/1] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> (/.begin ($_ /.then (/.throw/1 (/.string error)) (/.return (/.float dummy))) @@ -849,7 +849,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.raise] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (|> (/.begin ($_ /.then (/.statement (/.raise (/.string error))) (/.return (/.float dummy))) @@ -857,20 +857,20 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.catch /.throw/2] - (and (expression (|>> (:as Frac) (f.= expected)) + (and (expression (|>> (as Frac) (f.= expected)) (<| (/.apply_lambda/* (list)) (/.lambda {.#None}) [(list)] /.return (/.catch expected_tag) [(list)] (/.throw/2 expected_tag (/.float expected)))) - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (<| (/.apply_lambda/* (list)) (/.lambda {.#None}) [(list)] /.return (/.catch expected_tag) [(list)] /.statement (/.catch dummy_tag) [(list)] (/.throw/2 expected_tag (/.float expected)))) - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (<| (/.apply_lambda/* (list)) (/.lambda {.#None}) [(list)] /.return @@ -878,7 +878,7 @@ /.statement (/.catch expected_tag) [(list)] (/.throw/2 expected_tag (/.float expected)))))) (_.cover [/.latest_error_message] - (expression (|>> (:as Text) (text#= error)) + (expression (|>> (as Text) (text#= error)) (|> (/.begin ($_ /.then (/.statement (/.raise (/.string error))) (/.return (/.float dummy))) @@ -890,12 +890,12 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list)) ..nil) - (expression (|>> (:as Bit) (bit#= true)) + (expression (|>> (as Bit) (bit#= true)) (|> (/.begin ($_ /.then (/.statement (/.raise (/.string error))) (/.return (/.float dummy))) (list [(list) $ex (/.return ($_ /.and - (/.do "kind_of?" (list (: /.CVar (/.manual "Array"))) {.#None} /.latest_error_location) + (/.do "kind_of?" (list (is /.CVar (/.manual "Array"))) {.#None} /.latest_error_location) (/.> (/.int +0) (/.the "length" /.latest_error_location))))])) [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list)))))) @@ -917,23 +917,23 @@ $arg/2 (# ! each /.local (random.ascii/lower 12))] ($_ _.and (_.cover [/.lambda /.return] - (and (expression (|>> (:as Frac) (f.= float/0)) + (and (expression (|>> (as Frac) (f.= float/0)) (|> (/.return (/.float float/0)) [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list)))) - (expression (|>> (:as Frac) f.nat (n.= iterations)) + (expression (|>> (as Frac) f.nat (n.= iterations)) (|> (/.return (/.? (/.< (/.int (.int iterations)) $arg/0) (/.apply_lambda/* (list (/.+ (/.int +1) $arg/0)) $self) $arg/0)) [(list $arg/0)] (/.lambda {.#Some $self}) (/.apply_lambda/* (list (/.int +0))))))) (_.cover [/.apply_lambda/*] - (expression (|>> (:as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) (|> (/.return ($_ /.+ $arg/0 $arg/1 $arg/2)) [(list $arg/0 $arg/1 $arg/2)] (/.lambda {.#None}) (/.apply_lambda/* (list (/.float float/0) (/.float float/1) (/.float float/2)))))) (_.cover [/.function] - (expression (|>> (:as Frac) f.nat (n.= iterations)) + (expression (|>> (as Frac) f.nat (n.= iterations)) (|> ($_ /.then (/.function $self (list $arg/0) (/.return (/.? (/.< (/.int (.int iterations)) $arg/0) @@ -943,7 +943,7 @@ [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.apply/*] - (expression (|>> (:as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) (|> ($_ /.then (/.function $self (list $arg/0 $arg/1 $arg/2) (/.return ($_ /.+ $arg/0 $arg/1 $arg/2))) @@ -970,14 +970,14 @@ ??? random.bit] ($_ _.and (_.cover [/.if] - (expression (|>> (:as Frac) (f.= (if ??? float/0 float/1))) + (expression (|>> (as Frac) (f.= (if ??? float/0 float/1))) (|> (/.if (/.bool ???) (/.return (/.float float/0)) (/.return (/.float float/1))) [(list)] (/.lambda {.#None}) (/.apply_lambda/* (list))))) (_.cover [/.when] - (expression (|>> (:as Frac) (f.= (if ??? float/0 float/1))) + (expression (|>> (as Frac) (f.= (if ??? float/0 float/1))) (|> ($_ /.then (/.when (/.bool ???) (/.return (/.float float/0))) @@ -999,22 +999,22 @@ random.int)] ($_ _.and (_.cover [/.statement] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.statement (/.+ $arg/0 $arg/0)) (/.return $arg/0)) [(list $arg/0)] (/.lambda {.#None}) (/.apply_lambda/* (list (/.float float/0)))))) (_.cover [/.then] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (|> ($_ /.then (/.return $arg/0) (/.return $arg/1)) [(list $arg/0 $arg/1)] (/.lambda {.#None}) (/.apply_lambda/* (list (/.float float/0) (/.float float/1)))))) (_.cover [/.require/1] - (let [$JSON (: /.CVar (/.manual "JSON"))] - (expression (|>> (:as Text) (text#= expected)) + (let [$JSON (is /.CVar (/.manual "JSON"))] + (expression (|>> (as Text) (text#= expected)) (|> ($_ /.then (/.statement (/.require/1 (/.string "json"))) (/.return (let [json (/.do "parse" (list $arg/0) {.#None} $JSON)] @@ -1030,13 +1030,13 @@ (def: random_expression (Random /.Expression) - (let [literal (: (Random /.Literal) - ($_ random.either - (random#each /.bool random.bit) - (random#each /.float random.frac) - (random#each /.int random.int) - (random#each /.string (random.ascii/lower 5)) - ))] + (let [literal (is (Random /.Literal) + ($_ random.either + (random#each /.bool random.bit) + (random#each /.float random.frac) + (random#each /.int random.int) + (random#each /.string (random.ascii/lower 5)) + ))] ($_ random.either literal ))) @@ -1053,7 +1053,7 @@ (_.cover [/.code /.manual] (|> (/.manual (/.code expected)) - (: /.Expression) + (is /.Expression) (/#= expected))) (_.for [/.Expression] ..test|expression) diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 4e9638e6d..3e3c8e268 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -66,8 +66,8 @@ /.Test (do [! random.monad] [seed random.nat - .let [[read write] (: [(async.Async Nat) (async.Resolver Nat)] - (async.async []))] + .let [[read write] (is [(async.Async Nat) (async.Resolver Nat)] + (async.async []))] pre (<| (/.seed seed) (do ! [sample random.nat @@ -101,8 +101,8 @@ (n.= 1 (the /.#failures tally))))))) (do [! random.monad] [expected (# ! each (|>> (n.% 10) ++) random.nat) - .let [counter (: (Atom Nat) - (atom.atom 0))] + .let [counter (is (Atom Nat) + (atom.atom 0))] times_assertion (<| (/.times expected) (do ! [_ (in []) @@ -122,11 +122,11 @@ ($_ /.and (do [! random.monad] [expected (# ! each (|>> (n.% 10) ++) random.nat) - .let [counter (: (Atom Nat) - (atom.atom 0))] + .let [counter (is (Atom Nat) + (atom.atom 0))] assertion (<| /.in_parallel (list.repeated expected) - (: /.Test) + (is /.Test) (do ! [_ (in []) .let [_ (io.run! (atom.update! ++ counter))]] @@ -140,11 +140,11 @@ (n.= 0 (the /.#failures tally))))))) (do [! random.monad] [expected (# ! each (|>> (n.% 10) ++) random.nat) - .let [counter (: (Atom Nat) - (atom.atom 0))] + .let [counter (is (Atom Nat) + (atom.atom 0))] assertion (<| /.in_parallel (list.repeated expected) - (: /.Test) + (is /.Test) (do ! [_ (in []) .let [_ (undefined) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index 12f2ca7c3..77d6e0a1f 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -69,16 +69,16 @@ [instant random.instant .let [d0 (/.day_of_week instant)]] (_.cover [/.day_of_week] - (let [apply (: (-> (-> Duration Duration) (-> Day Day) Nat Bit) - (function (_ polarity move steps) - (let [day_shift (list#mix (function.constant move) - d0 - (list.repeated steps [])) - instant_shift (|> instant - (/.after (polarity (duration.up steps duration.day))) - /.day_of_week)] - (day#= day_shift - instant_shift))))] + (let [apply (is (-> (-> Duration Duration) (-> Day Day) Nat Bit) + (function (_ polarity move steps) + (let [day_shift (list#mix (function.constant move) + d0 + (list.repeated steps [])) + instant_shift (|> instant + (/.after (polarity (duration.up steps duration.day))) + /.day_of_week)] + (day#= day_shift + instant_shift))))] (and (apply function.identity day#succ 0) (apply function.identity day#succ 1) (apply function.identity day#succ 2) 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 dfd65e1ba..629ffb39f 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 @@ -285,28 +285,28 @@ composes_variants! (let [composes_different_variants! - (let [composes? (: (-> (Maybe Nat) (Maybe Nat) (Maybe Nat) Bit) - (function (_ left right both) - (|> (/.composite {/.#Variant left (dictionary.of_list n.hash (list [tag/0 expected/0]))} - {/.#Variant right (dictionary.of_list n.hash (list [tag/1 expected/1]))}) - (try#each (/#= {/.#Variant both (dictionary.of_list n.hash (list [tag/0 expected/0] - [tag/1 expected/1]))})) - (try.else false))))] + (let [composes? (is (-> (Maybe Nat) (Maybe Nat) (Maybe Nat) Bit) + (function (_ left right both) + (|> (/.composite {/.#Variant left (dictionary.of_list n.hash (list [tag/0 expected/0]))} + {/.#Variant right (dictionary.of_list n.hash (list [tag/1 expected/1]))}) + (try#each (/#= {/.#Variant both (dictionary.of_list n.hash (list [tag/0 expected/0] + [tag/1 expected/1]))})) + (try.else false))))] (and (composes? {.#None} {.#None} {.#None}) (composes? {.#Some arity} {.#None} {.#Some arity}) (composes? {.#None} {.#Some arity} {.#Some arity}) (composes? {.#Some arity} {.#Some arity} {.#Some arity}))) composes_same_variants! - (let [composes? (: (-> (Maybe Nat) (Maybe Nat) (Maybe Nat) Bit) - (function (_ left right both) - (|> (do try.monad - [variant (/.composite {/.#Variant left (dictionary.of_list n.hash (list [tag/0 expected/0]))} - {/.#Variant right (dictionary.of_list n.hash (list [tag/0 expected/1]))}) - expected (/.composite expected/0 expected/1)] - (in (/#= {/.#Variant both (dictionary.of_list n.hash (list [tag/0 expected]))} - variant))) - (try.else false))))] + (let [composes? (is (-> (Maybe Nat) (Maybe Nat) (Maybe Nat) Bit) + (function (_ left right both) + (|> (do try.monad + [variant (/.composite {/.#Variant left (dictionary.of_list n.hash (list [tag/0 expected/0]))} + {/.#Variant right (dictionary.of_list n.hash (list [tag/0 expected/1]))}) + expected (/.composite expected/0 expected/1)] + (in (/#= {/.#Variant both (dictionary.of_list n.hash (list [tag/0 expected]))} + variant))) + (try.else false))))] (and (composes? {.#None} {.#None} {.#None}) (composes? {.#Some arity} {.#None} {.#Some arity}) (composes? {.#None} {.#Some arity} {.#Some arity}) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux index aa9f91e78..af26cf21c 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/inference.lux @@ -232,29 +232,29 @@ [tagT tagC] (|> types/*,terms/* (list.item tag) (maybe.else [Any (' [])])) - variant?' (: (-> Type (Maybe Type) Nat Bit Code Bit) - (function (_ variant inferred lefts right? term) - (|> (do /phase.monad - [inferT (/.variant lefts right? variant) - [_ [it _]] (|> (/.general archive.empty ..analysis inferT (list term)) - //type.inferring)] - (case inferred - {.#Some inferred} - (//type.check - (do check.monad - [_ (check.check inferred it) - _ (check.check it inferred)] - (in true))) - - {.#None} - (in true))) - (//module.with 0 (product.left name)) - (/phase#each product.right) - (/phase.result state) - (try.else false)))) - variant? (: (-> Type Nat Bit Code Bit) - (function (_ type lefts right? term) - (variant?' type {.#Some type} lefts right? term))) + variant?' (is (-> Type (Maybe Type) Nat Bit Code Bit) + (function (_ variant inferred lefts right? term) + (|> (do /phase.monad + [inferT (/.variant lefts right? variant) + [_ [it _]] (|> (/.general archive.empty ..analysis inferT (list term)) + //type.inferring)] + (case inferred + {.#Some inferred} + (//type.check + (do check.monad + [_ (check.check inferred it) + _ (check.check it inferred)] + (in true))) + + {.#None} + (in true))) + (//module.with 0 (product.left name)) + (/phase#each product.right) + (/phase.result state) + (try.else false)))) + variant? (is (-> Type Nat Bit Code Bit) + (function (_ type lefts right? term) + (variant?' type {.#Some type} lefts right? term))) can_match_case! (variant? variantT lefts right? tagC) @@ -332,26 +332,26 @@ [type/1 term/1] (random.only (|>> product.left (same? type/0) not) ..simple_parameter) types/*,terms/* (random.list arity ..simple_parameter) - .let [record? (: (-> Type (Maybe Type) Nat (List Code) Bit) - (function (_ record expected arity terms) - (|> (do /phase.monad - [inference (/.record arity record) - [_ [it _]] (|> (/.general archive.empty ..analysis inference terms) - //type.inferring)] - (case expected - {.#Some expected} - (//type.check - (do check.monad - [_ (check.check expected it) - _ (check.check it expected)] - (in true))) - - {.#None} - (in true))) - (//module.with 0 (product.left name)) - (/phase#each product.right) - (/phase.result state) - (try.else false)))) + .let [record? (is (-> Type (Maybe Type) Nat (List Code) Bit) + (function (_ record expected arity terms) + (|> (do /phase.monad + [inference (/.record arity record) + [_ [it _]] (|> (/.general archive.empty ..analysis inference terms) + //type.inferring)] + (case expected + {.#Some expected} + (//type.check + (do check.monad + [_ (check.check expected it) + _ (check.check it expected)] + (in true))) + + {.#None} + (in true))) + (//module.with 0 (product.left name)) + (/phase#each product.right) + (/phase.result state) + (try.else false)))) record (type.tuple (list#each product.left types/*,terms/*)) terms (list#each product.right types/*,terms/*)]] ($_ _.and 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 af025cb4d..a7fe6be62 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 @@ -62,8 +62,8 @@ poly (random.list multiplicity $code.random) lux ..random_state - .let [singular (<| (:as Macro) - (: Macro') + .let [singular (<| (as Macro) + (is Macro') (function (_ inputs state) (case (list.item choice inputs) {.#Some it} @@ -71,8 +71,8 @@ {.#None} {try.#Failure expected_error}))) - multiple (<| (:as Macro) - (: Macro') + multiple (<| (as Macro) + (is Macro') (function (_ inputs state) {try.#Success [state (|> inputs (list.repeated multiplicity) 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 5fa0d281b..7a36cce34 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 @@ -68,20 +68,20 @@ $binding/2 (# ! each code.local_symbol (random.ascii/lower 5))] ($_ _.and (_.cover [/.tuple] - (let [tuple? (: (-> Type Type Bit) - (function (_ :input: :expected:) - (and (|> :input: - /.tuple - (check.result check.fresh_context) - (try#each (|>> product.right (type#= :expected:))) - (try.else false)) - (|> (do check.monad - [[@var :var:] check.var - _ (check.check :var: :input:)] - (/.tuple :var:)) - (check.result check.fresh_context) - (try#each (|>> product.right (type#= :expected:))) - (try.else false)))))] + (let [tuple? (is (-> Type Type Bit) + (function (_ :input: :expected:) + (and (|> :input: + /.tuple + (check.result check.fresh_context) + (try#each (|>> product.right (type#= :expected:))) + (try.else false)) + (|> (do check.monad + [[@var :var:] check.var + _ (check.check :var: :input:)] + (/.tuple :var:)) + (check.result check.fresh_context) + (try#each (|>> product.right (type#= :expected:))) + (try.else false)))))] (and (tuple? input/0 (type.anonymous input/0)) (tuple? (Tuple input/0 input/1 input/2) @@ -144,17 +144,17 @@ (-> Lux Symbol [Type Code] [Type Code] [Type Code] [Code Code Code] [Type Code] [Type Code] [Bit Nat] Bit) (let [state [//extension.#bundle (//extension/analysis.bundle ..eval) //extension.#state lux] - case? (: (-> Code (List [Code Code]) Bit) - (function (_ input branches) - (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty input) - (//type.expecting output/0))] - (in true)) - //scope.with - (//module.with 0 module/0) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (try.else false)))) + case? (is (-> Code (List [Code Code]) Bit) + (function (_ input branches) + (|> (do //phase.monad + [analysis (|> (/.case ..analysis branches archive.empty input) + (//type.expecting output/0))] + (in true)) + //scope.with + (//module.with 0 module/0) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (try.else false)))) body_types_mismatch! (and (not (case? (code.bit bit/0) (list [(` #0) body/1] @@ -251,17 +251,17 @@ (-> Lux Symbol [Type Code] [Type Code] [Type Code] [Code Code Code] [Type Code] Bit Bit) (let [state [//extension.#bundle (//extension/analysis.bundle ..eval) //extension.#state lux] - redundant? (: (-> Code (List [Code Code]) Bit) - (function (_ input branches) - (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty input) - (//type.expecting output/0))] - (in true)) - //scope.with - (//module.with 0 module/0) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (exception.otherwise (text.contains? (the exception.#label //coverage.redundancy))))))] + redundant? (is (-> Code (List [Code Code]) Bit) + (function (_ input branches) + (|> (do //phase.monad + [analysis (|> (/.case ..analysis branches archive.empty input) + (//type.expecting output/0))] + (in true)) + //scope.with + (//module.with 0 module/0) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (exception.otherwise (text.contains? (the exception.#label //coverage.redundancy))))))] (and (redundant? (` []) (list [(` []) body/0] [(` []) body/0])) @@ -313,18 +313,18 @@ tag/1 (code.symbol [module/0 tag/1]) tag/2 (code.symbol [module/0 tag/2]) - variant? (: (-> Code (List [Code Code]) Bit) - (function (_ input branches) - (|> (do //phase.monad - [_ (//module.declare_labels false tags/* false :variant:) - analysis (|> (/.case ..analysis branches archive.empty input) - (//type.expecting output/0))] - (in true)) - //scope.with - (//module.with 0 module/0) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (try.else false)))) + variant? (is (-> Code (List [Code Code]) Bit) + (function (_ input branches) + (|> (do //phase.monad + [_ (//module.declare_labels false tags/* false :variant:) + analysis (|> (/.case ..analysis branches archive.empty input) + (//type.expecting output/0))] + (in true)) + //scope.with + (//module.with 0 module/0) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (try.else false)))) can_bind! (and (variant? (` {(~ tag/0) (~ simple/0)}) @@ -384,18 +384,18 @@ slot/1 (code.symbol [module/0 slot/1]) slot/2 (code.symbol [module/0 slot/2]) - record? (: (-> Code (List [Code Code]) Bit) - (function (_ input branches) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/* false :record:) - analysis (|> (/.case ..analysis branches archive.empty input) - (//type.expecting output/0))] - (in true)) - //scope.with - (//module.with 0 module/0) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (try.else false)))) + record? (is (-> Code (List [Code Code]) Bit) + (function (_ input branches) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/* false :record:) + analysis (|> (/.case ..analysis branches archive.empty input) + (//type.expecting output/0))] + (in true)) + //scope.with + (//module.with 0 module/0) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (try.else false)))) can_bind! (record? (` [(~ slot/0) (~ simple/0) @@ -531,32 +531,32 @@ (//phase.result state) (exception.otherwise (text.contains? (the exception.#label /.empty_branches))))) (_.cover [/.non_exhaustive] - (let [non_exhaustive? (: (-> (List [Code Code]) Bit) - (function (_ branches) - (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty simple/0) - (//type.expecting output/0))] - (in false)) - //scope.with - (//module.with 0 module/0) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (exception.otherwise (text.contains? (the exception.#label /.non_exhaustive))))))] + (let [non_exhaustive? (is (-> (List [Code Code]) Bit) + (function (_ branches) + (|> (do //phase.monad + [analysis (|> (/.case ..analysis branches archive.empty simple/0) + (//type.expecting output/0))] + (in false)) + //scope.with + (//module.with 0 module/0) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (exception.otherwise (text.contains? (the exception.#label /.non_exhaustive))))))] (and (non_exhaustive? (list [simple/0 body/0])) (not (non_exhaustive? (list [simple/0 body/0] [$binding/0 body/0])))))) (_.cover [/.invalid] - (let [invalid? (: (-> (List [Code Code]) Bit) - (function (_ branches) - (|> (do //phase.monad - [analysis (|> (/.case ..analysis branches archive.empty simple/0) - (//type.expecting output/0))] - (in false)) - //scope.with - (//module.with 0 module/0) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (exception.otherwise (text.contains? (the exception.#label /.invalid))))))] + (let [invalid? (is (-> (List [Code Code]) Bit) + (function (_ branches) + (|> (do //phase.monad + [analysis (|> (/.case ..analysis branches archive.empty simple/0) + (//type.expecting output/0))] + (in false)) + //scope.with + (//module.with 0 module/0) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (exception.otherwise (text.contains? (the exception.#label /.invalid))))))] (and (invalid? (list [(` ((~ extension/0) (~ $binding/0) (~ $binding/1) (~ $binding/2))) body/0])) (invalid? (list [(` {(~ extension/0) (~ $binding/0) (~ $binding/1) (~ $binding/2)}) 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 f6d69fc56..aa0a98c6b 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 @@ -144,23 +144,23 @@ ($_ _.and (_.cover [/.sum] (let [variantT (type.variant (list#each product.left types/*,terms/*)) - sum? (: (-> Type Nat Bit Code Bit) - (function (_ type lefts right? code) - (|> (do //phase.monad - [analysis (|> (/.sum ..analysis lefts right? archive.empty code) - (//type.expecting type))] - (in (case analysis - (pattern (//analysis.variant [lefts' right?' analysis])) - (and (n.= lefts lefts') - (bit#= right? right?') - (..analysed? code analysis)) - - _ - false))) - (//module.with 0 (product.left name)) - (//phase#each product.right) - (//phase.result state) - (try.else false))))] + sum? (is (-> Type Nat Bit Code Bit) + (function (_ type lefts right? code) + (|> (do //phase.monad + [analysis (|> (/.sum ..analysis lefts right? archive.empty code) + (//type.expecting type))] + (in (case analysis + (pattern (//analysis.variant [lefts' right?' analysis])) + (and (n.= lefts lefts') + (bit#= right? right?') + (..analysed? code analysis)) + + _ + false))) + (//module.with 0 (product.left name)) + (//phase#each product.right) + (//phase.result state) + (try.else false))))] (and (sum? variantT lefts right? tagC) (sum? {.#Named name variantT} lefts right? tagC) (|> (do //phase.monad @@ -187,11 +187,11 @@ (and (sum? (type (Ex (_ a) (Maybe a))) 0 #0 (` [])) (sum? (type (Ex (_ a) (Maybe a))) 0 #1 tagC))))) (_.for [/.cannot_analyse_variant] - (let [failure? (: (All (_ a) (-> (Exception a) (//analysis.Operation Any) Bit)) - (function (_ exception analysis) - (let [it (//phase.result state analysis)] - (and (..failure? /.cannot_analyse_variant it) - (..failure? exception it)))))] + (let [failure? (is (All (_ a) (-> (Exception a) (//analysis.Operation Any) Bit)) + (function (_ exception analysis) + (let [it (//phase.result state analysis)] + (and (..failure? /.cannot_analyse_variant it) + (..failure? exception it)))))] ($_ _.and (_.cover [/.invalid_variant_type] (and (|> (/.sum ..analysis lefts right? archive.empty tagC) @@ -235,43 +235,43 @@ (maybe.else ""))]] ($_ _.and (_.cover [/.variant] - (let [expected_variant? (: (-> Symbol Bit) - (function (_ tag) - (|> (do //phase.monad - [_ (//module.declare_labels false tags false variantT) - analysis (|> (/.variant ..analysis tag archive.empty tagC) - (//type.expecting variantT))] - (in (case analysis - (pattern (//analysis.variant [lefts' right?' analysis])) - (and (n.= lefts lefts') - (bit#= right? right?') - (..analysed? tagC analysis)) - - _ - false))) - (//module.with 0 module) - (//phase#each product.right) - (//phase.result state) - (try.else false)))) - inferred_variant? (: (-> Symbol Bit) - (function (_ tag) - (|> (do //phase.monad - [_ (//module.declare_labels false tags false variantT) - [actualT analysis] (|> (/.variant ..analysis tag archive.empty tagC) - //type.inferring)] - (in (case analysis - (pattern (//analysis.variant [lefts' right?' analysis])) - (and (n.= lefts lefts') - (bit#= right? right?') - (..analysed? tagC analysis) - (type#= variantT actualT)) - - _ - false))) - (//module.with 0 module) - (//phase#each product.right) - (//phase.result state) - (try.else false))))] + (let [expected_variant? (is (-> Symbol Bit) + (function (_ tag) + (|> (do //phase.monad + [_ (//module.declare_labels false tags false variantT) + analysis (|> (/.variant ..analysis tag archive.empty tagC) + (//type.expecting variantT))] + (in (case analysis + (pattern (//analysis.variant [lefts' right?' analysis])) + (and (n.= lefts lefts') + (bit#= right? right?') + (..analysed? tagC analysis)) + + _ + false))) + (//module.with 0 module) + (//phase#each product.right) + (//phase.result state) + (try.else false)))) + inferred_variant? (is (-> Symbol Bit) + (function (_ tag) + (|> (do //phase.monad + [_ (//module.declare_labels false tags false variantT) + [actualT analysis] (|> (/.variant ..analysis tag archive.empty tagC) + //type.inferring)] + (in (case analysis + (pattern (//analysis.variant [lefts' right?' analysis])) + (and (n.= lefts lefts') + (bit#= right? right?') + (..analysed? tagC analysis) + (type#= variantT actualT)) + + _ + false))) + (//module.with 0 module) + (//phase#each product.right) + (//phase.result state) + (try.else false))))] (and (expected_variant? [module tag]) (expected_variant? ["" tag]) (inferred_variant? [module tag]) @@ -300,26 +300,26 @@ expected (list#each product.right types/*,terms/*)]] ($_ _.and (_.cover [/.product] - (let [product? (: (-> Type (List Code) Bit) - (function (_ type expected) - (|> (do //phase.monad - [analysis (|> expected - (/.product ..analysis archive.empty) - (//type.expecting type))] - (in (case analysis - (pattern (//analysis.tuple actual)) - (and (n.= (list.size expected) - (list.size actual)) - (list.every? (function (_ [expected actual]) - (..analysed? expected actual)) - (list.zipped/2 expected actual))) - - _ - false))) - (//module.with 0 module) - (//phase#each product.right) - (//phase.result state) - (try.else false))))] + (let [product? (is (-> Type (List Code) Bit) + (function (_ type expected) + (|> (do //phase.monad + [analysis (|> expected + (/.product ..analysis archive.empty) + (//type.expecting type))] + (in (case analysis + (pattern (//analysis.tuple actual)) + (and (n.= (list.size expected) + (list.size actual)) + (list.every? (function (_ [expected actual]) + (..analysed? expected actual)) + (list.zipped/2 expected actual))) + + _ + false))) + (//module.with 0 module) + (//phase#each product.right) + (//phase.result state) + (try.else false))))] (and (product? productT expected) (product? {.#Named name productT} expected) (product? (type (Ex (_ a) [a a])) (list term/0 term/0)) @@ -408,11 +408,11 @@ (try.else false))))) (_.for [/.cannot_analyse_tuple] (_.cover [/.invalid_tuple_type] - (let [failure? (: (All (_ a) (-> (Exception a) (//analysis.Operation Any) Bit)) - (function (_ exception operation) - (let [it (//phase.result state operation)] - (and (..failure? /.cannot_analyse_tuple it) - (..failure? exception it)))))] + (let [failure? (is (All (_ a) (-> (Exception a) (//analysis.Operation Any) Bit)) + (function (_ exception operation) + (let [it (//phase.result state operation)] + (and (..failure? /.cannot_analyse_tuple it) + (..failure? exception it)))))] (and (|> expected (/.product ..analysis archive.empty) (//type.expecting (|> types/*,terms/* @@ -472,21 +472,21 @@ slots/0)]] ($_ _.and (_.cover [/.normal] - (let [normal? (: (-> (List [Symbol Code]) (List Code) Bit) - (function (_ expected input) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/0 false :record:)] - (/.normal false input)) - (//module.with 0 module) - (//phase#each product.right) - (//phase.result state) - (pipe.case - {try.#Success {.#Some actual}} - (let [(open "list#[0]") (list.equivalence (product.equivalence symbol.equivalence code.equivalence))] - (list#= expected (list.reversed actual))) - - _ - false))))] + (let [normal? (is (-> (List [Symbol Code]) (List Code) Bit) + (function (_ expected input) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/0 false :record:)] + (/.normal false input)) + (//module.with 0 module) + (//phase#each product.right) + (//phase.result state) + (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) @@ -501,33 +501,33 @@ (_.cover [/.order] (let [local_record (list.zipped/2 (list#each (|>> [""]) slots/0) tuple) global_record (list.zipped/2 (list#each (|>> [module]) slots/0) tuple) - ordered? (: (-> Bit (List [Symbol Code]) Bit) - (function (_ pattern_matching? input) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/0 false :record:)] - (/.order pattern_matching? input)) - //scope.with - (//module.with 0 module) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (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) - (pipe.case - (pattern {try.#Success {.#Some [0 (list) actual_type]}}) - (same? .Any actual_type) - - _ - false))))] + ordered? (is (-> Bit (List [Symbol Code]) Bit) + (function (_ pattern_matching? input) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/0 false :record:)] + (/.order pattern_matching? input)) + //scope.with + (//module.with 0 module) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (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? (is (-> Bit Bit) + (function (_ pattern_matching?) + (|> (/.order false (list)) + (//phase.result state) + (pipe.case + (pattern {try.#Success {.#Some [0 (list) actual_type]}}) + (same? .Any actual_type) + + _ + false))))] (and (ordered? false global_record) (ordered? false (list.reversed global_record)) (ordered? false local_record) @@ -544,29 +544,29 @@ ... TODO: Test what happens when slots are shadowed by local bindings. ))) (_.cover [/.cannot_repeat_slot] - (let [repeated? (: (-> Bit Bit) - (function (_ pattern_matching?) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/0 false :record:)] - (/.order pattern_matching? (list.repeated arity [[module head_slot/0] head_term/0]))) - (//module.with 0 module) - (//phase#each product.right) - (//phase.result state) - (..failure? /.cannot_repeat_slot))))] + (let [repeated? (is (-> Bit Bit) + (function (_ pattern_matching?) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/0 false :record:)] + (/.order pattern_matching? (list.repeated arity [[module head_slot/0] head_term/0]))) + (//module.with 0 module) + (//phase#each product.right) + (//phase.result state) + (..failure? /.cannot_repeat_slot))))] (and (repeated? false) (repeated? true)))) (_.cover [/.record_size_mismatch] (let [local_record (list.zipped/2 (list#each (|>> [""]) slots/0) tuple) global_record (list.zipped/2 (list#each (|>> [module]) slots/0) tuple) - mismatched? (: (-> Bit (List [Symbol Code]) Bit) - (function (_ pattern_matching? input) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/0 false :record:)] - (/.order pattern_matching? input)) - //scope.with - (//module.with 0 module) - (//phase.result state) - (..failure? /.record_size_mismatch))))] + mismatched? (is (-> Bit (List [Symbol Code]) Bit) + (function (_ pattern_matching? input) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/0 false :record:)] + (/.order pattern_matching? input)) + //scope.with + (//module.with 0 module) + (//phase.result state) + (..failure? /.record_size_mismatch))))] (and (mismatched? false (list.first slice local_record)) (mismatched? false (list#composite local_record (list.first slice local_record))) @@ -577,47 +577,47 @@ (_.cover [/.slot_does_not_belong_to_record] (let [local_record (list.zipped/2 (list#each (|>> [""]) slots/01) tuple) global_record (list.zipped/2 (list#each (|>> [module]) slots/01) tuple) - mismatched? (: (-> Bit (List [Symbol Code]) Bit) - (function (_ pattern_matching? input) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/0 false :record:) - _ (//module.declare_labels true slots/1 false :record:)] - (/.order pattern_matching? input)) - //scope.with - (//module.with 0 module) - (//phase.result state) - (..failure? /.slot_does_not_belong_to_record))))] + mismatched? (is (-> Bit (List [Symbol Code]) Bit) + (function (_ pattern_matching? input) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/0 false :record:) + _ (//module.declare_labels true slots/1 false :record:)] + (/.order pattern_matching? input)) + //scope.with + (//module.with 0 module) + (//phase.result state) + (..failure? /.slot_does_not_belong_to_record))))] (and (mismatched? false local_record) (mismatched? false global_record) (mismatched? true global_record)))) (_.cover [/.record] - (let [record? (: (-> Type (List Text) (List Code) Code Bit) - (function (_ type slots tuple expected) - (|> (do //phase.monad - [_ (//module.declare_labels true slots false type)] - (/.record ..analysis archive.empty tuple)) - (//type.expecting type) - //scope.with - (//module.with 0 module) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (try#each (analysed? expected)) - (try.else false)))) - inferred? (: (-> (List Code) Bit) - (function (_ record) - (|> (do //phase.monad - [_ (//module.declare_labels true slots/0 false :record:)] - (//type.inferring - (/.record ..analysis archive.empty record))) - //scope.with - (//module.with 0 module) - (//phase#each (|>> product.right product.right)) - (//phase.result state) - (try#each (function (_ [actual_type actual_term]) - (and (same? :record: actual_type) - (analysed? (code.tuple tuple) actual_term)))) - (try.else false))))] + (let [record? (is (-> Type (List Text) (List Code) Code Bit) + (function (_ type slots tuple expected) + (|> (do //phase.monad + [_ (//module.declare_labels true slots false type)] + (/.record ..analysis archive.empty tuple)) + (//type.expecting type) + //scope.with + (//module.with 0 module) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (try#each (analysed? expected)) + (try.else false)))) + inferred? (is (-> (List Code) Bit) + (function (_ record) + (|> (do //phase.monad + [_ (//module.declare_labels true slots/0 false :record:)] + (//type.inferring + (/.record ..analysis archive.empty record))) + //scope.with + (//module.with 0 module) + (//phase#each (|>> product.right product.right)) + (//phase.result state) + (try#each (function (_ [actual_type actual_term]) + (and (same? :record: actual_type) + (analysed? (code.tuple tuple) actual_term)))) + (try.else false))))] (and (record? {.#Named name .Any} (list) (list) (' [])) (record? {.#Named name type/0} (list) (list term/0) term/0) (record? {.#Named name type/0} (list slot/0) (list term/0) term/0) 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 fd60e1de8..a770e05e3 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 @@ -82,41 +82,41 @@ $argument/1 (code.local_symbol argument/1)]] ($_ _.and (_.cover [/.function] - (let [function?' (: (-> Type Code (-> [(List Analysis) Analysis] Bit) Bit) - (function (_ function_type output_term ?) - (|> (do //phase.monad - [analysis (|> (/.function ..analysis function/0 argument/0 archive.empty - output_term) - (//type.expecting function_type))] - (in (case analysis - {//analysis.#Function it} - (? it) + (let [function?' (is (-> Type Code (-> [(List Analysis) Analysis] Bit) Bit) + (function (_ function_type output_term ?) + (|> (do //phase.monad + [analysis (|> (/.function ..analysis function/0 argument/0 archive.empty + output_term) + (//type.expecting function_type))] + (in (case analysis + {//analysis.#Function it} + (? it) - _ - false))) - (//module.with 0 module/0) - (//phase#each product.right) - (//phase.result state) - (try.else false)))) - function? (: (-> Type Code Bit) - (function (_ function_type output_term) - (function?' function_type output_term (function.constant true)))) - inferring? (: (-> Type Code Bit) - (function (_ :expected: term) - (|> (do //phase.monad - [[:actual: analysis] (|> (/.function ..analysis function/0 argument/0 archive.empty - term) - //type.inferring)] - (in (case analysis - {//analysis.#Function [actual_env actual_body]} - (type#= :expected: :actual:) + _ + false))) + (//module.with 0 module/0) + (//phase#each product.right) + (//phase.result state) + (try.else false)))) + function? (is (-> Type Code Bit) + (function (_ function_type output_term) + (function?' function_type output_term (function.constant true)))) + inferring? (is (-> Type Code Bit) + (function (_ :expected: term) + (|> (do //phase.monad + [[:actual: analysis] (|> (/.function ..analysis function/0 argument/0 archive.empty + term) + //type.inferring)] + (in (case analysis + {//analysis.#Function [actual_env actual_body]} + (type#= :expected: :actual:) - _ - false))) - (//module.with 0 module/0) - (//phase#each product.right) - (//phase.result state) - (try.else false))))] + _ + false))) + (//module.with 0 module/0) + (//phase#each product.right) + (//phase.result state) + (try.else false))))] (and (function? (-> input/0 output/0) term/0) (function? (-> input/0 input/0) $argument/0) @@ -206,26 +206,26 @@ module/0 (random.ascii/lower 1)] ($_ _.and (_.cover [/.apply] - (let [reification? (: (-> Type (List Code) Type Bit) - (function (_ :abstraction: terms :expected:) - (|> (do //phase.monad - [[:actual: analysis] (|> (/.apply ..analysis terms - :abstraction: - (//analysis.unit) - archive.empty - (' [])) - //type.inferring)] - (in (and (check.subsumes? :expected: :actual:) - (case analysis - {//analysis.#Apply _} - true + (let [reification? (is (-> Type (List Code) Type Bit) + (function (_ :abstraction: terms :expected:) + (|> (do //phase.monad + [[:actual: analysis] (|> (/.apply ..analysis terms + :abstraction: + (//analysis.unit) + archive.empty + (' [])) + //type.inferring)] + (in (and (check.subsumes? :expected: :actual:) + (case analysis + {//analysis.#Apply _} + true - _ - false)))) - (//module.with 0 module/0) - (//phase#each product.right) - (//phase.result state) - (try.else false))))] + _ + false)))) + (//module.with 0 module/0) + (//phase#each product.right) + (//phase.result state) + (try.else false))))] (and (reification? (-> input/0 input/1 output/0) (list term/0 term/1) output/0) (reification? (-> input/0 input/1 output/0) (list term/0) (-> input/1 output/0)) (reification? (All (_ a) (-> a a)) (list term/0) input/0) 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 d8c5ce4f8..8240bcddc 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 @@ -168,56 +168,56 @@ can_find_alias! can_find_type!))) (_.cover [/.foreign_module_has_not_been_imported] - (let [scenario (: (-> Type Global Bit) - (function (_ expected_type it) - (|> (do //phase.monad - [_ (//module.with 0 import - (//module.define expected_name it)) - _ (/.reference [import expected_name])] - (in false)) - (//type.expecting expected_type) - (//module.with 0 expected_module) - (//phase#each product.right) - (//phase.result state) - (exception.otherwise (text.contains? (the exception.#label /.foreign_module_has_not_been_imported))) - )))] + (let [scenario (is (-> Type Global Bit) + (function (_ expected_type it) + (|> (do //phase.monad + [_ (//module.with 0 import + (//module.define expected_name it)) + _ (/.reference [import expected_name])] + (in false)) + (//type.expecting expected_type) + (//module.with 0 expected_module) + (//phase#each product.right) + (//phase.result state) + (exception.otherwise (text.contains? (the exception.#label /.foreign_module_has_not_been_imported))) + )))] (and (scenario expected_type {.#Definition [#1 expected_type []]}) (scenario .Type {.#Type [#1 expected_type (if record? {.#Right [expected_label (list)]} {.#Left [expected_label (list)]})]})))) (_.cover [/.definition_has_not_been_exported] - (let [scenario (: (-> Type Global Bit) - (function (_ expected_type it) - (|> (do //phase.monad - [_ (//module.with 0 import - (//module.define expected_name it)) - _ (/.reference [import expected_name])] - (in false)) - (//type.expecting expected_type) - (//module.with 0 expected_module) - (//phase#each product.right) - (//phase.result state) - (exception.otherwise (text.contains? (the exception.#label /.definition_has_not_been_exported))) - )))] + (let [scenario (is (-> Type Global Bit) + (function (_ expected_type it) + (|> (do //phase.monad + [_ (//module.with 0 import + (//module.define expected_name it)) + _ (/.reference [import expected_name])] + (in false)) + (//type.expecting expected_type) + (//module.with 0 expected_module) + (//phase#each product.right) + (//phase.result state) + (exception.otherwise (text.contains? (the exception.#label /.definition_has_not_been_exported))) + )))] (and (scenario expected_type {.#Definition [#0 expected_type []]}) (scenario .Type {.#Type [#0 expected_type (if record? {.#Right [expected_label (list)]} {.#Left [expected_label (list)]})]})))) (_.cover [/.labels_are_not_definitions] - (let [scenario (: (-> Type Global Bit) - (function (_ expected_type it) - (|> (do //phase.monad - [_ (//module.with 0 import - (//module.define expected_label it)) - _ (/.reference [import expected_label])] - (in false)) - (//type.expecting expected_type) - (//module.with 0 expected_module) - (//phase#each product.right) - (//phase.result state) - (exception.otherwise (text.contains? (the exception.#label /.labels_are_not_definitions))))))] + (let [scenario (is (-> Type Global Bit) + (function (_ expected_type it) + (|> (do //phase.monad + [_ (//module.with 0 import + (//module.define expected_label it)) + _ (/.reference [import expected_label])] + (in false)) + (//type.expecting expected_type) + (//module.with 0 expected_module) + (//phase#each product.right) + (//phase.result state) + (exception.otherwise (text.contains? (the exception.#label /.labels_are_not_definitions))))))] (and (scenario expected_type {.#Tag [#1 expected_type (list) 0]}) (scenario expected_type {.#Slot [#1 expected_type (list) 0]})))) )))) 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 ea5d4ebb4..5827be799 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 @@ -67,14 +67,14 @@ false)))) (template: (analysis? <type> <tag>) - [(: (-> <type> Analysis Bit) - (function (_ expected) - (|>> (pipe.case - (pattern (<tag> actual)) - (same? expected actual) + [(is (-> <type> Analysis Bit) + (function (_ expected) + (|>> (pipe.case + (pattern (<tag> actual)) + (same? expected actual) - _ - false))))]) + _ + false))))]) (def: .public test (<| (_.covering /._) 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 1f24840eb..307816a02 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 @@ -45,48 +45,48 @@ random.int)] ($_ _.and (_.cover [/.read] - (|> (: (/.Operation Int Nat Nat Text) - (/.read %.int)) + (|> (is (/.Operation Int Nat Nat Text) + (/.read %.int)) (# phase.functor each (text#= (%.int state))) (phase.result [/.#bundle /.empty /.#state state]) (try.else false))) (_.cover [/.update] - (|> (: (/.Operation Int Nat Nat Text) - (do phase.monad - [_ (/.update ++)] - (/.read %.int))) + (|> (is (/.Operation Int Nat Nat Text) + (do phase.monad + [_ (/.update ++)] + (/.read %.int))) (# phase.functor each (text#= (%.int (++ state)))) (phase.result [/.#bundle /.empty /.#state state]) (try.else false))) (_.cover [/.temporary] - (|> (: (/.Operation Int Nat Nat Text) - (do phase.monad - [|state'| (/.temporary ++ (/.read %.int)) - |state| (/.read %.int)] - (in (format |state'| " " |state|)))) + (|> (is (/.Operation Int Nat Nat Text) + (do phase.monad + [|state'| (/.temporary ++ (/.read %.int)) + |state| (/.read %.int)] + (in (format |state'| " " |state|)))) (# phase.functor each (text#= (format (%.int (++ state)) " " (%.int state)))) (phase.result [/.#bundle /.empty /.#state state]) (try.else false))) (_.cover [/.with_state] - (|> (: (/.Operation Int Nat Nat Text) - (/.with_state state - (/.read %.int))) + (|> (is (/.Operation Int Nat Nat Text) + (/.with_state state + (/.read %.int))) (# phase.functor each (text#= (%.int state))) (phase.result [/.#bundle /.empty /.#state dummy]) (try.else false))) (_.cover [/.localized] - (|> (: (/.Operation Int Nat Nat Text) - (do phase.monad - [|state| (/.localized %.int - (function (_ _ old) (++ old)) - (text.enclosed ["<" ">"]) - (/.read %.int)) - |state'| (/.read %.int)] - (in (format |state'| " " |state|)))) + (|> (is (/.Operation Int Nat Nat Text) + (do phase.monad + [|state| (/.localized %.int + (function (_ _ old) (++ old)) + (text.enclosed ["<" ">"]) + (/.read %.int)) + |state'| (/.read %.int)] + (in (format |state'| " " |state|)))) (# phase.functor each (text#= (format (%.int (i.+ +2 state)) " " (%.int (i.+ +1 state))))) (phase.result [/.#bundle /.empty @@ -96,7 +96,7 @@ (def: extender /.Extender - (|>> :expected)) + (|>> as_expected)) (def: handler/0 (/.Handler Int Nat Nat) @@ -144,9 +144,9 @@ (def: test|bundle Test - (let [phase (: (/.Phase Int Nat Nat) - (function (_ archive input) - (# phase.monad in (++ input))))] + (let [phase (is (/.Phase Int Nat Nat) + (function (_ archive input) + (# phase.monad in (++ input))))] (do [! random.monad] [state random.int @@ -167,12 +167,12 @@ /.#state state]) (try.else false))) (_.cover [/.Phase] - (let [handler (: (/.Handler Int Nat Nat) - (function (_ @self phase archive inputs) - (let [! phase.monad] - (|> inputs - (monad.each ! (phase archive)) - (# ! each (list#mix n.+ 0))))))] + (let [handler (is (/.Handler Int Nat Nat) + (function (_ @self phase archive inputs) + (let [! phase.monad] + (|> inputs + (monad.each ! (phase archive)) + (# ! each (list#mix n.+ 0))))))] (|> (do phase.monad [_ (/.install extender extension handler)] (/.apply archive.empty phase [extension (list left right)])) @@ -191,9 +191,9 @@ /.#state state]) (try.else false))) (_.cover [/.incorrect_arity] - (let [handler (: (/.Handler Int Nat Nat) - (function (_ @self phase archive inputs) - (phase.except /.incorrect_arity [@self 2 (list.size inputs)])))] + (let [handler (is (/.Handler Int Nat Nat) + (function (_ @self phase archive inputs) + (phase.except /.incorrect_arity [@self 2 (list.size inputs)])))] (|> (do phase.monad [_ (/.install extender extension handler)] (/.apply archive.empty phase [extension (list)])) @@ -206,9 +206,9 @@ _ false)))) (_.cover [/.invalid_syntax] - (let [handler (: (/.Handler Int Nat Nat) - (function (_ @self phase archive inputs) - (phase.except /.invalid_syntax [@self %.nat inputs])))] + (let [handler (is (/.Handler Int Nat Nat) + (function (_ @self phase archive inputs) + (phase.except /.invalid_syntax [@self %.nat inputs])))] (|> (do phase.monad [_ (/.install extender extension handler)] (/.apply archive.empty phase [extension (list left right)])) @@ -244,16 +244,16 @@ (<| (_.for [/.Operation]) ($_ _.and (_.cover [/.lifted] - (and (|> (: (/.Operation Int Nat Nat Nat) - (/.lifted (do phase.monad - [] - (in expected)))) + (and (|> (is (/.Operation Int Nat Nat Nat) + (/.lifted (do phase.monad + [] + (in expected)))) (# phase.functor each (same? expected)) (phase.result [/.#bundle /.empty /.#state state]) (try.else false)) - (|> (: (/.Operation Int Nat Nat Nat) - (/.lifted (phase.lifted {try.#Failure expected_error}))) + (|> (is (/.Operation Int Nat Nat Nat) + (/.lifted (phase.lifted {try.#Failure expected_error}))) (phase.result [/.#bundle /.empty /.#state state]) (pipe.case @@ -266,9 +266,9 @@ (|> (do phase.monad [] (in expected)) - (: (/.Operation Int Nat Nat Nat)) + (is (/.Operation Int Nat Nat Nat)) /.up - (: (phase.Operation Int Nat)) + (is (phase.Operation Int Nat)) (# phase.functor each (same? expected)) (phase.result state) (try.else false))) 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 ea325ec72..aaa52ad0f 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 @@ -87,12 +87,12 @@ inputA //primitive.primitive thenA //primitive.primitive elseA //primitive.primitive - .let [thenB (: Branch - [{analysis.#Simple {analysis.#Bit true}} - thenA]) - elseB (: Branch - [{analysis.#Simple {analysis.#Bit false}} - elseA]) + .let [thenB (is Branch + [{analysis.#Simple {analysis.#Bit true}} + thenA]) + elseB (is Branch + [{analysis.#Simple {analysis.#Bit false}} + elseA]) ifA (if then|else (analysis.case [inputA [thenB (list elseB)]]) (analysis.case [inputA [elseB (list thenB)]]))]] @@ -237,20 +237,20 @@ [value/0 value/1 value/2 value/3 value/4] (random_five text.hash (random.unicode 1)) last_is_right? random.bit [body/0 body/1 body/2 body/3 body/4] (random_five frac.hash random.frac) - .let [path (: (-> Nat Bit Text Frac Path) - (function (_ lefts right? value body) - ($_ {synthesis.#Seq} - (synthesis.path/side (if right? - {.#Right lefts} - {.#Left lefts})) - (synthesis.path/text value) - {synthesis.#Then (synthesis.f64 body)}))) - branch (: (-> Nat Bit Text Frac Branch) - (function (_ lefts right? value body) - [analysis.#when (analysis.pattern/variant [analysis.#lefts lefts - analysis.#right? right? - analysis.#value (analysis.pattern/text value)]) - analysis.#then (analysis.frac body)]))]] + .let [path (is (-> Nat Bit Text Frac Path) + (function (_ lefts right? value body) + ($_ {synthesis.#Seq} + (synthesis.path/side (if right? + {.#Right lefts} + {.#Left lefts})) + (synthesis.path/text value) + {synthesis.#Then (synthesis.f64 body)}))) + branch (is (-> Nat Bit Text Frac Branch) + (function (_ lefts right? value body) + [analysis.#when (analysis.pattern/variant [analysis.#lefts lefts + analysis.#right? right? + analysis.#value (analysis.pattern/text value)]) + analysis.#then (analysis.frac body)]))]] (in [($_ {synthesis.#Alt} (path lefts/0 false value/0 body/0) (path lefts/1 false value/1 body/1) @@ -275,32 +275,32 @@ body/first random.frac body/mid (random.list mid_size random.frac) body/last random.frac - .let [path (: (-> Nat Bit Text Frac Path) - (function (_ lefts right? value body) - (if right? - ($_ {synthesis.#Seq} - (synthesis.path/member (if right? - {.#Right lefts} - {.#Left lefts})) - (synthesis.path/text value) - {synthesis.#Then (synthesis.f64 body)}) - ($_ {synthesis.#Seq} - (synthesis.path/member (if right? - {.#Right lefts} - {.#Left lefts})) - (synthesis.path/text value) - {synthesis.#Pop} - {synthesis.#Then (synthesis.f64 body)})))) - branch (: (-> Nat Bit Text Frac Branch) - (function (_ lefts right? value body) - [analysis.#when (if right? - (analysis.pattern/tuple (list#composite (list.repeated (++ lefts) (analysis.pattern/unit)) - (list (analysis.pattern/text value)))) - (analysis.pattern/tuple ($_ list#composite - (list.repeated lefts (analysis.pattern/unit)) - (list (analysis.pattern/text value) - (analysis.pattern/unit))))) - analysis.#then (analysis.frac body)]))]] + .let [path (is (-> Nat Bit Text Frac Path) + (function (_ lefts right? value body) + (if right? + ($_ {synthesis.#Seq} + (synthesis.path/member (if right? + {.#Right lefts} + {.#Left lefts})) + (synthesis.path/text value) + {synthesis.#Then (synthesis.f64 body)}) + ($_ {synthesis.#Seq} + (synthesis.path/member (if right? + {.#Right lefts} + {.#Left lefts})) + (synthesis.path/text value) + {synthesis.#Pop} + {synthesis.#Then (synthesis.f64 body)})))) + branch (is (-> Nat Bit Text Frac Branch) + (function (_ lefts right? value body) + [analysis.#when (if right? + (analysis.pattern/tuple (list#composite (list.repeated (++ lefts) (analysis.pattern/unit)) + (list (analysis.pattern/text value)))) + (analysis.pattern/tuple ($_ list#composite + (list.repeated lefts (analysis.pattern/unit)) + (list (analysis.pattern/text value) + (analysis.pattern/unit))))) + analysis.#then (analysis.frac body)]))]] (in [(list#mix (function (_ left right) {synthesis.#Alt left right}) (path (++ mid_size) true value/last body/last) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 1f220e13a..84c3873aa 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -109,48 +109,48 @@ (def: path (Scenario Path) - (let [pattern (: (Scenario Path) - (.function (again offset arity next) - (`` ($_ random.either - (random#in [next - [//.path/pop - //.path/pop]]) - (~~ (template [<path> <random>] - [(do [! random.monad] - [example (# ! each (|>> <path>) <random>)] - (in [next - [example - example]]))] + (let [pattern (is (Scenario Path) + (.function (again offset arity next) + (`` ($_ random.either + (random#in [next + [//.path/pop + //.path/pop]]) + (~~ (template [<path> <random>] + [(do [! random.monad] + [example (# ! each (|>> <path>) <random>)] + (in [next + [example + example]]))] - [//.path/bit random.bit] - [//.path/i64 (# ! each .i64 random.nat)] - [//.path/f64 random.frac] - [//.path/text (random.unicode 1)] - )) - (~~ (template [<path>] - [(do [! random.monad] - [example (# ! each (|>> <path>) - (random.or random.nat - random.nat))] - (in [next - [example - example]]))] + [//.path/bit random.bit] + [//.path/i64 (# ! each .i64 random.nat)] + [//.path/f64 random.frac] + [//.path/text (random.unicode 1)] + )) + (~~ (template [<path>] + [(do [! random.monad] + [example (# ! each (|>> <path>) + (random.or random.nat + random.nat))] + (in [next + [example + example]]))] - [//.path/side] - [//.path/member] - )) - (random#in [(++ next) - [(//.path/bind (/.register_optimization offset next)) - (//.path/bind next)]]) - )))) - sequential (: (Scenario Path) - (.function (again offset arity next) - (do random.monad - [[next [patternE patternA]] (pattern offset arity next) - [next [bodyE bodyA]] (..reference offset arity next)] - (in [next - [(//.path/seq patternE (//.path/then bodyE)) - (//.path/seq patternA (//.path/then bodyA))]]))))] + [//.path/side] + [//.path/member] + )) + (random#in [(++ next) + [(//.path/bind (/.register_optimization offset next)) + (//.path/bind next)]]) + )))) + sequential (is (Scenario Path) + (.function (again offset arity next) + (do random.monad + [[next [patternE patternA]] (pattern offset arity next) + [next [bodyE bodyA]] (..reference offset arity next)] + (in [next + [(//.path/seq patternE (//.path/then bodyE)) + (//.path/seq patternA (//.path/then bodyA))]]))))] (.function (again offset arity next) (do random.monad [[next [leftE leftA]] (sequential offset arity next) @@ -161,9 +161,9 @@ (def: (branch offset arity next) (Scenario Synthesis) - (let [random_member (: (Random Member) - (random.or random.nat - random.nat))] + (let [random_member (is (Random Member) + (random.or random.nat + random.nat))] ($_ random.either ($_ random.either (do [! random.monad] 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 80499a5e2..2de99cd64 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 @@ -31,15 +31,15 @@ (def: .public primitive (Random Analysis) (do r.monad - [primitive (: (Random ////analysis.Primitive) - ($_ r.or - (in []) - r.bit - r.nat - r.int - r.rev - r.frac - (r.unicode 5)))] + [primitive (is (Random ////analysis.Primitive) + ($_ r.or + (in []) + r.bit + r.nat + r.int + r.rev + r.frac + (r.unicode 5)))] (in {////analysis.#Primitive primitive}))) (def: .public (corresponds? analysis synthesis) @@ -51,7 +51,7 @@ (same? (|> expected <post_analysis>) (|> actual <post_synthesis>))] - [////analysis.#Unit (:as Text) ////synthesis.#Text (|>)] + [////analysis.#Unit (as Text) ////synthesis.#Text (|>)] [////analysis.#Bit (|>) ////synthesis.#Bit (|>)] [////analysis.#Nat .i64 ////synthesis.#I64 .i64] [////analysis.#Int .i64 ////synthesis.#I64 .i64] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux index 90d5b825c..c253f7107 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -1,28 +1,28 @@ (.using - [lux "*" - [abstract/monad {"+" do}] - [data - ["%" text/format {"+" format}] - [number - ["n" nat]]] - ["r" math/random {"+" Random} ("[1]#[0]" monad)] - ["_" test {"+" Test}] - [control - ["[0]" try] - [parser - ["l" text]]] - [data - ["[0]" text] - [collection - ["[0]" list] - ["[0]" dictionary {"+" Dictionary}]]] - [macro - ["[0]" code]] - [meta - ["[0]" location] - ["[0]" symbol]]] - [\\ - ["[0]" /]]) + [lux "*" + [abstract/monad {"+" do}] + [data + ["%" text/format {"+" format}] + [number + ["n" nat]]] + ["r" math/random {"+" Random} ("[1]#[0]" monad)] + ["_" test {"+" Test}] + [control + ["[0]" try] + [parser + ["l" text]]] + [data + ["[0]" text] + [collection + ["[0]" list] + ["[0]" dictionary {"+" Dictionary}]]] + [macro + ["[0]" code]] + [meta + ["[0]" location] + ["[0]" symbol]]] + [\\ + ["[0]" /]]) (def: symbol_part^ (Random Text) @@ -36,37 +36,37 @@ (def: code^ (Random Code) - (let [numeric^ (: (Random Code) + (let [numeric^ (is (Random Code) + ($_ r.either + (|> r.bit (r#each code.bit)) + (|> r.nat (r#each code.nat)) + (|> r.int (r#each code.int)) + (|> r.rev (r#each code.rev)) + (|> r.safe_frac (r#each code.frac)))) + textual^ (is (Random Code) + ($_ r.either + (do r.monad + [size (|> r.nat (r#each (n.% 20)))] + (|> (r.ascii/upper_alpha size) (r#each code.text))) + (|> symbol^ (r#each code.symbol)) + (|> symbol^ (r#each code.tag)))) + simple^ (is (Random Code) ($_ r.either - (|> r.bit (r#each code.bit)) - (|> r.nat (r#each code.nat)) - (|> r.int (r#each code.int)) - (|> r.rev (r#each code.rev)) - (|> r.safe_frac (r#each code.frac)))) - textual^ (: (Random Code) - ($_ r.either - (do r.monad - [size (|> r.nat (r#each (n.% 20)))] - (|> (r.ascii/upper_alpha size) (r#each code.text))) - (|> symbol^ (r#each code.symbol)) - (|> symbol^ (r#each code.tag)))) - simple^ (: (Random Code) - ($_ r.either - numeric^ - textual^))] + numeric^ + textual^))] (r.rec (function (_ code^) (let [multi^ (do r.monad [size (|> r.nat (r#each (n.% 3)))] (r.list size code^)) - composite^ (: (Random Code) - ($_ r.either - (|> multi^ (r#each code.form)) - (|> multi^ (r#each code.tuple)) - (do r.monad - [size (|> r.nat (r#each (n.% 3)))] - (|> (r.list size (r.and code^ code^)) - (r#each code.record)))))] + composite^ (is (Random Code) + ($_ r.either + (|> multi^ (r#each code.form)) + (|> multi^ (r#each code.tuple)) + (do r.monad + [size (|> r.nat (r#each (n.% 3)))] + (|> (r.list size (r.and code^ code^)) + (r#each code.record)))))] ($_ r.either simple^ composite^)))))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux index e347edf4a..d012390fc 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/registry.lux @@ -111,12 +111,12 @@ _ false)))))] - [/.definition (: category.Definition [expected_name {.#None}]) /.definitions category.#Definition /.analyser expected_name] + [/.definition (is category.Definition [expected_name {.#None}]) /.definitions category.#Definition /.analyser expected_name] [/.analyser expected_name /.analysers category.#Analyser /.synthesizer expected_name] [/.synthesizer expected_name /.synthesizers category.#Synthesizer /.generator expected_name] [/.generator expected_name /.generators category.#Generator /.directive expected_name] [/.directive expected_name /.directives category.#Directive /.custom expected_name] - [/.custom expected_name /.customs category.#Custom /.definition (: category.Definition [expected_name {.#None}])] + [/.custom expected_name /.customs category.#Custom /.definition (is category.Definition [expected_name {.#None}])] )) (_.cover [/.id] (and (~~ (template [<new> <expected>' <name>] @@ -126,7 +126,7 @@ (maybe#each (same? @expected)) (maybe.else false)))] - [/.definition (: category.Definition [expected_name {.#None}]) product.left] + [/.definition (is category.Definition [expected_name {.#None}]) product.left] [/.analyser expected_name |>] [/.synthesizer expected_name |>] [/.generator expected_name |>] @@ -136,12 +136,12 @@ (_.cover [/.artifacts] (and (~~ (template [<new> <query> <equivalence> <$>] [(let [expected/* (list#each <$> expected_names) - [ids registry] (: [(Sequence artifact.ID) /.Registry] - (list#mix (function (_ expected [ids registry]) - (let [[@new registry] (<new> expected mandatory? expected_dependencies registry)] - [(sequence.suffix @new ids) registry])) - [sequence.empty /.empty] - expected/*)) + [ids registry] (is [(Sequence artifact.ID) /.Registry] + (list#mix (function (_ expected [ids registry]) + (let [[@new registry] (<new> expected mandatory? expected_dependencies registry)] + [(sequence.suffix @new ids) registry])) + [sequence.empty /.empty] + expected/*)) it (/.artifacts registry)] (and (n.= expected_amount (sequence.size it)) (list.every? (function (_ [@it [it dependencies]]) @@ -149,9 +149,9 @@ (list.zipped/2 (sequence.list ids) (sequence.list it))) (# (list.equivalence <equivalence>) = expected/* (<query> registry))))] - [/.definition /.definitions category.definition_equivalence (: (-> Text category.Definition) - (function (_ it) - [it {.#None}]))] + [/.definition /.definitions category.definition_equivalence (is (-> Text category.Definition) + (function (_ it) + [it {.#None}]))] [/.analyser /.analysers text.equivalence (|>>)] [/.synthesizer /.synthesizers text.equivalence (|>>)] [/.generator /.generators text.equivalence (|>>)] @@ -170,7 +170,7 @@ (maybe.else false))) (try.else false)))] - [/.definition (: category.Definition [expected_name {.#None}]) product.left] + [/.definition (is category.Definition [expected_name {.#None}]) product.left] [/.analyser expected_name |>] [/.synthesizer expected_name |>] [/.generator expected_name |>] diff --git a/stdlib/source/test/lux/tool/compiler/meta/cache/purge.lux b/stdlib/source/test/lux/tool/compiler/meta/cache/purge.lux index 700cf75d7..f7e008720 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/cache/purge.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/cache/purge.lux @@ -77,40 +77,40 @@ ($_ _.and (_.cover [/.purge] (and (dictionary.empty? (/.purge (list) (list))) - (let [order (: (dependency.Order Nat) - (list [name/0 id/0 - [archive.#module module/0 - archive.#output (sequence.sequence) - archive.#registry registry.empty]]))] - (and (let [cache (: (List /.Cache) - (list [#1 name/0 id/0 module/0 registry.empty]))] + (let [order (is (dependency.Order Nat) + (list [name/0 id/0 + [archive.#module module/0 + archive.#output (sequence.sequence) + archive.#registry registry.empty]]))] + (and (let [cache (is (List /.Cache) + (list [#1 name/0 id/0 module/0 registry.empty]))] (dictionary.empty? (/.purge cache order))) - (let [cache (: (List /.Cache) - (list [#0 name/0 id/0 module/0 registry.empty]))] + (let [cache (is (List /.Cache) + (list [#0 name/0 id/0 module/0 registry.empty]))] (dictionary.key? (/.purge cache order) name/0)))) - (let [order (: (dependency.Order Nat) - (list [name/0 id/0 - [archive.#module module/0 - archive.#output (sequence.sequence) - archive.#registry registry.empty]] - [name/1 id/1 - [archive.#module module/1 - archive.#output (sequence.sequence) - archive.#registry registry.empty]]))] - (and (let [cache (: (List /.Cache) - (list [#1 name/0 id/0 module/0 registry.empty] - [#1 name/1 id/1 module/1 registry.empty])) + (let [order (is (dependency.Order Nat) + (list [name/0 id/0 + [archive.#module module/0 + archive.#output (sequence.sequence) + archive.#registry registry.empty]] + [name/1 id/1 + [archive.#module module/1 + archive.#output (sequence.sequence) + archive.#registry registry.empty]]))] + (and (let [cache (is (List /.Cache) + (list [#1 name/0 id/0 module/0 registry.empty] + [#1 name/1 id/1 module/1 registry.empty])) purge (/.purge cache order)] (dictionary.empty? purge)) - (let [cache (: (List /.Cache) - (list [#1 name/0 id/0 module/0 registry.empty] - [#0 name/1 id/1 module/1 registry.empty])) + (let [cache (is (List /.Cache) + (list [#1 name/0 id/0 module/0 registry.empty] + [#0 name/1 id/1 module/1 registry.empty])) purge (/.purge cache order)] (and (not (dictionary.key? (/.purge cache order) name/0)) (dictionary.key? (/.purge cache order) name/1))) - (let [cache (: (List /.Cache) - (list [#0 name/0 id/0 module/0 registry.empty] - [#1 name/1 id/1 module/1 registry.empty])) + (let [cache (is (List /.Cache) + (list [#0 name/0 id/0 module/0 registry.empty] + [#1 name/1 id/1 module/1 registry.empty])) purge (/.purge cache order)] (and (dictionary.key? (/.purge cache order) name/0) (dictionary.key? (/.purge cache order) name/1))))))) diff --git a/stdlib/source/test/lux/tool/compiler/meta/export.lux b/stdlib/source/test/lux/tool/compiler/meta/export.lux index 82efdf546..d25da0be5 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/export.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/export.lux @@ -44,8 +44,8 @@ source/1 (random.ascii/lower 2) target (random.ascii/lower 3) - .let [random_file (: (Random file.Path) - (# ! each (text.suffix io.lux_extension) (random.ascii/lower 4)))] + .let [random_file (is (Random file.Path) + (# ! each (text.suffix io.lux_extension) (random.ascii/lower 4)))] file/0' random_file .let [file/0 (format source/0 / file/0')] @@ -53,8 +53,8 @@ file/1' (# ! each (|>> (format dir/0 /)) random_file) .let [file/1 (format source/1 / file/1')] - .let [random_content (: (Random Binary) - (# ! each (|>> %.nat (# utf8.codec encoded)) random.nat))] + .let [random_content (is (Random Binary) + (# ! each (|>> %.nat (# utf8.codec encoded)) random.nat))] content/0 random_content content/1 random_content] ($_ _.and diff --git a/stdlib/source/test/lux/tool/compiler/meta/import.lux b/stdlib/source/test/lux/tool/compiler/meta/import.lux index e601614f6..c01a790ce 100644 --- a/stdlib/source/test/lux/tool/compiler/meta/import.lux +++ b/stdlib/source/test/lux/tool/compiler/meta/import.lux @@ -48,15 +48,15 @@ library/1 (random.ascii/lower 2) .let [/ .module_separator - random_file (: (Random file.Path) - (# ! each (text.suffix io.lux_extension) (random.ascii/lower 3)))] + random_file (is (Random file.Path) + (# ! each (text.suffix io.lux_extension) (random.ascii/lower 3)))] file/0 random_file dir/0 (random.ascii/lower 4) file/1 (# ! each (|>> (format dir/0 /)) random_file) - .let [random_content (: (Random Binary) - (# ! each (|>> %.nat (# utf8.codec encoded)) random.nat))] + .let [random_content (is (Random Binary) + (# ! each (|>> %.nat (# utf8.codec encoded)) random.nat))] now random.instant content/0 random_content content/1 random_content @@ -97,17 +97,17 @@ (in (|> (sequence.sequence {tar.#Directory file/0}) (format.result tar.writer)))) (try.else (binary.empty 0))) - imported? (: (-> /.Import Bit) - (function (_ it) - (and (n.= 2 (dictionary.size it)) - (|> it - (dictionary.value file/0) - (maybe#each (binary#= content/0)) - (maybe.else false)) - (|> it - (dictionary.value file/1) - (maybe#each (binary#= content/1)) - (maybe.else false)))))]] + imported? (is (-> /.Import Bit) + (function (_ it) + (and (n.= 2 (dictionary.size it)) + (|> it + (dictionary.value file/0) + (maybe#each (binary#= content/0)) + (maybe.else false)) + (|> it + (dictionary.value file/1) + (maybe#each (binary#= content/1)) + (maybe.else false)))))]] ($_ _.and (in (do [! async.monad] [it/0 (do (try.with !) diff --git a/stdlib/source/test/lux/tool/compiler/phase.lux b/stdlib/source/test/lux/tool/compiler/phase.lux index 19ec57c3c..ced6edd48 100644 --- a/stdlib/source/test/lux/tool/compiler/phase.lux +++ b/stdlib/source/test/lux/tool/compiler/phase.lux @@ -178,12 +178,12 @@ (try#each (same? expected)) (try.else false))) (_.cover [/.composite] - (let [phase (/.composite (: (/.Phase Nat Int Frac) - (function (_ archive input) - (# /.monad in (i.frac input)))) - (: (/.Phase Rev Frac Text) - (function (_ archive input) - (# /.monad in (%.frac input)))))] + (let [phase (/.composite (is (/.Phase Nat Int Frac) + (function (_ archive input) + (# /.monad in (i.frac input)))) + (is (/.Phase Rev Frac Text) + (function (_ archive input) + (# /.monad in (%.frac input)))))] (|> (phase archive.empty expected) (/.result' [state/0 state/1]) (pipe.case {try.#Success [[state/0' state/1'] actual]} diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index c173fdc85..6e19e21a0 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -51,15 +51,15 @@ (random.rec (function (_ again) (let [pairG (random.and again again) - un_parameterized (: (Random Type) - ($_ random.either - (random#each (|>> {.#Primitive}) (random.and ..short (random.list 0 again))) - (random#each (|>> {.#Primitive}) (random.and ..short (random.list 1 again))) - (random#each (|>> {.#Primitive}) (random.and ..short (random.list 2 again))) - (random#each (|>> {.#Sum}) pairG) - (random#each (|>> {.#Product}) pairG) - (random#each (|>> {.#Function}) pairG) - ))] + un_parameterized (is (Random Type) + ($_ random.either + (random#each (|>> {.#Primitive}) (random.and ..short (random.list 0 again))) + (random#each (|>> {.#Primitive}) (random.and ..short (random.list 1 again))) + (random#each (|>> {.#Primitive}) (random.and ..short (random.list 2 again))) + (random#each (|>> {.#Sum}) pairG) + (random#each (|>> {.#Product}) pairG) + (random#each (|>> {.#Function}) pairG) + ))] (case parameters 0 un_parameterized _ (|> random.nat @@ -195,40 +195,50 @@ (and (not (/.array? element_type)) (/.array? (/.array depth element_type)))) )) - (_.cover [/.:by_example] - (let [example (: (Maybe Nat) - {.#None})] + (_.cover [/.by_example] + (let [example (is (Maybe Nat) + {.#None})] (/#= (.type (List Nat)) - (/.:by_example [a] - (Maybe a) - example - - (List a))))) + (/.by_example [a] + (Maybe a) + example + + (List a))))) (do random.monad [sample random.nat] - (_.cover [/.:log!] + (_.cover [/.log!] (exec - (/.:log! sample) + (/.log! sample) true))) (do random.monad [left random.nat right (random.ascii/lower 1) .let [left,right [left right]]] - (_.cover [/.:as] + (_.cover [/.as] (|> left,right - (/.:as [l r] (And l r) (Or l r)) - (/.:as [l r] (Or l r) (And l r)) + (/.as [l r] (And l r) (Or l r)) + (/.as [l r] (Or l r) (And l r)) (same? left,right)))) (do random.monad [expected random.nat] - (_.cover [/.:sharing] + (_.cover [/.sharing] (n.= expected - (/.:sharing [a] - (I64 a) - expected + (/.sharing [a] + (I64 a) + expected - (I64 a) - (.i64 expected))))) + (I64 a) + (.i64 expected))))) + (do random.monad + [expected_left random.nat + expected_right random.nat] + (_.cover [/.let] + (let [[actual_left actual_right] + (is (/.let [side /.Nat] + [side side]) + [expected_left expected_right])] + (and (same? expected_left actual_left) + (same? expected_right actual_right))))) (do random.monad [.let [(open "/#[0]") /.equivalence] left (..random 0) diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux index 770fc60a4..8bae5b3bc 100644 --- a/stdlib/source/test/lux/type/abstract.lux +++ b/stdlib/source/test/lux/type/abstract.lux @@ -60,43 +60,43 @@ [expected_foo (random.ascii/lower 5) expected_bar random.nat] ($_ _.and - (_.cover [/.:abstraction] - (and (exec (: (g!Foo Text) - (/.:abstraction g!Foo expected_foo)) + (_.cover [/.abstraction] + (and (exec (is (g!Foo Text) + (/.abstraction g!Foo expected_foo)) true) - (exec (: (g!Bar Text) - (/.:abstraction expected_bar)) + (exec (is (g!Bar Text) + (/.abstraction expected_bar)) true))) - (_.cover [/.:representation] + (_.cover [/.representation] (and (|> expected_foo - (/.:abstraction g!Foo) - (: (g!Foo Bit)) - (/.:representation g!Foo) + (/.abstraction g!Foo) + (is (g!Foo Bit)) + (/.representation g!Foo) (text#= expected_foo)) - (|> (/.:abstraction expected_bar) - (: (g!Bar Bit)) - /.:representation + (|> (/.abstraction expected_bar) + (is (g!Bar Bit)) + /.representation (n.= expected_bar)))) - (_.cover [/.:transmutation] + (_.cover [/.transmutation] (and (exec (|> expected_foo - (/.:abstraction g!Foo) - (: (g!Foo .Macro)) - (/.:transmutation g!Foo) - (: (g!Foo .Lux))) + (/.abstraction g!Foo) + (is (g!Foo .Macro)) + (/.transmutation g!Foo) + (is (g!Foo .Lux))) true) - (exec (|> (/.:abstraction expected_bar) - (: (g!Bar .Macro)) - /.:transmutation - (: (g!Bar .Lux))) + (exec (|> (/.abstraction expected_bar) + (is (g!Bar .Macro)) + /.transmutation + (is (g!Bar .Lux))) true))) - (_.cover [/.^:representation] - (and (let [(/.^:representation g!Foo actual_foo) - (: (g!Foo .Module) - (/.:abstraction g!Foo expected_foo))] + (_.cover [/.pattern] + (and (let [(/.pattern g!Foo actual_foo) + (is (g!Foo .Module) + (/.abstraction g!Foo expected_foo))] (text#= expected_foo actual_foo)) - (let [(/.^:representation actual_bar) - (: (g!Bar .Module) - (/.:abstraction expected_bar))] + (let [(/.pattern actual_bar) + (is (g!Bar .Module) + (/.abstraction expected_bar))] (n.= expected_bar actual_bar)))) (_.for [/.Frame] ($_ _.and diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index 05ced5386..37c006732 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -140,16 +140,16 @@ [expected (random.ascii/upper 10)] (_.cover [/.failure] (case (/.result /.fresh_context - (: (/.Check Any) - (/.failure expected))) + (is (/.Check Any) + (/.failure expected))) {try.#Success _} false {try.#Failure actual} (same? expected actual)))) (do random.monad [expected (random.ascii/upper 10)] (_.cover [/.assertion] (and (case (/.result /.fresh_context - (: (/.Check Any) - (/.assertion expected true))) + (is (/.Check Any) + (/.assertion expected true))) {try.#Success _} true {try.#Failure actual} false) (case (/.result /.fresh_context (/.assertion expected false)) @@ -157,22 +157,22 @@ {try.#Failure actual} (same? expected actual))))) (_.cover [/.except] (case (/.result /.fresh_context - (: (/.Check Any) - (/.except ..yolo []))) + (is (/.Check Any) + (/.except ..yolo []))) {try.#Success _} false {try.#Failure error} (exception.match? ..yolo error))) - (let [scenario (: (-> (-> Text Bit) Type Type Bit) - (function (_ ? <left> <right>) - (and (|> (/.check <left> <right>) - (: (/.Check Any)) - (/.result /.fresh_context) - (pipe.case {try.#Failure error} (? error) - {try.#Success _} false)) - (|> (/.check <right> <left>) - (: (/.Check Any)) - (/.result /.fresh_context) - (pipe.case {try.#Failure error} (? error) - {try.#Success _} false)))))] + (let [scenario (is (-> (-> Text Bit) Type Type Bit) + (function (_ ? <left> <right>) + (and (|> (/.check <left> <right>) + (is (/.Check Any)) + (/.result /.fresh_context) + (pipe.case {try.#Failure error} (? error) + {try.#Success _} false)) + (|> (/.check <right> <left>) + (is (/.Check Any)) + (/.result /.fresh_context) + (pipe.case {try.#Failure error} (? error) + {try.#Success _} false)))))] ($_ _.and (_.cover [/.type_check_failed] (let [scenario (scenario (exception.match? /.type_check_failed))] diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux index b4e8536c5..e5c31c177 100644 --- a/stdlib/source/test/lux/type/dynamic.lux +++ b/stdlib/source/test/lux/type/dynamic.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - ["[0]" exception]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" try] + ["[0]" exception]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: .public test Test @@ -24,22 +24,22 @@ (do random.monad [expected random.nat] ($_ _.and - (_.cover [/.:dynamic /.:static] - (case (/.:static Nat (/.:dynamic expected)) + (_.cover [/.dynamic /.static] + (case (/.static Nat (/.dynamic expected)) {try.#Success actual} (n.= expected actual) {try.#Failure _} false)) (_.cover [/.wrong_type] - (case (/.:static Text (/.:dynamic expected)) + (case (/.static Text (/.dynamic expected)) {try.#Success actual} false {try.#Failure error} (exception.match? /.wrong_type error))) (_.cover [/.format] - (case (/.format (/.:dynamic expected)) + (case (/.format (/.dynamic expected)) {try.#Success actual} (text#= (%.nat expected) actual) diff --git a/stdlib/source/test/lux/type/quotient.lux b/stdlib/source/test/lux/type/quotient.lux index a81aff6b6..cb0f8bffe 100644 --- a/stdlib/source/test/lux/type/quotient.lux +++ b/stdlib/source/test/lux/type/quotient.lux @@ -1,20 +1,20 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - ["[0]" monad {"+" do}] - [\\specification - ["$[0]" equivalence]]] - [data - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - [math - ["[0]" random {"+" Random}] - [number - ["n" nat ("[1]#[0]" equivalence)]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + ["[0]" monad {"+" do}] + [\\specification + ["$[0]" equivalence]]] + [data + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + [math + ["[0]" random {"+" Random}] + [number + ["n" nat ("[1]#[0]" equivalence)]]]]] + [\\library + ["[0]" /]]) (def: .public (random class super) (All (_ t c %) (-> (/.Class t c %) (Random t) (Random (/.Quotient t c %)))) @@ -31,8 +31,8 @@ (<| (_.covering /._) (do random.monad [modulus (random.only (n.> 0) random.nat) - .let [class (: (-> Nat Text) - (|>> (n.% modulus) %.nat))] + .let [class (is (-> Nat Text) + (|>> (n.% modulus) %.nat))] value random.nat] ($_ _.and (_.for [/.equivalence] @@ -41,8 +41,8 @@ (_.for [/.Class] (_.cover [/.class] - (same? (: Any class) - (: Any (/.class class))))) + (same? (is Any class) + (is Any (/.class class))))) (_.for [/.Quotient] ($_ _.and (_.cover [/.quotient /.value /.label] @@ -53,8 +53,8 @@ (/.label quotient))))) (_.cover [/.type] (exec - (: ..Mod_10 - (/.quotient ..mod_10_class value)) + (is ..Mod_10 + (/.quotient ..mod_10_class value)) true)) )) )))) diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index d6bd361ed..2d269d300 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -1,21 +1,21 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [predicate {"+" Predicate}] - [monad {"+" do}]] - [control - ["[0]" maybe ("[1]#[0]" monad)]] - [data - [collection - ["[0]" list ("[1]#[0]" functor)]]] - [math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [predicate {"+" Predicate}] + [monad {"+" do}]] + [control + ["[0]" maybe ("[1]#[0]" monad)]] + [data + [collection + ["[0]" list ("[1]#[0]" functor)]]] + [math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) (def: _refiner (/.refiner (n.> 123))) @@ -30,8 +30,8 @@ (do [! random.monad] [raw random.nat modulus (# ! each (|>> (n.% 10) (n.+ 2)) random.nat) - .let [predicate (: (Predicate Nat) - (|>> (n.% modulus) (n.= 0)))] + .let [predicate (is (Predicate Nat) + (|>> (n.% modulus) (n.= 0)))] total_raws (# ! each (|>> (n.% 20) ++) random.nat) raws (random.list total_raws random.nat)] ($_ _.and @@ -84,7 +84,7 @@ expected (list#each /.value actual))))) (_.cover [/.type] - (exec (: (Maybe .._type) - (.._refiner raw)) + (exec (is (Maybe .._type) + (.._refiner raw)) true)) )))) diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index 366647d5c..2c6b1eb29 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -1,30 +1,30 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" meta] - [abstract - ["[0]" monad - [indexed {"+" do}]]] - [control - ["[0]" io {"+" IO}] - ["[0]" try] - ["[0]" exception {"+" Exception}] - [concurrency - ["[0]" async {"+" Async}]] - [parser - ["<[0]>" code]]] - [data - ["[0]" identity {"+" Identity}] - ["[0]" text ("[1]#[0]" equivalence) - ["%" format {"+" format}]]] - ["[0]" macro - [syntax {"+" syntax:}] - ["[0]" code]] - [math - ["[0]" random]]]] - [\\library - ["[0]" / {"+" Res}]]) + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" meta] + [abstract + ["[0]" monad + [indexed {"+" do}]]] + [control + ["[0]" io {"+" IO}] + ["[0]" try] + ["[0]" exception {"+" Exception}] + [concurrency + ["[0]" async {"+" Async}]] + [parser + ["<[0]>" code]]] + [data + ["[0]" identity {"+" Identity}] + ["[0]" text ("[1]#[0]" equivalence) + ["%" format {"+" format}]]] + ["[0]" macro + [syntax {"+" syntax:}] + ["[0]" code]] + [math + ["[0]" random]]]] + [\\library + ["[0]" / {"+" Res}]]) (def: pure Test @@ -37,7 +37,7 @@ (~~ (template [<coverage> <bindings>] [(_.cover <coverage> (<| (text#= (format pre post)) - (: (Identity Text)) + (is (Identity Text)) (/.run! !) (do (/.monad !) <bindings> @@ -80,7 +80,7 @@ [(_.cover <coverage> (<| (text#= (format pre post)) io.run! - (: (IO Text)) + (is (IO Text)) (/.run! !) (do (/.monad !) <bindings> @@ -121,7 +121,7 @@ (`` ($_ _.and (~~ (template [<coverage> <bindings>] [(in (monad.do ! - [outcome (<| (: (Async Text)) + [outcome (<| (is (Async Text)) (/.run! !) (do (/.monad !) <bindings> diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 714ea853b..bfcef3bc6 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -101,8 +101,8 @@ (# ! each (i.% +1,000)) (# ! each (i.* +1,000,000,000)) (# ! each (# /.meter in))) - .let [(open "meter#[0]") (: (Equivalence (/.Qty /.Meter)) - /.equivalence)] + .let [(open "meter#[0]") (is (Equivalence (/.Qty /.Meter)) + /.equivalence)] unscaled (|> random.int (# ! each (i.% +1,000)) (# ! each (i.* (.int how::to))) @@ -113,9 +113,9 @@ [(_.cover [<type> <scale>] (|> large (# <scale> scale) - (: (/.Qty (<type> /.Meter))) + (is (/.Qty (<type> /.Meter))) (# <scale> de_scale) - (: (/.Qty /.Meter)) + (is (/.Qty /.Meter)) (meter#= large)))] [/.Kilo /.kilo] @@ -126,9 +126,9 @@ [(_.cover [<type> <scale>] (|> small (# <scale> scale) - (: (/.Qty (<type> /.Meter))) + (is (/.Qty (<type> /.Meter))) (# <scale> de_scale) - (: (/.Qty /.Meter)) + (is (/.Qty /.Meter)) (meter#= small)))] [/.Milli /.milli] @@ -136,11 +136,11 @@ [/.Nano /.nano] )) (_.cover [/.re_scaled] - (|> large (: (/.Qty /.Meter)) - (# /.kilo scale) (: (/.Qty (/.Kilo /.Meter))) - (/.re_scaled /.kilo /.milli) (: (/.Qty (/.Milli /.Meter))) - (/.re_scaled /.milli /.kilo) (: (/.Qty (/.Kilo /.Meter))) - (# /.kilo de_scale) (: (/.Qty /.Meter)) + (|> large (is (/.Qty /.Meter)) + (# /.kilo scale) (is (/.Qty (/.Kilo /.Meter))) + (/.re_scaled /.kilo /.milli) (is (/.Qty (/.Milli /.Meter))) + (/.re_scaled /.milli /.kilo) (is (/.Qty (/.Kilo /.Meter))) + (# /.kilo de_scale) (is (/.Qty /.Meter)) (meter#= large))) (_.cover [/.scale:] (and (|> unscaled @@ -156,8 +156,8 @@ Test (do random.monad [.let [zero (# /.meter in +0) - (open "meter#[0]") (: (Equivalence (/.Qty /.Meter)) - /.equivalence)] + (open "meter#[0]") (is (Equivalence (/.Qty /.Meter)) + /.equivalence)] left (random.only (|>> (meter#= zero) not) (..meter 1,000)) right (..meter 1,000) extra (..second 1,000)] @@ -172,8 +172,8 @@ )) (_.cover [/.*] (let [expected (i.* (# /.meter out left) (# /.meter out right)) - actual ((debug.private /.out') (: (/.Qty [/.Meter /.Meter]) - (/.* left right)))] + actual ((debug.private /.out') (is (/.Qty [/.Meter /.Meter]) + (/.* left right)))] (i.= expected actual))) (_.cover [/./] (|> right diff --git a/stdlib/source/test/lux/world/file.lux b/stdlib/source/test/lux/world/file.lux index f494b7705..a7e9de34a 100644 --- a/stdlib/source/test/lux/world/file.lux +++ b/stdlib/source/test/lux/world/file.lux @@ -125,8 +125,8 @@ (def: (fs /) (-> Text (/.System IO)) - (let [disk (: (Atom Disk) - (atom.atom (dictionary.empty text.hash))) + (let [disk (is (Atom Disk) + (atom.atom (dictionary.empty text.hash))) mock (/.mock /)] (implementation (def: separator /) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index cbdb160d9..53263b27a 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -99,8 +99,8 @@ (def: (after_creation! fs watcher expected_path) (-> (//.System Async) (/.Watcher Async) //.Path (Async (Try Bit))) (do (try.with async.monad) - [_ (: (Async (Try Any)) - (//.make_file async.monad fs (binary.empty 0) expected_path)) + [_ (is (Async (Try Any)) + (//.make_file async.monad fs (binary.empty 0) expected_path)) poll/pre (# watcher poll []) poll/post (# watcher poll [])] (in (and (case poll/pre diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index d378cb0ee..97ebb59ac 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -113,9 +113,9 @@ (def: listing (List /.Key) (list.together (`` (list (~~ (template [<definition> <keys>] - [((: (-> Any (List /.Key)) - (function (_ _) - (`` (list (~~ (template.spliced <keys>)))))) + [((is (-> Any (List /.Key)) + (function (_ _) + (`` (list (~~ (template.spliced <keys>)))))) [])] <groups>)))))) diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 3d4de1e0f..1ab2b0a1d 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -67,27 +67,27 @@ on_trace random.nat num_headers (# ! each (nat.% 10) random.nat) headers (random.dictionary text.hash num_headers (random.ascii/lower 3) (random.ascii/lower 3)) - .let [mock (: (/.Client IO) - (implementation - (def: (request method url headers data) - (io.io (let [value (case method - {//.#Post} on_post - {//.#Get} on_get - {//.#Put} on_put - {//.#Patch} on_patch - {//.#Delete} on_delete - {//.#Head} on_head - {//.#Connect} on_connect - {//.#Options} on_options - {//.#Trace} on_trace) - data (|> value - (# nat.decimal encoded) - (# utf8.codec encoded))] - {try.#Success [//status.ok - [//.#headers headers - //.#body (function (_ ?wanted_bytes) - (io.io {try.#Success [(binary.size data) - data]}))]]})))))]] + .let [mock (is (/.Client IO) + (implementation + (def: (request method url headers data) + (io.io (let [value (case method + {//.#Post} on_post + {//.#Get} on_get + {//.#Put} on_put + {//.#Patch} on_patch + {//.#Delete} on_delete + {//.#Head} on_head + {//.#Connect} on_connect + {//.#Options} on_options + {//.#Trace} on_trace) + data (|> value + (# nat.decimal encoded) + (# utf8.codec encoded))] + {try.#Success [//status.ok + [//.#headers headers + //.#body (function (_ ?wanted_bytes) + (io.io {try.#Success [(binary.size data) + data]}))]]})))))]] (with_expansions [<cases> (as_is [/.post on_post] [/.get on_get] [/.put on_put] diff --git a/stdlib/source/test/lux/world/net/http/status.lux b/stdlib/source/test/lux/world/net/http/status.lux index 97359a058..f6c5a32ab 100644 --- a/stdlib/source/test/lux/world/net/http/status.lux +++ b/stdlib/source/test/lux/world/net/http/status.lux @@ -1,19 +1,19 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [data - [collection - ["[0]" list] - ["[0]" set {"+" Set}]]] - [macro - ["[0]" template]] - [math - [number - ["n" nat]]]]] - [\\library - ["[0]" / - ["/[1]" //]]]) + [library + [lux "*" + ["_" test {"+" Test}] + [data + [collection + ["[0]" list] + ["[0]" set {"+" Set}]]] + [macro + ["[0]" template]] + [math + [number + ["n" nat]]]]] + [\\library + ["[0]" / + ["/[1]" //]]]) (with_expansions [<categories> (as_is [informational [/.continue @@ -85,9 +85,9 @@ (def: all (List //.Status) (list.together (`` (list (~~ (template [<category> <status+>] - [((: (-> Any (List //.Status)) - (function (_ _) - (`` (list (~~ (template.spliced <status+>)))))) + [((is (-> Any (List //.Status)) + (function (_ _) + (`` (list (~~ (template.spliced <status+>)))))) 123)] <categories>)))))) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 7d62ad2ca..608af1381 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -1,32 +1,32 @@ (.using - [library - [lux "*" - ["_" test {"+" Test}] - [abstract - [monad {"+" do}]] - [control - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["[0]" io {"+" IO}] - [concurrency - ["[0]" async {"+" Async}]] - [parser - ["[0]" environment {"+" Environment}]]] - [data - ["[0]" text ("[1]#[0]" equivalence)] - [collection - ["[0]" list]]] - [math - ["[0]" random] - [number - ["n" nat] - ["i" int]]]]] - [\\library - ["[0]" / - [// - [file {"+" Path}]]]] - [\\specification - ["$[0]" /]]) + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}]] + [control + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + ["[0]" io {"+" IO}] + [concurrency + ["[0]" async {"+" Async}]] + [parser + ["[0]" environment {"+" Environment}]]] + [data + ["[0]" text ("[1]#[0]" equivalence)] + [collection + ["[0]" list]]] + [math + ["[0]" random] + [number + ["n" nat] + ["i" int]]]]] + [\\library + ["[0]" / + [// + [file {"+" Path}]]]] + [\\specification + ["$[0]" /]]) (exception: dead) @@ -67,7 +67,7 @@ (def: (execute [environment working_directory command arguments]) (<| io.io {try.#Success} - (: (/.Process IO)) + (is (/.Process IO)) (implementation (def: (read _) (io.io {try.#Success command})) diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index a36223c05..1f24ad030 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -57,89 +57,89 @@ (type: .public Binary (array.Array (I64 Any))))) -(`` (with_expansions [<size> (.: .Nat size) +(`` (with_expansions [<size> (.is .Nat size) <jvm> (ffi.array byte <size>) - <jvm> (.: ..Binary <jvm>)] + <jvm> (.is ..Binary <jvm>)] (template: .public (empty size) - [(: ..Binary - (for (~~ (.static @.old)) <jvm> - (~~ (.static @.jvm)) <jvm> - - (~~ (.static @.js)) - (.|> <size> - .int - "lux i64 f64" - [] - ("js object new" ("js constant" "ArrayBuffer")) - [] - ("js object new" ("js constant" "Uint8Array")) - (.:as ..Binary)) - - (~~ (.static @.python)) - (.|> <size> - [] - ("python apply" (.:as ffi.Function ("python constant" "bytearray"))) - (.:as ..Binary)) - - (~~ (.static @.scheme)) - (..make-bytevector <size>) - - ... Default - (array.empty <size>)))]))) - -(`` (with_expansions [<it> (.: ..Binary it) + [(is ..Binary + (for (~~ (.static @.old)) <jvm> + (~~ (.static @.jvm)) <jvm> + + (~~ (.static @.js)) + (.|> <size> + .int + "lux i64 f64" + [] + ("js object new" ("js constant" "ArrayBuffer")) + [] + ("js object new" ("js constant" "Uint8Array")) + (.as ..Binary)) + + (~~ (.static @.python)) + (.|> <size> + [] + ("python apply" (.as ffi.Function ("python constant" "bytearray"))) + (.as ..Binary)) + + (~~ (.static @.scheme)) + (..make-bytevector <size>) + + ... Default + (array.empty <size>)))]))) + +(`` (with_expansions [<it> (.is ..Binary it) <jvm> (ffi.length <it>)] (template: .public (size it) - [(.: .Nat - (.for (~~ (.static @.old)) <jvm> - (~~ (.static @.jvm)) <jvm> + [(.is .Nat + (.for (~~ (.static @.old)) <jvm> + (~~ (.static @.jvm)) <jvm> - (~~ (.static @.js)) - (.|> <it> - ("js object get" "length") - (.:as .Frac) - "lux f64 i64" - .nat) + (~~ (.static @.js)) + (.|> <it> + ("js object get" "length") + (.as .Frac) + "lux f64 i64" + .nat) - (~~ (.static @.python)) - (.|> <it> - (.:as (array.Array (.I64 .Any))) - "python array length") + (~~ (.static @.python)) + (.|> <it> + (.as (array.Array (.I64 .Any))) + "python array length") - (~~ (.static @.scheme)) - (..bytevector-length [<it>]) + (~~ (.static @.scheme)) + (..bytevector-length [<it>]) - ... Default - (array.size <it>)))]))) + ... Default + (array.size <it>)))]))) (def: byte_mask Nat (i64.mask i64.bits_per_byte)) (with_expansions [<byte_mask> (.static ..byte_mask) - <it> (.: ..Binary it) - <index> (.: .Nat index) + <it> (.is ..Binary it) + <index> (.is .Nat index) <jvm> (ffi.read! <index> <it>) <jvm> (ffi.byte_to_long <jvm>) <jvm> (.|> <jvm> - (.:as .I64) + (.as .I64) ("lux i64 and" <byte_mask>))] (template: .public (bytes/1 index it) - [(.<| (.:as .I64) - (.: (.I64 .Any)) + [(.<| (.as .I64) + (.is (.I64 .Any)) (`` (.for (~~ (.static @.old)) (~~ <jvm>) (~~ (.static @.jvm)) (~~ <jvm>) (~~ (.static @.js)) (.|> <it> - (.:as (array.Array .Frac)) + (.as (array.Array .Frac)) ("js array read" <index>) "lux f64 i64" .i64) (~~ (.static @.python)) (.|> <it> - (.:as (array.Array .I64)) + (.as (array.Array .I64)) ("python array read" <index>)) (~~ (.static @.scheme)) @@ -151,19 +151,19 @@ (array.item <index> <it>)))))])) (template: .public (bytes/2 index' it') - [(.<| (.let [index (.: Nat index') - it (.: ..Binary it')]) - (.:as .I64) - (.: (.I64 .Any)) + [(.<| (.let [index (.is Nat index') + it (.is ..Binary it')]) + (.as .I64) + (.is (.I64 .Any)) (.$_ "lux i64 or" ("lux i64 left-shift" 8 (..bytes/1 index it)) (..bytes/1 ("lux i64 +" 1 index) it)))]) (template: .public (bytes/4 index' it') - [(.<| (.let [index (.: Nat index') - it (.: ..Binary it')]) - (.:as .I64) - (.: (.I64 .Any)) + [(.<| (.let [index (.is Nat index') + it (.is ..Binary it')]) + (.as .I64) + (.is (.I64 .Any)) (.$_ "lux i64 or" ("lux i64 left-shift" 24 (..bytes/1 index it)) ("lux i64 left-shift" 16 (..bytes/1 ("lux i64 +" 1 index) it)) @@ -171,10 +171,10 @@ (..bytes/1 ("lux i64 +" 3 index) it)))]) (template: .public (bytes/8 index' it') - [(.<| (.let [index (.: Nat index') - it (.: ..Binary it')]) - (.:as .I64) - (.: (.I64 .Any)) + [(.<| (.let [index (.is Nat index') + it (.is ..Binary it')]) + (.as .I64) + (.is (.I64 .Any)) (.$_ "lux i64 or" ("lux i64 left-shift" 56 (..bytes/1 index it)) ("lux i64 left-shift" 48 (..bytes/1 ("lux i64 +" 1 index) it)) @@ -186,60 +186,60 @@ (..bytes/1 ("lux i64 +" 7 index) it)))]) (with_expansions [<byte> (hex "FF") - <it> (.: ..Binary it) - <index> (.: .Nat index) - <value> (.: (.I64 .Any) value) + <it> (.is ..Binary it) + <index> (.is .Nat index) + <value> (.is (.I64 .Any) value) <jvm_value> (`` (.for (~~ (.static @.old)) - (.:as .Int <value>) + (.as .Int <value>) (~~ (.static @.jvm)) - (.:as (.Primitive "java.lang.Long") <value>) + (.as (.Primitive "java.lang.Long") <value>) <value>)) <jvm_value> <jvm_value> <jvm_value> (ffi.long_to_byte <jvm_value>) <jvm> (ffi.write! <index> <jvm_value> <it>)] (`` (template: .public (with/1! index value it) - [(.: ..Binary - (.for (~~ (.static @.old)) <jvm> - (~~ (.static @.jvm)) <jvm> - - (~~ (.static @.js)) - (.|> <it> - (.: ..Binary) - (.:as (array.Array .Frac)) - ("js array write" <index> - (.|> <value> - .int - ("lux i64 and" (.int <byte>)) - "lux i64 f64")) - (.:as ..Binary)) - - (~~ (.static @.python)) - (.|> <it> - (.: ..Binary) - (.:as (array.Array (.I64 .Any))) - ("python array write" <index> (.|> <value> ("lux i64 and" <byte>) (.: (.I64 .Any)))) - (.:as ..Binary)) - - (~~ (.static @.scheme)) - (.let [it' <it>] - (.exec - (..bytevector-u8-set! [it' <index> <value>]) - it')) - - ... Default - (array.has! <index> (.|> <value> .int ("lux i64 and" (.int <byte>))) <it>)))]))) + [(.is ..Binary + (.for (~~ (.static @.old)) <jvm> + (~~ (.static @.jvm)) <jvm> + + (~~ (.static @.js)) + (.|> <it> + (.is ..Binary) + (.as (array.Array .Frac)) + ("js array write" <index> + (.|> <value> + .int + ("lux i64 and" (.int <byte>)) + "lux i64 f64")) + (.as ..Binary)) + + (~~ (.static @.python)) + (.|> <it> + (.is ..Binary) + (.as (array.Array (.I64 .Any))) + ("python array write" <index> (.|> <value> ("lux i64 and" <byte>) (.is (.I64 .Any)))) + (.as ..Binary)) + + (~~ (.static @.scheme)) + (.let [it' <it>] + (.exec + (..bytevector-u8-set! [it' <index> <value>]) + it')) + + ... Default + (array.has! <index> (.|> <value> .int ("lux i64 and" (.int <byte>))) <it>)))]))) (template: .public (with/2! index' value' it) - [(.let [index (.: .Nat index') - value (.: (.I64 .Any) value')] + [(.let [index (.is .Nat index') + value (.is (.I64 .Any) value')] (.|> it (..with/1! index ("lux i64 right-shift" 8 value)) (..with/1! ("lux i64 +" 1 index) value)))]) (template: .public (with/4! index' value' it) - [(.let [index (.: .Nat index') - value (.: (.I64 .Any) value')] + [(.let [index (.is .Nat index') + value (.is (.I64 .Any) value')] (.|> it (..with/1! index ("lux i64 right-shift" 24 value)) (..with/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 16 value)) @@ -247,18 +247,18 @@ (..with/1! ("lux i64 +" 3 index) value)))]) (`` (template: .public (with/8! index' value' it) - [(.let [index (.: .Nat index') - value (.: (.I64 .Any) value')] - (.for (~~ (.static @.scheme)) (.let [write_high (.: (.-> ..Binary ..Binary) - (.|>> (..with/1! index ("lux i64 right-shift" 56 value)) - (..with/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value)) - (..with/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value)) - (..with/1! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value)))) - write_low (.: (.-> ..Binary ..Binary) - (.|>> (..with/1! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value)) - (..with/1! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value)) - (..with/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) - (..with/1! ("lux i64 +" 7 index) value)))] + [(.let [index (.is .Nat index') + value (.is (.I64 .Any) value')] + (.for (~~ (.static @.scheme)) (.let [write_high (.is (.-> ..Binary ..Binary) + (.|>> (..with/1! index ("lux i64 right-shift" 56 value)) + (..with/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value)) + (..with/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value)) + (..with/1! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value)))) + write_low (.is (.-> ..Binary ..Binary) + (.|>> (..with/1! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value)) + (..with/1! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value)) + (..with/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) + (..with/1! ("lux i64 +" 7 index) value)))] (.|> it write_high write_low)) @@ -272,8 +272,8 @@ (..with/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) (..with/1! ("lux i64 +" 7 index) value))))])) -(with_expansions [<reference> (.: ..Binary reference') - <sample> (.: ..Binary sample') +(with_expansions [<reference> (.is ..Binary reference') + <sample> (.is ..Binary sample') <jvm> (java/util/Arrays::equals <reference> <sample>) <jvm> (ffi.of_boolean <jvm>)] (`` (template: .public (= reference' sample') diff --git a/stdlib/source/unsafe/lux/data/collection/array.lux b/stdlib/source/unsafe/lux/data/collection/array.lux index d3435b6ee..9d82fc7dd 100644 --- a/stdlib/source/unsafe/lux/data/collection/array.lux +++ b/stdlib/source/unsafe/lux/data/collection/array.lux @@ -19,197 +19,197 @@ <array_type> (.type (..Array <elem_type>))] (for @.jvm (template: (int! value) [(.|> value - (.:as <index_type>) + (.as <index_type>) "jvm object cast" "jvm conversion long-to-int")]) (as_is)) (`` (template: .public (empty <size>) - [((.: (.All (_ a) (.-> .Nat (..Array a))) - (.function (empty size) - (.for (~~ (.static @.old)) - (.:expected ("jvm anewarray" "(java.lang.Object )" size)) - - (~~ (.static @.jvm)) - (|> (~~ (..int! size)) - "jvm array new object" - (.: <array_type>) - .:expected) - - (~~ (.static @.js)) ("js array new" size) - (~~ (.static @.python)) ("python array new" size) - (~~ (.static @.lua)) ("lua array new" size) - (~~ (.static @.ruby)) ("ruby array new" size) - (~~ (.static @.php)) ("php array new" size) - (~~ (.static @.scheme)) ("scheme array new" size)))) + [((.is (.All (_ a) (.-> .Nat (..Array a))) + (.function (empty size) + (.for (~~ (.static @.old)) + (.as_expected ("jvm anewarray" "(java.lang.Object )" size)) + + (~~ (.static @.jvm)) + (|> (~~ (..int! size)) + "jvm array new object" + (.is <array_type>) + .as_expected) + + (~~ (.static @.js)) ("js array new" size) + (~~ (.static @.python)) ("python array new" size) + (~~ (.static @.lua)) ("lua array new" size) + (~~ (.static @.ruby)) ("ruby array new" size) + (~~ (.static @.php)) ("php array new" size) + (~~ (.static @.scheme)) ("scheme array new" size)))) <size>)])) (`` (template: .public (size <array>) - [((.: (.All (_ a) (.-> (..Array a) .Nat)) - (.function (size array) - (.for (~~ (.static @.old)) - ("jvm arraylength" array) - - (~~ (.static @.jvm)) - (.|> array - (.:as <array_type>) - "jvm array length object" - "jvm conversion int-to-long" - "jvm object cast" - (.: <index_type>) - (.:as .Nat)) - - (~~ (.static @.js)) ("js array length" array) - (~~ (.static @.python)) ("python array length" array) - (~~ (.static @.lua)) ("lua array length" array) - (~~ (.static @.ruby)) ("ruby array length" array) - (~~ (.static @.php)) ("php array length" array) - (~~ (.static @.scheme)) ("scheme array length" array)))) + [((.is (.All (_ a) (.-> (..Array a) .Nat)) + (.function (size array) + (.for (~~ (.static @.old)) + ("jvm arraylength" array) + + (~~ (.static @.jvm)) + (.|> array + (.as <array_type>) + "jvm array length object" + "jvm conversion int-to-long" + "jvm object cast" + (.is <index_type>) + (.as .Nat)) + + (~~ (.static @.js)) ("js array length" array) + (~~ (.static @.python)) ("python array length" array) + (~~ (.static @.lua)) ("lua array length" array) + (~~ (.static @.ruby)) ("ruby array length" array) + (~~ (.static @.php)) ("php array length" array) + (~~ (.static @.scheme)) ("scheme array length" array)))) <array>)])) (template: (lacks?' <read!> <null?> index array) [(<null?> (<read!> index array))]) (`` (template: .public (lacks? <index> <array>) - [((.: (.All (_ a) - (.-> .Nat (..Array a) .Bit)) - (.function (lacks? index array) - (.let [size (..size array)] - (.if ("lux i64 <" (.int size) (.int index)) - (.for (~~ (.static @.old)) - ("jvm object null?" ("jvm aaload" array index)) - - (~~ (.static @.jvm)) - (.|> array - (.:as <array_type>) - ("jvm array read object" (~~ (int! index))) - "jvm object null?") - - (~~ (.static @.js)) (~~ (lacks?' "js array read" "js object undefined?" index array)) - (~~ (.static @.python)) (~~ (lacks?' "python array read" "python object none?" index array)) - (~~ (.static @.lua)) (~~ (lacks?' "lua array read" "lua object nil?" index array)) - (~~ (.static @.ruby)) (~~ (lacks?' "ruby array read" "ruby object nil?" index array)) - (~~ (.static @.php)) (~~ (lacks?' "php array read" "php object null?" index array)) - (~~ (.static @.scheme)) (~~ (lacks?' "scheme array read" "scheme object nil?" index array))) - .true)))) + [((.is (.All (_ a) + (.-> .Nat (..Array a) .Bit)) + (.function (lacks? index array) + (.let [size (..size array)] + (.if ("lux i64 <" (.int size) (.int index)) + (.for (~~ (.static @.old)) + ("jvm object null?" ("jvm aaload" array index)) + + (~~ (.static @.jvm)) + (.|> array + (.as <array_type>) + ("jvm array read object" (~~ (int! index))) + "jvm object null?") + + (~~ (.static @.js)) (~~ (lacks?' "js array read" "js object undefined?" index array)) + (~~ (.static @.python)) (~~ (lacks?' "python array read" "python object none?" index array)) + (~~ (.static @.lua)) (~~ (lacks?' "lua array read" "lua object nil?" index array)) + (~~ (.static @.ruby)) (~~ (lacks?' "ruby array read" "ruby object nil?" index array)) + (~~ (.static @.php)) (~~ (lacks?' "php array read" "php object null?" index array)) + (~~ (.static @.scheme)) (~~ (lacks?' "scheme array read" "scheme object nil?" index array))) + .true)))) <index> <array>)])) (template: .public (has? index array) [(.not (..lacks? index array))]) (`` (template: .public (item <index> <array>) - [((.: (.All (_ a) - (.-> .Nat (..Array a) a)) - (.function (item index array) - (.for (~~ (.static @.old)) - ("jvm aaload" array index) - - (~~ (.static @.jvm)) - (.|> array - (.:as <array_type>) - ("jvm array read object" (~~ (int! index))) - .:expected) - - (~~ (.static @.js)) ("js array read" index array) - (~~ (.static @.python)) ("python array read" index array) - (~~ (.static @.lua)) ("lua array read" index array) - (~~ (.static @.ruby)) ("ruby array read" index array) - (~~ (.static @.php)) ("php array read" index array) - (~~ (.static @.scheme)) ("scheme array read" index array)))) + [((.is (.All (_ a) + (.-> .Nat (..Array a) a)) + (.function (item index array) + (.for (~~ (.static @.old)) + ("jvm aaload" array index) + + (~~ (.static @.jvm)) + (.|> array + (.as <array_type>) + ("jvm array read object" (~~ (int! index))) + .as_expected) + + (~~ (.static @.js)) ("js array read" index array) + (~~ (.static @.python)) ("python array read" index array) + (~~ (.static @.lua)) ("lua array read" index array) + (~~ (.static @.ruby)) ("ruby array read" index array) + (~~ (.static @.php)) ("php array read" index array) + (~~ (.static @.scheme)) ("scheme array read" index array)))) <index> <array>)])) (`` (template: .public (has! <index> <value> <array>) - [((.: (.All (_ a) - (.-> .Nat a (..Array a) (..Array a))) - (.function (has! index value array) - (.for (~~ (.static @.old)) - ("jvm aastore" array index value) - - (~~ (.static @.jvm)) - (.|> array - (.:as <array_type>) - ("jvm array write object" (~~ (int! index)) (.:as <elem_type> value)) - .:expected) - - (~~ (.static @.js)) ("js array write" index value array) - (~~ (.static @.python)) ("python array write" index value array) - (~~ (.static @.lua)) ("lua array write" index value array) - (~~ (.static @.ruby)) ("ruby array write" index value array) - (~~ (.static @.php)) ("php array write" index value array) - (~~ (.static @.scheme)) ("scheme array write" index value array)))) + [((.is (.All (_ a) + (.-> .Nat a (..Array a) (..Array a))) + (.function (has! index value array) + (.for (~~ (.static @.old)) + ("jvm aastore" array index value) + + (~~ (.static @.jvm)) + (.|> array + (.as <array_type>) + ("jvm array write object" (~~ (int! index)) (.as <elem_type> value)) + .as_expected) + + (~~ (.static @.js)) ("js array write" index value array) + (~~ (.static @.python)) ("python array write" index value array) + (~~ (.static @.lua)) ("lua array write" index value array) + (~~ (.static @.ruby)) ("ruby array write" index value array) + (~~ (.static @.php)) ("php array write" index value array) + (~~ (.static @.scheme)) ("scheme array write" index value array)))) <index> <value> <array>)])) (`` (template: .public (lacks! <index> <array>) - [((.: (.All (_ a) - (.-> .Nat (..Array a) (..Array a))) - (.function (lacks! index array) - (.let [size (..size array)] - (.if ("lux i64 <" (.int size) (.int index)) - (.for (~~ (.static @.old)) - (..has! index (.:expected ("jvm object null")) array) - - (~~ (.static @.jvm)) - (..has! index (.:expected (: <elem_type> ("jvm object null"))) array) - - (~~ (.static @.js)) ("js array delete" index array) - (~~ (.static @.python)) ("python array delete" index array) - (~~ (.static @.lua)) ("lua array delete" index array) - (~~ (.static @.ruby)) ("ruby array delete" index array) - (~~ (.static @.php)) ("php array delete" index array) - (~~ (.static @.scheme)) ("scheme array delete" index array)) - array)))) + [((.is (.All (_ a) + (.-> .Nat (..Array a) (..Array a))) + (.function (lacks! index array) + (.let [size (..size array)] + (.if ("lux i64 <" (.int size) (.int index)) + (.for (~~ (.static @.old)) + (..has! index (.as_expected ("jvm object null")) array) + + (~~ (.static @.jvm)) + (..has! index (.as_expected (is <elem_type> ("jvm object null"))) array) + + (~~ (.static @.js)) ("js array delete" index array) + (~~ (.static @.python)) ("python array delete" index array) + (~~ (.static @.lua)) ("lua array delete" index array) + (~~ (.static @.ruby)) ("ruby array delete" index array) + (~~ (.static @.php)) ("php array delete" index array) + (~~ (.static @.scheme)) ("scheme array delete" index array)) + array)))) <index> <array>)])) ) (template: .public (revised! <index> <$> <array>) - [((.: (.All (_ a) - (.-> .Nat (.-> a a) (..Array a) (..Array a))) - (.function (revised! index $ array) - (.if (..lacks? index array) - array - (..has! index ($ (..item index array)) array)))) + [((.is (.All (_ a) + (.-> .Nat (.-> a a) (..Array a) (..Array a))) + (.function (revised! index $ array) + (.if (..lacks? index array) + array + (..has! index ($ (..item index array)) array)))) <index> <$> <array>)]) (template: .public (upsert! <index> <default> <$> <array>) - [((.: (.All (_ a) - (.-> .Nat a (.-> a a) (..Array a) (..Array a))) - (.function (upsert! index default $ array) - (..has! index - ($ (.if (..lacks? index array) - default - (..item index array))) - array))) + [((.is (.All (_ a) + (.-> .Nat a (.-> a a) (..Array a) (..Array a))) + (.function (upsert! index default $ array) + (..has! index + ($ (.if (..lacks? index array) + default + (..item index array))) + array))) <index> <default> <$> <array>)]) (template: .public (copy! <length> <src_start> <src_array> <dest_start> <dest_array>) - [((.: (.All (_ a) - (.-> .Nat .Nat (..Array a) .Nat (..Array a) - (..Array a))) - (.function (copy! length src_start src_array dest_start dest_array) - (.loop [offset 0] - (.if ("lux i64 <" (.int length) (.int offset)) - (.exec - (.if (..lacks? ("lux i64 +" offset src_start) src_array) - (..lacks! ("lux i64 +" offset dest_start) dest_array) - (..has! ("lux i64 +" offset dest_start) - (..item ("lux i64 +" offset src_start) src_array) - dest_array)) - (again ("lux i64 +" 1 offset))) - dest_array)))) + [((.is (.All (_ a) + (.-> .Nat .Nat (..Array a) .Nat (..Array a) + (..Array a))) + (.function (copy! length src_start src_array dest_start dest_array) + (.loop [offset 0] + (.if ("lux i64 <" (.int length) (.int offset)) + (.exec + (.if (..lacks? ("lux i64 +" offset src_start) src_array) + (..lacks! ("lux i64 +" offset dest_start) dest_array) + (..has! ("lux i64 +" offset dest_start) + (..item ("lux i64 +" offset src_start) src_array) + dest_array)) + (again ("lux i64 +" 1 offset))) + dest_array)))) <length> <src_start> <src_array> <dest_start> <dest_array>)]) (template [<name> <when_lacks> <when_has>] [(template: .public (<name> <array>) - [((.: (.All (_ a) (.-> (..Array a) .Nat)) - (.function (occupancy array) - (.let [size (..size array)] - (.loop [index 0 - it 0] - (.if ("lux i64 <" (.int size) (.int index)) - (.if (..lacks? index array) - (again ("lux i64 +" 1 index) <when_lacks>) - (again ("lux i64 +" 1 index) <when_has>)) - it))))) + [((.is (.All (_ a) (.-> (..Array a) .Nat)) + (.function (occupancy array) + (.let [size (..size array)] + (.loop [index 0 + it 0] + (.if ("lux i64 <" (.int size) (.int index)) + (.if (..lacks? index array) + (again ("lux i64 +" 1 index) <when_lacks>) + (again ("lux i64 +" 1 index) <when_has>)) + it))))) <array>)])] [occupancy it ("lux i64 +" 1 it)] @@ -217,37 +217,37 @@ ) (template: .public (only! <?> <it>) - [((.: (.All (_ a) - (.-> (.-> a .Bit) (..Array a) (..Array a))) - (.function (only! ? it) - (.let [size (..size it)] - (.loop [index 0] - (.if ("lux i64 <" (.int size) (.int index)) - (.exec - (.if (..lacks? index it) - it - (.if (? (..item index it)) - it - (..lacks! index it))) - (again ("lux i64 +" 1 index))) - it))))) + [((.is (.All (_ a) + (.-> (.-> a .Bit) (..Array a) (..Array a))) + (.function (only! ? it) + (.let [size (..size it)] + (.loop [index 0] + (.if ("lux i64 <" (.int size) (.int index)) + (.exec + (.if (..lacks? index it) + it + (.if (? (..item index it)) + it + (..lacks! index it))) + (again ("lux i64 +" 1 index))) + it))))) <?> <it>)]) (template [<name> <predicate> <test> <type> <term>] [(template: .public (<name> <?> <it>) - [((.: (.All (_ a) - (.-> <predicate> (..Array a) (.Maybe <type>))) - (.function (<name> ? it) - (.let [size (..size it)] - (.loop [index 0] - (.if ("lux i64 <" (.int size) (.int index)) - (.if (..lacks? index it) - (again ("lux i64 +" 1 index)) - (.let [it (..item index it)] - (.if <test> - {.#Some <term>} - (again ("lux i64 +" 1 index))))) - {.#None}))))) + [((.is (.All (_ a) + (.-> <predicate> (..Array a) (.Maybe <type>))) + (.function (<name> ? it) + (.let [size (..size it)] + (.loop [index 0] + (.if ("lux i64 <" (.int size) (.int index)) + (.if (..lacks? index it) + (again ("lux i64 +" 1 index)) + (.let [it (..item index it)] + (.if <test> + {.#Some <term>} + (again ("lux i64 +" 1 index))))) + {.#None}))))) <?> <it>)])] [example (.-> a .Bit) (? it) a it] @@ -255,27 +255,27 @@ ) (template: .public (clone <it>) - [((.: (.All (_ a) (.-> (..Array a) (..Array a))) - (.function (clone it) - (.let [size (..size it)] - (..copy! size 0 it 0 (..empty size))))) + [((.is (.All (_ a) (.-> (..Array a) (..Array a))) + (.function (clone it) + (.let [size (..size it)] + (..copy! size 0 it 0 (..empty size))))) <it>)]) (template: .public (of_list <input>) - [((.: (.All (_ a) (.-> (.List a) (..Array a))) - (.function (of_list input) - (.let [size (list.size input) - output (..empty size)] - (.loop [index 0 - input input] - (.case input - {.#End} - output - - {.#Item head tail} - (.exec - (..has! index head output) - (again ("lux i64 +" 1 index) tail))))))) + [((.is (.All (_ a) (.-> (.List a) (..Array a))) + (.function (of_list input) + (.let [size (list.size input) + output (..empty size)] + (.loop [index 0 + input input] + (.case input + {.#End} + output + + {.#Item head tail} + (.exec + (..has! index head output) + (again ("lux i64 +" 1 index) tail))))))) <input>)]) (def: underflow @@ -283,108 +283,108 @@ (-- 0)) (`` (template: (list|-default <empty> <array>) - [((.: (.All (_ a) (.-> (.List a) (..Array a) (.List a))) - (.function (list|-default empty array) - (.loop [index ("lux i64 -" 1 (..size array)) - output empty] - (.if ("lux i64 =" (~~ (.static ..underflow)) index) - output - (again ("lux i64 -" 1 index) - (.if (..lacks? index array) - output - {.#Item (..item index array) output})))))) + [((.is (.All (_ a) (.-> (.List a) (..Array a) (.List a))) + (.function (list|-default empty array) + (.loop [index ("lux i64 -" 1 (..size array)) + output empty] + (.if ("lux i64 =" (~~ (.static ..underflow)) index) + output + (again ("lux i64 -" 1 index) + (.if (..lacks? index array) + output + {.#Item (..item index array) output})))))) <empty> <array>)])) (`` (template: (list|+default <default> <array>) - [((.: (.All (_ a) (.-> a (..Array a) (.List a))) - (.function (list|+default default array) - (.loop [index ("lux i64 -" 1 (..size array)) - output (`` (.: (.List (~~ (.as_is (~~ (.:of default))))) - {.#End}))] - (.if ("lux i64 =" (~~ (.static ..underflow)) index) - output - (again ("lux i64 -" 1 index) - {.#Item (.if (..lacks? index array) - default - (..item index array)) - output}))))) + [((.is (.All (_ a) (.-> a (..Array a) (.List a))) + (.function (list|+default default array) + (.loop [index ("lux i64 -" 1 (..size array)) + output (`` (.is (.List (~~ (.as_is (~~ (.type_of default))))) + {.#End}))] + (.if ("lux i64 =" (~~ (.static ..underflow)) index) + output + (again ("lux i64 -" 1 index) + {.#Item (.if (..lacks? index array) + default + (..item index array)) + output}))))) <default> <array>)])) (`` (template: .public (list <default> <array>) - [((.: (.All (_ a) (.-> (.Maybe a) (..Array a) (.List a))) - (.function (list default array) - (.case default - {.#Some default} - (~~ (..list|+default default array)) - - {.#None} - (~~ (..list|-default {.#End} array))))) + [((.is (.All (_ a) (.-> (.Maybe a) (..Array a) (.List a))) + (.function (list default array) + (.case default + {.#Some default} + (~~ (..list|+default default array)) + + {.#None} + (~~ (..list|-default {.#End} array))))) <default> <array>)])) (template: .public (= <//#=> <left/*> <right/*>) - [((.: (.All (_ a) (.-> (.-> a a .Bit) (..Array a) (..Array a) .Bit)) - (.function (= //#= left/* right/*) - (.let [size (..size left/*)] - (.and ("lux i64 =" (..size right/*) size) - (.loop [index 0] - (.if ("lux i64 <" (.int size) (.int index)) - (.if (..lacks? index left/*) - (..lacks? index right/*) - (.if (..lacks? index right/*) - .false - (.and (//#= (..item index left/*) - (..item index right/*)) - (again ("lux i64 +" 1 index))))) - true)))))) + [((.is (.All (_ a) (.-> (.-> a a .Bit) (..Array a) (..Array a) .Bit)) + (.function (= //#= left/* right/*) + (.let [size (..size left/*)] + (.and ("lux i64 =" (..size right/*) size) + (.loop [index 0] + (.if ("lux i64 <" (.int size) (.int index)) + (.if (..lacks? index left/*) + (..lacks? index right/*) + (.if (..lacks? index right/*) + .false + (.and (//#= (..item index left/*) + (..item index right/*)) + (again ("lux i64 +" 1 index))))) + true)))))) <//#=> <left/*> <right/*>)]) (template: .public (composite <left/*> <right/*>) - [((.: (.All (_ a) (.-> (..Array a) (..Array a) (..Array a))) - (.function (composite left/* right/*) - (.let [|left| (..size left/*) - |right| (..size right/*)] - (.|> (..empty ("lux i64 +" |left| |right|)) - (..copy! |left| 0 left/* 0) - (..copy! |right| 0 right/* |left|))))) + [((.is (.All (_ a) (.-> (..Array a) (..Array a) (..Array a))) + (.function (composite left/* right/*) + (.let [|left| (..size left/*) + |right| (..size right/*)] + (.|> (..empty ("lux i64 +" |left| |right|)) + (..copy! |left| 0 left/* 0) + (..copy! |right| 0 right/* |left|))))) <left/*> <right/*>)]) (template: .public (mix <$> <init> <it>) - [((.: (.All (_ a b) - (.-> (.-> Nat b a a) a (..Array b) a)) - (.function (mix $ init it) - (.let [size (..size it)] - (.loop [index 0 - so_far init] - (.if ("lux i64 <" (.int size) (.int index)) - (.if (..lacks? index it) - (again ("lux i64 +" 1 index) so_far) - (again ("lux i64 +" 1 index) ($ index (..item index it) so_far))) - so_far))))) + [((.is (.All (_ a b) + (.-> (.-> Nat b a a) a (..Array b) a)) + (.function (mix $ init it) + (.let [size (..size it)] + (.loop [index 0 + so_far init] + (.if ("lux i64 <" (.int size) (.int index)) + (.if (..lacks? index it) + (again ("lux i64 +" 1 index) so_far) + (again ("lux i64 +" 1 index) ($ index (..item index it) so_far))) + so_far))))) <$> <init> <it>)]) (template: .public (each <$> <input>) - [((.: (functor.Functor ..Array) - (.function (each $ input) - (..mix (.function (_ index item output) - (..has! index ($ item) output)) - (..empty (..size input)) - input))) + [((.is (functor.Functor ..Array) + (.function (each $ input) + (..mix (.function (_ index item output) + (..has! index ($ item) output)) + (..empty (..size input)) + input))) <$> <input>)]) (template [<name> <init> <op>] [(template: .public (<name> <?> <it>) - [((.: (.All (_ a) - (.-> (.-> a .Bit) - (.-> (..Array a) .Bit))) - (.function (<name> ? it) - (.let [size (..size it)] - (.loop [index 0] - (.if ("lux i64 <" (.int size) (.int index)) - (.if (..lacks? index it) - (again ("lux i64 +" 1 index)) - (<op> (? (..item index it)) - (again ("lux i64 +" 1 index)))) - <init>))))) + [((.is (.All (_ a) + (.-> (.-> a .Bit) + (.-> (..Array a) .Bit))) + (.function (<name> ? it) + (.let [size (..size it)] + (.loop [index 0] + (.if ("lux i64 <" (.int size) (.int index)) + (.if (..lacks? index it) + (again ("lux i64 +" 1 index)) + (<op> (? (..item index it)) + (again ("lux i64 +" 1 index)))) + <init>))))) <?> <it>)])] [every? .true and] @@ -392,20 +392,20 @@ ) (template: .public (one <?> <it>) - [((.: (.All (_ a b) - (.-> (.-> a (.Maybe b)) (..Array a) (.Maybe b))) - (.function (one ? it) - (.let [size (..size it)] - (.loop [index 0] - (.if ("lux i64 <" (.int size) (.int index)) - (with_expansions [<again> (again ("lux i64 +" 1 index))] - (.if (..lacks? index it) - <again> - (.case (? (..item index it)) - {.#None} - <again> - - output - output))) - {.#None}))))) + [((.is (.All (_ a b) + (.-> (.-> a (.Maybe b)) (..Array a) (.Maybe b))) + (.function (one ? it) + (.let [size (..size it)] + (.loop [index 0] + (.if ("lux i64 <" (.int size) (.int index)) + (with_expansions [<again> (again ("lux i64 +" 1 index))] + (.if (..lacks? index it) + <again> + (.case (? (..item index it)) + {.#None} + <again> + + output + output))) + {.#None}))))) <?> <it>)]) |