diff options
author | Eduardo Julian | 2021-09-10 01:21:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-10 01:21:23 -0400 |
commit | cd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 (patch) | |
tree | af6366578f98f1a8e551f4da9f3ad230fd63a4dd | |
parent | ef77466323f85a3d1b65b46a3deb93652ef22085 (diff) |
Migrated variants to the new syntax.
472 files changed, 7824 insertions, 7852 deletions
diff --git a/documentation/bookmark/security/capability_based.md b/documentation/bookmark/security/capability_based.md index 06e79850b..26f24c0e0 100644 --- a/documentation/bookmark/security/capability_based.md +++ b/documentation/bookmark/security/capability_based.md @@ -1,4 +1,5 @@ # Reference +1. [Introducing cap-std, a capability-based version of the Rust standard library](https://blog.sunfishcode.online/introducing-cap-std/) 1. [Introduction To Capability Based Security](http://www.skyhunter.com/marcs/capabilityIntro/index.html) diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux index 058f762c7..21ba1bbfd 100644 --- a/licentia/source/program/licentia.lux +++ b/licentia/source/program/licentia.lux @@ -76,8 +76,8 @@ (\ ! each /output.license))))] (\ file.default write (\ utf8.codec encoded document) output)))] (wrap (debug.log! (case ?done - (#try.Success _) + {#try.Success _} (success_message output) - (#try.Failure message) + {#try.Failure message} message))))) diff --git a/licentia/source/program/licentia/output.lux b/licentia/source/program/licentia/output.lux index c271f3005..3429df952 100644 --- a/licentia/source/program/licentia/output.lux +++ b/licentia/source/program/licentia/output.lux @@ -167,7 +167,7 @@ (def: .public (extension value) (-> Extension Text) (let [[show? document] (case (value@ #license.notification_period value) - (#.Some period) + {#.Some period} [true (extension.notification_requirement period)] #.None @@ -195,14 +195,14 @@ (-> Attribution Text) (let [copyright_notice (format "Attribution Copyright Notice: " (value@ #license.copyright_notice value)) phrase (case (value@ #license.phrase value) - (#.Some phrase) + {#.Some phrase} (format text.new_line "Attribution Phrase: " phrase text.new_line) #.None "") url (format text.new_line "Attribution URL: " (value@ #license.url value)) image (case (value@ #license.image value) - (#.Some image) + {#.Some image} (format text.new_line "Attribution Image: " image) #.None @@ -258,7 +258,7 @@ (maybe\each ..identification) (maybe.default "")) identified? (case (value@ #license.identification value) - (#.Some _) + {#.Some _} true #.None diff --git a/licentia/source/test/licentia.lux b/licentia/source/test/licentia.lux index 4940b31eb..7caf5301c 100644 --- a/licentia/source/test/licentia.lux +++ b/licentia/source/test/licentia.lux @@ -229,7 +229,7 @@ (present? extension.distinctness_requirement))) (_.test "The community must be notified of new extensions." (case (value@ #license.notification_period extension) - (#.Some period) + {#.Some period} (present? (extension.notification_requirement period)) #.None @@ -298,7 +298,7 @@ (_.test "Identification is present (if the license is identified)." (case (value@ #license.identification license) - (#.Some identification) + {#.Some identification} (and (present? (output.identification identification)) (present? miscellaneous.new_versions)) @@ -308,7 +308,7 @@ (_.test "Black-lists (if wanted by licensor) are explicitly enumerated and justified." (list.every? (function (_ black_list) (let [black_list_is_justified? (case (value@ #license.justification black_list) - (#.Some justification) + {#.Some justification} (present? justification) #.None @@ -348,7 +348,7 @@ (..about_extension present? (value@ #license.extension license)) (case (value@ #license.attribution license) - (#.Some attribution) + {#.Some attribution} (..about_attribution present? attribution) #.None diff --git a/lux-bootstrapper/src/lux/analyser.clj b/lux-bootstrapper/src/lux/analyser.clj index f837d8cee..ce571cae8 100644 --- a/lux-bootstrapper/src/lux/analyser.clj +++ b/lux-bootstrapper/src/lux/analyser.clj @@ -86,14 +86,28 @@ (|do [_ (&type/check exo-type &type/Text)] (return (&/|list (&&/|meta exo-type location (&&/$text ?value))))) - (&/$Tuple ?elems) - (&/with-analysis-meta location exo-type - (&&lux/analyse-record analyse exo-type ?elems)) - (&/$Tag ?ident) (&/with-analysis-meta location exo-type (analyse-variant+ analyse exo-type ?ident &/$End)) + (&/$Variant (&/$Item [command-meta command] parameters)) + (|case command + (&/$Nat idx) + (|let [(&/$Item [_ (&/$Bit ?right)] parameters*) parameters] + (&/with-analysis-meta location exo-type + (&&lux/analyse-variant analyse (&/$Right exo-type) (if ?right (inc idx) idx) ?right parameters*))) + + (&/$Tag ?ident) + (&/with-analysis-meta location exo-type + (analyse-variant+ analyse exo-type ?ident parameters)) + + _ + (&/fail-with-loc (str "[Analyser Error] Unknown syntax: " (&/show-ast (&/T [(&/T ["" -1 -1]) token]))))) + + (&/$Tuple ?elems) + (&/with-analysis-meta location exo-type + (&&lux/analyse-record analyse exo-type ?elems)) + (&/$Identifier ?ident) (&/with-analysis-meta location exo-type (&&lux/analyse-identifier analyse exo-type ?ident)) @@ -146,7 +160,7 @@ )) parameters] (&/with-location location (|case ?labels - [_ (&/$Form ?tags)] + [_ (&/$Variant ?tags)] (&&lux/analyse-def-type-tagged analyse optimize eval! compile-def ?name ?value false ?tags exported?) [_ (&/$Tuple ?slots)] @@ -176,15 +190,6 @@ :else (&&common/analyse-proc analyse exo-type ?procedure parameters)))) - - (&/$Nat idx) - (|let [(&/$Item [_ (&/$Bit ?right)] parameters*) parameters] - (&/with-analysis-meta location exo-type - (&&lux/analyse-variant analyse (&/$Right exo-type) (if ?right (inc idx) idx) ?right parameters*))) - - (&/$Tag ?ident) - (&/with-analysis-meta location exo-type - (analyse-variant+ analyse exo-type ?ident parameters)) ;; Pattern-matching syntax. (&/$Variant ?pattern-matching) diff --git a/lux-bootstrapper/src/lux/analyser/case.clj b/lux-bootstrapper/src/lux/analyser/case.clj index 49d781c3b..5d2bb020a 100644 --- a/lux-bootstrapper/src/lux/analyser/case.clj +++ b/lux-bootstrapper/src/lux/analyser/case.clj @@ -358,7 +358,7 @@ [=test =kont] (analyse-pattern &/$None case-type unit-tuple kont)] (return (&/T [($VariantTestAC (&/T [idx (&/|length group) =test])) =kont]))) - (&/$Form (&/$Item [_ (&/$Nat idx)] (&/$Item [_ (&/$Bit right?)] ?values))) + (&/$Variant (&/$Item [_ (&/$Nat idx)] (&/$Item [_ (&/$Bit right?)] ?values))) (let [idx (if right? (inc idx) idx)] (|do [value-type* (adjust-type value-type) case-type (&type/sum-at idx value-type*) @@ -369,7 +369,7 @@ (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$Tuple ?values)]) kont))] (return (&/T [($VariantTestAC (&/T [idx (&/|length (&type/flatten-sum value-type*)) =test])) =kont])))) - (&/$Form (&/$Item [_ (&/$Tag ?ident)] ?values)) + (&/$Variant (&/$Item [_ (&/$Tag ?ident)] ?values)) (|do [[=module =name] (&&/resolved-ident ?ident) must-infer? (&type/unknown? value-type) [_exported? variant-type** group idx] (&module/find-tag =module (str "#" =name)) diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux index cf4ff1036..ef9c02b0e 100644 --- a/lux-cl/source/program.lux +++ b/lux-cl/source/program.lux @@ -169,7 +169,7 @@ (let [sub_value (:as java/lang/Object sub_value)] (`` (<| (~~ (template [<type> <then>] [(case (ffi.check <type> sub_value) - (#.Some sub_value) + {#.Some sub_value} (`` (|> sub_value (~~ (template.splice <then>)))) #.None)] @@ -204,7 +204,7 @@ org/armedbear/lisp/LispObject (case (array.read! (|> idx java/lang/Integer::longValue (:as Nat)) (:as (Array java/lang/Object) value)) - (#.Some sub) + {#.Some sub} (to_sub sub) #.None @@ -224,7 +224,7 @@ value (read (org/armedbear/lisp/LispObject::NTH +2 host_object))] (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 _) + {#.Some _} (: Any (ffi.null)) _ @@ -239,18 +239,18 @@ (if (n.< size idx) ... TODO: Start using "SVREF" instead of "elt" ASAP (case (read (org/armedbear/lisp/LispObject::elt (.int idx) host_object)) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success member) + {#try.Success member} (recur (++ idx) (array.write! idx (:as Any member) output))) - (#try.Success output))))) + {#try.Success output})))) (def: (read host_object) (Reader org/armedbear/lisp/LispObject) (`` (<| (~~ (template [<class> <post_processing>] [(case (ffi.check <class> host_object) - (#.Some host_object) + {#.Some host_object} (`` (|> host_object (~~ (template.splice <post_processing>)))) #.None)] @@ -261,13 +261,13 @@ [org/armedbear/lisp/SimpleString [org/armedbear/lisp/SimpleString::getStringValue #try.Success]] [org/armedbear/lisp/Cons [(read_variant read)]] [org/armedbear/lisp/SimpleVector [(read_tuple read)]] - [org/armedbear/lisp/Nil [(new> (#try.Success false) [])]] + [org/armedbear/lisp/Nil [(new> {#try.Success false} [])]] [org/armedbear/lisp/Closure [#try.Success]] [program/LuxADT [program/LuxADT::getValue #try.Success]])) (case (ffi.check org/armedbear/lisp/Symbol host_object) - (#.Some host_object) + {#.Some host_object} (if (same? (org/armedbear/lisp/Symbol::T) host_object) - (#try.Success true) + {#try.Success true} (exception.throw ..unknown_kind_of_object (:as java/lang/Object host_object))) #.None) @@ -289,7 +289,7 @@ (def: (expander macro inputs lux) Expander (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (call_macro inputs lux macro) #.None @@ -381,7 +381,7 @@ (:as Try) (exec ("lux io log" "TODO: Extender") - (#try.Failure "TODO: Extender")))) + {#try.Failure "TODO: Extender"}))) @.common_lisp (def: (extender handler) diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux index 1e36e2906..8f81cd72f 100644 --- a/lux-js/source/program.lux +++ b/lux-js/source/program.lux @@ -69,7 +69,7 @@ (exception: (null_has_no_lux_representation [code (Maybe _.Expression)]) (case code - (#.Some code) + {#.Some code} (_.code code) #.None @@ -160,7 +160,7 @@ (-> Int org/openjdk/nashorn/api/scripting/JSObject) (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [program/IntValue] [] -... Methods + ... Methods (program/IntValue [] (getValue self []) java/lang/Object (:as java/lang/Object value)) @@ -214,18 +214,18 @@ (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) + {#.Some sub_value} (|> sub_value (:as (Array java/lang/Object)) js_structure) #.None) (case (ffi.check java/lang/Long sub_value) - (#.Some sub_value) + {#.Some sub_value} (|> sub_value (:as Int) js_int) #.None) -... else + ... else (:as org/openjdk/nashorn/api/scripting/JSObject sub_value))))] (ffi.object [] org/openjdk/nashorn/api/scripting/AbstractJSObject [program/StructureValue] [] -... Methods + ... Methods (program/StructureValue [] (getValue self []) java/lang/Object (:as (Array java/lang/Object) value)) @@ -252,7 +252,7 @@ (^ (static runtime.variant_flag_field)) (case (array.read! 1 value) - (#.Some set!) + {#.Some set!} set! _ @@ -280,7 +280,7 @@ ["Class" (java/lang/Object::toString (java/lang/Object::getClass object))] ["Object" (java/lang/Object::toString object)] ["Keys" (case (ffi.check org/openjdk/nashorn/api/scripting/ScriptObjectMirror object) - (#.Some object) + {#.Some object} (|> object (org/openjdk/nashorn/api/scripting/ScriptObjectMirror::getOwnKeys true) (:as (Array Text)) @@ -295,17 +295,17 @@ (Maybe Int)) (case [(org/openjdk/nashorn/api/scripting/JSObject::getMember [runtime.i64_high_field] js_object) (org/openjdk/nashorn/api/scripting/JSObject::getMember [runtime.i64_low_field] js_object)] - (^multi [(#.Some high) (#.Some low)] + (^multi [{#.Some high} {#.Some low}] [[(ffi.check java/lang/Number high) (ffi.check java/lang/Number low)] - [(#.Some high) (#.Some low)]] + [{#.Some high} {#.Some low}]] [[(java/lang/Number::longValue high) (java/lang/Number::longValue low)] [high low]]) - (#.Some (.int (n.+ (|> high .nat (i64.left_shifted 32)) + {#.Some (.int (n.+ (|> high .nat (i64.left_shifted 32)) (if (i.< +0 (.int low)) (|> low .nat (i64.left_shifted 32) (i64.right_shifted 32)) - (.nat low))))) + (.nat low))))} _ #.None)) @@ -317,14 +317,14 @@ (case [(org/openjdk/nashorn/api/scripting/JSObject::getMember [runtime.variant_tag_field] js_object) (org/openjdk/nashorn/api/scripting/JSObject::getMember [runtime.variant_flag_field] js_object) (org/openjdk/nashorn/api/scripting/JSObject::getMember [runtime.variant_value_field] js_object)] - (^multi [(#.Some tag) ?flag (#.Some value)] + (^multi [{#.Some tag} ?flag {#.Some value}] [(ffi.check java/lang/Number tag) - (#.Some tag)] + {#.Some tag}] [(lux_object value) - (#try.Success value)]) - (#.Some [(java/lang/Number::intValue (:as java/lang/Number tag)) + {#try.Success value}]) + {#.Some [(java/lang/Number::intValue (:as java/lang/Number tag)) (maybe.else (ffi.null) ?flag) - value]) + value]} _ #.None)) @@ -340,22 +340,22 @@ (array.empty num_keys))] (if (n.< num_keys idx) (case (org/openjdk/nashorn/api/scripting/JSObject::getMember (%.nat idx) js_object) - (#.Some member) + {#.Some member} (case (ffi.check org/openjdk/nashorn/internal/runtime/Undefined member) - (#.Some _) + {#.Some _} (recur (++ idx) output) #.None (case (lux_object member) - (#try.Success parsed_member) + {#try.Success parsed_member} (recur (++ idx) (array.write! idx (:as java/lang/Object parsed_member) output)) - (#try.Failure error) + {#try.Failure error} #.None)) #.None (recur (++ idx) output)) - (#.Some output)))) + {#.Some output}))) #.None)) (def: (lux_object js_object) @@ -363,51 +363,51 @@ (`` (<| (if (ffi.null? js_object) (exception.except ..null_has_no_lux_representation [#.None])) (case (ffi.check org/openjdk/nashorn/internal/runtime/Undefined js_object) - (#.Some _) + {#.Some _} (exception.except ..undefined_has_no_lux_representation []) #.None) (~~ (template [<class>] [(case (ffi.check <class> js_object) - (#.Some js_object) - (#try.Success js_object) + {#.Some js_object} + {#try.Success js_object} #.None)] [java/lang/Boolean] [java/lang/String])) (~~ (template [<class> <method>] [(case (ffi.check <class> js_object) - (#.Some js_object) - (#try.Success (<method> js_object)) + {#.Some js_object} + {#try.Success (<method> js_object)} #.None)] [java/lang/Number java/lang/Number::doubleValue] [program/StructureValue program/StructureValue::getValue] [program/IntValue program/IntValue::getValue])) (case (ffi.check org/openjdk/nashorn/api/scripting/ScriptObjectMirror js_object) - (#.Some js_object) + {#.Some js_object} (case (check_int js_object) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (case (check_variant lux_object js_object) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (case (check_tuple lux_object js_object) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (if (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)]) - (#try.Success js_object) + {#try.Success 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)]) - (#try.Success js_object) + ... else + ... (exception.except ..unknown_kind_of_host_object [(:as java/lang/Object js_object)]) + {#try.Success js_object} ))) (def: (ensure_function function) @@ -417,7 +417,7 @@ (:as java/lang/Object) (ffi.check org/openjdk/nashorn/api/scripting/JSObject))] (if (org/openjdk/nashorn/api/scripting/JSObject::isFunction function) - (#.Some function) + {#.Some function} #.None))) ) @@ -444,16 +444,16 @@ (def: (expander macro inputs lux) Expander (case (..ensure_function macro) - (#.Some macro) + {#.Some macro} (case (call_macro inputs lux macro) - (#try.Success output) + {#try.Success output} (|> output (:as java/lang/Object) lux_object (:as (Try (Try [Lux (List Code)])))) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..cannot_apply_a_non_function (:as java/lang/Object macro)))) @@ -462,7 +462,7 @@ @.js (def: (expander macro inputs lux) Expander - (#try.Success ((:as Macro' macro) inputs lux))) + {#try.Success ((:as Macro' macro) inputs lux)}) ]) (for [@.old @@ -471,11 +471,11 @@ (do try.monad [?output (javax/script/ScriptEngine::eval (_.code input) interpreter)] (case ?output - (#.Some output) + {#.Some output} (..lux_object output) #.None - (exception.except ..null_has_no_lux_representation [(#.Some input)])))) + (exception.except ..null_has_no_lux_representation [{#.Some input}])))) (def: (execute! interpreter input) (-> javax/script/ScriptEngine _.Statement (Try Any)) @@ -519,24 +519,24 @@ @.js (as_is (def: (eval code) (-> Text (Try (Maybe Any))) -... Note: I have to call "eval" this way -... in order to avoid a quirk of calling eval in Node -... when the code is running under "use strict";. + ... Note: I have to call "eval" this way + ... in order to avoid a quirk of calling eval in Node + ... when the code is running under "use strict";. (try (let [return ("js apply" (function.identity ("js constant" "eval")) code)] (if ("js object null?" return) #.None - (#.Some return))))) + {#.Some return})))) (def: (evaluate! alias input) (-> Context _.Expression (Try Any)) (do try.monad [?output (..eval (_.code input))] (case ?output - (#.Some output) + {#.Some output} (in output) #.None - (exception.except ..null_has_no_lux_representation [(#.Some input)])))) + (exception.except ..null_has_no_lux_representation [{#.Some input}])))) (def: (execute! input) (-> _.Statement (Try Any)) diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index b41e0b75f..b81a10c69 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -72,19 +72,19 @@ (def: (literal literal) (-> /.Literal Inst) (case literal - (#/.Boolean value) (_.boolean value) - (#/.Int value) (_.int value) - (#/.Long value) (_.long value) - (#/.Double value) (_.double value) - (#/.Char value) (_.char value) - (#/.String value) (_.string value))) + {#/.Boolean value} (_.boolean value) + {#/.Int value} (_.int value) + {#/.Long value} (_.long value) + {#/.Double value} (_.double value) + {#/.Char value} (_.char value) + {#/.String value} (_.string value))) (def: (constant instruction) (-> /.Constant Inst) (case instruction - (#/.BIPUSH constant) (_.BIPUSH constant) + {#/.BIPUSH constant} (_.BIPUSH constant) - (#/.SIPUSH constant) (_.SIPUSH constant) + {#/.SIPUSH constant} (_.SIPUSH constant) #/.ICONST_M1 _.ICONST_M1 #/.ICONST_0 _.ICONST_0 @@ -106,7 +106,7 @@ #/.ACONST_NULL _.NULL - (#/.LDC literal) + {#/.LDC literal} (..literal literal) )) @@ -153,16 +153,16 @@ (def: (arithmetic instruction) (-> /.Arithmetic Inst) (case instruction - (#/.Int_Arithmetic int_arithmetic) + {#/.Int_Arithmetic int_arithmetic} (..int_arithmetic int_arithmetic) - (#/.Long_Arithmetic long_arithmetic) + {#/.Long_Arithmetic long_arithmetic} (..long_arithmetic long_arithmetic) - (#/.Float_Arithmetic float_arithmetic) + {#/.Float_Arithmetic float_arithmetic} (..float_arithmetic float_arithmetic) - (#/.Double_Arithmetic double_arithmetic) + {#/.Double_Arithmetic double_arithmetic} (..double_arithmetic double_arithmetic))) (def: (int_bitwise instruction) @@ -188,10 +188,10 @@ (def: (bitwise instruction) (-> /.Bitwise Inst) (case instruction - (#/.Int_Bitwise int_bitwise) + {#/.Int_Bitwise int_bitwise} (..int_bitwise int_bitwise) - (#/.Long_Bitwise long_bitwise) + {#/.Long_Bitwise long_bitwise} (..long_bitwise long_bitwise))) (def: (conversion instruction) @@ -221,8 +221,8 @@ (case instruction #/.ARRAYLENGTH _.ARRAYLENGTH - (#/.NEWARRAY type) (_.NEWARRAY type) - (#/.ANEWARRAY type) (_.ANEWARRAY type) + {#/.NEWARRAY type} (_.NEWARRAY type) + {#/.ANEWARRAY type} (_.ANEWARRAY type) #/.BALOAD _.BALOAD #/.BASTORE _.BASTORE @@ -252,20 +252,20 @@ (-> /.Object Inst) (case instruction (^template [<tag> <inst>] - [(<tag> class field_name field_type) + [{<tag> class field_name field_type} (<inst> class field_name field_type)]) ([#/.GETSTATIC _.GETSTATIC] [#/.PUTSTATIC _.PUTSTATIC] [#/.GETFIELD _.GETFIELD] [#/.PUTFIELD _.PUTFIELD]) - (#/.NEW type) (_.NEW type) + {#/.NEW type} (_.NEW type) - (#/.INSTANCEOF type) (_.INSTANCEOF type) - (#/.CHECKCAST type) (_.CHECKCAST type) + {#/.INSTANCEOF type} (_.INSTANCEOF type) + {#/.CHECKCAST type} (_.CHECKCAST type) (^template [<tag> <inst>] - [(<tag> class method_name method_type) + [{<tag> class method_name method_type} (<inst> class method_name method_type)]) ([#/.INVOKEINTERFACE _.INVOKEINTERFACE] [#/.INVOKESPECIAL _.INVOKESPECIAL] @@ -276,42 +276,42 @@ (def: (local_int instruction) (-> /.Local_Int Inst) (case instruction - (#/.ILOAD register) (_.ILOAD register) - (#/.ISTORE register) (_.ISTORE register))) + {#/.ILOAD register} (_.ILOAD register) + {#/.ISTORE register} (_.ISTORE register))) (def: (local_long instruction) (-> /.Local_Long Inst) (case instruction - (#/.LLOAD register) (_.LLOAD register) - (#/.LSTORE register) (_.LSTORE register))) + {#/.LLOAD register} (_.LLOAD register) + {#/.LSTORE register} (_.LSTORE register))) (def: (local_float instruction) (-> /.Local_Float Inst) (case instruction - (#/.FLOAD register) (_.FLOAD register) - (#/.FSTORE register) (_.FSTORE register))) + {#/.FLOAD register} (_.FLOAD register) + {#/.FSTORE register} (_.FSTORE register))) (def: (local_double instruction) (-> /.Local_Double Inst) (case instruction - (#/.DLOAD register) (_.DLOAD register) - (#/.DSTORE register) (_.DSTORE register))) + {#/.DLOAD register} (_.DLOAD register) + {#/.DSTORE register} (_.DSTORE register))) (def: (local_object instruction) (-> /.Local_Object Inst) (case instruction - (#/.ALOAD register) (_.ALOAD register) - (#/.ASTORE register) (_.ASTORE register))) + {#/.ALOAD register} (_.ALOAD register) + {#/.ASTORE register} (_.ASTORE register))) (def: (local instruction) (-> /.Local Inst) (case instruction - (#/.Local_Int instruction) (..local_int instruction) - (#/.IINC register) (_.IINC register) - (#/.Local_Long instruction) (..local_long instruction) - (#/.Local_Float instruction) (..local_float instruction) - (#/.Local_Double instruction) (..local_double instruction) - (#/.Local_Object instruction) (..local_object instruction))) + {#/.Local_Int instruction} (..local_int instruction) + {#/.IINC register} (_.IINC register) + {#/.Local_Long instruction} (..local_long instruction) + {#/.Local_Float instruction} (..local_float instruction) + {#/.Local_Double instruction} (..local_double instruction) + {#/.Local_Object instruction} (..local_object instruction))) (def: (stack instruction) (-> /.Stack Inst) @@ -340,34 +340,34 @@ (def: (branching instruction) (-> (/.Branching org/objectweb/asm/Label) Inst) (case instruction - (#/.IF_ICMPEQ label) (_.IF_ICMPEQ label) - (#/.IF_ICMPGE label) (_.IF_ICMPGE label) - (#/.IF_ICMPGT label) (_.IF_ICMPGT label) - (#/.IF_ICMPLE label) (_.IF_ICMPLE label) - (#/.IF_ICMPLT label) (_.IF_ICMPLT label) - (#/.IF_ICMPNE label) (_.IF_ICMPNE label) - (#/.IFEQ label) (_.IFEQ label) - (#/.IFGE label) (_.IFGE label) - (#/.IFGT label) (_.IFGT label) - (#/.IFLE label) (_.IFLE label) - (#/.IFLT label) (_.IFLT label) - (#/.IFNE label) (_.IFNE label) - - (#/.TABLESWITCH min max default labels) + {#/.IF_ICMPEQ label} (_.IF_ICMPEQ label) + {#/.IF_ICMPGE label} (_.IF_ICMPGE label) + {#/.IF_ICMPGT label} (_.IF_ICMPGT label) + {#/.IF_ICMPLE label} (_.IF_ICMPLE label) + {#/.IF_ICMPLT label} (_.IF_ICMPLT label) + {#/.IF_ICMPNE label} (_.IF_ICMPNE label) + {#/.IFEQ label} (_.IFEQ label) + {#/.IFGE label} (_.IFGE label) + {#/.IFGT label} (_.IFGT label) + {#/.IFLE label} (_.IFLE label) + {#/.IFLT label} (_.IFLT label) + {#/.IFNE label} (_.IFNE label) + + {#/.TABLESWITCH min max default labels} (_.TABLESWITCH min max default labels) - (#/.LOOKUPSWITCH default keys+labels) + {#/.LOOKUPSWITCH default keys+labels} (_.LOOKUPSWITCH default keys+labels) - (#/.IF_ACMPEQ label) (_.IF_ACMPEQ label) - (#/.IF_ACMPNE label) (_.IF_ACMPNE label) - (#/.IFNONNULL label) (_.IFNONNULL label) - (#/.IFNULL label) (_.IFNULL label))) + {#/.IF_ACMPEQ label} (_.IF_ACMPEQ label) + {#/.IF_ACMPNE label} (_.IF_ACMPNE label) + {#/.IFNONNULL label} (_.IFNONNULL label) + {#/.IFNULL label} (_.IFNULL label))) (def: (exception instruction) (-> (/.Exception org/objectweb/asm/Label) Inst) (case instruction - (#/.Try start end handler exception) (_.try start end handler exception) + {#/.Try start end handler exception} (_.try start end handler exception) #/.ATHROW _.ATHROW)) (def: (concurrency instruction) @@ -389,27 +389,27 @@ (def: (control instruction) (-> (/.Control org/objectweb/asm/Label) Inst) (case instruction - (#/.GOTO label) (_.GOTO label) - (#/.Branching instruction) (..branching instruction) - (#/.Exception instruction) (..exception instruction) - (#/.Concurrency instruction) (..concurrency instruction) - (#/.Return instruction) (..return instruction))) + {#/.GOTO label} (_.GOTO label) + {#/.Branching instruction} (..branching instruction) + {#/.Exception instruction} (..exception instruction) + {#/.Concurrency instruction} (..concurrency instruction) + {#/.Return instruction} (..return instruction))) (def: (instruction instruction) (-> (/.Instruction Inst org/objectweb/asm/Label) Inst) (case instruction #/.NOP _.NOP - (#/.Constant instruction) (..constant instruction) - (#/.Arithmetic instruction) (..arithmetic instruction) - (#/.Bitwise instruction) (..bitwise instruction) - (#/.Conversion instruction) (..conversion instruction) - (#/.Array instruction) (..array instruction) - (#/.Object instruction) (..object instruction) - (#/.Local instruction) (..local instruction) - (#/.Stack instruction) (..stack instruction) - (#/.Comparison instruction) (..comparison instruction) - (#/.Control instruction) (..control instruction) - (#/.Embedded embedded) embedded)) + {#/.Constant instruction} (..constant instruction) + {#/.Arithmetic instruction} (..arithmetic instruction) + {#/.Bitwise instruction} (..bitwise instruction) + {#/.Conversion instruction} (..conversion instruction) + {#/.Array instruction} (..array instruction) + {#/.Object instruction} (..object instruction) + {#/.Local instruction} (..local instruction) + {#/.Stack instruction} (..stack instruction) + {#/.Comparison instruction} (..comparison instruction) + {#/.Control instruction} (..control instruction) + {#/.Embedded embedded} embedded)) (type: Mapping (Dictionary /.Label org/objectweb/asm/Label)) @@ -421,7 +421,7 @@ (def: (relabel [mapping label]) (Re_labeler Identity) (case (dictionary.value label mapping) - (#.Some label) + {#.Some label} [mapping label] #.None @@ -432,39 +432,39 @@ (Re_labeler /.Branching) (case instruction (^template [<tag>] - [(<tag> label) + [{<tag> label} (let [[mapping label] (..relabel [mapping label])] - [mapping (<tag> label)])]) + [mapping {<tag> label}])]) ([#/.IF_ICMPEQ] [#/.IF_ICMPGE] [#/.IF_ICMPGT] [#/.IF_ICMPLE] [#/.IF_ICMPLT] [#/.IF_ICMPNE] [#/.IFEQ] [#/.IFNE] [#/.IFGE] [#/.IFGT] [#/.IFLE] [#/.IFLT] [#/.IF_ACMPEQ] [#/.IF_ACMPNE] [#/.IFNONNULL] [#/.IFNULL]) - (#/.TABLESWITCH min max default labels) + {#/.TABLESWITCH min max default labels} (let [[mapping default] (..relabel [mapping default]) [mapping labels] (list\mix (function (_ input [mapping output]) (let [[mapping input] (..relabel [mapping input])] [mapping (list& input output)])) [mapping (list)] labels)] - [mapping (#/.TABLESWITCH min max default (list.reversed labels))]) + [mapping {#/.TABLESWITCH min max default (list.reversed labels)}]) - (#/.LOOKUPSWITCH default keys+labels) + {#/.LOOKUPSWITCH default keys+labels} (let [[mapping default] (..relabel [mapping default]) [mapping keys+labels] (list\mix (function (_ [expected input] [mapping output]) (let [[mapping input] (..relabel [mapping input])] [mapping (list& [expected input] output)])) [mapping (list)] keys+labels)] - [mapping (#/.LOOKUPSWITCH default (list.reversed keys+labels))]) + [mapping {#/.LOOKUPSWITCH default (list.reversed keys+labels)}]) )) (def: (relabel_exception [mapping instruction]) (Re_labeler /.Exception) (case instruction - (#/.Try start end handler exception) + {#/.Try start end handler exception} (let [[mapping start] (..relabel [mapping start]) [mapping end] (..relabel [mapping end]) [mapping handler] (..relabel [mapping handler])] - [mapping (#/.Try start end handler exception)]) + [mapping {#/.Try start end handler exception}]) #/.ATHROW [mapping #/.ATHROW] @@ -474,31 +474,31 @@ (Re_labeler /.Control) (case instruction (^template [<tag> <relabel>] - [(<tag> instruction) + [{<tag> instruction} (let [[mapping instruction] (<relabel> [mapping instruction])] - [mapping (<tag> instruction)])]) + [mapping {<tag> instruction}])]) ([#/.GOTO ..relabel] [#/.Branching ..relabel_branching] [#/.Exception ..relabel_exception]) (^template [<tag>] - [(<tag> instruction) - [mapping (<tag> instruction)]]) + [{<tag> instruction} + [mapping {<tag> instruction}]]) ([#/.Concurrency] [#/.Return]) )) (def: (relabel_instruction [mapping instruction]) (Re_labeler (/.Instruction Inst)) (case instruction - (#/.Embedded embedded) - [mapping (#/.Embedded embedded)] + {#/.Embedded embedded} + [mapping {#/.Embedded embedded}] #/.NOP [mapping #/.NOP] (^template [<tag>] - [(<tag> instruction) - [mapping (<tag> instruction)]]) + [{<tag> instruction} + [mapping {<tag> instruction}]]) ([#/.Constant] [#/.Arithmetic] [#/.Bitwise] @@ -509,9 +509,9 @@ [#/.Stack] [#/.Comparison]) - (#/.Control instruction) + {#/.Control instruction} (let [[mapping instruction] (..relabel_control [mapping instruction])] - [mapping (#/.Control instruction)]))) + [mapping {#/.Control instruction}]))) (def: (relabel_bytecode [mapping bytecode]) (Re_labeler (/.Bytecode Inst)) @@ -587,10 +587,10 @@ ..Handler)) (function (_ extension_name phase archive input) (case (<code>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (phase.except extension.invalid_syntax [extension_name %.code input])))) (type: Declaration @@ -716,11 +716,11 @@ (type: (Method a) (Variant - (#Constructor (Constructor a)) - (#Override (Override a)) - (#Virtual (Virtual a)) - (#Static (Static a)) - (#Abstract Abstract))) + {#Constructor (Constructor a)} + {#Override (Override a)} + {#Virtual (Virtual a)} + {#Static (Static a)} + {#Abstract Abstract})) (def: constructor (Parser (Constructor Code)) @@ -843,10 +843,10 @@ (def: (header_value valueT) (-> (Type Value) Inst) (case (/type.primitive? valueT) - (#.Left classT) + {#.Left classT} _.NULL - (#.Right primitiveT) + {#.Right primitiveT} (cond (or (\ /type.equivalence = /type.boolean primitiveT) (\ /type.equivalence = /type.byte primitiveT) (\ /type.equivalence = /type.short primitiveT) @@ -866,16 +866,16 @@ (def: (header_return returnT) (-> (Type Return) Inst) (case (/type.void? returnT) - (#.Right returnT) + {#.Right returnT} _.RETURN - (#.Left valueT) + {#.Left valueT} (case (/type.primitive? valueT) - (#.Left classT) + {#.Left classT} (|>> (header_value classT) _.ARETURN) - (#.Right primitiveT) + {#.Right primitiveT} (cond (or (\ /type.equivalence = /type.boolean primitiveT) (\ /type.equivalence = /type.byte primitiveT) (\ /type.equivalence = /type.short primitiveT) @@ -911,9 +911,9 @@ (def: (method_header super_class method) (-> (Type Class) (Method Code) jvm.Def) (case method - (#Constructor [privacy strict_floating_point? annotations variables exceptions + {#Constructor [privacy strict_floating_point? annotations variables exceptions self arguments constructor_arguments - body]) + body]} (let [[super_name super_vars] (parser.read_class super_class) init_constructor_arguments (|> constructor_arguments (list\each (|>> product.left ..header_value)) @@ -933,9 +933,9 @@ (_.INVOKESPECIAL super_class ..constructor_name super_constructorT) _.RETURN))) - (#Override [[parent_name parent_variables] name strict_floating_point? annotations variables + {#Override [[parent_name parent_variables] name strict_floating_point? annotations variables self arguments return exceptions - body]) + body]} (def.method #jvm.Public (if strict_floating_point? jvm.strictM @@ -944,9 +944,9 @@ (/type.method [variables (list\each product.right arguments) return exceptions]) (..header_return return)) - (#Virtual [name privacy final? strict_floating_point? annotations variables + {#Virtual [name privacy final? strict_floating_point? annotations variables self arguments return exceptions - body]) + body]} (def.method (..visibility privacy) (|> jvm.noneM (jvm.++M (if strict_floating_point? @@ -959,9 +959,9 @@ (/type.method [variables (list\each product.right arguments) return exceptions]) (..header_return return)) - (#Static [name privacy strict_floating_point? annotations variables + {#Static [name privacy strict_floating_point? annotations variables arguments return exceptions - body]) + body]} (def.method (..visibility privacy) (|> jvm.staticM (jvm.++M (if strict_floating_point? @@ -971,7 +971,7 @@ (/type.method [variables (list\each product.right arguments) return exceptions]) (..header_return return)) - (#Abstract method) + {#Abstract method} (..abstract_method_generation method) )) @@ -1033,7 +1033,7 @@ arguments) returnT (//A.boxed_reflection_return mapping /type.void) [_scope bodyA] (|> arguments' - (#.Item [self selfT]) + {#.Item [self selfT]} list.reversed (list\mix scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) @@ -1063,7 +1063,7 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - (#.Item [self selfT]) + {#.Item [self selfT]} list.reversed (list\mix scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) @@ -1091,7 +1091,7 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - (#.Item [self selfT]) + {#.Item [self selfT]} list.reversed (list\mix scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) @@ -1128,24 +1128,24 @@ (def: (method_analysis archive declaration supers method) (-> Archive Declaration (List (Type Class)) (Method Code) (Operation (Method Analysis))) (case method - (#Constructor method) + {#Constructor method} (\ phase.monad each (|>> #Constructor) (constructor_method_analysis archive declaration method)) - (#Override method) + {#Override method} (\ phase.monad each (|>> #Override) (override_method_analysis archive declaration supers method)) - (#Virtual method) + {#Virtual method} (\ phase.monad each (|>> #Virtual) (virtual_method_analysis archive declaration method)) - (#Static method) + {#Static method} (\ phase.monad each (|>> #Static) (static_method_analysis archive method)) - (#Abstract method) - (\ phase.monad in (#Abstract method)) + {#Abstract method} + (\ phase.monad in {#Abstract method}) )) (template: (method_body <bodyS>) @@ -1168,7 +1168,7 @@ (\ ! each (|>> [typeJ]) (synthesise archive termA))) constructor_argumentsA) - bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [privacy strict_floating_point? annotations method_tvars exceptions self arguments constructor_argumentsS (case bodyS @@ -1187,7 +1187,7 @@ synthesise directive.synthesis] (directive.lifted_synthesis (do ! - [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + [bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [[super_name super_tvars] method_name strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ (case bodyS @@ -1206,7 +1206,7 @@ synthesise directive.synthesis] (directive.lifted_synthesis (do ! - [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + [bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [name privacy final? strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ (case bodyS @@ -1225,7 +1225,7 @@ synthesise directive.synthesis] (directive.lifted_synthesis (do ! - [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + [bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [name privacy strict_floating_point? annotations method_tvars arguments returnJ exceptionsJ (case bodyS @@ -1238,24 +1238,24 @@ (def: (method_synthesis archive method) (-> Archive (Method Analysis) (Operation (Method Synthesis))) (case method - (#Constructor method) + {#Constructor method} (\ phase.monad each (|>> #Constructor) (constructor_method_synthesis archive method)) - (#Override method) + {#Override method} (\ phase.monad each (|>> #Override) (override_method_synthesis archive method)) - (#Virtual method) + {#Virtual method} (\ phase.monad each (|>> #Virtual) (virtual_method_synthesis archive method)) - (#Static method) + {#Static method} (\ phase.monad each (|>> #Static) (static_method_synthesis archive method)) - (#Abstract method) - (\ phase.monad in (#Abstract method)) + {#Abstract method} + (\ phase.monad in {#Abstract method}) )) (def: (constructor_method_generation archive super_class method) @@ -1363,19 +1363,19 @@ (def: (method_generation archive super_class method) (-> Archive (Type Class) (Method Synthesis) (Operation jvm.Def)) (case method - (#Constructor method) + {#Constructor method} (..constructor_method_generation archive super_class method) - (#Override method) + {#Override method} (..override_method_generation archive method) - (#Virtual method) + {#Virtual method} (..virtual_method_generation archive method) - (#Static method) + {#Static method} (..static_method_generation archive method) - (#Abstract method) + {#Abstract method} (\ phase.monad in (..abstract_method_generation method)) )) @@ -1384,13 +1384,13 @@ (def: (convert_overriden_method method) (-> (Method Code) (Maybe (//A.Overriden_Method Code))) (case method - (#Override [[parent_name parent_variables] method_name strict_floating_point? annotations variables + {#Override [[parent_name parent_variables] method_name strict_floating_point? annotations variables self arguments return exceptions - body]) - (#.Some [(/type.class parent_name parent_variables) method_name + body]} + {#.Some [(/type.class parent_name parent_variables) method_name strict_floating_point? (list) variables self arguments return exceptions - body]) + body]} _ #.None)) @@ -1445,7 +1445,7 @@ (do ! [artifact_id (generation.learn_custom class_name) _ (generation.execute! directive) - _ (generation.save! artifact_id (#.Some class_name) directive) + _ (generation.save! artifact_id {#.Some class_name} directive) _ (generation.log! (format "JVM Class " (%.text class_name)))] (in directive.no_requirements)))))])) @@ -1472,7 +1472,7 @@ (do ! [artifact_id (generation.learn_custom class_name) _ (generation.execute! directive) - _ (generation.save! artifact_id (#.Some class_name) directive) + _ (generation.save! artifact_id {#.Some class_name} directive) _ (generation.log! (format "JVM Interface " (%.text class_name)))] (in directive.no_requirements)))))])) diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux index 36aed2d61..ecafc00d2 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/def.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux @@ -296,8 +296,8 @@ #.End function.identity - (#.Item singleton #.End) + {#.Item singleton #.End} singleton - (#.Item head tail) + {#.Item head tail} (function.composite (fuse tail) head))) diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux index 2255774f8..bbeffb023 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux @@ -152,7 +152,7 @@ (def: .public make_label (All (_ s) (Operation s org/objectweb/asm/Label)) (function (_ state) - (#try.Success [state (org/objectweb/asm/Label::new)]))) + {#try.Success [state (org/objectweb/asm/Label::new)]})) (def: .public (with_label action) (All (_ a) (-> (-> org/objectweb/asm/Label a) a)) @@ -414,10 +414,10 @@ (def: .public (array elementT) (-> (Type Value) Inst) (case (type.primitive? elementT) - (#.Left elementT) + {#.Left elementT} (ANEWARRAY elementT) - (#.Right elementT) + {#.Right elementT} (NEWARRAY elementT))) (template [<name> <boolean> <byte> <short> <int> <long> <float> <double> <char>] @@ -462,8 +462,8 @@ #.End function.identity - (#.Item singleton #.End) + {#.Item singleton #.End} singleton - (#.Item head tail) + {#.Item head tail} (function.composite (fuse tail) head))) diff --git a/lux-jvm/source/luxc/lang/synthesis/variable.lux b/lux-jvm/source/luxc/lang/synthesis/variable.lux index 12594e154..685eaae92 100644 --- a/lux-jvm/source/luxc/lang/synthesis/variable.lux +++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux @@ -11,10 +11,10 @@ (def: (bound-vars path) (-> ls.Path (List Variable)) (case path - (#ls.BindP register) + {#ls.BindP register} (list (.int register)) - (^or (#ls.SeqP pre post) (#ls.AltP pre post)) + (^or {#ls.SeqP pre post} {#ls.AltP pre post}) (list/composite (bound-vars pre) (bound-vars post)) _ @@ -23,13 +23,13 @@ (def: (path-bodies path) (-> ls.Path (List ls.Synthesis)) (case path - (#ls.ExecP body) + {#ls.ExecP body} (list body) - (#ls.SeqP pre post) + {#ls.SeqP pre post} (path-bodies post) - (#ls.AltP pre post) + {#ls.AltP pre post} (list/composite (path-bodies pre) (path-bodies post)) _ @@ -49,40 +49,40 @@ (let [tracker (loop [exprS exprS tracker (list/mix s.has init-tracker bound)] (case exprS - (#ls.Variable var) + {#ls.Variable var} (if (non-arg? current-arity var) (s.lacks var tracker) tracker) - (#ls.Variant tag last? memberS) + {#ls.Variant tag last? memberS} (recur memberS tracker) - (#ls.Tuple membersS) + {#ls.Tuple membersS} (list/mix recur tracker membersS) - (#ls.Call funcS argsS) + {#ls.Call funcS argsS} (list/mix recur (recur funcS tracker) argsS) - (^or (#ls.Recur argsS) - (#ls.Procedure name argsS)) + (^or {#ls.Recur argsS} + {#ls.Procedure name argsS}) (list/mix recur tracker argsS) - (#ls.Let offset inputS outputS) + {#ls.Let offset inputS outputS} (|> tracker (recur inputS) (recur outputS)) - (#ls.If testS thenS elseS) + {#ls.If testS thenS elseS} (|> tracker (recur testS) (recur thenS) (recur elseS)) - (#ls.Loop offset initsS bodyS) + {#ls.Loop offset initsS bodyS} (recur bodyS (list/mix recur tracker initsS)) - (#ls.Case inputS outputPS) + {#ls.Case inputS outputPS} (let [tracker' (list/mix s.has (recur inputS tracker) (bound-vars outputPS))] (list/mix recur tracker' (path-bodies outputPS))) - (#ls.Function arity env bodyS) + {#ls.Function arity env bodyS} (list/mix s.lacks tracker env) _ diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index db7b5b3fa..6a641f0ee 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -83,20 +83,20 @@ (def: (class_value class_name class) (-> Text (java/lang/Class java/lang/Object) (Try Any)) (case (java/lang/Class::getField ..value_field class) - (#try.Success field) + {#try.Success field} (case (java/lang/reflect/Field::get #.None field) - (#try.Success ?value) + {#try.Success ?value} (case ?value - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (exception.except ..invalid_value class_name)) - (#try.Failure error) + {#try.Failure error} (exception.except ..cannot_load [class_name error])) - (#try.Failure error) + {#try.Failure error} (exception.except ..invalid_field [class_name ..value_field error]))) (def: class_path_separator ".") diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index a6d0a725f..0959130a3 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -106,15 +106,15 @@ #synthesis.Pop (operation@in ..popI) - (#synthesis.Bind register) + {#synthesis.Bind register} (operation@in (|>> peekI (_.ASTORE register))) - (#synthesis.Bit_Fork when thenP elseP) + {#synthesis.Bit_Fork when thenP elseP} (do phase.monad [thenG (path' stack_depth @else @end phase archive thenP) elseG (.case elseP - (#.Some elseP) + {#.Some elseP} (path' stack_depth @else @end phase archive elseP) #.None @@ -129,7 +129,7 @@ elseG)))) (^template [<tag> <unwrap> <dup> <pop> <test> <comparison> <if>] - [(<tag> cons) + [{<tag> cons} (do [@ phase.monad] [forkG (: (Operation Inst) (monad.mix @ (function (_ [test thenP] elseG) @@ -146,7 +146,7 @@ elseG))))) (|>> <pop> (_.GOTO @else)) - (#.Item cons)))] + {#.Item cons}))] (in (|>> peekI <unwrap> forkG)))]) @@ -156,7 +156,7 @@ (_.INVOKEVIRTUAL (type.class "java.lang.Object" (list)) "equals" ..equalsJT) _.IFEQ]) - (#synthesis.Then bodyS) + {#synthesis.Then bodyS} (do phase.monad [bodyI (phase archive bodyS)] (in (|>> (pop_altI stack_depth) @@ -202,14 +202,14 @@ ([synthesis.member/left ..left_projection] [synthesis.member/right ..right_projection]) - (#synthesis.Seq leftP rightP) + {#synthesis.Seq leftP rightP} (do phase.monad [leftI (path' stack_depth @else @end phase archive leftP) rightI (path' stack_depth @else @end phase archive rightP)] (in (|>> leftI rightI))) - (#synthesis.Alt leftP rightP) + {#synthesis.Alt leftP rightP} (do phase.monad [@alt_else _.make_label leftI (path' (++ stack_depth) @alt_else @end phase archive leftP) @@ -268,10 +268,10 @@ [recordG (phase archive recordS)] (in (list@mix (function (_ step so_far) (.let [next (.case step - (#.Left lefts) + {#.Left lefts} (..left_projection lefts) - (#.Right lefts) + {#.Right lefts} (..right_projection lefts))] (|>> so_far next))) recordG diff --git a/lux-jvm/source/luxc/lang/translation/jvm/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/common.lux index 8db12bd7e..2dade7a97 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux @@ -32,21 +32,21 @@ ... (All (_ a) (-> (Meta a) (Meta [Artifacts a]))) ... (function (_ state) ... (case (action (revised@ #.host -... (|>> (:coerce Host) -... (with@ #artifacts (dictionary.new text.hash)) -... (:coerce Nothing)) -... state)) -... (#try.Success [state' output]) -... (#try.Success [(revised@ #.host -... (|>> (:coerce Host) -... (with@ #artifacts (|> (value@ #.host state) (:coerce Host) (value@ #artifacts))) -... (:coerce Nothing)) -... state') -... [(|> state' (value@ #.host) (:coerce Host) (value@ #artifacts)) -... output]]) +... (|>> (:coerce Host) +... (with@ #artifacts (dictionary.new text.hash)) +... (:coerce Nothing)) +... state)) +... {#try.Success [state' output]} +... {#try.Success [(revised@ #.host +... (|>> (:coerce Host) +... (with@ #artifacts (|> (value@ #.host state) (:coerce Host) (value@ #artifacts))) +... (:coerce Nothing)) +... state') +... [(|> state' (value@ #.host) (:coerce Host) (value@ #artifacts)) +... output]]} -... (#try.Failure error) -... (#try.Failure error)))) +... {#try.Failure error} +... {#try.Failure error}))) ... (def: .public (load-definition state) ... (-> Lux (-> Name Binary (Try Any))) @@ -60,14 +60,14 @@ ... (case (do try.monad ... [field (Class::getField [..value-field] class)] ... (Field::get [#.None] field)) -... (#try.Success (#.Some def-value)) +... {#try.Success {#.Some def-value}} ... (wrap def-value) -... (#try.Success #.None) +... {#try.Success #.None} ... (phase.throw invalid-definition-value (%name def-name)) -... (#try.Failure error) +... {#try.Failure error} ... (phase.throw cannot-load-definition -... (format "Definition: " (%name def-name) "\n" -... "Error:\n" -... error)))))))) +... (format "Definition: " (%name def-name) "\n" +... "Error:\n" +... error)))))))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux index 087ebfaff..a460ad96b 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux @@ -72,5 +72,5 @@ (^ (synthesis.function/abstraction data)) (function.function translate archive data) - (#synthesis.Extension extension) + {#synthesis.Extension extension} (extension.apply archive translate extension))) 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 e3ac4141b..8d92a68eb 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -48,10 +48,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (phase.except extension.invalid_syntax [extension_name %synthesis input])))) (import: java/lang/Double 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 131ff0968..8535c3b35 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -96,9 +96,9 @@ (do <>.monad [arrayJT (<text>.then parser.array <synthesis>.text)] (case (parser.array? arrayJT) - (#.Some elementJT) + {#.Some elementJT} (case (parser.object? elementJT) - (#.Some elementJT) + {#.Some elementJT} (in elementJT) #.None @@ -629,7 +629,7 @@ (do phase.monad [] (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (in (_.GETSTATIC (type.class class (list)) field primitive)) #.None @@ -644,7 +644,7 @@ [valueI (generate archive valueS) .let [$class (type.class class (list))]] (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (in (|>> valueI (_.PUTSTATIC $class field primitive) (_.string synthesis.unit))) @@ -664,7 +664,7 @@ [objectI (generate archive objectS) .let [$class (type.class class (list)) getI (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (_.GETFIELD $class field primitive) #.None @@ -683,7 +683,7 @@ objectI (generate archive objectS) .let [$class (type.class class (list)) putI (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (_.PUTFIELD $class field primitive) #.None @@ -709,10 +709,10 @@ (do phase.monad [valueI (generate archive valueS)] (case (type.primitive? valueT) - (#.Right valueT) + {#.Right valueT} (in [valueT valueI]) - (#.Left valueT) + {#.Left valueT} (in [valueT (|>> valueI (_.CHECKCAST valueT))])))) @@ -722,10 +722,10 @@ (def: (prepare_output outputT) (-> (Type Return) Inst) (case (type.void? outputT) - (#.Right outputT) + {#.Right outputT} ..voidI - (#.Left outputT) + {#.Left outputT} function.identity)) (def: invoke::static @@ -814,26 +814,26 @@ [0 _] body [1 _] body - [2 (#synthesis.Control (#synthesis.Branch (#synthesis.Let _ 2 hidden)))] + [2 {#synthesis.Control {#synthesis.Branch {#synthesis.Let _ 2 hidden}}}] hidden - [_ (#synthesis.Control (#synthesis.Branch (#synthesis.Case _ path)))] + [_ {#synthesis.Control {#synthesis.Branch {#synthesis.Case _ path}}}] (loop [path path] (case path (^or #synthesis.Pop - (#synthesis.Access _) - (#synthesis.Bind _) - (#synthesis.Bit_Fork _) - (#synthesis.I64_Fork _) - (#synthesis.F64_Fork _) - (#synthesis.Text_Fork _) - (#synthesis.Alt _)) + {#synthesis.Access _} + {#synthesis.Bind _} + {#synthesis.Bit_Fork _} + {#synthesis.I64_Fork _} + {#synthesis.F64_Fork _} + {#synthesis.Text_Fork _} + {#synthesis.Alt _}) body - (#synthesis.Seq _ next) + {#synthesis.Seq _ next} (recur next) - (#synthesis.Then hidden) + {#synthesis.Then hidden} hidden)) _ @@ -873,27 +873,27 @@ (synthesis.path/then (normalize bodyS)) (^template [<tag>] - [(^ (<tag> leftP rightP)) - (<tag> (recur leftP) (recur rightP))]) + [(^ {<tag> leftP rightP}) + {<tag> (recur leftP) (recur rightP)}]) ([#synthesis.Alt] [#synthesis.Seq]) (^template [<tag>] - [(^ (<tag> value)) + [(^ {<tag> value}) path]) ([#synthesis.Pop] [#synthesis.Bind] [#synthesis.Access]) - (#synthesis.Bit_Fork when then else) - (#synthesis.Bit_Fork when (recur then) (maybe\each recur else)) + {#synthesis.Bit_Fork when then else} + {#synthesis.Bit_Fork when (recur then) (maybe\each recur else)} (^template [<tag>] - [(<tag> [[test then] elses]) - (<tag> [[test (recur then)] + [{<tag> [[test then] elses]} + {<tag> [[test (recur then)] (list\each (function (_ [else_test else_then]) [else_test (recur else_then)]) - elses)])]) + elses)]}]) ([#synthesis.I64_Fork] [#synthesis.F64_Fork] [#synthesis.Text_Fork]) @@ -903,11 +903,11 @@ (-> (Dictionary Synthesis Variable) Synthesis Synthesis) (function (recur body) (case body - (^template [<tag>] - [(^ (<tag> value)) - body]) - ([#synthesis.Primitive] - [synthesis.constant]) + (^ {#synthesis.Primitive value}) + body + + (^ {synthesis.constant value}) + body (^ (synthesis.variant [lefts right? sub])) (synthesis.variant [lefts right? (recur sub)]) @@ -957,8 +957,8 @@ (^ (synthesis.function/apply [functionS inputsS+])) (synthesis.function/apply [(recur functionS) (list\each recur inputsS+)]) - (#synthesis.Extension [name inputsS+]) - (#synthesis.Extension [name (list\each recur inputsS+)])))) + {#synthesis.Extension [name inputsS+]} + {#synthesis.Extension [name (list\each recur inputsS+)]}))) (def: $Object (type.class "java.lang.Object" (list))) @@ -999,14 +999,14 @@ (def: (prepare_argument lux_register argumentT jvm_register) (-> Register (Type Value) Register [Register Inst]) (case (type.primitive? argumentT) - (#.Left argumentT) + {#.Left argumentT} [(n.+ 1 jvm_register) (if (n.= lux_register jvm_register) (|>>) (|>> (_.ALOAD jvm_register) (_.ASTORE lux_register)))] - (#.Right argumentT) + {#.Right argumentT} (template.let [(wrap_primitive <shift> <load> <type>) [[(n.+ <shift> jvm_register) (|>> (<load> jvm_register) @@ -1040,21 +1040,21 @@ (def: .public (returnI returnT) (-> (Type Return) Inst) (case (type.void? returnT) - (#.Right returnT) + {#.Right returnT} _.RETURN - (#.Left returnT) + {#.Left returnT} (case (type.primitive? returnT) - (#.Left returnT) + {#.Left returnT} (case (type.class? returnT) - (#.Some class_name) + {#.Some class_name} (|>> (_.CHECKCAST returnT) _.ARETURN) #.None _.ARETURN) - (#.Right returnT) + {#.Right returnT} (template.let [(unwrap_primitive <return> <type>) [(|>> (_.unwrap <type>) <return>)]] @@ -1102,7 +1102,7 @@ ... Give them names as "foreign" variables. list.enumeration (list\each (function (_ [id capture]) - [capture (#variable.Foreign id)])) + [capture {#variable.Foreign id}])) (dictionary.of_list synthesis.hash)) normalized_methods (list\each (function (_ [environment [ownerT name diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index 2a202fbcd..7630191e9 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -308,7 +308,7 @@ (do [! phase.monad] [@begin _.make_label [function_context bodyI] (case forced_context - (#.Some function_context) + {#.Some function_context} (do ! [without_context (generation.with_anchor [@begin 1] (generate archive bodyS))] @@ -331,7 +331,7 @@ #.None (generation.save! (product.right function_context) #.None directive) - (#.Some function_context) + {#.Some function_context} (in []))] (in instanceI))) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux index 9b0feeb78..3c76f44c0 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux @@ -53,10 +53,10 @@ (def: .public (variable archive variable) (-> Archive Variable (Operation Inst)) (case variable - (#variable.Local variable) + {#variable.Local variable} (operation@in (local variable)) - (#variable.Foreign variable) + {#variable.Foreign variable} (foreign archive variable))) (def: .public (constant archive name) diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index b2319af7e..e3244f410 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -144,73 +144,73 @@ unwrap_long (: (-> Synthesis Synthesis) (|>> (list ($.text jvm/type/box.long) ($.text "long")) - (#$.Extension "jvm object cast"))) + {#$.Extension "jvm object cast"})) long_to_int (: (-> Synthesis Synthesis) (|>> (list) - (#$.Extension "jvm conversion long-to-int"))) + {#$.Extension "jvm conversion long-to-int"})) literal_nat (: (-> Nat Synthesis) (|>> .i64 $.i64 unwrap_long long_to_int)) write! (: (-> Text Nat Synthesis Synthesis Synthesis) (function (_ element_class index value array) - ((#$.Extension "jvm array write object" - (list (jvm_type (jvm/type.array (jvm/type.class element_class (list)))) - (literal_nat index) - value - array))))) + ({#$.Extension "jvm array write object" + (list (jvm_type (jvm/type.array (jvm/type.class element_class (list)))) + (literal_nat index) + value + array)}))) object_array (: (-> Text Nat Synthesis) (function (_ class_name size) - (#$.Extension "jvm array new object" - (list (class_type class_name) - (literal_nat size))))) + {#$.Extension "jvm array new object" + (list (class_type class_name) + (literal_nat size))})) class_of (: (-> Synthesis Synthesis) (function (_ object) - (#$.Extension "jvm member invoke virtual" - (list& (class_type "java.lang.Object") - ($.text "getClass") - (class_type "java.lang.Class") - object - (list))))) + {#$.Extension "jvm member invoke virtual" + (list& (class_type "java.lang.Object") + ($.text "getClass") + (class_type "java.lang.Class") + object + (list))})) input (: (All (_ c) (-> (jvm/type.Type c) Synthesis Synthesis)) (function (_ value_type value) ($.tuple (list (jvm_type value_type) value)))) - example_object (#$.Extension "jvm member invoke constructor" - (list& (class_type "java.lang.Object") - (list))) + example_object {#$.Extension "jvm member invoke constructor" + (list& (class_type "java.lang.Object") + (list))} phase_arity 3 $phase ($.variable/local 1) $archive ($.variable/local 2) $input ($.variable/local 3) $state ($.variable/local 4) - apply_method (#$.Extension "jvm member invoke virtual" - (list& (class_type "java.lang.Class") - ($.text "getMethod") - (class_type "java.lang.reflect.Method") - (class_of $phase) - (list (input java/lang/String - ($.text runtime.apply_method)) - (input <java/lang/Class> - (|> (object_array "java.lang.Class" phase_arity) - (write! "java.lang.Class" 0 (class_of example_object)) - (write! "java.lang.Class" 1 (class_of example_object)) - (write! "java.lang.Class" 2 (class_of example_object)))))))] - (#$.Extension "jvm member invoke virtual" - (list& (class_type "java.lang.reflect.Method") - ($.text "invoke") - (class_type "java.lang.Object") - apply_method - (list (input java/lang/Object - $phase) - (input <java/lang/Object> - (|> (object_array "java.lang.Object" phase_arity) - (write! "java.lang.Object" 0 $archive) - (write! "java.lang.Object" 1 $input) - (write! "java.lang.Object" 2 $state)))))))) + apply_method {#$.Extension "jvm member invoke virtual" + (list& (class_type "java.lang.Class") + ($.text "getMethod") + (class_type "java.lang.reflect.Method") + (class_of $phase) + (list (input java/lang/String + ($.text runtime.apply_method)) + (input <java/lang/Class> + (|> (object_array "java.lang.Class" phase_arity) + (write! "java.lang.Class" 0 (class_of example_object)) + (write! "java.lang.Class" 1 (class_of example_object)) + (write! "java.lang.Class" 2 (class_of example_object))))))}] + {#$.Extension "jvm member invoke virtual" + (list& (class_type "java.lang.reflect.Method") + ($.text "invoke") + (class_type "java.lang.Object") + apply_method + (list (input java/lang/Object + $phase) + (input <java/lang/Object> + (|> (object_array "java.lang.Object" phase_arity) + (write! "java.lang.Object" 0 $archive) + (write! "java.lang.Object" 1 $input) + (write! "java.lang.Object" 2 $state)))))})) (def: (phase_wrapper archive) (-> Archive (generation.Operation _.Anchor _.Inst _.Definition phase.Wrapper)) (do phase.monad - [instanceG (function.function' (#.Some [0 (.nat -1)]) expression.translate archive [(list) 4 ..how_to_wrap_a_phase]) + [instanceG (function.function' {#.Some [0 (.nat -1)]} expression.translate archive [(list) 4 ..how_to_wrap_a_phase]) phase_wrapper (generation.evaluate! [0 (.nat -2)] instanceG)] (in (function (_ phase) (<| try.trusted diff --git a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux index ef12fcf25..81328faec 100644 --- a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux +++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux @@ -42,10 +42,10 @@ (_primitive.analyse (` ((~ (code.text procedure)) (~+ params))))))) (analysis.with-current-module "") (macro.result (initL.compiler [])) - (case> (#e.Success _) + (case> {#e.Success _} <success> - (#e.Error error) + {#e.Error error} <failure>)))] [success #1 #0] @@ -63,10 +63,10 @@ (_primitive.analyse syntax)))) (analysis.with-current-module "") (macro.result (initL.compiler [])) - (case> (#e.Success _) + (case> {#e.Success _} <success> - (#e.Error error) + {#e.Error error} <failure>)))] [success' #1 #0] @@ -281,14 +281,14 @@ size (|> r.nat (:: @ each cap)) idx (|> r.nat (:: @ each (n/% size))) level (|> r.nat (:: @ each cap)) - #let [unboxedT (#.Primitive unboxed (list)) - arrayT (#.Primitive "#Array" (list unboxedT)) + #let [unboxedT {#.Primitive unboxed (list)} + arrayT {#.Primitive "#Array" (list unboxedT)} arrayC (`' ("lux check" (+0 "#Array" (+1 (+0 (~ (code.text unboxed)) (+0)) (+0))) ("jvm array new" (~ (code.nat size))))) - boxedT (#.Primitive boxed (list)) + boxedT {#.Primitive boxed (list)} boxedTC (` (+0 (~ (code.text boxed)) (+0))) multi-arrayT (list/mix (function (_ _ innerT) - (|> innerT (list) (#.Primitive "#Array"))) + (|> innerT (list) {#.Primitive "#Array"})) boxedT (list.n/range +1 level))]] ($_ seq @@ -335,7 +335,7 @@ [!unboxed !boxed] (|> array-type (r.filter (function (_ [!unboxed !boxed]) (not (text/= boxed !boxed))))) - #let [boxedT (#.Primitive boxed (list)) + #let [boxedT {#.Primitive boxed (list)} boxedC (`' ("lux check" (+0 (~ (code.text boxed)) (+0)) ("jvm object null"))) !boxedC (`' ("lux check" (+0 (~ (code.text !boxed)) (+0)) @@ -354,12 +354,12 @@ (test "jvm object null" (success "jvm object null" (list) - (#.Primitive boxed (list)))) + {#.Primitive boxed (list)})) (test "jvm object null (no primitives)" (or (text/= "java.lang.Object" boxed) (failure "jvm object null" (list) - (#.Primitive unboxed (list))))) + {#.Primitive unboxed (list)}))) (test "jvm object null?" (success "jvm object null?" (list boxedC) @@ -381,7 +381,7 @@ (test "jvm object class" (success "jvm object class" (list (code.text boxed)) - (#.Primitive "java.lang.Class" (list boxedT)))) + {#.Primitive "java.lang.Class" (list boxedT)})) (test "jvm object instance?" (success "jvm object instance?" (list (code.text boxed) @@ -406,12 +406,12 @@ (success "jvm member static get" (list (code.text "java.lang.System") (code.text "out")) - (#.Primitive "java.io.PrintStream" (list)))) + {#.Primitive "java.io.PrintStream" (list)})) (test "jvm member static get (inheritance out)" (success "jvm member static get" (list (code.text "java.lang.System") (code.text "out")) - (#.Primitive "java.lang.Object" (list)))) + {#.Primitive "java.lang.Object" (list)})) (test "jvm member static put" (success "jvm member static put" (list (code.text "java.awt.datatransfer.DataFlavor") @@ -444,14 +444,14 @@ (code.text "id") (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) ("jvm object null")))) - (#.Primitive "java.lang.String" (list)))) + {#.Primitive "java.lang.String" (list)})) (test "jvm member virtual get (inheritance out)" (success "jvm member virtual get" (list (code.text "org.omg.CORBA.ValueMember") (code.text "id") (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) ("jvm object null")))) - (#.Primitive "java.lang.Object" (list)))) + {#.Primitive "java.lang.Object" (list)})) (test "jvm member virtual put" (success "jvm member virtual put" (list (code.text "org.omg.CORBA.ValueMember") @@ -488,14 +488,14 @@ (success "jvm member static get" (list (code.text "java.util.GregorianCalendar") (code.text "AD")) - (#.Primitive "java.lang.Integer" (list)))) + {#.Primitive "java.lang.Integer" (list)})) (test "jvm member virtual get" (success "jvm member virtual get" (list (code.text "javax.accessibility.AccessibleAttributeSequence") (code.text "startIndex") (`' ("lux check" (+0 "javax.accessibility.AccessibleAttributeSequence" (+0)) ("jvm object null")))) - (#.Primitive "java.lang.Integer" (list)))) + {#.Primitive "java.lang.Integer" (list)})) (test "jvm member virtual put" (success "jvm member virtual put" (list (code.text "javax.accessibility.AccessibleAttributeSequence") @@ -522,28 +522,28 @@ (success' (` ("jvm member invoke static" "java.lang.Long" "decode" ["java.lang.String" (~ stringC)])) - (#.Primitive "java.lang.Long" (list)))) + {#.Primitive "java.lang.Long" (list)})) (test "jvm member invoke virtual" (success' (` ("jvm object cast" ("jvm member invoke virtual" "java.lang.Object" "equals" ("jvm object cast" (~ longC)) ["java.lang.Object" ("jvm object cast" (~ longC))]))) - (#.Primitive "java.lang.Boolean" (list)))) + {#.Primitive "java.lang.Boolean" (list)})) (test "jvm member invoke special" (success' (` ("jvm object cast" ("jvm member invoke special" "java.lang.Long" "equals" ("jvm object cast" (~ longC)) ["java.lang.Object" ("jvm object cast" (~ longC))]))) - (#.Primitive "java.lang.Boolean" (list)))) + {#.Primitive "java.lang.Boolean" (list)})) (test "jvm member invoke interface" (success' (` ("jvm object cast" ("jvm member invoke interface" "java.util.Collection" "add" ("jvm object cast" (~ objectC)) ["java.lang.Object" ("jvm object cast" (~ longC))]))) - (#.Primitive "java.lang.Boolean" (list)))) + {#.Primitive "java.lang.Boolean" (list)})) (test "jvm member invoke constructor" (success' (` ("jvm member invoke constructor" "java.util.ArrayList" ["int" ("jvm object cast" (~ intC))])) - (All (_ a) (#.Primitive "java.util.ArrayList" (list a))))) + (All (_ a) {#.Primitive "java.util.ArrayList" (list a)}))) ))) diff --git a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux index ad2a67deb..b923a4e90 100644 --- a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux +++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux @@ -21,29 +21,29 @@ (-> ls.Arity ls.Synthesis Bit) (loop [exprS exprS] (case exprS - (^ [_ (#.Form (list [_ (#.Text "lux case")] inputS pathS))]) + (^ [_ {#.Form (list [_ {#.Text "lux case"}] inputS pathS)}]) (loop [pathS pathS] (case pathS - (^ [_ (#.Form (list [_ (#.Text "lux case alt")] leftS rightS))]) + (^ [_ {#.Form (list [_ {#.Text "lux case alt"}] leftS rightS)}]) (or (recur leftS) (recur rightS)) - (^ [_ (#.Form (list [_ (#.Text "lux case seq")] leftS rightS))]) + (^ [_ {#.Form (list [_ {#.Text "lux case seq"}] leftS rightS)}]) (recur rightS) - (^ [_ (#.Form (list [_ (#.Text "lux case exec")] bodyS))]) + (^ [_ {#.Form (list [_ {#.Text "lux case exec"}] bodyS)}]) (does-recursion? arity bodyS) _ #0)) - (^ [_ (#.Form (list& [_ (#.Text "lux recur")] argsS))]) + (^ [_ {#.Form (list& [_ {#.Text "lux recur"}] argsS)}]) (n/= arity (list.size argsS)) - (^ [_ (#.Form (list [_ (#.Text "lux let")] register inputS bodyS))]) + (^ [_ {#.Form (list [_ {#.Text "lux let"}] register inputS bodyS)}]) (recur bodyS) - (^ [_ (#.Form (list [_ (#.Text "lux if")] inputS thenS elseS))]) + (^ [_ {#.Form (list [_ {#.Text "lux if"}] inputS thenS elseS)}]) (or (recur thenS) (recur elseS)) @@ -132,7 +132,7 @@ (test "Can accurately identify (and then reify) tail recursion." (case (expressionS.synthesize extensionL.no-syntheses analysis) - (^ [_ (#.Form (list [_ (#.Text "lux function")] [_ (#.Nat _arity)] [_ (#.Tuple _env)] _body))]) + (^ [_ {#.Form (list [_ {#.Text "lux function"}] [_ {#.Nat _arity}] [_ {#.Tuple _env}] _body)}]) (|> _body (does-recursion? arity) (bit/= prediction) @@ -149,13 +149,13 @@ (test "Can reify loops." (case (expressionS.synthesize extensionL.no-syntheses (la.apply (list.repeat arity (' [])) analysis)) - (^ [_ (#.Form (list [_ (#.Text "lux loop")] [_ (#.Nat in_register)] [_ (#.Tuple _inits)] _body))]) + (^ [_ {#.Form (list [_ {#.Text "lux loop"}] [_ {#.Nat in_register}] [_ {#.Tuple _inits}] _body)}]) (and (n/= arity (list.size _inits)) (not (loopS.contains-self-reference? _body))) - (^ [_ (#.Form (list& [_ (#.Text "lux call")] - [_ (#.Form (list [_ (#.Text "lux function")] _arity _env _bodyS))] - argsS))]) + (^ [_ {#.Form (list& [_ {#.Text "lux call"}] + [_ {#.Form (list [_ {#.Text "lux function"}] _arity _env _bodyS)}] + argsS)}]) (loopS.contains-self-reference? _bodyS) _ diff --git a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux index 1262f2252..0d73b1038 100644 --- a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux +++ b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux @@ -24,7 +24,7 @@ (test "Can synthesize procedure calls." (|> (expressionS.synthesize extensionL.no-syntheses (la.procedure nameA argsA)) - (case> (^ [_ (#.Form (list& [_ (#.Text procedure)] argsS))]) + (case> (^ [_ {#.Form (list& [_ {#.Text procedure}] argsS)}]) (and (text/= nameA procedure) (list.every? (product.uncurried corresponds?) (list.zip2 argsA argsS))) diff --git a/lux-jvm/test/test/luxc/lang/translation/js.lux b/lux-jvm/test/test/luxc/lang/translation/js.lux index effad7726..69bcd7ecd 100644 --- a/lux-jvm/test/test/luxc/lang/translation/js.lux +++ b/lux-jvm/test/test/luxc/lang/translation/js.lux @@ -22,7 +22,7 @@ (def: (test-primitive-identity synthesis) (-> Synthesis Bit) (|> (run-js (` ("lux is" (~ synthesis) (~ synthesis)))) - (case> (#e.Success valueV) + (case> {#e.Success valueV} (:coerce Bit valueV) _ @@ -33,10 +33,10 @@ (template [<name> <type> <pre> <=>] [(def: (<name> angle) (-> <type> Check) - (|>> (case> (#e.Success valueV) + (|>> (case> {#e.Success valueV} (<=> (<pre> angle) (:coerce <type> valueV)) - (#e.Error error) + {#e.Error error} #0)))] [sin-check Frac math.sin f/=] @@ -73,7 +73,7 @@ ($_ seq (test "Cannot get non-existing fields from objects." (|> (run-js (` ("js object get" (~ field) (~ empty-object)))) - (case> (^multi (#e.Success valueV) + (case> (^multi {#e.Success valueV} [(:coerce (Maybe Int) valueV) #.None]) #1 @@ -81,8 +81,8 @@ #0))) (test "Can get fields from objects." (|> (run-js (` ("js object get" (~ field) (~ object)))) - (case> (^multi (#e.Success valueV) - [(:coerce (Maybe Int) valueV) (#.Some valueV)]) + (case> (^multi {#e.Success valueV} + [(:coerce (Maybe Int) valueV) {#.Some valueV}]) (i/= value (:coerce Int valueV)) _ @@ -90,7 +90,7 @@ (test "Can delete fields from objects." (|> (run-js (let [post-delete (` ("js object delete" (~ field) (~ object)))] (` ("js object get" (~ field) (~ post-delete))))) - (case> (^multi (#e.Success valueV) + (case> (^multi {#e.Success valueV} [(:coerce (Maybe Int) valueV) #.None]) #1 @@ -99,10 +99,10 @@ (test "Can instance new objects." (let [base (` ("js object new" ("js global" "Number") (~ (code.text (%f frac-value)))))] (|> (run-js (` ("lux frac +" (~ base) 0.0))) - (case> (#e.Success valueV) + (case> {#e.Success valueV} (f/= frac-value (:coerce Frac valueV)) - (#e.Error error) + {#e.Error error} #0)))) (test "Can call methods on objects." (|> (run-js (` ("js object call" ("js global" "Math") "sin" (~ (code.text (%f frac-value)))))) @@ -124,9 +124,9 @@ (length-check length))) (test "Can get an element from an array." (|> (run-js (` ("js array read" (~ (code.nat idx)) (~ arrayS)))) - (case> (^multi (#e.Success elemV) + (case> (^multi {#e.Success elemV} [[(list.nth idx elems) (:coerce (Maybe Nat) elemV)] - [(#.Some reference) (#.Some sample)]]) + [{#.Some reference} {#.Some sample}]]) (n/= reference sample) _ @@ -136,9 +136,9 @@ overwriteS (code.nat overwrite)] (|> (run-js (` ("js array read" (~ idxS) ("js array write" (~ idxS) (~ overwriteS) (~ arrayS))))) - (case> (^multi (#e.Success elemV) + (case> (^multi {#e.Success elemV} [(:coerce (Maybe Nat) elemV) - (#.Some sample)]) + {#.Some sample}]) (n/= overwrite sample) _ @@ -149,7 +149,7 @@ (and (|> (run-js (` ("js array length" (~ deleteS)))) (length-check length)) (|> (run-js (` ("js array read" (~ idxS) (~ deleteS)))) - (case> (^multi (#e.Success elemV) + (case> (^multi {#e.Success elemV} [(:coerce (Maybe Nat) elemV) #.None]) #1 diff --git a/lux-jvm/test/test/luxc/lang/translation/jvm.lux b/lux-jvm/test/test/luxc/lang/translation/jvm.lux index 95812e6ca..86c8253e4 100644 --- a/lux-jvm/test/test/luxc/lang/translation/jvm.lux +++ b/lux-jvm/test/test/luxc/lang/translation/jvm.lux @@ -36,10 +36,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (<test> <sample> (:coerce <cast> valueT)) - (#e.Error error) + {#e.Error error} #0)))] ["jvm convert double-to-float" "jvm convert float-to-double" code.frac frac-sample Frac f/=] @@ -68,10 +68,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (<test> <sample> (:coerce <cast> valueT)) - (#e.Error error) + {#e.Error error} #0)))] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-long" code.int int-sample Int i/=] @@ -95,10 +95,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (<test> <sample> (:coerce <cast> valueT)) - (#e.Error error) + {#e.Error error} #0)))] ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-byte" "jvm convert byte-to-long" code.int int-sample Int i/=] @@ -136,11 +136,11 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (<test> (<reference> param subject) (:coerce <type> valueT)) - (#e.Error error) + {#e.Error error} #0)))] [(format "jvm " <domain> " +") <+>] @@ -175,11 +175,11 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (n/= (<reference> param subject) (:coerce Nat valueT)) - (#e.Error error) + {#e.Error error} #0)))] [(format "jvm " <domain> " and") bit.and] @@ -209,11 +209,11 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (<test> (<reference> shift (<pre-subject> subject)) (:coerce <type> valueT)) - (#e.Error error) + {#e.Error error} #0)))] [(format "jvm " <domain> " shl") bit.left-shift Nat n/= id code.nat] @@ -241,11 +241,11 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success valueT) + (case> {#e.Success valueT} (bit/= (<reference> param subject) (:coerce Bit valueT)) - (#e.Error error) + {#e.Error error} #0)))] [(format "jvm " <domain> " =") <=>] @@ -297,10 +297,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputZ) + (case> {#e.Success outputZ} (<test> <value> (:coerce <type> outputZ)) - (#e.Error error) + {#e.Error error} #0)))] ["boolean" Bit valueZ bit/= (code.bit valueZ) @@ -345,10 +345,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (<test> <value> (:coerce <type> outputT)) - (#e.Error error) + {#e.Error error} #0)))] ["char" Int valueC i/= @@ -373,10 +373,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (f/= valueD (:coerce Frac outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm array length" (|> (do macro.Monad<Meta> @@ -384,10 +384,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (n/= size (:coerce Nat outputT)) - (#e.Error error) + {#e.Error error} #0))) ))))) @@ -435,10 +435,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (:coerce Bit outputT) - (#e.Error error) + {#e.Error error} #0))) (test "jvm object null?" (|> (do macro.Monad<Meta> @@ -446,10 +446,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (not (:coerce Bit outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm object synchronized" (|> (do macro.Monad<Meta> @@ -457,10 +457,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (i/= sample (:coerce Int outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm object throw" (|> (do macro.Monad<Meta> @@ -472,15 +472,15 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (case (:coerce (e.Error Any) outputT) - (#e.Error error) + {#e.Error error} (text.contains? exception-message error) - (#e.Success outputT) + {#e.Success outputT} #0) - (#e.Error error) + {#e.Error error} #0))) (test "jvm object class" (|> (do macro.Monad<Meta> @@ -488,10 +488,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (|> outputT (:coerce Class) (Class::getName []) (text/= class)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm object instance?" (|> (do macro.Monad<Meta> @@ -499,10 +499,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (:coerce Bit outputT) - (#e.Error error) + {#e.Error error} #0))) )))) @@ -531,10 +531,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (i/= GregorianCalendar::AD (:coerce Int outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm member static put" (|> (do macro.Monad<Meta> @@ -543,10 +543,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (same? hostL.unit (:coerce Text outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm member virtual get" (|> (do macro.Monad<Meta> @@ -554,10 +554,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (text/= sample-string (:coerce Text outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm member virtual put" (|> (do macro.Monad<Meta> @@ -567,10 +567,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (text/= other-sample-string (:coerce Text outputT)) - (#e.Error error) + {#e.Error error} #0))) )))) @@ -596,10 +596,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (i/= sample (:coerce Int outputT)) - (#e.Error error) + {#e.Error error} #0))) (test "jvm member invoke virtual" (|> (do macro.Monad<Meta> @@ -609,10 +609,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (:coerce Bit outputT) - (#e.Error error) + {#e.Error error} #0))) (test "jvm member invoke interface" (|> (do macro.Monad<Meta> @@ -622,10 +622,10 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (:coerce Bit outputT) - (#e.Error error) + {#e.Error error} #0))) (test "jvm member invoke constructor" (|> (do macro.Monad<Meta> @@ -633,9 +633,9 @@ (evalT.eval sampleI)) (lang.with-current-module "") (macro.result (io.run! init-jvm)) - (case> (#e.Success outputT) + (case> {#e.Success outputT} (host.instance? ArrayList (:coerce Object outputT)) - (#e.Error error) + {#e.Error error} #0))) )))) diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index 1ff6e2e57..04f566788 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -170,7 +170,7 @@ (let [re_wrap (: (-> java/lang/Object java/lang/Object) (function (_ unwrapped) (case (ffi.check [java/lang/Object] unwrapped) - (#.Some sub_value) + {#.Some sub_value} (|> sub_value (:as (Array java/lang/Object)) lux_structure (:as java/lang/Object)) #.None @@ -194,14 +194,14 @@ (net/sandius/rembulan/impl/DefaultTable [] (rawget self [field java/lang/Object]) java/lang/Object (case (ffi.check net/sandius/rembulan/ByteString field) - (#.Some field) + {#.Some field} (case (net/sandius/rembulan/ByteString::decode field) (^ (static runtime.variant_tag_field)) (|> value (array.read! 0) maybe.trusted) (^ (static runtime.variant_flag_field)) (case (array.read! 1 value) - (#.Some _) + {#.Some _} (:as java/lang/Object "") #.None @@ -215,7 +215,7 @@ #.None (case (ffi.check java/lang/Long field) - (#.Some idx) + {#.Some idx} (|> value (array.read! (|> idx (:as Nat) --)) maybe.trusted re_wrap) #.None @@ -230,14 +230,14 @@ (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)] + (^multi [{#.Some tag} ?flag {#.Some value}] [(read value) - (#try.Success value)]) - (#try.Success [(: Any (|> tag (:as java/lang/Long) java/lang/Long::intValue)) + {#try.Success value}]) + {#try.Success [(: Any (|> tag (:as java/lang/Long) java/lang/Long::intValue)) (: Any (case ?flag - (#.Some _) (: Any "") + {#.Some _} (: Any "") #.None (:as Any (ffi.null)))) - (: Any value)]) + (: Any value)]} _ (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) @@ -254,14 +254,14 @@ #.None (recur num_keys (++ idx) output) - (#.Some member) + {#.Some member} (case (read member) - (#try.Success parsed_member) + {#try.Success parsed_member} (recur num_keys (++ idx) (array.write! idx (:as java/lang/Object parsed_member) output)) - (#try.Failure error) - (#try.Failure error))) - (#try.Success output))))) + {#try.Failure error} + {#try.Failure error})) + {#try.Success output})))) (exception: .public nil_has_no_lux_representation) @@ -271,7 +271,7 @@ (exception.except ..nil_has_no_lux_representation [])) (~~ (template [<class> <post_processing>] [(case (ffi.check <class> host_object) - (#.Some typed_object) + {#.Some typed_object} (|> typed_object <post_processing>) _)] @@ -285,12 +285,12 @@ [program/StructureValue (<| #try.Success program/StructureValue::getValue)] )) (case (ffi.check net/sandius/rembulan/impl/DefaultTable host_object) - (#.Some typed_object) + {#.Some typed_object} (case (read_variant read typed_object) - (#try.Success value) - (#try.Success value) + {#try.Success value} + {#try.Success value} - (#try.Failure error) + {#try.Failure error} (read_tuple read typed_object)) _) @@ -327,15 +327,15 @@ (def: (expander baggage macro inputs lux) (-> Baggage Expander) (case (..ensure_function macro) - (#.Some macro) + {#.Some macro} (case (..call_macro baggage inputs lux macro) - (#try.Success output) + {#try.Success output} (|> output (:as (Try [Lux (List Code)])) #try.Success) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..cannot_apply_a_non_function (:as java/lang/Object macro)))))] @@ -345,7 +345,7 @@ @.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") @@ -555,7 +555,7 @@ #.None (in []) - (#.Some value) + {#.Some value} (read value))))) _ (try.trusted (run! ..rembulan_prelude))] [[state_context executor] @@ -596,9 +596,9 @@ (do try.monad [lua_function (..load (_.code code))] (let [output ("lua apply" lua_function)] - (#try.Success (if ("lua object nil?" output) + {#try.Success (if ("lua object nil?" output) [] - output))))))] + output)}))))] (: (Host _.Expression _.Statement) (implementation (def: (evaluate! context code) diff --git a/lux-php/source/program.lux b/lux-php/source/program.lux index c2c61b1ef..9421b6f9c 100644 --- a/lux-php/source/program.lux +++ b/lux-php/source/program.lux @@ -185,34 +185,34 @@ (<| (if (ffi.null? value) (php/runtime/memory/NullMemory::INSTANCE)) (case (ffi.check java/lang/Boolean value) - (#.Some value) + {#.Some value} (if (:as Bit value) (php/runtime/memory/TrueMemory::INSTANCE) (php/runtime/memory/FalseMemory::INSTANCE)) #.None) (case (ffi.check java/lang/Long value) - (#.Some value) + {#.Some value} (php/runtime/memory/LongMemory::new value) #.None) (case (ffi.check java/lang/Double value) - (#.Some value) + {#.Some value} (php/runtime/memory/DoubleMemory::new value) #.None) (case (ffi.check java/lang/String value) - (#.Some value) + {#.Some value} (php/runtime/memory/StringMemory::new value) #.None) (case (ffi.check [java/lang/Object] value) - (#.Some value) + {#.Some value} (lux_structure (:as (Array java/lang/Object) value)) #.None) (case (ffi.check php/runtime/memory/ObjectMemory value) - (#.Some value) + {#.Some value} value #.None) @@ -243,7 +243,7 @@ php/runtime/Memory (`` (<| (~~ (template [<class> <method> <extractor>] [(case (ffi.check <class> index) - (#.Some index) + {#.Some index} (<method> trace (<extractor> index) self) #.None)] @@ -286,7 +286,7 @@ #.None (php/runtime/memory/NullMemory::INSTANCE) - (#.Some value) + {#.Some value} ..unit) (^ (static runtime.variant_value_field)) @@ -317,17 +317,17 @@ (:as php/runtime/memory/ReferenceMemory) php/runtime/memory/ReferenceMemory::getValue)] (case (ffi.check php/runtime/memory/NullMemory value) - (#.Some _) + {#.Some _} (recur (++ idx) output) #.None (case (read value) - (#try.Success lux_value) + {#try.Success lux_value} (recur (++ idx) (array.write! idx lux_value output)) error error))) - (#try.Success output))))) + {#try.Success output})))) (def: variant_tag_field (php/runtime/memory/StringMemory::new runtime.variant_tag_field)) @@ -348,8 +348,8 @@ (php/runtime/memory/ArrayMemory::get ..variant_value_field) maybe.trusted read)] - [(#try.Success tag) (#try.Success value)] - (#try.Success [(java/lang/Long::intValue (:as java/lang/Long tag)) + [{#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) @@ -357,12 +357,12 @@ (:as php/runtime/memory/ReferenceMemory) php/runtime/memory/ReferenceMemory::getValue (ffi.check php/runtime/memory/NullMemory)) - (#.Some _) + {#.Some _} (ffi.null) #.None synthesis.unit)) - value]) + value]} _ (exception.throw ..unknown_kind_of_object host_object))) @@ -376,8 +376,8 @@ Reader (`` (<| (~~ (template [<class> <constant>] [(case (ffi.check <class> host_object) - (#.Some _) - (#try.Success <constant>) + {#.Some _} + {#try.Success <constant>} #.None)] @@ -386,7 +386,7 @@ )) (~~ (template [<class> <post>] [(case (ffi.check <class> host_object) - (#.Some value) + {#.Some value} (`` (|> value (~~ (template.splice <post>)))) #.None)] @@ -399,10 +399,10 @@ [php/runtime/memory/ObjectMemory [#try.Success]] )) (case (ffi.check php/runtime/memory/ArrayMemory host_object) - (#.Some value) + {#.Some value} (if (|> value (php/runtime/memory/ArrayMemory::get ..tuple_size_field) - (case> (#.Some _) false #.None true)) + (case> {#.Some _} false #.None true)) (read_variant read value) (read_tuple read value)) @@ -457,7 +457,7 @@ (def: (expander macro inputs lux) Expander (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (call_macro inputs lux macro) #.None diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index afb244311..4aa41e066 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -128,17 +128,17 @@ (array.empty size))] (if (n.< size idx) (case (org/python/core/PyObject::__getitem__ (.int idx) host_object) - (#try.Failure try) - (#try.Failure try) + {#try.Failure try} + {#try.Failure try} - (#try.Success value) + {#try.Success value} (case (read value) - (#try.Failure try) - (#try.Failure try) + {#try.Failure try} + {#try.Failure try} - (#try.Success lux_value) + {#try.Success lux_value} (recur (++ idx) (array.write! idx lux_value output)))) - (#try.Success output))))) + {#try.Success output})))) (exception: (unknown_kind_of_object [object java/lang/Object]) (exception.report @@ -149,26 +149,26 @@ (case [(org/python/core/PyObject::__getitem__ +0 host_object) (org/python/core/PyObject::__getitem__ +1 host_object) (org/python/core/PyObject::__getitem__ +2 host_object)] - (^or [(#try.Failure try) _ _] - [_ (#try.Failure try) _] - [_ _ (#try.Failure try)]) - (#try.Failure try) + (^or [{#try.Failure try} _ _] + [_ {#try.Failure try} _] + [_ _ {#try.Failure try}]) + {#try.Failure try} - (^multi [(#try.Success tag) (#try.Success flag) (#try.Success value)] + (^multi [{#try.Success tag} {#try.Success flag} {#try.Success value}] [(read tag) - (#try.Success tag)] + {#try.Success tag}] [(read value) - (#try.Success value)]) - (#try.Success [tag + {#try.Success value}]) + {#try.Success [tag (: Any (case (ffi.check org/python/core/PyNone (:as java/lang/Object flag)) - (#.Some _) + {#.Some _} (:as Any (ffi.null)) #.None (:as Any synthesis.unit))) - value]) + value]} _ (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) @@ -177,8 +177,8 @@ Translator (`` (<| (~~ (template [<class> <processing>] [(case (ffi.check <class> (:as <class> host_object)) - (#.Some host_object) - (#try.Success (`` (|> host_object (~~ (template.spliced <processing>))))) + {#.Some host_object} + {#try.Success (`` (|> host_object (~~ (template.spliced <processing>))))} _)] @@ -198,7 +198,7 @@ )) (~~ (template [<class> <processing>] [(case (ffi.check <class> host_object) - (#.Some host_object) + {#.Some host_object} (<| <processing> (:as org/python/core/PyObject) host_object) _)] @@ -207,7 +207,7 @@ [org/python/core/PyList (..read_tuple read)] )) ... (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]) - (#try.Success host_object)))) + {#try.Success host_object}))) (exception: (cannot_apply_a_non_function [object java/lang/Object]) (exception.report @@ -249,16 +249,16 @@ (def: (expander macro inputs lux) Expander (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (case (..call_macro inputs lux macro) - (#try.Success output) + {#try.Success output} (|> output (:as org/python/core/PyObject) ..read (:as (Try (Try [Lux (List Code)])))) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..cannot_apply_a_non_function (:as java/lang/Object macro)))))] @@ -268,7 +268,7 @@ @.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))) @@ -281,10 +281,10 @@ execute! (: (-> (_.Statement Any) (Try Any)) (function (execute! input) (case (org/python/util/PythonInterpreter::exec (_.code input) interpreter) - (#try.Failure error) + {#try.Failure error} (if (text.contains? "maximum recursion depth exceeded" error) (execute! input) - (#try.Failure error)) + {#try.Failure error}) output output)))] diff --git a/lux-r/source/luxc/lang/synthesis/variable.lux b/lux-r/source/luxc/lang/synthesis/variable.lux deleted file mode 100644 index 82478a2d6..000000000 --- a/lux-r/source/luxc/lang/synthesis/variable.lux +++ /dev/null @@ -1,101 +0,0 @@ -(.module: - lux - (lux (data [number] - (coll [list "list/" Mix<List> Monoid<List>] - ["s" set]))) - (luxc (lang ["la" analysis] - ["ls" synthesis] - ["[0]L" variable {"+" [Variable]}]))) - -(def: (bound-vars path) - (-> ls.Path (List Variable)) - (case path - (#ls.BindP register) - (list (.int register)) - - (^or (#ls.SeqP pre post) (#ls.AltP pre post)) - (list/composite (bound-vars pre) (bound-vars post)) - - _ - (list))) - -(def: (path-bodies path) - (-> ls.Path (List ls.Synthesis)) - (case path - (#ls.ExecP body) - (list body) - - (#ls.SeqP pre post) - (path-bodies post) - - (#ls.AltP pre post) - (list/composite (path-bodies pre) (path-bodies post)) - - _ - (list))) - -(def: (non-arg? arity var) - (-> ls.Arity Variable Bit) - (and (variableL.local? var) - (n/> arity (.nat var)))) - -(type: Tracker - (s.Set Variable)) - -(def: init-tracker - Tracker - (s.new number.Hash<Int>)) - -(def: (unused-vars current-arity bound exprS) - (-> ls.Arity (List Variable) ls.Synthesis (List Variable)) - (let [tracker (loop [exprS exprS - tracker (list/mix s.has init-tracker bound)] - (case exprS - (#ls.Variable var) - (if (non-arg? current-arity var) - (s.lacks var tracker) - tracker) - - (#ls.Variant tag last? memberS) - (recur memberS tracker) - - (#ls.Tuple membersS) - (list/mix recur tracker membersS) - - (#ls.Call funcS argsS) - (list/mix recur (recur funcS tracker) argsS) - - (^or (#ls.Recur argsS) - (#ls.Procedure name argsS)) - (list/mix recur tracker argsS) - - (#ls.Let offset inputS outputS) - (|> tracker (recur inputS) (recur outputS)) - - (#ls.If testS thenS elseS) - (|> tracker (recur testS) (recur thenS) (recur elseS)) - - (#ls.Loop offset initsS bodyS) - (recur bodyS (list/mix recur tracker initsS)) - - (#ls.Case inputS outputPS) - (let [tracker' (list/mix s.has - (recur inputS tracker) - (bound-vars outputPS))] - (list/mix recur tracker' (path-bodies outputPS))) - - (#ls.Function arity env bodyS) - (list/mix s.lacks tracker env) - - _ - tracker - ))] - (s.to-list tracker))) - -... (def: (optimize-register-use current-arity [pathS bodyS]) -... (-> ls.Arity [ls.Path ls.Synthesis] [ls.Path ls.Synthesis]) -... (let [bound (bound-vars pathS) -... unused (unused-vars current-arity bound bodyS) -... adjusted (adjust-vars unused bound)] -... [(|> pathS (clean-pattern adjusted) simplify-pattern) -... (clean-expression adjusted bodyS)])) diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux index ec77f8c0d..990fb6dbc 100644 --- a/lux-r/source/program.lux +++ b/lux-r/source/program.lux @@ -188,7 +188,7 @@ ... (let [sub_value (:as java/lang/Object sub_value)] ... (`` (<| (~~ (template [<type> <then>] ... [(case (ffi.check <type> sub_value) - ... (#.Some sub_value) + ... {#.Some sub_value} ... (`` (|> sub_value (~~ (template.splice <then>)))) ... #.None)] @@ -362,7 +362,7 @@ (case (|> host_object (org/renjin/sexp/ListVector::get_field runtime.variant_flag_field) (ffi.check org/renjin/sexp/Null)) - (#.Some _) + {#.Some _} (: Any (ffi.null)) _ @@ -377,12 +377,12 @@ (|> host_object (org/renjin/sexp/ListVector::get_field runtime.i64_low_field) (ffi.check org/renjin/sexp/IntArrayVector))] - [(#.Some high) (#.Some low)] - (#try.Success (runtime.lux_i64 (org/renjin/sexp/SEXP::asInt high) - (org/renjin/sexp/SEXP::asInt low))) + [{#.Some high} {#.Some low}] + {#try.Success (runtime.lux_i64 (org/renjin/sexp/SEXP::asInt high) + (org/renjin/sexp/SEXP::asInt low))} _ - (#try.Failure ""))) + {#try.Failure ""})) (def: (read_tuple read host_object) (-> (Reader java/lang/Object) (Reader org/renjin/sexp/ListVector)) @@ -391,12 +391,12 @@ 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) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success member) + {#try.Success member} (recur (++ idx) (array.write! idx (:as Any member) output))) - (#try.Success output))))) + {#try.Success output})))) (def: (field_class field host_object) (-> Text org/renjin/sexp/ListVector Text) @@ -411,23 +411,23 @@ (exec ... ("lux io log" (exception.construct ..unknown_kind_of_object [host_object])) (`` (<| (case (ffi.check org/renjin/sexp/ListVector host_object) - (#.Some host_object) + {#.Some host_object} (<| (case (..read_variant read host_object) - (#try.Success output) - (#try.Success output) + {#try.Success output} + {#try.Success output} - (#try.Failure _)) + {#try.Failure _}) (case (..read_i64 host_object) - (#try.Success output) - (#try.Success output) + {#try.Success output} + {#try.Success output} - (#try.Failure _)) + {#try.Failure _}) (..read_tuple read host_object)) #.None) (~~ (template [<class> <post_processing>] [(case (ffi.check <class> host_object) - (#.Some host_object) + {#.Some host_object} (`` (|> host_object (~~ (template.splice <post_processing>)))) #.None)] @@ -458,10 +458,10 @@ (org/renjin/sexp/PairList$Builder::add (..host_value lux)) org/renjin/sexp/PairList$Builder::build (:as org/renjin/sexp/PairList))) - (#try.Success r_inputs) + {#try.Success r_inputs} r_inputs - (#try.Failure error) + {#try.Failure error} (exec ("lux io log" error) (panic! error)))) @@ -481,7 +481,7 @@ (def: (expander interpreter macro inputs lux) (-> org/renjin/script/RenjinScriptEngine Expander) (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (call_macro interpreter inputs lux macro) #.None @@ -569,7 +569,7 @@ (:as Try) (exec ("lux io log" "TODO: Extender") - (#try.Failure "TODO: Extender")))) + {#try.Failure "TODO: Extender"}))) @.r (def: (extender handler) diff --git a/lux-ruby/source/program.lux b/lux-ruby/source/program.lux index 25e3cc2ab..37713dfdb 100644 --- a/lux-ruby/source/program.lux +++ b/lux-ruby/source/program.lux @@ -242,14 +242,14 @@ #.None (recur (++ idx) output) - (#.Some value) + {#.Some value} (case (read value) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success lux_value) + {#try.Success lux_value} (recur (++ idx) (array.write! idx lux_value output)))) - (#try.Success output))))) + {#try.Success output})))) (exception: (unknown_kind_of_object [object java/lang/Object]) (exception.report @@ -261,18 +261,18 @@ (case [(org/jruby/RubyHash::get (:as java/lang/String runtime.variant_tag_field) host_object) (org/jruby/RubyHash::get (:as java/lang/String runtime.variant_flag_field) host_object) (org/jruby/RubyHash::get (:as java/lang/String runtime.variant_value_field) host_object)] - (^multi [(#.Some tag) ?flag (#.Some value)] + (^multi [{#.Some tag} ?flag {#.Some value}] [(read value) - (#try.Success value)]) - (#try.Success [(:as Any (java/lang/Long::intValue (:as java/lang/Long tag))) + {#try.Success value}]) + {#try.Success [(:as Any (java/lang/Long::intValue (:as java/lang/Long tag))) (:as Any (case ?flag - (#.Some _) + {#.Some _} "" #.None (ffi.null))) - (:as Any value)]) + (:as Any value)]} _ (exception.except ..unknown_kind_of_object [(:as java/lang/Object host_object)]))) @@ -285,7 +285,7 @@ (exception.except ..nil_has_no_lux_representation [])) (~~ (template [<class> <post_processing>] [(case (ffi.check <class> host_object) - (#.Some typed_object) + {#.Some typed_object} (`` (|> typed_object (~~ (template.spliced <post_processing>)))) _)] @@ -316,27 +316,27 @@ (-> (-> (Array java/lang/Object) org/jruby/runtime/builtin/IRubyObject) (-> java/lang/Object org/jruby/runtime/builtin/IRubyObject)) (<| (case (ffi.check [java/lang/Object] value) - (#.Some value) + {#.Some value} (|> value (:as (Array java/lang/Object)) lux_structure) #.None) (case (ffi.check java/lang/Boolean value) - (#.Some value) + {#.Some value} (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime value) #.None) (case (ffi.check java/lang/Long value) - (#.Some value) + {#.Some value} (org/jruby/RubyFixnum::new ..initial_ruby_runtime value) #.None) (case (ffi.check java/lang/Double value) - (#.Some value) + {#.Some value} (org/jruby/RubyFloat::new ..initial_ruby_runtime value) #.None) (case (ffi.check java/lang/String value) - (#.Some value) + {#.Some value} (org/jruby/RubyString::newInternalFromJavaExternal ..initial_ruby_runtime value) #.None) @@ -378,9 +378,9 @@ org/jruby/runtime/builtin/IRubyObject (let [member (ffi.read! 0 args)] (<| (case (ffi.check org/jruby/RubyFixnum member) - (#.Some member) + {#.Some member} (case (array.read! (org/jruby/RubyFixnum::getLongValue member) value) - (#.Some value) + {#.Some value} (wrapped_lux_value lux_structure value) #.None @@ -388,7 +388,7 @@ #.None) (case (ffi.check org/jruby/RubyString member) - (#.Some member) + {#.Some member} (case (:as Text (org/jruby/RubyString::asJavaString member)) (^ (static runtime.variant_tag_field)) (|> value @@ -403,12 +403,12 @@ #.None ..ruby_nil - (#.Some flag) + {#.Some flag} ..lux_unit) (^ (static runtime.variant_value_field)) (case (array.read! 2 value) - (#.Some value) + {#.Some value} (wrapped_lux_value lux_structure value) #.None @@ -419,10 +419,10 @@ #.None) (case (ffi.check org/jruby/RubyRange member) - (#.Some member) + {#.Some member} (case [(|> member (org/jruby/RubyRange::first thread_context) (ffi.check org/jruby/RubyFixnum)) (|> member (org/jruby/RubyRange::size thread_context) (ffi.check org/jruby/RubyFixnum))] - [(#.Some first) (#.Some size)] + [{#.Some first} {#.Some size}] (let [first (org/jruby/RubyFixnum::getLongValue first) size (org/jruby/RubyFixnum::getLongValue size)] (lux_structure (java/util/Arrays::copyOfRange value first (i.+ first size)))) @@ -448,10 +448,10 @@ org/jruby/runtime/builtin/IRubyObject (let [reference (ffi.read! 0 args)] (case (..read (:as java/lang/Object reference)) - (#try.Success reference) + {#try.Success reference} (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime (same? (: Any reference) (: Any value))) - (#try.Failure error) + {#try.Failure error} (org/jruby/RubyBoolean::newBoolean ..initial_ruby_runtime false)))))) (def: (lux_wrapper_length value) @@ -508,7 +508,7 @@ (case (|> args (ffi.read! 0) (ffi.check org/jruby/RubySymbol)) - (#.Some method) + {#.Some method} (|> (case (|> method org/jruby/RubySymbol::asJavaString (:as Text)) @@ -585,16 +585,16 @@ (def: (expander macro inputs lux) Expander (case (ensure_macro macro) - (#.Some macro) + {#.Some macro} (case (call_macro inputs lux macro) - (#try.Success output) + {#try.Success output} (|> output (:as java/lang/Object) ..read (:as (Try (Try [Lux (List Code)])))) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..cannot_apply_a_non_function [(:as java/lang/Object macro)]))) @@ -692,7 +692,7 @@ (let [inputs (array.list #.None inputs)]) (case inputs (^ (list)) - (#try.Success (host_phase partial_application phase)) + {#try.Success (host_phase partial_application phase)} (^ (list input/0)) (do try.monad diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux index ee5b95952..1eac52eeb 100644 --- a/lux-scheme/source/program.lux +++ b/lux-scheme/source/program.lux @@ -134,14 +134,14 @@ (def: (variant? value) (-> Any Bit) (case (ffi.check [java/lang/Object] (:as java/lang/Object value)) - (#.Some array) + {#.Some array} ... TODO: Get rid of this coercion ASAP. (let [array (:as (Array java/lang/Object) array)] (and (n.= 3 (array.size array)) (case (array.read! 0 array) - (#.Some tag) + {#.Some tag} (case (ffi.check java/lang/Integer tag) - (#.Some _) + {#.Some _} true #.None @@ -177,7 +177,7 @@ [] (getCar self []) java/lang/Object (if cdr? (case (array.read! 1 value) - (#.Some flag_is_set) + {#.Some flag_is_set} true #.None @@ -243,7 +243,7 @@ (def: (lux_value value) (-> java/lang/Object java/lang/Object) (<| (case (ffi.check [java/lang/Object] value) - (#.Some value) + {#.Some value} ... TODO: Get rid of the coercions below. (if (variant? value) (variant_value lux_value false (:as (Array java/lang/Object) value)) @@ -269,7 +269,7 @@ [tag (read (gnu/lists/Pair::getCar 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) + {#.Some flag} (:as Bit flag) #.None @@ -285,19 +285,19 @@ (array.new size))] (if (n.< size idx) (case (read (gnu/lists/FVector::getRaw (.int idx) host_object)) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success lux_value) + {#try.Success lux_value} (recur (++ idx) (array.write! idx (: Any lux_value) output))) - (#try.Success output))))) + {#try.Success output})))) (def: (read host_object) (Reader java/lang/Object) (`` (<| (~~ (template [<class>] [(case (ffi.check <class> host_object) - (#.Some host_object) - (#try.Success host_object) + {#.Some host_object} + {#try.Success host_object} #.None)] [java/lang/Boolean] [java/lang/Long] [java/lang/Double] [java/lang/String] @@ -305,8 +305,8 @@ )) (~~ (template [<class> <processing>] [(case (ffi.check <class> host_object) - (#.Some host_object) - (#try.Success (<| <processing> host_object)) + {#.Some host_object} + {#try.Success (<| <processing> host_object)} #.None)] [java/lang/Integer java/lang/Integer::longValue] @@ -321,11 +321,11 @@ [program/TupleValue program/TupleValue::getValue] )) (case (ffi.check gnu/lists/Pair host_object) - (#.Some host_object) + {#.Some host_object} (read_variant read host_object) #.None) (case (ffi.check gnu/lists/FVector host_object) - (#.Some host_object) + {#.Some host_object} (read_tuple read (:as (gnu/lists/FVector java/lang/Object) host_object)) #.None) ... else @@ -338,17 +338,17 @@ (def: (expander macro inputs lux) Expander (case (..ensure_macro macro) - (#.Some macro) + {#.Some macro} (case (gnu/mapping/Procedure::apply2 (lux_value (:as java/lang/Object inputs)) (lux_value (:as java/lang/Object lux)) macro) - (#try.Success output) + {#try.Success output} (|> output ..read (:as (Try (Try [Lux (List Code)])))) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.throw ..cannot_apply_a_non_function (:as java/lang/Object macro))) diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index e81beecb2..0f6e94998 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -329,17 +329,17 @@ (type: Type (Rec @ (Variant - (#Primitive Text (List @)) - (#Sum @ @) - (#Product @ @) - (#Function @ @) - (#Parameter Nat) - (#Var Nat) - (#Ex Nat) - (#UnivQ (List @) @) - (#ExQ (List @) @) - (#Apply @ @) - (#Named Name @))))]) + {#Primitive Text (List @)} + {#Sum @ @} + {#Product @ @} + {#Function @ @} + {#Parameter Nat} + {#Var Nat} + {#Ex Nat} + {#UnivQ (List @) @} + {#ExQ (List @) @} + {#Apply @ @} + {#Named Name @})))]) (documentation: /.exec "Sequential execution of expressions (great for side-effects)." @@ -354,8 +354,8 @@ \n "Allows the usage of macros within the patterns to provide custom syntax.") [(case (: (List Int) (list +1 +2 +3)) - (#Item x (#Item y (#Item z #End))) - (#Some ($_ * x y z)) + {#Item x {#Item y {#Item z #End}}} + {#Some ($_ * x y z)} _ #None)]) @@ -366,7 +366,7 @@ [(case (: (List Int) (list +1 +2 +3)) (^ (list x y z)) - (#Some ($_ * x y z)) + {#Some ($_ * x y z)} _ #None)]) @@ -435,7 +435,7 @@ [(macro: .public (name_of tokens) (case tokens (^template [<tag>] - [(^ (list [_ (<tag> [module name])])) + [(^ (list [_ {<tag> [module name]}])) (in (list (` [(~ (text$ module)) (~ (text$ name))])))]) ([#Identifier] [#Tag]) @@ -489,8 +489,8 @@ [(type: Referrals (Variant #All - (#Only (List Text)) - (#Exclude (List Text)) + {#Only (List Text)} + {#Exclude (List Text)} #Ignore #Nothing))]) @@ -506,7 +506,7 @@ "The type-definition macro." [(type: (List a) #End - (#Item a (List a)))]) + {#Item a (List a)})]) (documentation: /.Interface "Interface definition." @@ -540,13 +540,13 @@ (loop [end to output #.End] (cond (< end from) - (recur (pred end) (#.Item end output)) + (recur (pred end) {#.Item end output}) (< from end) - (recur (succ end) (#.Item end output)) + (recur (succ end) {#.Item end output}) ... (= end from) - (#.Item end output)))))]) + {#.Item end output}))))]) (documentation: /.cond "Conditional branching with multiple test conditions." @@ -640,30 +640,30 @@ [(def: (reduced env type) (-> (List Type) Type Type) (case type - (#.Primitive name params) - (#.Primitive name (list\each (reduced env) params)) + {#.Primitive name params} + {#.Primitive name (list\each (reduced env) params)} (^template [<tag>] - [(<tag> left right) - (<tag> (reduced env left) (reduced env right))]) + [{<tag> left right} + {<tag> (reduced env left) (reduced env right)}]) ([#.Sum] [#.Product]) (^template [<tag>] - [(<tag> left right) - (<tag> (reduced env left) (reduced env right))]) + [{<tag> left right} + {<tag> (reduced env left) (reduced env right)}]) ([#.Function] [#.Apply]) (^template [<tag>] - [(<tag> old_env def) + [{<tag> old_env def} (case old_env #.End - (<tag> env def) + {<tag> env def} _ type)]) ([#.UnivQ] [#.ExQ]) - (#.Parameter idx) + {#.Parameter idx} (else type (list.item idx env)) _ @@ -751,21 +751,21 @@ (format "Multi-level pattern matching." \n "Useful in situations where the result of a branch depends on further refinements on the values being matched.") [(case (split (size static) uri) - (^multi (#Some [chunk uri']) + (^multi {#Some [chunk uri']} [(text\= static chunk) #1]) (match_uri endpoint? parts' uri') _ - (#Left (format "Static part " (%t static) " does not match URI: " uri)))] + {#Left (format "Static part " (%t static) " does not match URI: " uri)})] ["Short-cuts can be taken when using bit tests." "The example above can be rewritten as..." (case (split (size static) uri) - (^multi (#Some [chunk uri']) + (^multi {#Some [chunk uri']} (text\= static chunk)) (match_uri endpoint? parts' uri') _ - (#Left (format "Static part " (%t static) " does not match URI: " uri)))]) + {#Left (format "Static part " (%t static) " does not match URI: " uri)})]) (documentation: /.name_of "Given an identifier or a tag, gives back a 2 tuple with the module and name parts, both as Text." @@ -875,8 +875,8 @@ "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) + (^code (#0 (~ [_ {#.Nat number}]) +456.789)) + {#.Some number} _ #.None))]) @@ -898,11 +898,11 @@ (case (: (Either Text Bar) (try (: Bar (risky computation which may panic)))) - (#.Right success) + {#.Right success} (: Foo (do something after success)) - (#.Left error) + {#.Left error} (: Foo (recover from error))))]) diff --git a/stdlib/source/documentation/lux/control/concurrency/actor.lux b/stdlib/source/documentation/lux/control/concurrency/actor.lux index c0701a367..a26d2f2d6 100644 --- a/stdlib/source/documentation/lux/control/concurrency/actor.lux +++ b/stdlib/source/documentation/lux/control/concurrency/actor.lux @@ -58,8 +58,8 @@ (message: .public (push [value a] state self) (List a) - (let [state' (#.Item value state)] - (async.resolved (#try.Success [state' state']))))]) + (let [state' {#.Item value state}] + (async.resolved {#try.Success [state' state']})))]) (actor: .public counter Nat @@ -67,11 +67,11 @@ [(message: .public (count! [increment Nat] state self) Any (let [state' (n.+ increment state)] - (async.resolved (#try.Success [state' state'])))) + (async.resolved {#try.Success [state' state']}))) (message: .public (read! state self) Nat - (async.resolved (#try.Success [state state])))]))] + (async.resolved {#try.Success [state state]}))]))] (documentation: /.actor: (format "Defines a named actor, with its behavior and internal state." \n "Messages for the actor must be defined after the on_mail handler.") diff --git a/stdlib/source/documentation/lux/control/maybe.lux b/stdlib/source/documentation/lux/control/maybe.lux index f57f2f54d..582c1fa4a 100644 --- a/stdlib/source/documentation/lux/control/maybe.lux +++ b/stdlib/source/documentation/lux/control/maybe.lux @@ -18,7 +18,7 @@ (format "Allows you to provide a default value that will be used" \n "if a (Maybe x) value turns out to be #.None." \n "Note: the expression for the default value will not be computed if the base computation succeeds.") - [(else +20 (#.Some +10)) + [(else +20 {#.Some +10}) "=>" +10] [(else +20 #.None) diff --git a/stdlib/source/documentation/lux/control/try.lux b/stdlib/source/documentation/lux/control/try.lux index 6ef45a5b2..8176614d0 100644 --- a/stdlib/source/documentation/lux/control/try.lux +++ b/stdlib/source/documentation/lux/control/try.lux @@ -40,9 +40,9 @@ \n "if a (Try x) value turns out to be #Failure." \n "Note: the expression for the default value will not be computed if the base computation succeeds.") [(= "bar" - (else "foo" (#..Success "bar")))] + (else "foo" {#..Success "bar"}))] [(= "foo" - (else "foo" (#..Failure "KABOOM!")))]) + (else "foo" {#..Failure "KABOOM!"}))]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index ed6bce3a5..b8926391a 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -87,7 +87,7 @@ (format "Yields a list with every non-empty item in the array." \n "Can use the optional default value when encountering an empty cell in the array.") [(list #.None array) - (list (#.Some default) array)]) + (list {#.Some default} array)]) (.def: .public documentation (.List $.Module) diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index f76ada558..d8e818783 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -144,7 +144,7 @@ [(= (??? (: java/lang/String (null))) #.None)] [(= (??? "YOLO") - (#.Some "YOLO"))]) + {#.Some "YOLO"})]) (documentation: /.!!! (format "Takes a (Maybe ObjectType) and returns a ObjectType." @@ -158,7 +158,7 @@ (format "Checks whether an object is an instance of a particular class." \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.") [(case (check String "YOLO") - (#.Some value_as_string) + {#.Some value_as_string} #.None)]) (documentation: /.synchronized diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index b2ac15139..64fbfcf45 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -107,7 +107,7 @@ [(= (??? (: java/lang/String (null))) #.None)] [(= (??? "YOLO") - (#.Some "YOLO"))]) + {#.Some "YOLO"})]) (documentation: /.!!! "Takes a (Maybe ObjectType) and returns a ObjectType." @@ -121,7 +121,7 @@ (format "Checks whether an object is an instance of a particular class." \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.") [(case (check java/lang/String "YOLO") - (#.Some value_as_string) + {#.Some value_as_string} #.None)]) (documentation: /.synchronized diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 5f6f9342e..7d94363f3 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -18,153 +18,177 @@ ... (Ex (_ a) a)) ("lux def" Any ("lux type check type" - (9 #1 [..prelude_module "Any"] - (8 #0 (0 #0) (4 #0 1)))) + {9 #1 + [..prelude_module "Any"] + {8 #0 + {0 #0} + {4 #0 1}}}) #1) ... (type: .public Nothing ... (All (_ a) a)) ("lux def" Nothing ("lux type check type" - (9 #1 [..prelude_module "Nothing"] - (7 #0 (0 #0) (4 #0 1)))) + {9 #1 + [..prelude_module "Nothing"] + {7 #0 + {0 #0} + {4 #0 1}}}) #1) ... (type: .public (List a) ... #End -... (#Item a (List a))) +... {#Item a (List a)}) ("lux def type tagged" List - (9 #1 [..prelude_module "List"] - (7 #0 (0 #0) - (1 #0 - ... End - Any - ... Item - (2 #0 (4 #0 1) - (9 #0 (4 #0 1) (4 #0 0)))))) - ("End" "Item") + {9 #1 + [..prelude_module "List"] + {7 #0 + {0 #0} + {1 #0 + ... End + Any + ... Item + {2 #0 + {4 #0 1} + {9 #0 + {4 #0 1} + {4 #0 0}}}}}} + {"End" "Item"} #1) ("lux def" Bit ("lux type check type" - (9 #1 [..prelude_module "Bit"] - (0 #0 "#Bit" #End))) + {9 #1 + [..prelude_module "Bit"] + {0 #0 "#Bit" #End}}) #1) ("lux def" I64 ("lux type check type" - (9 #1 [..prelude_module "I64"] - (7 #0 (0 #0) - (0 #0 "#I64" (#Item (4 #0 1) #End))))) + {9 #1 + [..prelude_module "I64"] + {7 #0 + {0 #0} + {0 #0 "#I64" {#Item {4 #0 1} #End}}}}) #1) ("lux def" Nat ("lux type check type" - (9 #1 [..prelude_module "Nat"] - (0 #0 "#I64" (#Item (0 #0 "#Nat" #End) #End)))) + {9 #1 + [..prelude_module "Nat"] + {0 #0 "#I64" {#Item {0 #0 "#Nat" #End} #End}}}) #1) ("lux def" Int ("lux type check type" - (9 #1 [..prelude_module "Int"] - (0 #0 "#I64" (#Item (0 #0 "#Int" #End) #End)))) + {9 #1 + [..prelude_module "Int"] + {0 #0 "#I64" {#Item {0 #0 "#Int" #End} #End}}}) #1) ("lux def" Rev ("lux type check type" - (9 #1 [..prelude_module "Rev"] - (0 #0 "#I64" (#Item (0 #0 "#Rev" #End) #End)))) + {9 #1 + [..prelude_module "Rev"] + {0 #0 "#I64" {#Item {0 #0 "#Rev" #End} #End}}}) #1) ("lux def" Frac ("lux type check type" - (9 #1 [..prelude_module "Frac"] - (0 #0 "#Frac" #End))) + {9 #1 + [..prelude_module "Frac"] + {0 #0 "#Frac" #End}}) #1) ("lux def" Text ("lux type check type" - (9 #1 [..prelude_module "Text"] - (0 #0 "#Text" #End))) + {9 #1 + [..prelude_module "Text"] + {0 #0 "#Text" #End}}) #1) ("lux def" Name ("lux type check type" - (9 #1 [..prelude_module "Name"] - (2 #0 Text Text))) + {9 #1 + [..prelude_module "Name"] + {2 #0 Text Text}}) #1) ... (type: .public (Maybe a) ... #None -... (#Some a)) +... {#Some a}) ("lux def type tagged" Maybe - (9 #1 [..prelude_module "Maybe"] - (7 #0 #End - (1 #0 - ... None - Any - ... Some - (4 #0 1)))) - ("None" "Some") + {9 #1 + [..prelude_module "Maybe"] + {7 #0 + #End + {1 #0 + ... None + Any + ... Some + {4 #0 1}}}} + {"None" "Some"} #1) ... (type: .public Type ... (Rec Type ... (Variant -... (#Primitive Text (List Type)) -... (#Sum Type Type) -... (#Product Type Type) -... (#Function Type Type) -... (#Parameter Nat) -... (#Var Nat) -... (#Ex Nat) -... (#UnivQ (List Type) Type) -... (#ExQ (List Type) Type) -... (#Apply Type Type) -... (#Named Name Type)))) +... {#Primitive Text (List Type)} +... {#Sum Type Type} +... {#Product Type Type} +... {#Function Type Type} +... {#Parameter Nat} +... {#Var Nat} +... {#Ex Nat} +... {#UnivQ (List Type) Type} +... {#ExQ (List Type) Type} +... {#Apply Type Type} +... {#Named Name Type}))) ("lux def type tagged" Type - (9 #1 [..prelude_module "Type"] - ({Type - ({Type_List - ({Type_Pair - (9 #0 (0 #0 ["" #End]) - (7 #0 #End - (1 #0 - ... Primitive - (2 #0 Text Type_List) - (1 #0 - ... Sum - Type_Pair - (1 #0 - ... Product - Type_Pair - (1 #0 - ... Function - Type_Pair - (1 #0 - ... Parameter - Nat - (1 #0 - ... Var - Nat - (1 #0 - ... Ex - Nat - (1 #0 - ... UnivQ - (2 #0 Type_List Type) - (1 #0 - ... ExQ - (2 #0 Type_List Type) - (1 #0 - ... Apply - Type_Pair - ... Named - (2 #0 Name Type)))))))))))))} - ("lux type check type" (2 #0 Type Type)))} - ("lux type check type" (9 #0 Type List)))} - ("lux type check type" (9 #0 (0 #0 ["" #End]) (4 #0 0))))) - ("Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named") + {9 #1 [..prelude_module "Type"] + ({Type + ({Type_List + ({Type_Pair + {9 #0 + {0 #0 ["" #End]} + {7 #0 + #End + {1 #0 + ... Primitive + {2 #0 Text Type_List} + {1 #0 + ... Sum + Type_Pair + {1 #0 + ... Product + Type_Pair + {1 #0 + ... Function + Type_Pair + {1 #0 + ... Parameter + Nat + {1 #0 + ... Var + Nat + {1 #0 + ... Ex + Nat + {1 #0 + ... UnivQ + {2 #0 Type_List Type} + {1 #0 + ... ExQ + {2 #0 Type_List Type} + {1 #0 + ... Apply + Type_Pair + ... Named + {2 #0 Name Type}}}}}}}}}}}}}} + ("lux type check type" {2 #0 Type Type}))} + ("lux type check type" {9 #0 Type List}))} + ("lux type check type" {9 #0 {0 #0 ["" #End]} {4 #0 0}}))} + {"Primitive" "Sum" "Product" "Function" "Parameter" "Var" "Ex" "UnivQ" "ExQ" "Apply" "Named"} #1) ... (type: .public Location @@ -173,8 +197,8 @@ ... #line Nat ... #column Nat])) ("lux def type tagged" Location - (#Named [..prelude_module "Location"] - (#Product Text (#Product Nat Nat))) + {#Named [..prelude_module "Location"] + {#Product Text {#Product Nat Nat}}} ["module" "line" "column"] #1) @@ -183,80 +207,81 @@ ... [#meta m ... #datum v])) ("lux def type tagged" Ann - (#Named [..prelude_module "Ann"] - (#UnivQ #End - (#UnivQ #End - (#Product (#Parameter 3) - (#Parameter 1))))) + {#Named [..prelude_module "Ann"] + {#UnivQ #End + {#UnivQ #End + {#Product + {#Parameter 3} + {#Parameter 1}}}}} ["meta" "datum"] #1) ... (type: .public (Code' w) -... (#Bit Bit) -... (#Nat Nat) -... (#Int Int) -... (#Rev Rev) -... (#Frac Frac) -... (#Text Text) -... (#Identifier Name) -... (#Tag Name) -... (#Form (List (w (Code' w)))) -... (#Variant (List (w (Code' w)))) -... (#Tuple (List (w (Code' w))))) +... {#Bit Bit} +... {#Nat Nat} +... {#Int Int} +... {#Rev Rev} +... {#Frac Frac} +... {#Text Text} +... {#Identifier Name} +... {#Tag Name} +... {#Form (List (w (Code' w)))} +... {#Variant (List (w (Code' w)))} +... {#Tuple (List (w (Code' w)))}) ("lux def type tagged" Code' - (#Named [..prelude_module "Code'"] - ({Code - ({Code_List - (#UnivQ #End - (#Sum - ... Bit - Bit - (#Sum - ... Nat - Nat - (#Sum - ... Int - Int - (#Sum - ... Rev - Rev - (#Sum - ... Frac - Frac - (#Sum - ... Text - Text - (#Sum - ... Identifier - Name - (#Sum - ... Tag - Name - (#Sum - ... Form - Code_List - (#Sum - ... Variant - Code_List - ... Tuple - Code_List - )))))))))) - )} - ("lux type check type" (#Apply Code List)))} - ("lux type check type" (#Apply (#Apply (#Parameter 1) - (#Parameter 0)) - (#Parameter 1))))) - ("Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Variant" "Tuple") + {#Named [..prelude_module "Code'"] + ({Code + ({Code_List + {#UnivQ #End + {#Sum + ... Bit + Bit + {#Sum + ... Nat + Nat + {#Sum + ... Int + Int + {#Sum + ... Rev + Rev + {#Sum + ... Frac + Frac + {#Sum + ... Text + Text + {#Sum + ... Identifier + Name + {#Sum + ... Tag + Name + {#Sum + ... Form + Code_List + {#Sum + ... Variant + Code_List + ... Tuple + Code_List + }}}}}}}}}} + }} + ("lux type check type" {#Apply Code List}))} + ("lux type check type" {#Apply {#Apply {#Parameter 1} + {#Parameter 0}} + {#Parameter 1}}))} + {"Bit" "Nat" "Int" "Rev" "Frac" "Text" "Identifier" "Tag" "Form" "Variant" "Tuple"} #1) ... (type: .public Code ... (Ann Location (Code' (Ann Location)))) ("lux def" Code ("lux type check type" - (#Named [..prelude_module "Code"] - ({w - (#Apply (#Apply w Code') w)} - ("lux type check type" (#Apply Location Ann))))) + {#Named [..prelude_module "Code"] + ({w + {#Apply {#Apply w Code'} w}} + ("lux type check type" {#Apply Location Ann}))}) #1) ("lux def" private @@ -277,119 +302,118 @@ ("lux def" _ann ("lux type check" - (#Function (#Apply (#Apply Location Ann) - Code') - Code) + {#Function {#Apply {#Apply Location Ann} Code'} + Code} ([_ data] [dummy_location data])) #0) ("lux def" bit$ - ("lux type check" (#Function Bit Code) - ([_ value] (_ann (#Bit value)))) + ("lux type check" {#Function Bit Code} + ([_ value] (_ann {#Bit value}))) #0) ("lux def" nat$ - ("lux type check" (#Function Nat Code) - ([_ value] (_ann (#Nat value)))) + ("lux type check" {#Function Nat Code} + ([_ value] (_ann {#Nat value}))) #0) ("lux def" int$ - ("lux type check" (#Function Int Code) - ([_ value] (_ann (#Int value)))) + ("lux type check" {#Function Int Code} + ([_ value] (_ann {#Int value}))) #0) ("lux def" rev$ - ("lux type check" (#Function Rev Code) - ([_ value] (_ann (#Rev value)))) + ("lux type check" {#Function Rev Code} + ([_ value] (_ann {#Rev value}))) #0) ("lux def" frac$ - ("lux type check" (#Function Frac Code) - ([_ value] (_ann (#Frac value)))) + ("lux type check" {#Function Frac Code} + ([_ value] (_ann {#Frac value}))) #0) ("lux def" text$ - ("lux type check" (#Function Text Code) - ([_ text] (_ann (#Text text)))) + ("lux type check" {#Function Text Code} + ([_ text] (_ann {#Text text}))) #0) ("lux def" identifier$ - ("lux type check" (#Function Name Code) - ([_ name] (_ann (#Identifier name)))) + ("lux type check" {#Function Name Code} + ([_ name] (_ann {#Identifier name}))) #0) ("lux def" local_identifier$ - ("lux type check" (#Function Text Code) - ([_ name] (_ann (#Identifier ["" name])))) + ("lux type check" {#Function Text Code} + ([_ name] (_ann {#Identifier ["" name]}))) #0) ("lux def" tag$ - ("lux type check" (#Function Name Code) - ([_ name] (_ann (#Tag name)))) + ("lux type check" {#Function Name Code} + ([_ name] (_ann {#Tag name}))) #0) ("lux def" local_tag$ - ("lux type check" (#Function Text Code) - ([_ name] (_ann (#Tag ["" name])))) + ("lux type check" {#Function Text Code} + ([_ name] (_ann {#Tag ["" name]}))) #0) ("lux def" form$ - ("lux type check" (#Function (#Apply Code List) Code) - ([_ tokens] (_ann (#Form tokens)))) + ("lux type check" {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Form tokens}))) #0) ("lux def" variant$ - ("lux type check" (#Function (#Apply Code List) Code) - ([_ tokens] (_ann (#Variant tokens)))) + ("lux type check" {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Variant tokens}))) #0) ("lux def" tuple$ - ("lux type check" (#Function (#Apply Code List) Code) - ([_ tokens] (_ann (#Tuple tokens)))) + ("lux type check" {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Tuple tokens}))) #0) ... (type: .public Definition ... [Bit Type Any]) ("lux def" Definition ("lux type check type" - (#Named [..prelude_module "Definition"] - (#Product Bit (#Product Type Any)))) + {#Named [..prelude_module "Definition"] + {#Product Bit {#Product Type Any}}}) .public) ... (type: .public Alias ... Name) ("lux def" Alias ("lux type check type" - (#Named [..prelude_module "Alias"] - Name)) + {#Named [..prelude_module "Alias"] + Name}) .public) ... (type: .public Label ... [Bit Type (List Text) Nat]) ("lux def" Label ("lux type check type" - (#Named [..prelude_module "Label"] - (#Product Bit (#Product Type (#Product (#Apply Text List) Nat))))) + {#Named [..prelude_module "Label"] + {#Product Bit {#Product Type {#Product {#Apply Text List} Nat}}}}) .public) ... (type: .public Global ... (Variant -... (#Definition Definition) -... (#Type [Bit Type (Either [Text (List Text)] [Text (List Text)])]) -... (#Tag Label) -... (#Slot Label) -... (#Alias Alias))) +... {#Definition Definition} +... {#Type [Bit Type (Either [Text (List Text)] [Text (List Text)])]} +... {#Tag Label} +... {#Slot Label} +... {#Alias Alias})) ("lux def type tagged" Global - (#Named [..prelude_module "Global"] - (#Sum Definition - (#Sum ({labels - (#Product Bit (#Product Type (#Sum labels labels)))} - (#Product Text (#Apply Text List))) - (#Sum Label - (#Sum Label - Alias))))) - ("Definition" "Type" "Label" "Slot" "Alias") + {#Named [..prelude_module "Global"] + {#Sum Definition + {#Sum ({labels + {#Product Bit {#Product Type {#Sum labels labels}}}} + {#Product Text {#Apply Text List}}) + {#Sum Label + {#Sum Label + Alias}}}}} + {"Definition" "Type" "Label" "Slot" "Alias"} .public) ... (type: .public (Bindings k v) @@ -397,29 +421,29 @@ ... [#counter Nat ... #mappings (List [k v])])) ("lux def type tagged" Bindings - (#Named [..prelude_module "Bindings"] - (#UnivQ #End - (#UnivQ #End - (#Product - ... counter - Nat - ... mappings - (#Apply (#Product (#Parameter 3) - (#Parameter 1)) - List))))) + {#Named [..prelude_module "Bindings"] + {#UnivQ #End + {#UnivQ #End + {#Product + ... counter + Nat + ... mappings + {#Apply {#Product {#Parameter 3} + {#Parameter 1}} + List}}}}} ["counter" "mappings"] .public) ... (type: .public Ref -... (#Local Nat) -... (#Captured Nat)) +... {#Local Nat} +... {#Captured Nat}) ("lux def type tagged" Ref - (#Named [..prelude_module "Ref"] - (#Sum ... Local - Nat - ... Captured - Nat)) - ("Local" "Captured") + {#Named [..prelude_module "Ref"] + {#Sum ... Local + Nat + ... Captured + Nat}} + {"Local" "Captured"} .public) ... (type: .public Scope @@ -429,44 +453,44 @@ ... #locals (Bindings Text [Type Nat]) ... #captured (Bindings Text [Type Ref])])) ("lux def type tagged" Scope - (#Named [..prelude_module "Scope"] - (#Product ... name - (#Apply Text List) - (#Product ... inner - Nat - (#Product ... locals - (#Apply (#Product Type Nat) (#Apply Text Bindings)) - ... captured - (#Apply (#Product Type Ref) (#Apply Text Bindings)))))) + {#Named [..prelude_module "Scope"] + {#Product ... name + {#Apply Text List} + {#Product ... inner + Nat + {#Product ... locals + {#Apply {#Product Type Nat} {#Apply Text Bindings}} + ... captured + {#Apply {#Product Type Ref} {#Apply Text Bindings}}}}}} ["name" "inner" "locals" "captured"] .public) ("lux def" Code_List ("lux type check type" - (#Apply Code List)) + {#Apply Code List}) #0) ... (type: .public (Either l r) -... (#Left l) -... (#Right r)) +... {#Left l} +... {#Right r}) ("lux def type tagged" Either - (#Named [..prelude_module "Either"] - (#UnivQ #End - (#UnivQ #End - (#Sum - ... Left - (#Parameter 3) - ... Right - (#Parameter 1))))) - ("Left" "Right") + {#Named [..prelude_module "Either"] + {#UnivQ #End + {#UnivQ #End + {#Sum + ... Left + {#Parameter 3} + ... Right + {#Parameter 1}}}}} + {"Left" "Right"} .public) ... (type: .public Source ... [Location Nat Text]) ("lux def" Source ("lux type check type" - (#Named [..prelude_module "Source"] - (#Product Location (#Product Nat Text)))) + {#Named [..prelude_module "Source"] + {#Product Location {#Product Nat Text}}}) .public) ... (type: .public Module_State @@ -474,16 +498,16 @@ ... #Compiled ... #Cached) ("lux def type tagged" Module_State - (#Named [..prelude_module "Module_State"] - (#Sum - ... #Active - Any - (#Sum - ... #Compiled - Any - ... #Cached - Any))) - ("Active" "Compiled" "Cached") + {#Named [..prelude_module "Module_State"] + {#Sum + ... #Active + Any + {#Sum + ... #Compiled + Any + ... #Cached + Any}}} + {"Active" "Compiled" "Cached"} .public) ... (type: .public Module @@ -494,22 +518,22 @@ ... #imports (List Text) ... #module_state Module_State])) ("lux def type tagged" Module - (#Named [..prelude_module "Module"] - (#Product - ... module_hash - Nat - (#Product - ... module_aliases - (#Apply (#Product Text Text) List) - (#Product - ... definitions - (#Apply (#Product Text Global) List) - (#Product - ... imports - (#Apply Text List) - ... module_state - Module_State - ))))) + {#Named [..prelude_module "Module"] + {#Product + ... module_hash + Nat + {#Product + ... module_aliases + {#Apply {#Product Text Text} List} + {#Product + ... definitions + {#Apply {#Product Text Global} List} + {#Product + ... imports + {#Apply Text List} + ... module_state + Module_State + }}}}} ["module_hash" "module_aliases" "definitions" "imports" "module_state"] .public) @@ -519,14 +543,14 @@ ... #var_counter Nat ... #var_bindings (List [Nat (Maybe Type)])])) ("lux def type tagged" Type_Context - (#Named [..prelude_module "Type_Context"] - (#Product ... ex_counter - Nat - (#Product ... var_counter - Nat - ... var_bindings - (#Apply (#Product Nat (#Apply Type Maybe)) - List)))) + {#Named [..prelude_module "Type_Context"] + {#Product ... ex_counter + Nat + {#Product ... var_counter + Nat + ... var_bindings + {#Apply {#Product Nat {#Apply Type Maybe}} + List}}}} ["ex_counter" "var_counter" "var_bindings"] .public) @@ -535,14 +559,14 @@ ... #Eval ... #Interpreter) ("lux def type tagged" Mode - (#Named [..prelude_module "Mode"] - (#Sum ... Build - Any - (#Sum ... Eval - Any - ... Interpreter - Any))) - ("Build" "Eval" "Interpreter") + {#Named [..prelude_module "Mode"] + {#Sum ... Build + Any + {#Sum ... Eval + Any + ... Interpreter + Any}}} + {"Build" "Eval" "Interpreter"} .public) ... (type: .public Info @@ -551,15 +575,15 @@ ... #version Text ... #mode Mode])) ("lux def type tagged" Info - (#Named [..prelude_module "Info"] - (#Product - ... target - Text - (#Product - ... version - Text - ... mode - Mode))) + {#Named [..prelude_module "Info"] + {#Product + ... target + Text + {#Product + ... version + Text + ... mode + Mode}}} ["target" "version" "mode"] .public) @@ -579,52 +603,52 @@ ... #eval (-> Type Code (-> Lux (Either Text [Lux Any]))) ... #host Any])) ("lux def type tagged" Lux - (#Named [..prelude_module "Lux"] - ({Lux - (#Apply (0 #0 ["" #End]) - (#UnivQ #End - (#Product - ... info - Info - (#Product - ... source - Source - (#Product - ... location - Location - (#Product - ... current_module - (#Apply Text Maybe) - (#Product - ... modules - (#Apply (#Product Text Module) List) - (#Product - ... scopes - (#Apply Scope List) - (#Product - ... type_context - Type_Context - (#Product - ... expected - (#Apply Type Maybe) - (#Product - ... seed - Nat - (#Product - ... scope_type_vars - (#Apply Nat List) - (#Product - ... extensions - Any - (#Product - ... eval - (#Function Type - (#Function Code - (#Function Lux - (#Sum Text (#Product Lux Any))))) - ... host - Any))))))))))))))} - (#Apply (0 #0 ["" #End]) (#Parameter 0)))) + {#Named [..prelude_module "Lux"] + ({Lux + {#Apply {0 #0 ["" #End]} + {#UnivQ #End + {#Product + ... info + Info + {#Product + ... source + Source + {#Product + ... location + Location + {#Product + ... current_module + {#Apply Text Maybe} + {#Product + ... modules + {#Apply {#Product Text Module} List} + {#Product + ... scopes + {#Apply Scope List} + {#Product + ... type_context + Type_Context + {#Product + ... expected + {#Apply Type Maybe} + {#Product + ... seed + Nat + {#Product + ... scope_type_vars + {#Apply Nat List} + {#Product + ... extensions + Any + {#Product + ... eval + {#Function Type + {#Function Code + {#Function Lux + {#Sum Text {#Product Lux Any}}}}} + ... host + Any}}}}}}}}}}}}}}} + {#Apply {0 #0 ["" #End]} {#Parameter 0}})} ["info" "source" "location" "current_module" "modules" "scopes" "type_context" "expected" "seed" "scope_type_vars" "extensions" "eval" "host"] .public) @@ -632,63 +656,63 @@ ... (-> Lux (Either Text [Lux a]))) ("lux def" Meta ("lux type check type" - (#Named [..prelude_module "Meta"] - (#UnivQ #End - (#Function Lux - (#Apply (#Product Lux (#Parameter 1)) - (#Apply Text Either)))))) + {#Named [..prelude_module "Meta"] + {#UnivQ #End + {#Function Lux + {#Apply {#Product Lux {#Parameter 1}} + {#Apply Text Either}}}}}) .public) ... (type: .public Macro' ... (-> (List Code) (Meta (List Code)))) ("lux def" Macro' ("lux type check type" - (#Named [..prelude_module "Macro'"] - (#Function Code_List (#Apply Code_List Meta)))) + {#Named [..prelude_module "Macro'"] + {#Function Code_List {#Apply Code_List Meta}}}) .public) ... (type: .public Macro ... (primitive "#Macro")) ("lux def" Macro ("lux type check type" - (#Named [..prelude_module "Macro"] - (#Primitive "#Macro" #End))) + {#Named [..prelude_module "Macro"] + {#Primitive "#Macro" #End}}) .public) ... Base functions & macros ("lux def" in_meta ("lux type check" - (#UnivQ #End - (#Function (#Parameter 1) - (#Function Lux - (#Apply (#Product Lux - (#Parameter 1)) - (#Apply Text Either))))) + {#UnivQ #End + {#Function {#Parameter 1} + {#Function Lux + {#Apply {#Product Lux + {#Parameter 1}} + {#Apply Text Either}}}}} ([_ val] ([_ state] - (#Right state val)))) + {#Right state val}))) #0) ("lux def" failure ("lux type check" - (#UnivQ #End - (#Function Text - (#Function Lux - (#Apply (#Product Lux - (#Parameter 1)) - (#Apply Text Either))))) + {#UnivQ #End + {#Function Text + {#Function Lux + {#Apply {#Product Lux + {#Parameter 1}} + {#Apply Text Either}}}}} ([_ msg] ([_ state] - (#Left msg)))) + {#Left msg}))) #0) ("lux def" let'' ("lux macro" ([_ tokens] - ({(#Item lhs (#Item rhs (#Item body #End))) - (in_meta (#Item (form$ (#Item (variant$ (#Item lhs (#Item body #End))) - (#Item rhs #End))) - #End)) + ({{#Item lhs {#Item rhs {#Item body #End}}} + (in_meta {#Item (form$ {#Item (variant$ {#Item lhs {#Item body #End}}) + {#Item rhs #End}}) + #End}) _ (failure "Wrong syntax for let''")} @@ -698,33 +722,33 @@ ("lux def" function'' ("lux macro" ([_ tokens] - ({(#Item [_ (#Tuple (#Item arg args'))] (#Item body #End)) - (in_meta (#Item (_ann (#Form (#Item (_ann (#Tuple (#Item (_ann (#Identifier ["" ""])) - (#Item arg #End)))) - (#Item ({#End - body - - _ - (_ann (#Form (#Item (_ann (#Identifier [..prelude_module "function''"])) - (#Item (_ann (#Tuple args')) - (#Item body #End)))))} - args') - #End)))) - #End)) - - (#Item [_ (#Identifier ["" self])] (#Item [_ (#Tuple (#Item arg args'))] (#Item body #End))) - (in_meta (#Item (_ann (#Form (#Item (_ann (#Tuple (#Item (_ann (#Identifier ["" self])) - (#Item arg #End)))) - (#Item ({#End - body - - _ - (_ann (#Form (#Item (_ann (#Identifier [..prelude_module "function''"])) - (#Item (_ann (#Tuple args')) - (#Item body #End)))))} - args') - #End)))) - #End)) + ({{#Item [_ {#Tuple {#Item arg args'}}] {#Item body #End}} + (in_meta {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Identifier ["" ""]}) + {#Item arg #End}}}) + {#Item ({#End + body + + _ + (_ann {#Form {#Item (_ann {#Identifier [..prelude_module "function''"]}) + {#Item (_ann {#Tuple args'}) + {#Item body #End}}}})} + args') + #End}}}) + #End}) + + {#Item [_ {#Identifier ["" self]}] {#Item [_ {#Tuple {#Item arg args'}}] {#Item body #End}}} + (in_meta {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Identifier ["" self]}) + {#Item arg #End}}}) + {#Item ({#End + body + + _ + (_ann {#Form {#Item (_ann {#Identifier [..prelude_module "function''"]}) + {#Item (_ann {#Tuple args'}) + {#Item body #End}}}})} + args') + #End}}}) + #End}) _ (failure "Wrong syntax for function''")} @@ -733,70 +757,70 @@ ("lux def" location_code ("lux type check" Code - (tuple$ (#Item (text$ "") (#Item (nat$ 0) (#Item (nat$ 0) #End))))) + (tuple$ {#Item (text$ "") {#Item (nat$ 0) {#Item (nat$ 0) #End}}})) #0) ("lux def" meta_code - ("lux type check" (#Function Name (#Function Code Code)) + ("lux type check" {#Function Name {#Function Code Code}} ([_ tag] ([_ value] - (tuple$ (#Item location_code - (#Item (form$ (#Item (tag$ tag) (#Item value #End))) - #End)))))) + (tuple$ {#Item location_code + {#Item (form$ {#Item (tag$ tag) {#Item value #End}}) + #End}})))) #0) ("lux def" flag_meta - ("lux type check" (#Function Text Code) + ("lux type check" {#Function Text Code} ([_ tag] - (tuple$ (#Item [(meta_code [..prelude_module "Tag"] (tuple$ (#Item (text$ ..prelude_module) (#Item (text$ tag) #End)))) - (#Item [(meta_code [..prelude_module "Bit"] (bit$ #1)) - #End])])))) + (tuple$ {#Item [(meta_code [..prelude_module "Tag"] (tuple$ {#Item (text$ ..prelude_module) {#Item (text$ tag) #End}})) + {#Item [(meta_code [..prelude_module "Bit"] (bit$ #1)) + #End]}]}))) #0) ("lux def" as_def - ("lux type check" (#Function Code (#Function Code (#Function Code Code))) + ("lux type check" {#Function Code {#Function Code {#Function Code Code}}} (function'' [name value export_policy] - (form$ (#Item (text$ "lux def") (#Item name (#Item value (#Item export_policy #End))))))) + (form$ {#Item (text$ "lux def") {#Item name {#Item value {#Item export_policy #End}}}}))) #0) ("lux def" as_checked - ("lux type check" (#Function Code (#Function Code Code)) + ("lux type check" {#Function Code {#Function Code Code}} (function'' [type value] - (form$ (#Item (text$ "lux type check") (#Item type (#Item value #End)))))) + (form$ {#Item (text$ "lux type check") {#Item type {#Item value #End}}}))) #0) ("lux def" as_function - ("lux type check" (#Function Code (#Function (#Apply Code List) (#Function Code Code))) + ("lux type check" {#Function Code {#Function {#Apply Code List} {#Function Code Code}}} (function'' [self inputs output] - (form$ (#Item (identifier$ [..prelude_module "function''"]) - (#Item self - (#Item (tuple$ inputs) - (#Item output #End))))))) + (form$ {#Item (identifier$ [..prelude_module "function''"]) + {#Item self + {#Item (tuple$ inputs) + {#Item output #End}}}}))) #0) ("lux def" as_macro - ("lux type check" (#Function Code Code) + ("lux type check" {#Function Code Code} (function'' [expression] - (form$ (#Item (text$ "lux macro") - (#Item expression - #End))))) + (form$ {#Item (text$ "lux macro") + {#Item expression + #End}}))) #0) ("lux def" def:'' ("lux macro" (function'' [tokens] - ({(#Item [export_policy - (#Item [[_ (#Form (#Item [name args]))] - (#Item [type (#Item [body #End])])])]) - (in_meta (#Item [(as_def name + ({{#Item [export_policy + {#Item [[_ {#Form {#Item [name args]}}] + {#Item [type {#Item [body #End]}]}]}]} + (in_meta {#Item [(as_def name (as_checked type (as_function name args body)) export_policy) - #End])) + #End]}) - (#Item [export_policy (#Item [name (#Item [type (#Item [body #End])])])]) - (in_meta (#Item [(as_def name (as_checked type body) + {#Item [export_policy {#Item [name {#Item [type {#Item [body #End]}]}]}]} + (in_meta {#Item [(as_def name (as_checked type body) export_policy) - #End])) + #End]}) _ (failure "Wrong syntax for def''")} @@ -806,10 +830,10 @@ ("lux def" macro:' ("lux macro" (function'' [tokens] - ({(#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End))) - (in_meta (#Item (as_def name (as_macro (as_function name args body)) + ({{#Item export_policy {#Item [_ {#Form {#Item name args}}] {#Item body #End}}} + (in_meta {#Item (as_def name (as_macro (as_function name args body)) export_policy) - #End)) + #End}) _ (failure "Wrong syntax for macro:'")} @@ -820,58 +844,58 @@ (in_meta #End)) (macro:' .private ($' tokens) - ({(#Item x #End) + ({{#Item x #End} (in_meta tokens) - (#Item x (#Item y xs)) - (in_meta (#Item (form$ (#Item (identifier$ [..prelude_module "$'"]) - (#Item (form$ (#Item (tag$ [..prelude_module "Apply"]) - (#Item y (#Item x #End)))) - xs))) - #End)) + {#Item x {#Item y xs}} + (in_meta {#Item (form$ {#Item (identifier$ [..prelude_module "$'"]) + {#Item (variant$ {#Item (tag$ [..prelude_module "Apply"]) + {#Item y {#Item x #End}}}) + xs}}) + #End}) _ (failure "Wrong syntax for $'")} tokens)) (def:'' .private (list\each f xs) - (#UnivQ #End - (#UnivQ #End - (#Function (#Function (#Parameter 3) (#Parameter 1)) - (#Function ($' List (#Parameter 3)) - ($' List (#Parameter 1)))))) + {#UnivQ #End + {#UnivQ #End + {#Function {#Function {#Parameter 3} {#Parameter 1}} + {#Function ($' List {#Parameter 3}) + ($' List {#Parameter 1})}}}} ({#End #End - (#Item x xs') - (#Item (f x) (list\each f xs'))} + {#Item x xs'} + {#Item (f x) (list\each f xs')}} xs)) (def:'' .private Replacement_Environment Type - ($' List (#Product Text Code))) + ($' List {#Product Text Code})) (def:'' .private (replacement_environment xs ys) - (#Function ($' List Text) (#Function ($' List Code) Replacement_Environment)) - ({[(#Item x xs') (#Item y ys')] - (#Item [x y] (replacement_environment xs' ys')) + {#Function ($' List Text) {#Function ($' List Code) Replacement_Environment}} + ({[{#Item x xs'} {#Item y ys'}] + {#Item [x y] (replacement_environment xs' ys')} _ #End} [xs ys])) (def:'' .private (text\= reference sample) - (#Function Text (#Function Text Bit)) + {#Function Text {#Function Text Bit}} ("lux text =" reference sample)) (def:'' .private (replacement for environment) - (#Function Text (#Function Replacement_Environment ($' Maybe Code))) + {#Function Text {#Function Replacement_Environment ($' Maybe Code)}} ({#End #None - (#Item [k v] environment') + {#Item [k v] environment'} ({#1 - (#Some v) + {#Some v} #0 (replacement for environment')} @@ -879,30 +903,30 @@ environment)) (def:'' .private (with_replacements reps syntax) - (#Function Replacement_Environment (#Function Code Code)) - ({[_ (#Identifier "" name)] - ({(#Some replacement) + {#Function Replacement_Environment {#Function Code Code}} + ({[_ {#Identifier "" name}] + ({{#Some replacement} replacement #None syntax} (..replacement name reps)) - [meta (#Form parts)] - [meta (#Form (list\each (with_replacements reps) parts))] + [meta {#Form parts}] + [meta {#Form (list\each (with_replacements reps) parts)}] - [meta (#Variant members)] - [meta (#Variant (list\each (with_replacements reps) members))] + [meta {#Variant members}] + [meta {#Variant (list\each (with_replacements reps) members)}] - [meta (#Tuple members)] - [meta (#Tuple (list\each (with_replacements reps) members))] + [meta {#Tuple members}] + [meta {#Tuple (list\each (with_replacements reps) members)}] _ syntax} syntax)) (def:'' .private (n/* param subject) - (#Function Nat (#Function Nat Nat)) + {#Function Nat {#Function Nat Nat}} ("lux type as" Nat ("lux i64 *" ("lux type as" Int param) @@ -910,36 +934,36 @@ (def:'' .private (list\mix f init xs) ... (All (_ a b) (-> (-> b a a) a (List b) a)) - (#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1) - (#Function (#Parameter 3) - (#Parameter 3))) - (#Function (#Parameter 3) - (#Function ($' List (#Parameter 1)) - (#Parameter 3)))))) + {#UnivQ #End {#UnivQ #End {#Function {#Function {#Parameter 1} + {#Function {#Parameter 3} + {#Parameter 3}}} + {#Function {#Parameter 3} + {#Function ($' List {#Parameter 1}) + {#Parameter 3}}}}}} ({#End init - (#Item x xs') + {#Item x xs'} (list\mix f (f x init) xs')} xs)) (def:'' .private (list\size list) - (#UnivQ #End - (#Function ($' List (#Parameter 1)) Nat)) + {#UnivQ #End + {#Function ($' List {#Parameter 1}) Nat}} (list\mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) (def:'' .private (let$ binding value body) - (#Function Code (#Function Code (#Function Code Code))) - (form$ (#Item (variant$ (#Item binding (#Item body #End))) - (#Item value #End)))) + {#Function Code {#Function Code {#Function Code Code}}} + (form$ {#Item (variant$ {#Item binding {#Item body #End}}) + {#Item value #End}})) (def:'' .private (UnivQ$ body) - (#Function Code Code) - (form$ (#Item (tag$ [..prelude_module "UnivQ"]) (#Item (tag$ [..prelude_module "End"]) (#Item body #End))))) + {#Function Code Code} + (variant$ {#Item (tag$ [..prelude_module "UnivQ"]) {#Item (tag$ [..prelude_module "End"]) {#Item body #End}}})) (def:'' .private (ExQ$ body) - (#Function Code Code) - (form$ (#Item (tag$ [..prelude_module "ExQ"]) (#Item (tag$ [..prelude_module "End"]) (#Item body #End))))) + {#Function Code Code} + (variant$ {#Item (tag$ [..prelude_module "ExQ"]) {#Item (tag$ [..prelude_module "End"]) {#Item body #End}}})) (def:'' .private quantification_level Text @@ -948,24 +972,24 @@ double_quote))) (def:'' .private quantified - (#Function Code Code) + {#Function Code Code} (let$ (local_identifier$ ..quantification_level) (nat$ 0))) (def:'' .private (quantified_type_parameter idx) - (#Function Nat Code) - (form$ (#Item (tag$ [..prelude_module "Parameter"]) - (#Item (form$ (#Item (text$ "lux i64 +") - (#Item (local_identifier$ ..quantification_level) - (#Item (nat$ idx) - #End)))) - #End)))) + {#Function Nat Code} + (variant$ {#Item (tag$ [..prelude_module "Parameter"]) + {#Item (form$ {#Item (text$ "lux i64 +") + {#Item (local_identifier$ ..quantification_level) + {#Item (nat$ idx) + #End}}}) + #End}})) (def:'' .private (next_level depth) - (#Function Nat Nat) + {#Function Nat Nat} ("lux i64 +" 2 depth)) (def:'' .private (self_id? id) - (#Function Nat Bit) + {#Function Nat Bit} ("lux i64 =" id ("lux type as" Nat ("lux i64 *" +2 ("lux i64 /" +2 @@ -973,49 +997,49 @@ id)))))) (def:'' .public (__adjusted_quantified_type__ permission depth type) - (#Function Nat (#Function Nat (#Function Type Type))) + {#Function Nat {#Function Nat {#Function Type Type}}} ({0 ({... Jackpot! - (#Parameter id) + {#Parameter id} ({id' - ({#0 (#Parameter id') - #1 (#Parameter ("lux i64 -" 2 id'))} + ({#0 {#Parameter id'} + #1 {#Parameter ("lux i64 -" 2 id')}} (self_id? id))} ("lux i64 -" ("lux i64 -" depth id) 0)) ... Recur - (#Primitive name parameters) - (#Primitive name (list\each (__adjusted_quantified_type__ permission depth) - parameters)) + {#Primitive name parameters} + {#Primitive name (list\each (__adjusted_quantified_type__ permission depth) + parameters)} - (#Sum left right) - (#Sum (__adjusted_quantified_type__ permission depth left) - (__adjusted_quantified_type__ permission depth right)) + {#Sum left right} + {#Sum (__adjusted_quantified_type__ permission depth left) + (__adjusted_quantified_type__ permission depth right)} - (#Product left right) - (#Product (__adjusted_quantified_type__ permission depth left) - (__adjusted_quantified_type__ permission depth right)) + {#Product left right} + {#Product (__adjusted_quantified_type__ permission depth left) + (__adjusted_quantified_type__ permission depth right)} - (#Function input output) - (#Function (__adjusted_quantified_type__ permission depth input) - (__adjusted_quantified_type__ permission depth output)) + {#Function input output} + {#Function (__adjusted_quantified_type__ permission depth input) + (__adjusted_quantified_type__ permission depth output)} - (#UnivQ environment body) - (#UnivQ environment - (__adjusted_quantified_type__ permission (next_level depth) body)) + {#UnivQ environment body} + {#UnivQ environment + (__adjusted_quantified_type__ permission (next_level depth) body)} - (#ExQ environment body) - (#ExQ environment - (__adjusted_quantified_type__ permission (next_level depth) body)) + {#ExQ environment body} + {#ExQ environment + (__adjusted_quantified_type__ permission (next_level depth) body)} - (#Apply parameter function) - (#Apply (__adjusted_quantified_type__ permission depth parameter) - (__adjusted_quantified_type__ permission depth function)) + {#Apply parameter function} + {#Apply (__adjusted_quantified_type__ permission depth parameter) + (__adjusted_quantified_type__ permission depth function)} ... Leave these alone. - (#Named name anonymous) type - (#Var id) type - (#Ex id) type} + {#Named name anonymous} type + {#Var id} type + {#Ex id} type} type) _ @@ -1023,29 +1047,29 @@ permission)) (def:'' .private (with_correct_quantification body) - (#Function Code Code) - (form$ (#Item (identifier$ [prelude_module "__adjusted_quantified_type__"]) - (#Item (local_identifier$ ..quantification_level) - (#Item (nat$ 0) - (#Item body - #End)))))) + {#Function Code Code} + (form$ {#Item (identifier$ [prelude_module "__adjusted_quantified_type__"]) + {#Item (local_identifier$ ..quantification_level) + {#Item (nat$ 0) + {#Item body + #End}}}})) (def:'' .private (with_quantification depth body) - (#Function Nat (#Function Code Code)) + {#Function Nat {#Function Code Code}} ({g!level (let$ g!level - (form$ (#Item (text$ "lux i64 +") - (#Item g!level - (#Item (nat$ ("lux type as" Nat - ("lux i64 *" +2 - ("lux type as" Int - depth)))) - #End)))) + (form$ {#Item (text$ "lux i64 +") + {#Item g!level + {#Item (nat$ ("lux type as" Nat + ("lux i64 *" +2 + ("lux type as" Int + depth)))) + #End}}}) body)} (local_identifier$ ..quantification_level))) (def:'' .private (initialized_quantification? lux) - (#Function Lux Bit) + {#Function Lux Bit} ({[#info _ #source _ #current_module _ #modules _ #scopes scopes #type_context _ #host _ #seed _ #expected _ #location _ #extensions _ @@ -1070,17 +1094,17 @@ lux)) (macro:' .public (All tokens lux) - ({(#Item [_ (#Form (#Item self_name args))] - (#Item body #End)) - (#Right [lux - (#Item ({raw + ({{#Item [_ {#Form {#Item self_name args}}] + {#Item body #End}} + {#Right [lux + {#Item ({raw ({#1 raw #0 (..quantified raw)} (initialized_quantification? lux))} ({#End body - (#Item head tail) + {#Item head tail} (with_correct_quantification (let$ self_name (quantified_type_parameter 0) ({[_ raw] @@ -1095,24 +1119,24 @@ body)] args))))} args)) - #End)]) + #End}]} _ - (#Left "Wrong syntax for All")} + {#Left "Wrong syntax for All"}} tokens)) (macro:' .public (Ex tokens lux) - ({(#Item [_ (#Form (#Item self_name args))] - (#Item body #End)) - (#Right [lux - (#Item ({raw + ({{#Item [_ {#Form {#Item self_name args}}] + {#Item body #End}} + {#Right [lux + {#Item ({raw ({#1 raw #0 (..quantified raw)} (initialized_quantification? lux))} ({#End body - (#Item head tail) + {#Item head tail} (with_correct_quantification (let$ self_name (quantified_type_parameter 0) ({[_ raw] @@ -1127,47 +1151,47 @@ body)] args))))} args)) - #End)]) + #End}]} _ - (#Left "Wrong syntax for Ex")} + {#Left "Wrong syntax for Ex"}} tokens)) (def:'' .private (list\reversed list) (All (_ a) - (#Function ($' List a) ($' List a))) + {#Function ($' List a) ($' List a)}) (list\mix ("lux type check" (All (_ a) - (#Function a (#Function ($' List a) ($' List a)))) - (function'' [head tail] (#Item head tail))) + {#Function a {#Function ($' List a) ($' List a)}}) + (function'' [head tail] {#Item head tail})) #End list)) (macro:' .public (-> tokens) - ({(#Item output inputs) - (in_meta (#Item (list\mix ("lux type check" (#Function Code (#Function Code Code)) - (function'' [i o] (form$ (#Item (tag$ [..prelude_module "Function"]) (#Item i (#Item o #End)))))) + ({{#Item output inputs} + (in_meta {#Item (list\mix ("lux type check" {#Function Code {#Function Code Code}} + (function'' [i o] (variant$ {#Item (tag$ [..prelude_module "Function"]) {#Item i {#Item o #End}}}))) output inputs) - #End)) + #End}) _ (failure "Wrong syntax for ->")} (list\reversed tokens))) (macro:' .public (list xs) - (in_meta (#Item (list\mix (function'' [head tail] - (form$ (#Item (tag$ [..prelude_module "Item"]) - (#Item (tuple$ (#Item [head (#Item [tail #End])])) - #End)))) + (in_meta {#Item (list\mix (function'' [head tail] + (variant$ {#Item (tag$ [..prelude_module "Item"]) + {#Item (tuple$ {#Item [head {#Item [tail #End]}]}) + #End}})) (tag$ [..prelude_module "End"]) (list\reversed xs)) - #End))) + #End})) (macro:' .public (list& xs) - ({(#Item last init) + ({{#Item last init} (in_meta (list (list\mix (function'' [head tail] - (form$ (list (tag$ [..prelude_module "Item"]) - (tuple$ (list head tail))))) + (variant$ (list (tag$ [..prelude_module "Item"]) + (tuple$ (list head tail))))) last init))) @@ -1179,8 +1203,8 @@ ({#End (in_meta (list (identifier$ [..prelude_module "Nothing"]))) - (#Item last prevs) - (in_meta (list (list\mix (function'' [left right] (form$ (list (tag$ [..prelude_module "Sum"]) left right))) + {#Item last prevs} + (in_meta (list (list\mix (function'' [left right] (variant$ (list (tag$ [..prelude_module "Sum"]) left right))) last prevs)))} (list\reversed tokens))) @@ -1189,24 +1213,24 @@ ({#End (in_meta (list (identifier$ [..prelude_module "Any"]))) - (#Item last prevs) - (in_meta (list (list\mix (function'' [left right] (form$ (list (tag$ [..prelude_module "Product"]) left right))) + {#Item last prevs} + (in_meta (list (list\mix (function'' [left right] (variant$ (list (tag$ [..prelude_module "Product"]) left right))) last prevs)))} (list\reversed tokens))) (macro:' .private (function' tokens) - (let'' [name tokens'] ({(#Item [[_ (#Identifier ["" name])] tokens']) + (let'' [name tokens'] ({{#Item [[_ {#Identifier ["" name]}] tokens']} [name tokens'] _ ["" tokens]} tokens) - ({(#Item [[_ (#Tuple args)] (#Item [body #End])]) + ({{#Item [[_ {#Tuple args}] {#Item [body #End]}]} ({#End (failure "function' requires a non-empty arguments tuple.") - (#Item [harg targs]) + {#Item [harg targs]} (in_meta (list (form$ (list (tuple$ (list (local_identifier$ name) harg)) (list\mix (function'' [arg body'] @@ -1222,9 +1246,9 @@ tokens'))) (macro:' .private (def:''' tokens) - ({(#Item [export_policy - (#Item [[_ (#Form (#Item [name args]))] - (#Item [type (#Item [body #End])])])]) + ({{#Item [export_policy + {#Item [[_ {#Form {#Item [name args]}}] + {#Item [type {#Item [body #End]}]}]}]} (in_meta (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") @@ -1235,7 +1259,7 @@ body)))) export_policy)))) - (#Item [export_policy (#Item [name (#Item [type (#Item [body #End])])])]) + {#Item [export_policy {#Item [name {#Item [type {#Item [body #End]}]}]}]} (in_meta (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux type check") @@ -1257,15 +1281,15 @@ (def:''' .private (pairs xs) (All (_ a) (-> ($' List a) ($' List (Tuple a a)))) - ({(#Item x (#Item y xs')) - (#Item [x y] (pairs xs')) + ({{#Item x {#Item y xs'}} + {#Item [x y] (pairs xs')} _ #End} xs)) (macro:' .private (let' tokens) - ({(#Item [[_ (#Tuple bindings)] (#Item [body #End])]) + ({{#Item [[_ {#Tuple bindings}] {#Item [body #End]}]} (in_meta (list (list\mix ("lux type check" (-> (Tuple Code Code) Code Code) (function' [binding body] @@ -1285,7 +1309,7 @@ ({#End #0 - (#Item x xs') + {#Item x xs'} ({#1 #1 #0 (any? p xs')} (p x))} @@ -1299,16 +1323,18 @@ (def:''' .private (untemplated_list tokens) (-> ($' List Code) Code) ({#End - (_ann (#Tag [..prelude_module "End"])) + (_ann {#Tag [..prelude_module "End"]}) - (#Item [token tokens']) - (_ann (#Form (list (_ann (#Tag [..prelude_module "Item"])) token (untemplated_list tokens'))))} + {#Item [token tokens']} + (_ann {#Variant (list (_ann {#Tag [..prelude_module "Item"]}) + token + (untemplated_list tokens'))})} tokens)) (def:''' .private (list\composite xs ys) (All (_ a) (-> ($' List a) ($' List a) ($' List a))) - ({(#Item x xs') - (#Item x (list\composite xs' ys)) + ({{#Item x xs'} + {#Item x (list\composite xs' ys)} #End ys} @@ -1316,7 +1342,7 @@ (def:''' .private (right_associativity op a1 a2) (-> Code Code Code Code) - ({[_ (#Form parts)] + ({[_ {#Form parts}] (form$ (list\composite parts (list a1 a2))) _ @@ -1330,8 +1356,8 @@ (func left right))) (macro:' .public (_$ tokens) - ({(#Item op tokens') - ({(#Item first nexts) + ({{#Item op tokens'} + ({{#Item first nexts} (in_meta (list (list\mix (function\flipped (right_associativity op)) first nexts))) _ @@ -1343,8 +1369,8 @@ tokens)) (macro:' .public ($_ tokens) - ({(#Item op tokens') - ({(#Item last prevs) + ({{#Item op tokens'} + ({{#Item last prevs} (in_meta (list (list\mix (right_associativity op) last prevs))) _ @@ -1362,26 +1388,26 @@ ... (: (All (_ a b) (-> (-> a (m b)) (m a) (m b))) ... then))) ("lux def type tagged" Monad - (#Named [..prelude_module "Monad"] - (All (_ !) - (Tuple (All (_ a) - (-> a ($' ! a))) - (All (_ a b) - (-> (-> a ($' ! b)) - ($' ! a) - ($' ! b)))))) + {#Named [..prelude_module "Monad"] + (All (_ !) + (Tuple (All (_ a) + (-> a ($' ! a))) + (All (_ a b) + (-> (-> a ($' ! b)) + ($' ! a) + ($' ! b)))))} ["in" "then"] #0) (def:''' .private maybe_monad ($' Monad Maybe) [#in - (function' [x] (#Some x)) + (function' [x] {#Some x}) #then (function' [f ma] ({#None #None - (#Some a) (f a)} + {#Some a} (f a)} ma))]) (def:''' .private meta_monad @@ -1389,26 +1415,26 @@ [#in (function' [x] (function' [state] - (#Right state x))) + {#Right state x})) #then (function' [f ma] (function' [state] - ({(#Left msg) - (#Left msg) + ({{#Left msg} + {#Left msg} - (#Right [state' a]) + {#Right [state' a]} (f a state')} (ma state))))]) (macro:' .private (do tokens) - ({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End))) + ({{#Item monad {#Item [_ {#Tuple bindings}] {#Item body #End}}} (let' [g!in (local_identifier$ "in") g!then (local_identifier$ " then ") body' (list\mix ("lux type check" (-> (Tuple Code Code) Code Code) (function' [binding body'] (let' [[var value] binding] - ({[_ (#Identifier [module short])] + ({[_ {#Identifier [module short]}] ({"" (form$ (list g!then (form$ (list (tuple$ (list (local_identifier$ "") var)) body')) @@ -1445,11 +1471,11 @@ ({#End (in #End) - (#Item x xs') + {#Item x xs'} (do m [y (f x) ys (monad\each m f xs')] - (in (#Item y ys)))} + (in {#Item y ys}))} xs))) (def:''' .private (monad\mix m f y xs) @@ -1463,14 +1489,14 @@ ({#End (in y) - (#Item x xs') + {#Item x xs'} (do m [y' (f x y)] (monad\mix m f y' xs'))} xs))) (macro:' .public (if tokens) - ({(#Item test (#Item then (#Item else #End))) + ({{#Item test {#Item then {#Item else #End}}} (in_meta (list (form$ (list (variant$ (list (bit$ #1) then (bit$ #0) else)) test)))) @@ -1486,9 +1512,9 @@ (def:''' .private (plist\value k plist) (All (_ a) (-> Text ($' PList a) ($' Maybe a))) - ({(#Item [[k' v] plist']) + ({{#Item [[k' v] plist']} (if (text\= k k') - (#Some v) + {#Some v} (plist\value k plist')) #End @@ -1513,37 +1539,37 @@ #scopes scopes #type_context types #host host #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] state] - ({(#Some [#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _]) - ({(#Some constant) - ({(#Alias real_name) - (#Right [state real_name]) + ({{#Some [#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _]} + ({{#Some constant} + ({{#Alias real_name} + {#Right [state real_name]} - (#Definition [exported? def_type def_value]) - (#Right [state full_name]) + {#Definition [exported? def_type def_value]} + {#Right [state full_name]} - (#Type [exported? type labels]) - (#Right [state full_name]) + {#Type [exported? type labels]} + {#Right [state full_name]} - (#Label _) - (#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))) + {#Label _} + {#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))} - (#Slot _) - (#Left ($_ text\composite "Unknown definition: " (name\encoded full_name)))} + {#Slot _} + {#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))}} constant) #None - (#Left ($_ text\composite "Unknown definition: " (name\encoded full_name)))} + {#Left ($_ text\composite "Unknown definition: " (name\encoded full_name))}} (plist\value name definitions)) #None - (#Left ($_ text\composite "Unknown module: " module " @ " (name\encoded full_name)))} + {#Left ($_ text\composite "Unknown module: " module " @ " (name\encoded full_name))}} (plist\value module modules)))) (def:''' .private (code_list expression) (-> Code Code) - (let' [type (form$ (list (tag$ [..prelude_module "Apply"]) - (identifier$ [..prelude_module "Code"]) - (identifier$ [..prelude_module "List"])))] + (let' [type (variant$ (list (tag$ [..prelude_module "Apply"]) + (identifier$ [..prelude_module "Code"]) + (identifier$ [..prelude_module "List"])))] (form$ (list (text$ "lux type check") type expression)))) (def:''' .private (spliced replace? untemplated elems) @@ -1552,20 +1578,20 @@ ({#End (in_meta (tag$ [..prelude_module "End"])) - (#Item lastI inits) + {#Item lastI inits} (do meta_monad - [lastO ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] + [lastO ({[_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced #End]}]}}] (in (code_list spliced)) _ (do meta_monad [lastO (untemplated lastI)] - (in (code_list (form$ (list (tag$ [..prelude_module "Item"]) - (tuple$ (list lastO (tag$ [..prelude_module "End"]))))))))} + (in (code_list (variant$ (list (tag$ [..prelude_module "Item"]) + (tuple$ (list lastO (tag$ [..prelude_module "End"]))))))))} lastI)] (monad\mix meta_monad (function' [leftI rightO] - ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] + ({[_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced #End]}]}}] (let' [g!in-module (form$ (list (text$ "lux in-module") (text$ ..prelude_module) (identifier$ [..prelude_module "list\composite"])))] @@ -1574,7 +1600,7 @@ _ (do meta_monad [leftO (untemplated leftI)] - (in (form$ (list (tag$ [..prelude_module "Item"]) (tuple$ (list leftO rightO))))))} + (in (variant$ (list (tag$ [..prelude_module "Item"]) (tuple$ (list leftO rightO))))))} leftI)) lastO inits))} @@ -1587,41 +1613,41 @@ (def:''' .private (untemplated_text value) (-> Text Code) - (with_location (form$ (list (tag$ [..prelude_module "Text"]) (text$ value))))) + (with_location (variant$ (list (tag$ [..prelude_module "Text"]) (text$ value))))) (def:''' .private (untemplated replace? subst token) (-> Bit Text Code ($' Meta Code)) - ({[_ [_ (#Bit value)]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Bit"]) (bit$ value))))) + ({[_ [_ {#Bit value}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Bit"]) (bit$ value))))) - [_ [_ (#Nat value)]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Nat"]) (nat$ value))))) + [_ [_ {#Nat value}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Nat"]) (nat$ value))))) - [_ [_ (#Int value)]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Int"]) (int$ value))))) + [_ [_ {#Int value}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Int"]) (int$ value))))) - [_ [_ (#Rev value)]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Rev"]) (rev$ value))))) + [_ [_ {#Rev value}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Rev"]) (rev$ value))))) - [_ [_ (#Frac value)]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Frac"]) (frac$ value))))) + [_ [_ {#Frac value}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Frac"]) (frac$ value))))) - [_ [_ (#Text value)]] + [_ [_ {#Text value}]] (in_meta (untemplated_text value)) - [#0 [_ (#Tag [module name])]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Tag"]) (tuple$ (list (text$ module) (text$ name))))))) + [#0 [_ {#Tag [module name]}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Tag"]) (tuple$ (list (text$ module) (text$ name))))))) - [#1 [_ (#Tag [module name])]] + [#1 [_ {#Tag [module name]}]] (let' [module' ({"" subst _ module} module)] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Tag"]) (tuple$ (list (text$ module') (text$ name)))))))) + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Tag"]) (tuple$ (list (text$ module') (text$ name)))))))) - [#1 [_ (#Identifier [module name])]] + [#1 [_ {#Identifier [module name]}]] (do meta_monad [real_name ({"" (if (text\= "" subst) @@ -1632,52 +1658,52 @@ (in [module name])} module) .let' [[module name] real_name]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Identifier"]) (tuple$ (list (text$ module) (text$ name)))))))) + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Identifier"]) (tuple$ (list (text$ module) (text$ name)))))))) - [#0 [_ (#Identifier [module name])]] - (in_meta (with_location (form$ (list (tag$ [..prelude_module "Identifier"]) (tuple$ (list (text$ module) (text$ name))))))) + [#0 [_ {#Identifier [module name]}]] + (in_meta (with_location (variant$ (list (tag$ [..prelude_module "Identifier"]) (tuple$ (list (text$ module) (text$ name))))))) - [#1 [_ (#Form (#Item [[_ (#Identifier ["" "~"])] (#Item [unquoted #End])]))]] + [#1 [_ {#Form {#Item [[_ {#Identifier ["" "~"]}] {#Item [unquoted #End]}]}}]] (in_meta (form$ (list (text$ "lux type check") (identifier$ [..prelude_module "Code"]) unquoted))) - [#1 [_ (#Form (#Item [[_ (#Identifier ["" "~!"])] (#Item [dependent #End])]))]] + [#1 [_ {#Form {#Item [[_ {#Identifier ["" "~!"]}] {#Item [dependent #End]}]}}]] (do meta_monad [independent (untemplated replace? subst dependent)] - (in (with_location (form$ (list (tag$ [..prelude_module "Form"]) - (untemplated_list (list (untemplated_text "lux in-module") - (untemplated_text subst) - independent))))))) + (in (with_location (variant$ (list (tag$ [..prelude_module "Form"]) + (untemplated_list (list (untemplated_text "lux in-module") + (untemplated_text subst) + independent))))))) - [#1 [_ (#Form (#Item [[_ (#Identifier ["" "~'"])] (#Item [keep_quoted #End])]))]] + [#1 [_ {#Form {#Item [[_ {#Identifier ["" "~'"]}] {#Item [keep_quoted #End]}]}}]] (untemplated #0 subst keep_quoted) - [_ [meta (#Form elems)]] + [_ [meta {#Form elems}]] (do meta_monad [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (form$ (list (tag$ [..prelude_module "Form"]) output)))]] + .let' [[_ output'] (with_location (variant$ (list (tag$ [..prelude_module "Form"]) output)))]] (in [meta output'])) - [_ [meta (#Variant elems)]] + [_ [meta {#Variant elems}]] (do meta_monad [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (form$ (list (tag$ [..prelude_module "Variant"]) output)))]] + .let' [[_ output'] (with_location (variant$ (list (tag$ [..prelude_module "Variant"]) output)))]] (in [meta output'])) - [_ [meta (#Tuple elems)]] + [_ [meta {#Tuple elems}]] (do meta_monad [output (spliced replace? (untemplated replace? subst) elems) - .let' [[_ output'] (with_location (form$ (list (tag$ [..prelude_module "Tuple"]) output)))]] + .let' [[_ output'] (with_location (variant$ (list (tag$ [..prelude_module "Tuple"]) output)))]] (in [meta output']))} [replace? token])) (macro:' .public (primitive tokens) - ({(#Item [_ (#Text class_name)] #End) - (in_meta (list (form$ (list (tag$ [..prelude_module "Primitive"]) (text$ class_name) (tag$ [..prelude_module "End"]))))) + ({{#Item [_ {#Text class_name}] #End} + (in_meta (list (variant$ (list (tag$ [..prelude_module "Primitive"]) (text$ class_name) (tag$ [..prelude_module "End"]))))) - (#Item [_ (#Text class_name)] (#Item [_ (#Tuple params)] #End)) - (in_meta (list (form$ (list (tag$ [..prelude_module "Primitive"]) (text$ class_name) (untemplated_list params))))) + {#Item [_ {#Text class_name}] {#Item [_ {#Tuple params}] #End}} + (in_meta (list (variant$ (list (tag$ [..prelude_module "Primitive"]) (text$ class_name) (untemplated_list params))))) _ (failure "Wrong syntax for primitive")} @@ -1689,16 +1715,16 @@ #scopes scopes #type_context types #host host #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] - ({(#Some module_name) - (#Right [state module_name]) + ({{#Some module_name} + {#Right [state module_name]} _ - (#Left "Cannot get the module name without a module!")} + {#Left "Cannot get the module name without a module!"}} current_module)} state)) (macro:' .public (` tokens) - ({(#Item template #End) + ({{#Item template #End} (do meta_monad [current_module current_module_name =template (untemplated #1 current_module template)] @@ -1711,7 +1737,7 @@ tokens)) (macro:' .public (`' tokens) - ({(#Item template #End) + ({{#Item template #End} (do meta_monad [=template (untemplated #1 "" template)] (in (list (form$ (list (text$ "lux type check") (identifier$ [..prelude_module "Code"]) =template))))) @@ -1721,7 +1747,7 @@ tokens)) (macro:' .public (' tokens) - ({(#Item template #End) + ({{#Item template #End} (do meta_monad [=template (untemplated #0 "" template)] (in (list (form$ (list (text$ "lux type check") (identifier$ [..prelude_module "Code"]) =template))))) @@ -1731,15 +1757,21 @@ tokens)) (macro:' .public (|> tokens) - ({(#Item [init apps]) + ({{#Item [init apps]} (in_meta (list (list\mix ("lux type check" (-> Code Code Code) (function' [app acc] - ({[_ (#Tuple parts)] + ({[_ {#Variant parts}] + (variant$ (list\composite parts (list acc))) + + [_ {#Tuple parts}] (tuple$ (list\composite parts (list acc))) - [_ (#Form parts)] + [_ {#Form parts}] (form$ (list\composite parts (list acc))) + [_ {#Tag _}] + (` {(~ app) (~ acc)}) + _ (` ((~ app) (~ acc)))} app))) @@ -1751,15 +1783,21 @@ tokens)) (macro:' .public (<| tokens) - ({(#Item [init apps]) + ({{#Item [init apps]} (in_meta (list (list\mix ("lux type check" (-> Code Code Code) (function' [app acc] - ({[_ (#Tuple parts)] + ({[_ {#Variant parts}] + (variant$ (list\composite parts (list acc))) + + [_ {#Tuple parts}] (tuple$ (list\composite parts (list acc))) - [_ (#Form parts)] + [_ {#Form parts}] (form$ (list\composite parts (list acc))) + [_ {#Tag name}] + (` {(~ app) (~ acc)}) + _ (` ((~ app) (~ acc)))} app))) @@ -1777,8 +1815,8 @@ (def:''' .private (identifier_name x) (-> Code ($' Maybe Name)) - ({[_ (#Identifier sname)] - (#Some sname) + ({[_ {#Identifier sname}] + {#Some sname} _ #None} @@ -1786,8 +1824,8 @@ (def:''' .private (tag_name x) (-> Code ($' Maybe Name)) - ({[_ (#Tag sname)] - (#Some sname) + ({[_ {#Tag sname}] + {#Some sname} _ #None} @@ -1795,8 +1833,8 @@ (def:''' .private (identifier_short x) (-> Code ($' Maybe Text)) - ({[_ (#Identifier "" sname)] - (#Some sname) + ({[_ {#Identifier "" sname}] + {#Some sname} _ #None} @@ -1804,8 +1842,8 @@ (def:''' .private (tuple_list tuple) (-> Code ($' Maybe ($' List Code))) - ({[_ (#Tuple members)] - (#Some members) + ({[_ {#Tuple members}] + {#Some members} _ #None} @@ -1813,22 +1851,22 @@ (def:''' .private (realized_template env template) (-> Replacement_Environment Code Code) - ({[_ (#Identifier "" sname)] - ({(#Some subst) + ({[_ {#Identifier "" sname}] + ({{#Some subst} subst _ template} (..replacement sname env)) - [meta (#Form elems)] - [meta (#Form (list\each (realized_template env) elems))] + [meta {#Form elems}] + [meta {#Form (list\each (realized_template env) elems)}] - [meta (#Tuple elems)] - [meta (#Tuple (list\each (realized_template env) elems))] + [meta {#Tuple elems}] + [meta {#Tuple (list\each (realized_template env) elems)}] - [meta (#Variant elems)] - [meta (#Variant (list\each (realized_template env) elems))] + [meta {#Variant elems}] + [meta {#Variant (list\each (realized_template env) elems)}] _ template} @@ -1869,8 +1907,8 @@ (list\mix list\composite #End (list\reversed xs))) (macro:' .public (template tokens) - ({(#Item [[_ (#Tuple bindings)] (#Item [[_ (#Tuple templates)] data])]) - ({[(#Some bindings') (#Some data')] + ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} + ({[{#Some bindings'} {#Some data'}] (let' [apply ("lux type check" (-> Replacement_Environment ($' List Code)) (function' [env] (list\each (realized_template env) templates))) num_bindings (list\size bindings')] @@ -1988,7 +2026,7 @@ (def:''' .private (macro_type? type) (-> Type Bit) - ({(#Named ["library/lux" "Macro"] (#Primitive "#Macro" #End)) + ({{#Named ["library/lux" "Macro"] {#Primitive "#Macro" #End}} #1 _ @@ -2003,25 +2041,25 @@ [$module (plist\value module modules) gdef (let' [[#module_hash _ #module_aliases _ #definitions bindings #imports _ #module_state _] ("lux type check" Module $module)] (plist\value name bindings))] - ({(#Alias [r_module r_name]) + ({{#Alias [r_module r_name]} (macro'' modules current_module r_module r_name) - (#Definition [exported? def_type def_value]) + {#Definition [exported? def_type def_value]} (if (macro_type? def_type) (if exported? - (#Some ("lux type as" Macro def_value)) + {#Some ("lux type as" Macro def_value)} (if (text\= module current_module) - (#Some ("lux type as" Macro def_value)) + {#Some ("lux type as" Macro def_value)} #None)) #None) - (#Type [exported? type labels]) + {#Type [exported? type labels]} #None - (#Label _) + {#Label _} #None - (#Slot _) + {#Slot _} #None} ("lux type check" Global gdef)))) @@ -2047,7 +2085,7 @@ #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] - (#Right state (macro'' modules current_module module name))} + {#Right state (macro'' modules current_module module name)}} state))))) (def:''' .private (macro? name) @@ -2055,7 +2093,7 @@ (do meta_monad [name (normal name) output (macro' name)] - (in ({(#Some _) #1 + (in ({{#Some _} #1 #None #0} output)))) @@ -2065,20 +2103,20 @@ ({#End xs - (#Item [x #End]) + {#Item [x #End]} xs - (#Item [x xs']) + {#Item [x xs']} (list& x sep (list\interposed sep xs'))} xs)) (def:''' .private (single_expansion token) (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Item [_ (#Identifier name)] args))] + ({[_ {#Form {#Item [_ {#Identifier name}] args}}] (do meta_monad [name' (normal name) ?macro (macro' name')] - ({(#Some macro) + ({{#Some macro} (("lux type as" Macro' macro) args) #None @@ -2091,11 +2129,11 @@ (def:''' .private (expansion token) (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Item [_ (#Identifier name)] args))] + ({[_ {#Form {#Item [_ {#Identifier name}] args}}] (do meta_monad [name' (normal name) ?macro (macro' name')] - ({(#Some macro) + ({{#Some macro} (do meta_monad [top_level_expansion (("lux type as" Macro' macro) args) recursive_expansion (monad\each meta_monad expansion top_level_expansion)] @@ -2111,11 +2149,11 @@ (def:''' .private (full_expansion syntax) (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Item [_ (#Identifier name)] args))] + ({[_ {#Form {#Item [_ {#Identifier name}] args}}] (do meta_monad [name' (normal name) ?macro (macro' name')] - ({(#Some macro) + ({{#Some macro} (do meta_monad [expansion (("lux type as" Macro' macro) args) expansion' (monad\each meta_monad full_expansion expansion)] @@ -2124,23 +2162,23 @@ #None (do meta_monad [args' (monad\each meta_monad full_expansion args)] - (in (list (form$ (#Item (identifier$ name) (list\conjoint args'))))))} + (in (list (form$ {#Item (identifier$ name) (list\conjoint args')}))))} ?macro)) - [_ (#Form members)] + [_ {#Form members}] (do meta_monad [members' (monad\each meta_monad full_expansion members)] (in (list (form$ (list\conjoint members'))))) - [_ (#Tuple members)] + [_ {#Variant members}] (do meta_monad [members' (monad\each meta_monad full_expansion members)] - (in (list (tuple$ (list\conjoint members'))))) + (in (list (variant$ (list\conjoint members'))))) - [_ (#Variant members)] + [_ {#Tuple members}] (do meta_monad [members' (monad\each meta_monad full_expansion members)] - (in (list (variant$ (list\conjoint members'))))) + (in (list (tuple$ (list\conjoint members'))))) _ (in_meta (list syntax))} @@ -2152,49 +2190,49 @@ (def:''' .private (code\encoded code) (-> Code Text) - ({[_ (#Bit value)] + ({[_ {#Bit value}] (bit\encoded value) - [_ (#Nat value)] + [_ {#Nat value}] (nat\encoded value) - [_ (#Int value)] + [_ {#Int value}] (int\encoded value) - [_ (#Rev value)] + [_ {#Rev value}] ("lux io error" "@code\encoded Undefined behavior.") - [_ (#Frac value)] + [_ {#Frac value}] (frac\encoded value) - [_ (#Text value)] + [_ {#Text value}] (text\encoded value) - [_ (#Identifier [module name])] + [_ {#Identifier [module name]}] (if (text\= "" module) name ($_ text\composite module "." name)) - [_ (#Tag [module name])] + [_ {#Tag [module name]}] (if (text\= "" module) ($_ text\composite "#" name) ($_ text\composite "#" module "." name)) - [_ (#Form xs)] + [_ {#Form xs}] ($_ text\composite "(" (|> xs (list\each code\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") - [_ (#Tuple xs)] + [_ {#Tuple xs}] ($_ text\composite "[" (|> xs (list\each code\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) "]") - [_ (#Variant xs)] + [_ {#Variant xs}] ($_ text\composite "{" (|> xs (list\each code\encoded) (list\interposed " ") @@ -2204,45 +2242,45 @@ (def:''' .private (normal_type type) (-> Code Code) - ({[_ (#Form (#Item [_ (#Tag tag)] parts))] - (form$ (#Item (tag$ tag) (list\each normal_type parts))) + ({[_ {#Variant {#Item [_ {#Tag tag}] parts}}] + (` {(~ (tag$ tag)) (~+ (list\each normal_type parts))}) - [_ (#Variant members)] + [_ {#Variant members}] (` (Or (~+ (list\each normal_type members)))) - [_ (#Tuple members)] + [_ {#Tuple members}] (` (Tuple (~+ (list\each normal_type members)))) - [_ (#Form (#Item [_ (#Text "lux in-module")] - (#Item [_ (#Text module)] - (#Item type' - #End))))] + [_ {#Form {#Item [_ {#Text "lux in-module"}] + {#Item [_ {#Text module}] + {#Item type' + #End}}}}] (` ("lux in-module" (~ (text$ module)) (~ (normal_type type')))) - [_ (#Form (#Item [_ (#Identifier ["" ":~"])] (#Item expression #End)))] + [_ {#Form {#Item [_ {#Identifier ["" ":~"]}] {#Item expression #End}}}] expression - [_0 (#Form (#Item [_1 (#Variant (#Item binding (#Item body #End)))] - (#Item value - #End)))] - [_0 (#Form (#Item [_1 (#Variant (#Item binding (#Item (normal_type body) #End)))] - (#Item value - #End)))] - - [_0 (#Form (#Item [_1 (#Identifier ["library/lux" "__adjusted_quantified_type__"])] - (#Item _permission - (#Item _level - (#Item body - #End)))))] - [_0 (#Form (#Item [_1 (#Identifier [..prelude_module "__adjusted_quantified_type__"])] - (#Item _permission - (#Item _level - (#Item (normal_type body) - #End)))))] - - [_ (#Form (#Item type_fn args))] + [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item body #End}}}] + {#Item value + #End}}}] + [_0 {#Form {#Item [_1 {#Variant {#Item binding {#Item (normal_type body) #End}}}] + {#Item value + #End}}}] + + [_0 {#Form {#Item [_1 {#Identifier ["library/lux" "__adjusted_quantified_type__"]}] + {#Item _permission + {#Item _level + {#Item body + #End}}}}}] + [_0 {#Form {#Item [_1 {#Identifier [..prelude_module "__adjusted_quantified_type__"]}] + {#Item _permission + {#Item _level + {#Item (normal_type body) + #End}}}}}] + + [_ {#Form {#Item type_fn args}}] (list\mix ("lux type check" (-> Code Code Code) - (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn))))) + (function' [arg type_fn] (` {#.Apply (~ arg) (~ type_fn)}))) (normal_type type_fn) (list\each normal_type args)) @@ -2251,13 +2289,13 @@ type)) (macro:' .public (type tokens) - ({(#Item type #End) + ({{#Item type #End} (do meta_monad - [initialized_quantification? (function' [lux] (#Right [lux (initialized_quantification? lux)]))] + [initialized_quantification? (function' [lux] {#Right [lux (initialized_quantification? lux)]})] (if initialized_quantification? (do meta_monad [type+ (full_expansion type)] - ({(#Item type' #End) + ({{#Item type' #End} (in (list (normal_type type'))) _ @@ -2270,7 +2308,7 @@ tokens)) (macro:' .public (: tokens) - ({(#Item type (#Item value #End)) + ({{#Item type {#Item value #End}} (in_meta (list (` ("lux type check" (..type (~ type)) (~ value))))) @@ -2280,7 +2318,7 @@ tokens)) (macro:' .public (:as tokens) - ({(#Item type (#Item value #End)) + ({{#Item type {#Item value #End}} (in_meta (list (` ("lux type as" (..type (~ type)) (~ value))))) @@ -2313,16 +2351,16 @@ #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] - (#Right [#info info #source source #current_module _ #modules modules + {#Right [#info info #source source #current_module _ #modules modules #scopes scopes #type_context types #host host #seed ("lux i64 +" 1 seed) #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] - (local_identifier$ ($_ text\composite "__gensym__" prefix (nat\encoded seed))))} + (local_identifier$ ($_ text\composite "__gensym__" prefix (nat\encoded seed)))}} state)) (macro:' .public (exec tokens) - ({(#Item value actions) + ({{#Item value actions} (let' [dummy (local_identifier$ "")] (in_meta (list (list\mix ("lux type check" (-> Code Code Code) (function' [pre post] (` ({(~ dummy) (~ post)} @@ -2336,29 +2374,29 @@ (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 [_ {#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 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 [_ {#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]) + {#Item export_policy {#Item name {#Item body #End}}} + {#Some [export_policy name #End #None body]} _ #None} tokens))] - ({(#Some [export_policy name args ?type body]) + ({{#Some [export_policy name args ?type body]} (let' [body' ({#End body _ (` (function' (~ name) [(~+ args)] (~ body)))} args) - body'' ({(#Some type) + body'' ({{#Some type} (` (: (~ type) (~ body'))) #None @@ -2374,9 +2412,9 @@ (def:' .private (expander branches) (-> (List Code) (Meta (List Code))) - ({(#Item [_ (#Form (#Item [_ (#Identifier name)] args))] - (#Item body - branches')) + ({{#Item [_ {#Form {#Item [_ {#Identifier name}] args}}] + {#Item body + branches'}} (do meta_monad [??? (macro? name)] (if ??? @@ -2389,7 +2427,7 @@ body sub_expansion))))) - (#Item pattern (#Item body branches')) + {#Item pattern {#Item body branches'}} (do meta_monad [sub_expansion (expander branches')] (in (list& pattern body sub_expansion))) @@ -2406,7 +2444,7 @@ branches)) (macro:' .public (case tokens) - ({(#Item value branches) + ({{#Item value branches} (do meta_monad [expansion (expander branches)] (in (list (` ((~ (variant$ expansion)) (~ value)))))) @@ -2417,11 +2455,11 @@ (macro:' .public (^ tokens) (case tokens - (#Item [_ (#Form (#Item pattern #End))] (#Item body branches)) + {#Item [_ {#Form {#Item pattern #End}}] {#Item body branches}} (do meta_monad [pattern+ (full_expansion pattern)] (case pattern+ - (#Item pattern' #End) + {#Item pattern' #End} (in (list& pattern' body branches)) _ @@ -2432,7 +2470,7 @@ (macro:' .public (^or tokens) (case tokens - (^ (list& [_ (#Form patterns)] body branches)) + (^ (list& [_ {#Form patterns}] body branches)) (case patterns #End (failure "^or cannot have 0 patterns") @@ -2448,7 +2486,7 @@ (def:' .private (identifier? code) (-> Code Bit) (case code - [_ (#Identifier _)] + [_ {#Identifier _}] #1 _ @@ -2456,7 +2494,7 @@ (macro:' .public (let tokens) (case tokens - (^ (list [_ (#Tuple bindings)] body)) + (^ (list [_ {#Tuple bindings}] body)) (if (multiple? 2 (list\size bindings)) (|> bindings pairs list\reversed (list\mix (: (-> [Code Code] Code Code) @@ -2476,12 +2514,12 @@ (macro:' .public (function tokens) (case (: (Maybe [Text Code (List Code) Code]) (case tokens - (^ (list [_ (#Form (list& [_ (#Identifier ["" name])] head tail))] body)) - (#Some name head tail body) + (^ (list [_ {#Form (list& [_ {#Identifier ["" name]}] head tail)}] body)) + {#Some name head tail body} _ #None)) - (#Some g!name head tail body) + {#Some g!name head tail body} (let [g!blank (local_identifier$ "") nest (: (-> Code (-> Code Code Code)) (function' [g!name] @@ -2500,7 +2538,7 @@ (-> (List Code) (Maybe Any)) (case tokens (^ (list)) - (#Some []) + {#Some []} _ #None)) @@ -2509,7 +2547,7 @@ (-> (List Code) (Maybe [(List Code) Code])) (case tokens (^ (list& code tokens')) - (#Some [tokens' code]) + {#Some [tokens' code]} _ #None)) @@ -2517,8 +2555,8 @@ (def:' .private (local_identifierP tokens) (-> (List Code) (Maybe [(List Code) Text])) (case tokens - (^ (list& [_ (#Identifier ["" local_identifier])] tokens')) - (#Some [tokens' local_identifier]) + (^ (list& [_ {#Identifier ["" local_identifier]}] tokens')) + {#Some [tokens' local_identifier]} _ #None)) @@ -2528,14 +2566,14 @@ (-> (List Code) (Maybe (List <item_type>))) (case tokens #End - (#Some #End) + {#Some #End} _ (do maybe_monad [% (<item_parser> tokens) .let' [[tokens head] %] tail (<parser> tokens)] - (in (#Item head tail)))))] + (in {#Item head tail}))))] [parametersP Text local_identifierP] [enhanced_parametersP Code anyP] @@ -2545,7 +2583,7 @@ [(def:' .private (<parser> tokens) (-> (List Code) (Maybe [(List Code) [Text (List <parameter_type>)]])) (case tokens - (^ (list& [_ (#Form local_declaration)] tokens')) + (^ (list& [_ {#Form local_declaration}] tokens')) (do maybe_monad [% (local_identifierP local_declaration) .let' [[local_declaration name] %] @@ -2567,13 +2605,13 @@ (case tokens (^ (list& candidate tokens')) (case candidate - [_ (#Bit it)] + [_ {#Bit it}] [tokens' candidate] - [_ (#Identifier ["" _])] + [_ {#Identifier ["" _]}] [tokens (` .private)] - [_ (#Identifier it)] + [_ {#Identifier it}] [tokens' candidate] _ @@ -2600,11 +2638,11 @@ (case tokens ... TB (^ (list& type body tokens')) - (#Some [tokens' [(#Some type) body]]) + {#Some [tokens' [{#Some type} body]]} ... B (^ (list& body tokens')) - (#Some [tokens' [#None body]]) + {#Some [tokens' [#None body]]} _ #None)) @@ -2621,7 +2659,7 @@ (macro:' .public (def: tokens) (case (definitionP tokens) - (#Some [export_policy name parameters ?type body]) + {#Some [export_policy name parameters ?type body]} (let [body (case parameters #End body @@ -2630,7 +2668,7 @@ (` (function ((~ (..local_identifier$ name)) (~+ parameters)) (~ body)))) body (case ?type - (#Some type) + {#Some type} (` (: (~ type) (~ body))) @@ -2655,7 +2693,7 @@ (macro:' .public (macro: tokens) (case (macroP tokens) - (#Some [export_policy name args body]) + {#Some [export_policy name args body]} (let [name (local_identifier$ name) body (case args #End @@ -2678,13 +2716,13 @@ #End #None - (#Item x xs') + {#Item x xs'} (case (f x) #None (list\one f xs') - (#Some y) - (#Some y)))) + {#Some y} + {#Some y}))) (template [<name> <form> <message>] [(macro: .public (<name> tokens) @@ -2712,17 +2750,17 @@ (macro: (maybe\else tokens state) (case tokens (^ (list else maybe)) - (let [g!temp (: Code [dummy_location (#Identifier ["" ""])]) + (let [g!temp (: Code [dummy_location {#Identifier ["" ""]}]) code (` (case (~ maybe) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.None (~ else)))] - (#Right [state (list code)])) + {#Right [state (list code)]}) _ - (#Left "Wrong syntax for maybe\else"))) + {#Left "Wrong syntax for maybe\else"})) (def: (text\all_split_by splitter input) (-> Text Text (List Text)) @@ -2730,7 +2768,7 @@ #None (list input) - (#Some idx) + {#Some idx} (list& ("lux text clip" 0 idx input) (text\all_split_by splitter (let [after_offset ("lux i64 +" 1 idx) @@ -2746,52 +2784,52 @@ #End #None - (#Item x xs') + {#Item x xs'} (if ("lux i64 =" 0 idx) - (#Some x) + {#Some x} (item ("lux i64 -" 1 idx) xs')))) ... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction (def: (reduced env type) (-> (List Type) Type Type) (case type - (#Sum left right) - (#Sum (reduced env left) (reduced env right)) + {#Sum left right} + {#Sum (reduced env left) (reduced env right)} - (#Product left right) - (#Product (reduced env left) (reduced env right)) + {#Product left right} + {#Product (reduced env left) (reduced env right)} - (#Apply arg func) - (#Apply (reduced env arg) (reduced env func)) + {#Apply arg func} + {#Apply (reduced env arg) (reduced env func)} - (#UnivQ ?local_env ?local_def) + {#UnivQ ?local_env ?local_def} (case ?local_env #End - (#UnivQ env ?local_def) + {#UnivQ env ?local_def} _ type) - (#ExQ ?local_env ?local_def) + {#ExQ ?local_env ?local_def} (case ?local_env #End - (#ExQ env ?local_def) + {#ExQ env ?local_def} _ type) - (#Function ?input ?output) - (#Function (reduced env ?input) (reduced env ?output)) + {#Function ?input ?output} + {#Function (reduced env ?input) (reduced env ?output)} - (#Parameter idx) + {#Parameter idx} (case (item idx env) - (#Some parameter) + {#Some parameter} parameter _ type) - (#Named name type) + {#Named name type} (reduced env type) _ @@ -2801,18 +2839,18 @@ (def: (applied_type param type_fn) (-> Type Type (Maybe Type)) (case type_fn - (#UnivQ env body) - (#Some (reduced (list& type_fn param env) body)) + {#UnivQ env body} + {#Some (reduced (list& type_fn param env) body)} - (#ExQ env body) - (#Some (reduced (list& type_fn param env) body)) + {#ExQ env body} + {#Some (reduced (list& type_fn param env) body)} - (#Apply A F) + {#Apply A F} (do maybe_monad [type_fn* (applied_type A F)] (applied_type param type_fn*)) - (#Named name type) + {#Named name type} (applied_type param type) _ @@ -2822,7 +2860,7 @@ [(def: (<name> type) (-> Type (List Type)) (case type - (<tag> left right) + {<tag> left right} (list& left (<name> right)) _ @@ -2836,9 +2874,9 @@ (def: (flat_application type) (-> Type [Type (List Type)]) (case type - (#Apply head func') + {#Apply head func'} (let [[func tail] (flat_application func')] - [func (#Item head tail)]) + [func {#Item head tail}]) _ [type (list)])) @@ -2846,28 +2884,28 @@ (def: (interface_methods type) (-> Type (Maybe (List Type))) (case type - (#Product _) - (#Some (flat_tuple type)) + {#Product _} + {#Some (flat_tuple type)} - (#Apply arg func) + {#Apply arg func} (do maybe_monad [output (applied_type arg func)] (interface_methods output)) - (#UnivQ _ body) + {#UnivQ _ body} (interface_methods body) - (#ExQ _ body) + {#ExQ _ body} (interface_methods body) - (#Named name type) + {#Named name type} (interface_methods type) - (#Sum _) + {#Sum _} #None _ - (#Some (list type)))) + {#Some (list type)})) (def: (module name) (-> Text (Meta Module)) @@ -2877,11 +2915,11 @@ #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] state] (case (plist\value name modules) - (#Some module) - (#Right state module) + {#Some module} + {#Right state module} _ - (#Left ($_ text\composite "Unknown module: " name)))))) + {#Left ($_ text\composite "Unknown module: " name)})))) (def: (type_slot [module name]) (-> Name (Meta [Nat (List Name) Bit Type])) @@ -2889,7 +2927,7 @@ [=module (..module module) .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module]] (case (plist\value (text\composite "#" name) definitions) - (#Some (#Slot [exported type group index])) + {#Some {#Slot [exported type group index]}} (in_meta [index (list\each (function (_ slot) [module slot]) @@ -2903,26 +2941,26 @@ (def: (record_slots type) (-> Type (Meta (Maybe [(List Name) (List Type)]))) (case type - (#Apply arg func) + {#Apply arg func} (record_slots func) - (#UnivQ env body) + {#UnivQ env body} (record_slots body) - (#ExQ env body) + {#ExQ env body} (record_slots body) - (#Named [module name] unnamed) + {#Named [module name] unnamed} (do meta_monad [=module (..module module) .let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module]] (case (plist\value name definitions) - (#Some (#Type [exported? (#Named _ _type) (#Right slots)])) + {#Some {#Type [exported? {#Named _ _type} {#Right slots}]}} (case (interface_methods _type) - (#Some members) - (in_meta (#Some [(list\each (function (_ slot) [module slot]) - (#Item slots)) - members])) + {#Some members} + (in_meta {#Some [(list\each (function (_ slot) [module slot]) + {#Item slots}) + members]}) _ (in_meta #None)) @@ -2941,16 +2979,16 @@ #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] state] (case expected - (#Some type) - (#Right state type) + {#Some type} + {#Right state type} #None - (#Left "Not expecting any type."))))) + {#Left "Not expecting any type."})))) (def: (type\encoded type) (-> Type Text) (case type - (#Primitive name params) + {#Primitive name params} (case params #End name @@ -2958,38 +2996,38 @@ _ ($_ text\composite "(" name " " (|> params (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")")) - (#Sum _) - ($_ text\composite "(Or " (|> (flat_variant type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") + {#Sum _} + ($_ text\composite "{" (|> (flat_variant type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) "}") - (#Product _) + {#Product _} ($_ text\composite "[" (|> (flat_tuple type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) "]") - (#Function _) + {#Function _} ($_ text\composite "(-> " (|> (flat_lambda type) (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")") - (#Parameter id) + {#Parameter id} (nat\encoded id) - (#Var id) + {#Var id} ($_ text\composite "⌈v:" (nat\encoded id) "⌋") - (#Ex id) + {#Ex id} ($_ text\composite "⟨e:" (nat\encoded id) "⟩") - (#UnivQ env body) + {#UnivQ env body} ($_ text\composite "(All " (type\encoded body) ")") - (#ExQ env body) + {#ExQ env body} ($_ text\composite "(Ex " (type\encoded body) ")") - (#Apply _) + {#Apply _} (let [[func args] (flat_application type)] ($_ text\composite "(" (type\encoded func) " " (|> args (list\each type\encoded) (list\interposed " ") list\reversed (list\mix text\composite "")) ")")) - (#Named name _) + {#Named name _} (name\encoded name) )) @@ -3000,7 +3038,7 @@ tags+type (record_slots struct_type) tags (: (Meta (List Name)) (case tags+type - (#Some [tags _]) + {#Some [tags _]} (in_meta tags) _ @@ -3014,9 +3052,9 @@ (: (-> Code (Meta (List Code))) (function (_ token) (case token - (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier ["" tag_name])] value export_policy))]) + (^ [_ {#Form (list [_ {#Text "lux def"}] [_ {#Identifier ["" tag_name]}] value export_policy)}]) (case (plist\value tag_name tag_mappings) - (#Some tag) + {#Some tag} (in (list tag value)) _ @@ -3033,7 +3071,7 @@ #End "" - (#Item head tail) + {#Item head tail} (list\mix (function (_ right left) ($_ text\composite left separator right)) head @@ -3046,7 +3084,7 @@ #None _ - (#Item tokens))) + {#Item tokens})) (def: (implementationP tokens) (-> (List Code) (Maybe [Code Text (List Code) Code (List Code)])) @@ -3060,7 +3098,7 @@ (macro: .public (implementation: tokens) (case (implementationP tokens) - (#Some [export_policy name args type definitions]) + {#Some [export_policy name args type definitions]} (let [usage (case args #End (local_identifier$ name) @@ -3085,12 +3123,12 @@ (-> (-> (List Code) (Maybe [(List Code) a])) (-> (List Code) (Maybe (List a))))) (case tokens - (#Item _) + {#Item _} (do maybe_monad [% (itP tokens) .let [[tokens' head] %] tail (case tokens' - (#Item _) + {#Item _} (everyP itP tokens') #End @@ -3098,27 +3136,27 @@ (in (list& head tail))) #End - (#Some (list)))) + {#Some (list)})) (def: (caseP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens - (^ (list& [_ (#Tag ["" niladic])] tokens')) - (#Some [tokens' [niladic (` .Any)]]) + (^ (list& [_ {#Tag ["" niladic]}] tokens')) + {#Some [tokens' [niladic (` .Any)]]} - (^ (list& [_ (#Form (list& [_ (#Tag ["" polyadic])] caseT))] tokens')) - (#Some [tokens' [polyadic (` (..Tuple (~+ caseT)))]]) + (^ (list& [_ {#Variant (list& [_ {#Tag ["" polyadic]}] caseT)}] tokens')) + {#Some [tokens' [polyadic (` (..Tuple (~+ caseT)))]]} _ #None)) (macro: .public (Variant tokens) (case (everyP caseP tokens) - (#Some cases) + {#Some cases} (in_meta (list (` (..Union (~+ (list\each product\right cases)))) - (form$ (list\each (function (_ case) - (text$ (product\left case))) - cases)))) + (variant$ (list\each (function (_ case) + (text$ (product\left case))) + cases)))) #None (failure "Wrong syntax for Variant"))) @@ -3126,17 +3164,17 @@ (def: (slotP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens - (^ (list& [_ (#Tag ["" slot])] type tokens')) - (#Some [tokens' [slot type]]) + (^ (list& [_ {#Tag ["" slot]}] type tokens')) + {#Some [tokens' [slot type]]} _ #None)) (macro: .public (Record tokens) (case tokens - (^ (list [_ (#Tuple record)])) + (^ (list [_ {#Tuple record}])) (case (everyP slotP record) - (#Some slots) + {#Some slots} (in_meta (list (` (..Tuple (~+ (list\each product\right slots)))) (tuple$ (list\each (function (_ slot) (text$ (product\left slot))) @@ -3161,30 +3199,30 @@ (def: (textP tokens) (-> (List Code) (Maybe [(List Code) Text])) (case tokens - (^ (list& [_ (#Text it)] tokens')) - (#Some [tokens' it]) + (^ (list& [_ {#Text it}] tokens')) + {#Some [tokens' it]} _ #None)) (def: (type_declaration it) (-> Code (Meta (Tuple Code (Maybe (Either (List Text) (List Text)))))) - ({[_ (#Form (#Item [_ (#Identifier declarer)] parameters))] + ({[_ {#Form {#Item [_ {#Identifier declarer}] parameters}}] (do meta_monad [declaration (single_expansion (form$ (list& (identifier$ declarer) parameters)))] (case declaration - (^ (list type [_ (#Form tags)])) + (^ (list type [_ {#Variant tags}])) (case (everyP textP tags) - (#Some tags) - (in_meta [type (#Some (#Left tags))]) + {#Some tags} + (in_meta [type {#Some {#Left tags}}]) #None (failure "Improper type-definition syntax")) - (^ (list type [_ (#Tuple slots)])) + (^ (list type [_ {#Tuple slots}])) (case (everyP textP slots) - (#Some slots) - (in_meta [type (#Some (#Right slots))]) + {#Some slots} + (in_meta [type {#Some {#Right slots}}]) #None (failure "Improper type-definition syntax")) @@ -3201,7 +3239,7 @@ (macro: .public (type: tokens) (case (typeP tokens) - (#Some [export_policy name args type_codes]) + {#Some [export_policy name args type_codes]} (do meta_monad [type+labels?? (..type_declaration type_codes) module_name current_module_name @@ -3210,30 +3248,27 @@ type' (: (Maybe Code) (case args #End - (#Some type) + {#Some type} _ - (#Some (` (.All ((~ type_name) (~+ (list\each local_identifier$ args))) - (~ type))))))]] + {#Some (` (.All ((~ type_name) (~+ (list\each local_identifier$ args))) + (~ type)))}))]] (case type' - (#Some type'') - (let [typeC (` (#.Named [(~ (text$ module_name)) + {#Some type''} + (let [typeC (` {#.Named [(~ (text$ module_name)) (~ (text$ name))] - (.type (~ type''))))] + (.type (~ type''))})] (in_meta (list (case labels?? - (#Some labels) - (case labels - (#Left tags) - (` ("lux def type tagged" (~ type_name) - (~ typeC) - ((~+ (list\each text$ tags))) - (~ export_policy))) - - (#Right slots) - (` ("lux def type tagged" (~ type_name) - (~ typeC) - [(~+ (list\each text$ slots))] - (~ export_policy)))) + {#Some labels} + (` ("lux def type tagged" (~ type_name) + (~ typeC) + (~ (case labels + {#Left tags} + (` {(~+ (list\each text$ tags))}) + + {#Right slots} + (` [(~+ (list\each text$ slots))]))) + (~ export_policy))) _ (` ("lux def" (~ type_name) @@ -3261,8 +3296,8 @@ (type: Referrals (Variant #All - (#Only (List Text)) - (#Exclude (List Text)) + {#Only (List Text)} + {#Exclude (List Text)} #Ignore #Nothing)) @@ -3286,7 +3321,7 @@ (: (-> Code (Meta Text)) (function (_ def) (case def - [_ (#Identifier ["" name])] + [_ {#Identifier ["" name]}] (in_meta name) _ @@ -3296,24 +3331,24 @@ (def: (referrals_parser tokens) (-> (List Code) (Meta [Referrals (List Code)])) (case tokens - (^or (^ (list& [_ (#Variant (list [_ (#Text "+")] [_ (#Tuple defs)]))] tokens')) - (^ (list& [_ (#Variant (list [_ (#Text "only")] [_ (#Tuple defs)]))] tokens'))) + (^or (^ (list& [_ {#Variant (list [_ {#Text "+"}] [_ {#Tuple defs}])}] tokens')) + (^ (list& [_ {#Variant (list [_ {#Text "only"}] [_ {#Tuple defs}])}] tokens'))) (do meta_monad [defs' (..referral_references defs)] - (in [(#Only defs') tokens'])) + (in [{#Only defs'} tokens'])) - (^or (^ (list& [_ (#Variant (list [_ (#Text "-")] [_ (#Tuple defs)]))] tokens')) - (^ (list& [_ (#Variant (list [_ (#Text "exclude")] [_ (#Tuple defs)]))] tokens'))) + (^or (^ (list& [_ {#Variant (list [_ {#Text "-"}] [_ {#Tuple defs}])}] tokens')) + (^ (list& [_ {#Variant (list [_ {#Text "exclude"}] [_ {#Tuple defs}])}] tokens'))) (do meta_monad [defs' (..referral_references defs)] - (in [(#Exclude defs') tokens'])) + (in [{#Exclude defs'} tokens'])) - (^or (^ (list& [_ (#Text "*")] tokens')) - (^ (list& [_ (#Text "all")] tokens'))) + (^or (^ (list& [_ {#Text "*"}] tokens')) + (^ (list& [_ {#Text "all"}] tokens'))) (in_meta [#All tokens']) - (^or (^ (list& [_ (#Text "_")] tokens')) - (^ (list& [_ (#Text "ignore")] tokens'))) + (^or (^ (list& [_ {#Text "_"}] tokens')) + (^ (list& [_ {#Text "ignore"}] tokens'))) (in_meta [#Ignore tokens']) _ @@ -3325,12 +3360,12 @@ #End (in_meta [#End #End]) - (^ (list& [_ (#Form (list& [_ (#Text prefix)] structs))] parts')) + (^ (list& [_ {#Form (list& [_ {#Text prefix}] structs)}] parts')) (do meta_monad [structs' (monad\each meta_monad (function (_ struct) (case struct - [_ (#Identifier ["" struct_name])] + [_ {#Identifier ["" struct_name]}] (in_meta struct_name) _ @@ -3338,7 +3373,7 @@ structs) next+remainder (openings_parser parts')] (let [[next remainder] next+remainder] - (in_meta [(#Item [prefix structs'] next) + (in_meta [{#Item [prefix structs'] next} remainder]))) _ @@ -3362,7 +3397,7 @@ ((: (-> Text Text Text) (function (recur left right) (case (..text\split_by pattern right) - (#Some [pre post]) + {#Some [pre post]} (recur ($_ "lux text concat" left pre replacement) post) #None @@ -3392,8 +3427,8 @@ (-> Text Text Text) (case [(text\split_by ..module_separator hierarchy) (text\split_by ..parallel_hierarchy_sigil root)] - [(#Some [_ hierarchy']) - (#Some ["" root'])] + [{#Some [_ hierarchy']} + {#Some ["" root']}] (normal_parallel_path' hierarchy' root') _ @@ -3404,8 +3439,8 @@ (def: (normal_parallel_path hierarchy root) (-> Text Text (Maybe Text)) (case (text\split_by ..parallel_hierarchy_sigil root) - (#Some ["" root']) - (#Some (normal_parallel_path' hierarchy root')) + {#Some ["" root']} + {#Some (normal_parallel_path' hierarchy root')} _ #None)) @@ -3416,7 +3451,7 @@ #None relatives - (#Some found) + {#Some found} (if ("lux i64 =" relatives found) (relative_ups ("lux i64 +" 1 relatives) input) relatives))) @@ -3427,7 +3462,7 @@ (^or [0 _] [_ #End]) list - [_ (#Item _ tail)] + [_ {#Item _ tail}] (list\after ("lux i64 -" 1 amount) tail))) (def: (absolute_module_name nested? relative_root module) @@ -3465,7 +3500,7 @@ (function (_ token) (case token ... Simple - [_ (#Identifier ["" module_name])] + [_ {#Identifier ["" module_name]}] (do meta_monad [absolute_module_name (..absolute_module_name nested? relative_root module_name)] (in (list [#import_name absolute_module_name @@ -3474,10 +3509,10 @@ #refer_open (list)]]))) ... Nested - (^ [_ (#Tuple (list& [_ (#Identifier ["" module_name])] extra))]) + (^ [_ {#Tuple (list& [_ {#Identifier ["" module_name]}] extra)}]) (do meta_monad [absolute_module_name (case (normal_parallel_path relative_root module_name) - (#Some parallel_path) + {#Some parallel_path} (in parallel_path) #None @@ -3498,10 +3533,10 @@ #refer_open openings]] sub_imports)))) - (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Identifier ["" module_name])] extra))]) + (^ [_ {#Tuple (list& [_ {#Text alias}] [_ {#Identifier ["" module_name]}] extra)}]) (do meta_monad [absolute_module_name (case (normal_parallel_path relative_root module_name) - (#Some parallel_path) + {#Some parallel_path} (in parallel_path) #None @@ -3510,15 +3545,15 @@ .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)] + 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_alias {#Some module_alias} #import_refer [#refer_defs referral #refer_open openings]] sub_imports)))) @@ -3542,38 +3577,38 @@ #scope_type_vars scope_type_vars #eval _eval] [current_module modules])] (case (plist\value module modules) - (#Some =module) + {#Some =module} (let [to_alias (list\each (: (-> [Text Global] (List Text)) (function (_ [name definition]) (case definition - (#Alias _) + {#Alias _} (list) - (#Definition [exported? def_type def_value]) + {#Definition [exported? def_type def_value]} (if exported? (list name) (list)) - (#Type [exported? type labels]) + {#Type [exported? type labels]} (if exported? (list name) (list)) - (#Label _) + {#Label _} (list) - (#Slot _) + {#Slot _} (list)))) (let [[#module_hash _ #module_aliases _ #definitions definitions #imports _ #module_state _] =module] definitions))] - (#Right state (list\conjoint to_alias))) + {#Right state (list\conjoint to_alias)}) #None - (#Left ($_ text\composite + {#Left ($_ text\composite "Unknown module: " (text\encoded module) ..\n "Current module: " (case current_module - (#Some current_module) + {#Some current_module} (text\encoded current_module) #None @@ -3582,7 +3617,7 @@ (list\each (function (_ [name module]) (text$ name))) tuple$ - code\encoded)))) + code\encoded))}) )) (def: (list\only p xs) @@ -3592,9 +3627,9 @@ #End (list) - (#Item x xs') + {#Item x xs'} (if (p x) - (#Item x (list\only p xs')) + {#Item x (list\only p xs')} (list\only p xs')))) (def: (is_member? cases name) @@ -3611,7 +3646,7 @@ (-> (-> a (Maybe b)) a a (Maybe b))) (case (f x1) #None (f x2) - (#Some y) (#Some y))) + {#Some y} {#Some y})) (def: (in_env name state) (-> Text Lux (Maybe Type)) @@ -3630,7 +3665,7 @@ (on_either (list\one (: (-> [Text [Type Any]] (Maybe Type)) (function (_ [bname [type _]]) (if (text\= name bname) - (#Some type) + {#Some type} #None)))) (: (List [Text [Type Any]]) locals) (: (List [Text [Type Any]]) closure))))) @@ -3647,26 +3682,26 @@ #None #None - (#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]) + {#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]} (case (plist\value v_name definitions) #None #None - (#Some definition) + {#Some definition} (case definition - (#Alias real_name) + {#Alias real_name} (definition_type real_name state) - (#Definition [exported? def_type def_value]) - (#Some def_type) + {#Definition [exported? def_type def_value]} + {#Some def_type} - (#Type [exported? type labels]) - (#Some ..Type) + {#Type [exported? type labels]} + {#Some ..Type} - (#Label _) + {#Label _} #None - (#Slot _) + {#Slot _} #None))))) (def: (definition_value name state) @@ -3678,29 +3713,29 @@ #scope_type_vars scope_type_vars #eval _eval] state] (case (plist\value v_module modules) #None - (#Left (text\composite "Unknown definition: " (name\encoded name))) + {#Left (text\composite "Unknown definition: " (name\encoded name))} - (#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]) + {#Some [#definitions definitions #module_hash _ #module_aliases _ #imports _ #module_state _]} (case (plist\value v_name definitions) #None - (#Left (text\composite "Unknown definition: " (name\encoded name))) + {#Left (text\composite "Unknown definition: " (name\encoded name))} - (#Some definition) + {#Some definition} (case definition - (#Alias real_name) + {#Alias real_name} (definition_value real_name state) - (#Definition [exported? def_type def_value]) - (#Right [state [def_type def_value]]) + {#Definition [exported? def_type def_value]} + {#Right [state [def_type def_value]]} - (#Type [exported? type labels]) - (#Right [state [..Type type]]) + {#Type [exported? type labels]} + {#Right [state [..Type type]]} - (#Label _) - (#Left (text\composite "Unknown definition: " (name\encoded name))) + {#Label _} + {#Left (text\composite "Unknown definition: " (name\encoded name))} - (#Slot _) - (#Left (text\composite "Unknown definition: " (name\encoded name)))))))) + {#Slot _} + {#Left (text\composite "Unknown definition: " (name\encoded name))}))))) (def: (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) @@ -3708,7 +3743,7 @@ #End #End - (#Item [var bound] bindings') + {#Item [var bound] bindings'} (if ("lux i64 =" idx var) bound (type_variable idx bindings')))) @@ -3721,24 +3756,24 @@ (function (_ compiler) (let [temp (if (text\= "" module) (case (in_env name compiler) - (#Some struct_type) - (#Right [compiler struct_type]) + {#Some struct_type} + {#Right [compiler struct_type]} _ (case (definition_type [current_module name] compiler) - (#Some struct_type) - (#Right [compiler struct_type]) + {#Some struct_type} + {#Right [compiler struct_type]} _ - (#Left ($_ text\composite "Unknown var: " (name\encoded full_name))))) + {#Left ($_ text\composite "Unknown var: " (name\encoded full_name))})) (case (definition_type full_name compiler) - (#Some struct_type) - (#Right [compiler struct_type]) + {#Some struct_type} + {#Right [compiler struct_type]} _ - (#Left ($_ text\composite "Unknown var: " (name\encoded full_name)))))] + {#Left ($_ text\composite "Unknown var: " (name\encoded full_name))}))] (case temp - (#Right [compiler (#Var type_id)]) + {#Right [compiler {#Var type_id}]} (let [[#info _ #source _ #current_module _ #modules _ #scopes _ #type_context type_context #host _ #seed _ #expected _ #location _ #extensions extensions @@ -3748,8 +3783,8 @@ #None temp - (#Some actualT) - (#Right [compiler actualT]))) + {#Some actualT} + {#Right [compiler actualT]})) _ temp)) @@ -3759,9 +3794,9 @@ (All (_ a b) (-> (List a) (List b) (List [a b]))) (case xs - (#Item x xs') + {#Item x xs'} (case ys - (#Item y ys') + {#Item y ys'} (list& [x y] (zipped/2 xs' ys')) _ @@ -3772,12 +3807,12 @@ (macro: .public (^open tokens) (case tokens - (^ (list& [_ (#Form (list [_ (#Text alias)]))] body branches)) + (^ (list& [_ {#Form (list [_ {#Text alias}])}] body branches)) (do meta_monad [g!temp (..identifier "temp")] (in (list& g!temp (` (..^open (~ g!temp) (~ (text$ alias)) (~ body))) branches))) - (^ (list [_ (#Identifier name)] [_ (#Text alias)] body)) + (^ (list [_ {#Identifier name}] [_ {#Text alias}] body)) (do meta_monad [init_type (type_definition name) struct_evidence (record_slots init_type)] @@ -3785,7 +3820,7 @@ #None (failure (text\composite "Can only 'open' structs: " (type\encoded init_type))) - (#Some tags&members) + {#Some tags&members} (do meta_monad [full_body ((: (-> Name [(List Name) (List Type)] Code (Meta Code)) (function (recur source [tags members] target) @@ -3799,7 +3834,7 @@ (do meta_monad [m_implementation (record_slots m_type)] (case m_implementation - (#Some m_tags&members) + {#Some m_tags&members} (recur m_local m_tags&members enhanced_target) @@ -3834,8 +3869,8 @@ (All (_ a) (-> Nat (List a) (List [Nat a]))) (case xs - (#Item x xs') - (#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')) + {#Item x xs'} + {#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')} #End #End)) @@ -3847,7 +3882,7 @@ (macro: .public (value@ tokens) (case tokens - (^ (list [_ (#Tag slot')] record)) + (^ (list [_ {#Tag slot'}] record)) (do meta_monad [slot (normal slot') output (..type_slot slot) @@ -3855,7 +3890,7 @@ g!_ (..identifier "_") g!output (..identifier "")] (case (interface_methods type) - (#Some members) + {#Some members} (let [pattern (|> (zipped/2 tags (enumeration members)) (list\each (: (-> [Name [Nat Type]] (List Code)) (function (_ [[r_module r_name] [r_idx r_type]]) @@ -3870,7 +3905,7 @@ _ (failure "value@ can only use records."))) - (^ (list [_ (#Tuple slots)] record)) + (^ (list [_ {#Tuple slots}] record)) (in_meta (list (list\mix (: (-> Code Code Code) (function (_ slot inner) (` (..value@ (~ slot) (~ inner))))) @@ -3901,7 +3936,7 @@ tuple$) source+ (` ({(~ pattern) (~ g!output)} (~ source)))]] (case output - (#Some [tags' members']) + {#Some [tags' members']} (do meta_monad [decls' (monad\each meta_monad (: (-> [Nat Name Type] (Meta (List Code))) @@ -3917,15 +3952,15 @@ (macro: .public (open: tokens) (case tokens - (^ (list [_ (#Text alias)] struct)) + (^ (list [_ {#Text alias}] struct)) (case struct - [_ (#Identifier struct_name)] + [_ {#Identifier struct_name}] (do meta_monad [struct_type (type_definition struct_name) output (record_slots struct_type) .let [source (identifier$ struct_name)]] (case output - (#Some [tags members]) + {#Some [tags members]} (do meta_monad [decls' (monad\each meta_monad (: (-> [Nat Name Type] (Meta (List Code))) (function (_ [tag_index sname stype]) @@ -4001,13 +4036,13 @@ #All (exported_definitions module_name) - (#Only +defs) + {#Only +defs} (do meta_monad [*defs (exported_definitions module_name) _ (test_referrals module_name *defs +defs)] (in +defs)) - (#Exclude _defs) + {#Exclude _defs} (do meta_monad [*defs (exported_definitions module_name) _ (test_referrals module_name *defs _defs)] @@ -4033,7 +4068,7 @@ (macro: (refer tokens) (case tokens - (^ (list& [_ (#Text module_name)] options)) + (^ (list& [_ {#Text module_name}] options)) (do meta_monad [=refer (referrals module_name options)] (referral_definitions module_name =refer)) @@ -4049,10 +4084,10 @@ #All (list (' "*")) - (#Only defs) + {#Only defs} (list (variant$ (list (' "+") (tuple$ (list\each local_identifier$ defs))))) - (#Exclude defs) + {#Exclude defs} (list (variant$ (list (' "-") (tuple$ (list\each local_identifier$ defs))))) #Ignore @@ -4082,11 +4117,11 @@ (refer_code module_name m_alias =refer))) imports) =module (` ("lux def module" (~ =imports)))]] - (in (#Item =module =refers)))) + (in {#Item =module =refers}))) (macro: .public (\ tokens) (case tokens - (^ (list struct [_ (#Identifier member)])) + (^ (list struct [_ {#Identifier member}])) (in_meta (list (` (let [(^open (~ (text$ (alias_stand_in 0)))) (~ struct)] (~ (identifier$ member)))))) (^ (list& struct member args)) @@ -4097,13 +4132,13 @@ (macro: .public (with@ tokens) (case tokens - (^ (list [_ (#Tag slot')] value record)) + (^ (list [_ {#Tag slot'}] value record)) (do meta_monad [slot (normal slot') output (..type_slot slot) .let [[idx tags exported? type] output]] (case (interface_methods type) - (#Some members) + {#Some members} (do meta_monad [pattern' (monad\each meta_monad (: (-> [Name [Nat Type]] (Meta [Name Nat Code])) @@ -4133,7 +4168,7 @@ _ (failure "with@ can only use records."))) - (^ (list [_ (#Tuple slots)] value record)) + (^ (list [_ {#Tuple slots}] value record)) (case slots #End (failure "Wrong syntax for with@") @@ -4153,7 +4188,7 @@ [_ accesses'] (list\mix (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) (function (_ [new_slot new_binding] [old_record accesses']) [(` (value@ (~ new_slot) (~ new_binding))) - (#Item (list new_binding old_record) accesses')])) + {#Item (list new_binding old_record) accesses'}])) [record (: (List (List Code)) #End)] pairs) accesses (list\conjoint (list\reversed accesses'))]] @@ -4180,13 +4215,13 @@ (macro: .public (revised@ tokens) (case tokens - (^ (list [_ (#Tag slot')] fun record)) + (^ (list [_ {#Tag slot'}] fun record)) (do meta_monad [slot (normal slot') output (..type_slot slot) .let [[idx tags exported? type] output]] (case (interface_methods type) - (#Some members) + {#Some members} (do meta_monad [pattern' (monad\each meta_monad (: (-> [Name [Nat Type]] (Meta [Name Nat Code])) @@ -4216,7 +4251,7 @@ _ (failure "revised@ can only use records."))) - (^ (list [_ (#Tuple slots)] fun record)) + (^ (list [_ {#Tuple slots}] fun record)) (case slots #End (failure "Wrong syntax for revised@") @@ -4249,9 +4284,9 @@ (macro: .public (^template tokens) (case tokens - (^ (list& [_ (#Form (list [_ (#Tuple bindings)] - [_ (#Tuple templates)]))] - [_ (#Form data)] + (^ (list& [_ {#Form (list [_ {#Tuple bindings}] + [_ {#Tuple templates}])}] + [_ {#Form data}] branches)) (case (: (Maybe (List Code)) (do maybe_monad @@ -4267,7 +4302,7 @@ list\conjoint in)) #None)))) - (#Some output) + {#Some output} (in_meta (list\composite output branches)) #None @@ -4293,57 +4328,57 @@ #End #End - (#Item x xs') + {#Item x xs'} (case ys #End #End - (#Item y ys') + {#Item y ys'} (list& x y (interleaved xs' ys'))))) (def: (type_code type) (-> Type Code) (case type - (#Primitive name params) - (` (#.Primitive (~ (text$ name)) (~ (untemplated_list (list\each type_code params))))) + {#Primitive name params} + (` {#.Primitive (~ (text$ name)) (~ (untemplated_list (list\each type_code params)))}) (^template [<tag>] - [(<tag> left right) - (` (<tag> (~ (type_code left)) (~ (type_code right))))]) + [{<tag> left right} + (` {<tag> (~ (type_code left)) (~ (type_code right))})]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) (^template [<tag>] - [(<tag> id) - (` (<tag> (~ (nat$ id))))]) + [{<tag> id} + (` {<tag> (~ (nat$ id))})]) ([#.Parameter] [#.Var] [#.Ex]) (^template [<tag>] - [(<tag> env type) + [{<tag> env type} (let [env' (untemplated_list (list\each type_code env))] - (` (<tag> (~ env') (~ (type_code type)))))]) + (` {<tag> (~ env') (~ (type_code type))}))]) ([#.UnivQ] [#.ExQ]) - (#Named [module name] anonymous) + {#Named [module name] anonymous} ... TODO: Generate the explicit type definition instead of using ... the "identifier$" shortcut below. - ... (` (#.Named [(~ (text$ module)) (~ (text$ name))] - ... (~ (type_code anonymous)))) + ... (` {#.Named [(~ (text$ module)) (~ (text$ name))] + ... (~ (type_code anonymous))}) (identifier$ [module name]))) (macro: .public (loop tokens) (let [?params (case tokens - (^ (list name [_ (#Tuple bindings)] body)) - (#Some [name bindings body]) + (^ (list name [_ {#Tuple bindings}] body)) + {#Some [name bindings body]} - (^ (list [_ (#Tuple bindings)] body)) - (#Some [(local_identifier$ "recur") bindings body]) + (^ (list [_ {#Tuple bindings}] body)) + {#Some [(local_identifier$ "recur") bindings body]} _ #None)] (case ?params - (#Some [name bindings body]) + {#Some [name bindings body]} (let [pairs (pairs bindings) vars (list\each product\left pairs) inits (list\each product\right pairs)] @@ -4351,7 +4386,7 @@ (do meta_monad [inits' (: (Meta (List Name)) (case (monad\each maybe_monad identifier_name inits) - (#Some inits') (in_meta inits') + {#Some inits'} (in_meta inits') #None (failure "Wrong syntax for loop"))) init_types (monad\each meta_monad type_definition inits') expected ..expected_type] @@ -4376,7 +4411,7 @@ (macro: .public (^slots tokens) (case tokens - (^ (list& [_ (#Form (list [_ (#Tuple (list& hslot' tslots'))]))] body branches)) + (^ (list& [_ {#Form (list [_ {#Tuple (list& hslot' tslots')}])}] body branches)) (do meta_monad [slots (: (Meta [Name (List Name)]) (case (: (Maybe [Name (List Name)]) @@ -4384,7 +4419,7 @@ [hslot (..tag_name hslot') tslots (monad\each maybe_monad ..tag_name tslots')] (in [hslot tslots]))) - (#Some slots) + {#Some slots} (in_meta slots) #None @@ -4404,7 +4439,7 @@ (function (_ [module name]) (let [tag (tag$ [module name])] (case (plist\value name slot_pairings) - (#Some binding) (list tag binding) + {#Some binding} (list tag binding) #None (list tag g!_)))))) list\conjoint tuple$)]] @@ -4416,27 +4451,27 @@ (def: (with_expansions' label tokens target) (-> Text (List Code) Code (List Code)) (case target - (^or [_ (#Bit _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Rev _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) + (^or [_ {#Bit _}] [_ {#Nat _}] [_ {#Int _}] [_ {#Rev _}] [_ {#Frac _}] [_ {#Text _}] [_ {#Tag _}]) (list target) - [_ (#Identifier [module name])] + [_ {#Identifier [module name]}] (if (and (text\= "" module) (text\= label name)) tokens (list target)) (^template [<tag>] - [[location (<tag> elems)] - (list [location (<tag> (list\conjoint (list\each (with_expansions' label tokens) elems)))])]) + [[location {<tag> elems}] + (list [location {<tag> (list\conjoint (list\each (with_expansions' label tokens) elems))}])]) ([#Form] [#Variant] [#Tuple]))) (macro: .public (with_expansions tokens) (case tokens - (^ (list& [_ (#Tuple bindings)] bodies)) + (^ (list& [_ {#Tuple bindings}] bodies)) (case bindings - (^ (list& [_ (#Identifier ["" var_name])] expr bindings')) + (^ (list& [_ {#Identifier ["" var_name]}] expr bindings')) (do meta_monad [expansion (single_expansion expr)] (in (with_expansions' var_name expansion @@ -4457,7 +4492,7 @@ (-> Type Type) (case type (^template [<name>] - [(#Named ["library/lux" <name>] _) + [{#Named ["library/lux" <name>] _} type]) (["Bit"] ["Nat"] @@ -4466,7 +4501,7 @@ ["Frac"] ["Text"]) - (#Named _ type') + {#Named _ type'} (flat_alias type') _ @@ -4479,7 +4514,7 @@ .let [[type value] type+value]] (case (flat_alias type) (^template [<name> <type> <wrapper>] - [(#Named ["library/lux" <name>] _) + [{#Named ["library/lux" <name>] _} (in (<wrapper> (:as <type> value)))]) (["Bit" Bit bit$] ["Nat" Nat nat$] @@ -4494,7 +4529,7 @@ (def: (static_literal token) (-> Code (Meta Code)) (case token - [_ (#Identifier [def_module def_name])] + [_ {#Identifier [def_module def_name]}] (if (text\= "" def_module) (do meta_monad [current_module current_module_name] @@ -4502,10 +4537,10 @@ (static_simple_literal [def_module def_name])) (^template [<tag>] - [[meta (<tag> parts)] + [[meta {<tag> parts}] (do meta_monad [=parts (monad\each meta_monad static_literal parts)] - (in [meta (<tag> =parts)]))]) + (in [meta {<tag> =parts}]))]) ([#Form] [#Variant] [#Tuple]) @@ -4532,7 +4567,7 @@ (def: (case_level^ level) (-> Code (Meta [Code Code])) (case level - (^ [_ (#Tuple (list expr binding))]) + (^ [_ {#Tuple (list expr binding)}]) (in_meta [expr binding]) _ @@ -4545,7 +4580,7 @@ #End (failure "Multi-level patterns cannot be empty.") - (#Item init extras) + {#Item init extras} (do meta_monad [extras' (monad\each meta_monad case_level^ extras)] (in [init extras'])))) @@ -4554,7 +4589,7 @@ (-> Code [Multi_Level_Case Code] (List Code)) (let [inner_pattern_body (list\mix (function (_ [calculation pattern] success) (let [bind? (case pattern - [_ (#Identifier _)] + [_ {#Identifier _}] #1 _ @@ -4566,17 +4601,17 @@ (~+ (if bind? (list) (list g!_ (` #.None)))))))) - (` (#.Some (~ body))) + (` {#.Some (~ body)}) (: (List [Code Code]) (list\reversed levels)))] (list init_pattern inner_pattern_body))) (macro: .public (^multi tokens) (case tokens - (^ (list& [_meta (#Form levels)] body next_branches)) + (^ (list& [_meta {#Form levels}] body next_branches)) (do meta_monad [mlc (multi_level_case^ levels) .let [initial_bind? (case mlc - [[_ (#Identifier _)] _] + [[_ {#Identifier _}] _] #1 _ @@ -4584,13 +4619,13 @@ expected ..expected_type g!temp (..identifier "temp")] (let [output (list g!temp - (` ({(#Some (~ g!temp)) + (` ({{#Some (~ g!temp)} (~ g!temp) #None (case (~ g!temp) (~+ next_branches))} - ("lux type check" (#.Apply (~ (type_code expected)) Maybe) + ("lux type check" {#.Apply (~ (type_code expected)) Maybe} (case (~ g!temp) (~+ (multi_level_case$ g!temp [mlc body])) @@ -4613,9 +4648,10 @@ (macro: .public (name_of tokens) (case tokens (^template [<tag>] - [(^ (list [_ (<tag> [module name])])) + [(^ (list [_ {<tag> [module name]}])) (in_meta (list (` [(~ (text$ module)) (~ (text$ name))])))]) - ([#Identifier] [#Tag]) + ([#Identifier] + [#Tag]) _ (failure (..wrong_syntax_error [..prelude_module "name_of"])))) @@ -4627,16 +4663,16 @@ #scopes scopes #type_context types #host host #seed seed #expected expected #location location #extensions extensions #scope_type_vars scope_type_vars #eval _eval] - (#Right [state scope_type_vars]))) + {#Right [state scope_type_vars]})) (macro: .public (:parameter tokens) (case tokens - (^ (list [_ (#Nat idx)])) + (^ (list [_ {#Nat idx}])) (do meta_monad [stvs ..scope_type_vars] (case (..item idx (list\reversed stvs)) - (#Some var_id) - (in (list (` (#Ex (~ (nat$ var_id)))))) + {#Some var_id} + (in (list (` {#Ex (~ (nat$ var_id))}))) #None (failure (text\composite "Indexed-type does not exist: " (nat\encoded idx))))) @@ -4651,7 +4687,7 @@ (macro: .public (^@ tokens) (case tokens - (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] pattern))] body branches)) + (^ (list& [_meta {#Form (list [_ {#Identifier ["" name]}] pattern)}] body branches)) (let [g!whole (local_identifier$ name)] (in_meta (list& g!whole (` (case (~ g!whole) (~ pattern) (~ body))) @@ -4662,7 +4698,7 @@ (macro: .public (^|> tokens) (case tokens - (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] [_ (#Tuple steps)]))] body branches)) + (^ (list& [_meta {#Form (list [_ {#Identifier ["" name]}] [_ {#Tuple steps}])}] body branches)) (let [g!name (local_identifier$ name)] (in_meta (list& g!name (` (let [(~ g!name) (|> (~ g!name) (~+ steps))] @@ -4685,7 +4721,7 @@ (def: location (Meta Location) (function (_ compiler) - (#Right [compiler (value@ #location compiler)]))) + {#Right [compiler (value@ #location compiler)]})) (macro: .public (undefined tokens) (case tokens @@ -4702,7 +4738,7 @@ (macro: .public (:of tokens) (case tokens - (^ (list [_ (#Identifier var_name)])) + (^ (list [_ {#Identifier var_name}])) (do meta_monad [var_type (type_definition var_name)] (in (list (type_code var_type)))) @@ -4719,8 +4755,8 @@ (def: (tupleP tokens) (-> (List Code) (Maybe [(List Code) (List Code)])) (case tokens - (^ (list& [_ (#Tuple tuple)] tokens')) - (#Some [tokens' tuple]) + (^ (list& [_ {#Tuple tuple}] tokens')) + {#Some [tokens' tuple]} _ #None)) @@ -4737,7 +4773,7 @@ (macro: .public (template: tokens) (case (templateP tokens) - (#Some [export_policy name args input_templates]) + {#Some [export_policy name args input_templates]} (do meta_monad [g!tokens (..identifier "tokens") g!compiler (..identifier "compiler") @@ -4750,51 +4786,51 @@ ((~ (local_identifier$ name)) (~ g!tokens) (~ g!compiler)) (case (~ g!tokens) (^ (list (~+ (list\each local_identifier$ args)))) - (#.Right [(~ g!compiler) + {#.Right [(~ g!compiler) (list (~+ (list\each (function (_ template) (` (`' (~ (with_replacements rep_env template))))) - input_templates)))]) + input_templates)))]} (~ g!_) - (#.Left (~ (text$ (..wrong_syntax_error [this_module name])))))))))) + {#.Left (~ (text$ (..wrong_syntax_error [this_module name])))})))))) #None (failure (..wrong_syntax_error (name_of ..template:))))) (macro: .public (as_is tokens compiler) - (#Right [compiler tokens])) + {#Right [compiler tokens]}) (macro: .public (char tokens compiler) (case tokens - (^multi (^ (list [_ (#Text input)])) + (^multi (^ (list [_ {#Text input}])) (|> input "lux text size" ("lux i64 =" 1))) (|> input ("lux text char" 0) nat$ list [compiler] #Right) _ - (#Left (..wrong_syntax_error (name_of ..char))))) + {#Left (..wrong_syntax_error (name_of ..char))})) (def: target (Meta Text) (function (_ compiler) - (#Right [compiler (value@ [#info #target] compiler)]))) + {#Right [compiler (value@ [#info #target] compiler)]})) (def: (platform_name choice) (-> Code (Meta Text)) (case choice - [_ (#Text platform)] + [_ {#Text platform}] (..in_meta platform) - [_ (#Identifier identifier)] + [_ {#Identifier identifier}] (do meta_monad [identifier (..global_identifier identifier) type+value (..definition_value identifier) .let [[type value] type+value]] (case (..flat_alias type) - (^or (#Primitive "#Text" #End) - (#Named ["library/lux" "Text"] (#Primitive "#Text" #End))) + (^or {#Primitive "#Text" #End} + {#Named ["library/lux" "Text"] {#Primitive "#Text" #End}}) (in (:as ..Text value)) _ @@ -4815,10 +4851,10 @@ #None (failure ($_ text\composite "No code for target platform: " target)) - (#Some default) + {#Some default} (in_meta (list default))) - (#Item [key pick] options') + {#Item [key pick] options'} (do meta_monad [platform (..platform_name key)] (if (text\= target platform) @@ -4831,25 +4867,25 @@ list\size (n/% 2) ("lux i64 =" 0)) - (#Some (pairs tokens)) + {#Some (pairs tokens)} #None)) (macro: .public (for tokens) (do meta_monad [target ..target] (case tokens - (^ (list [_ (#Tuple options)])) + (^ (list [_ {#Tuple options}])) (case (pairs' options) - (#Some options) + {#Some options} (target_pick target options #None) #None (failure (..wrong_syntax_error (name_of ..for)))) - (^ (list [_ (#Tuple options)] default)) + (^ (list [_ {#Tuple options}] default)) (case (pairs' options) - (#Some options) - (target_pick target options (#Some default)) + {#Some options} + (target_pick target options {#Some default}) #None (failure (..wrong_syntax_error (name_of ..for)))) @@ -4860,17 +4896,17 @@ (def: (embedded_expansions code) (-> Code (Meta [(List [Code Code]) Code])) (case code - (^ [ann (#Form (list [_ (#Identifier ["" "~~"])] expansion))]) + (^ [ann {#Form (list [_ {#Identifier ["" "~~"]}] expansion)}]) (do meta_monad [g!expansion (..identifier "g!expansion")] (in [(list [g!expansion expansion]) g!expansion])) (^template [<tag>] - [[ann (<tag> parts)] + [[ann {<tag> parts}] (do meta_monad [=parts (monad\each meta_monad embedded_expansions parts)] (in [(list\mix list\composite (list) (list\each product\left =parts)) - [ann (<tag> (list\each product\right =parts))]]))]) + [ann {<tag> (list\each product\right =parts)}]]))]) ([#Form] [#Variant] [#Tuple]) @@ -4902,24 +4938,24 @@ #End last - (#Item [init inits']) - (` (#.Item (~ init) (~ (untemplated_list& last inits')))))) + {#Item [init inits']} + (` {#.Item (~ init) (~ (untemplated_list& last inits'))}))) (template [<tag> <name>] [(def: (<name> g!meta untemplated_pattern elems) (-> Code (-> Code (Meta Code)) (-> (List Code) (Meta Code))) (case (list\reversed elems) - (#Item [_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] - inits) + {#Item [_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced #End]}]}}] + inits} (do meta_monad [=inits (monad\each meta_monad untemplated_pattern (list\reversed inits))] - (in (` [(~ g!meta) (<tag> (~ (untemplated_list& spliced =inits)))]))) + (in (` [(~ g!meta) {<tag> (~ (untemplated_list& spliced =inits))}]))) _ (do meta_monad [=elems (monad\each meta_monad untemplated_pattern elems)] - (in (` [(~ g!meta) (<tag> (~ (untemplated_list =elems)))])))))] + (in (` [(~ g!meta) {<tag> (~ (untemplated_list =elems))}])))))] [#.Form untemplated_form] [#.Tuple untemplated_tuple] @@ -4932,8 +4968,8 @@ [g!meta (..identifier "g!meta")] (case pattern (^template [<tag> <gen>] - [[_ (<tag> value)] - (in (` [(~ g!meta) (<tag> (~ (<gen> value)))]))]) + [[_ {<tag> value}] + (in (` [(~ g!meta) {<tag> (~ (<gen> value))}]))]) ([#.Bit bit$] [#.Nat nat$] [#.Int int$] @@ -4943,14 +4979,14 @@ [#.Tag name$] [#.Identifier name$]) - [_ (#Form (#Item [[_ (#Identifier ["" "~"])] (#Item [unquoted #End])]))] + [_ {#Form {#Item [[_ {#Identifier ["" "~"]}] {#Item [unquoted #End]}]}}] (in_meta unquoted) - [_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))] + [_ {#Form {#Item [[_ {#Identifier ["" "~+"]}] {#Item [spliced #End]}]}}] (failure "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.") (^template [<tag> <untemplated>] - [[_ (<tag> elems)] + [[_ {<tag> elems}] (<untemplated> g!meta untemplated_pattern elems)]) ([#Form ..untemplated_form] [#Variant ..untemplated_variant] @@ -4959,7 +4995,7 @@ (macro: .public (^code tokens) (case tokens - (^ (list& [_meta (#Form (list template))] body branches)) + (^ (list& [_meta {#Form (list template)}] body branches)) (do meta_monad [pattern (untemplated_pattern template)] (in (list& pattern body branches))) @@ -4982,7 +5018,7 @@ (macro: .public (:let tokens) (case tokens - (^ (list [_ (#Tuple bindings)] bodyT)) + (^ (list [_ {#Tuple bindings}] bodyT)) (if (multiple? 2 (list\size bindings)) (in_meta (list (` (..with_expansions [(~+ (|> bindings ..pairs @@ -5010,9 +5046,9 @@ (def: (methodP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (case tokens - (^ (list& [_ (#Form (list [_ (#Text "lux type check")] type [_ (#Identifier ["" name])]))] + (^ (list& [_ {#Form (list [_ {#Text "lux type check"}] type [_ {#Identifier ["" name]}])}] tokens')) - (#Some [tokens' [name type]]) + {#Some [tokens' [name type]]} _ #None)) @@ -5021,7 +5057,7 @@ (do meta_monad [methods' (monad\each meta_monad expansion tokens)] (case (everyP methodP (list\conjoint methods')) - (#Some methods) + {#Some methods} (in (list (` (..Tuple (~+ (list\each product\right methods)))) (tuple$ (list\each (|>> product\left text$) methods)))) @@ -5031,13 +5067,13 @@ (def: (recursive_type g!self g!dummy name body) (-> Code Code Text Code Code) (` ((.All ((~ g!self) (~ g!dummy)) - (~ (let$ (local_identifier$ name) (` (#.Apply (..primitive "") (~ g!self))) + (~ (let$ (local_identifier$ name) (` {#.Apply (..primitive "") (~ g!self)}) body))) (..primitive "")))) (macro: .public (Rec tokens) (case tokens - (^ (list [_ (#Identifier "" name)] body)) + (^ (list [_ {#Identifier "" name}] body)) (do meta_monad [body' (expansion body) g!self (identifier "g!self") diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux index b4dd60a68..20e24bcb5 100644 --- a/stdlib/source/library/lux/abstract/comonad.lux +++ b/stdlib/source/library/lux/abstract/comonad.lux @@ -26,15 +26,15 @@ (macro: .public (be tokens state) (case (: (Maybe [(Maybe Text) Code (List Code) Code]) (case tokens - (^ (list [_ (#.Tuple (list [_ (#.Identifier ["" name])] comonad))] [_ (#.Tuple bindings)] body)) - (#.Some [(#.Some name) comonad bindings body]) + (^ (list [_ {#.Tuple (list [_ {#.Identifier ["" name]}] comonad)}] [_ {#.Tuple bindings}] body)) + {#.Some [{#.Some name} comonad bindings body]} - (^ (list comonad [_ (#.Tuple bindings)] body)) - (#.Some [#.None comonad bindings body]) + (^ (list comonad [_ {#.Tuple bindings}] body)) + {#.Some [#.None comonad bindings body]} _ #.None)) - (#.Some [?name comonad bindings body]) + {#.Some [?name comonad bindings body]} (if (|> bindings list.size (n.% 2) (n.= 0)) (let [[module short] (name_of ..be) identifier (: (-> Text Code) @@ -47,19 +47,19 @@ (with_expansions [<default> (` (|> (~ value) (~ g!disjoint) ((~ g!each) (function ((~ g!_) (~ var)) (~ body')))))] (let [[var value] binding] (case var - [_ (#.Identifier ["" _])] + [_ {#.Identifier ["" _]}] <default> - [_ (#.Identifier _)] + [_ {#.Identifier _}] (` ((~ var) (~ value) (~ body'))) _ <default>))))) body (list.reversed (list.pairs bindings)))] - (#.Right [state (list (case ?name - (#.Some name) - (let [name [location.dummy (#.Identifier ["" name])]] + {#.Right [state (list (case ?name + {#.Some name} + (let [name [location.dummy {#.Identifier ["" name]}]] (` (.case (~ comonad) (~ name) (.case (~ name) @@ -69,8 +69,8 @@ #.None (` (.case (~ comonad) [(~ g!each) (~' out) (~ g!disjoint)] - (~ body')))))])) - (#.Left "'be' bindings must have an even number of parts.")) + (~ body')))))]}) + {#.Left "'be' bindings must have an even number of parts."}) #.None - (#.Left "Wrong syntax for 'be'"))) + {#.Left "Wrong syntax for 'be'"})) diff --git a/stdlib/source/library/lux/abstract/enum.lux b/stdlib/source/library/lux/abstract/enum.lux index 390bd9956..c78a0711f 100644 --- a/stdlib/source/library/lux/abstract/enum.lux +++ b/stdlib/source/library/lux/abstract/enum.lux @@ -16,10 +16,10 @@ (loop [end to output #.End] (cond (< end from) - (recur (pred end) (#.Item end output)) + (recur (pred end) {#.Item end output}) (< from end) - (recur (succ end) (#.Item end output)) + (recur (succ end) {#.Item end output}) ... (= end from) - (#.Item end output))))) + {#.Item end output})))) diff --git a/stdlib/source/library/lux/abstract/functor.lux b/stdlib/source/library/lux/abstract/functor.lux index c72ae415b..5b7b4d3f1 100644 --- a/stdlib/source/library/lux/abstract/functor.lux +++ b/stdlib/source/library/lux/abstract/functor.lux @@ -20,11 +20,11 @@ (implementation (def: (each f fa|ga) (case fa|ga - (#.Left fa) - (#.Left (f\each f fa)) + {#.Left fa} + {#.Left (f\each f fa)} - (#.Right ga) - (#.Right (g\each f ga)))))) + {#.Right ga} + {#.Right (g\each f ga)})))) (type: .public (And f g) (All (_ a) (.And (f a) (g a)))) diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux index 98baec35e..c915945a1 100644 --- a/stdlib/source/library/lux/abstract/monad.lux +++ b/stdlib/source/library/lux/abstract/monad.lux @@ -13,7 +13,7 @@ #.End init - (#.Item x xs') + {#.Item x xs'} (list\mix f (f x init) xs'))) (def: (list\size xs) @@ -24,21 +24,21 @@ #.End counter - (#.Item _ xs') + {#.Item _ xs'} (recur (++ counter) xs')))) (def: (reversed xs) (All (_ a) (-> (List a) (List a))) - (list\mix (function (_ head tail) (#.Item head tail)) + (list\mix (function (_ head tail) {#.Item head tail}) #.End xs)) (def: (pairs xs) (All (_ a) (-> (List a) (List [a a]))) (case xs - (#.Item x1 (#.Item x2 xs')) - (#.Item [x1 x2] (pairs xs')) + {#.Item x1 {#.Item x2 xs'}} + {#.Item [x1 x2] (pairs xs')} _ #.End)) @@ -57,15 +57,15 @@ (macro: .public (do tokens state) (case (: (Maybe [(Maybe Text) Code (List Code) Code]) (case tokens - (^ (list [_ (#.Tuple (list [_ (#.Identifier ["" name])] monad))] [_ (#.Tuple bindings)] body)) - (#.Some [(#.Some name) monad bindings body]) + (^ (list [_ {#.Tuple (list [_ {#.Identifier ["" name]}] monad)}] [_ {#.Tuple bindings}] body)) + {#.Some [{#.Some name} monad bindings body]} - (^ (list monad [_ (#.Tuple bindings)] body)) - (#.Some [#.None monad bindings body]) + (^ (list monad [_ {#.Tuple bindings}] body)) + {#.Some [#.None monad bindings body]} _ #.None)) - (#.Some [?name monad bindings body]) + {#.Some [?name monad bindings body]} (if (|> bindings list\size .int ("lux i64 %" +2) ("lux i64 =" +0)) (let [[module short] (name_of ..do) identifier (: (-> Text Code) @@ -78,19 +78,19 @@ (with_expansions [<default> (` (|> (~ value) ((~ g!each) (function ((~ g!_) (~ var)) (~ body'))) (~ g!conjoint)))] (let [[var value] binding] (case var - [_ (#.Identifier ["" _])] + [_ {#.Identifier ["" _]}] <default> - [_ (#.Identifier _)] + [_ {#.Identifier _}] (` ((~ var) (~ value) (~ body'))) _ <default>))))) body (reversed (pairs bindings)))] - (#.Right [state (list (case ?name - (#.Some name) - (let [name [location.dummy (#.Identifier ["" name])]] + {#.Right [state (list (case ?name + {#.Some name} + (let [name [location.dummy {#.Identifier ["" name]}]] (` (.case (~ monad) (~ name) (.case (~ name) @@ -100,11 +100,11 @@ #.None (` (.case (~ monad) [(~ g!each) (~' in) (~ g!conjoint)] - (~ body')))))])) - (#.Left "'do' bindings must have an even number of parts.")) + (~ body')))))]}) + {#.Left "'do' bindings must have an even number of parts."}) #.None - (#.Left "Wrong syntax for 'do'"))) + {#.Left "Wrong syntax for 'do'"})) (def: .public (then monad f) (All (_ ! a b) @@ -123,10 +123,10 @@ #.End (!\in #.End) - (#.Item x xs') + {#.Item x xs'} (|> x (!\each (function (_ _x) - (!\each (|>> (#.Item _x)) (recur xs')))) + (!\each (|>> {#.Item _x}) (recur xs')))) !\conjoint))))) (def: .public (each monad f) @@ -139,10 +139,10 @@ #.End (!\in #.End) - (#.Item x xs') + {#.Item x xs'} (|> (f x) (!\each (function (_ _x) - (!\each (|>> (#.Item _x)) (recur xs')))) + (!\each (|>> {#.Item _x}) (recur xs')))) !\conjoint))))) (def: .public (only monad f) @@ -155,12 +155,12 @@ #.End (!\in #.End) - (#.Item head xs') + {#.Item head xs'} (|> (f head) (!\each (function (_ verdict) (!\each (function (_ tail) (if verdict - (#.Item head tail) + {#.Item head tail} tail)) (recur xs')))) !\conjoint))))) @@ -173,7 +173,7 @@ #.End (\ monad in init) - (#.Item x xs') + {#.Item x xs'} (do monad [init' (f x init)] (mix monad f init' xs')))) diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux index 2f4d88fcc..04718ceb8 100644 --- a/stdlib/source/library/lux/abstract/monad/free.lux +++ b/stdlib/source/library/lux/abstract/monad/free.lux @@ -8,19 +8,19 @@ (type: .public (Free F a) (Variant - (#Pure a) - (#Effect (F (Free F a))))) + {#Pure a} + {#Effect (F (Free F a))})) (implementation: .public (functor dsl) (All (_ F) (-> (Functor F) (Functor (Free F)))) (def: (each f ea) (case ea - (#Pure a) - (#Pure (f a)) + {#Pure a} + {#Pure (f a)} - (#Effect value) - (#Effect (\ dsl each (each f) value))))) + {#Effect value} + {#Effect (\ dsl each (each f) value)}))) (implementation: .public (apply dsl) (All (_ F) (-> (Functor F) (Apply (Free F)))) @@ -30,16 +30,16 @@ (def: (on ea ef) (case [ef ea] - [(#Pure f) (#Pure a)] - (#Pure (f a)) + [{#Pure f} {#Pure a}] + {#Pure (f a)} - [(#Pure f) (#Effect fa)] - (#Effect (\ dsl each + [{#Pure f} {#Effect fa}] + {#Effect (\ dsl each (\ (..functor dsl) each f) - fa)) + fa)} - [(#Effect ff) _] - (#Effect (\ dsl each (on ea) ff)) + [{#Effect ff} _] + {#Effect (\ dsl each (on ea) ff)} ))) (implementation: .public (monad dsl) @@ -48,20 +48,20 @@ (def: &functor (..functor dsl)) (def: (in a) - (#Pure a)) + {#Pure a}) (def: (conjoint efefa) (case efefa - (#Pure efa) + {#Pure efa} (case efa - (#Pure a) - (#Pure a) + {#Pure a} + {#Pure a} - (#Effect fa) - (#Effect fa)) + {#Effect fa} + {#Effect fa}) - (#Effect fefa) - (#Effect (\ dsl each + {#Effect fefa} + {#Effect (\ dsl each (\ (monad dsl) conjoint) - fefa)) + fefa)} ))) diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index 6e8ddb602..3051aba52 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -33,8 +33,8 @@ (type: Context (Variant - (#Macro Name Code) - (#Binding Binding))) + {#Macro Name Code} + {#Binding Binding})) (def: global_identifier (Parser Name) @@ -67,12 +67,12 @@ (macro.with_identifiers [g!_ g!then] (let [body (list\mix (function (_ context next) (case context - (#Macro macro parameter) + {#Macro macro parameter} (` ((~ (code.identifier macro)) (~ parameter) (~ next))) - (#Binding [binding value]) + {#Binding [binding value]} (` ((~ g!then) (.function ((~ g!_) (~ binding)) (~ next)) @@ -80,7 +80,7 @@ expression (list.reversed context))] (in (list (case ?name - (#.Some name) + {#.Some name} (let [name (code.local_identifier name)] (` (let [(~ name) (~ monad) [#..in (~' in) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index 28a48035f..2e70ed49e 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -67,7 +67,7 @@ (monad.do meta.monad [expansion expander] (case expansion - (#.Item singleton #.End) + {#.Item singleton #.End} (in singleton) _ @@ -87,7 +87,7 @@ aliases))] (case [(value@ #bottom inputs) (value@ #bottom outputs)] - [(#.Some bottomI) (#.Some bottomO)] + [{#.Some bottomI} {#.Some bottomO}] (monad.do meta.monad [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) bottomI))) outputC (singleton (macro.full_expansion (stack_mix (value@ #top outputs) bottomO)))] @@ -191,12 +191,12 @@ (def: .public ||L (All (_ a b) (=> [a] [(Or a b)])) (function (_ [stack l]) - [stack (0 #0 l)])) + [stack {0 #0 l}])) (def: .public ||R (All (_ a b) (=> [b] [(Or a b)])) (function (_ [stack r]) - [stack (0 #1 r)])) + [stack {0 #1 r}])) (template [<input> <output> <word> <func>] [(`` (def: .public <word> diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux index 5ce45f632..e3635595a 100644 --- a/stdlib/source/library/lux/control/concurrency/actor.lux +++ b/stdlib/source/library/lux/control/concurrency/actor.lux @@ -54,8 +54,8 @@ (do [! io.monad] [current (async.value read)] (case current - (#.Some [head tail]) - (\ ! each (|>> (#.Item head)) + {#.Some [head tail]} + (\ ! each (|>> {#.Item head}) (pending tail)) #.None @@ -94,15 +94,15 @@ [[head tail] |mailbox| ?state' (on_mail head state self)] (case ?state' - (#try.Failure error) + {#try.Failure error} (let [[_ resolve] (value@ #obituary (:representation self))] (exec (io.run! (do io.monad [pending (..pending tail)] - (resolve [error state (#.Item head pending)]))) + (resolve [error state {#.Item head pending}]))) (in []))) - (#try.Success state') + {#try.Success state'} (recur state' tail))))] self))) @@ -147,10 +147,10 @@ (if resolved? (do ! [_ (atom.write! (product.right entry) (value@ #mailbox (:representation actor)))] - (in (#try.Success []))) + (in {#try.Success []})) (recur |mailbox|&resolve))) - (#.Some [_ |mailbox|']) + {#.Some [_ |mailbox|']} (recur |mailbox|')))))) (in (exception.except ..dead []))))) @@ -171,15 +171,15 @@ (do [! async.monad] [outcome (message state self)] (case outcome - (#try.Success [state' return]) + {#try.Success [state' return]} (exec - (io.run! (resolve (#try.Success return))) - (async.resolved (#try.Success state'))) + (io.run! (resolve {#try.Success return})) + (async.resolved {#try.Success state'})) - (#try.Failure error) + {#try.Failure error} (exec - (io.run! (resolve (#try.Failure error))) - (async.resolved (#try.Failure error))))))])) + (io.run! (resolve {#try.Failure error})) + (async.resolved {#try.Failure error})))))])) (def: .public (tell! message actor) (All (_ s o) (-> (Message s o) (Actor s) (Async (Try o)))) @@ -187,11 +187,11 @@ (do async.monad [outcome (async.future (..mail! mail actor))] (case outcome - (#try.Success) + {#try.Success} async - (#try.Failure error) - (in (#try.Failure error))))))] + {#try.Failure error} + (in {#try.Failure error})))))] ) ) @@ -244,7 +244,7 @@ #.None (` (~! ..default_on_mail)) - (#.Some [[mailN stateN selfN] bodyC]) + {#.Some [[mailN stateN selfN] bodyC]} (` (function ((~ g!_) (~ (code.local_identifier mailN)) (~ (code.local_identifier stateN)) diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux index 903ac8bd9..6e38aff6f 100644 --- a/stdlib/source/library/lux/control/concurrency/async.lux +++ b/stdlib/source/library/lux/control/concurrency/async.lux @@ -31,12 +31,12 @@ (do [! io.monad] [(^@ old [_value _observers]) (atom.read! async)] (case _value - (#.Some _) + {#.Some _} (in #0) #.None (do ! - [.let [new [(#.Some value) #.None]] + [.let [new [{#.Some value} #.None]] succeeded? (atom.compare_and_swap! old new async)] (if succeeded? (do ! @@ -47,7 +47,7 @@ (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)])) @@ -66,11 +66,11 @@ [.let [async (:representation async)] (^@ old [_value _observers]) (atom.read! async)] (case _value - (#.Some value) + {#.Some value} (f value) #.None - (let [new [_value (#.Item f _observers)]] + (let [new [_value {#.Item f _observers}]] (do ! [swapped? (atom.compare_and_swap! old new async)] (if swapped? @@ -85,7 +85,7 @@ (|>> (case> #.None #0 - (#.Some _) + {#.Some _} #1))))) (implementation: .public functor diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux index 1021c7e05..5498eeb06 100644 --- a/stdlib/source/library/lux/control/concurrency/frp.lux +++ b/stdlib/source/library/lux/control/concurrency/frp.lux @@ -42,7 +42,7 @@ stopped? (current #.None)] (if stopped? ... I closed the sink. - (in (#try.Success [])) + (in {#try.Success []}) ... Someone else interacted with the sink. (do ! [latter (atom.read! sink)] @@ -63,12 +63,12 @@ [(Async (Maybe [a (Channel a)])) (async.Resolver (Maybe [a (Channel a)]))] (async.async []))] - fed? (current (#.Some [value next]))] + fed? (current {#.Some [value next]})] (if fed? ... I fed the sink. (do ! [_ (atom.compare_and_swap! current resolve_next sink)] - (in (#try.Success []))) + (in {#try.Success []})) ... Someone else interacted with the sink. (do ! [latter (atom.read! sink)] @@ -102,8 +102,8 @@ [item_f ff item_a fa] (case [item_f item_a] - [(#.Some [head_f tail_f]) (#.Some [head_a tail_a])] - (in (#.Some [(head_f head_a) (on tail_a tail_f)])) + [{#.Some [head_f tail_f]} {#.Some [head_a tail_a]}] + (in {#.Some [(head_f head_a) (on tail_a tail_f)]}) _ (in #.None))))) @@ -118,7 +118,7 @@ (def: &functor ..functor) (def: (in a) - (async.resolved (#.Some [a ..empty]))) + (async.resolved {#.Some [a ..empty]})) (def: (conjoint mma) (let [[output sink] (channel [])] @@ -128,13 +128,13 @@ (do [! async.monad] [?mma mma] (case ?mma - (#.Some [ma mma']) + {#.Some [ma mma']} (do ! [_ (loop [ma ma] (do ! [?ma ma] (case ?ma - (#.Some [a ma']) + {#.Some [a ma']} (exec (io.run! (\ sink feed a)) (recur ma')) @@ -158,9 +158,9 @@ (do async.monad [item channel] (case item - (#.Some [head tail]) + {#.Some [head tail]} (case (io.run! (subscriber head)) - (#.Some _) + {#.Some _} (recur tail) #.None @@ -175,10 +175,10 @@ (do async.monad [item channel] (case item - (#.Some [head tail]) + {#.Some [head tail]} (let [tail' (only pass? tail)] (if (pass? head) - (in (#.Some [head tail'])) + (in {#.Some [head tail']}) tail')) #.None @@ -187,7 +187,7 @@ (def: .public (of_async async) (All (_ a) (-> (Async a) (Channel a))) (async\each (function (_ value) - (#.Some [value ..empty])) + {#.Some [value ..empty]}) async)) (def: .public (mix f init channel) @@ -200,7 +200,7 @@ #.None (in init) - (#.Some [head tail]) + {#.Some [head tail]} (do ! [init' (f head init)] (mix f init' tail))))) @@ -213,12 +213,12 @@ [item channel] (case item #.None - (in (#.Some [init (in #.None)])) + (in {#.Some [init (in #.None)]}) - (#.Some [head tail]) + {#.Some [head tail]} (do ! [init' (f head init)] - (in (#.Some [init (mixes f init' tail)])))))) + (in {#.Some [init (mixes f init' tail)]}))))) (def: .public (poll milli_seconds action) (All (_ a) @@ -241,8 +241,8 @@ (do async.monad [?next (f init)] (case ?next - (#.Some [state output]) - (in (#.Some [output (iterations f state)])) + {#.Some [state output]} + (in {#.Some [output (iterations f state)]}) #.None (in #.None)))) @@ -252,10 +252,10 @@ (do async.monad [item channel] (case item - (#.Some [head tail]) + {#.Some [head tail]} (if (\ equivalence = previous head) (distinct' equivalence previous tail) - (in (#.Some [head (distinct' equivalence head tail)]))) + (in {#.Some [head (distinct' equivalence head tail)]})) #.None (in #.None)))) @@ -265,8 +265,8 @@ (do async.monad [item channel] (in (case item - (#.Some [head tail]) - (#.Some [head (distinct' equivalence head tail)]) + {#.Some [head tail]} + {#.Some [head (distinct' equivalence head tail)]} #.None #.None)))) @@ -276,8 +276,8 @@ (do [! async.monad] [item channel] (case item - (#.Some [head tail]) - (\ ! each (|>> (#.Item head)) + {#.Some [head tail]} + (\ ! each (|>> {#.Item head}) (list tail)) #.None @@ -289,7 +289,7 @@ #.End ..empty - (#.Item head tail) - (async.resolved (#.Some [head (do async.monad + {#.Item head tail} + (async.resolved {#.Some [head (do async.monad [_ (async.delay milli_seconds)] - (sequential milli_seconds tail))])))) + (sequential milli_seconds tail))]}))) diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux index 013720460..755e201ff 100644 --- a/stdlib/source/library/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux @@ -89,9 +89,9 @@ #.None (in true) - (#.Some sink) + {#.Some sink} (sink []))] - (in (#try.Success (value@ #open_positions post)))))))))] + (in {#try.Success (value@ #open_positions post)})))))))] ) (abstract: .public Mutex diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux index 6b89926ff..382859176 100644 --- a/stdlib/source/library/lux/control/concurrency/stm.lux +++ b/stdlib/source/library/lux/control/concurrency/stm.lux @@ -54,10 +54,10 @@ (do ! [result (\ sink feed new_value)] (case result - (#try.Success _) + {#try.Success _} (in []) - (#try.Failure _) + {#try.Failure _} (un_follow! sink var)))) observers)] (in [])) @@ -68,7 +68,7 @@ (do io.monad [.let [[channel sink] (frp.channel [])] _ (atom.update! (function (_ [value observers]) - [value (#.Item sink observers)]) + [value {#.Item sink observers}]) (:representation target))] (in [channel sink])))] ) @@ -99,12 +99,12 @@ (All (_ a) (-> (Var a) (STM a))) (function (_ tx) (case (var_value var tx) - (#.Some value) + {#.Some value} [tx value] #.None (let [value (..read! var)] - [(#.Item [var value value] tx) + [{#.Item [var value value] tx} value])))) (def: (with_updated_var var value tx) @@ -113,28 +113,28 @@ #.End #.End - (#.Item [_var _original _current] tx') + {#.Item [_var _original _current] tx'} (if (same? (:as (Var Any) var) (:as (Var Any) _var)) - (#.Item [#var (:as (Var Any) _var) + {#.Item [#var (:as (Var Any) _var) #original (:as Any _original) #current (:as Any value)] - tx') - (#.Item [#var _var + tx'} + {#.Item [#var _var #original _original #current _current] - (with_updated_var var value tx'))))) + (with_updated_var var value tx')}))) (def: .public (write value var) (All (_ a) (-> a (Var a) (STM Any))) (function (_ tx) (case (var_value var tx) - (#.Some _) + {#.Some _} [(with_updated_var var value tx) []] #.None - [(#.Item [var (..read! var) value] tx) + [{#.Item [var (..read! var) value] tx} []]))) (implementation: .public functor @@ -223,7 +223,7 @@ (atom.write! (product.right entry) pending_commits) (recur |commits|&resolve))) - (#.Some [head tail]) + {#.Some [head tail]} (recur tail))))))) (def: (process_commit! commit) diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index c9430c1ed..f52b7f319 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -91,14 +91,14 @@ (def: (execute! action) (-> (IO Any) Any) (case (try (io.run! action)) - (#try.Failure error) + {#try.Failure error} (exec ("lux io log" ($_ "lux text concat" "ERROR DURING THREAD EXECUTION:" text.new_line error)) []) - (#try.Success _) + {#try.Success _} [])) (def: .public (schedule! milli_seconds action) @@ -129,9 +129,9 @@ ... Default (do [! io.monad] [now (\ ! each (|>> instant.millis .nat) instant.now) - _ (atom.update! (|>> (#.Item [#creation now + _ (atom.update! (|>> {#.Item [#creation now #delay milli_seconds - #action action])) + #action action]}) ..runner)] (in []))))) diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 039265ff7..3ea07e3e7 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -40,26 +40,26 @@ (-> (Exception e) (-> Text a) (Try a) (Try a))) (case try - (#//.Success output) - (#//.Success output) + {#//.Success output} + {#//.Success output} - (#//.Failure error) + {#//.Failure error} (let [reference (value@ #label exception)] (if (text.starts_with? reference error) - (#//.Success (|> error + {#//.Success (|> error (text.clip_since (text.size reference)) maybe.trusted - then)) - (#//.Failure error))))) + then)} + {#//.Failure error})))) (def: .public (otherwise else try) (All (_ a) (-> (-> Text a) (Try a) a)) (case try - (#//.Success output) + {#//.Success output} output - (#//.Failure error) + {#//.Failure error} (else error))) (def: .public (error exception message) @@ -68,12 +68,12 @@ (def: .public (except exception message) (All (_ e a) (-> (Exception e) e (Try a))) - (#//.Failure (..error exception message))) + {#//.Failure (..error exception message)}) (def: .public (assertion exception message test) (All (_ e) (-> (Exception e) e Bit (Try Any))) (if test - (#//.Success []) + {#//.Success []} (..except exception message))) (def: exception @@ -131,7 +131,7 @@ #.End "" - (#.Item head tail) + {#.Item head tail} (list\mix (function (_ post pre) ($_ text\composite pre text.new_line (on_entry post))) (on_entry head) @@ -148,8 +148,8 @@ (|> entries (list\mix (function (_ entry [index next]) [(++ index) - (#.Item [(n\encoded index) (format entry)] - next)]) + {#.Item [(n\encoded index) (format entry)] + next}]) [0 #.End]) product.right list.reversed @@ -173,13 +173,13 @@ (def: .public (with exception message computation) (All (_ e a) (-> (Exception e) e (Try a) (Try a))) (case computation - (#//.Failure error) - (#//.Failure (case error + {#//.Failure error} + {#//.Failure (case error "" (..error exception message) _ - (..decorated (..error exception message) error))) + (..decorated (..error exception message) error))} success success)) diff --git a/stdlib/source/library/lux/control/function/memo.lux b/stdlib/source/library/lux/control/function/memo.lux index 8e99b18ab..cccc36bf4 100644 --- a/stdlib/source/library/lux/control/function/memo.lux +++ b/stdlib/source/library/lux/control/function/memo.lux @@ -23,7 +23,7 @@ (do [! state.monad] [memory state.get] (case (dictionary.value input memory) - (#.Some output) + {#.Some output} (in output) #.None diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index 159f037e3..820d40253 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -58,7 +58,7 @@ #.End (in (list body)) - (#.Item mutual #.End) + {#.Item mutual #.End} (.let [g!name (|> mutual (value@ [#declaration #declaration.name]) code.local_identifier)] (in (list (` (.let [(~ g!name) (: (~ (value@ #type mutual)) (function (~ (declaration.format (value@ #declaration mutual))) @@ -110,7 +110,7 @@ #.End (in (list)) - (#.Item definition #.End) + {#.Item definition #.End} (.let [(^slots [#export_policy #mutual]) definition (^slots [#declaration #type #body]) mutual] (in (list (` (.def: (~ export_policy) (~ (declaration.format declaration)) diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 16b501d9e..baedf1354 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -25,13 +25,13 @@ (let [cache (atom.atom #.None)] (:abstraction (function (_ _) (case (io.run! (atom.read! cache)) - (#.Some value) + {#.Some value} value _ (let [value (generator [])] (exec - (io.run! (atom.compare_and_swap! _ (#.Some value) cache)) + (io.run! (atom.compare_and_swap! _ {#.Some value} cache)) value))))))) (def: .public (value lazy) diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index 036377285..0387618a8 100644 --- a/stdlib/source/library/lux/control/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -13,7 +13,7 @@ ... (type: (Maybe a) ... #.None -... (#.Some a)) +... {#.Some a}) (implementation: .public monoid (All (_ a) (Monoid (Maybe a))) @@ -25,8 +25,8 @@ #.None my - (#.Some x) - (#.Some x)))) + {#.Some x} + {#.Some x}))) (implementation: .public functor (Functor Maybe) @@ -34,7 +34,7 @@ (def: (each f ma) (case ma #.None #.None - (#.Some a) (#.Some (f a))))) + {#.Some a} {#.Some (f a)}))) (implementation: .public apply (Apply Maybe) @@ -43,8 +43,8 @@ (def: (on fa ff) (case [ff fa] - [(#.Some f) (#.Some a)] - (#.Some (f a)) + [{#.Some f} {#.Some a}] + {#.Some (f a)} _ #.None))) @@ -55,14 +55,14 @@ (def: &functor ..functor) (def: (in x) - (#.Some x)) + {#.Some x}) (def: (conjoint mma) (case mma #.None #.None - (#.Some mx) + {#.Some mx} mx))) (implementation: .public (equivalence super) @@ -73,7 +73,7 @@ [#.None #.None] #1 - [(#.Some x) (#.Some y)] + [{#.Some x} {#.Some y}] (\ super = x y) _ @@ -90,7 +90,7 @@ #.None 0 - (#.Some value) + {#.Some value} (\ super hash value)))) (implementation: .public (with monad) @@ -109,7 +109,7 @@ #.None (in #.None) - (#.Some Mma) + {#.Some Mma} Mma)))) (def: .public (lifted monad) @@ -119,16 +119,16 @@ (macro: .public (else tokens state) (case tokens (^ (.list else maybe)) - (let [g!temp (: Code [location.dummy (#.Identifier ["" ""])])] - (#.Right [state (.list (` (case (~ maybe) - (#.Some (~ g!temp)) + (let [g!temp (: Code [location.dummy {#.Identifier ["" ""]}])] + {#.Right [state (.list (` (case (~ maybe) + {#.Some (~ g!temp)} (~ g!temp) #.None - (~ else))))])) + (~ else))))]}) _ - (#.Left "Wrong syntax for else"))) + {#.Left "Wrong syntax for else"})) (def: .public trusted (All (_ a) (-> (Maybe a) a)) @@ -140,15 +140,15 @@ #.None #.End - (#.Some value) - (#.Item value #.End))) + {#.Some value} + {#.Item value #.End})) (macro: .public (when tokens state) (case tokens (^ (.list test then)) - (#.Right [state (.list (` (.if (~ test) + {#.Right [state (.list (` (.if (~ test) (~ then) - #.None)))]) + #.None)))]} _ - (#.Left "Wrong syntax for when"))) + {#.Left "Wrong syntax for when"})) diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux index 7b7c499aa..17731a079 100644 --- a/stdlib/source/library/lux/control/parser.lux +++ b/stdlib/source/library/lux/control/parser.lux @@ -25,11 +25,11 @@ (def: (each f ma) (function (_ input) (case (ma input) - (#try.Failure msg) - (#try.Failure msg) + {#try.Failure msg} + {#try.Failure msg} - (#try.Success [input' a]) - (#try.Success [input' (f a)]))))) + {#try.Success [input' a]} + {#try.Success [input' (f a)]})))) (implementation: .public apply (All (_ s) (Apply (Parser s))) @@ -39,16 +39,16 @@ (def: (on fa ff) (function (_ input) (case (ff input) - (#try.Success [input' f]) + {#try.Success [input' f]} (case (fa input') - (#try.Success [input'' a]) - (#try.Success [input'' (f a)]) + {#try.Success [input'' a]} + {#try.Success [input'' (f a)]} - (#try.Failure msg) - (#try.Failure msg)) + {#try.Failure msg} + {#try.Failure msg}) - (#try.Failure msg) - (#try.Failure msg))))) + {#try.Failure msg} + {#try.Failure msg})))) (implementation: .public monad (All (_ s) (Monad (Parser s))) @@ -57,34 +57,34 @@ (def: (in x) (function (_ input) - (#try.Success [input x]))) + {#try.Success [input x]})) (def: (conjoint mma) (function (_ input) (case (mma input) - (#try.Failure msg) - (#try.Failure msg) + {#try.Failure msg} + {#try.Failure msg} - (#try.Success [input' ma]) + {#try.Success [input' ma]} (ma input'))))) (def: .public (assertion message test) (All (_ s) (-> Text Bit (Parser s Any))) (function (_ input) (if test - (#try.Success [input []]) - (#try.Failure message)))) + {#try.Success [input []]} + {#try.Failure message}))) (def: .public (maybe parser) (All (_ s a) (-> (Parser s a) (Parser s (Maybe a)))) (function (_ input) (case (parser input) - (#try.Failure _) - (#try.Success [input #.None]) + {#try.Failure _} + {#try.Success [input #.None]} - (#try.Success [input' x]) - (#try.Success [input' (#.Some x)])))) + {#try.Success [input' x]} + {#try.Success [input' {#.Some x}]}))) (def: .public (result parser input) (All (_ s a) @@ -103,23 +103,23 @@ (-> (Parser s a) (Parser s b) (Parser s (Or a b)))) (function (_ tokens) (case (left tokens) - (#try.Success [tokens' output]) - (#try.Success [tokens' (0 #0 output)]) + {#try.Success [tokens' output]} + {#try.Success [tokens' {0 #0 output}]} - (#try.Failure _) + {#try.Failure _} (case (right tokens) - (#try.Success [tokens' output]) - (#try.Success [tokens' (0 #1 output)]) + {#try.Success [tokens' output]} + {#try.Success [tokens' {0 #1 output}]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (def: .public (either this that) (All (_ s a) (-> (Parser s a) (Parser s a) (Parser s a))) (function (_ tokens) (case (this tokens) - (#try.Failure _) + {#try.Failure _} (that tokens) output @@ -130,10 +130,10 @@ (-> (Parser s a) (Parser s (List a)))) (function (_ input) (case (parser input) - (#try.Failure _) - (#try.Success [input (list)]) + {#try.Failure _} + {#try.Success [input (list)]} - (#try.Success [input' head]) + {#try.Success [input' head]} (..result (\ ..monad each (|>> (list& head)) (some parser)) input')))) @@ -153,7 +153,7 @@ [x parser] (|> parser (exactly (-- amount)) - (\ ! each (|>> (#.Item x))))))) + (\ ! each (|>> {#.Item x})))))) (def: .public (at_least amount parser) (All (_ s a) (-> Nat (Parser s a) (Parser s (List a)))) @@ -167,11 +167,11 @@ 0 (\ ..monad in (list)) _ (function (_ input) (case (parser input) - (#try.Failure msg) - (#try.Success [input (list)]) + {#try.Failure msg} + {#try.Success [input (list)]} - (#try.Success [input' x]) - (..result (\ ..monad each (|>> (#.Item x)) + {#try.Success [input' x]} + (..result (\ ..monad each (|>> {#.Item x}) (at_most (-- amount) parser)) input'))))) @@ -192,51 +192,51 @@ #.None (in #.End) - (#.Some x) + {#.Some x} (|> parser (..and separator) ..some - (\ ! each (|>> (list\each product.right) (#.Item x))))))) + (\ ! each (|>> (list\each product.right) {#.Item x})))))) (def: .public (not parser) (All (_ s a) (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) - (#try.Failure msg) - (#try.Success [input []]) + {#try.Failure msg} + {#try.Success [input []]} _ - (#try.Failure "Expected to fail; yet succeeded.")))) + {#try.Failure "Expected to fail; yet succeeded."}))) (def: .public (failure message) (All (_ s a) (-> Text (Parser s a))) (function (_ input) - (#try.Failure message))) + {#try.Failure message})) (def: .public (lifted operation) (All (_ s a) (-> (Try a) (Parser s a))) (function (_ input) (case operation - (#try.Success output) - (#try.Success [input output]) + {#try.Success output} + {#try.Success [input output]} - (#try.Failure error) - (#try.Failure error)))) + {#try.Failure error} + {#try.Failure error}))) (def: .public (else value parser) (All (_ s a) (-> a (Parser s a) (Parser s a))) (function (_ input) (case (parser input) - (#try.Failure error) - (#try.Success [input value]) + {#try.Failure error} + {#try.Success [input value]} - (#try.Success [input' output]) - (#try.Success [input' output])))) + {#try.Success [input' output]} + {#try.Success [input' output]}))) (def: .public remaining (All (_ s) (Parser s s)) (function (_ inputs) - (#try.Success [inputs inputs]))) + {#try.Success [inputs inputs]})) (def: .public (rec parser) (All (_ s a) (-> (-> (Parser s a) (Parser s a)) (Parser s a))) @@ -267,28 +267,28 @@ (All (_ s a) (-> (Parser s a) (Parser s Bit))) (function (_ input) (case (parser input) - (#try.Failure error) - (#try.Success [input false]) + {#try.Failure error} + {#try.Success [input false]} - (#try.Success [input' _]) - (#try.Success [input' true])))) + {#try.Success [input' _]} + {#try.Success [input' true]}))) (def: .public (parses parser) (All (_ s a) (-> (Parser s a) (Parser s Any))) (function (_ input) (case (parser input) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [input' _]) - (#try.Success [input' []])))) + {#try.Success [input' _]} + {#try.Success [input' []]}))) (def: .public (speculative parser) (All (_ s a) (-> (Parser s a) (Parser s a))) (function (_ input) (case (parser input) - (#try.Success [input' output]) - (#try.Success [input output]) + {#try.Success [input' output]} + {#try.Success [input output]} output output))) @@ -297,13 +297,13 @@ (All (_ s a z) (-> (Codec a z) (Parser s a) (Parser s z))) (function (_ input) (case (parser input) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [input' to_decode]) + {#try.Success [input' to_decode]} (case (\ codec decoded to_decode) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success value) - (#try.Success [input' value]))))) + {#try.Success value} + {#try.Success [input' value]})))) diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index bbc90f043..0c5f47cb3 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -53,13 +53,13 @@ (def: .public (result parser input) (All (_ a) (-> (Parser a) (List Analysis) (Try a))) (case (parser input) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [#.End value]) - (#try.Success value) + {#try.Success [#.End value]} + {#try.Success value} - (#try.Success [unconsumed _]) + {#try.Success [unconsumed _]} (exception.except ..unconsumed_input unconsumed))) (def: .public any @@ -69,23 +69,23 @@ #.End (exception.except ..cannot_parse input) - (#.Item [head tail]) - (#try.Success [tail head])))) + {#.Item [head tail]} + {#try.Success [tail head]}))) (def: .public end! (Parser Any) (function (_ tokens) (case tokens - #.End (#try.Success [tokens []]) - _ (#try.Failure (format "Expected list of tokens to be empty!" - (remaining_inputs tokens)))))) + #.End {#try.Success [tokens []]} + _ {#try.Failure (format "Expected list of tokens to be empty!" + (remaining_inputs tokens))}))) (def: .public end? (Parser Bit) (function (_ tokens) - (#try.Success [tokens (case tokens + {#try.Success [tokens (case tokens #.End true - _ false)]))) + _ false)]})) (template [<query> <assertion> <tag> <type> <eq>] [(`` (as_is (def: .public <query> @@ -93,7 +93,7 @@ (function (_ input) (case input (^ (list& (<tag> x) input')) - (#try.Success [input' x]) + {#try.Success [input' x]} _ (exception.except ..cannot_parse input)))) @@ -104,7 +104,7 @@ (case input (^ (list& (<tag> actual) input')) (if (\ <eq> = expected actual) - (#try.Success [input' []]) + {#try.Success [input' []]} (exception.except ..cannot_parse input)) _ @@ -128,7 +128,7 @@ (^ (list& (/.tuple head) tail)) (do try.monad [output (..result parser head)] - (#try.Success [tail output])) + {#try.Success [tail output]}) _ (exception.except ..cannot_parse input)))) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index d6de3c7cd..0f5e925e1 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -41,29 +41,29 @@ (def: .public (result parser input) (All (_ a) (-> (Parser a) Binary (Try a))) (case (parser [0 input]) - (#try.Failure msg) - (#try.Failure msg) + {#try.Failure msg} + {#try.Failure msg} - (#try.Success [[end _] output]) + {#try.Success [[end _] output]} (let [length (/.size input)] (if (n.= end length) - (#try.Success output) + {#try.Success output} (exception.except ..binary_was_not_fully_read [length end]))))) (def: .public end? (Parser Bit) (function (_ (^@ input [offset data])) - (#try.Success [input (n.= offset (/.size data))]))) + {#try.Success [input (n.= offset (/.size data))]})) (def: .public offset (Parser Offset) (function (_ (^@ input [offset data])) - (#try.Success [input offset]))) + {#try.Success [input offset]})) (def: .public remaining (Parser Nat) (function (_ (^@ input [offset data])) - (#try.Success [input (n.- offset (/.size data))]))) + {#try.Success [input (n.- offset (/.size data))]})) (type: .public Size Nat) @@ -78,11 +78,11 @@ (Parser I64) (function (_ [offset binary]) (case (<read> offset binary) - (#try.Success data) - (#try.Success [(n.+ <size> offset) binary] data) + {#try.Success data} + {#try.Success [(n.+ <size> offset) binary] data} - (#try.Failure error) - (#try.Failure error))))] + {#try.Failure error} + {#try.Failure error})))] [bits/8 ..size/8 /.read/8!] [bits/16 ..size/16 /.read/16!] @@ -115,7 +115,7 @@ (with_expansions [<case>+' (template.spliced <case>+)] (case flag (^template [<number> <tag> <parser>] - [<number> (`` (\ ! each (|>> ((~~ (template.spliced <tag>)))) <parser>))]) + [<number> (`` (\ ! each (|>> {(~~ (template.spliced <tag>))}) <parser>))]) (<case>+') _ (//.lifted (exception.except ..invalid_tag [(template.amount [<case>+]) flag])))))]) @@ -154,7 +154,7 @@ (-> Nat (Parser Binary)) (function (_ [offset binary]) (case size - 0 (#try.Success [[offset binary] (/.empty 0)]) + 0 {#try.Success [[offset binary] (/.empty 0)]} _ (|> binary (/.slice offset size) (\ try.monad each (|>> [[(n.+ size offset) binary]])))))) diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index c60b80d6a..aca4512fb 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -16,26 +16,26 @@ (def: .public (result parser inputs) (All (_ a) (-> (Parser a) (List Text) (Try a))) (case (//.result parser inputs) - (#try.Success [remaining output]) + {#try.Success [remaining output]} (case remaining #.End - (#try.Success output) + {#try.Success output} _ - (#try.Failure (format "Remaining CLI inputs: " (text.interposed " " remaining)))) + {#try.Failure (format "Remaining CLI inputs: " (text.interposed " " remaining))}) - (#try.Failure try) - (#try.Failure try))) + {#try.Failure try} + {#try.Failure try})) (def: .public any (Parser Text) (function (_ inputs) (case inputs - (#.Item arg inputs') - (#try.Success [inputs' arg]) + {#.Item arg inputs'} + {#try.Success [inputs' arg]} _ - (#try.Failure "Cannot parse empty arguments.")))) + {#try.Failure "Cannot parse empty arguments."}))) (def: .public (parse parser) (All (_ a) (-> (-> Text (Try a)) (Parser a))) @@ -52,33 +52,33 @@ [[remaining raw] (any inputs)] (if (text\= reference raw) (in [remaining []]) - (#try.Failure (format "Missing token: '" reference "'")))))) + {#try.Failure (format "Missing token: '" reference "'")})))) (def: .public (somewhere cli) (All (_ a) (-> (Parser a) (Parser a))) (function (_ inputs) (loop [immediate inputs] (case (//.result cli immediate) - (#try.Success [remaining output]) - (#try.Success [remaining output]) + {#try.Success [remaining output]} + {#try.Success [remaining output]} - (#try.Failure try) + {#try.Failure try} (case immediate #.End - (#try.Failure try) + {#try.Failure try} - (#.Item to_omit immediate') + {#.Item to_omit immediate'} (do try.monad [[remaining output] (recur immediate')] - (in [(#.Item to_omit remaining) + (in [{#.Item to_omit remaining} output]))))))) (def: .public end (Parser Any) (function (_ inputs) (case inputs - #.End (#try.Success [inputs []]) - _ (#try.Failure (format "Unknown parameters: " (text.interposed " " inputs)))))) + #.End {#try.Success [inputs []]} + _ {#try.Failure (format "Unknown parameters: " (text.interposed " " inputs))}))) (def: .public (named name value) (All (_ a) (-> Text (Parser a) (Parser a))) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index f9fc4d550..d58874cf4 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -25,7 +25,7 @@ (All (_ a) (-> (List [a a]) (List a))) (case pairs #.End #.End - (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) + {#.Item [[x y] pairs']} (list& x y (un_paired pairs')))) (type: .public Parser (//.Parser (List Code))) @@ -41,29 +41,29 @@ (function (_ tokens) (case tokens #.End - (#try.Failure "There are no tokens to parse!") + {#try.Failure "There are no tokens to parse!"} - (#.Item [t tokens']) - (#try.Success [tokens' t])))) + {#.Item [t tokens']} + {#try.Success [tokens' t]}))) (def: .public next (Parser Code) (function (_ tokens) (case tokens #.End - (#try.Failure "There are no tokens to parse!") + {#try.Failure "There are no tokens to parse!"} - (#.Item next _) - (#try.Success [tokens next])))) + {#.Item next _} + {#try.Success [tokens next]}))) (template [<query> <check> <type> <tag> <eq> <desc>] - [(with_expansions [<failure> (as_is (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))] + [(with_expansions [<failure> (as_is {#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))})] (def: .public <query> (Parser <type>) (function (_ tokens) (case tokens - (#.Item [[_ (<tag> x)] tokens']) - (#try.Success [tokens' x]) + {#.Item [[_ {<tag> x}] tokens']} + {#try.Success [tokens' x]} _ <failure>))) @@ -72,9 +72,9 @@ (-> <type> (Parser Any)) (function (_ tokens) (case tokens - (#.Item [[_ (<tag> actual)] tokens']) + {#.Item [[_ {<tag> actual}] tokens']} (if (\ <eq> = expected actual) - (#try.Success [tokens' []]) + {#try.Success [tokens' []]} <failure>) _ @@ -94,23 +94,23 @@ (-> Code (Parser Any)) (function (_ tokens) (case tokens - (#.Item [token tokens']) + {#.Item [token tokens']} (if (code\= code token) - (#try.Success [tokens' []]) - (#try.Failure ($_ text\composite "Expected a " (code.format code) " but instead got " (code.format token) - (remaining_inputs tokens)))) + {#try.Success [tokens' []]} + {#try.Failure ($_ text\composite "Expected a " (code.format code) " but instead got " (code.format token) + (remaining_inputs tokens))}) _ - (#try.Failure "There are no tokens to parse!")))) + {#try.Failure "There are no tokens to parse!"}))) (template [<query> <check> <tag> <eq> <desc>] - [(with_expansions [<failure> (as_is (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))] + [(with_expansions [<failure> (as_is {#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))})] (def: .public <query> (Parser Text) (function (_ tokens) (case tokens - (#.Item [[_ (<tag> ["" x])] tokens']) - (#try.Success [tokens' x]) + {#.Item [[_ {<tag> ["" x]}] tokens']} + {#try.Success [tokens' x]} _ <failure>))) @@ -119,9 +119,9 @@ (-> Text (Parser Any)) (function (_ tokens) (case tokens - (#.Item [[_ (<tag> ["" actual])] tokens']) + {#.Item [[_ {<tag> ["" actual]}] tokens']} (if (\ <eq> = expected actual) - (#try.Success [tokens' []]) + {#try.Success [tokens' []]} <failure>) _ @@ -137,13 +137,13 @@ (-> (Parser a) (Parser a))) (function (_ tokens) (case tokens - (#.Item [[_ (<tag> members)] tokens']) + {#.Item [[_ {<tag> members}] tokens']} (case (p members) - (#try.Success [#.End x]) (#try.Success [tokens' x]) - _ (#try.Failure ($_ text\composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens)))) + {#try.Success [#.End x]} {#try.Success [tokens' x]} + _ {#try.Failure ($_ text\composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens))}) _ - (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))))] + {#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))})))] [form #.Form "form"] [variant #.Variant "variant"] @@ -154,32 +154,32 @@ (Parser Any) (function (_ tokens) (case tokens - #.End (#try.Success [tokens []]) - _ (#try.Failure ($_ text\composite "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) + #.End {#try.Success [tokens []]} + _ {#try.Failure ($_ text\composite "Expected list of tokens to be empty!" (remaining_inputs tokens))}))) (def: .public end? (Parser Bit) (function (_ tokens) - (#try.Success [tokens (case tokens + {#try.Success [tokens (case tokens #.End true - _ false)]))) + _ false)]})) (def: .public (result parser inputs) (All (_ a) (-> (Parser a) (List Code) (Try a))) (case (parser inputs) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [unconsumed value]) + {#try.Success [unconsumed value]} (case unconsumed #.End - (#try.Success value) + {#try.Success value} _ - (#try.Failure (|> unconsumed + {#try.Failure (|> unconsumed (list\each code.format) (text.interposed ", ") - (text\composite "Unconsumed inputs: ")))))) + (text\composite "Unconsumed inputs: "))}))) (def: .public (local inputs parser) (All (_ a) (-> (List Code) (Parser a) (Parser a))) @@ -195,5 +195,5 @@ result (//.or parser ..any)] (case result - (#.Left _) (//.failure (text\composite "Did NOT expect to parse code: " (code.format sample))) - (#.Right output) (in output)))) + {#.Left _} (//.failure (text\composite "Did NOT expect to parse code: " (code.format sample))) + {#.Right output} (in output)))) diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux index 1ad723411..ce254222e 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -33,8 +33,8 @@ (-> Property (Parser Text)) (function (_ environment) (case (dictionary.value name environment) - (#.Some value) - (#try.Success [environment value]) + {#.Some value} + {#try.Success [environment value]} #.None (exception.except ..unknown_property [name])))) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 4d09fa72b..3a0d76c1f 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -34,16 +34,16 @@ (def: .public (result parser json) (All (_ a) (-> (Parser a) JSON (Try a))) (case (//.result parser (list json)) - (#try.Success [remainder output]) + {#try.Success [remainder output]} (case remainder #.End - (#try.Success output) + {#try.Success output} _ (exception.except ..unconsumed_input remainder)) - (#try.Failure error) - (#try.Failure error))) + {#try.Failure error} + {#try.Failure error})) (def: .public any (Parser JSON) @@ -52,8 +52,8 @@ #.End (exception.except ..empty_input []) - (#.Item head tail) - (#try.Success [tail head])))) + {#.Item head tail} + {#try.Success [tail head]}))) (exception: .public (unexpected_value [value JSON]) (exception.report @@ -65,7 +65,7 @@ (do //.monad [head ..any] (case head - (<tag> value) + {<tag> value} (in value) _ @@ -89,7 +89,7 @@ (do //.monad [head ..any] (case head - (<tag> value) + {<tag> value} (in (\ <equivalence> = test value)) _ @@ -100,10 +100,10 @@ (do //.monad [head ..any] (case head - (<tag> value) + {<tag> value} (if (\ <equivalence> = test value) (in []) - (//.failure (exception.error ..value_mismatch [(<tag> test) (<tag> value)]))) + (//.failure (exception.error ..value_mismatch [{<tag> test} {<tag> value}]))) _ (//.failure (exception.error ..unexpected_value [head])))))] @@ -123,12 +123,12 @@ (do //.monad [head ..any] (case head - (#/.Array values) + {#/.Array values} (case (//.result parser (row.list values)) - (#try.Failure error) + {#try.Failure error} (//.failure error) - (#try.Success [remainder output]) + {#try.Success [remainder output]} (case remainder #.End (in output) @@ -144,17 +144,17 @@ (do //.monad [head ..any] (case head - (#/.Object kvs) + {#/.Object kvs} (case (|> kvs dictionary.entries (list\each (function (_ [key value]) - (list (#/.String key) value))) + (list {#/.String key} value))) list.together (//.result parser)) - (#try.Failure error) + {#try.Failure error} (//.failure error) - (#try.Success [remainder output]) + {#try.Success [remainder output]} (case remainder #.End (in output) @@ -169,20 +169,20 @@ (All (_ a) (-> Text (Parser a) (Parser a))) (function (recur inputs) (case inputs - (^ (list& (#/.String key) value inputs')) + (^ (list& {#/.String key} value inputs')) (if (text\= key field_name) (case (//.result parser (list value)) - (#try.Success [#.End output]) - (#try.Success [inputs' output]) + {#try.Success [#.End output]} + {#try.Success [inputs' output]} - (#try.Success [inputs'' _]) + {#try.Success [inputs'' _]} (exception.except ..unconsumed_input inputs'') - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) (do try.monad [[inputs'' output] (recur inputs')] - (in [(list& (#/.String key) value inputs'') + (in [(list& {#/.String key} value inputs'') output]))) #.End diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index 0bc446089..1578f9115 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -53,13 +53,13 @@ (def: .public (result parser input) (All (_ a) (-> (Parser a) (List Synthesis) (Try a))) (case (parser input) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [#.End value]) - (#try.Success value) + {#try.Success [#.End value]} + {#try.Success value} - (#try.Success [unconsumed _]) + {#try.Success [unconsumed _]} (exception.except ..unconsumed_input unconsumed))) (def: .public any @@ -69,22 +69,22 @@ #.End (exception.except ..empty_input []) - (#.Item [head tail]) - (#try.Success [tail head])))) + {#.Item [head tail]} + {#try.Success [tail head]}))) (def: .public end! (Parser Any) (.function (_ tokens) (case tokens - #.End (#try.Success [tokens []]) + #.End {#try.Success [tokens []]} _ (exception.except ..expected_empty_input [tokens])))) (def: .public end? (Parser Bit) (.function (_ tokens) - (#try.Success [tokens (case tokens + {#try.Success [tokens (case tokens #.End true - _ false)]))) + _ false)]})) (template [<query> <assertion> <tag> <type> <eq>] [(`` (def: .public <query> @@ -92,7 +92,7 @@ (.function (_ input) (case input (^ (list& (<tag> x) input')) - (#try.Success [input' x]) + {#try.Success [input' x]} _ (exception.except ..cannot_parse input))))) @@ -103,7 +103,7 @@ (case input (^ (list& (<tag> actual) input')) (if (\ <eq> = expected actual) - (#try.Success [input' []]) + {#try.Success [input' []]} (exception.except ..cannot_parse input)) _ @@ -125,7 +125,7 @@ (^ (list& (/.tuple head) tail)) (do try.monad [output (..result parser head)] - (#try.Success [tail output])) + {#try.Success [tail output]}) _ (exception.except ..cannot_parse input)))) @@ -138,7 +138,7 @@ (if (n.= expected actual) (do try.monad [output (..result parser (list body))] - (#try.Success [tail [environment output]])) + {#try.Success [tail [environment output]]}) (exception.except ..wrong_arity [expected actual])) _ @@ -152,7 +152,7 @@ (do try.monad [inits (..result init_parsers inits) iteration (..result iteration_parser (list iteration))] - (#try.Success [tail [start inits iteration]])) + {#try.Success [tail [start inits iteration]]}) _ (exception.except ..cannot_parse input)))) diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index 9c847ad5c..8594dc353 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -58,18 +58,18 @@ (def: .public (result parser input) (All (_ a) (-> (Parser a) Text (Try a))) (case (parser [start_offset input]) - (#try.Failure msg) - (#try.Failure msg) + {#try.Failure msg} + {#try.Failure msg} - (#try.Success [[end_offset _] output]) + {#try.Success [[end_offset _] output]} (if (n.= end_offset (/.size input)) - (#try.Success output) + {#try.Success output} (exception.except ..unconsumed_input [end_offset input])))) (def: .public offset (Parser Offset) (function (_ (^@ input [offset tape])) - (#try.Success [input offset]))) + {#try.Success [input offset]})) (def: (with_slices parser) (-> (Parser (List Slice)) (Parser Slice)) @@ -87,8 +87,8 @@ (Parser Text) (function (_ [offset tape]) (case (/.char offset tape) - (#.Some output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]) + {#.Some output} + {#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]} _ (exception.except ..cannot_parse [])))) @@ -97,10 +97,10 @@ (Parser Slice) (function (_ [offset tape]) (case (/.char offset tape) - (#.Some _) - (#try.Success [[("lux i64 +" 1 offset) tape] + {#.Some _} + {#try.Success [[("lux i64 +" 1 offset) tape] [#basis offset - #distance 1]]) + #distance 1]]} _ (exception.except ..cannot_slice [])))) @@ -110,7 +110,7 @@ (All (_ a) (-> (Parser a) (Parser <type>))) (function (_ input) (case (parser input) - (#try.Failure msg) + {#try.Failure msg} (<any> input) _ @@ -128,10 +128,10 @@ (-> Text (Parser Any)) (function (_ [offset tape]) (case (/.index_since offset reference tape) - (#.Some where) + {#.Some where} (if (n.= offset where) - (#try.Success [[("lux i64 +" (/.size reference) offset) tape] - []]) + {#try.Success [[("lux i64 +" (/.size reference) offset) tape] + []]} (exception.except ..cannot_match [reference])) _ @@ -141,15 +141,15 @@ (Parser Any) (function (_ (^@ input [offset tape])) (if (n.= offset (/.size tape)) - (#try.Success [input []]) + {#try.Success [input []]} (exception.except ..unconsumed_input input)))) (def: .public next (Parser Text) (function (_ (^@ input [offset tape])) (case (/.char offset tape) - (#.Some output) - (#try.Success [input (/.of_char output)]) + {#.Some output} + {#try.Success [input (/.of_char output)]} _ (exception.except ..cannot_parse [])))) @@ -157,7 +157,7 @@ (def: .public remaining (Parser Text) (function (_ (^@ input [offset tape])) - (#try.Success [input (..left_over offset tape)]))) + {#try.Success [input (..left_over offset tape)]})) (def: .public (range bottom top) (-> Nat Nat (Parser Text)) @@ -211,10 +211,10 @@ (-> Text (Parser Text)) (function (_ [offset tape]) (case (/.char offset tape) - (#.Some output) + {#.Some output} (let [output' (/.of_char output)] (if (<modifier> (/.contains? output' options)) - (#try.Success [[("lux i64 +" 1 offset) tape] output']) + {#try.Success [[("lux i64 +" 1 offset) tape] output']} (exception.except <exception> [options output]))) _ @@ -229,12 +229,12 @@ (-> Text (Parser Slice)) (function (_ [offset tape]) (case (/.char offset tape) - (#.Some output) + {#.Some output} (let [output' (/.of_char output)] (if (<modifier> (/.contains? output' options)) - (#try.Success [[("lux i64 +" 1 offset) tape] + {#try.Success [[("lux i64 +" 1 offset) tape] [#basis offset - #distance 1]]) + #distance 1]]} (exception.except <exception> [options output]))) _ @@ -252,9 +252,9 @@ (-> (-> Char Bit) (Parser Text)) (function (_ [offset tape]) (case (/.char offset tape) - (#.Some output) + {#.Some output} (if (parser output) - (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]) + {#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]} (exception.except ..character_does_not_satisfy_predicate [output])) _ @@ -340,11 +340,11 @@ (All (_ a) (-> Text (Parser a) (Parser a))) (function (_ real_input) (case (..result parser local_input) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success value) - (#try.Success [real_input value])))) + {#try.Success value} + {#try.Success [real_input value]}))) (def: .public (slice parser) (-> (Parser Slice) (Parser Text)) @@ -352,8 +352,8 @@ [[basis distance] parser] (function (_ (^@ input [offset tape])) (case (/.clip basis distance tape) - (#.Some output) - (#try.Success [input output]) + {#.Some output} + {#try.Success [input output]} #.None (exception.except ..cannot_slice []))))) diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index 7a28812ac..68b4336a5 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -28,7 +28,7 @@ (def: .public value (All (_ t) (Parser t t)) (function (_ zipper) - (#try.Success [zipper (zipper.value zipper)]))) + {#try.Success [zipper (zipper.value zipper)]})) (exception: .public cannot_move_further) @@ -40,8 +40,8 @@ #.None (exception.except ..cannot_move_further []) - (#.Some next) - (#try.Success [next []]))))] + {#.Some next} + {#try.Success [next []]})))] [down zipper.down] [up zipper.up] diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index c75df1031..4e2414934 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -23,7 +23,7 @@ ["[0]" //]) (template: (|recursion_dummy|) - [(#.Primitive "" #.End)]) + [{#.Primitive "" #.End}]) (template [<name>] [(exception: .public (<name> [type Type]) @@ -74,13 +74,13 @@ (def: (result' env poly types) (All (_ a) (-> Env (Parser a) (List Type) (Try a))) (case (//.result poly [env types]) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [[env' remaining] output]) + {#try.Success [[env' remaining] output]} (case remaining #.End - (#try.Success output) + {#try.Success output} _ (exception.except ..unconsumed_input remaining)))) @@ -92,17 +92,17 @@ (def: .public env (Parser Env) (.function (_ [env inputs]) - (#try.Success [[env inputs] env]))) + {#try.Success [[env inputs] env]})) (def: (with_env temp poly) (All (_ a) (-> Env (Parser a) (Parser a))) (.function (_ [env inputs]) (case (//.result poly [temp inputs]) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [[_ remaining] output]) - (#try.Success [[env remaining] output])))) + {#try.Success [[_ remaining] output]} + {#try.Success [[env remaining] output]}))) (def: .public next (Parser Type) @@ -111,8 +111,8 @@ #.End (exception.except ..empty_input []) - (#.Item headT tail) - (#try.Success [[env inputs] headT])))) + {#.Item headT tail} + {#try.Success [[env inputs] headT]}))) (def: .public any (Parser Type) @@ -121,18 +121,18 @@ #.End (exception.except ..empty_input []) - (#.Item headT tail) - (#try.Success [[env tail] headT])))) + {#.Item headT tail} + {#try.Success [[env tail] headT]}))) (def: .public (local types poly) (All (_ a) (-> (List Type) (Parser a) (Parser a))) (.function (_ [env pass_through]) (case (result' env poly types) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success output) - (#try.Success [[env pass_through] output])))) + {#try.Success output} + {#try.Success [[env pass_through] output]}))) (def: (label idx) (-> Nat Code) @@ -146,11 +146,11 @@ (case (//.result poly [(dictionary.has current_id [type g!var] env) inputs]) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [[_ inputs'] output]) - (#try.Success [[env inputs'] [g!var output]]))))) + {#try.Success [[_ inputs'] output]} + {#try.Success [[env inputs'] [g!var output]]})))) (template [<name> <flattener> <tag> <exception>] [(`` (def: .public (<name> poly) @@ -192,8 +192,8 @@ (recur (++ current_arg) (|> env' (dictionary.has funcI [headT funcL]) - (dictionary.has (++ funcI) [(#.Parameter (++ funcI)) varL])) - (#.Item varL all_varsL))) + (dictionary.has (++ funcI) [{#.Parameter (++ funcI)} varL])) + {#.Item varL all_varsL})) (let [partialI (|> current_arg (n.* 2) (n.+ funcI)) partial_varI (++ partialI) partial_varL (label partial_varI) @@ -203,8 +203,8 @@ (recur (++ current_arg) (|> env' (dictionary.has partialI [(|recursion_dummy|) partialC]) - (dictionary.has partial_varI [(#.Parameter partial_varI) partial_varL])) - (#.Item partial_varL all_varsL)))) + (dictionary.has partial_varI [{#.Parameter partial_varI} partial_varL])) + {#.Item partial_varL all_varsL}))) [all_varsL env']))]] (<| (with_env env') (local (list non_poly)) @@ -229,7 +229,7 @@ .let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] (if (n.= 0 (list.size paramsT)) (//.failure (exception.error ..not_application headT)) - (..local (#.Item funcT paramsT) poly)))) + (..local {#.Item funcT paramsT} poly)))) (template [<name> <test>] [(def: .public (<name> expected) @@ -258,9 +258,9 @@ [env ..env headT any] (case headT - (#.Parameter idx) + {#.Parameter idx} (case (dictionary.value (adjusted_idx env idx) env) - (#.Some [poly_type poly_code]) + {#.Some [poly_type poly_code]} (in poly_code) #.None @@ -275,10 +275,10 @@ [env ..env headT any] (case headT - (#.Parameter idx) + {#.Parameter idx} (if (n.= id (adjusted_idx env idx)) (in []) - (//.failure (exception.error ..wrong_parameter [(#.Parameter id) headT]))) + (//.failure (exception.error ..wrong_parameter [{#.Parameter id} headT]))) _ (//.failure (exception.error ..not_parameter headT))))) @@ -288,7 +288,7 @@ (do //.monad [headT any] (case headT - (#.Ex ex_id) + {#.Ex ex_id} (in ex_id) _ @@ -299,7 +299,7 @@ (do //.monad [inputT any] (case inputT - (#.Named name anonymousT) + {#.Named name anonymousT} (in [name anonymousT]) _ @@ -310,7 +310,7 @@ (do [! //.monad] [headT any] (case (type.anonymous headT) - (^ (#.Apply (|recursion_dummy|) (#.UnivQ _ headT'))) + (^ {#.Apply (|recursion_dummy|) {#.UnivQ _ headT'}}) (do ! [[recT _ output] (|> poly (with_extension (|recursion_dummy|)) @@ -327,9 +327,9 @@ [env ..env headT any] (case (type.anonymous headT) - (^multi (^ (#.Apply (|recursion_dummy|) (#.Parameter funcT_idx))) + (^multi (^ {#.Apply (|recursion_dummy|) {#.Parameter funcT_idx}}) (n.= 0 (adjusted_idx env funcT_idx)) - [(dictionary.value 0 env) (#.Some [self_type self_call])]) + [(dictionary.value 0 env) {#.Some [self_type self_call]}]) (in self_call) _ diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index a54e68170..6a1eb1206 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -42,13 +42,13 @@ (def: (result' parser attrs documents) (All (_ a) (-> (Parser a) Attrs (List XML) (Try a))) (case (//.result parser [attrs documents]) - (#try.Success [[attrs' remaining] output]) + {#try.Success [[attrs' remaining] output]} (if (list.empty? remaining) - (#try.Success output) + {#try.Success output} (exception.except ..unconsumed_inputs remaining)) - (#try.Failure error) - (#try.Failure error))) + {#try.Failure error} + {#try.Failure error})) (def: .public (result parser documents) (All (_ a) (-> (Parser a) (List XML) (Try a))) @@ -61,12 +61,12 @@ #.End (exception.except ..empty_input []) - (#.Item head tail) + {#.Item head tail} (case head - (#/.Text value) - (#try.Success [[attrs tail] value]) + {#/.Text value} + {#try.Success [[attrs tail] value]} - (#/.Node _) + {#/.Node _} (exception.except ..unexpected_input []))))) (def: .public tag @@ -76,13 +76,13 @@ #.End (exception.except ..empty_input []) - (#.Item head _) + {#.Item head _} (case head - (#/.Text _) + {#/.Text _} (exception.except ..unexpected_input []) - (#/.Node tag _ _) - (#try.Success [[attrs documents] tag]))))) + {#/.Node tag _ _} + {#try.Success [[attrs documents] tag]})))) (def: .public (attribute name) (-> Attribute (Parser Text)) @@ -91,8 +91,8 @@ #.None (exception.except ..unknown_attribute [name (dictionary.keys attrs)]) - (#.Some value) - (#try.Success [[attrs documents] value])))) + {#.Some value} + {#try.Success [[attrs documents] value]}))) (def: .public (node expected parser) (All (_ a) (-> Tag (Parser a) (Parser a))) @@ -101,12 +101,12 @@ #.End (exception.except ..empty_input []) - (#.Item head tail) + {#.Item head tail} (case head - (#/.Text _) + {#/.Text _} (exception.except ..unexpected_input []) - (#/.Node actual attrs' children) + {#/.Node actual attrs' children} (if (name\= expected actual) (|> children (..result' parser attrs') @@ -120,8 +120,8 @@ #.End (exception.except ..empty_input []) - (#.Item head tail) - (#try.Success [[attrs tail] head])))) + {#.Item head tail} + {#try.Success [[attrs tail] head]}))) (exception: .public nowhere) @@ -129,16 +129,16 @@ (All (_ a) (-> (Parser a) (Parser a))) (function (recur [attrs input]) (case (//.result parser [attrs input]) - (#try.Success [[attrs remaining] output]) - (#try.Success [[attrs remaining] output]) + {#try.Success [[attrs remaining] output]} + {#try.Success [[attrs remaining] output]} - (#try.Failure error) + {#try.Failure error} (case input #.End (exception.except ..nowhere []) - (#.Item head tail) + {#.Item head tail} (do try.monad [[[attrs tail'] output] (recur [attrs tail])] - (in [[attrs (#.Item head tail')] + (in [[attrs {#.Item head tail'}] output])))))) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index 9c3c5ce36..2f9c81229 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -37,7 +37,7 @@ (def: _reversed_ (Parser Any) (function (_ tokens) - (#try.Success [(list.reversed tokens) []]))) + {#try.Success [(list.reversed tokens) []]})) (syntax: .public (cond> [_ _reversed_ prev <code>.any diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux index 58f406e3a..934daf578 100644 --- a/stdlib/source/library/lux/control/region.lux +++ b/stdlib/source/library/lux/control/region.lux @@ -35,20 +35,20 @@ output (Try a)]) (format error (case output - (#try.Success _) + {#try.Success _} "" - (#try.Failure error|output) + {#try.Failure error|output} (format separator error|output)))) (def: (clean clean_up output) (All (_ a) (-> (Try Any) (Try a) (Try a))) (case clean_up - (#try.Success _) + {#try.Success _} output - (#try.Failure error) + {#try.Failure error} (exception.except ..clean_up_error [error output]))) (def: .public (run! monad computation) @@ -65,9 +65,9 @@ (All (_ ! a) (-> (Monad !) (-> a (! (Try Any))) a (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) - (\ monad in [(#.Item (function (_ region) (cleaner value)) - cleaners) - (#try.Success value)]))) + (\ monad in [{#.Item (function (_ region) (cleaner value)) + cleaners} + {#try.Success value}]))) (implementation: .public (functor super) (All (_ !) @@ -80,11 +80,11 @@ (\ super each (function (_ [cleaners' temp]) [cleaners' (case temp - (#try.Success value) - (#try.Success (f value)) + {#try.Success value} + {#try.Success (f value)} - (#try.Failure error) - (#try.Failure error))]) + {#try.Failure error} + {#try.Failure error})]) (fa region+cleaners)))))) (implementation: .public (apply super) @@ -101,16 +101,16 @@ [[cleaners ef] (ff [region cleaners]) [cleaners ea] (fa [region cleaners])] (case ef - (#try.Success f) + {#try.Success f} (case ea - (#try.Success a) - (in [cleaners (#try.Success (f a))]) + {#try.Success a} + (in [cleaners {#try.Success (f a)}]) - (#try.Failure error) - (in [cleaners (#try.Failure error)])) + {#try.Failure error} + (in [cleaners {#try.Failure error}])) - (#try.Failure error) - (in [cleaners (#try.Failure error)])))))) + {#try.Failure error} + (in [cleaners {#try.Failure error}])))))) (implementation: .public (monad super) (All (_ !) @@ -122,25 +122,25 @@ (def: (in value) (function (_ [region cleaners]) - (\ super in [cleaners (#try.Success value)]))) + (\ super in [cleaners {#try.Success value}]))) (def: (conjoint ffa) (function (_ [region cleaners]) (do super [[cleaners efa] (ffa [region cleaners])] (case efa - (#try.Success fa) + {#try.Success fa} (fa [region cleaners]) - (#try.Failure error) - (in [cleaners (#try.Failure error)])))))) + {#try.Failure error} + (in [cleaners {#try.Failure error}])))))) (def: .public (failure monad error) (All (_ ! a) (-> (Monad !) Text (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) - (\ monad in [cleaners (#try.Failure error)]))) + (\ monad in [cleaners {#try.Failure error}]))) (def: .public (except monad exception message) (All (_ ! e a) @@ -154,5 +154,5 @@ (All (_ r) (Region r ! a)))) (function (_ [region cleaners]) (\ monad each - (|>> #try.Success [cleaners]) + (|>> {#try.Success} [cleaners]) operation))) diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index b2db48900..dcf7c1c8b 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -30,7 +30,7 @@ ["Today" (%.date today)] ["Message" message] ["Code" (case focus - (#.Some focus) + {#.Some focus} (%.code focus) #.None @@ -44,10 +44,10 @@ (do <>.monad [raw <c>.text] (case (\ date.codec decoded raw) - (#try.Success date) + {#try.Success date} (in date) - (#try.Failure message) + {#try.Failure message} (<>.failure message))))) (syntax: .public (remember [deadline ..deadline @@ -57,7 +57,7 @@ today (instant.date now)] (if (date\< deadline today) (in (case focus - (#.Some focus) + {#.Some focus} (list focus) #.None @@ -71,7 +71,7 @@ (in (list (` (..remember (~ (code.text (%.date deadline))) (~ (code.text (format <message> " " message))) (~+ (case focus - (#.Some focus) + {#.Some focus} (list focus) #.None diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 16d58007c..b18a38dd8 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -11,19 +11,19 @@ (type: .public (Try a) (Variant - (#Failure Text) - (#Success a))) + {#Failure Text} + {#Success a})) (implementation: .public functor (Functor Try) (def: (each f ma) (case ma - (#Failure msg) - (#Failure msg) + {#Failure msg} + {#Failure msg} - (#Success datum) - (#Success (f datum))))) + {#Success datum} + {#Success (f datum)}))) (implementation: .public apply (Apply Try) @@ -32,16 +32,16 @@ (def: (on fa ff) (case ff - (#Success f) + {#Success f} (case fa - (#Success a) - (#Success (f a)) + {#Success a} + {#Success (f a)} - (#Failure msg) - (#Failure msg)) + {#Failure msg} + {#Failure msg}) - (#Failure msg) - (#Failure msg)))) + {#Failure msg} + {#Failure msg}))) (implementation: .public monad (Monad Try) @@ -49,14 +49,14 @@ (def: &functor ..functor) (def: (in a) - (#Success a)) + {#Success a}) (def: (conjoint mma) (case mma - (#Failure msg) - (#Failure msg) + {#Failure msg} + {#Failure msg} - (#Success ma) + {#Success ma} ma))) (implementation: .public (with monad) @@ -74,10 +74,10 @@ (do monad [eMea MeMea] (case eMea - (#Failure try) - (in (#Failure try)) + {#Failure try} + (in {#Failure try}) - (#Success Mea) + {#Success Mea} Mea)))) (def: .public (lifted monad) @@ -89,10 +89,10 @@ (def: (= reference sample) (case [reference sample] - [(#Success reference) (#Success sample)] + [{#Success reference} {#Success sample}] (_\= reference sample) - [(#Failure reference) (#Failure sample)] + [{#Failure reference} {#Failure sample}] ("lux text =" reference sample) _ @@ -103,42 +103,42 @@ (All (_ a) (-> (Try a) a)) (case try - (#Success value) + {#Success value} value - (#Failure message) + {#Failure message} (panic! message))) (def: .public (maybe try) (All (_ a) (-> (Try a) (Maybe a))) (case try - (#Success value) - (#.Some value) + {#Success value} + {#.Some value} - (#Failure message) + {#Failure message} #.None)) (def: .public (of_maybe maybe) (All (_ a) (-> (Maybe a) (Try a))) (case maybe - (#.Some value) - (#Success value) + {#.Some value} + {#Success value} #.None - (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encoded) - (name_of ..of_maybe)))))) + {#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encoded) + (name_of ..of_maybe)))})) (macro: .public (else tokens compiler) (case tokens (^ (list else try)) - (#Success [compiler (list (` (case (~ try) - (#..Success (~' g!temp)) + {#Success [compiler (list (` (case (~ try) + {#..Success (~' g!temp)} (~' g!temp) - (#..Failure (~ [location.dummy (#.Identifier ["" ""])])) - (~ else))))]) + {#..Failure (~ [location.dummy {#.Identifier ["" ""]}])} + (~ else))))]} _ - (#Failure "Wrong syntax for else"))) + {#Failure "Wrong syntax for else"})) diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux index 0805da036..6d824d2eb 100644 --- a/stdlib/source/library/lux/control/writer.lux +++ b/stdlib/source/library/lux/control/writer.lux @@ -63,7 +63,11 @@ (def: (conjoint MlMla) (do monad [[l1 Mla] (for [@.old - (: ((:parameter 1) (Writer (:parameter 0) ((:parameter 1) (Writer (:parameter 0) (:parameter 2))))) + (: {#.Apply (Writer (:parameter 0) + {#.Apply (Writer (:parameter 0) + (:parameter 2)) + (:parameter 1)}) + (:parameter 1)} MlMla)] ... On new compiler MlMla) diff --git a/stdlib/source/library/lux/data/binary.lux b/stdlib/source/library/lux/data/binary.lux index 33bac997b..e4a07b788 100644 --- a/stdlib/source/library/lux/data/binary.lux +++ b/stdlib/source/library/lux/data/binary.lux @@ -198,31 +198,31 @@ (def: .public (read/8! index binary) (-> Nat Binary (Try I64)) (if (n.< (..!size binary) index) - (#try.Success (!read index binary)) + {#try.Success (!read index binary)} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (read/16! index binary) (-> Nat Binary (Try I64)) (if (n.< (..!size binary) (n.+ 1 index)) - (#try.Success ($_ i64.or + {#try.Success ($_ i64.or (i64.left_shifted 8 (!read index binary)) - (!read (n.+ 1 index) binary))) + (!read (n.+ 1 index) binary))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (read/32! index binary) (-> Nat Binary (Try I64)) (if (n.< (..!size binary) (n.+ 3 index)) - (#try.Success ($_ i64.or + {#try.Success ($_ i64.or (i64.left_shifted 24 (!read index binary)) (i64.left_shifted 16 (!read (n.+ 1 index) binary)) (i64.left_shifted 8 (!read (n.+ 2 index) binary)) - (!read (n.+ 3 index) binary))) + (!read (n.+ 3 index) binary))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (read/64! index binary) (-> Nat Binary (Try I64)) (if (n.< (..!size binary) (n.+ 7 index)) - (#try.Success ($_ i64.or + {#try.Success ($_ i64.or (i64.left_shifted 56 (!read index binary)) (i64.left_shifted 48 (!read (n.+ 1 index) binary)) (i64.left_shifted 40 (!read (n.+ 2 index) binary)) @@ -230,32 +230,32 @@ (i64.left_shifted 24 (!read (n.+ 4 index) binary)) (i64.left_shifted 16 (!read (n.+ 5 index) binary)) (i64.left_shifted 8 (!read (n.+ 6 index) binary)) - (!read (n.+ 7 index) binary))) + (!read (n.+ 7 index) binary))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (write/8! index value binary) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) index) - (#try.Success (|> binary - (!write index value))) + {#try.Success (|> binary + (!write index value))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (write/16! index value binary) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) (n.+ 1 index)) - (#try.Success (|> binary + {#try.Success (|> binary (!write index (i64.right_shifted 8 value)) - (!write (n.+ 1 index) value))) + (!write (n.+ 1 index) value))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (write/32! index value binary) (-> Nat (I64 Any) Binary (Try Binary)) (if (n.< (..!size binary) (n.+ 3 index)) - (#try.Success (|> binary + {#try.Success (|> binary (!write index (i64.right_shifted 24 value)) (!write (n.+ 1 index) (i64.right_shifted 16 value)) (!write (n.+ 2 index) (i64.right_shifted 8 value)) - (!write (n.+ 3 index) value))) + (!write (n.+ 3 index) value))} (exception.except ..index_out_of_bounds [(..!size binary) index]))) (def: .public (write/64! index value binary) @@ -270,7 +270,7 @@ (!write (n.+ 6 index) (i64.right_shifted 8 value)) (!write (n.+ 7 index) value))] (|> binary write_high write_low #try.Success))] - (#try.Success (|> binary + {#try.Success (|> binary (!write index (i64.right_shifted 56 value)) (!write (n.+ 1 index) (i64.right_shifted 48 value)) (!write (n.+ 2 index) (i64.right_shifted 40 value)) @@ -278,7 +278,7 @@ (!write (n.+ 4 index) (i64.right_shifted 24 value)) (!write (n.+ 5 index) (i64.right_shifted 16 value)) (!write (n.+ 6 index) (i64.right_shifted 8 value)) - (!write (n.+ 7 index) value)))) + (!write (n.+ 7 index) value))}) (exception.except ..index_out_of_bounds [(..!size binary) index]))) (implementation: .public equivalence @@ -329,7 +329,7 @@ (!read (n.+ source_offset index) source) target) (recur (++ index))) - (#try.Success target)))))))) + {#try.Success target}))))))) (def: .public (slice offset length binary) (-> Nat Nat Binary (Try Binary)) @@ -337,7 +337,7 @@ limit (n.+ length offset)] (if (n.> size limit) (exception.except ..slice_out_of_bounds [size offset length]) - (with_expansions [<jvm> (as_is (#try.Success (java/util/Arrays::copyOfRange binary (.int offset) (.int limit))))] + (with_expansions [<jvm> (as_is {#try.Success (java/util/Arrays::copyOfRange binary (.int offset) (.int limit))})] (for [@.old <jvm> @.jvm <jvm>] @@ -350,10 +350,10 @@ 0 binary _ (let [distance (n.- bytes (..!size binary))] (case (..slice bytes distance binary) - (#try.Success slice) + {#try.Success slice} slice - (#try.Failure _) + {#try.Failure _} (..empty 0))))) (implementation: .public monoid diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux index b1926e164..d78777213 100644 --- a/stdlib/source/library/lux/data/bit.lux +++ b/stdlib/source/library/lux/data/bit.lux @@ -56,9 +56,9 @@ (def: (decoded input) (case input - "#1" (#.Right #1) - "#0" (#.Right #0) - _ (#.Left "Wrong syntax for Bit.")))) + "#1" {#.Right #1} + "#0" {#.Right #0} + _ {#.Left "Wrong syntax for Bit."}))) (def: .public complement (All (_ a) (-> (-> a Bit) (-> a Bit))) diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux index 0bd99245d..31cfc865b 100644 --- a/stdlib/source/library/lux/data/collection/array.lux +++ b/stdlib/source/library/lux/data/collection/array.lux @@ -22,7 +22,7 @@ "#Array") (type: .public (Array a) - (#.Primitive ..type_name (#.Item a #.End))) + {#.Primitive ..type_name {#.Item a #.End}}) (with_expansions [<index_type> (primitive "java.lang.Long") <elem_type> (primitive "java.lang.Object") @@ -79,7 +79,7 @@ [(let [output (<read!> index array)] (if (<null?> output) #.None - (#.Some output)))]) + {#.Some output}))]) (def: .public (read! index array) (All (_ a) @@ -89,7 +89,7 @@ (let [value ("jvm aaload" array index)] (if ("jvm object null?" value) #.None - (#.Some value))) + {#.Some value})) @.jvm (let [value (|> array @@ -97,7 +97,7 @@ ("jvm array read object" (!int index)))] (if ("jvm object null?" value) #.None - (#.Some (:expected value)))) + {#.Some (:expected value)})) @.js (!read! "js array read" "js object undefined?") @.python (!read! "python array read" "python object none?") @@ -149,7 +149,7 @@ (All (_ a) (-> Nat (Array a) Bit)) (case (..read! index array) - (#.Some _) + {#.Some _} true _ @@ -162,7 +162,7 @@ #.None array - (#.Some value) + {#.Some value} (write! index (transform value) array))) (def: .public (upsert! index default transform array) @@ -183,7 +183,7 @@ #.None target - (#.Some value) + {#.Some value} (write! (n.+ offset dest_start) value target))) dest_array (list.indices length)))) @@ -195,7 +195,7 @@ #.None count - (#.Some _) + {#.Some _} (++ count))) 0 (list.indices (size array)))) @@ -212,7 +212,7 @@ #.None xs' - (#.Some x) + {#.Some x} (if (p x) xs' (delete! idx xs')))) @@ -229,9 +229,9 @@ #.None (recur (++ idx)) - (#.Some x) + {#.Some x} (if (p x) - (#.Some x) + {#.Some x} (recur (++ idx)))) #.None)))) @@ -245,9 +245,9 @@ #.None (recur (++ idx)) - (#.Some x) + {#.Some x} (if (p idx x) - (#.Some [idx x]) + {#.Some [idx x]} (recur (++ idx)))) #.None)))) @@ -259,7 +259,7 @@ #.None ys - (#.Some x) + {#.Some x} (write! idx x ys))) (empty arr_size) (list.indices arr_size)))) @@ -286,8 +286,8 @@ _ (recur (-- idx) (case (read! idx array) - (#.Some head) - (#.Item head output) + {#.Some head} + {#.Item head output} #.None output))))) @@ -302,13 +302,13 @@ _ (recur (-- idx) - (#.Item (maybe.else default (read! idx array)) - output))))) + {#.Item (maybe.else default (read! idx array)) + output})))) (def: .public (list default array) (All (_ a) (-> (Maybe a) (Array a) (List a))) (case default - (#.Some default) + {#.Some default} (list|+default default array) #.None @@ -327,7 +327,7 @@ [#.None #.None] true - [(#.Some x) (#.Some y)] + [{#.Some x} {#.Some y}] (,\= x y) _ @@ -359,7 +359,7 @@ #.None mb - (#.Some x) + {#.Some x} (write! idx (f x) mb))) (empty arr_size) (list.indices arr_size)) @@ -377,7 +377,7 @@ #.None (recur so_far (++ idx)) - (#.Some value) + {#.Some value} (recur (f value so_far) (++ idx))) so_far))))) @@ -390,7 +390,7 @@ (loop [idx 0] (if (n.< size idx) (case (..read! idx array) - (#.Some value) + {#.Some value} (<op> (predicate value) (recur (++ idx))) diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux index 3d7e785f3..bc78d8032 100644 --- a/stdlib/source/library/lux/data/collection/dictionary.lux +++ b/stdlib/source/library/lux/data/collection/dictionary.lux @@ -58,11 +58,11 @@ ... Dictionaries. (type: (Node k v) (Variant - (#Hierarchy Nat (Array (Node k v))) - (#Base Bit_Map - (Array (Either (Node k v) - [k v]))) - (#Collisions Hash_Code (Array [k v])))) + {#Hierarchy Nat (Array (Node k v))} + {#Base Bit_Map + (Array (Either (Node k v) + [k v]))} + {#Collisions Hash_Code (Array [k v])})) ... #Hierarchy nodes are meant to point down only to lower-level nodes. (type: (Hierarchy k v) @@ -127,7 +127,7 @@ ... The cannonical empty node, which is just an empty #Base node. (def: empty_node Node - (#Base clean_bitmap (array.empty 0))) + {#Base clean_bitmap (array.empty 0)}) ... Expands a copy of the array, to have 1 extra slot, which is used ... for storing the value. @@ -241,11 +241,11 @@ (let [[bitmap base] node] (case (array.read! idx h_array) #.None [insertion_idx node] - (#.Some sub_node) (if (n.= except_idx idx) + {#.Some sub_node} (if (n.= except_idx idx) [insertion_idx node] [(++ insertion_idx) [(with_bit_position (to_bit_position idx) bitmap) - (array.write! insertion_idx (#.Left sub_node) base)]]) + (array.write! insertion_idx {#.Left sub_node} base)]]) ))) [0 [clean_bitmap (array.empty (-- h_size))]] @@ -268,10 +268,10 @@ bitmap) [(++ base_idx) (case (array.read! base_idx base) - (#.Some (#.Left sub_node)) + {#.Some {#.Left sub_node}} (array.write! hierarchy_idx sub_node h_array) - (#.Some (#.Right [key' val'])) + {#.Some {#.Right [key' val']}} (array.write! hierarchy_idx (node\has (level_up level) (\ key_hash hash key') key' val' key_hash empty_node) h_array) @@ -289,7 +289,7 @@ (def: (node\empty? node) (All (_ k v) (-> (Node k v) Bit)) (`` (case node - (#Base (~~ (static ..clean_bitmap)) _) + {#Base (~~ (static ..clean_bitmap)) _} #1 _ @@ -300,47 +300,47 @@ (case node ... For #Hierarchy nodes, check whether one can add the element to ... a sub-node. If impossible, introduce a new singleton sub-node. - (#Hierarchy _size hierarchy) + {#Hierarchy _size hierarchy} (let [idx (level_index level hash) [_size' sub_node] (case (array.read! idx hierarchy) - (#.Some sub_node) + {#.Some sub_node} [_size sub_node] _ [(++ _size) empty_node])] - (#Hierarchy _size' - (array\revised idx (node\has (level_up level) hash key val key_hash sub_node) - hierarchy))) + {#Hierarchy _size' + (array\revised idx (node\has (level_up level) hash key val key_hash sub_node) + hierarchy)}) ... For #Base nodes, check if the corresponding Bit_Position has ... already been used. - (#Base bitmap base) + {#Base bitmap base} (let [bit (level_bit_position level hash)] (if (with_bit_position? bit bitmap) ... If so... (let [idx (base_index bit bitmap)] (case (array.read! idx base) ... If it's being used by a node, add the KV to it. - (#.Some (#.Left sub_node)) + {#.Some {#.Left sub_node}} (let [sub_node' (node\has (level_up level) hash key val key_hash sub_node)] - (#Base bitmap (array\revised idx (#.Left sub_node') base))) + {#Base bitmap (array\revised idx {#.Left sub_node'} base)}) ... Otherwise, if it's being used by a KV, compare the keys. - (#.Some (#.Right key' val')) + {#.Some {#.Right key' val'}} (if (\ key_hash = key key') ... If the same key is found, replace the value. - (#Base bitmap (array\revised idx (#.Right key val) base)) + {#Base bitmap (array\revised idx {#.Right key val} base)} ... Otherwise, compare the hashes of the keys. - (#Base bitmap (array\revised idx - (#.Left (let [hash' (\ key_hash hash key')] + {#Base bitmap (array\revised idx + {#.Left (let [hash' (\ key_hash hash key')] (if (n.= hash hash') ... If the hashes are ... the same, a new ... #Collisions node ... is added. - (#Collisions hash (|> (array.empty 2) + {#Collisions hash (|> (array.empty 2) (array.write! 0 [key' val']) - (array.write! 1 [key val]))) + (array.write! 1 [key val]))} ... Otherwise, one can ... just keep using ... #Base nodes, so @@ -349,8 +349,8 @@ (let [next_level (level_up level)] (|> empty_node (node\has next_level hash' key' val' key_hash) - (node\has next_level hash key val key_hash)))))) - base))) + (node\has next_level hash key val key_hash)))))} + base)}) #.None (undefined))) @@ -360,35 +360,35 @@ (if (n.< ..promotion_threshold base_count) ... If so, resize the #Base node to accommodate the ... new KV-pair. - (#Base (with_bit_position bit bitmap) - (array\has (base_index bit bitmap) (#.Right [key val]) base)) + {#Base (with_bit_position bit bitmap) + (array\has (base_index bit bitmap) {#.Right [key val]} base)} ... Otherwise, promote it to a #Hierarchy node, and add the new ... KV-pair as a singleton node to it. - (#Hierarchy (++ base_count) - (|> base - (promotion node\has key_hash level bitmap) - (array.write! (level_index level hash) - (node\has (level_up level) hash key val key_hash empty_node)))))))) + {#Hierarchy (++ base_count) + (|> base + (promotion node\has key_hash level bitmap) + (array.write! (level_index level hash) + (node\has (level_up level) hash key val key_hash empty_node)))})))) ... For #Collisions nodes, compare the hashes. - (#Collisions _hash _colls) + {#Collisions _hash _colls} (if (n.= hash _hash) ... If they're equal, that means the new KV contributes to the ... collisions. (case (collision_index key_hash key _colls) ... If the key was already present in the collisions-list, its ... value gets updated. - (#.Some coll_idx) - (#Collisions _hash (array\revised coll_idx [key val] _colls)) + {#.Some coll_idx} + {#Collisions _hash (array\revised coll_idx [key val] _colls)} ... Otherwise, the KV-pair is added to the collisions-list. #.None - (#Collisions _hash (array\has (array.size _colls) [key val] _colls))) + {#Collisions _hash (array\has (array.size _colls) [key val] _colls)}) ... If the hashes are not equal, create a new #Base node that ... contains the old #Collisions node, plus the new KV-pair. - (|> (#Base (level_bit_position level _hash) - (|> (array.empty 1) - (array.write! 0 (#.Left node)))) + (|> {#Base (level_bit_position level _hash) + (|> (array.empty 1) + (array.write! 0 {#.Left node}))} (node\has level hash key val key_hash))) )) @@ -397,7 +397,7 @@ (case node ... For #Hierarchy nodes, find out if there's a valid sub-node for ... the Hash-Code. - (#Hierarchy h_size h_array) + {#Hierarchy h_size h_array} (let [idx (level_index level hash)] (case (array.read! idx h_array) ... If not, there's nothing to remove. @@ -405,7 +405,7 @@ node ... But if there is, try to remove the key from the sub-node. - (#.Some sub_node) + {#.Some sub_node} (let [sub_node' (node\lacks (level_up level) hash key key_hash sub_node)] ... Then check if a removal was actually done. (if (same? sub_node sub_node') @@ -416,22 +416,22 @@ ... Check if it's due time for a demotion. (if (n.> demotion_threshold h_size) ... If so, just clear the space. - (#Hierarchy (-- h_size) (array\clear idx h_array)) + {#Hierarchy (-- h_size) (array\clear idx h_array)} ... Otherwise, perform it. - (#Base (demotion idx [h_size h_array]))) + {#Base (demotion idx [h_size h_array])}) ... But if the sub_removal yielded a non_empty node, then ... just update the hiearchy branch. - (#Hierarchy h_size (array\revised idx sub_node' h_array))))))) + {#Hierarchy h_size (array\revised idx sub_node' h_array)}))))) ... For #Base nodes, check whether the Bit_Position is set. - (#Base bitmap base) + {#Base bitmap base} (let [bit (level_bit_position level hash)] (if (with_bit_position? bit bitmap) (let [idx (base_index bit bitmap)] (case (array.read! idx base) ... If set, check if it's a sub_node, and remove the KV ... from it. - (#.Some (#.Left sub_node)) + {#.Some {#.Left sub_node}} (let [sub_node' (node\lacks (level_up level) hash key key_hash sub_node)] ... Verify that it was removed. (if (same? sub_node sub_node') @@ -445,20 +445,20 @@ empty_node ... But if not, then just unset the position and ... remove the node. - (#Base (without_bit_position bit bitmap) - (array\lacks idx base))) + {#Base (without_bit_position bit bitmap) + (array\lacks idx base)}) ... But, if it did not come out empty, then the ... position is kept, and the node gets updated. - (#Base bitmap - (array\revised idx (#.Left sub_node') base))))) + {#Base bitmap + (array\revised idx {#.Left sub_node'} base)}))) ... If, however, there was a KV-pair instead of a sub-node. - (#.Some (#.Right [key' val'])) + {#.Some {#.Right [key' val']}} ... Check if the keys match. (if (\ key_hash = key key') ... If so, remove the KV-pair and unset the Bit_Position. - (#Base (without_bit_position bit bitmap) - (array\lacks idx base)) + {#Base (without_bit_position bit bitmap) + (array\lacks idx base)} ... Otherwise, there's nothing to remove. node) @@ -468,42 +468,42 @@ node)) ... For #Collisions nodes, It need to find out if the key already existst. - (#Collisions _hash _colls) + {#Collisions _hash _colls} (case (collision_index key_hash key _colls) ... If not, then there's nothing to remove. #.None node ... But if so, then check the size of the collisions list. - (#.Some idx) + {#.Some idx} (if (n.= 1 (array.size _colls)) ... If there's only one left, then removing it leaves us with ... an empty node. empty_node ... Otherwise, just shrink the array by removing the KV-pair. - (#Collisions _hash (array\lacks idx _colls)))) + {#Collisions _hash (array\lacks idx _colls)})) )) (def: (node\value level hash key key_hash node) (All (_ k v) (-> Level Hash_Code k (Hash k) (Node k v) (Maybe v))) (case node ... For #Hierarchy nodes, just look-up the key on its children. - (#Hierarchy _size hierarchy) + {#Hierarchy _size hierarchy} (case (array.read! (level_index level hash) hierarchy) #.None #.None - (#.Some sub_node) (node\value (level_up level) hash key key_hash sub_node)) + {#.Some sub_node} (node\value (level_up level) hash key key_hash sub_node)) ... For #Base nodes, check the leaves, and recursively check the branches. - (#Base bitmap base) + {#Base bitmap base} (let [bit (level_bit_position level hash)] (if (with_bit_position? bit bitmap) (case (array.read! (base_index bit bitmap) base) - (#.Some (#.Left sub_node)) + {#.Some {#.Left sub_node}} (node\value (level_up level) hash key key_hash sub_node) - (#.Some (#.Right [key' val'])) + {#.Some {#.Right [key' val']}} (if (\ key_hash = key key') - (#.Some val') + {#.Some val'} #.None) #.None @@ -511,7 +511,7 @@ #.None)) ... For #Collisions nodes, do a linear scan of all the known KV-pairs. - (#Collisions _hash _colls) + {#Collisions _hash _colls} (\ maybe.monad each product.right (array.example (|>> product.left (\ key_hash = key)) _colls)) @@ -520,41 +520,41 @@ (def: (node\size node) (All (_ k v) (-> (Node k v) Nat)) (case node - (#Hierarchy _size hierarchy) + {#Hierarchy _size hierarchy} (array\mix n.+ 0 (array\each node\size hierarchy)) - (#Base _ base) + {#Base _ base} (array\mix n.+ 0 (array\each (function (_ sub_node') (case sub_node' - (#.Left sub_node) (node\size sub_node) - (#.Right _) 1)) + {#.Left sub_node} (node\size sub_node) + {#.Right _} 1)) base)) - (#Collisions hash colls) + {#Collisions hash colls} (array.size colls) )) (def: (node\entries node) (All (_ k v) (-> (Node k v) (List [k v]))) (case node - (#Hierarchy _size hierarchy) + {#Hierarchy _size hierarchy} (array\mix (function (_ sub_node tail) (list\composite (node\entries sub_node) tail)) #.End hierarchy) - (#Base bitmap base) + {#Base bitmap base} (array\mix (function (_ branch tail) (case branch - (#.Left sub_node) + {#.Left sub_node} (list\composite (node\entries sub_node) tail) - (#.Right [key' val']) - (#.Item [key' val'] tail))) + {#.Right [key' val']} + {#.Item [key' val'] tail})) #.End base) - (#Collisions hash colls) - (array\mix (function (_ [key' val'] tail) (#.Item [key' val'] tail)) + {#Collisions hash colls} + (array\mix (function (_ [key' val'] tail) {#.Item [key' val'] tail}) #.End colls))) @@ -591,15 +591,15 @@ (All (_ k v) (-> (Dictionary k v) k Bit)) (case (value key dict) #.None #0 - (#.Some _) #1)) + {#.Some _} #1)) (exception: .public key_already_exists) (def: .public (has' key val dict) (All (_ k v) (-> k v (Dictionary k v) (Try (Dictionary k v)))) (case (value key dict) - #.None (#try.Success (has key val dict)) - (#.Some _) (exception.except ..key_already_exists []))) + #.None {#try.Success (has key val dict)} + {#.Some _} (exception.except ..key_already_exists []))) (def: .public (revised key f dict) (All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v))) @@ -607,7 +607,7 @@ #.None dict - (#.Some val) + {#.Some val} (has key (f val) dict))) (def: .public (revised' key default f dict) @@ -641,7 +641,7 @@ (All (_ k v) (-> (Dictionary k v) (List <side>))) (|>> ..entries (list\mix (function (_ [k v] bundle) - (#.Item <side> bundle)) + {#.Item <side> bundle}) #.End)))] [k keys] @@ -661,7 +661,7 @@ #.None (has key val2 dict) - (#.Some val1) + {#.Some val1} (has key (f val2 val1) dict))) dict1 (entries dict2))) @@ -672,7 +672,7 @@ #.None dict - (#.Some val) + {#.Some val} (|> dict (lacks from_key) (has to_key val)))) @@ -683,7 +683,7 @@ (list\mix (function (_ key new_dict) (case (value key dict) #.None new_dict - (#.Some val) (has key val new_dict))) + {#.Some val} (has key val new_dict))) (empty key_hash) keys))) @@ -695,7 +695,7 @@ (..size subject)) (list.every? (function (_ [k rv]) (case (..value k subject) - (#.Some sv) + {#.Some sv} (,\= rv sv) _ @@ -707,23 +707,23 @@ (def: (each f fa) (case fa - (#Hierarchy size hierarchy) - (#Hierarchy size (array\each (each f) hierarchy)) + {#Hierarchy size hierarchy} + {#Hierarchy size (array\each (each f) hierarchy)} - (#Base bitmap base) - (#Base bitmap (array\each (function (_ either) + {#Base bitmap base} + {#Base bitmap (array\each (function (_ either) (case either - (#.Left fa') - (#.Left (each f fa')) + {#.Left fa'} + {#.Left (each f fa')} - (#.Right [k v]) - (#.Right [k (f v)]))) - base)) + {#.Right [k v]} + {#.Right [k (f v)]})) + base)} - (#Collisions hash collisions) - (#Collisions hash (array\each (function (_ [k v]) + {#Collisions hash collisions} + {#Collisions hash (array\each (function (_ [k v]) [k (f v)]) - collisions))))) + collisions)}))) (implementation: .public functor (All (_ k) (Functor (Dictionary k))) diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux index 857683d40..d6376e88b 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux @@ -65,11 +65,11 @@ #.None #.None - (#.Some node) + {#.Some node} (let [node_key (value@ #key node)] (cond (\ dict = node_key key) ... (_\= node_key key) - (#.Some (value@ #value node)) + {#.Some (value@ #value node)} (\ dict < node_key key) ... (_\< node_key key) @@ -90,7 +90,7 @@ #.None #0 - (#.Some node) + {#.Some node} (let [node_key (value@ #key node)] (or (\ dict = node_key key) ... (_\= node_key key) @@ -106,13 +106,13 @@ #.None #.None - (#.Some node) + {#.Some node} (loop [node node] (case (value@ <side> node) #.None - (#.Some (value@ #value node)) + {#.Some (value@ #value node)} - (#.Some side) + {#.Some side} (recur side)))))] [min #left] @@ -126,7 +126,7 @@ #.None 0 - (#.Some node) + {#.Some node} (++ (n.+ (recur (value@ #left node)) (recur (value@ #right node))))))) @@ -155,42 +155,42 @@ #Red (red (value@ #key center) (value@ #value center) - (#.Some addition) + {#.Some addition} (value@ #right center)) #Black (with_expansions [<default_behavior> (as_is (black (value@ #key center) (value@ #value center) - (#.Some addition) + {#.Some addition} (value@ #right center)))] (case (value@ #color addition) #Red (case (value@ #left addition) - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Red]) (red (value@ #key addition) (value@ #value addition) - (#.Some (blackened left)) - (#.Some (black (value@ #key center) + {#.Some (blackened left)} + {#.Some (black (value@ #key center) (value@ #value center) (value@ #right addition) - (value@ #right center)))) + (value@ #right center))}) _ (case (value@ #right addition) - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Red]) (red (value@ #key right) (value@ #value right) - (#.Some (black (value@ #key addition) + {#.Some (black (value@ #key addition) (value@ #value addition) (value@ #left addition) - (value@ #left right))) - (#.Some (black (value@ #key center) + (value@ #left right))} + {#.Some (black (value@ #key center) (value@ #value center) (value@ #right right) - (value@ #right center)))) + (value@ #right center))}) _ <default_behavior>)) @@ -205,41 +205,41 @@ (red (value@ #key center) (value@ #value center) (value@ #left center) - (#.Some addition)) + {#.Some addition}) #Black (with_expansions [<default_behavior> (as_is (black (value@ #key center) (value@ #value center) (value@ #left center) - (#.Some addition)))] + {#.Some addition}))] (case (value@ #color addition) #Red (case (value@ #right addition) - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Red]) (red (value@ #key addition) (value@ #value addition) - (#.Some (black (value@ #key center) + {#.Some (black (value@ #key center) (value@ #value center) (value@ #left center) - (value@ #left addition))) - (#.Some (blackened right))) + (value@ #left addition))} + {#.Some (blackened right)}) _ (case (value@ #left addition) - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Red]) (red (value@ #key left) (value@ #value left) - (#.Some (black (value@ #key center) + {#.Some (black (value@ #key center) (value@ #value center) (value@ #left center) - (value@ #left left))) - (#.Some (black (value@ #key addition) + (value@ #left left))} + {#.Some (black (value@ #key addition) (value@ #value addition) (value@ #right left) - (value@ #right addition)))) + (value@ #right addition))}) _ <default_behavior>)) @@ -253,9 +253,9 @@ root' (loop [?root (value@ #root dict)] (case ?root #.None - (#.Some (red key value #.None #.None)) + {#.Some (red key value #.None #.None)} - (#.Some root) + {#.Some root} (let [reference (value@ #key root)] (`` (cond (~~ (template [<comp> <tag> <add>] [(<comp> reference key) @@ -263,15 +263,15 @@ outcome (recur side_root)] (if (same? side_root outcome) ?root - (#.Some (<add> (maybe.trusted outcome) - root))))] + {#.Some (<add> (maybe.trusted outcome) + root)}))] [_\< #left ..with_left] [(order.> (value@ #&order dict)) #right ..with_right] )) ... (_\= reference key) - (#.Some (with@ #value value root)) + {#.Some (with@ #value value root)} ))) ))] (with@ #root root' dict))) @@ -279,28 +279,28 @@ (def: (left_balanced key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Red] - [(value@ #left left) (#.Some left>>left)] + [(value@ #left left) {#.Some left>>left}] [(value@ #color left>>left) #Red]) (red (value@ #key left) (value@ #value left) - (#.Some (blackened left>>left)) - (#.Some (black key value (value@ #right left) ?right))) + {#.Some (blackened left>>left)} + {#.Some (black key value (value@ #right left) ?right)}) - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Red] - [(value@ #right left) (#.Some left>>right)] + [(value@ #right left) {#.Some left>>right}] [(value@ #color left>>right) #Red]) (red (value@ #key left>>right) (value@ #value left>>right) - (#.Some (black (value@ #key left) + {#.Some (black (value@ #key left) (value@ #value left) (value@ #left left) - (value@ #left left>>right))) - (#.Some (black key value + (value@ #left left>>right))} + {#.Some (black key value (value@ #right left>>right) - ?right))) + ?right)}) _ (black key value ?left ?right))) @@ -308,26 +308,26 @@ (def: (right_balanced key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Red] - [(value@ #right right) (#.Some right>>right)] + [(value@ #right right) {#.Some right>>right}] [(value@ #color right>>right) #Red]) (red (value@ #key right) (value@ #value right) - (#.Some (black key value ?left (value@ #left right))) - (#.Some (blackened right>>right))) + {#.Some (black key value ?left (value@ #left right))} + {#.Some (blackened right>>right)}) - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Red] - [(value@ #left right) (#.Some right>>left)] + [(value@ #left right) {#.Some right>>left}] [(value@ #color right>>left) #Red]) (red (value@ #key right>>left) (value@ #value right>>left) - (#.Some (black key value ?left (value@ #left right>>left))) - (#.Some (black (value@ #key right) + {#.Some (black key value ?left (value@ #left right>>left))} + {#.Some (black (value@ #key right) (value@ #value right) (value@ #right right>>left) - (value@ #right right)))) + (value@ #right right))}) _ (black key value ?left ?right))) @@ -335,27 +335,27 @@ (def: (without_left key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?left - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Red]) - (red key value (#.Some (blackened left)) ?right) + (red key value {#.Some (blackened left)} ?right) _ (case ?right - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Black]) - (right_balanced key value ?left (#.Some (reddened right))) + (right_balanced key value ?left {#.Some (reddened right)}) - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Red] - [(value@ #left right) (#.Some right>>left)] + [(value@ #left right) {#.Some right>>left}] [(value@ #color right>>left) #Black]) (red (value@ #key right>>left) (value@ #value right>>left) - (#.Some (black key value ?left (value@ #left right>>left))) - (#.Some (right_balanced (value@ #key right) + {#.Some (black key value ?left (value@ #left right>>left))} + {#.Some (right_balanced (value@ #key right) (value@ #value right) (value@ #right right>>left) - (\ maybe.functor each reddened (value@ #right right))))) + (\ maybe.functor each reddened (value@ #right right)))}) _ (panic! error_message)) @@ -364,27 +364,27 @@ (def: (without_right key value ?left ?right) (All (_ k v) (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) (case ?right - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Red]) - (red key value ?left (#.Some (blackened right))) + (red key value ?left {#.Some (blackened right)}) _ (case ?left - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Black]) - (left_balanced key value (#.Some (reddened left)) ?right) + (left_balanced key value {#.Some (reddened left)} ?right) - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Red] - [(value@ #right left) (#.Some left>>right)] + [(value@ #right left) {#.Some left>>right}] [(value@ #color left>>right) #Black]) (red (value@ #key left>>right) (value@ #value left>>right) - (#.Some (left_balanced (value@ #key left) + {#.Some (left_balanced (value@ #key left) (value@ #value left) (\ maybe.functor each reddened (value@ #left left)) - (value@ #left left>>right))) - (#.Some (black key value (value@ #right left>>right) ?right))) + (value@ #left left>>right))} + {#.Some (black key value (value@ #right left>>right) ?right)}) _ (panic! error_message) @@ -399,7 +399,7 @@ [_ #.None] ?left - [(#.Some left) (#.Some right)] + [{#.Some left} {#.Some right}] (case [(value@ #color left) (value@ #color right)] [#Red #Red] (do maybe.monad @@ -408,37 +408,37 @@ #Red (in (red (value@ #key fused) (value@ #value fused) - (#.Some (red (value@ #key left) + {#.Some (red (value@ #key left) (value@ #value left) (value@ #left left) - (value@ #left fused))) - (#.Some (red (value@ #key right) + (value@ #left fused))} + {#.Some (red (value@ #key right) (value@ #value right) (value@ #right fused) - (value@ #right right))))) + (value@ #right right))})) #Black (in (red (value@ #key left) (value@ #value left) (value@ #left left) - (#.Some (red (value@ #key right) + {#.Some (red (value@ #key right) (value@ #value right) - (#.Some fused) - (value@ #right right))))))) + {#.Some fused} + (value@ #right right))})))) [#Red #Black] - (#.Some (red (value@ #key left) + {#.Some (red (value@ #key left) (value@ #value left) (value@ #left left) (prepended (value@ #right left) - ?right))) + ?right))} [#Black #Red] - (#.Some (red (value@ #key right) + {#.Some (red (value@ #key right) (value@ #value right) (prepended ?left (value@ #left right)) - (value@ #right right))) + (value@ #right right))} [#Black #Black] (do maybe.monad @@ -447,23 +447,23 @@ #Red (in (red (value@ #key fused) (value@ #value fused) - (#.Some (black (value@ #key left) + {#.Some (black (value@ #key left) (value@ #value left) (value@ #left left) - (value@ #left fused))) - (#.Some (black (value@ #key right) + (value@ #left fused))} + {#.Some (black (value@ #key right) (value@ #value right) (value@ #right fused) - (value@ #right right))))) + (value@ #right right))})) #Black (in (without_left (value@ #key left) (value@ #value left) (value@ #left left) - (#.Some (black (value@ #key right) + {#.Some (black (value@ #key right) (value@ #value right) - (#.Some fused) - (value@ #right right))))) + {#.Some fused} + (value@ #right right))})) )) ) @@ -478,7 +478,7 @@ #.None [#.None #0] - (#.Some root) + {#.Some root} (let [root_key (value@ #key root) root_val (value@ #value root)] (if (_\= root_key key) @@ -495,22 +495,22 @@ [side_outcome _] (if go_left? (case (value@ #left root) - (^multi (#.Some left) + (^multi {#.Some left} [(value@ #color left) #Black]) - [(#.Some (without_left root_key root_val side_outcome (value@ #right root))) + [{#.Some (without_left root_key root_val side_outcome (value@ #right root))} #0] _ - [(#.Some (red root_key root_val side_outcome (value@ #right root))) + [{#.Some (red root_key root_val side_outcome (value@ #right root))} #0]) (case (value@ #right root) - (^multi (#.Some right) + (^multi {#.Some right} [(value@ #color right) #Black]) - [(#.Some (without_right root_key root_val (value@ #left root) side_outcome)) + [{#.Some (without_right root_key root_val (value@ #left root) side_outcome)} #0] _ - [(#.Some (red root_key root_val (value@ #left root) side_outcome)) + [{#.Some (red root_key root_val (value@ #left root) side_outcome)} #0]) ))) )) @@ -521,14 +521,14 @@ (with@ #root ?root dict) dict) - (#.Some root) - (with@ #root (#.Some (blackened root)) dict) + {#.Some root} + (with@ #root {#.Some (blackened root)} dict) ))) (def: .public (revised key transform dict) (All (_ k v) (-> k (-> v v) (Dictionary k v) (Dictionary k v))) (case (..value key dict) - (#.Some old) + {#.Some old} (..has key (transform old) dict) #.None @@ -549,7 +549,7 @@ #.None (list) - (#.Some node') + {#.Some node'} ($_ list\composite (recur (value@ #left node')) (list <output>) @@ -571,7 +571,7 @@ [#.End #.End] #1 - [(#.Item [keyR valueR] entriesR') (#.Item [keyS valueS] entriesS')] + [{#.Item [keyR valueR] entriesR'} {#.Item [keyS valueS] entriesS'}] (and (/\= keyR keyS) (,\= valueR valueS) (recur entriesR' entriesS')) diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux index 9bd4665df..85fec4622 100644 --- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux @@ -34,9 +34,9 @@ #.End #.None - (#.Item [k' v'] properties') + {#.Item [k' v'] properties'} (if (text\= key k') - (#.Some v') + {#.Some v'} (value key properties')))) (template [<name> <type> <access>] @@ -51,7 +51,7 @@ (def: .public (contains? key properties) (All (_ a) (-> Text (PList a) Bit)) (case (..value key properties) - (#.Some _) + {#.Some _} true #.None @@ -63,12 +63,12 @@ #.End (list [key val]) - (#.Item [k' v'] properties') + {#.Item [k' v'] properties'} (if (text\= key k') - (#.Item [key val] - properties') - (#.Item [k' v'] - (has key val properties'))))) + {#.Item [key val] + properties'} + {#.Item [k' v'] + (has key val properties')}))) (def: .public (revised key f properties) (All (_ a) (-> Text (-> a a) (PList a) (PList a))) @@ -76,10 +76,10 @@ #.End #.End - (#.Item [k' v'] properties') + {#.Item [k' v'] properties'} (if (text\= key k') - (#.Item [k' (f v')] properties') - (#.Item [k' v'] (revised key f properties'))))) + {#.Item [k' (f v')] properties'} + {#.Item [k' v'] (revised key f properties')}))) (def: .public (lacks key properties) (All (_ a) (-> Text (PList a) (PList a))) @@ -87,11 +87,11 @@ #.End properties - (#.Item [k' v'] properties') + {#.Item [k' v'] properties'} (if (text\= key k') properties' - (#.Item [k' v'] - (lacks key properties'))))) + {#.Item [k' v'] + (lacks key properties')}))) (def: .public equivalence (All (_ a) (-> (Equivalence a) (Equivalence (PList a)))) diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux index 286290c96..5c630614b 100644 --- a/stdlib/source/library/lux/data/collection/list.lux +++ b/stdlib/source/library/lux/data/collection/list.lux @@ -21,7 +21,7 @@ ... (type: (List a) ... #End -... (#Item a (List a))) +... {#Item a (List a)}) (implementation: .public mix (Mix List) @@ -31,7 +31,7 @@ #.End init - (#.Item x xs') + {#.Item x xs'} (mix f (f x init) xs')))) (def: .public (mixes f init inputs) @@ -40,13 +40,13 @@ #.End (list init) - (#.Item [head tail]) - (#.Item [init (mixes f (f head init) tail)]))) + {#.Item [head tail]} + {#.Item [init (mixes f (f head init) tail)]})) (def: .public (reversed xs) (All (_ a) (-> (List a) (List a))) - (mix (function (_ head tail) (#.Item head tail)) + (mix (function (_ head tail) {#.Item head tail}) #.End xs)) @@ -57,9 +57,9 @@ #.End #.End - (#.Item x xs') + {#.Item x xs'} (if (keep? x) - (#.Item x (only keep? xs')) + {#.Item x (only keep? xs')} (only keep? xs')))) (def: .public (partition satisfies? list) @@ -68,17 +68,17 @@ #.End [#.End #.End] - (#.Item head tail) + {#.Item head tail} (let [[in out] (partition satisfies? tail)] (if (satisfies? head) - [(#.Item head in) out] - [in (#.Item head out)])))) + [{#.Item head in} out] + [in {#.Item head out}])))) (def: .public (pairs xs) (All (_ a) (-> (List a) (List [a a]))) (case xs (^ (list& x1 x2 xs')) - (#.Item [x1 x2] (pairs xs')) + {#.Item [x1 x2] (pairs xs')} _ #.End)) @@ -92,11 +92,11 @@ #.End #.End - (#.Item x xs') + {#.Item x xs'} <then>) <else>))] - [first (#.Item x (first (-- n) xs')) #.End] + [first {#.Item x (first (-- n) xs')} #.End] [after (after (-- n) xs') xs] ) @@ -108,12 +108,12 @@ #.End #.End - (#.Item x xs') + {#.Item x xs'} (if (predicate x) <then> <else>)))] - [while (#.Item x (while predicate xs')) #.End] + [while {#.Item x (while predicate xs')} #.End] [until (until predicate xs') xs] ) @@ -125,9 +125,9 @@ #.End [#.End #.End] - (#.Item x xs') + {#.Item x xs'} (let [[tail rest] (split_at (-- n) xs')] - [(#.Item x tail) rest])) + [{#.Item x tail} rest])) [#.End xs])) (def: (split_when' predicate ys xs) @@ -137,10 +137,10 @@ #.End [ys xs] - (#.Item x xs') + {#.Item x xs'} (if (predicate x) [ys xs] - (split_when' predicate (#.Item x ys) xs')))) + (split_when' predicate {#.Item x ys} xs')))) (def: .public (split_when predicate xs) (All (_ a) @@ -156,21 +156,21 @@ _ (let [[pre post] (split_at size list)] - (#.Item pre (sub size post))))) + {#.Item pre (sub size post)}))) (def: .public (repeated n x) (All (_ a) (-> Nat a (List a))) (case n 0 #.End - _ (#.Item x (repeated (-- n) x)))) + _ {#.Item x (repeated (-- n) x)})) (def: (iterations' f x) (All (_ a) (-> (-> a (Maybe a)) a (List a))) (case (f x) - (#.Some x') - (#.Item x (iterations' f x')) + {#.Some x'} + {#.Item x (iterations' f x')} #.None (list))) @@ -179,8 +179,8 @@ (All (_ a) (-> (-> a (Maybe a)) a (List a))) (case (f x) - (#.Some x') - (#.Item x (iterations' f x')) + {#.Some x'} + {#.Item x (iterations' f x')} #.None (list x))) @@ -192,10 +192,10 @@ #.End #.None - (#.Item x xs') + {#.Item x xs'} (case (check x) - (#.Some output) - (#.Some output) + {#.Some output} + {#.Some output} #.None (one check xs')))) @@ -207,8 +207,8 @@ @.js (mix (function (_ head tail) (case (check head) - (#.Some head) - (#.Item head tail) + {#.Some head} + {#.Item head tail} #.None tail)) @@ -218,10 +218,10 @@ #.End #.End - (#.Item x xs') + {#.Item x xs'} (case (check x) - (#.Some output) - (#.Item output (all check xs')) + {#.Some output} + {#.Item output (all check xs')} #.None (all check xs'))))) @@ -231,7 +231,7 @@ (-> (Predicate a) (List a) (Maybe a))) (..one (function (_ value) (if (predicate value) - (#.Some value) + {#.Some value} #.None)) xs)) @@ -242,10 +242,10 @@ #.End xs - (#.Item x #.End) + {#.Item x #.End} xs - (#.Item x xs') + {#.Item x xs'} (list& x sep (interposed sep xs')))) (def: .public (size list) @@ -260,7 +260,7 @@ #.End <init> - (#.Item head tail) + {#.Item head tail} (<op> (predicate head) (<name> predicate tail))))] @@ -275,9 +275,9 @@ #.End #.None - (#.Item x xs') + {#.Item x xs'} (case i - 0 (#.Some x) + 0 {#.Some x} _ (item (-- i) xs')))) (implementation: .public (equivalence Equivalence<a>) @@ -288,7 +288,7 @@ [#.End #.End] #1 - [(#.Item x xs') (#.Item y ys')] + [{#.Item x xs'} {#.Item y ys'}] (and (\ Equivalence<a> = x y) (= xs' ys')) @@ -317,8 +317,8 @@ #.End ys - (#.Item x xs') - (#.Item x (composite xs' ys))))) + {#.Item x xs'} + {#.Item x (composite xs' ys)}))) (open: "[0]" ..monoid) @@ -330,8 +330,8 @@ #.End #.End - (#.Item a ma') - (#.Item (f a) (each f ma'))))) + {#.Item a ma'} + {#.Item (f a) (each f ma')}))) (open: "[0]" ..functor) @@ -345,7 +345,7 @@ #.End #.End - (#.Item f ff') + {#.Item f ff'} (|> ff' (on fa) (composite (each f fa)))))) @@ -356,7 +356,7 @@ (def: &functor ..functor) (def: (in a) - (#.Item a #.End)) + {#.Item a #.End}) (def: conjoint (|>> reversed (mix composite identity)))) @@ -367,11 +367,11 @@ #.End (list) - (#.Item x xs') + {#.Item x xs'} (let [[pre post] (mix (function (_ x' [pre post]) (if (< x x') - [(#.Item x' pre) post] - [pre (#.Item x' post)])) + [{#.Item x' pre} post] + [pre {#.Item x' post}])) [(list) (list)] xs')] ($_ composite (sorted < pre) (list x) (sorted < post))))) @@ -391,7 +391,7 @@ #.End #0 - (#.Item x' xs') + {#.Item x' xs'} (or (\ eq = x x') (member? eq xs' x)))) @@ -402,8 +402,8 @@ #.End #.None - (#.Item x xs') - (#.Some <side>)))] + {#.Item x xs'} + {#.Some <side>}))] [head a x] [tail (List a) xs'] @@ -417,7 +417,7 @@ (def: (identifier$ name) (-> Text Code) - [["" 0 0] (#.Identifier "" name)]) + [["" 0 0] {#.Identifier "" name}]) (def: (nat\encoded value) (-> Nat Text) @@ -443,7 +443,7 @@ (macro: .public (zipped tokens state) (case tokens - (^ (list [_ (#.Nat num_lists)])) + (^ (list [_ {#.Nat num_lists}])) (if (n.> 0 num_lists) (let [(^open "[0]") ..functor indices (..indices num_lists) @@ -458,7 +458,7 @@ (let [base (nat\encoded idx)] [(identifier$ base) (identifier$ ("lux text concat" base "'"))])))) - pattern (` [(~+ (each (function (_ [v vs]) (` (#.Item (~ v) (~ vs)))) + pattern (` [(~+ (each (function (_ [v vs]) (` {#.Item (~ v) (~ vs)})) vars+lists))]) g!step (identifier$ "0step0") g!blank (identifier$ "0,0") @@ -467,23 +467,23 @@ (function ((~ g!step) (~+ list_vars)) (case [(~+ list_vars)] (~ pattern) - (#.Item [(~+ (each product.left vars+lists))] - ((~ g!step) (~+ list_vars))) + {#.Item [(~+ (each product.left vars+lists))] + ((~ g!step) (~+ list_vars))} (~ g!blank) #.End))))] - (#.Right [state (list code)])) - (#.Left "Cannot zipped 0 lists.")) + {#.Right [state (list code)]}) + {#.Left "Cannot zipped 0 lists."}) _ - (#.Left "Wrong syntax for zipped"))) + {#.Left "Wrong syntax for zipped"})) (def: .public zipped/2 (zipped 2)) (def: .public zipped/3 (zipped 3)) (macro: .public (zipped_with tokens state) (case tokens - (^ (list [_ (#.Nat num_lists)])) + (^ (list [_ {#.Nat num_lists}])) (if (n.> 0 num_lists) (let [(^open "[0]") ..functor indices (..indices num_lists) @@ -501,7 +501,7 @@ (let [base (nat\encoded idx)] [(identifier$ base) (identifier$ ("lux text concat" base "'"))])))) - pattern (` [(~+ (each (function (_ [v vs]) (` (#.Item (~ v) (~ vs)))) + pattern (` [(~+ (each (function (_ [v vs]) (` {#.Item (~ v) (~ vs)})) vars+lists))]) g!step (identifier$ "0step0") g!blank (identifier$ "0,0") @@ -510,16 +510,16 @@ (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))) + {#.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.")) + {#.Right [state (list code)]}) + {#.Left "Cannot zipped_with 0 lists."}) _ - (#.Left "Wrong syntax for zipped_with"))) + {#.Left "Wrong syntax for zipped_with"})) (def: .public zipped_with/2 (zipped_with 2)) (def: .public zipped_with/3 (zipped_with 3)) @@ -530,10 +530,10 @@ #.End #.None - (#.Item x #.End) - (#.Some x) + {#.Item x #.End} + {#.Some x} - (#.Item x xs') + {#.Item x xs'} (last xs'))) (def: .public (inits xs) @@ -542,16 +542,16 @@ #.End #.None - (#.Item x #.End) - (#.Some #.End) + {#.Item x #.End} + {#.Some #.End} - (#.Item x xs') + {#.Item x xs'} (case (inits xs') #.None (undefined) - (#.Some tail) - (#.Some (#.Item x tail))) + {#.Some tail} + {#.Some {#.Item x tail}}) )) (def: .public together @@ -573,7 +573,9 @@ [lMla MlMla ... TODO: Remove this version ASAP and use one below. lla (for [@.old - (: ((:parameter 0) (List (List (:parameter 1)))) + (: {#.Apply + (type (List (List (:parameter 1)))) + (:parameter 0)} (monad.all ! lMla))] (monad.all ! lMla))] (in (..together lla))))) @@ -590,15 +592,15 @@ #.End #.End - (#.Item x xs') - (#.Item [idx x] (recur (++ idx) xs'))))) + {#.Item x xs'} + {#.Item [idx x] (recur (++ idx) xs')}))) (macro: .public (when tokens state) (case tokens (^ (.list test then)) - (#.Right [state (.list (` (.if (~ test) + {#.Right [state (.list (` (.if (~ test) (~ then) - (.list))))]) + (.list))))]} _ - (#.Left "Wrong syntax for when"))) + {#.Left "Wrong syntax for when"})) diff --git a/stdlib/source/library/lux/data/collection/queue.lux b/stdlib/source/library/lux/data/collection/queue.lux index 3e3bd9e87..7a52a1e9f 100644 --- a/stdlib/source/library/lux/data/collection/queue.lux +++ b/stdlib/source/library/lux/data/collection/queue.lux @@ -76,7 +76,7 @@ (with@ #front (.list val) queue) _ - (revised@ #rear (|>> (#.Item val)) queue))) + (revised@ #rear (|>> {#.Item val}) queue))) (implementation: .public (equivalence super) (All (_ a) (-> (Equivalence a) (Equivalence (Queue a)))) diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux index 28f1f135f..6e56b4b1c 100644 --- a/stdlib/source/library/lux/data/collection/queue/priority.lux +++ b/stdlib/source/library/lux/data/collection/queue/priority.lux @@ -57,13 +57,13 @@ #.None 0 - (#.Some tree) + {#.Some tree} (loop [node tree] (case (tree.root node) - (0 #0 _) + {0 #0 _} 1 - (0 #1 [left right]) + {0 #1 [left right]} (n.+ (recur left) (recur right)))))) (def: .public (member? equivalence queue member) @@ -72,13 +72,13 @@ #.None false - (#.Some tree) + {#.Some tree} (loop [node tree] (case (tree.root node) - (0 #0 reference) + {0 #0 reference} (\ equivalence = reference member) - (0 #1 [left right]) + {0 #1 [left right]} (or (recur left) (recur right)))))) @@ -90,25 +90,25 @@ .let [highest_priority (tree.tag tree)]] (loop [node tree] (case (tree.root node) - (0 #0 reference) + {0 #0 reference} (if (n.= highest_priority (tree.tag node)) #.None - (#.Some node)) + {#.Some node}) - (0 #1 left right) + {0 #1 left right} (if (n.= highest_priority (tree.tag left)) (case (recur left) #.None - (#.Some right) + {#.Some right} - (#.Some =left) - (#.Some (\ ..builder branch =left right))) + {#.Some =left} + {#.Some (\ ..builder branch =left right)}) (case (recur right) #.None - (#.Some left) + {#.Some left} - (#.Some =right) - (#.Some (\ ..builder branch left =right))))))))) + {#.Some =right} + {#.Some (\ ..builder branch left =right)}))))))) (def: .public (end priority value queue) (All (_ a) (-> Priority a (Queue a) (Queue a))) @@ -116,10 +116,10 @@ (:abstraction (case (:representation queue) #.None - (#.Some addition) + {#.Some addition} - (#.Some tree) - (#.Some (\ ..builder branch tree addition))))))] + {#.Some tree} + {#.Some (\ ..builder branch tree addition)}))))] ) (def: .public empty? diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux index 728a67ce4..aa8c6d0f7 100644 --- a/stdlib/source/library/lux/data/collection/row.lux +++ b/stdlib/source/library/lux/data/collection/row.lux @@ -34,8 +34,8 @@ (type: (Node a) (Variant - (#Base (Array a)) - (#Hierarchy (Array (Node a))))) + {#Base (Array a)} + {#Hierarchy (Array (Node a))})) (type: (Base a) (Array a)) @@ -93,7 +93,7 @@ (def: (path level tail) (All (_ a) (-> Level (Base a) (Node a))) (if (n.= 0 level) - (#Base tail) + {#Base tail} (|> (empty_hierarchy []) (array.write! 0 (path (level_down level) tail)) #Hierarchy))) @@ -109,15 +109,15 @@ ... If we're currently on a bottom node sub_node (if (n.= branching_exponent level) ... Just add the tail to it - (#Base tail) + {#Base tail} ... Otherwise, check whether there's a vacant spot (case (array.read! sub_idx parent) ... If so, set the path to the tail #.None (..path (level_down level) tail) ... If not, push the tail onto the sub_node. - (#.Some (#Hierarchy sub_node)) - (#Hierarchy (with_tail size (level_down level) tail sub_node)) + {#.Some {#Hierarchy sub_node}} + {#Hierarchy (with_tail size (level_down level) tail sub_node)} _ (undefined)) @@ -136,11 +136,11 @@ (All (_ a) (-> Level Index a (Hierarchy a) (Hierarchy a))) (let [sub_idx (branch_idx (i64.right_shifted level idx))] (case (array.read! sub_idx hierarchy) - (#.Some (#Hierarchy sub_node)) + {#.Some {#Hierarchy sub_node}} (|> (array.clone hierarchy) - (array.write! sub_idx (#Hierarchy (hierarchy\has (level_down level) idx val sub_node)))) + (array.write! sub_idx {#Hierarchy (hierarchy\has (level_down level) idx val sub_node)})) - (^multi (#.Some (#Base base)) + (^multi {#.Some {#Base base}} (n.= 0 (level_down level))) (|> (array.clone hierarchy) (array.write! sub_idx (|> (array.clone base) @@ -160,13 +160,13 @@ (do maybe.monad [base|hierarchy (array.read! sub_idx hierarchy) sub (case base|hierarchy - (#Hierarchy sub) + {#Hierarchy sub} (without_tail size (level_down level) sub) - (#Base _) + {#Base _} (undefined))] (|> (array.clone hierarchy) - (array.write! sub_idx (#Hierarchy sub)) + (array.write! sub_idx {#Hierarchy sub}) #.Some)) ... Else... @@ -178,10 +178,10 @@ (def: (node\list node) (All (_ a) (-> (Node a) (List a))) (case node - (#Base base) + {#Base base} (array.list #.None base) - (#Hierarchy hierarchy) + {#Hierarchy hierarchy} (|> hierarchy (array.list #.None) list.reversed @@ -228,7 +228,7 @@ (: (Hierarchy (:parameter 0)) (empty_hierarchy []))] (empty_hierarchy [])) - (array.write! 0 (#Hierarchy (value@ #root row))) + (array.write! 0 {#Hierarchy (value@ #root row)}) (array.write! 1 (..path (value@ #level row) (value@ #tail row))))) (revised@ #level level_up)) ... Otherwise, just push the current tail onto the root. @@ -261,18 +261,18 @@ hierarchy (value@ #root row)] (case [(n.> branching_exponent level) (array.read! (branch_idx (i64.right_shifted level idx)) hierarchy)] - [#1 (#.Some (#Hierarchy sub))] + [#1 {#.Some {#Hierarchy sub}}] (recur (level_down level) sub) - [#0 (#.Some (#Base base))] - (#try.Success base) + [#0 {#.Some {#Base base}}] + {#try.Success base} [_ #.None] (exception.except ..base_was_not_found []) _ (exception.except ..incorrect_row_structure []))) - (#try.Success (value@ #tail row))) + {#try.Success (value@ #tail row)}) (exception.except ..index_out_of_bounds [row idx]))) (def: .public (item idx row) @@ -280,8 +280,8 @@ (do try.monad [base (base_for idx row)] (case (array.read! (branch_idx idx) base) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (exception.except ..incorrect_row_structure [])))) @@ -290,14 +290,14 @@ (All (_ a) (-> Nat a (Row a) (Try (Row a)))) (let [row_size (value@ #size row)] (if (within_bounds? row idx) - (#try.Success (if (n.< (tail_off row_size) idx) + {#try.Success (if (n.< (tail_off row_size) idx) (revised@ #root (hierarchy\has (value@ #level row) idx val) row) (revised@ #tail (for [@.old (: (-> (Base (:parameter 0)) (Base (:parameter 0))) (|>> array.clone (array.write! (branch_idx idx) val)))] (|>> array.clone (array.write! (branch_idx idx) val))) - row))) + row))} (exception.except ..index_out_of_bounds [row idx])))) (def: .public (revised idx f row) @@ -332,10 +332,10 @@ (without_tail row_size init_level (value@ #root row)))] (if (n.> branching_exponent level) (case [(array.read! 1 root) (array.read! 0 root)] - [#.None (#.Some (#Hierarchy sub_node))] + [#.None {#.Some {#Hierarchy sub_node}}] (recur (level_down level) sub_node) - ... [#.None (#.Some (#Base _))] + ... [#.None {#.Some {#Base _}}] ... (undefined) _ @@ -350,8 +350,8 @@ (def: .public (list row) (All (_ a) (-> (Row a) (List a))) - (list\composite (node\list (#Hierarchy (value@ #root row))) - (node\list (#Base (value@ #tail row))))) + (list\composite (node\list {#Hierarchy (value@ #root row)}) + (node\list {#Base (value@ #tail row)}))) (def: .public of_list (All (_ a) (-> (List a) (Row a))) @@ -373,10 +373,10 @@ (def: (= v1 v2) (case [v1 v2] - [(#Base b1) (#Base b2)] + [{#Base b1} {#Base b2}] (\ (array.equivalence Equivalence<a>) = b1 b2) - [(#Hierarchy h1) (#Hierarchy h2)] + [{#Hierarchy h1} {#Hierarchy h2}] (\ (array.equivalence (node_equivalence Equivalence<a>)) = h1 h2) _ @@ -388,20 +388,20 @@ (def: (= v1 v2) (and (n.= (value@ #size v1) (value@ #size v2)) (let [(^open "node\[0]") (node_equivalence Equivalence<a>)] - (and (node\= (#Base (value@ #tail v1)) - (#Base (value@ #tail v2))) - (node\= (#Hierarchy (value@ #root v1)) - (#Hierarchy (value@ #root v2)))))))) + (and (node\= {#Base (value@ #tail v1)} + {#Base (value@ #tail v2)}) + (node\= {#Hierarchy (value@ #root v1)} + {#Hierarchy (value@ #root v2)})))))) (implementation: node_mix (Mix Node) (def: (mix f init xs) (case xs - (#Base base) + {#Base base} (array\mix f init base) - (#Hierarchy hierarchy) + {#Hierarchy hierarchy} (array\mix (function (_ node init') (mix f init' node)) init hierarchy)))) @@ -414,8 +414,8 @@ (mix f (mix f init - (#Hierarchy (value@ #root xs))) - (#Base (value@ #tail xs)))))) + {#Hierarchy (value@ #root xs)}) + {#Base (value@ #tail xs)})))) (implementation: .public monoid (All (_ a) (Monoid (Row a))) @@ -430,11 +430,11 @@ (def: (each f xs) (case xs - (#Base base) - (#Base (array\each f base)) + {#Base base} + {#Base (array\each f base)} - (#Hierarchy hierarchy) - (#Hierarchy (array\each (each f) hierarchy))))) + {#Hierarchy hierarchy} + {#Hierarchy (array\each (each f) hierarchy)}))) (implementation: .public functor (Functor Row) @@ -485,15 +485,15 @@ (-> (Predicate a) (Node a) Bit)) (function (help predicate node) (case node - (#Base base) + {#Base base} (<array> predicate base) - (#Hierarchy hierarchy) + {#Hierarchy hierarchy} (<array> (help predicate) hierarchy))))] (function (<name> predicate row) (let [(^slots [#root #tail]) row] - (<op> (help predicate (#Hierarchy root)) - (help predicate (#Base tail)))))))] + (<op> (help predicate {#Hierarchy root}) + (help predicate {#Base tail}))))))] [every? array.every? #1 and] [any? array.any? #0 or] diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index a641721c8..6e4e0b801 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -42,7 +42,7 @@ #.End (recur start next) - (#.Item head' tail') + {#.Item head' tail'} (recur head' tail'))]))) (template [<name> <return>] @@ -91,7 +91,7 @@ (if <pred_test> [(list) xs] (let [[tail next] (<splitter> <pred_step> xs')] - [(#.Item [x tail]) next]))))] + [{#.Item [x tail]} next]))))] [split_when (-> a Bit) (pred x) pred] [split_at Nat (n.= 0 pred) (-- pred)] diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux index cd36648eb..89baa8935 100644 --- a/stdlib/source/library/lux/data/collection/set/multi.lux +++ b/stdlib/source/library/lux/data/collection/set/multi.lux @@ -43,7 +43,7 @@ (case multiplicity 0 set _ (case (dictionary.value elem (:representation set)) - (#.Some current) + {#.Some current} (:abstraction (if (n.> multiplicity current) (dictionary.revised elem (n.- multiplicity) (:representation set)) diff --git a/stdlib/source/library/lux/data/collection/stack.lux b/stdlib/source/library/lux/data/collection/stack.lux index feb2d2805..87925a89a 100644 --- a/stdlib/source/library/lux/data/collection/stack.lux +++ b/stdlib/source/library/lux/data/collection/stack.lux @@ -31,8 +31,8 @@ #.End #.None - (#.Item value _) - (#.Some value))) + {#.Item value _} + {#.Some value})) (def: .public (next stack) (All (_ a) (-> (Stack a) (Maybe [a (Stack a)]))) @@ -40,12 +40,12 @@ #.End #.None - (#.Item top stack') - (#.Some [top (:abstraction stack')]))) + {#.Item top 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) diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index 96d92ac6d..281e9f2ed 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -27,7 +27,7 @@ (value@ #children) (list\each flat) list\conjoint - (#.Item (value@ #value tree)))) + {#.Item (value@ #value tree)})) (def: .public (leaf value) (All (_ a) (-> a (Tree a))) diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux index b4e042069..c5fc655e8 100644 --- a/stdlib/source/library/lux/data/collection/tree/finger.lux +++ b/stdlib/source/library/lux/data/collection/tree/finger.lux @@ -45,40 +45,40 @@ (:abstraction [#monoid monoid #tag tag - #root (0 #0 value)])) + #root {0 #0 value}])) (def: (branch left right) (:abstraction [#monoid monoid #tag (\ monoid composite (..tag left) (..tag right)) - #root (0 #1 [left right])]))) + #root {0 #1 [left right]}]))) (def: .public (value tree) (All (_ @ t v) (-> (Tree @ t v) v)) (case (value@ #root (:representation tree)) - (0 #0 value) + {0 #0 value} value - (0 #1 [left right]) + {0 #1 [left right]} (value left))) (def: .public (tags tree) (All (_ @ t v) (-> (Tree @ t v) (List t))) (case (value@ #root (:representation tree)) - (0 #0 value) + {0 #0 value} (list (value@ #tag (:representation tree))) - (0 #1 [left right]) + {0 #1 [left right]} (list\composite (tags left) (tags right)))) (def: .public (values tree) (All (_ @ t v) (-> (Tree @ t v) (List v))) (case (value@ #root (:representation tree)) - (0 #0 value) + {0 #0 value} (list value) - (0 #1 [left right]) + {0 #1 [left right]} (list\composite (values left) (values right)))) @@ -90,10 +90,10 @@ (loop [_tag tag//identity _node root] (case _node - (0 #0 value) - (#.Some value) + {0 #0 value} + {#.Some value} - (0 #1 [left right]) + {0 #1 [left right]} (let [shifted_tag (tag//composite _tag (..tag left))] (if (predicate shifted_tag) (recur _tag (value@ #root (:representation left))) @@ -104,7 +104,7 @@ (def: .public (exists? predicate tree) (All (_ @ t v) (-> (Predicate t) (Tree @ t v) Bit)) (case (..one predicate tree) - (#.Some _) + {#.Some _} true #.None diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux index ee7daa341..313a61909 100644 --- a/stdlib/source/library/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux @@ -92,11 +92,11 @@ #.End #.None - (#.Item head tail) - (#.Some [#family (#.Some [#parent (with@ [#node #//.children] (list) zipper) + {#.Item head tail} + {#.Some [#family {#.Some [#parent (with@ [#node #//.children] (list) zipper) #lefts #.End - #rights tail]) - #node head]))) + #rights tail]} + #node head]})) (def: .public (up zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) @@ -107,33 +107,33 @@ (revised@ #node (: (-> (Tree (:parameter 0)) (Tree (:parameter 0))) (with@ #//.children (list\composite (list.reversed lefts) - (#.Item (value@ #node zipper) - rights)))) + {#.Item (value@ #node zipper) + rights}))) parent)] (with@ [#node #//.children] (list\composite (list.reversed lefts) - (#.Item (value@ #node zipper) - rights)) + {#.Item (value@ #node zipper) + rights}) parent)))))) (template [<one> <all> <side> <op_side>] [(def: .public (<one> zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (value@ #family zipper) - (#.Some family) + {#.Some family} (case (value@ <side> family) - (#.Item next side') - (#.Some (for [@.old - [#family (#.Some (|> family + {#.Item next side'} + {#.Some (for [@.old + [#family {#.Some (|> family (with@ <side> side') - (revised@ <op_side> (|>> (#.Item (value@ #node zipper)))))) + (revised@ <op_side> (|>> {#.Item (value@ #node zipper)})))} #node next]] (let [move (: (All (_ a) (-> (List (Tree a)) (Zipper a) (Family Zipper a) (Family Zipper a))) (function (_ side' zipper) (|>> (with@ <side> side') - (revised@ <op_side> (|>> (#.Item (value@ #node zipper)))))))] - [#family (#.Some (move side' zipper family)) - #node next]))) + (revised@ <op_side> (|>> {#.Item (value@ #node zipper)})))))] + [#family {#.Some (move side' zipper family)} + #node next]))} #.End #.None) @@ -147,24 +147,24 @@ #.None #.None - (#.Some family) + {#.Some family} (case (list.reversed (value@ <side> family)) #.End #.None - (#.Item last prevs) - (#.Some (for [@.old [#family (#.Some (|> family + {#.Item last prevs} + {#.Some (for [@.old [#family {#.Some (|> family (with@ <side> #.End) - (revised@ <op_side> (|>> (#.Item (value@ #node zipper)) - (list\composite prevs))))) + (revised@ <op_side> (|>> {#.Item (value@ #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) (|>> (with@ <side> #.End) - (revised@ <op_side> (|>> (#.Item (value@ #node zipper)) + (revised@ <op_side> (|>> {#.Item (value@ #node zipper)} (list\composite prevs))))))] - [#family (#.Some (move prevs zipper family)) - #node last]))))))] + [#family {#.Some (move prevs zipper family)} + #node last]))})))] [right rightmost #rights #lefts] [left leftmost #lefts #rights] @@ -173,14 +173,14 @@ (def: .public (next zipper) (All (_ a) (-> (Zipper a) (Maybe (Zipper a)))) (case (..down zipper) - (#.Some forward) - (#.Some forward) + {#.Some forward} + {#.Some forward} #.None (loop [@ zipper] (case (..right @) - (#.Some forward) - (#.Some forward) + {#.Some forward} + {#.Some forward} #.None (do maybe.monad @@ -190,12 +190,12 @@ (def: (bottom zipper) (All (_ a) (-> (Zipper a) (Zipper a))) (case (..right zipper) - (#.Some forward) + {#.Some forward} (bottom forward) #.None (case (..down zipper) - (#.Some forward) + {#.Some forward} (bottom forward) #.None @@ -207,13 +207,13 @@ #.None (..up zipper) - (#.Some backward) - (#.Some (case (..down backward) - (#.Some then) + {#.Some backward} + {#.Some (case (..down backward) + {#.Some then} (..bottom then) #.None - backward)))) + backward)})) (template [<name> <move>] [(def: .public (<name> zipper) @@ -222,13 +222,13 @@ #.None #.None - (#.Some @) + {#.Some @} (loop [@ @] (case (<move> @) #.None - (#.Some @) + {#.Some @} - (#.Some @) + {#.Some @} (recur @)))))] [end ..next] @@ -241,7 +241,7 @@ #.None true - (#.Some _) + {#.Some _} false)) (def: .public (interpose value zipper) @@ -253,7 +253,7 @@ (def: .public (adopt value zipper) (All (_ a) (-> a (Zipper a) (Zipper a))) (revised@ [#node #//.children] - (|>> (#.Item (//.leaf value))) + (|>> {#.Item (//.leaf value)}) zipper)) (def: .public (remove zipper) @@ -266,7 +266,7 @@ (value@ #rights family) (value@ #parent family))) - (#.Item next side) + {#.Item next side} (in (|> zipper (with@ #family (|> family (with@ #lefts side) @@ -280,10 +280,10 @@ #.None #.None - (#.Some family) - (#.Some (with@ #family - (#.Some (revised@ <side> (|>> (#.Item (//.leaf value))) family)) - zipper))))] + {#.Some family} + {#.Some (with@ #family + {#.Some (revised@ <side> (|>> {#.Item (//.leaf value)}) family)} + zipper)}))] [insert_left #lefts] [insert_right #rights] diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 234b7a093..0fcc94723 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -85,7 +85,7 @@ (function (_ altV) (case altV (^template [<number> <tag> <writer>] - [(<tag> caseV) + [{<tag> caseV} (let [[caseS caseT] (<writer> caseV)] [(.++ caseS) (function (_ [offset binary]) @@ -233,7 +233,7 @@ (function (_ altV) (case altV (^template [<number> <tag> <writer>] - [(<tag> caseV) + [{<tag> caseV} (let [[caseS caseT] (<writer> caseV)] [(.++ caseS) (function (_ [offset binary]) @@ -268,7 +268,7 @@ (function (_ altV) (case altV (^template [<number> <tag> <writer>] - [(<tag> caseV) + [{<tag> caseV} (let [[caseS caseT] (<writer> caseV)] [(.++ caseS) (function (_ [offset binary]) diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux index a0d849ccf..e0c1d1773 100644 --- a/stdlib/source/library/lux/data/format/css.lux +++ b/stdlib/source/library/lux/data/format/css.lux @@ -50,7 +50,7 @@ (def: .public (font font) (-> Font (CSS Special)) (let [with_unicode (case (value@ #/font.unicode_range font) - (#.Some unicode_range) + {#.Some unicode_range} (let [unicode_range' (format "U+" (\ nat.hex encoded (value@ #/font.start unicode_range)) "-" (\ nat.hex encoded (value@ #/font.end unicode_range)))] (list ["unicode-range" unicode_range'])) @@ -74,7 +74,7 @@ (-> URL (Maybe Query) (CSS Special)) (:abstraction (format (format "@import url(" (%.text url) ")") (case query - (#.Some query) + {#.Some query} (format " " (/query.query query)) #.None diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index ae4393448..1d5fe95df 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -922,7 +922,7 @@ #.None (:representation Stop stop) - (#.Some hint) + {#.Some hint} (format (:representation Hint hint) ..value_separator (:representation Stop stop))))])]) (type: .public (List/1 a) @@ -1078,7 +1078,7 @@ (Value Image)) (let [after_extent (format "at " (:representation location)) with_extent (case extent - (#.Some extent) + {#.Some extent} (format (..extent extent) " " after_extent) #.None @@ -1158,7 +1158,7 @@ (def: .public (font_family options) (-> (List Font) (Value Font)) (case options - (#.Item _) + {#.Item _} (|> options (list\each ..font_name) (text.interposed ",") diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 10cf2c203..7e1a7e322 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -41,7 +41,7 @@ #Parent #Self #Top - (#Frame Text))) + {#Frame Text})) (def: (target value) (-> Target Text) @@ -50,7 +50,7 @@ #Parent "_parent" #Self "_self" #Top "_top" - (#Frame name) name)) + {#Frame name} name)) ... Properly formats text to ensure no injection can happen on the HTML. (def: safe @@ -176,7 +176,7 @@ (-> URL (Maybe Target) Meta) (let [partial (list ["href" href]) full (case target - (#.Some target) + {#.Some target} (list& ["target" (..target target)] partial) #.None @@ -213,7 +213,7 @@ (def: .public (image source attributes) (-> URL Attributes Image) (|> attributes - (#.Item ["src" source]) + {#.Item ["src" source]} (..simple "img"))) (def: .public (svg attributes content) @@ -267,9 +267,9 @@ (type: .public Shape (Variant - (#Rectangle Rectangle) - (#Circle Circle) - (#Polygon Polygon))) + {#Rectangle Rectangle} + {#Circle Circle} + {#Polygon Polygon})) (template [<name> <shape> <type> <format>] [(def: (<name> attributes shape) @@ -286,13 +286,13 @@ (def: (area attributes shape) (-> Attributes Shape (HTML Any)) (case shape - (#Rectangle rectangle) + {#Rectangle rectangle} (..rectangle attributes rectangle) - (#Circle circle) + {#Circle circle} (..circle attributes circle) - (#Polygon polygon) + {#Polygon polygon} (..polygon attributes polygon))) (def: .public (each attributes areas for) @@ -303,7 +303,7 @@ #.End (..empty "map" attributes) - (#.Item head tail) + {#.Item head tail} (..tag "map" attributes (list\mix (function.flipped ..and) head tail))))) @@ -348,7 +348,7 @@ (-> (Maybe Content) Attributes <type> <type>) (..tag <container_tag> attributes (case description - (#.Some description) + {#.Some description} ($_ ..and (..tag <description_tag> (list) description) content) @@ -469,7 +469,7 @@ #.End (..empty "dl" attributes) - (#.Item head tail) + {#.Item head tail} (..tag "dl" attributes (list\mix (function.flipped ..and) head tail)))) @@ -527,7 +527,7 @@ #.End head - (#.Item first rest) + {#.Item first rest} (..and head (..table_body (list\mix (function.flipped ..and) first rest)))) @@ -535,21 +535,21 @@ #.None content - (#.Some footer) + {#.Some footer} (..and content (..table_foot (..table_row footer)))) content (case columns #.None content - (#.Some columns) + {#.Some columns} (..and (..columns_group columns) content)) content (case caption #.None content - (#.Some caption) + {#.Some caption} (..and (:as HTML caption) content))] (..tag "table" attributes diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 052ce1c18..aa6ef2279 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -43,12 +43,12 @@ (type: .public JSON (Rec JSON (Variant - (#Null Null) - (#Boolean Boolean) - (#Number Number) - (#String String) - (#Array (Row JSON)) - (#Object (Dictionary String JSON))))) + {#Null Null} + {#Boolean Boolean} + {#Number Number} + {#String String} + {#Array (Row JSON)} + {#Object (Dictionary String JSON)}))) (template [<name> <type>] [(type: .public <name> @@ -85,26 +85,26 @@ (def: (jsonF token) (-> JSON Code) (case token - (#Null _) + {#Null _} (` #..Null) (^template [<ctor> <json_tag>] - [(<json_tag> value) - (` (<json_tag> (~ (<ctor> value))))]) + [{<json_tag> value} + (` {<json_tag> (~ (<ctor> value))})]) ([code.bit #..Boolean] [code.frac #..Number] [code.text #..String]) - (#Array members) - (` (#..Array ((~! row.row) (~+ (row.list (row\each jsonF members)))))) + {#Array members} + (` {#..Array ((~! row.row) (~+ (row.list (row\each jsonF members))))}) - (#Object pairs) - (` (#..Object ((~! dictionary.of_list) + {#Object pairs} + (` {#..Object ((~! dictionary.of_list) (~! text.hash) (list (~+ (|> pairs dictionary.entries (list\each (function (_ [key_name value]) - (` [(~ (code.text key_name)) (~ (jsonF value))]))))))))))) + (` [(~ (code.text key_name)) (~ (jsonF value))])))))))}))) (syntax: .public (json [token ..jsonP]) (in (list (` (: JSON (~ (jsonF token))))))) @@ -112,47 +112,47 @@ (def: .public (fields json) (-> JSON (Try (List String))) (case json - (#Object obj) - (#try.Success (dictionary.keys obj)) + {#Object obj} + {#try.Success (dictionary.keys obj)} _ - (#try.Failure ($_ text\composite "Cannot get the fields of a non-object.")))) + {#try.Failure ($_ text\composite "Cannot get the fields of a non-object.")})) (def: .public (field key json) (-> String JSON (Try JSON)) (case json - (#Object obj) + {#Object obj} (case (dictionary.value key obj) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None - (#try.Failure ($_ text\composite "Missing field '" key "' on object."))) + {#try.Failure ($_ text\composite "Missing field '" key "' on object.")}) _ - (#try.Failure ($_ text\composite "Cannot get field '" key "' on a non-object.")))) + {#try.Failure ($_ text\composite "Cannot get field '" key "' on a non-object.")})) (def: .public (has key value json) (-> String JSON JSON (Try JSON)) (case json - (#Object obj) - (#try.Success (#Object (dictionary.has key value obj))) + {#Object obj} + {#try.Success {#Object (dictionary.has key value obj)}} _ - (#try.Failure ($_ text\composite "Cannot set field '" key "' on a non-object.")))) + {#try.Failure ($_ text\composite "Cannot set field '" key "' on a non-object.")})) (template [<name> <tag> <type>] [(def: .public (<name> key json) (-> Text JSON (Try <type>)) (case (field key json) - (#try.Success (<tag> value)) - (#try.Success value) + {#try.Success {<tag> value}} + {#try.Success value} - (#try.Success _) - (#try.Failure ($_ text\composite "Wrong value type at key: " key)) + {#try.Success _} + {#try.Failure ($_ text\composite "Wrong value type at key: " key)} - (#try.Failure error) - (#try.Failure error)))] + {#try.Failure error} + {#try.Failure error}))] [boolean_field #Boolean Boolean] [number_field #Number Number] @@ -170,13 +170,13 @@ #1 (^template [<tag> <struct>] - [[(<tag> x') (<tag> y')] + [[{<tag> x'} {<tag> y'}] (\ <struct> = x' y')]) ([#Boolean bit.equivalence] [#Number f.equivalence] [#String text.equivalence]) - [(#Array xs) (#Array ys)] + [{#Array xs} {#Array ys}] (and (n.= (row.size xs) (row.size ys)) (list\mix (function (_ idx prev) (and prev @@ -188,13 +188,13 @@ #1 (list.indices (row.size xs)))) - [(#Object xs) (#Object ys)] + [{#Object xs} {#Object ys}] (and (n.= (dictionary.size xs) (dictionary.size ys)) (list\mix (function (_ [xk xv] prev) (and prev (case (dictionary.value xk ys) #.None #0 - (#.Some yv) (= xv yv)))) + {#.Some yv} (= xv yv)))) #1 (dictionary.entries xs))) @@ -273,7 +273,7 @@ (-> JSON Text) (case json (^template [<tag> <format>] - [(<tag> value) + [{<tag> value} (<format> value)]) ([#Null ..null_format] [#Boolean ..boolean_format] @@ -337,10 +337,10 @@ offset (<text>.many <text>.decimal)] (in ($_ text\composite mark (if signed?' "-" "") offset))))] (case (f\decoded ($_ text\composite (if signed? "-" "") digits "." decimals exp)) - (#try.Failure message) + {#try.Failure message} (<>.failure message) - (#try.Success value) + {#try.Success value} (in value)))) (def: escaped_parser diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux index 163bb3b20..b04f60806 100644 --- a/stdlib/source/library/lux/data/format/markdown.lux +++ b/stdlib/source/library/lux/data/format/markdown.lux @@ -110,7 +110,7 @@ (list\each (function (_ [idx [summary detail]]) (format "1. " (:representation summary) (case detail - (#.Some detail) + {#.Some detail} (|> detail :representation ..indent @@ -128,7 +128,7 @@ (|>> (list\each (function (_ [summary detail]) (format "* " (:representation summary) (case detail - (#.Some detail) + {#.Some detail} (|> detail :representation ..indent diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index c0864904c..ec7b997e9 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -76,7 +76,7 @@ [(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> @@ -230,10 +230,10 @@ (def: (un_padded string) (-> Binary (Try Binary)) (case (binary.size string) - 0 (#try.Success string) + 0 {#try.Success string} size (loop [end (-- size)] (case end - 0 (#try.Success (\ utf8.codec encoded "")) + 0 {#try.Success (\ utf8.codec encoded "")} _ (do try.monad [last_char (binary.read/8! end string)] (`` (case (.nat last_char) @@ -261,7 +261,7 @@ binary.size (n.> <size>)) (exception.except <exception> [value]) - (#try.Success (:abstraction value))) + {#try.Success (:abstraction value)}) (exception.except ..not_ascii [value]))) (def: .public <out> @@ -569,10 +569,10 @@ (type: .public Entry (Variant - (#Normal ..Normal) - (#Symbolic_Link ..Symbolic_Link) - (#Directory ..Directory) - (#Contiguous ..Contiguous))) + {#Normal ..Normal} + {#Symbolic_Link ..Symbolic_Link} + {#Directory ..Directory} + {#Contiguous ..Contiguous})) (type: Device Small) @@ -720,10 +720,10 @@ (def: entry_writer (Writer Entry) - (|>> (case> (#Normal value) (..normal_file_writer value) - (#Symbolic_Link value) (..symbolic_link_writer value) - (#Directory value) (..directory_writer value) - (#Contiguous value) (..contiguous_file_writer value)))) + (|>> (case> {#Normal value} (..normal_file_writer value) + {#Symbolic_Link value} (..symbolic_link_writer value) + {#Directory value} (..directory_writer value) + {#Contiguous value} (..contiguous_file_writer value)))) (def: end_of_archive_size Size diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux index 5131090ec..90aaa1b1e 100644 --- a/stdlib/source/library/lux/data/format/xml.lux +++ b/stdlib/source/library/lux/data/format/xml.lux @@ -37,8 +37,8 @@ (type: .public XML (Rec XML (Variant - (#Text Text) - (#Node Tag Attrs (List XML))))) + {#Text Text} + {#Node Tag Attrs (List XML)}))) (def: namespace_separator ":") @@ -61,7 +61,7 @@ #.None (<>.codec int.decimal (<text>.many <text>.decimal)) - (#.Some _) + {#.Some _} (<>.codec int.decimal (<text>.many <text>.hexadecimal)))] (in (|> code .nat text.of_char))) (<>.before (<text>.this ";")) @@ -95,7 +95,7 @@ #.None (in ["" first_part]) - (#.Some second_part) + {#.Some second_part} (in [first_part second_part])))) (def: tag^ namespaced_symbol^) @@ -176,18 +176,18 @@ .let [no_children^ ($_ <>.either (do <>.monad [_ (<text>.this "/>")] - (in (#Node tag attrs (list)))) + (in {#Node tag attrs (list)})) (do <>.monad [_ (<text>.this ">") _ (<>.some (<>.either <text>.space ..comment^)) _ (..close_tag^ tag)] - (in (#Node tag attrs (list))))) + (in {#Node tag attrs (list)}))) with_children^ (do <>.monad [_ (<text>.this ">") children (<>.many node^) _ (..close_tag^ tag)] - (in (#Node tag attrs children)))]] + (in {#Node tag attrs children}))]] ($_ <>.either no_children^ with_children^)) @@ -245,10 +245,10 @@ (loop [prefix "" input input] (case input - (#Text value) + {#Text value} (sanitize_value value) - (^ (#Node xml_tag xml_attrs (list (#Text value)))) + (^ {#Node xml_tag xml_attrs (list {#Text value})}) (let [tag (..tag xml_tag) attrs (if (dictionary.empty? xml_attrs) "" @@ -258,7 +258,7 @@ (sanitize_value value) "</" tag ">")) - (#Node xml_tag xml_attrs xml_children) + {#Node xml_tag xml_attrs xml_children} (let [tag (..tag xml_tag) attrs (if (dictionary.empty? xml_attrs) "" @@ -279,11 +279,11 @@ (def: (= reference sample) (case [reference sample] - [(#Text reference/value) (#Text sample/value)] + [{#Text reference/value} {#Text sample/value}] (text\= reference/value sample/value) - [(#Node reference/tag reference/attrs reference/children) - (#Node sample/tag sample/attrs sample/children)] + [{#Node reference/tag reference/attrs reference/children} + {#Node sample/tag sample/attrs sample/children}] (and (name\= reference/tag sample/tag) (\ (dictionary.equivalence text.equivalence) = reference/attrs sample/attrs) (n.= (list.size reference/children) diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux index 64d1f19ff..79d1feef3 100644 --- a/stdlib/source/library/lux/data/name.lux +++ b/stdlib/source/library/lux/data/name.lux @@ -53,10 +53,10 @@ (def: (decoded input) (case (text.all_split_by ..separator input) (^ (list short)) - (#.Right ["" short]) + {#.Right ["" short]} (^ (list module short)) - (#.Right [module short]) + {#.Right [module short]} _ - (#.Left (text\composite "Invalid format for Name: " input))))) + {#.Left (text\composite "Invalid format for Name: " input)}))) diff --git a/stdlib/source/library/lux/data/sum.lux b/stdlib/source/library/lux/data/sum.lux index 85d27f12b..174a2936f 100644 --- a/stdlib/source/library/lux/data/sum.lux +++ b/stdlib/source/library/lux/data/sum.lux @@ -9,7 +9,7 @@ [(def: .public (<name> value) (All (_ left right) (-> <name> (Or left right))) - (0 <right?> value))] + {0 <right?> value})] [#0 left] [#1 right]) @@ -20,8 +20,8 @@ (-> (Or a b) c))) (function (_ input) (case input - (0 #0 l) (on_left l) - (0 #1 r) (on_right r)))) + {0 #0 l} (on_left l) + {0 #1 r} (on_right r)))) (def: .public (then on_left on_right) (All (_ l l' r r') @@ -29,8 +29,8 @@ (-> (Or l r) (Or l' r')))) (function (_ input) (case input - (0 #0 l) (0 #0 (on_left l)) - (0 #1 r) (0 #1 (on_right r))))) + {0 #0 l} {0 #0 (on_left l)} + {0 #1 r} {0 #1 (on_right r)}))) (template [<name> <side> <right?>] [(def: .public (<name> items) @@ -39,10 +39,10 @@ #.End #.End - (#.Item (0 <right?> x) items') - (#.Item [x (<name> items')]) + {#.Item {0 <right?> x} items'} + {#.Item [x (<name> items')]} - (#.Item _ items') + {#.Item _ items'} (<name> items')))] [lefts a #0] @@ -55,21 +55,21 @@ #.End [#.End #.End] - (#.Item x xs') + {#.Item x xs'} (let [[lefts rights] (partition xs')] (case x - (0 #0 x') [(#.Item x' lefts) rights] - (0 #1 x') [lefts (#.Item x' rights)])))) + {0 #0 x'} [{#.Item x' lefts} rights] + {0 #1 x'} [lefts {#.Item x' rights}])))) (def: .public (equivalence left right) (All (_ l r) (-> (Equivalence l) (Equivalence r) (Equivalence (Or l r)))) (implementation (def: (= reference sample) (case [reference sample] - [(#.Left reference) (#.Left sample)] + [{#.Left reference} {#.Left sample}] (\ left = reference sample) - [(#.Right reference) (#.Right sample)] + [{#.Right reference} {#.Right sample}] (\ right = reference sample) _ @@ -83,8 +83,8 @@ (\ right &equivalence))) (def: (hash value) (case value - (#.Left value) + {#.Left value} (\ left hash value) - (#.Right value) + {#.Right value} (\ right hash value))))) diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux index b3961edc4..7823bd333 100644 --- a/stdlib/source/library/lux/data/text.lux +++ b/stdlib/source/library/lux/data/text.lux @@ -53,7 +53,7 @@ (def: .public (char index input) (-> Nat Text (Maybe Char)) (if (n.< ("lux text size" input) index) - (#.Some ("lux text char" index input)) + {#.Some ("lux text char" index input)} #.None)) (def: .public (index_since offset pattern input) @@ -74,13 +74,13 @@ #.None output - (#.Some offset') + {#.Some offset'} (recur (++ offset') output'))))) (def: .public (starts_with? prefix x) (-> Text Text Bit) (case (index prefix x) - (#.Some 0) + {#.Some 0} true _ @@ -89,7 +89,7 @@ (def: .public (ends_with? postfix x) (-> Text Text Bit) (case (last_index postfix x) - (#.Some n) + {#.Some n} (n.= (size x) (n.+ (size postfix) n)) @@ -104,7 +104,7 @@ (def: .public (contains? sub text) (-> Text Text Bit) (case ("lux text index" 0 sub text) - (#.Some _) + {#.Some _} true _ @@ -134,20 +134,20 @@ (-> Nat Nat Text (Maybe Text)) (if (|> size (n.+ offset) (n.> ("lux text size" input))) #.None - (#.Some ("lux text clip" offset size input)))) + {#.Some ("lux text clip" offset size input)})) (def: .public (clip_since offset input) (-> Nat Text (Maybe Text)) (let [size ("lux text size" input)] (if (n.> size offset) #.None - (#.Some ("lux text clip" offset (n.- offset size) input))))) + {#.Some ("lux text clip" offset (n.- offset size) input)}))) (def: .public (split_at at x) (-> Nat Text (Maybe [Text Text])) (case [(..clip 0 at x) (..clip_since at x)] - [(#.Some pre) (#.Some post)] - (#.Some [pre post]) + [{#.Some pre} {#.Some post}] + {#.Some [pre post]} _ #.None)) @@ -165,14 +165,14 @@ (loop [input sample output (: (List Text) (list))] (case (..split_by token input) - (#.Some [pre post]) + {#.Some [pre post]} (|> output - (#.Item pre) + {#.Item pre} (recur post)) #.None (|> output - (#.Item input) + {#.Item input} list.reversed)))) (def: .public (replaced/1 pattern replacement template) @@ -219,7 +219,7 @@ (loop [left "" right template] (case (..split_by pattern right) - (#.Some [pre post]) + {#.Some [pre post]} (recur ($_ "lux text concat" left pre replacement) post) #.None diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux index 817288316..fc063228e 100644 --- a/stdlib/source/library/lux/data/text/encoding/utf8.lux +++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux @@ -113,7 +113,7 @@ (def: (decoded value) (-> Binary (Try Text)) - (with_expansions [<jvm> (#try.Success (java/lang/String::new value (//.name //.utf_8)))] + (with_expansions [<jvm> {#try.Success (java/lang/String::new value (//.name //.utf_8))}] (for [@.old <jvm> @.jvm <jvm> @@ -137,7 +137,7 @@ (try (:as Text ("python object do" "decode" (:expected value) "utf-8"))) @.lua - (#try.Success ("lua utf8 decode" value)) + {#try.Success ("lua utf8 decode" value)} @.ruby (|> value diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index db706cc42..422239a27 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -182,15 +182,15 @@ (case (|> current ("lux text clip" (n.+ ..ascii_escape_offset offset) ..code_size) (\ n.hex decoded)) - (#try.Success char) + {#try.Success char} (let [limit' (|> limit (n.- offset) (n.- ..unicode_escape_offset))] - (#try.Success [(format previous + {#try.Success [(format previous ("lux text clip" 0 offset current) (//.of_char char)) ("lux text clip" (n.+ ..unicode_escape_offset offset) limit' current) - limit'])) + limit']}) - (#try.Failure error) + {#try.Failure error} (exception.except ..invalid_unicode_escape [current offset]))) (def: .public (un_escaped text) @@ -234,14 +234,14 @@ _ (recur (++ offset) previous current limit)) - (#try.Success (case previous + {#try.Success (case previous "" current - _ (format previous current)))))) + _ (format previous current))}))) (syntax: .public (literal [literal <code>.text]) (case (..un_escaped literal) - (#try.Success un_escaped) + {#try.Success un_escaped} (in (list (code.text un_escaped))) - (#try.Failure error) + {#try.Failure error} (meta.failure error))) diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux index 759ccb847..b22f3ce00 100644 --- a/stdlib/source/library/lux/data/text/format.lux +++ b/stdlib/source/library/lux/data/text/format.lux @@ -128,5 +128,5 @@ #.None "#.None" - (#.Some value) - (..format "(#.Some " (format value) ")")))) + {#.Some value} + (..format "{#.Some " (format value) "}")))) diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 94fd16694..63b112bb4 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -110,7 +110,7 @@ re_range^ re_options^))] (in (case negate? - (#.Some _) (` ((~! <text>.not) ($_ ((~! <>.either)) (~+ parts)))) + {#.Some _} (` ((~! <text>.not) ($_ ((~! <>.either)) (~+ parts)))) #.None (` ($_ ((~! <>.either)) (~+ parts))))))) (def: re_user_class^ @@ -273,7 +273,7 @@ (type: Re_Group (Variant #Non_Capturing - (#Capturing [(Maybe Text) Nat]))) + {#Capturing [(Maybe Text) Nat]})) (def: (re_sequential^ capturing? re_scoped^ current_module) (-> Bit @@ -290,16 +290,16 @@ [Nat (List Code) (List (List Code))]) (function (_ part [idx names steps]) (case part - (^or (#.Left complex) (#.Right [#Non_Capturing complex])) + (^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]) + {#.Right [{#Capturing [?name num_captures]} scoped]} (let [[idx! name!] (case ?name - (#.Some _name) + {#.Some _name} [idx (code.identifier ["" _name])] #.None @@ -334,31 +334,31 @@ (All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser [Text (Or l r)]))) (function (_ input) (case (left input) - (#try.Success [input' [lt lv]]) - (#try.Success [input' [lt (0 #0 lv)]]) + {#try.Success [input' [lt lv]]} + {#try.Success [input' [lt {0 #0 lv}]]} - (#try.Failure _) + {#try.Failure _} (case (right input) - (#try.Success [input' [rt rv]]) - (#try.Success [input' [rt (0 #1 rv)]]) + {#try.Success [input' [rt rv]]} + {#try.Success [input' [rt {0 #1 rv}]]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (def: (|||_^ left right) (All (_ l r) (-> (Parser [Text l]) (Parser [Text r]) (Parser Text))) (function (_ input) (case (left input) - (#try.Success [input' [lt lv]]) - (#try.Success [input' lt]) + {#try.Success [input' [lt lv]]} + {#try.Success [input' lt]} - (#try.Failure _) + {#try.Failure _} (case (right input) - (#try.Success [input' [rt rv]]) - (#try.Success [input' rt]) + {#try.Success [input' [rt rv]]} + {#try.Success [input' rt]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (def: (prep_alternative [num_captures alt]) (-> [Nat Code] Code) @@ -401,12 +401,12 @@ _ (<text>.this ">") [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) _ (<text>.this ")")] - (in [(#Capturing [(#.Some captured_name) num_captures]) pattern])) + (in [{#Capturing [{#.Some captured_name} num_captures]} pattern])) (do <>.monad [_ (<text>.this "(") [num_captures pattern] (re_alternative^ #1 re_scoped^ current_module) _ (<text>.this ")")] - (in [(#Capturing [#.None num_captures]) pattern])))) + (in [{#Capturing [#.None num_captures]} pattern])))) (def: (regex^ current_module) (-> Text (Parser Code)) @@ -417,11 +417,11 @@ [current_module meta.current_module_name] (case (<text>.result (regex^ current_module) pattern) - (#try.Failure error) + {#try.Failure error} (meta.failure (format "Error while parsing regular-expression:" //.new_line error)) - (#try.Success regex) + {#try.Success regex} (in (list regex))))) (syntax: .public (^regex [[pattern bindings] (<code>.form (<>.and <code>.text (<>.maybe <code>.any))) @@ -430,6 +430,6 @@ (with_identifiers [g!temp] (in (list& (` (^multi (~ g!temp) [((~! <text>.result) (..regex (~ (code.text pattern))) (~ g!temp)) - (#try.Success (~ (maybe.else g!temp bindings)))])) + {#try.Success (~ (maybe.else g!temp bindings))}])) body branches)))) diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux index b47505a09..32a05b3a4 100644 --- a/stdlib/source/library/lux/data/text/unicode/set.lux +++ b/stdlib/source/library/lux/data/text/unicode/set.lux @@ -217,10 +217,10 @@ (loop [tree (:representation set)] (if (//block.within? (tree.tag tree) character) (case (tree.root tree) - (0 #0 _) + {0 #0 _} true - (0 #1 left right) + {0 #1 left right} (or (recur left) (recur right))) false))) diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 8f3245ea2..7b107d8e5 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -126,7 +126,7 @@ (let [member ("lua array read" idx tuple)] (if ("lua object nil?" member) #.End - (#.Item member (recur (++ idx))))))))] + {#.Item member (recur (++ idx))})))))] (as_is)) (def: (tuple_inspection inspection) @@ -145,7 +145,7 @@ (with_expansions [<jvm> (let [object (:as java/lang/Object value)] (`` (<| (~~ (template [<class> <processing>] [(case (ffi.check <class> object) - (#.Some value) + {#.Some value} (`` (|> value (~~ (template.spliced <processing>)))) #.None)] @@ -155,16 +155,16 @@ [java/lang/String [(:as .Text) %.text]] )) (case (ffi.check [java/lang/Object] object) - (#.Some value) + {#.Some value} (let [value (:as (array.Array java/lang/Object) value)] (case (array.read! 0 value) - (^multi (#.Some tag) + (^multi {#.Some tag} [(ffi.check java/lang/Integer tag) - (#.Some tag)] + {#.Some tag}] [[(array.read! 1 value) (array.read! 2 value)] - [last? (#.Some choice)]]) + [last? {#.Some choice}]]) (let [last? (case last? - (#.Some _) #1 + {#.Some _} #1 #.None #0)] (|> (%.format (%.nat (.nat (java/lang/Integer::longValue tag))) " " (%.bit last?) @@ -256,8 +256,8 @@ "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)) @@ -447,18 +447,18 @@ representations membersR+ variantV variantV] (case representations - (#.Item leftR (#.Item rightR extraR+)) + {#.Item leftR {#.Item rightR extraR+}} (case (:as (Or Any Any) variantV) - (#.Left left) + {#.Left left} [lefts #0 (leftR left)] - (#.Right right) + {#.Right right} (case extraR+ #.End [lefts #1 (rightR right)] _ - (recur (++ lefts) (#.Item rightR extraR+) right))) + (recur (++ lefts) {#.Item rightR extraR+} right))) _ (undefined)))] @@ -475,10 +475,10 @@ #.End "" - (#.Item lastR #.End) + {#.Item lastR #.End} (lastR tupleV) - (#.Item headR tailR) + {#.Item headR tailR} (let [[leftV rightV] (:as [Any Any] tupleV)] (%.format (headR leftV) " " (recur tailR rightV)))))] (%.format "[" tuple_body "]")))))) @@ -496,7 +496,7 @@ (do <>.monad [[funcT inputsT+] (<type>.applied (<>.and <type>.any (<>.many <type>.any)))] (case (type.applied inputsT+ funcT) - (#.Some outputT) + {#.Some outputT} (<type>.local (list outputT) representation) #.None @@ -512,10 +512,10 @@ (def: .public (representation type value) (-> Type Any (Try Text)) (case (<type>.result ..representation_parser type) - (#try.Success representation) - (#try.Success (representation value)) + {#try.Success representation} + {#try.Success (representation value)} - (#try.Failure _) + {#try.Failure _} (exception.except ..cannot_represent_value type))) (syntax: .public (private [definition <code>.identifier]) @@ -589,7 +589,7 @@ #.None (` (~! ..inspection)) - (#.Some format) + {#.Some format} format)] (` [(~ (code.text name)) ((~ format) (~ (code.local_identifier name)))]))) diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index f523c3335..7ebe3cfdf 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -35,12 +35,12 @@ ["[0]" syntax]]]]]]]) (template: (|recursion_dummy|) - [(#.Primitive "" #.End)]) + [{#.Primitive "" #.End}]) (type: Fragment (Variant - (#Comment Text) - (#Code Code))) + {#Comment Text} + {#Code Code})) (def: fragment (Parser Fragment) @@ -51,7 +51,7 @@ (-> Code Nat) (case code (^template [<tag>] - [[[_ _ column] (<tag> _)] + [[[_ _ column] {<tag> _}] column]) ([#.Bit] [#.Nat] @@ -63,7 +63,7 @@ [#.Tag]) (^template [<tag>] - [[[_ _ column] (<tag> members)] + [[[_ _ column] {<tag> members}] (|> members (list\each reference_column) (list\mix n.min column))]) @@ -89,7 +89,7 @@ (-> Text Location Nat Code [Location Text]) (case example (^template [<tag> <prefix>] - [[new_location (<tag> [module short])] + [[new_location {<tag> [module short]}] (let [documentation (<| (text.prefix <prefix>) (cond (text\= expected_module module) short @@ -106,7 +106,7 @@ [#.Tag syntax.sigil]) (^template [<tag> <format>] - [[new_location (<tag> value)] + [[new_location {<tag> value}] (let [documentation (`` (|> value (~~ (template.spliced <format>))))] [(revised@ #.column (n.+ (text.size documentation)) new_location) (format (padding reference_column old_location new_location) @@ -119,7 +119,7 @@ [#.Text [%.text]]) (^template [|<| |>| <tag>] - [[group_location (<tag> members)] + [[group_location {<tag> members}] (let [[group_location' members_documentation] (list\mix (function (_ part [last_location text_accum]) (let [[member_location member_documentation] (code_documentation expected_module last_location reference_column part)] [member_location (format text_accum member_documentation)])) @@ -144,10 +144,10 @@ (def: (fragment_documentation module fragment) (-> Text Fragment Text) (case fragment - (#Comment comment) + {#Comment comment} (..single_line_comment comment) - (#Code example) + {#Code example} (let [reference_column (..reference_column example) [location _] example] (|> example @@ -161,7 +161,7 @@ (-> Nat Text) (format "_" (%.nat id)) ... (case (text.char id ..parameter_name_options) - ... (#.Some char) + ... {#.Some char} ... (text.of_char char) ... #.None @@ -192,7 +192,7 @@ (if (type_parameter? id) (let [parameter_id (..parameter_id level id)] (case (list.item parameter_id type_function_arguments) - (#.Some found) + {#.Some found} found _ @@ -222,29 +222,29 @@ (def: (%type' level type_function_name nestable? module type) (-> Nat Text Bit Text Type Text) (case type - (#.Primitive name params) + {#.Primitive name params} (|> params (list\each (|>> (%type' level type_function_name false module) (format " "))) - (#.Item (%.text name)) + {#.Item (%.text name)} text.together (text.enclosed ["(primitive " ")"])) - (#.Sum _) + {#.Sum _} (|> type type.flat_variant (list\each (%type' level type_function_name false module)) (text.interposed " ") (text.enclosed ["(Or " ")"])) - (#.Product _) + {#.Product _} (|> type type.flat_tuple (list\each (%type' level type_function_name false module)) (text.interposed " ") (text.enclosed ["[" "]"])) - (#.Function input output) + {#.Function input output} (let [[ins out] (type.flat_function type)] (format "(-> " (|> ins (list\each (%type' level type_function_name false module)) (text.interposed " ")) @@ -252,17 +252,17 @@ (%type' level type_function_name false module out) ")")) - (#.Parameter idx) + {#.Parameter idx} (parameter_name [type_function_name (list)] level idx) (^template [<tag> <pre> <post>] - [(<tag> id) + [{<tag> id} (format <pre> (%.nat id) <post>)]) ([#.Var "⌈" "⌋"] [#.Ex "⟨" "⟩"]) (^template [<tag> <name> <flat>] - [(<tag> _) + [{<tag> _} (let [[level' body] (<flat> type) args (level_parameters level level') body_doc (%type' (n.+ level level') type_function_name nestable? module body)] @@ -274,15 +274,15 @@ ([#.UnivQ "All" type.flat_univ_q] [#.ExQ "Ex" type.flat_ex_q]) - (^ (#.Apply (|recursion_dummy|) (#.Parameter 0))) + (^ {#.Apply (|recursion_dummy|) {#.Parameter 0}}) type_function_name - (^ (#.Apply (|recursion_dummy|) (#.UnivQ _ body))) + (^ {#.Apply (|recursion_dummy|) {#.UnivQ _ body}}) (format "(Rec " type_function_name \n (nested " " (%type' level type_function_name nestable? module body)) ")") - (#.Apply param fun) + {#.Apply param fun} (let [[type_func type_arguments] (type.flat_application type)] (format "(" (%type' level type_function_name false module type_func) " " (|> type_arguments @@ -290,7 +290,7 @@ (text.interposed " ")) ")")) - (#.Named [_module _name] type) + {#.Named [_module _name] type} (cond (text\= module _module) _name @@ -308,9 +308,9 @@ (def: (parameterized_type arity type) (-> Nat Type (Maybe Type)) (case arity - 0 (#.Some type) + 0 {#.Some type} _ (case type - (#.UnivQ _env _type) + {#.UnivQ _env _type} (parameterized_type (-- arity) _type) _ @@ -325,7 +325,7 @@ _ (case type - (#.Primitive name params) + {#.Primitive name params} (case params #.End (format "(primitive " (%.text name) ")") @@ -333,7 +333,7 @@ _ (format "(primitive " (%.text name) " " (|> params (list\each (type_definition' false level arity type_function_info #.None module)) (text.interposed " ")) ")")) - (#.Sum _) + {#.Sum _} (let [members (type.flat_variant type)] (case tags #.End @@ -348,20 +348,20 @@ (list.zipped/2 tags) (list\each (function (_ [t_name type]) (case type - (#.Product _) + {#.Product _} (let [types (type.flat_tuple type)] - (format " (#" t_name " " + (format " {#" t_name " " (|> types (list\each (type_definition' false level arity type_function_info #.None module)) (text.interposed " ")) - ")")) + "}")) _ - (format " (#" t_name " " (type_definition' false level arity type_function_info #.None module type) ")")))) + (format " {#" t_name " " (type_definition' false level arity type_function_info #.None module type) "}")))) (text.interposed \n) (text.enclosed [(format "(Variant" \n) ")"])))) - (#.Product _) + {#.Product _} (let [members (type.flat_tuple type)] (case tags #.End @@ -376,24 +376,24 @@ (text.enclosed [" [" "]"]) (text.enclosed [(format "(Record" \n) ")"])))) - (#.Function input output) + {#.Function input output} (let [[ins out] (type.flat_function type)] (format "(-> " (|> ins (list\each (type_definition' false level arity type_function_info #.None module)) (text.interposed " ")) " " (type_definition' false level arity type_function_info #.None module out) ")")) - (#.Parameter idx) + {#.Parameter idx} (parameter_name type_function_info level idx) (^template [<tag> <pre>] - [(<tag> id) + [{<tag> id} (format <pre> (%.nat id))]) ([#.Var "-"] [#.Ex "+"]) (^template [<tag> <name> <flat>] - [(<tag> _) + [{<tag> _} (let [[level' body] (<flat> type) args (level_parameters (n.- arity level) level') body_doc (type_definition' nestable? (n.+ level level') arity type_function_info tags module body) @@ -409,10 +409,10 @@ [#.ExQ "Ex" type.flat_ex_q]) ... Recursive call - (^ (#.Apply (|recursion_dummy|) (#.Parameter 0))) + (^ {#.Apply (|recursion_dummy|) {#.Parameter 0}}) (product.left type_function_info) - (^ (#.Apply (|recursion_dummy|) (#.UnivQ _ body))) + (^ {#.Apply (|recursion_dummy|) {#.UnivQ _ body}}) (|> (type_definition' nestable? level arity type_function_info tags module body) (text.all_split_by \n) (list\each (text.prefix " ")) @@ -420,7 +420,7 @@ (text.enclosed [(format "(Rec " (product.left type_function_info) \n) ")"])) - (#.Apply param fun) + {#.Apply param fun} (let [[type_func type_arguments] (type.flat_application type)] (format "(" (type_definition' false level arity type_function_info tags module type_func) " " (|> type_arguments @@ -428,7 +428,7 @@ (text.interposed " ")) ")")) - (#.Named [_module _name] type) + {#.Named [_module _name] type} (cond (text\= module _module) _name @@ -443,7 +443,7 @@ (-> Text [Text (List Text)] (List Text) Type Text) (let [arity (list.size parameters)] (case (parameterized_type arity type) - (#.Some type) + {#.Some type} (type_definition' true (-- arity) arity [name parameters] tags module type) #.None @@ -552,7 +552,7 @@ (~+ (list\each code.local_identifier parameters)))) ... Description (~+ (case description - (#.Some description) + {#.Some description} (list (` (<| ((~! md.paragraph)) ((~! md.text)) (~ description)))) diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index 885c32fbc..e4b320a27 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -51,10 +51,10 @@ (~ g!_) <end>] (.\ (~! <>.monad) (~' in) (~ body))) (~ g!inputs)) - (#.Right (~ g!_)) + {#.Right (~ g!_)} (~ g!_) - (#.Left (~ g!error)) + {#.Left (~ g!error)} ((~! phase.failure) (~ g!error))) ))))))))] diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux index b8a1dbf58..57f346903 100644 --- a/stdlib/source/library/lux/ffi.js.lux +++ b/stdlib/source/library/lux/ffi.js.lux @@ -93,8 +93,8 @@ (type: Method (Variant - (#Static Static_Method) - (#Virtual Virtual_Method))) + {#Static Static_Method} + {#Virtual Virtual_Method})) (def: common_method (Parser Common_Method) @@ -116,9 +116,9 @@ (type: Member (Variant - (#Constructor Constructor) - (#Field Field) - (#Method Method))) + {#Constructor Constructor} + {#Field Field} + {#Method Method})) (def: member (Parser Member) @@ -144,7 +144,7 @@ (-> Code [Bit Code] Code) (if nullable? (` (case (~ input) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.None @@ -165,7 +165,7 @@ (` (let [(~ g!temp) (~ output)] (if ("js object null?" (~ g!temp)) #.None - (#.Some (~ g!temp))))) + {#.Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("js object null?" (~ g!temp))) (~ g!temp) @@ -176,8 +176,8 @@ (type: Import (Variant - (#Class [Class_Declaration Text (List Member)]) - (#Function Static_Method))) + {#Class [Class_Declaration Text (List Member)]} + {#Function Static_Method})) (def: class_declaration (Parser Class_Declaration) @@ -238,7 +238,7 @@ (syntax: .public (import: [import ..import]) (with_identifiers [g!temp g!_] (case import - (#Class [[class_name class_parameters] format members]) + {#Class [[class_name class_parameters] format members]} (with_identifiers [g!object] (let [qualify (: (-> Text Code) (function (_ member_name) @@ -254,7 +254,7 @@ (..Object (primitive (~ (code.text real_class)))))) (list\each (function (_ member) (case member - (#Constructor inputsT) + {#Constructor inputsT} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify "new")) [(~+ (list\each product.right g!inputs))]) @@ -266,7 +266,7 @@ ("js constant" (~ (code.text real_class))) [(~+ (list\each (with_null g!temp) g!inputs))]))))) - (#Field [static? field fieldT]) + {#Field [static? field fieldT]} (if static? (` ((~! syntax:) ((~ (qualify field)) []) (\ (~! meta.monad) (~' in) @@ -280,9 +280,9 @@ (:expected (~ (without_null g!temp fieldT (` ("js object get" (~ (code.text field)) (~ g!object))))))))) - (#Method method) + {#Method method} (case method - (#Static [method alias inputsT io? try? outputT]) + {#Static [method alias inputsT io? try? outputT]} (..make_function (qualify (maybe.else method alias)) g!temp (%.format real_class "." method) @@ -291,7 +291,7 @@ try? outputT) - (#Virtual [method alias inputsT io? try? outputT]) + {#Virtual [method alias inputsT io? try? outputT]} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify (maybe.else method alias))) [(~+ (list\each product.right g!inputs))] @@ -312,7 +312,7 @@ [(~+ (list\each (with_null g!temp) g!inputs))]))))))))))) members))))) - (#Function [name alias inputsT io? try? outputT]) + {#Function [name alias inputsT io? try? outputT]} (in (list (..make_function (code.local_identifier (maybe.else name alias)) g!temp name @@ -337,9 +337,9 @@ #.None (~ g!_) - (#.Some (:as (~ type) (~ constant)))))))) + {#.Some (:as (~ type) (~ constant))}))))) - (#.Item [next tail]) + {#.Item [next tail]} (let [separator "."] (in (list (` (: (.Maybe (~ type)) (case (..type_of (~ constant)) @@ -355,7 +355,7 @@ #.None .false - (#.Some _) + {#.Some _} .true)]) (template [<name> <constant>] @@ -370,7 +370,7 @@ (def: .public on_node_js? Bit (case (..constant (Object Any) [process]) - (#.Some process) + {#.Some process} (case (:as Text ("js apply" ("js constant" "Object.prototype.toString.call") process)) "[object process]" diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index fd9e9d111..0ccc11f86 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -56,7 +56,7 @@ (template [<name> <class>] [(`` (def: .public <name> .Type - (#.Primitive <class> #.End)))] + {#.Primitive <class> #.End}))] [Boolean box.boolean] [Byte box.byte] @@ -71,7 +71,7 @@ (template [<name> <class>] [(`` (def: .public <name> .Type - (#.Primitive (reflection.reflection <class>) #.End)))] + {#.Primitive (reflection.reflection <class>) #.End}))] ... Primitives [boolean reflection.boolean] @@ -227,8 +227,8 @@ (type: FieldDecl (Variant - (#ConstantField (Type Value) Code) - (#VariableField State (Type Value)))) + {#ConstantField (Type Value) Code} + {#VariableField State (Type Value)})) (type: MethodDecl (Record @@ -239,43 +239,43 @@ (type: Method_Definition (Variant - (#ConstructorMethod [Bit + {#ConstructorMethod [Bit (List (Type Var)) Text (List Argument) (List (Typed Code)) Code - (List (Type Class))]) - (#VirtualMethod [Bit + (List (Type Class))]} + {#VirtualMethod [Bit Bit (List (Type Var)) Text (List Argument) (Type Return) Code - (List (Type Class))]) - (#OverridenMethod [Bit + (List (Type Class))]} + {#OverridenMethod [Bit (Type Declaration) (List (Type Var)) Text (List Argument) (Type Return) Code - (List (Type Class))]) - (#StaticMethod [Bit + (List (Type Class))]} + {#StaticMethod [Bit (List (Type Var)) (List Argument) (Type Return) Code - (List (Type Class))]) - (#AbstractMethod [(List (Type Var)) + (List (Type Class))]} + {#AbstractMethod [(List (Type Var)) (List Argument) (Type Return) - (List (Type Class))]) - (#NativeMethod [(List (Type Var)) + (List (Type Class))]} + {#NativeMethod [(List (Type Var)) (List Argument) (Type Return) - (List (Type Class))]))) + (List (Type Class))]})) (type: Partial_Call (Record @@ -318,10 +318,10 @@ (type: Import_Member_Declaration (Variant - (#EnumDecl (List Text)) - (#ConstructorDecl [ImportMethodCommons ImportConstructorDecl]) - (#MethodDecl [ImportMethodCommons ImportMethodDecl]) - (#FieldAccessDecl ImportFieldDecl))) + {#EnumDecl (List Text)} + {#ConstructorDecl [ImportMethodCommons ImportConstructorDecl]} + {#MethodDecl [ImportMethodCommons ImportMethodDecl]} + {#FieldAccessDecl ImportFieldDecl})) (def: (primitive_type mode type) (-> Primitive_Mode (Type Primitive) Code) @@ -362,7 +362,7 @@ (-> (Type Parameter) Code) (`` (<| (~~ (template [<when> <binding> <then>] [(case (<when> type) - (#.Some <binding>) + {#.Some <binding>} <then> #.None)] @@ -382,7 +382,7 @@ (-> Primitive_Mode (Type Value) Code) (`` (<| (~~ (template [<when> <binding> <then>] [(case (<when> type) - (#.Some <binding>) + {#.Some <binding>} <then> #.None)] @@ -390,12 +390,12 @@ [parser.parameter? type (parameter_type type)] [parser.primitive? type (primitive_type mode type)] [parser.array? elementT (case (parser.primitive? elementT) - (#.Some elementT) - (` (#.Primitive (~ (code.text (..reflection (type.array elementT)))) #.End)) + {#.Some elementT} + (` {#.Primitive (~ (code.text (..reflection (type.array elementT)))) #.End}) #.None - (` (#.Primitive (~ (code.text array.type_name)) - (#.Item (~ (value_type mode elementT)) #.End))))])) + (` {#.Primitive (~ (code.text array.type_name)) + {#.Item (~ (value_type mode elementT)) #.End}}))])) (undefined) ))) @@ -433,8 +433,8 @@ (-> (-> Code Code) Code Code) (case (f input) (^template [<tag>] - [[meta (<tag> parts)] - [meta (<tag> (list\each (replaced f) parts))]]) + [[meta {<tag> parts}] + [meta {<tag> (list\each (replaced f) parts)}]]) ([#.Form] [#.Variant] [#.Tuple]) @@ -445,7 +445,7 @@ (def: (parser->replacer p ast) (-> (Parser Code) (-> Code Code)) (case (<>.result p (list ast)) - (#.Right [#.End ast']) + {#.Right [#.End ast']} ast' _ @@ -455,10 +455,10 @@ (def: (field->parser class_name self_name [[field_name _ _] field]) (-> Text Text [Member_Declaration FieldDecl] (Parser Code)) (case field - (#ConstantField _) + {#ConstantField _} (get_const_parser class_name field_name) - (#VariableField _) + {#VariableField _} (<>.either (get_var_parser class_name field_name self_name) (put_var_parser class_name field_name self_name)))) @@ -510,22 +510,22 @@ (def: (method->parser class_name [[method_name _ _] meth_def]) (-> Text [Member_Declaration Method_Definition] (Parser Code)) (case meth_def - (#ConstructorMethod strict? type_vars self_name args constructor_args return_expr exs) + {#ConstructorMethod strict? type_vars self_name args constructor_args return_expr exs} (constructor_parser class_name args) - (#StaticMethod strict? type_vars args return_type return_expr exs) + {#StaticMethod strict? type_vars args return_type return_expr exs} (static_method_parser class_name method_name args) - (#VirtualMethod final? strict? type_vars self_name args return_type return_expr exs) + {#VirtualMethod final? strict? type_vars self_name args return_type return_expr exs} (virtual_method_parser class_name method_name args self_name) - (#OverridenMethod strict? owner_class type_vars self_name args return_type return_expr exs) + {#OverridenMethod strict? owner_class type_vars self_name args return_type return_expr exs} (special_method_parser class_name method_name args self_name) - (#AbstractMethod type_vars args return_type exs) + {#AbstractMethod type_vars args return_type exs} (virtual_method_parser class_name method_name args "") - (#NativeMethod type_vars args return_type exs) + {#NativeMethod type_vars args return_type exs} (virtual_method_parser class_name method_name args ""))) (def: privacy_modifier^ @@ -754,14 +754,14 @@ anns ..annotations^ type (..type^ type_vars) body <code>.any] - (in [[name #PublicP anns] (#ConstantField [type body])]))) + (in [[name #PublicP anns] {#ConstantField [type body]}]))) (<code>.form (do <>.monad [pm privacy_modifier^ sm state_modifier^ name <code>.local_identifier anns ..annotations^ type (..type^ type_vars)] - (in [[name pm anns] (#VariableField [sm type])]))))) + (in [[name pm anns] {#VariableField [sm type]}]))))) (def: (argument^ type_vars) (-> (List (Type Var)) (Parser Argument)) @@ -798,7 +798,7 @@ (in [[#member_name constructor_method_name #member_privacy pm #member_anns annotations] - (#ConstructorMethod strict_fp? method_vars self_name arguments constructor_args body exs)])))) + {#ConstructorMethod strict_fp? method_vars self_name arguments constructor_args body exs}])))) (def: (virtual_method_def^ class_vars) (-> (List (Type Var)) (Parser [Member_Declaration Method_Definition])) @@ -819,7 +819,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#VirtualMethod final? strict_fp? method_vars self_name arguments return_type body exs)])))) + {#VirtualMethod final? strict_fp? method_vars self_name arguments return_type body exs}])))) (def: overriden_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -840,7 +840,7 @@ (in [[#member_name name #member_privacy #PublicP #member_anns annotations] - (#OverridenMethod strict_fp? owner_class method_vars self_name arguments return_type body exs)])))) + {#OverridenMethod strict_fp? owner_class method_vars self_name arguments return_type body exs}])))) (def: static_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -859,7 +859,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#StaticMethod strict_fp? method_vars arguments return_type body exs)])))) + {#StaticMethod strict_fp? method_vars arguments return_type body exs}])))) (def: abstract_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -876,7 +876,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#AbstractMethod method_vars arguments return_type exs)])))) + {#AbstractMethod method_vars arguments return_type exs}])))) (def: native_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -893,7 +893,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#NativeMethod method_vars arguments return_type exs)])))) + {#NativeMethod method_vars arguments return_type exs}])))) (def: (method_def^ class_vars) (-> (List (Type Var)) (Parser [Member_Declaration Method_Definition])) @@ -938,7 +938,7 @@ (<code>.form (do <>.monad [_ (<code>.this! (' "enum")) enum_members (<>.some <code>.local_identifier)] - (in (#EnumDecl enum_members)))) + (in {#EnumDecl enum_members}))) (<code>.form (do <>.monad [tvars (<>.else (list) ..vars^) _ (<code>.identifier! ["" "new"]) @@ -947,7 +947,7 @@ ?prim_mode (<>.maybe primitive_mode^) args (..import_member_args^ total_vars) [io? try? maybe?] import_member_return_flags^] - (in (#ConstructorDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) + (in {#ConstructorDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) #import_member_alias (maybe.else "new" ?alias) #import_member_kind #VirtualIMK #import_member_tvars tvars @@ -955,7 +955,7 @@ #import_member_maybe? maybe? #import_member_try? try? #import_member_io? io?] - []])) + []]}) )) (<code>.form (do <>.monad [kind (: (Parser ImportMethodKind) @@ -969,7 +969,7 @@ args (..import_member_args^ total_vars) [io? try? maybe?] import_member_return_flags^ return (..return^ total_vars)] - (in (#MethodDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) + (in {#MethodDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) #import_member_alias (maybe.else name ?alias) #import_member_kind kind #import_member_tvars tvars @@ -978,7 +978,7 @@ #import_member_try? try? #import_member_io? io?] [#import_method_name name - #import_method_return return]])))) + #import_method_return return]]}))) (<code>.form (do <>.monad [static? (<>.parses? (<code>.this! (' "static"))) name <code>.local_identifier @@ -986,12 +986,12 @@ gtype (..type^ owner_vars) maybe? (<>.parses? (<code>.this! (' "?"))) setter? (<>.parses? (<code>.this! (' #!)))] - (in (#FieldAccessDecl [#import_field_mode (maybe.else #AutoPrM ?prim_mode) + (in {#FieldAccessDecl [#import_field_mode (maybe.else #AutoPrM ?prim_mode) #import_field_name name #import_field_static? static? #import_field_maybe? maybe? #import_field_setter? setter? - #import_field_type gtype])))) + #import_field_type gtype]}))) )) (def: bundle @@ -1061,14 +1061,14 @@ (def: (field_decl$ [[name pm anns] field]) (-> [Member_Declaration FieldDecl] Code) (case field - (#ConstantField class value) + {#ConstantField class value} (` ("constant" (~ (code.text name)) [(~+ (list\each annotation$ anns))] (~ (value$ class)) (~ value) )) - (#VariableField sm class) + {#VariableField sm class} (` ("variable" (~ (code.text name)) (~ (privacy_modifier$ pm)) (~ (state_modifier$ sm)) @@ -1088,7 +1088,7 @@ (def: (method_def$ fully_qualified_class_name method_parser super_class fields [[name pm anns] method_def]) (-> External (Parser Code) (Type Class) (List [Member_Declaration FieldDecl]) [Member_Declaration Method_Definition] Code) (case method_def - (#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs) + {#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs} (let [replacer (|> (list\each (field->parser fully_qualified_class_name self_name) fields) (list\mix <>.either method_parser) parser->replacer)] @@ -1104,7 +1104,7 @@ (~ (replaced replacer body)) ))) - (#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs) + {#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs} (let [replacer (|> (list\each (field->parser fully_qualified_class_name self_name) fields) (list\mix <>.either method_parser) parser->replacer)] @@ -1121,7 +1121,7 @@ [(~+ (list\each class$ exs))] (~ (replaced replacer body))))) - (#OverridenMethod strict_fp? declaration type_vars self_name arguments return_type body exs) + {#OverridenMethod strict_fp? declaration type_vars self_name arguments return_type body exs} (let [replacer (|> (list\each (field->parser fully_qualified_class_name self_name) fields) (list\mix <>.either method_parser) parser->replacer) @@ -1150,7 +1150,7 @@ (replaced super_replacer))) ))) - (#StaticMethod strict_fp? type_vars arguments return_type body exs) + {#StaticMethod strict_fp? type_vars arguments return_type body exs} (let [replacer (parser->replacer (<>.failure ""))] (` ("static" (~ (code.text name)) @@ -1163,7 +1163,7 @@ [(~+ (list\each class$ exs))] (~ (replaced replacer body))))) - (#AbstractMethod type_vars arguments return_type exs) + {#AbstractMethod type_vars arguments return_type exs} (` ("abstract" (~ (code.text name)) (~ (privacy_modifier$ pm)) @@ -1173,7 +1173,7 @@ (~ (return$ return_type)) [(~+ (list\each class$ exs))])) - (#NativeMethod type_vars arguments return_type exs) + {#NativeMethod type_vars arguments return_type exs} (` ("native" (~ (code.text name)) (~ (privacy_modifier$ pm)) @@ -1255,12 +1255,12 @@ (in (list (` (let [(~ g!temp) (~ expr)] (if ("jvm object null?" (~ g!temp)) #.None - (#.Some (~ g!temp))))))))) + {#.Some (~ g!temp)}))))))) (syntax: .public (!!! [expr <code>.any]) (with_identifiers [g!value] (in (list (` (.case (~ expr) - (#.Some (~ g!value)) + {#.Some (~ g!value)} (~ g!value) #.None @@ -1273,11 +1273,11 @@ 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) + {#.Some unchecked} (in (list (` (: (~ check_type) (let [(~ g!unchecked) (~ unchecked)] (~ check_code)))))) @@ -1314,10 +1314,10 @@ (def: (member_type_vars class_tvars member) (-> (List (Type Var)) Import_Member_Declaration (List (Type Var))) (case member - (#ConstructorDecl [commons _]) + {#ConstructorDecl [commons _]} (list\composite class_tvars (value@ #import_member_tvars commons)) - (#MethodDecl [commons _]) + {#MethodDecl [commons _]} (case (value@ #import_member_kind commons) #StaticIMK (value@ #import_member_tvars commons) @@ -1331,7 +1331,7 @@ (def: (member_def_arg_bindings vars member) (-> (List (Type Var)) Import_Member_Declaration (Meta [(List [Bit Code]) (List (Type Value)) (List Code)])) (case member - (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) + (^or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]}) (let [(^slots [#import_member_tvars #import_member_args]) commons] (do [! meta.monad] [arg_inputs (monad.each ! @@ -1356,7 +1356,7 @@ (def: (with_return_maybe member never_null? unboxed return_term) (-> Import_Member_Declaration Bit (Type Value) Code Code) (case member - (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) + (^or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]}) (cond (or never_null? (dictionary.key? ..boxes unboxed)) return_term @@ -1379,7 +1379,7 @@ [(def: (<name> member return_term) (-> Import_Member_Declaration Code Code) (case member - (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) + (^or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]}) (if (value@ <tag> commons) <term_trans> return_term) @@ -1420,7 +1420,7 @@ raw) (list)])))) unboxed/boxed (case (dictionary.value unboxed ..boxes) - (#.Some boxed) + {#.Some boxed} (<unbox/box> unboxed boxed refined) #.None @@ -1490,7 +1490,7 @@ (-> (List (Type Var)) Class_Kind (Type Declaration) [(List [Bit Code]) (List (Type Value)) (List Code)] Import_Member_Declaration Text Text (Meta (List Code))) (let [[full_name class_tvars] (parser.declaration class)] (case member - (#EnumDecl enum_members) + {#EnumDecl enum_members} (with_identifiers [g!_] (do meta.monad [.let [enum_type (: Code @@ -1509,7 +1509,7 @@ (~ (get_static_field full_name name)))))))]] (in (list\each getter_interop enum_members)))) - (#ConstructorDecl [commons _]) + {#ConstructorDecl [commons _]} (do meta.monad [.let [classT (type.class full_name (list)) def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))]) @@ -1528,7 +1528,7 @@ (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list\each product.right arg_function_inputs)))]) ((~' in) (.list (.` (~ jvm_interop))))))))) - (#MethodDecl [commons method]) + {#MethodDecl [commons method]} (with_identifiers [g!obj] (do meta.monad [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))]) @@ -1566,7 +1566,7 @@ (list\each ..decorate_input)))))) jvm_interop (: Code (case (type.void? method_return) - (#.Left method_return) + {#.Left method_return} (|> [method_return callC] (with_automatic_output_conversion (value@ #import_member_mode commons)) @@ -1575,7 +1575,7 @@ (with_return_io member)) - (#.Right method_return) + {#.Right method_return} (|> callC (with_return_try member) (with_return_io member))))]] @@ -1583,7 +1583,7 @@ (~+ (syntax_inputs object_ast))]) ((~' in) (.list (.` (~ jvm_interop)))))))))) - (#FieldAccessDecl fad) + {#FieldAccessDecl fad} (do meta.monad [.let [(^open "[0]") fad getter_name (code.identifier ["" (..import_name import_format method_prefix import_field_name)]) @@ -1655,12 +1655,12 @@ (-> (Type Declaration) (Meta Class_Kind)) (let [[class_name _] (parser.declaration declaration)] (case (load_class class_name) - (#.Right class) + {#.Right class} (\ meta.monad in (if (interface? class) #Interface #Class)) - (#.Left _) + {#.Left _} (meta.failure (format "Unknown class: " class_name))))) (syntax: .public (import: [declaration ..declaration^ @@ -1708,7 +1708,7 @@ (if (lux_type\= .Any type) (\ meta.monad in $Object) (case type - (#.Primitive name params) + {#.Primitive name params} (`` (cond (~~ (template [<type>] [(text\= (..reflection <type>) name) (case params @@ -1747,7 +1747,7 @@ (text\= array.type_name name) (case params - (#.Item elementLT #.End) + {#.Item elementLT #.End} (\ meta.monad each type.array (lux_type->jvm_type elementLT)) @@ -1759,7 +1759,7 @@ #.End (let [[_ unprefixed] (maybe.trusted (text.split_by descriptor.array_prefix name))] (\ meta.monad each type.array - (lux_type->jvm_type (#.Primitive unprefixed (list))))) + (lux_type->jvm_type {#.Primitive unprefixed (list)}))) _ <failure>) @@ -1772,22 +1772,22 @@ (do meta.monad [paramJT (lux_type->jvm_type paramLT)] (case (parser.parameter? paramJT) - (#.Some paramJT) + {#.Some paramJT} (in paramJT) #.None <failure>))) params))))) - (#.Apply A F) + {#.Apply A F} (case (lux_type.applied (list A) F) #.None <failure> - (#.Some type') + {#.Some type'} (lux_type->jvm_type type')) - (#.Named _ type') + {#.Named _ type'} (lux_type->jvm_type type') _ @@ -1795,7 +1795,7 @@ (syntax: .public (length [array <code>.any]) (case array - [_ (#.Identifier array_name)] + [_ {#.Identifier array_name}] (do meta.monad [array_type (meta.type array_name) array_jvm_type (lux_type->jvm_type array_type) @@ -1830,7 +1830,7 @@ (syntax: .public (read! [idx <code>.any array <code>.any]) (case array - [_ (#.Identifier array_name)] + [_ {#.Identifier array_name}] (do meta.monad [array_type (meta.type array_name) array_jvm_type (lux_type->jvm_type array_type) @@ -1868,7 +1868,7 @@ value <code>.any array <code>.any]) (case array - [_ (#.Identifier array_name)] + [_ {#.Identifier array_name}] (do meta.monad [array_type (meta.type array_name) array_jvm_type (lux_type->jvm_type array_type) @@ -1918,7 +1918,7 @@ object <code>.any]) (case [(parser.array? type) (parser.class? type)] - (^or [(#.Some _) _] [_ (#.Some _)]) + (^or [{#.Some _} _] [_ {#.Some _}]) (in (list (` (.: (~ (..value_type #ManualPrM type)) ("jvm object cast" (~ object)))))) diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux index 91f5b598c..8760b35f0 100644 --- a/stdlib/source/library/lux/ffi.lua.lux +++ b/stdlib/source/library/lux/ffi.lua.lux @@ -91,8 +91,8 @@ (type: Method (Variant - (#Static Static_Method) - (#Virtual Virtual_Method))) + {#Static Static_Method} + {#Virtual Virtual_Method})) (def: common_method (Parser Common_Method) @@ -114,8 +114,8 @@ (type: Member (Variant - (#Field Field) - (#Method Method))) + {#Field Field} + {#Method Method})) (def: member (Parser Member) @@ -140,7 +140,7 @@ (-> Code [Bit Code] Code) (if nilable? (` (case (~ input) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.None @@ -153,7 +153,7 @@ (` (let [(~ g!temp) (~ output)] (if ("lua object nil?" (~ g!temp)) #.None - (#.Some (~ g!temp))))) + {#.Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("lua object nil?" (~ g!temp))) (~ g!temp) @@ -161,9 +161,9 @@ (type: Import (Variant - (#Class [Text Text (List Member)]) - (#Function Static_Method) - (#Constant Field))) + {#Class [Text Text (List Member)]} + {#Function Static_Method} + {#Constant Field})) (def: import ($_ <>.or @@ -221,7 +221,7 @@ ... (import: (os/getenv [..String] "io" "?" ..String)))} (with_identifiers [g!temp] (case import - (#Class [class format members]) + {#Class [class format members]} (with_identifiers [g!object] (let [qualify (: (-> Text Code) (function (_ member_name) @@ -232,7 +232,7 @@ g!type (code.local_identifier class) real_class (text.replaced "/" "." class) imported (case (text.all_split_by "/" class) - (#.Item head tail) + {#.Item head tail} (list\mix (function (_ sub super) (` ("lua object get" (~ (code.text sub)) (:as (..Object .Any) (~ super))))) @@ -245,7 +245,7 @@ (..Object (primitive (~ (code.text real_class)))))) (list\each (function (_ member) (case member - (#Field [static? field fieldT]) + {#Field [static? field fieldT]} (if static? (` ((~! syntax:) ((~ (qualify field)) []) (\ (~! meta.monad) (~' in) @@ -260,9 +260,9 @@ (~ (without_nil g!temp fieldT (` ("lua object get" (~ (code.text field)) (:as (..Object .Any) (~ g!object)))))))))) - (#Method method) + {#Method method} (case method - (#Static [method alias inputsT io? try? outputT]) + {#Static [method alias inputsT io? try? outputT]} (..make_function (qualify (maybe.else method alias)) g!temp (` ("lua object get" (~ (code.text method)) @@ -272,7 +272,7 @@ try? outputT) - (#Virtual [method alias inputsT io? try? outputT]) + {#Virtual [method alias inputsT io? try? outputT]} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify (maybe.else method alias))) [(~+ (list\each product.right g!inputs))] @@ -292,7 +292,7 @@ (~+ (list\each (with_nil g!temp) g!inputs))))))))))))) members))))) - (#Function [name alias inputsT io? try? outputT]) + {#Function [name alias inputsT io? try? outputT]} (in (list (..make_function (code.local_identifier (maybe.else name alias)) g!temp (` ("lua constant" (~ (code.text (text.replaced "/" "." name))))) @@ -301,7 +301,7 @@ try? outputT))) - (#Constant [_ name fieldT]) + {#Constant [_ name fieldT]} (in (list (` ((~! syntax:) ((~ (code.local_identifier name)) []) (\ (~! meta.monad) (~' in) (list (` (.:as (~ (nilable_type fieldT)) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 6e77cb642..ce87fcbec 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -78,10 +78,10 @@ (type: GenericType (Rec GenericType (Variant - (#GenericTypeVar Text) - (#GenericClass [Text (List GenericType)]) - (#GenericArray GenericType) - (#GenericWildcard (Maybe [BoundKind GenericType]))))) + {#GenericTypeVar Text} + {#GenericClass [Text (List GenericType)]} + {#GenericArray GenericType} + {#GenericWildcard (Maybe [BoundKind GenericType])}))) (type: Type_Parameter [Text (List GenericType)]) @@ -147,8 +147,8 @@ (type: FieldDecl (Variant - (#ConstantField GenericType Code) - (#VariableField State GenericType))) + {#ConstantField GenericType Code} + {#VariableField State GenericType})) (type: MethodDecl (Record @@ -167,42 +167,42 @@ (type: Method_Definition (Variant - (#ConstructorMethod [Bit + {#ConstructorMethod [Bit (List Type_Parameter) (List ArgDecl) (List ConstructorArg) Code - (List GenericType)]) - (#VirtualMethod [Bit + (List GenericType)]} + {#VirtualMethod [Bit Bit (List Type_Parameter) Text (List ArgDecl) GenericType Code - (List GenericType)]) - (#OverridenMethod [Bit + (List GenericType)]} + {#OverridenMethod [Bit Class_Declaration (List Type_Parameter) Text (List ArgDecl) GenericType Code - (List GenericType)]) - (#StaticMethod [Bit + (List GenericType)]} + {#StaticMethod [Bit (List Type_Parameter) (List ArgDecl) GenericType Code - (List GenericType)]) - (#AbstractMethod [(List Type_Parameter) + (List GenericType)]} + {#AbstractMethod [(List Type_Parameter) (List ArgDecl) GenericType - (List GenericType)]) - (#NativeMethod [(List Type_Parameter) + (List GenericType)]} + {#NativeMethod [(List Type_Parameter) (List ArgDecl) GenericType - (List GenericType)]))) + (List GenericType)]})) (type: Partial_Call (Record @@ -245,10 +245,10 @@ (type: Import_Member_Declaration (Variant - (#EnumDecl (List Text)) - (#ConstructorDecl [ImportMethodCommons ImportConstructorDecl]) - (#MethodDecl [ImportMethodCommons ImportMethodDecl]) - (#FieldAccessDecl ImportFieldDecl))) + {#EnumDecl (List Text)} + {#ConstructorDecl [ImportMethodCommons ImportConstructorDecl]} + {#MethodDecl [ImportMethodCommons ImportMethodDecl]} + {#FieldAccessDecl ImportFieldDecl})) ... Utils (def: (manual_primitive_type class) @@ -256,7 +256,7 @@ (case class (^template [<prim> <type>] [<prim> - (#.Some (' <type>))]) + {#.Some (' <type>)}]) (["boolean" (primitive "java.lang.Boolean")] ["byte" (primitive "java.lang.Byte")] ["short" (primitive "java.lang.Short")] @@ -275,7 +275,7 @@ (case class (^template [<prim> <type>] [<prim> - (#.Some (' <type>))]) + {#.Some (' <type>)}]) (["boolean" .Bit] ["byte" .Int] ["short" .Int] @@ -300,12 +300,12 @@ (case [name+params mode in_array?] (^multi [[prim #.End] #ManualPrM #0] [(manual_primitive_type prim) - (#.Some output)]) + {#.Some output}]) output (^multi [[prim #.End] #AutoPrM #0] [(auto_primitive_type prim) - (#.Some output)]) + {#.Some output}]) output [[name params] _ _] @@ -316,7 +316,7 @@ (def: (class_type' mode type_params in_array? class) (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code) (case class - (#GenericTypeVar name) + {#GenericTypeVar name} (case (list.example (function (_ [pname pbounds]) (and (text\= name pname) (not (list.empty? pbounds)))) @@ -324,21 +324,21 @@ #.None (code.identifier ["" name]) - (#.Some [pname pbounds]) + {#.Some [pname pbounds]} (class_type' mode type_params in_array? (maybe.trusted (list.head pbounds)))) - (#GenericClass name+params) + {#GenericClass name+params} (generic_class_type' mode type_params in_array? name+params class_type') - (#GenericArray param) + {#GenericArray param} (let [=param (class_type' mode type_params #1 param)] (` ((~! array.Array) (~ =param)))) - (^or (#GenericWildcard #.None) (#GenericWildcard (#.Some [#LowerBound _]))) + (^or {#GenericWildcard #.None} {#GenericWildcard {#.Some [#LowerBound _]}}) (` .Any) - (#GenericWildcard (#.Some [#UpperBound upper_bound])) + {#GenericWildcard {#.Some [#UpperBound upper_bound]}} (class_type' mode type_params in_array? upper_bound) )) @@ -358,7 +358,7 @@ #.End (code.identifier ["" pname]) - (#.Item bound1 _) + {#.Item bound1 _} (class_type #ManualPrM class_params bound1)))) class_params)] (` (primitive (~ (code.text (safe class_name))) @@ -369,7 +369,7 @@ (def: (simple_class$ env class) (-> (List Type_Parameter) GenericType Text) (case class - (#GenericTypeVar name) + {#GenericTypeVar name} (case (list.example (function (_ [pname pbounds]) (and (text\= name pname) (not (list.empty? pbounds)))) @@ -377,25 +377,25 @@ #.None type_var_class - (#.Some [pname pbounds]) + {#.Some [pname pbounds]} (simple_class$ env (maybe.trusted (list.head pbounds)))) - (^or (#GenericWildcard #.None) (#GenericWildcard (#.Some [#LowerBound _]))) + (^or {#GenericWildcard #.None} {#GenericWildcard {#.Some [#LowerBound _]}}) type_var_class - (#GenericWildcard (#.Some [#UpperBound upper_bound])) + {#GenericWildcard {#.Some [#UpperBound upper_bound]}} (simple_class$ env upper_bound) - (#GenericClass name env) + {#GenericClass name env} (safe name) - (#GenericArray param') + {#GenericArray param'} (case param' - (#GenericArray param) + {#GenericArray param} (format "[" (simple_class$ env param)) (^template [<prim> <class>] - [(#GenericClass <prim> #.End) + [{#GenericClass <prim> #.End} <class>]) (["boolean" "[Z"] ["byte" "[B"] @@ -436,8 +436,8 @@ (-> (-> Code Code) Code Code) (case (f input) (^template [<tag>] - [[meta (<tag> parts)] - [meta (<tag> (list\each (pre_walk_replace f) parts))]]) + [[meta {<tag> parts}] + [meta {<tag> (list\each (pre_walk_replace f) parts)}]]) ([#.Form] [#.Variant] [#.Tuple]) @@ -448,7 +448,7 @@ (def: (parser_replacer p ast) (-> (Parser Code) (-> Code Code)) (case (<>.result p (list ast)) - (#.Right [#.End ast']) + {#.Right [#.End ast']} ast' _ @@ -458,10 +458,10 @@ (def: (field_parser class_name [[field_name _ _] field]) (-> Text [Member_Declaration FieldDecl] (Parser Code)) (case field - (#ConstantField _) + {#ConstantField _} (get_const_parser class_name field_name) - (#VariableField _) + {#VariableField _} (<>.either (get_var_parser class_name field_name) (put_var_parser class_name field_name)))) @@ -505,20 +505,20 @@ (def: (method_parser params class_name [[method_name _ _] meth_def]) (-> (List Type_Parameter) Text [Member_Declaration Method_Definition] (Parser Code)) (case meth_def - (#ConstructorMethod strict? type_vars args constructor_args return_expr exs) + {#ConstructorMethod strict? type_vars args constructor_args return_expr exs} (constructor_parser params class_name args) - (#StaticMethod strict? type_vars args return_type return_expr exs) + {#StaticMethod strict? type_vars args return_type return_expr exs} (static_method_parser params class_name method_name args) - (^or (#VirtualMethod final? strict? type_vars self_name args return_type return_expr exs) - (#OverridenMethod strict? owner_class type_vars self_name args return_type return_expr exs)) + (^or {#VirtualMethod final? strict? type_vars self_name args return_type return_expr exs} + {#OverridenMethod strict? owner_class type_vars self_name args return_type return_expr exs}) (special_method_parser params class_name method_name args) - (#AbstractMethod type_vars args return_type exs) + {#AbstractMethod type_vars args return_type exs} (virtual_method_parser params class_name method_name args) - (#NativeMethod type_vars args return_type exs) + {#NativeMethod type_vars args return_type exs} (virtual_method_parser params class_name method_name args))) ... Parsers @@ -556,24 +556,24 @@ ($_ <>.either (do <>.monad [_ (<code>.this! (' ?))] - (in (#GenericWildcard #.None))) + (in {#GenericWildcard #.None})) (<code>.tuple (do <>.monad [_ (<code>.this! (' ?)) bound_kind bound_kind^ bound recur^] - (in (#GenericWildcard (#.Some [bound_kind bound]))))) + (in {#GenericWildcard {#.Some [bound_kind bound]}}))) (do <>.monad [name <code>.local_identifier _ (no_periods_assertion name)] (if (list.member? text.equivalence (list\each product.left type_vars) name) - (in (#GenericTypeVar name)) - (in (#GenericClass name (list))))) + (in {#GenericTypeVar name}) + (in {#GenericClass name (list)}))) (<code>.tuple (do <>.monad [component recur^] (case component (^template [<class> <name>] - [(#GenericClass <name> #.End) - (in (#GenericClass <class> (list)))]) + [{#GenericClass <name> #.End} + (in {#GenericClass <class> (list)})]) (["[Z" "boolean"] ["[B" "byte"] ["[S" "short"] @@ -584,14 +584,14 @@ ["[C" "char"]) _ - (in (#GenericArray component))))) + (in {#GenericArray component})))) (<code>.form (do <>.monad [name <code>.local_identifier _ (no_periods_assertion name) params (<>.some recur^) _ (<>.assertion (format name " cannot be a type-parameter!") (not (list.member? text.equivalence (list\each product.left type_vars) name)))] - (in (#GenericClass name params)))) + (in {#GenericClass name params}))) )))) (def: type_param^ @@ -702,14 +702,14 @@ anns ..annotations^ type (..generic_type^ type_vars) body <code>.any] - (in [[name #PublicP anns] (#ConstantField [type body])]))) + (in [[name #PublicP anns] {#ConstantField [type body]}]))) (<code>.form (do <>.monad [pm privacy_modifier^ sm state_modifier^ name <code>.local_identifier anns ..annotations^ type (..generic_type^ type_vars)] - (in [[name pm anns] (#VariableField [sm type])]))))) + (in [[name pm anns] {#VariableField [sm type]}]))))) (def: (arg_decl^ type_vars) (-> (List Type_Parameter) (Parser ArgDecl)) @@ -744,7 +744,7 @@ (in [[#member_name constructor_method_name #member_privacy pm #member_anns annotations] - (#ConstructorMethod strict_fp? method_vars arg_decls constructor_args body exs)])))) + {#ConstructorMethod strict_fp? method_vars arg_decls constructor_args body exs}])))) (def: (virtual_method_def^ class_vars) (-> (List Type_Parameter) (Parser [Member_Declaration Method_Definition])) @@ -765,10 +765,10 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#VirtualMethod final? strict_fp? - method_vars - this_name arg_decls return_type - body exs)])))) + {#VirtualMethod final? strict_fp? + method_vars + this_name arg_decls return_type + body exs}])))) (def: overriden_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -788,10 +788,10 @@ (in [[#member_name name #member_privacy #PublicP #member_anns annotations] - (#OverridenMethod strict_fp? - owner_class method_vars - this_name arg_decls return_type - body exs)])))) + {#OverridenMethod strict_fp? + owner_class method_vars + this_name arg_decls return_type + body exs}])))) (def: static_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -810,7 +810,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#StaticMethod strict_fp? method_vars arg_decls return_type body exs)])))) + {#StaticMethod strict_fp? method_vars arg_decls return_type body exs}])))) (def: abstract_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -827,7 +827,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#AbstractMethod method_vars arg_decls return_type exs)])))) + {#AbstractMethod method_vars arg_decls return_type exs}])))) (def: native_method_def^ (Parser [Member_Declaration Method_Definition]) @@ -844,7 +844,7 @@ (in [[#member_name name #member_privacy pm #member_anns annotations] - (#NativeMethod method_vars arg_decls return_type exs)])))) + {#NativeMethod method_vars arg_decls return_type exs}])))) (def: (method_def^ class_vars) (-> (List Type_Parameter) (Parser [Member_Declaration Method_Definition])) @@ -885,7 +885,7 @@ (<code>.form (do <>.monad [_ (<code>.this! (' "enum")) enum_members (<>.some <code>.local_identifier)] - (in (#EnumDecl enum_members)))) + (in {#EnumDecl enum_members}))) (<code>.form (do <>.monad [tvars ..type_params^ _ (<code>.this! (' new)) @@ -894,7 +894,7 @@ ?prim_mode (<>.maybe primitive_mode^) args (..import_member_args^ total_vars) [io? try? maybe?] import_member_return_flags^] - (in (#ConstructorDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) + (in {#ConstructorDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) #import_member_alias (maybe.else "new" ?alias) #import_member_kind #VirtualIMK #import_member_tvars tvars @@ -902,7 +902,7 @@ #import_member_maybe? maybe? #import_member_try? try? #import_member_io? io?] - []])))) + []]}))) (<code>.form (do <>.monad [kind (: (Parser ImportMethodKind) (<>.or (<code>.this! (' "static")) @@ -915,7 +915,7 @@ args (..import_member_args^ total_vars) [io? try? maybe?] import_member_return_flags^ return (..generic_type^ total_vars)] - (in (#MethodDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) + (in {#MethodDecl [[#import_member_mode (maybe.else #AutoPrM ?prim_mode) #import_member_alias (maybe.else name ?alias) #import_member_kind kind #import_member_tvars tvars @@ -924,7 +924,7 @@ #import_member_try? try? #import_member_io? io?] [#import_method_name name - #import_method_return return]])))) + #import_method_return return]]}))) (<code>.form (do <>.monad [static? (<>.parses? (<code>.this! (' "static"))) name <code>.local_identifier @@ -932,12 +932,12 @@ gtype (..generic_type^ owner_vars) maybe? (<>.parses? (<code>.this! (' "?"))) setter? (<>.parses? (<code>.this! (' #!)))] - (in (#FieldAccessDecl [#import_field_mode (maybe.else #AutoPrM ?prim_mode) + (in {#FieldAccessDecl [#import_field_mode (maybe.else #AutoPrM ?prim_mode) #import_field_name name #import_field_static? static? #import_field_maybe? maybe? #import_field_setter? setter? - #import_field_type gtype])))) + #import_field_type gtype]}))) )) (def: bundle @@ -992,19 +992,19 @@ (def: (generic_type$ gtype) (-> GenericType JVM_Code) (case gtype - (#GenericTypeVar name) + {#GenericTypeVar name} name - (#GenericClass name params) + {#GenericClass name params} (format "(" (safe name) " " (spaced (list\each generic_type$ params)) ")") - (#GenericArray param) + {#GenericArray param} (format "(" array.type_name " " (generic_type$ param) ")") - (#GenericWildcard #.None) + {#GenericWildcard #.None} "?" - (#GenericWildcard (#.Some [bound_kind bound])) + {#GenericWildcard {#.Some [bound_kind bound]}} (format (bound_kind$ bound_kind) (generic_type$ bound)))) (def: (type_param$ [name bounds]) @@ -1041,7 +1041,7 @@ (def: (field_decl$ [[name pm anns] field]) (-> [Member_Declaration FieldDecl] JVM_Code) (case field - (#ConstantField class value) + {#ConstantField class value} (with_parens (spaced (list "constant" name (with_brackets (spaced (list\each annotation$ anns))) @@ -1049,7 +1049,7 @@ (code.format value)) )) - (#VariableField sm class) + {#VariableField sm class} (with_parens (spaced (list "variable" name (privacy_modifier$ pm) @@ -1072,7 +1072,7 @@ (def: (method_def$ replacer super_class [[name pm anns] method_def]) (-> (-> Code Code) Super_Class_Decl [Member_Declaration Method_Definition] JVM_Code) (case method_def - (#ConstructorMethod strict_fp? type_vars arg_decls constructor_args body exs) + {#ConstructorMethod strict_fp? type_vars arg_decls constructor_args body exs} (with_parens (spaced (list "init" (privacy_modifier$ pm) @@ -1085,7 +1085,7 @@ (code.format (pre_walk_replace replacer body)) ))) - (#VirtualMethod final? strict_fp? type_vars this_name arg_decls return_type body exs) + {#VirtualMethod final? strict_fp? type_vars this_name arg_decls return_type body exs} (with_parens (spaced (list "virtual" name @@ -1100,7 +1100,7 @@ (code.format (pre_walk_replace replacer (` (let [(~ (code.local_identifier this_name)) (~' _jvm_this)] (~ body)))))))) - (#OverridenMethod strict_fp? class_decl type_vars this_name arg_decls return_type body exs) + {#OverridenMethod strict_fp? class_decl type_vars this_name arg_decls return_type body exs} (let [super_replacer (parser_replacer (<code>.form (do <>.monad [_ (<code>.this! (' ::super!)) args (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any)) @@ -1128,7 +1128,7 @@ (code.format)) )))) - (#StaticMethod strict_fp? type_vars arg_decls return_type body exs) + {#StaticMethod strict_fp? type_vars arg_decls return_type body exs} (with_parens (spaced (list "static" name @@ -1141,7 +1141,7 @@ (generic_type$ return_type) (code.format (pre_walk_replace replacer body))))) - (#AbstractMethod type_vars arg_decls return_type exs) + {#AbstractMethod type_vars arg_decls return_type exs} (with_parens (spaced (list "abstract" name @@ -1152,7 +1152,7 @@ (with_brackets (spaced (list\each arg_decl$ arg_decls))) (generic_type$ return_type)))) - (#NativeMethod type_vars arg_decls return_type exs) + {#NativeMethod type_vars arg_decls return_type exs} (with_parens (spaced (list "native" name @@ -1242,12 +1242,12 @@ (in (list (` (let [(~ g!temp) (~ expr)] (if ("jvm object null?" (~ g!temp)) #.None - (#.Some (~ g!temp))))))))) + {#.Some (~ g!temp)}))))))) (syntax: .public (!!! [expr <code>.any]) (with_identifiers [g!value] (in (list (` (.case (~ expr) - (#.Some (~ g!value)) + {#.Some (~ g!value)} (~ g!value) #.None @@ -1260,11 +1260,11 @@ 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) + {#.Some unchecked} (in (list (` (: (~ check_type) (let [(~ g!unchecked) (~ unchecked)] (~ check_code)))))) @@ -1299,10 +1299,10 @@ (def: (member_type_vars class_tvars member) (-> (List Type_Parameter) Import_Member_Declaration (List Type_Parameter)) (case member - (#ConstructorDecl [commons _]) + {#ConstructorDecl [commons _]} (list\composite class_tvars (value@ #import_member_tvars commons)) - (#MethodDecl [commons _]) + {#MethodDecl [commons _]} (case (value@ #import_member_kind commons) #StaticIMK (value@ #import_member_tvars commons) @@ -1316,7 +1316,7 @@ (def: (member_def_arg_bindings type_params class member) (-> (List Type_Parameter) Class_Declaration Import_Member_Declaration (Meta [(List [Bit Code]) (List Text) (List Code)])) (case member - (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) + (^or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]}) (let [(^slots [#import_member_tvars #import_member_args]) commons] (do [! meta.monad] [arg_inputs (monad.each ! @@ -1343,7 +1343,7 @@ (def: (decorate_return_maybe class member return_term) (-> Class_Declaration Import_Member_Declaration Code Code) (case member - (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) + (^or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]}) (if (value@ #import_member_maybe? commons) (` (??? (~ return_term))) (let [g!temp (` ((~' ~') (~ (code.identifier ["" " Ω "]))))] @@ -1362,7 +1362,7 @@ [(def: (<name> member return_term) (-> Import_Member_Declaration Code Code) (case member - (^or (#ConstructorDecl [commons _]) (#MethodDecl [commons _])) + (^or {#ConstructorDecl [commons _]} {#MethodDecl [commons _]}) (if (value@ <tag> commons) <term_trans> return_term) @@ -1437,7 +1437,7 @@ (list.only free_type_param?) (list\each lux_type_parameter))] (case member - (#EnumDecl enum_members) + {#EnumDecl enum_members} (macro.with_identifiers [g!_] (do [! meta.monad] [.let [enum_type (: Code @@ -1458,7 +1458,7 @@ ((~ (code.text (format "jvm getstatic" ":" full_name ":" name)))))))))]] (in (list\each getter_interop enum_members)))) - (#ConstructorDecl [commons _]) + {#ConstructorDecl [commons _]} (do meta.monad [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))]) jvm_extension (code.text (format "jvm new" ":" full_name ":" (text.interposed "," arg_classes))) @@ -1470,7 +1470,7 @@ (in (list (` ((~! syntax:) ((~ def_name) [(~+ (syntax_inputs (list\each product.right arg_function_inputs)))]) ((~' in) (.list (.` (~ jvm_interop))))))))) - (#MethodDecl [commons method]) + {#MethodDecl [commons method]} (with_identifiers [g!obj] (do meta.monad [.let [def_name (code.identifier ["" (..import_name import_format method_prefix (value@ #import_member_alias commons))]) @@ -1504,7 +1504,7 @@ (~+ (syntax_inputs object_ast))]) ((~' in) (.list (.` (~ jvm_interop)))))))))) - (#FieldAccessDecl fad) + {#FieldAccessDecl fad} (do meta.monad [.let [(^open "[0]") fad base_gtype (class_type import_field_mode type_params import_field_type) @@ -1583,12 +1583,12 @@ (-> Class_Declaration (Meta Class_Kind)) (let [class_name (..safe class_name)] (case (..load_class class_name) - (#try.Success class) + {#try.Success class} (\ meta.monad in (if (interface? class) #Interface #Class)) - (#try.Failure error) + {#try.Failure error} (meta.failure (format "Cannot load class: " class_name text.new_line error))))) @@ -1607,7 +1607,7 @@ size <code>.any]) (case type (^template [<type> <array_op>] - [(^ (#GenericClass <type> (list))) + [(^ {#GenericClass <type> (list)}) (in (list (` (<array_op> (~ size)))))]) (["boolean" "jvm znewarray"] ["byte" "jvm bnewarray"] @@ -1629,18 +1629,18 @@ (if (type\= Any type) (\ meta.monad in "java.lang.Object") (case type - (#.Primitive name params) + {#.Primitive name params} (\ meta.monad in name) - (#.Apply A F) + {#.Apply A F} (case (type.applied (list A) F) #.None (meta.failure (format "Cannot apply type: " (type.format F) " to " (type.format A))) - (#.Some type') + {#.Some type'} (type_class_name type')) - (#.Named _ type') + {#.Named _ type'} (type_class_name type') _ @@ -1649,7 +1649,7 @@ (syntax: .public (read! [idx <code>.any array <code>.any]) (case array - [_ (#.Identifier array_name)] + [_ {#.Identifier array_name}] (do meta.monad [array_type (meta.type array_name) array_jvm_type (type_class_name array_type)] @@ -1678,7 +1678,7 @@ value <code>.any array <code>.any]) (case array - [_ (#.Identifier array_name)] + [_ {#.Identifier array_name}] (do meta.monad [array_type (meta.type array_name) array_jvm_type (type_class_name array_type)] diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index 78d75f269..ae8e4b347 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -99,8 +99,8 @@ (type: Method (Variant - (#Static Static_Method) - (#Virtual Virtual_Method))) + {#Static Static_Method} + {#Virtual Virtual_Method})) (def: common_method (Parser Common_Method) @@ -122,8 +122,8 @@ (type: Member (Variant - (#Field Field) - (#Method Method))) + {#Field Field} + {#Method Method})) (def: member (Parser Member) @@ -148,7 +148,7 @@ (-> Code [Bit Code] Code) (if nullable? (` (case (~ input) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.Null @@ -161,7 +161,7 @@ (` (let [(~ g!temp) (~ output)] (if ("php object null?" (~ g!temp)) #.None - (#.Some (~ g!temp))))) + {#.Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("php object null?" (~ g!temp))) (~ g!temp) @@ -169,9 +169,9 @@ (type: Import (Variant - (#Class Text (Maybe Alias) Text (List Member)) - (#Function Static_Method) - (#Constant Field))) + {#Class Text (Maybe Alias) Text (List Member)} + {#Function Static_Method} + {#Constant Field})) (def: import (Parser Import) @@ -188,10 +188,10 @@ (syntax: .public (try [expression <code>.any]) ... {#.doc (example (case (try (risky_computation input)) - ... (#.Right success) + ... {#.Right success} ... (do_something success) - ... (#.Left error) + ... {#.Left error} ... (recover_from_failure error)))} (in (list (` ("lux try" ((~! io.io) (~ expression))))))) @@ -239,7 +239,7 @@ (syntax: .public (import: [import ..import]) (with_identifiers [g!temp] (case import - (#Class [class alias format members]) + {#Class [class alias format members]} (with_identifiers [g!object] (let [qualify (: (-> Text Code) (function (_ member_name) @@ -253,7 +253,7 @@ (..Object (primitive (~ (code.text class)))))) (list\each (function (_ member) (case member - (#Field [static? field alias fieldT]) + {#Field [static? field alias fieldT]} (if static? (` ((~! syntax:) ((~ (qualify (maybe.else field alias))) []) (\ (~! meta.monad) (~' in) @@ -267,9 +267,9 @@ (~ (without_null g!temp fieldT (` ("php object get" (~ (code.text field)) (:as (..Object .Any) (~ g!object)))))))))) - (#Method method) + {#Method method} (case method - (#Static [method alias inputsT io? try? outputT]) + {#Static [method alias inputsT io? try? outputT]} (..make_function (qualify (maybe.else method alias)) g!temp (` ("php object get" (~ (code.text method)) @@ -280,7 +280,7 @@ try? outputT) - (#Virtual [method alias inputsT io? try? outputT]) + {#Virtual [method alias inputsT io? try? outputT]} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify (maybe.else method alias))) [(~+ (list\each product.right g!inputs))] @@ -300,7 +300,7 @@ (~+ (list\each (with_null g!temp) g!inputs))))))))))))) members))))) - (#Function [name alias inputsT io? try? outputT]) + {#Function [name alias inputsT io? try? outputT]} (let [imported (` ("php constant" (~ (code.text name))))] (in (list (..make_function (code.local_identifier (maybe.else name alias)) g!temp @@ -310,7 +310,7 @@ try? outputT)))) - (#Constant [_ name alias fieldT]) + {#Constant [_ name alias fieldT]} (let [imported (` ("php constant" (~ (code.text name))))] (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias))) []) (\ (~! meta.monad) (~' in) diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux index d5f1e23a2..ccee694ae 100644 --- a/stdlib/source/library/lux/ffi.py.lux +++ b/stdlib/source/library/lux/ffi.py.lux @@ -92,8 +92,8 @@ (type: Method (Variant - (#Static Static_Method) - (#Virtual Virtual_Method))) + {#Static Static_Method} + {#Virtual Virtual_Method})) (def: common_method (Parser Common_Method) @@ -115,9 +115,9 @@ (type: Member (Variant - (#Constructor Constructor) - (#Field Field) - (#Method Method))) + {#Constructor Constructor} + {#Field Field} + {#Method Method})) (def: member (Parser Member) @@ -143,7 +143,7 @@ (-> Code [Bit Code] Code) (if noneable? (` (case (~ input) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.None @@ -156,7 +156,7 @@ (` (let [(~ g!temp) (~ output)] (if ("python object none?" (~ g!temp)) #.None - (#.Some (~ g!temp))))) + {#.Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("python object none?" (~ g!temp))) (~ g!temp) @@ -164,8 +164,8 @@ (type: Import (Variant - (#Class [Text Text (List Member)]) - (#Function Static_Method))) + {#Class [Text Text (List Member)]} + {#Function Static_Method})) (def: import (Parser Import) @@ -241,7 +241,7 @@ ... ("static" getmtime [..String] "io" "try" ..Float)]))} (with_identifiers [g!temp] (case import - (#Class [class format members]) + {#Class [class format members]} (with_identifiers [g!object] (let [qualify (: (-> Text Code) (function (_ member_name) @@ -252,7 +252,7 @@ g!type (code.local_identifier class) real_class (text.replaced "/" "." class) imported (case (text.all_split_by "/" class) - (#.Item head tail) + {#.Item head tail} (list\mix (function (_ sub super) (` ("python object get" (~ (code.text sub)) (:as (..Object .Any) (~ super))))) @@ -265,7 +265,7 @@ (..Object (primitive (~ (code.text real_class)))))) (list\each (function (_ member) (case member - (#Constructor inputsT) + {#Constructor inputsT} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify "new")) [(~+ (list\each product.right g!inputs))]) @@ -276,7 +276,7 @@ (:as ..Function (~ imported)) (~+ (list\each (with_none g!temp) g!inputs))))))) - (#Field [static? field fieldT]) + {#Field [static? field fieldT]} (if static? (` ((~! syntax:) ((~ (qualify field)) []) (\ (~! meta.monad) (~' in) @@ -291,9 +291,9 @@ (~ (without_none g!temp fieldT (` ("python object get" (~ (code.text field)) (:as (..Object .Any) (~ g!object)))))))))) - (#Method method) + {#Method method} (case method - (#Static [method alias inputsT io? try? outputT]) + {#Static [method alias inputsT io? try? outputT]} (..make_function (qualify (maybe.else method alias)) g!temp (` ("python object get" (~ (code.text method)) @@ -303,7 +303,7 @@ try? outputT) - (#Virtual [method alias inputsT io? try? outputT]) + {#Virtual [method alias inputsT io? try? outputT]} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify (maybe.else method alias))) [(~+ (list\each product.right g!inputs))] @@ -323,7 +323,7 @@ (~+ (list\each (with_none g!temp) g!inputs))))))))))))) members))))) - (#Function [name alias inputsT io? try? outputT]) + {#Function [name alias inputsT io? try? outputT]} (in (list (..make_function (code.local_identifier (maybe.else name alias)) g!temp (` ("python constant" (~ (code.text name)))) diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux index 62620c6af..c2d06bb78 100644 --- a/stdlib/source/library/lux/ffi.rb.lux +++ b/stdlib/source/library/lux/ffi.rb.lux @@ -99,8 +99,8 @@ (type: Method (Variant - (#Static Static_Method) - (#Virtual Virtual_Method))) + {#Static Static_Method} + {#Virtual Virtual_Method})) (def: common_method (Parser Common_Method) @@ -122,8 +122,8 @@ (type: Member (Variant - (#Field Field) - (#Method Method))) + {#Field Field} + {#Method Method})) (def: member (Parser Member) @@ -148,7 +148,7 @@ (-> Code [Bit Code] Code) (if nilable? (` (case (~ input) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.None @@ -161,7 +161,7 @@ (` (let [(~ g!temp) (~ output)] (if ("ruby object nil?" (~ g!temp)) #.None - (#.Some (~ g!temp))))) + {#.Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("ruby object nil?" (~ g!temp))) (~ g!temp) @@ -169,9 +169,9 @@ (type: Import (Variant - (#Class Text (Maybe Alias) Text (List Member)) - (#Function Static_Method) - (#Constant Field))) + {#Class Text (Maybe Alias) Text (List Member)} + {#Function Static_Method} + {#Constant Field})) (def: import (Parser [(Maybe Text) Import]) @@ -232,7 +232,7 @@ (syntax: .public (import: [[?module import] ..import]) (with_identifiers [g!temp] (case import - (#Class [class alias format members]) + {#Class [class alias format members]} (with_identifiers [g!object] (let [qualify (: (-> Text Code) (function (_ member_name) @@ -243,7 +243,7 @@ g!type (code.local_identifier (maybe.else class alias)) module_import (: (List Code) (case ?module - (#.Some module) + {#.Some module} (list (` ("ruby import" (~ (code.text module))))) #.None @@ -253,7 +253,7 @@ (..Object (primitive (~ (code.text class)))))) (list\each (function (_ member) (case member - (#Field [static? field alias fieldT]) + {#Field [static? field alias fieldT]} (if static? (` ((~! syntax:) ((~ (qualify (maybe.else field alias))) []) (\ (~! meta.monad) (~' in) @@ -269,9 +269,9 @@ (~ (without_nil g!temp fieldT (` ("ruby object get" (~ (code.text field)) (:as (..Object .Any) (~ g!object)))))))))) - (#Method method) + {#Method method} (case method - (#Static [method alias inputsT io? try? outputT]) + {#Static [method alias inputsT io? try? outputT]} (..make_function (qualify (maybe.else method alias)) g!temp (` ("ruby object get" (~ (code.text method)) @@ -284,7 +284,7 @@ try? outputT) - (#Virtual [method alias inputsT io? try? outputT]) + {#Virtual [method alias inputsT io? try? outputT]} (let [g!inputs (input_variables inputsT)] (` (def: ((~ (qualify (maybe.else method alias))) [(~+ (list\each product.right g!inputs))] @@ -304,10 +304,10 @@ (~+ (list\each (with_nil g!temp) g!inputs))))))))))))) members))))) - (#Function [name alias inputsT io? try? outputT]) + {#Function [name alias inputsT io? try? outputT]} (let [imported (` (.exec (~+ (case ?module - (#.Some module) + {#.Some module} (list (` ("ruby import" (~ (code.text module))))) #.None @@ -321,10 +321,10 @@ try? outputT)))) - (#Constant [_ name alias fieldT]) + {#Constant [_ name alias fieldT]} (let [imported (` (.exec (~+ (case ?module - (#.Some module) + {#.Some module} (list (` ("ruby import" (~ (code.text module))))) #.None diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 0862942c1..18800df0a 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -120,7 +120,7 @@ (-> Code [Bit Code] Code) (if nilable? (` (case (~ input) - (#.Some (~ g!temp)) + {#.Some (~ g!temp)} (~ g!temp) #.None @@ -133,7 +133,7 @@ (` (let [(~ g!temp) (~ output)] (if ("scheme object nil?" (~ g!temp)) #.None - (#.Some (~ g!temp))))) + {#.Some (~ g!temp)}))) (` (let [(~ g!temp) (~ output)] (if (not ("scheme object nil?" (~ g!temp))) (~ g!temp) @@ -141,8 +141,8 @@ (type: Import (Variant - (#Function Common_Method) - (#Constant Field))) + {#Function Common_Method} + {#Constant Field})) (def: import (Parser Import) @@ -153,10 +153,10 @@ (syntax: .public (try [expression <code>.any]) ... {#.doc (example (case (try (risky_computation input)) - ... (#.Right success) + ... {#.Right success} ... (do_something success) - ... (#.Left error) + ... {#.Left error} ... (recover_from_failure error)))} (in (list (` ("lux try" ((~! io.io) (~ expression))))))) @@ -204,7 +204,7 @@ (syntax: .public (import: [import ..import]) (with_identifiers [g!temp] (case import - (#Function [name alias inputsT io? try? outputT]) + {#Function [name alias inputsT io? try? outputT]} (let [imported (` ("scheme constant" (~ (code.text name))))] (in (list (..make_function (code.local_identifier (maybe.else name alias)) g!temp @@ -214,7 +214,7 @@ try? outputT)))) - (#Constant [_ name alias fieldT]) + {#Constant [_ name alias fieldT]} (let [imported (` ("scheme constant" (~ (code.text name))))] (in (list (` ((~! syntax:) ((~ (code.local_identifier (maybe.else name alias)))) (\ (~! meta.monad) (~' in) diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux index 46d2ada34..5962e36fa 100644 --- a/stdlib/source/library/lux/macro.lux +++ b/stdlib/source/library/lux/macro.lux @@ -21,11 +21,11 @@ (def: .public (single_expansion syntax) (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Item [[_ (#.Identifier name)] args]))] + [_ {#.Form {#.Item [[_ {#.Identifier name}] args]}}] (do //.monad [?macro (//.macro name)] (case ?macro - (#.Some macro) + {#.Some macro} ((:as Macro' macro) args) #.None @@ -37,11 +37,11 @@ (def: .public (expansion syntax) (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Item [[_ (#.Identifier name)] args]))] + [_ {#.Form {#.Item [[_ {#.Identifier name}] args]}}] (do //.monad [?macro (//.macro name)] (case ?macro - (#.Some macro) + {#.Some macro} (do [! //.monad] [top_level_expansion ((:as Macro' macro) args)] (|> top_level_expansion @@ -57,11 +57,11 @@ (def: .public (full_expansion syntax) (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Item [[_ (#.Identifier name)] args]))] + [_ {#.Form {#.Item [[_ {#.Identifier name}] args]}}] (do //.monad [?macro (//.macro name)] (case ?macro - (#.Some macro) + {#.Some macro} (do //.monad [expansion ((:as Macro' macro) args) expansion' (monad.each //.monad full_expansion expansion)] @@ -72,18 +72,18 @@ [parts' (monad.each //.monad full_expansion (list& (code.identifier name) args))] (in (list (code.form (list\conjoint parts'))))))) - [_ (#.Form (#.Item [harg targs]))] + [_ {#.Form {#.Item [harg targs]}}] (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+))))))) - [_ (#.Variant members)] + [_ {#.Variant members}] (do //.monad [members' (monad.each //.monad full_expansion members)] (in (list (code.variant (list\conjoint members'))))) - [_ (#.Tuple members)] + [_ {#.Tuple members}] (do //.monad [members' (monad.each //.monad full_expansion members)] (in (list (code.tuple (list\conjoint members'))))) @@ -103,7 +103,7 @@ (def: (local_identifier ast) (-> Code (Meta Text)) (case ast - [_ (#.Identifier [_ name])] + [_ {#.Identifier [_ name]}] (\ //.monad in name) _ @@ -117,7 +117,7 @@ (macro: .public (with_identifiers tokens) (case tokens - (^ (list [_ (#.Tuple identifiers)] body)) + (^ (list [_ {#.Tuple identifiers}] body)) (do [! //.monad] [identifier_names (monad.each ! ..local_identifier identifiers) .let [identifier_defs (list\conjoint (list\each (: (-> Text (List Code)) @@ -148,16 +148,16 @@ macro_name [module short]] (case (: (Maybe [Bit Code]) (case tokens - (^ (list [_ (#.Text "omit")] + (^ (list [_ {#.Text "omit"}] token)) - (#.Some [#1 token]) + {#.Some [#1 token]} (^ (list token)) - (#.Some [#0 token]) + {#.Some [#0 token]} _ #.None)) - (#.Some [omit? token]) + {#.Some [omit? token]} (do //.monad [location //.location output (<func> token) diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux index b80a1a418..aaa054c96 100644 --- a/stdlib/source/library/lux/macro/code.lux +++ b/stdlib/source/library/lux/macro/code.lux @@ -20,17 +20,17 @@ ["[0]" location]]]]) ... (type: (Code' w) -... (#.Bit Bit) -... (#.Nat Nat) -... (#.Int Int) -... (#.Rev Rev) -... (#.Frac Frac) -... (#.Text Text) -... (#.Identifier Name) -... (#.Tag Name) -... (#.Form (List (w (Code' w)))) -... (#.Variant (List (w (Code' w)))) -... (#.Tuple (List (w (Code' w))))) +... {#.Bit Bit} +... {#.Nat Nat} +... {#.Int Int} +... {#.Rev Rev} +... {#.Frac Frac} +... {#.Text Text} +... {#.Identifier Name} +... {#.Tag Name} +... {#.Form (List (w (Code' w)))} +... {#.Variant (List (w (Code' w)))} +... {#.Tuple (List (w (Code' w)))}) ... (type: Code ... (Ann Location (Code' (Ann Location)))) @@ -38,7 +38,7 @@ (template [<name> <type> <tag>] [(def: .public (<name> x) (-> <type> Code) - [location.dummy (<tag> x)])] + [location.dummy {<tag> x}])] [bit Bit #.Bit] [nat Nat #.Nat] @@ -56,7 +56,7 @@ (template [<name> <tag>] [(def: .public (<name> name) (-> Text Code) - [location.dummy (<tag> ["" name])])] + [location.dummy {<tag> ["" name]}])] [local_identifier #.Identifier] [local_tag #.Tag]) @@ -67,7 +67,7 @@ (def: (= x y) (case [x y] (^template [<tag> <eq>] - [[[_ (<tag> x')] [_ (<tag> y')]] + [[[_ {<tag> x'}] [_ {<tag> y'}]] (\ <eq> = x' y')]) ([#.Bit bit.equivalence] [#.Nat nat.equivalence] @@ -79,7 +79,7 @@ [#.Tag name.equivalence]) (^template [<tag>] - [[[_ (<tag> xs')] [_ (<tag> ys')]] + [[[_ {<tag> xs'}] [_ {<tag> ys'}]] (\ (list.equivalence =) = xs' ys')]) ([#.Form] [#.Variant] @@ -92,7 +92,7 @@ (-> Code Text) (case ast (^template [<tag> <struct>] - [[_ (<tag> value)] + [[_ {<tag> value}] (\ <struct> encoded value)]) ([#.Bit bit.codec] [#.Nat nat.decimal] @@ -101,14 +101,14 @@ [#.Frac frac.decimal] [#.Identifier name.codec]) - [_ (#.Text value)] + [_ {#.Text value}] (text.format value) - [_ (#.Tag name)] + [_ {#.Tag name}] (text\composite "#" (\ name.codec encoded name)) (^template [<tag> <open> <close>] - [[_ (<tag> members)] + [[_ {<tag> members}] ($_ text\composite <open> (list\mix (function (_ next prev) @@ -130,8 +130,8 @@ substitute (case ast (^template [<tag>] - [[location (<tag> parts)] - [location (<tag> (list\each (replaced original substitute) parts))]]) + [[location {<tag> parts}] + [location {<tag> (list\each (replaced original substitute) parts)}]]) ([#.Form] [#.Variant] [#.Tuple]) diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index ca48592af..f53a6473b 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -36,14 +36,14 @@ (All (_ a) (-> Text (-> Module (Try [Module a])) (Meta a))) (function (_ compiler) (case (|> compiler (value@ #.modules) (plist.value name)) - (#.Some module) + {#.Some module} (case (body module) - (#try.Success [module' output]) - (#try.Success [(revised@ #.modules (plist.has name module') compiler) - output]) + {#try.Success [module' output]} + {#try.Success [(revised@ #.modules (plist.has name module') compiler) + output]} - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) #.None (exception.except ..unknown_module [name])))) @@ -52,17 +52,17 @@ (-> [Name Macro] (Meta Any)) (do meta.monad [[module_name definition_name] (meta.normal name) - .let [definition (: Global (#.Definition [false .Macro macro])) + .let [definition (: Global {#.Definition [false .Macro macro]}) add_macro! (: (-> (PList Global) (PList Global)) (plist.has definition_name definition))]] (..with_module module_name (function (_ module) (case (|> module (value@ #.definitions) (plist.value definition_name)) #.None - (#try.Success [(revised@ #.definitions add_macro! module) - []]) + {#try.Success [(revised@ #.definitions add_macro! module) + []]} - (#.Some _) + {#.Some _} (exception.except ..cannot_shadow_definition [module_name definition_name])))))) (def: (pop_one name) @@ -74,9 +74,9 @@ (..with_module module_name (function (_ module) (case (|> module (value@ #.definitions) (plist.value definition_name)) - (#.Some _) - (#try.Success [(revised@ #.definitions lacks_macro! module) - []]) + {#.Some _} + {#try.Success [(revised@ #.definitions lacks_macro! module) + []]} #.None (exception.except ..unknown_definition [module_name definition_name])))))) @@ -90,7 +90,7 @@ _ (..pop_one self) compiler meta.compiler_state] (in (case (value@ #.expected compiler) - (#.Some _) + {#.Some _} (list (' [])) #.None diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index efdb15f1f..3b885c86a 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -29,19 +29,19 @@ (All (_ a) (-> Code (Parser a) (Parser a))) (function (_ tokens) (case (parser tokens) - (#try.Success [tokens output]) - (#try.Success [tokens output]) + {#try.Success [tokens output]} + {#try.Success [tokens output]} - (#try.Failure error) - (#try.Failure ($_ text\composite + {#try.Failure error} + {#try.Failure ($_ text\composite "Failed to parse: " (code.format binding) text.new_line - error))))) + error)}))) (def: (un_paired pairs) (All (_ a) (-> (List [a a]) (List a))) (case pairs #.End #.End - (#.Item [[x y] pairs']) (list& x y (un_paired pairs')))) + {#.Item [[x y] pairs']} (list& x y (un_paired pairs')))) (def: syntax (Parser [Code [Text (List Code)] Code]) @@ -54,7 +54,7 @@ (macro: .public (syntax: tokens) (case (</>.result ..syntax tokens) - (#try.Success [export_policy [name args] body]) + {#try.Success [export_policy [name args] body]} (with_identifiers [g!tokens g!body g!error] (do [! meta.monad] [_ (if (|> args list.size nat.even?) @@ -67,10 +67,10 @@ (` ((~! ..self_documenting) (' (~ var)) (~ parser)))])] (case var - [_ (#.Identifier ["" _])] + [_ {#.Identifier ["" _]}] <default> - [_ (#.Identifier _)] + [_ {#.Identifier _}] (in [var parser]) _ @@ -86,11 +86,11 @@ [(~+ (..un_paired vars+parsers))] ((~' in) (~ body)))) (~ g!tokens)) - (#try.Success (~ g!body)) + {#try.Success (~ g!body)} ((~ g!body) (~ g!state)) - (#try.Failure (~ g!error)) - (#try.Failure ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error))))))))))) + {#try.Failure (~ g!error)} + {#try.Failure ((~! text.interposed) (~! text.new_line) (list (~ error_msg) (~ g!error)))}))))))) - (#try.Failure error) + {#try.Failure error} (meta.failure (macro.wrong_syntax_error (name_of ..syntax:))))) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index 707c44ea2..9cbe2fb1a 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -56,10 +56,10 @@ (` ((~ (code.text ..extension)) (~ (code.local_identifier name)) (~ (case value - (#.Left check) + {#.Left check} (//check.format check) - (#.Right value) + {#.Right value} value)) (~ (code.bit export?))))) @@ -90,9 +90,9 @@ (do <>.monad [definition (..parser compiler) _ (case (value@ #value definition) - (#.Left _) + {#.Left _} (in []) - (#.Right _) + {#.Right _} (<>.lifted (exception.except ..lacks_type [definition])))] (in definition))) diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux index 91428bb7e..2d33f7098 100644 --- a/stdlib/source/library/lux/macro/syntax/export.lux +++ b/stdlib/source/library/lux/macro/syntax/export.lux @@ -16,11 +16,11 @@ (do [! <>.monad] [candiate <code>.next] (case candiate - [_ (#.Identifier ["" _])] + [_ {#.Identifier ["" _]}] (in default_policy) - (^or [_ (#.Bit _)] - [_ (#.Identifier _)]) + (^or [_ {#.Bit _}] + [_ {#.Identifier _}]) (do ! [_ <code>.any] (in candiate)) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index 2f690935b..8be738131 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -86,11 +86,11 @@ [(syntax: .public (<name> [name (<>.or (<>.and (..part true) (..part false)) (..part false))]) (case name - (#.Left [simple complex]) + {#.Left [simple complex]} (in (list (<complex> [(text.interposed "" simple) (text.interposed "" complex)]))) - (#.Right simple) + {#.Right simple} (in (list (|> simple (text.interposed "") <simple>)))))] [identifier code.local_identifier code.identifier] @@ -103,17 +103,17 @@ (def: (applied env template) (-> Environment Code Code) (case template - [_ (#.Identifier "" name)] + [_ {#.Identifier "" name}] (case (dictionary.value name env) - (#.Some substitute) + {#.Some substitute} substitute #.None template) (^template [<tag>] - [[meta (<tag> elems)] - [meta (<tag> (list\each (applied env) elems))]]) + [[meta {<tag> elems}] + [meta {<tag> (list\each (applied env) elems)}]]) ([#.Form] [#.Variant] [#.Tuple]) @@ -143,7 +143,7 @@ (.let [environment (: Environment (|> (list.zipped/2 parameters inputs) (dictionary.of_list text.hash)))] - (#.Right [compiler (list\each (..applied environment) template)])) + {#.Right [compiler (list\each (..applied environment) template)]}) (exception.except ..irregular_arguments [parameters_amount inputs_amount])))))) (def: local @@ -162,12 +162,12 @@ [here_name meta.current_module_name expression? (: (Meta Bit) (function (_ lux) - (#try.Success [lux (case (value@ #.expected lux) + {#try.Success [lux (case (value@ #.expected lux) #.None false - (#.Some _) - true)]))) + {#.Some _} + true)]})) g!pop (local.push (list\each (function (_ local) [[here_name (value@ #name local)] (..macro local)]) diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index 616c62709..de54af790 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -21,10 +21,10 @@ (type: Infix (Rec Infix (Variant - (#Const Code) - (#Call (List Code)) - (#Unary Code Infix) - (#Binary Infix Code Infix)))) + {#Const Code} + {#Call (List Code)} + {#Unary Code Infix} + {#Binary Infix Code Infix}))) (def: literal (Parser Code) @@ -51,7 +51,7 @@ init_param expression steps (<>.some (<>.and <code>.any expression))] (in (list\mix (function (_ [op param] [_subject _op _param]) - [(#Binary _subject _op _param) op param]) + [{#Binary _subject _op _param} op param]) [init_subject init_op init_param] steps)))) ))) @@ -59,16 +59,16 @@ (def: (prefix infix) (-> Infix Code) (case infix - (#Const value) + {#Const value} value - (#Call parts) + {#Call parts} (code.form parts) - (#Unary op subject) + {#Unary op subject} (` ((~ op) (~ (prefix subject)))) - (#Binary left op right) + {#Binary left op right} (` ((~ op) (~ (prefix right)) (~ (prefix left)))))) (syntax: .public (infix [expr ..expression]) diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index 189a4b060..e82f222cc 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -136,7 +136,7 @@ (let [[modulus value] (:representation modular) [[vk mk] gcd] (i.extended_gcd value (//.divisor modulus))] (case gcd - +1 (#.Some (..modular modulus vk)) + +1 {#.Some (..modular modulus vk)} _ #.None)))] ) @@ -151,6 +151,6 @@ (-> (Modulus r%) (Modulus s%) (Try (-> (Mod s%) (Mod r%))))) (if (//.= reference subject) - (#try.Success (|>> ..value - (..modular reference))) + {#try.Success (|>> ..value + (..modular reference))} (exception.except ..moduli_are_not_equal [reference subject]))) diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index 4a4b000df..0d3c4fb7f 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -27,7 +27,7 @@ (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)) diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux index 2f0338817..4c20fd9fd 100644 --- a/stdlib/source/library/lux/math/number.lux +++ b/stdlib/source/library/lux/math/number.lux @@ -19,7 +19,7 @@ (def: (separator_prefixed? number) (-> Text Bit) (case ("lux text index" 0 ..separator number) - (#.Some 0) + {#.Some 0} #1 _ @@ -32,34 +32,34 @@ (template [<macro> <nat> <int> <rev> <frac> <error>] [(macro: .public (<macro> tokens state) (case tokens - (#.Item [meta (#.Text repr')] #.End) + {#.Item [meta {#.Text repr'}] #.End} (if (..separator_prefixed? repr') - (#try.Failure <error>) + {#try.Failure <error>} (let [repr (..without_separators repr')] (case (\ <nat> decoded repr) - (#try.Success value) - (#try.Success [state (list [meta (#.Nat value)])]) + {#try.Success value} + {#try.Success [state (list [meta {#.Nat value}])]} - (^multi (#try.Failure _) + (^multi {#try.Failure _} [(\ <int> decoded repr) - (#try.Success value)]) - (#try.Success [state (list [meta (#.Int value)])]) + {#try.Success value}]) + {#try.Success [state (list [meta {#.Int value}])]} - (^multi (#try.Failure _) + (^multi {#try.Failure _} [(\ <rev> decoded repr) - (#try.Success value)]) - (#try.Success [state (list [meta (#.Rev value)])]) + {#try.Success value}]) + {#try.Success [state (list [meta {#.Rev value}])]} - (^multi (#try.Failure _) + (^multi {#try.Failure _} [(\ <frac> decoded repr) - (#try.Success value)]) - (#try.Success [state (list [meta (#.Frac value)])]) + {#try.Success value}]) + {#try.Success [state (list [meta {#.Frac value}])]} _ - (#try.Failure <error>)))) + {#try.Failure <error>}))) _ - (#try.Failure <error>)))] + {#try.Failure <error>}))] [bin /nat.binary /int.binary /rev.binary /frac.binary "Invalid binary syntax."] [oct /nat.octal /int.octal /rev.octal /frac.octal "Invalid octal syntax."] diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux index c919e8ab5..230f18c1d 100644 --- a/stdlib/source/library/lux/math/number/frac.lux +++ b/stdlib/source/library/lux/math/number/frac.lux @@ -201,11 +201,11 @@ (def: (decoded input) (case ("lux f64 decode" input) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None - (#try.Failure "Could not decode Frac")))) + {#try.Failure "Could not decode Frac"}))) (def: log/2 (-> Frac Frac) @@ -355,13 +355,13 @@ (\ codec decoded))] (in [("lux text clip" 0 split_index representation) (//int.* <factor> (.int exponent))]))]) - ([+1 (^or [(#.Some split_index) #.None #.None #.None] - [#.None (#.Some split_index) #.None #.None])] - [-1 (^or [#.None #.None (#.Some split_index) #.None] - [#.None #.None #.None (#.Some split_index)])]) + ([+1 (^or [{#.Some split_index} #.None #.None #.None] + [#.None {#.Some split_index} #.None #.None])] + [-1 (^or [#.None #.None {#.Some split_index} #.None] + [#.None #.None #.None {#.Some split_index}])]) _ - (#try.Success [representation +0]))) + {#try.Success [representation +0]})) (template [<struct> <nat> <int> <error>] [(implementation: .public <struct> @@ -388,7 +388,7 @@ (do [! try.monad] [[mantissa exponent] (..representation_exponent <nat> representation) [whole decimal] (case ("lux text index" 0 "." mantissa) - (#.Some split_index) + {#.Some split_index} (do ! [.let [after_offset (++ split_index) after_length (//nat.- after_offset ("lux text size" mantissa))] @@ -399,7 +399,7 @@ decimal])) #.None - (#try.Failure ("lux text concat" <error> representation))) + {#try.Failure ("lux text concat" <error> representation)}) .let [whole ("lux text clip" 1 (-- ("lux text size" whole)) whole)] mantissa (\ <nat> decoded (case decimal 0 whole @@ -410,7 +410,7 @@ (//i64.left_shifted ..sign_offset (.i64 sign)) (//i64.left_shifted ..mantissa_size (.i64 (//int.+ (.int ..double_bias) exponent))) (//i64.zero ..mantissa_size (.i64 mantissa)))))) - (#try.Failure ("lux text concat" <error> representation))))))] + {#try.Failure ("lux text concat" <error> representation)}))))] [binary //nat.binary //int.binary "Invalid binary syntax: "] [octal //nat.octal //int.octal "Invalid octaladecimal syntax: "] diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index 4fbab4334..8ccf4b8c8 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -197,7 +197,7 @@ sign (..bit (-- width)) mantissa (..mask (-- width)) co_mantissa (..xor (.i64 -1) mantissa)] - (#.Some (: Sub + {#.Some (: Sub (implementation (def: &equivalence ..equivalence) (def: width width) @@ -207,5 +207,5 @@ (def: (wide value) (.i64 (case (.nat (..and sign value)) 0 value - _ (..or co_mantissa value)))))))) + _ (..or co_mantissa value))))))}) #.None)) diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux index 0e515f8a5..5c4ff3cd6 100644 --- a/stdlib/source/library/lux/math/number/int.lux +++ b/stdlib/source/library/lux/math/number/int.lux @@ -229,8 +229,8 @@ (\ try.functor each (|>> -- .int ..opposite --))) _ - (#try.Failure <error>)) - (#try.Failure <error>)))))] + {#try.Failure <error>}) + {#try.Failure <error>}))))] [binary //nat.binary "Invalid binary syntax for Int: "] [octal //nat.octal "Invalid octal syntax for Int: "] diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux index 3efe7f197..0b0bf4105 100644 --- a/stdlib/source/library/lux/math/number/nat.lux +++ b/stdlib/source/library/lux/math/number/nat.lux @@ -191,8 +191,8 @@ (def: (binary_value digit) (-> Nat (Maybe Nat)) (case digit - (^ (char "0")) (#.Some 0) - (^ (char "1")) (#.Some 1) + (^ (char "0")) {#.Some 0} + (^ (char "1")) {#.Some 1} _ #.None)) (def: (octal_character value) @@ -211,14 +211,14 @@ (def: (octal_value digit) (-> Nat (Maybe Nat)) (case digit - (^ (char "0")) (#.Some 0) - (^ (char "1")) (#.Some 1) - (^ (char "2")) (#.Some 2) - (^ (char "3")) (#.Some 3) - (^ (char "4")) (#.Some 4) - (^ (char "5")) (#.Some 5) - (^ (char "6")) (#.Some 6) - (^ (char "7")) (#.Some 7) + (^ (char "0")) {#.Some 0} + (^ (char "1")) {#.Some 1} + (^ (char "2")) {#.Some 2} + (^ (char "3")) {#.Some 3} + (^ (char "4")) {#.Some 4} + (^ (char "5")) {#.Some 5} + (^ (char "6")) {#.Some 6} + (^ (char "7")) {#.Some 7} _ #.None)) (def: (decimal_character value) @@ -239,16 +239,16 @@ (def: (decimal_value digit) (-> Nat (Maybe Nat)) (case digit - (^ (char "0")) (#.Some 0) - (^ (char "1")) (#.Some 1) - (^ (char "2")) (#.Some 2) - (^ (char "3")) (#.Some 3) - (^ (char "4")) (#.Some 4) - (^ (char "5")) (#.Some 5) - (^ (char "6")) (#.Some 6) - (^ (char "7")) (#.Some 7) - (^ (char "8")) (#.Some 8) - (^ (char "9")) (#.Some 9) + (^ (char "0")) {#.Some 0} + (^ (char "1")) {#.Some 1} + (^ (char "2")) {#.Some 2} + (^ (char "3")) {#.Some 3} + (^ (char "4")) {#.Some 4} + (^ (char "5")) {#.Some 5} + (^ (char "6")) {#.Some 6} + (^ (char "7")) {#.Some 7} + (^ (char "8")) {#.Some 8} + (^ (char "9")) {#.Some 9} _ #.None)) (def: (hexadecimal_character value) @@ -276,12 +276,12 @@ (-> Nat (Maybe Nat)) (case digit (^template [<character> <number>] - [(^ (char <character>)) (#.Some <number>)]) + [(^ (char <character>)) {#.Some <number>}]) (["0" 0] ["1" 1] ["2" 2] ["3" 3] ["4" 4] ["5" 5] ["6" 6] ["7" 7] ["8" 8] ["9" 9]) (^template [<lower> <upper> <number>] - [(^or (^ (char <lower>)) (^ (char <upper>))) (#.Some <number>)]) + [(^or (^ (char <lower>)) (^ (char <upper>))) {#.Some <number>}]) (["a" "A" 10] ["b" "B" 11] ["c" "C" 12] ["d" "D" 13] ["e" "E" 14] ["f" "F" 15]) _ #.None)) @@ -312,16 +312,16 @@ output 0] (if (..< input_size idx) (case (<to_value> ("lux text char" idx repr)) - (#.Some digit_value) + {#.Some digit_value} (recur (++ idx) (|> output ("lux i64 left-shift" <shift>) ("lux i64 or" digit_value))) _ - (#try.Failure ("lux text concat" <error> repr))) - (#try.Success output))) - (#try.Failure ("lux text concat" <error> repr))))))] + {#try.Failure ("lux text concat" <error> repr)}) + {#try.Success output})) + {#try.Failure ("lux text concat" <error> repr)}))))] [1 binary binary_character binary_value "Invalid binary syntax for Nat: "] [3 octal octal_character octal_value "Invalid octal syntax for Nat: "] @@ -345,7 +345,7 @@ (def: (decoded repr) (let [input_size ("lux text size" repr)] - (with_expansions [<failure> (#try.Failure ("lux text concat" "Invalid decimal syntax for Nat: " repr))] + (with_expansions [<failure> {#try.Failure ("lux text concat" "Invalid decimal syntax for Nat: " repr)}] (if (..> 0 input_size) (loop [idx 0 output 0] @@ -354,10 +354,10 @@ #.None <failure> - (#.Some digit_value) + {#.Some digit_value} (recur (++ idx) (|> output (..* 10) (..+ digit_value)))) - (#try.Success output))) + {#try.Success output})) <failure>))))) (implementation: .public hash diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index 1e6aff940..be5bb235a 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -30,7 +30,7 @@ (def: .public (nat value) (-> Ratio (Maybe Nat)) (case (value@ #denominator value) - 1 (#.Some (value@ #numerator value)) + 1 {#.Some (value@ #numerator value)} _ #.None)) (def: (normal (^slots [#numerator #denominator])) @@ -136,7 +136,7 @@ (def: (decoded input) (case (text.split_by ..separator input) - (#.Some [num denom]) + {#.Some [num denom]} (do try.monad [numerator (n\decoded num) denominator (n\decoded denom)] @@ -144,7 +144,7 @@ #denominator denominator]))) #.None - (#.Left (text\composite "Invalid syntax for ratio: " input))))) + {#.Left (text\composite "Invalid syntax for ratio: " input)}))) (template [<identity> <composite> <name>] [(implementation: .public <name> diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux index 07013dc94..a652d3913 100644 --- a/stdlib/source/library/lux/math/number/rev.lux +++ b/stdlib/source/library/lux/math/number/rev.lux @@ -225,7 +225,7 @@ ("lux text clip" 1 (-- ("lux text size" input)) input)) (template [<struct> <codec> <char_bit_size> <error>] - [(with_expansions [<error_output> (as_is (#try.Failure ("lux text concat" <error> repr)))] + [(with_expansions [<error_output> (as_is {#try.Failure ("lux text concat" <error> repr)})] (implementation: .public <struct> (Codec Text Rev) @@ -253,8 +253,8 @@ (case ("lux text char" 0 repr) (^ (char ".")) (case (\ <codec> decoded (..decimals repr)) - (#try.Success output) - (#try.Success (.rev output)) + {#try.Success output} + {#try.Success (.rev output)} _ <error_output>) @@ -365,10 +365,10 @@ #.None #.None - (#.Some digit) + {#.Some digit} (recur (++ idx) (digits\put! idx digit output))) - (#.Some output)))))) + {#.Some output}))))) (def: (digits\< param subject) (-> Digits Digits Bit) @@ -425,7 +425,7 @@ (def: (decoded input) (let [dotted? (case ("lux text index" 0 "." input) - (#.Some 0) + {#.Some 0} true _ @@ -435,7 +435,7 @@ (//nat.<= (++ //i64.width)))] (if (and dotted? within_limits?) (case (|> input ..decimals ..text_digits) - (#.Some digits) + {#.Some digits} (loop [digits digits idx 0 output 0] @@ -447,9 +447,9 @@ (recur (digits\-! power digits) (++ idx) (//i64.one (//nat.- idx (-- //i64.width)) output)))) - (#try.Success (.rev output)))) + {#try.Success (.rev output)})) #.None - (#try.Failure ("lux text concat" "Wrong syntax for Rev: " input))) - (#try.Failure ("lux text concat" "Wrong syntax for Rev: " input)))) + {#try.Failure ("lux text concat" "Wrong syntax for Rev: " input)}) + {#try.Failure ("lux text concat" "Wrong syntax for Rev: " input)})) )) diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux index 348482e63..b7dd727d7 100644 --- a/stdlib/source/library/lux/math/random.lux +++ b/stdlib/source/library/lux/math/random.lux @@ -91,7 +91,7 @@ (do ..monad [sample random] (case (check sample) - (#.Some output) + {#.Some output} (in output) #.None @@ -102,7 +102,7 @@ (do ..monad [sample gen] (case (refiner sample) - (#.Some refined) + {#.Some refined} (in refined) #.None @@ -207,10 +207,10 @@ (if ? (do ! [=left left] - (in (0 #0 =left))) + (in {0 #0 =left})) (do ! [=right right] - (in (0 #1 =right)))))) + (in {0 #1 =right}))))) (def: .public (either left right) (All (_ a) (-> (Random a) (Random a) (Random a))) @@ -233,22 +233,26 @@ (if some? (do ! [value value_gen] - (in (#.Some value))) + (in {#.Some value})) (in #.None)))) -(template [<name> <type> <zero> <plus>] - [(def: .public (<name> size value_gen) - (All (_ a) (-> Nat (Random a) (Random (<type> a)))) - (if (n.> 0 size) - (do ..monad - [x value_gen - xs (<name> (-- size) value_gen)] - (in (<plus> x xs))) - (\ ..monad in <zero>)))] - - [list List (.list) #.Item] - [row Row row.empty row.suffix] - ) +(def: .public (list size value_gen) + (All (_ a) (-> Nat (Random a) (Random (List a)))) + (if (n.> 0 size) + (do ..monad + [x value_gen + xs (list (-- size) value_gen)] + (in {#.Item x xs})) + (\ ..monad in (.list)))) + +(def: .public (row size value_gen) + (All (_ a) (-> Nat (Random a) (Random (Row a)))) + (if (n.> 0 size) + (do ..monad + [x value_gen + xs (row (-- size) value_gen)] + (in (row.suffix x xs))) + (\ ..monad in row.empty))) (template [<name> <type> <ctor>] [(def: .public (<name> size value_gen) diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 122dde3ca..433d76d91 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -34,11 +34,11 @@ (def: (each f fa) (function (_ lux) (case (fa lux) - (#try.Failure msg) - (#try.Failure msg) + {#try.Failure msg} + {#try.Failure msg} - (#try.Success [lux' a]) - (#try.Success [lux' (f a)]))))) + {#try.Success [lux' a]} + {#try.Success [lux' (f a)]})))) (implementation: .public apply (Apply Meta) @@ -48,16 +48,16 @@ (def: (on fa ff) (function (_ lux) (case (ff lux) - (#try.Success [lux' f]) + {#try.Success [lux' f]} (case (fa lux') - (#try.Success [lux'' a]) - (#try.Success [lux'' (f a)]) + {#try.Success [lux'' a]} + {#try.Success [lux'' (f a)]} - (#try.Failure msg) - (#try.Failure msg)) + {#try.Failure msg} + {#try.Failure msg}) - (#try.Failure msg) - (#try.Failure msg))))) + {#try.Failure msg} + {#try.Failure msg})))) (implementation: .public monad (Monad Meta) @@ -66,15 +66,15 @@ (def: (in x) (function (_ lux) - (#try.Success [lux x]))) + {#try.Success [lux x]})) (def: (conjoint mma) (function (_ lux) (case (mma lux) - (#try.Failure msg) - (#try.Failure msg) + {#try.Failure msg} + {#try.Failure msg} - (#try.Success [lux' ma]) + {#try.Success [lux' ma]} (ma lux'))))) (def: .public (result' lux action) @@ -84,54 +84,54 @@ (def: .public (result lux action) (All (_ a) (-> Lux (Meta a) (Try a))) (case (action lux) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [_ output]) - (#try.Success output))) + {#try.Success [_ output]} + {#try.Success output})) (def: .public (either left right) (All (_ a) (-> (Meta a) (Meta a) (Meta a))) (function (_ lux) (case (left lux) - (#try.Failure error) + {#try.Failure error} (right lux) - (#try.Success [lux' output]) - (#try.Success [lux' output])))) + {#try.Success [lux' output]} + {#try.Success [lux' output]}))) (def: .public (assertion message test) (-> Text Bit (Meta Any)) (function (_ lux) (if test - (#try.Success [lux []]) - (#try.Failure message)))) + {#try.Success [lux []]} + {#try.Failure message}))) (def: .public (failure error) (All (_ a) (-> Text (Meta a))) (function (_ state) - (#try.Failure (location.with (value@ #.location state) error)))) + {#try.Failure (location.with (value@ #.location state) error)})) (def: .public (module name) (-> Text (Meta Module)) (function (_ lux) (case (plist.value name (value@ #.modules lux)) - (#.Some module) - (#try.Success [lux module]) + {#.Some module} + {#try.Success [lux module]} _ - (#try.Failure ($_ text\composite "Unknown module: " name))))) + {#try.Failure ($_ text\composite "Unknown module: " name)}))) (def: .public current_module_name (Meta Text) (function (_ lux) (case (value@ #.current_module lux) - (#.Some current_module) - (#try.Success [lux current_module]) + {#.Some current_module} + {#try.Success [lux current_module]} _ - (#try.Failure "No current module.")))) + {#try.Failure "No current module."}))) (def: .public current_module (Meta Module) @@ -143,7 +143,7 @@ (def: (macro_type? type) (-> Type Bit) (`` (case type - (#.Named [(~~ (static .prelude_module)) "Macro"] (#.Primitive "#Macro" #.End)) + {#.Named [(~~ (static .prelude_module)) "Macro"] {#.Primitive "#Macro" #.End}} true _ @@ -166,12 +166,12 @@ [[module name] (..normal full_name)] (: (Meta (Maybe Macro)) (function (_ lux) - (#try.Success [lux + {#try.Success [lux (case (..current_module_name lux) - (#try.Failure error) + {#try.Failure error} #.None - (#try.Success [_ this_module]) + {#try.Success [_ this_module]} (let [modules (value@ #.modules lux)] (loop [module module name name] @@ -183,45 +183,45 @@ (value@ #.definitions) (plist.value name)))] (case definition - (#.Alias [r_module r_name]) + {#.Alias [r_module r_name]} (recur r_module r_name) - (#.Definition [exported? def_type def_value]) + {#.Definition [exported? def_type def_value]} (if (macro_type? def_type) - (#.Some (:as Macro def_value)) + {#.Some (:as Macro def_value)} #.None) - (#.Type [exported? type labels]) + {#.Type [exported? type labels]} #.None - (#.Label _) + {#.Label _} #.None - (#.Slot _) - #.None)))))]))))) + {#.Slot _} + #.None)))))]})))) (def: .public seed (Meta Nat) (function (_ lux) - (#try.Success [(revised@ #.seed ++ lux) - (value@ #.seed lux)]))) + {#try.Success [(revised@ #.seed ++ lux) + (value@ #.seed lux)]})) (def: .public (module_exists? module) (-> Text (Meta Bit)) (function (_ lux) - (#try.Success [lux (case (plist.value module (value@ #.modules lux)) - (#.Some _) + {#try.Success [lux (case (plist.value module (value@ #.modules lux)) + {#.Some _} #1 #.None - #0)]))) + #0)]})) (def: (on_either f x1 x2) (All (_ a b) (-> (-> a (Maybe b)) a a (Maybe b))) (case (f x1) #.None (f x2) - (#.Some y) (#.Some y))) + {#.Some y} {#.Some y})) (def: (type_variable idx bindings) (-> Nat (List [Nat (Maybe Type)]) (Maybe Type)) @@ -229,7 +229,7 @@ #.End #.None - (#.Item [var bound] bindings') + {#.Item [var bound] bindings'} (if (n.= idx var) bound (type_variable idx bindings')))) @@ -237,16 +237,16 @@ (def: (clean_type type) (-> Type (Meta Type)) (case type - (#.Var var) + {#.Var var} (function (_ lux) (case (|> lux (value@ [#.type_context #.var_bindings]) (type_variable var)) - (^or #.None (#.Some (#.Var _))) - (#try.Success [lux type]) + (^or #.None {#.Some {#.Var _}}) + {#try.Success [lux type]} - (#.Some type') - (#try.Success [lux type']))) + {#.Some type'} + {#try.Success [lux type']})) _ (\ ..monad in type))) @@ -269,11 +269,11 @@ (: (List [Text [Type Any]]) (value@ [#.captured #.mappings] scope)))] (in type)) - (#.Some var_type) + {#.Some var_type} ((clean_type var_type) lux) #.None - (#try.Failure ($_ text\composite "Unknown variable: " name)))))) + {#try.Failure ($_ text\composite "Unknown variable: " name)})))) (def: without_lux_runtime (-> (List Text) (List Text)) @@ -303,8 +303,8 @@ (value@ #.modules) (plist.value normal_module))] (plist.value normal_short definitions))) - (#.Some definition) - (#try.Success [lux definition]) + {#.Some definition} + {#try.Success [lux definition]} _ (let [current_module (|> lux (value@ #.current_module) (maybe.else "???")) @@ -312,11 +312,11 @@ (value@ #.modules) (list\each product.left) ..module_listing)] - (#try.Failure ($_ text\composite + {#try.Failure ($_ text\composite "Unknown definition: " (name\encoded name) text.new_line " Current module: " current_module text.new_line (case (plist.value current_module (value@ #.modules lux)) - (#.Some this_module) + {#.Some this_module} (let [candidates (|> lux (value@ #.modules) (list\each (function (_ [module_name module]) @@ -324,20 +324,20 @@ (value@ #.definitions) (list.all (function (_ [def_name global]) (case global - (^or (#.Definition [exported? _]) - (#.Type [exported? _])) + (^or {#.Definition [exported? _]} + {#.Type [exported? _]}) (if (and exported? (text\= normal_short def_name)) - (#.Some (name\encoded [module_name def_name])) + {#.Some (name\encoded [module_name def_name])} #.None) - (#.Alias _) + {#.Alias _} #.None - (#.Label _) + {#.Label _} #.None - (#.Slot _) + {#.Slot _} #.None)))))) list.together (list.sorted text\<) @@ -357,35 +357,35 @@ _ "") - " All known modules: " all_known_modules text.new_line))))))) + " All known modules: " all_known_modules text.new_line)}))))) (def: .public (export name) (-> Name (Meta Definition)) (do ..monad [definition (..definition name)] (case definition - (#.Definition definition) + {#.Definition definition} (let [[exported? def_type def_value] definition] (if exported? (in definition) (failure ($_ text\composite "Definition is not an export: " (name\encoded name))))) - (#.Type [exported? type labels]) + {#.Type [exported? type labels]} (if exported? (in [exported? .Type type]) (failure ($_ text\composite "Type is not an export: " (name\encoded name)))) - (#.Alias de_aliased) + {#.Alias de_aliased} (failure ($_ text\composite "Aliases are not considered exports: " (name\encoded name))) - (#.Label _) + {#.Label _} (failure ($_ text\composite "Tags are not considered exports: " (name\encoded name))) - (#.Slot _) + {#.Slot _} (failure ($_ text\composite "Slots are not considered exports: " (name\encoded name)))))) @@ -395,21 +395,21 @@ (do ..monad [definition (definition name)] (case definition - (#.Alias de_aliased) + {#.Alias de_aliased} (definition_type de_aliased) - (#.Definition [exported? def_type def_value]) + {#.Definition [exported? def_type def_value]} (clean_type def_type) - (#.Type [exported? type labels]) + {#.Type [exported? type labels]} (in .Type) - (#.Label _) + {#.Label _} (failure ($_ text\composite "Tags have no type: " (name\encoded name))) - (#.Slot _) + {#.Slot _} (failure ($_ text\composite "Slots have no type: " (name\encoded name)))))) @@ -429,10 +429,10 @@ (do ..monad [definition (definition name)] (case definition - (#.Alias de_aliased) + {#.Alias de_aliased} (type_definition de_aliased) - (#.Definition [exported? def_type def_value]) + {#.Definition [exported? def_type def_value]} (let [type_code (`` ("lux in-module" (~~ (static .prelude_module)) .type_code))] (if (or (same? .Type def_type) (\ code.equivalence = @@ -441,13 +441,13 @@ (in (:as Type def_value)) (..failure ($_ text\composite "Definition is not a type: " (name\encoded name))))) - (#.Type [exported? type labels]) + {#.Type [exported? type labels]} (in type) - (#.Label _) + {#.Label _} (..failure ($_ text\composite "Tag is not a type: " (name\encoded name))) - (#.Slot _) + {#.Slot _} (..failure ($_ text\composite "Slot is not a type: " (name\encoded name)))))) (def: .public (globals module) @@ -455,29 +455,29 @@ (function (_ lux) (case (plist.value module (value@ #.modules lux)) #.None - (#try.Failure ($_ text\composite "Unknown module: " module)) + {#try.Failure ($_ text\composite "Unknown module: " module)} - (#.Some module) - (#try.Success [lux (value@ #.definitions module)])))) + {#.Some module} + {#try.Success [lux (value@ #.definitions module)]}))) (def: .public (definitions module) (-> Text (Meta (List [Text Definition]))) (\ ..monad each (list.all (function (_ [name global]) (case global - (#.Alias de_aliased) + {#.Alias de_aliased} #.None - (#.Definition definition) - (#.Some [name definition]) + {#.Definition definition} + {#.Some [name definition]} - (#.Type [exported? type labels]) - (#.Some [name [exported? .Type type]]) + {#.Type [exported? type labels]} + {#.Some [name [exported? .Type type]]} - (#.Label _) + {#.Label _} #.None - (#.Slot _) + {#.Slot _} #.None))) (..globals module))) @@ -505,12 +505,12 @@ [.let [[module_name name] type_name] module (..module module_name)] (case (plist.value name (value@ #.definitions module)) - (#.Some (#.Type [exported? type labels])) + {#.Some {#.Type [exported? type labels]}} (case labels - (^or (#.Left labels) - (#.Right labels)) - (in (#.Some (list\each (|>> [module_name]) - (#.Item labels))))) + (^or {#.Left labels} + {#.Right labels}) + (in {#.Some (list\each (|>> [module_name]) + {#.Item labels})})) _ (in #.None)))) @@ -518,17 +518,17 @@ (def: .public location (Meta Location) (function (_ lux) - (#try.Success [lux (value@ #.location lux)]))) + {#try.Success [lux (value@ #.location lux)]})) (def: .public expected_type (Meta Type) (function (_ lux) (case (value@ #.expected lux) - (#.Some type) - (#try.Success [lux type]) + {#.Some type} + {#try.Success [lux type]} #.None - (#try.Failure "Not expecting any type.")))) + {#try.Failure "Not expecting any type."}))) (def: .public (imported_modules module_name) (-> Text (Meta (List Text))) @@ -556,7 +556,7 @@ =module (..module module) this_module_name ..current_module_name] (case (plist.value (text\composite "#" name) (value@ #.definitions =module)) - (#.Some (<tag> [exported? type group idx])) + {#.Some {<tag> [exported? type group idx]}} (if (or (text\= this_module_name module) exported?) (in [idx (list\each (|>> [module]) group) type]) @@ -577,17 +577,17 @@ this_module_name ..current_module_name] (in (list.all (function (_ [short global]) (case global - (#.Type [exported? type labels]) + {#.Type [exported? type labels]} (if (or exported? (text\= this_module_name module)) - (#.Some [(list\each (|>> [module]) + {#.Some [(list\each (|>> [module]) (case labels - (#.Left tags) - (#.Item tags) + {#.Left tags} + {#.Item tags} - (#.Right slots) - (#.Item slots))) - type]) + {#.Right slots} + {#.Item slots})) + type]} #.None) _ @@ -599,52 +599,52 @@ (function (_ lux) (case (list.inits (value@ #.scopes lux)) #.None - (#try.Failure "No local environment") + {#try.Failure "No local environment"} - (#.Some scopes) - (#try.Success [lux + {#.Some scopes} + {#try.Success [lux (list\each (|>> (value@ [#.locals #.mappings]) (list\each (function (_ [name [type _]]) [name type]))) - scopes)])))) + scopes)]}))) (def: .public (de_aliased def_name) (-> Name (Meta Name)) (do ..monad [constant (..definition def_name)] (in (case constant - (#.Alias real_def_name) + {#.Alias real_def_name} real_def_name - (#.Definition _) + {#.Definition _} def_name - (#.Type _) + {#.Type _} def_name - (#.Label _) + {#.Label _} def_name - (#.Slot _) + {#.Slot _} def_name)))) (def: .public compiler_state (Meta Lux) (function (_ lux) - (#try.Success [lux lux]))) + {#try.Success [lux lux]})) (def: .public type_context (Meta Type_Context) (function (_ lux) - (#try.Success [lux (value@ #.type_context lux)]))) + {#try.Success [lux (value@ #.type_context lux)]})) (def: .public (lifted result) (All (_ a) (-> (Try a) (Meta a))) (case result - (#try.Success output) + {#try.Success output} (\ ..monad in output) - (#try.Failure error) + {#try.Failure error} (..failure error))) (def: .public (eval type code) @@ -658,8 +658,8 @@ (All (_ it) (-> (Meta it) (Meta (Try it)))) (function (_ lux) (case (computation lux) - (#try.Success [lux' output]) - (#try.Success [lux' (#try.Success output)]) + {#try.Success [lux' output]} + {#try.Success [lux' {#try.Success output}]} - (#try.Failure error) - (#try.Success [lux (#try.Failure error)])))) + {#try.Failure error} + {#try.Success [lux {#try.Failure error}]}))) diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux index 7f37b4d77..3c797eda0 100644 --- a/stdlib/source/library/lux/meta/location.lux +++ b/stdlib/source/library/lux/meta/location.lux @@ -22,14 +22,14 @@ (case tokens #.End (let [location (value@ #.location compiler)] - (#.Right [compiler + {#.Right [compiler (list (` (.: .Location - [(~ [..dummy (#.Text (value@ #.module location))]) - (~ [..dummy (#.Nat (value@ #.line location))]) - (~ [..dummy (#.Nat (value@ #.column location))])])))])) + [(~ [..dummy {#.Text (value@ #.module location)}]) + (~ [..dummy {#.Nat (value@ #.line location)}]) + (~ [..dummy {#.Nat (value@ #.column location)}])])))]}) _ - (#.Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (name_of ..here)))))) + {#.Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (name_of ..here)))})) (def: .public (format it) (-> Location Text) diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index 7b81afa69..844da6654 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -21,8 +21,8 @@ (type: Arguments (Variant - (#Raw Text) - (#Parsed (List Code)))) + {#Raw Text} + {#Parsed (List Code)})) (def: arguments^ (<code>.Parser Arguments) @@ -43,11 +43,11 @@ ((~' in) (~ g!output))))] (in (list (` ("lux def program" (~ (case args - (#Raw args) + {#Raw args} (` (.function ((~ g!program) (~ (code.identifier ["" args]))) (~ initialization+event_loop))) - (#Parsed args) + {#Parsed args} (` (.function ((~ g!program) (~ g!args)) (case ((~! <cli>.result) (: (~! (<cli>.Parser (io.IO .Any))) ((~! do) (~! <>.monad) @@ -55,8 +55,8 @@ (~ g!_) (~! <cli>.end)] ((~' in) (~ initialization+event_loop)))) (~ g!args)) - (#.Right (~ g!output)) + {#.Right (~ g!output)} (~ g!output) - (#.Left (~ g!message)) + {#.Left (~ g!message)} (.panic! (~ g!message)))))))))))))) diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux index a208ba0ff..1a14f8d6e 100644 --- a/stdlib/source/library/lux/target/common_lisp.lux +++ b/stdlib/source/library/lux/target/common_lisp.lux @@ -156,7 +156,7 @@ #.End "" - (#.Item _) + {#.Item _} (|> singles (list\each ..code) (text.interposed " ") @@ -174,7 +174,7 @@ (def: .public (call/* func) (-> (Expression Any) (-> (List (Expression Any)) (Computation Any))) - (|>> (#.Item func) ..form)) + (|>> {#.Item func} ..form)) (template [<name> <function>] [(def: .public <name> @@ -406,7 +406,7 @@ #.End expression - (#.Item single #.End) + {#.Item single #.End} (:abstraction (format <prefix> single " " (:representation expression))) diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux index c648d5bf2..662f0c3a4 100644 --- a/stdlib/source/library/lux/target/js.lux +++ b/stdlib/source/library/lux/target/js.lux @@ -406,7 +406,7 @@ (text.interposed text.new_line)) text.new_line (case default - (#.Some default) + {#.Some default} (format "default:" (..nested (:representation default))) diff --git a/stdlib/source/library/lux/target/jvm.lux b/stdlib/source/library/lux/target/jvm.lux index e32769bbc..0d07ab2aa 100644 --- a/stdlib/source/library/lux/target/jvm.lux +++ b/stdlib/source/library/lux/target/jvm.lux @@ -11,18 +11,18 @@ (type: .public Literal (Variant - (#Boolean Bit) - (#Int Int) - (#Long Int) - (#Double Frac) - (#Char Nat) - (#String Text))) + {#Boolean Bit} + {#Int Int} + {#Long Int} + {#Double Frac} + {#Char Nat} + {#String Text})) (type: .public Constant (Variant - (#BIPUSH Int) + {#BIPUSH Int} - (#SIPUSH Int) + {#SIPUSH Int} #ICONST_M1 #ICONST_0 @@ -44,7 +44,7 @@ #ACONST_NULL - (#LDC Literal))) + {#LDC Literal})) (type: .public Int_Arithmetic (Variant @@ -84,10 +84,10 @@ (type: .public Arithmetic (Variant - (#Int_Arithmetic Int_Arithmetic) - (#Long_Arithmetic Long_Arithmetic) - (#Float_Arithmetic Float_Arithmetic) - (#Double_Arithmetic Double_Arithmetic))) + {#Int_Arithmetic Int_Arithmetic} + {#Long_Arithmetic Long_Arithmetic} + {#Float_Arithmetic Float_Arithmetic} + {#Double_Arithmetic Double_Arithmetic})) (type: .public Int_Bitwise (Variant @@ -109,8 +109,8 @@ (type: .public Bitwise (Variant - (#Int_Bitwise Int_Bitwise) - (#Long_Bitwise Long_Bitwise))) + {#Int_Bitwise Int_Bitwise} + {#Long_Bitwise Long_Bitwise})) (type: .public Conversion (Variant @@ -137,8 +137,8 @@ (Variant #ARRAYLENGTH - (#NEWARRAY (Type Primitive)) - (#ANEWARRAY (Type category.Object)) + {#NEWARRAY (Type Primitive)} + {#ANEWARRAY (Type category.Object)} #BALOAD #BASTORE @@ -166,58 +166,58 @@ (type: .public Object (Variant - (#GETSTATIC (Type Class) Text (Type Value)) - (#PUTSTATIC (Type Class) Text (Type Value)) + {#GETSTATIC (Type Class) Text (Type Value)} + {#PUTSTATIC (Type Class) Text (Type Value)} - (#NEW (Type Class)) + {#NEW (Type Class)} - (#INSTANCEOF (Type Class)) - (#CHECKCAST (Type category.Object)) + {#INSTANCEOF (Type Class)} + {#CHECKCAST (Type category.Object)} - (#GETFIELD (Type Class) Text (Type Value)) - (#PUTFIELD (Type Class) Text (Type Value)) + {#GETFIELD (Type Class) Text (Type Value)} + {#PUTFIELD (Type Class) Text (Type Value)} - (#INVOKEINTERFACE (Type Class) Text (Type Method)) - (#INVOKESPECIAL (Type Class) Text (Type Method)) - (#INVOKESTATIC (Type Class) Text (Type Method)) - (#INVOKEVIRTUAL (Type Class) Text (Type Method)))) + {#INVOKEINTERFACE (Type Class) Text (Type Method)} + {#INVOKESPECIAL (Type Class) Text (Type Method)} + {#INVOKESTATIC (Type Class) Text (Type Method)} + {#INVOKEVIRTUAL (Type Class) Text (Type Method)})) (type: .public Register Nat) (type: .public Local_Int (Variant - (#ILOAD Register) - (#ISTORE Register))) + {#ILOAD Register} + {#ISTORE Register})) (type: .public Local_Long (Variant - (#LLOAD Register) - (#LSTORE Register))) + {#LLOAD Register} + {#LSTORE Register})) (type: .public Local_Float (Variant - (#FLOAD Register) - (#FSTORE Register))) + {#FLOAD Register} + {#FSTORE Register})) (type: .public Local_Double (Variant - (#DLOAD Register) - (#DSTORE Register))) + {#DLOAD Register} + {#DSTORE Register})) (type: .public Local_Object (Variant - (#ALOAD Register) - (#ASTORE Register))) + {#ALOAD Register} + {#ASTORE Register})) (type: .public Local (Variant - (#Local_Int Local_Int) - (#IINC Register) - (#Local_Long Local_Long) - (#Local_Float Local_Float) - (#Local_Double Local_Double) - (#Local_Object Local_Object))) + {#Local_Int Local_Int} + {#IINC Register} + {#Local_Long Local_Long} + {#Local_Float Local_Float} + {#Local_Double Local_Double} + {#Local_Object Local_Object})) (type: .public Stack (Variant @@ -246,30 +246,30 @@ (type: .public (Branching label) (Variant - (#IF_ICMPEQ label) - (#IF_ICMPGE label) - (#IF_ICMPGT label) - (#IF_ICMPLE label) - (#IF_ICMPLT label) - (#IF_ICMPNE label) - (#IFEQ label) - (#IFNE label) - (#IFGE label) - (#IFGT label) - (#IFLE label) - (#IFLT label) - - (#TABLESWITCH Int Int label (List label)) - (#LOOKUPSWITCH label (List [Int label])) - - (#IF_ACMPEQ label) - (#IF_ACMPNE label) - (#IFNONNULL label) - (#IFNULL label))) + {#IF_ICMPEQ label} + {#IF_ICMPGE label} + {#IF_ICMPGT label} + {#IF_ICMPLE label} + {#IF_ICMPLT label} + {#IF_ICMPNE label} + {#IFEQ label} + {#IFNE label} + {#IFGE label} + {#IFGT label} + {#IFLE label} + {#IFLT label} + + {#TABLESWITCH Int Int label (List label)} + {#LOOKUPSWITCH label (List [Int label])} + + {#IF_ACMPEQ label} + {#IF_ACMPNE label} + {#IFNONNULL label} + {#IFNULL label})) (type: .public (Exception label) (Variant - (#Try label label label (Type Class)) + {#Try label label label (Type Class)} #ATHROW)) (type: .public Concurrency @@ -288,26 +288,26 @@ (type: .public (Control label) (Variant - (#GOTO label) - (#Branching (Branching label)) - (#Exception (Exception label)) - (#Concurrency Concurrency) - (#Return Return))) + {#GOTO label} + {#Branching (Branching label)} + {#Exception (Exception label)} + {#Concurrency Concurrency} + {#Return Return})) (type: .public (Instruction embedded label) (Variant #NOP - (#Constant Constant) - (#Arithmetic Arithmetic) - (#Bitwise Bitwise) - (#Conversion Conversion) - (#Array Array) - (#Object Object) - (#Local Local) - (#Stack Stack) - (#Comparison Comparison) - (#Control (Control label)) - (#Embedded embedded))) + {#Constant Constant} + {#Arithmetic Arithmetic} + {#Bitwise Bitwise} + {#Conversion Conversion} + {#Array Array} + {#Object Object} + {#Local Local} + {#Stack Stack} + {#Comparison Comparison} + {#Control (Control label)} + {#Embedded embedded})) (type: .public (Bytecode embedded label) (Row (Instruction embedded label))) diff --git a/stdlib/source/library/lux/target/jvm/attribute.lux b/stdlib/source/library/lux/target/jvm/attribute.lux index 78ce1854d..ed10a42c6 100644 --- a/stdlib/source/library/lux/target/jvm/attribute.lux +++ b/stdlib/source/library/lux/target/jvm/attribute.lux @@ -55,8 +55,8 @@ (type: .public Attribute (Rec Attribute (Variant - (#Constant (Info (Constant Any))) - (#Code (Info <Code>))))) + {#Constant (Info (Constant Any))} + {#Code (Info <Code>)}))) (type: .public Code <Code>) @@ -82,16 +82,16 @@ (-> Attribute Nat) (case attribute (^template [<tag>] - [(<tag> [name length info]) + [{<tag> [name length info]} (|> length //unsigned.value (n.+ ..common_attribute_length))]) ([#Constant] [#Code]))) ... TODO: Inline ASAP (def: (constant' @name index) (-> (Index UTF8) (Constant Any) Attribute) - (#Constant [#name @name + {#Constant [#name @name #length (|> /constant.length //unsigned.u4 try.trusted) - #info index])) + #info index]}) (def: .public (constant index) (-> (Constant Any) (Resource Attribute)) @@ -102,13 +102,13 @@ ... TODO: Inline ASAP (def: (code' @name specification) (-> (Index UTF8) Code Attribute) - (#Code [#name @name + {#Code [#name @name ... https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.3 #length (|> specification (/code.length ..length) //unsigned.u4 try.trusted) - #info specification])) + #info specification]}) (def: .public (code specification) (-> Code (Resource Attribute)) @@ -119,8 +119,8 @@ (def: .public (writer value) (Writer Attribute) (case value - (#Constant attribute) + {#Constant attribute} ((info_writer /constant.writer) attribute) - (#Code attribute) + {#Code attribute} ((info_writer (/code.writer writer)) attribute))) diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux index 85fa58c78..d999f5320 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode.lux @@ -78,7 +78,7 @@ (def: relative_identity Relative - (function.constant (#try.Success [..no_exceptions _.empty]))) + (function.constant {#try.Success [..no_exceptions _.empty]})) (implementation: relative_monoid (Monoid Relative) @@ -106,11 +106,11 @@ (def: .public new_label (Bytecode Label) (function (_ [pool environment tracker]) - (#try.Success [[pool + {#try.Success [[pool environment (revised@ #next ++ tracker)] [..relative_identity - (value@ #next tracker)]]))) + (value@ #next tracker)]]})) (exception: .public (label_has_already_been_set [label Label]) (exception.report @@ -131,7 +131,7 @@ (with_expansions [<success> (as_is (in [[pool environment (revised@ #known - (dictionary.has label [actual (#.Some @here)]) + (dictionary.has label [actual {#.Some @here}]) tracker)] [..relative_identity []]]))] @@ -140,10 +140,10 @@ (function (_ [pool environment tracker]) (let [@here (value@ #program_counter tracker)] (case (dictionary.value label (value@ #known tracker)) - (#.Some [expected (#.Some address)]) + {#.Some [expected {#.Some address}]} (exception.except ..label_has_already_been_set [label]) - (#.Some [expected #.None]) + {#.Some [expected #.None]} (do try.monad [[actual environment] (/environment.continue expected environment)] <success>) @@ -455,10 +455,10 @@ (do ..monad [index (..lifted (//constant/pool.string value))] (case (|> index //index.value //unsigned.value //unsigned.u1) - (#try.Success index) + {#try.Success index} (..bytecode $0 $1 @_ _.ldc [index]) - (#try.Failure _) + {#try.Failure _} (..bytecode $0 $1 @_ _.ldc_w/string [index])))) (import: java/lang/Float @@ -480,10 +480,10 @@ _ (do ..monad [index (..lifted (<constant> (<constructor> value)))] (case (|> index //index.value //unsigned.value //unsigned.u1) - (#try.Success index) + {#try.Success index} (..bytecode $0 $1 @_ _.ldc [index]) - (#try.Failure _) + {#try.Failure _} (..bytecode $0 $1 @_ <wide> [index])))))] [int I32 //constant.integer //constant/pool.integer _.ldc_w/integer @@ -502,10 +502,10 @@ (do ..monad [index (..lifted (//constant/pool.float (//constant.float value)))] (case (|> index //index.value //unsigned.value //unsigned.u1) - (#try.Success index) + {#try.Success index} (..bytecode $0 $1 @_ _.ldc [index]) - (#try.Failure _) + {#try.Failure _} (..bytecode $0 $1 @_ _.ldc_w/float [index])))) (def: float_bits @@ -583,10 +583,10 @@ (def: (register id) (-> Nat (Bytecode Register)) (case (//unsigned.u1 id) - (#try.Success register) + {#try.Success register} (\ ..monad in register) - (#try.Failure error) + {#try.Failure error} (..except ..invalid_register [id]))) (template [<for> <size> <name> <general> <specials>] @@ -715,10 +715,10 @@ (def: (resolve_label label resolver) (-> Label Resolver (Try [Stack Address])) (case (dictionary.value label resolver) - (#.Some [actual (#.Some address)]) - (#try.Success [actual address]) + {#.Some [actual {#.Some address}]} + {#try.Success [actual address]} - (#.Some [actual #.None]) + {#.Some [actual #.None]} (exception.except ..unset_label [label]) #.None @@ -727,7 +727,7 @@ (def: (acknowledge_label stack label tracker) (-> Stack Label Tracker Tracker) (case (dictionary.value label (value@ #known tracker)) - (#.Some _) + {#.Some _} tracker #.None @@ -757,10 +757,10 @@ (\ /stack.equivalence = expected actual)) jump (..jump @from @to)] (case jump - (#.Left jump) + {#.Left jump} (exception.except ..cannot_do_a_big_jump [label @from jump]) - (#.Right jump) + {#.Right jump} (in [..no_exceptions (bytecode jump)])))) []]])))))))] @@ -802,19 +802,19 @@ (with@ #program_counter program_counter'))] [(function (_ resolver) (case (dictionary.value label resolver) - (#.Some [expected (#.Some @to)]) + {#.Some [expected {#.Some @to}]} (do try.monad [_ (exception.assertion ..mismatched_environments [(name_of <instruction>) label @here expected actual] (\ /stack.equivalence = expected actual)) jump (..jump @from @to)] (case jump - (#.Left jump) + {#.Left jump} <on_long_jump> - (#.Right jump) + {#.Right jump} <on_short_jump>)) - (#.Some [expected #.None]) + {#.Some [expected #.None]} (exception.except ..unset_label [label]) #.None @@ -832,10 +832,10 @@ (def: (big_jump jump) (-> Any_Jump Big_Jump) (case jump - (#.Left big) + {#.Left big} big - (#.Right small) + {#.Right small} (/jump.lifted small))) (exception: .public invalid_tableswitch) @@ -865,7 +865,7 @@ (monad.each ! get) (monad.then ! (monad.each ! product.right)))] (in [@default @at_minimum @afterwards])) - (#.Some [@default @at_minimum @afterwards]) + {#.Some [@default @at_minimum @afterwards]} (do [! try.monad] [>default (\ ! each ..big_jump (..jump @from @default)) >at_minimum (\ ! each ..big_jump (..jump @from @at_minimum)) @@ -907,7 +907,7 @@ (monad.each ! (|>> product.right get)) (monad.then ! (monad.each ! product.right)))] (in [@default @cases])) - (#.Some [@default @cases]) + {#.Some [@default @cases]} (do [! try.monad] [>default (\ ! each ..big_jump (..jump @from @default)) >cases (|> @cases @@ -1025,7 +1025,7 @@ (do ..monad [@catch (..lifted (//constant/pool.class (//name.internal (..reflection catch))))] (function (_ [pool environment tracker]) - (#try.Success + {#try.Success [[pool environment (..acknowledge_label /stack.catch @handler tracker)] @@ -1042,7 +1042,7 @@ #//exception.handler @handler #//exception.catch @catch]) _.empty]))) - []]])))) + []]]}))) (def: .public (composite pre post) (All (_ pre post) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux index 9ba2ca0d4..c7b6481fb 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/environment.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/environment.lux @@ -28,7 +28,7 @@ (do try.monad [limit (<limit> type)] (in [#limit limit - #stack (#.Some /stack.empty)])))] + #stack {#.Some /stack.empty}])))] [static /limit.static] [virtual /limit.virtual] @@ -53,8 +53,8 @@ (def: .public (stack environment) (-> Environment (Try Stack)) (case (value@ #..stack environment) - (#.Some stack) - (#try.Success stack) + {#.Some stack} + {#try.Success stack} #.None (exception.except ..discontinuity []))) @@ -72,13 +72,13 @@ (def: .public (continue expected environment) (-> Stack Environment (Try [Stack Environment])) (case (value@ #..stack environment) - (#.Some actual) + {#.Some actual} (if (\ /stack.equivalence = expected actual) - (#try.Success [actual environment]) + {#try.Success [actual environment]} (exception.except ..mismatched_stacks [expected actual])) #.None - (#try.Success [expected (with@ #..stack (#.Some expected) environment)]))) + {#try.Success [expected (with@ #..stack {#.Some expected} environment)]})) (def: .public (consumes amount) (-> U2 Condition) @@ -88,7 +88,7 @@ (do try.monad [previous (..stack environment) current (/stack.pop amount previous)] - (in (with@ #..stack (#.Some current) environment))))) + (in (with@ #..stack {#.Some current} environment))))) (def: .public (produces amount) (-> U2 Condition) @@ -100,7 +100,7 @@ (value@ [#..limit #/limit.stack]) (/stack.max current))]] (in (|> environment - (with@ #..stack (#.Some current)) + (with@ #..stack {#.Some current}) (with@ [#..limit #/limit.stack] limit)))))) (def: .public (has registry) diff --git a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux index 9fe36c303..646278f35 100644 --- a/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux +++ b/stdlib/source/library/lux/target/jvm/bytecode/instruction.lux @@ -634,12 +634,12 @@ _ (binary.write/32! offset (///signed.value maximum) binary)] (loop [offset (n.+ (///unsigned.value ..integer_size) offset) afterwards (: (List Big_Jump) - (#.Item at_minimum afterwards))] + {#.Item at_minimum afterwards})] (case afterwards #.End (in binary) - (#.Item head tail) + {#.Item head tail} (do ! [_ (binary.write/32! offset (///signed.value head) binary)] (recur (n.+ (///unsigned.value ..big_jump_size) offset) @@ -698,7 +698,7 @@ #.End (in binary) - (#.Item [value jump] tail) + {#.Item [value jump] tail} (do ! [_ (binary.write/32! offset (///signed.value value) binary) _ (binary.write/32! (n.+ (///unsigned.value ..integer_size) offset) (///signed.value jump) binary)] diff --git a/stdlib/source/library/lux/target/jvm/constant.lux b/stdlib/source/library/lux/target/jvm/constant.lux index d1e9b2122..27efe496d 100644 --- a/stdlib/source/library/lux/target/jvm/constant.lux +++ b/stdlib/source/library/lux/target/jvm/constant.lux @@ -157,22 +157,22 @@ (type: .public Constant (Variant - (#UTF8 UTF8) - (#Integer Integer) - (#Float Float) - (#Long Long) - (#Double Double) - (#Class Class) - (#String String) - (#Field (Reference //category.Value)) - (#Method (Reference //category.Method)) - (#Interface_Method (Reference //category.Method)) - (#Name_And_Type (Name_And_Type Any)))) + {#UTF8 UTF8} + {#Integer Integer} + {#Float Float} + {#Long Long} + {#Double Double} + {#Class Class} + {#String String} + {#Field (Reference //category.Value)} + {#Method (Reference //category.Method)} + {#Interface_Method (Reference //category.Method)} + {#Name_And_Type (Name_And_Type Any)})) (def: .public (size constant) (-> Constant Nat) (case constant - (^or (#Long _) (#Double _)) + (^or {#Long _} {#Double _}) 2 _ @@ -186,7 +186,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag> <equivalence>] - [[(<tag> reference) (<tag> sample)] + [[{<tag> reference} {<tag> sample}] (\ <equivalence> = reference sample)]) ([#UTF8 text.equivalence] [#Integer (..value_equivalence i32.equivalence)] @@ -244,7 +244,7 @@ (function (_ value) (case value (^template [<case> <tag> <writer>] - [(<case> value) + [{<case> value} (binaryF\composite (/tag.writer <tag>) (<writer> value))]) (<constants>) diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux index 2ae78260d..41ff5ad26 100644 --- a/stdlib/source/library/lux/target/jvm/constant/pool.lux +++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux @@ -57,19 +57,19 @@ (with_expansions [<try_again> (as_is (recur (.++ idx)))] (loop [idx 0] (case (row.item idx pool) - (#try.Success entry) + {#try.Success entry} (case entry - [index (<tag> reference)] + [index {<tag> reference}] (if (\ <equivalence> = reference <value>') - (#try.Success [[current pool] - index]) + {#try.Success [[current pool] + index]} <try_again>) _ <try_again>) - (#try.Failure _) - (let [new (<tag> <value>')] + {#try.Failure _} + (let [new {<tag> <value>'}] (do [! try.monad] [@new (//unsigned.u2 (//.size new)) next (: (Try Index) diff --git a/stdlib/source/library/lux/target/jvm/encoding/signed.lux b/stdlib/source/library/lux/target/jvm/encoding/signed.lux index 3bafb4bfc..5d4f124a6 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/signed.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/signed.lux @@ -67,7 +67,7 @@ (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>] diff --git a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux index df550075b..097265bcf 100644 --- a/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux +++ b/stdlib/source/library/lux/target/jvm/encoding/unsigned.lux @@ -74,7 +74,7 @@ (-> Nat (Try <name>)) (if (n.> (:representation <maximum>) value) (exception.except ..value_exceeds_the_maximum [(name_of <name>) value <maximum>]) - (#try.Success (:abstraction value)))) + {#try.Success (:abstraction value)})) (def: .public (<+> parameter subject) (-> <name> <name> (Try <name>)) @@ -88,7 +88,7 @@ subject' (:representation subject)] (if (n.> subject' parameter') (exception.except ..subtraction_cannot_yield_negative_value [(name_of <name>) parameter subject]) - (#try.Success (:abstraction (n.- parameter' subject')))))) + {#try.Success (:abstraction (n.- parameter' subject'))}))) (def: .public (<max> left right) (-> <name> <name> <name>) diff --git a/stdlib/source/library/lux/target/jvm/loader.lux b/stdlib/source/library/lux/target/jvm/loader.lux index 1d5eda342..82999be00 100644 --- a/stdlib/source/library/lux/target/jvm/loader.lux +++ b/stdlib/source/library/lux/target/jvm/loader.lux @@ -116,12 +116,12 @@ (let [class_name (:as Text class_name) classes (|> library atom.read! io.run!)] (case (dictionary.value class_name classes) - (#.Some bytecode) + {#.Some bytecode} (case (..define class_name bytecode (<| <cast> self)) - (#try.Success class) + {#try.Success class} (:expected class) - (#try.Failure error) + {#try.Failure error} (panic! (exception.error ..cannot_define [class_name error]))) #.None @@ -135,7 +135,7 @@ (in (exception.except ..already_stored name)) (do ! [_ (atom.update! (dictionary.has name bytecode) library)] - (in (#try.Success [])))))) + (in {#try.Success []}))))) (def: .public (load name loader) (-> Text java/lang/ClassLoader diff --git a/stdlib/source/library/lux/target/jvm/method.lux b/stdlib/source/library/lux/target/jvm/method.lux index 11e8e1c06..a56b732c3 100644 --- a/stdlib/source/library/lux/target/jvm/method.lux +++ b/stdlib/source/library/lux/target/jvm/method.lux @@ -59,16 +59,16 @@ (monad.all !) (\ ! each row.of_list)) attributes (case code - (#.Some code) + {#.Some code} (do ! [environment (case (if (//modifier.has? static modifier) (//bytecode/environment.static type) (//bytecode/environment.virtual type)) - (#try.Success environment) + {#try.Success environment} (in environment) - (#try.Failure error) - (function (_ _) (#try.Failure error))) + {#try.Failure error} + (function (_ _) {#try.Failure error})) [environment exceptions instruction output] (//bytecode.resolve environment code) .let [bytecode (|> instruction //bytecode/instruction.result format.instance)] @code (//attribute.code [#//attribute/code.limit (value@ #//bytecode/environment.limit environment) diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux index 740d43c63..59a3d72d6 100644 --- a/stdlib/source/library/lux/target/jvm/reflection.lux +++ b/stdlib/source/library/lux/target/jvm/reflection.lux @@ -128,10 +128,10 @@ (def: .public (load class_loader name) (-> java/lang/ClassLoader External (Try (java/lang/Class java/lang/Object))) (case (java/lang/Class::forName name false class_loader) - (#try.Success class) - (#try.Success class) + {#try.Success class} + {#try.Success class} - (#try.Failure _) + {#try.Failure _} (exception.except ..unknown_class [name]))) (def: .public (sub? class_loader super sub) @@ -146,7 +146,7 @@ java/lang/reflect/Type (Try (/.Type Class))) (<| (case (ffi.check java/lang/Class reflection) - (#.Some class) + {#.Some class} (let [class_name (|> class (:as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] @@ -164,13 +164,13 @@ [/reflection.char])) (text.starts_with? /descriptor.array_prefix class_name)) (exception.except ..not_a_class reflection) - (#try.Success (/.class class_name (list)))))) + {#try.Success (/.class class_name (list))}))) _) (case (ffi.check java/lang/reflect/ParameterizedType reflection) - (#.Some reflection) + {#.Some reflection} (let [raw (java/lang/reflect/ParameterizedType::getRawType reflection)] (case (ffi.check java/lang/Class raw) - (#.Some raw) + {#.Some raw} (do [! try.monad] [paramsT (|> reflection java/lang/reflect/ParameterizedType::getActualTypeArguments @@ -190,11 +190,11 @@ (def: .public (parameter reflection) (-> java/lang/reflect/Type (Try (/.Type Parameter))) (<| (case (ffi.check java/lang/reflect/TypeVariable reflection) - (#.Some reflection) - (#try.Success (/.var (java/lang/reflect/TypeVariable::getName reflection))) + {#.Some reflection} + {#try.Success (/.var (java/lang/reflect/TypeVariable::getName reflection))} _) (case (ffi.check java/lang/reflect/WildcardType reflection) - (#.Some reflection) + {#.Some reflection} ... TODO: Instead of having single lower/upper bounds, should ... allow for multiple ones. (case [(array.read! 0 (java/lang/reflect/WildcardType::getLowerBounds reflection)) @@ -202,18 +202,18 @@ (^template [<pattern> <kind>] [<pattern> (case (ffi.check java/lang/reflect/GenericArrayType bound) - (#.Some _) + {#.Some _} ... TODO: Array bounds should not be "erased" as they ... are right now. - (#try.Success /.wildcard) + {#try.Success /.wildcard} _ (\ try.monad each <kind> (..class' parameter bound)))]) - ([[_ (#.Some bound)] /.upper] - [[(#.Some bound) _] /.lower]) + ([[_ {#.Some bound}] /.upper] + [[{#.Some bound} _] /.lower]) _ - (#try.Success /.wildcard)) + {#try.Success /.wildcard}) _) (..class' parameter reflection))) @@ -225,14 +225,14 @@ (def: .public (type reflection) (-> java/lang/reflect/Type (Try (/.Type Value))) (<| (case (ffi.check java/lang/Class reflection) - (#.Some reflection) + {#.Some reflection} (let [class_name (|> reflection (:as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] (`` (cond (~~ (template [<reflection> <type>] [(text\= (/reflection.reflection <reflection>) class_name) - (#try.Success <type>)] + {#try.Success <type>}] [/reflection.boolean /.boolean] [/reflection.byte /.byte] @@ -244,10 +244,10 @@ [/reflection.char /.char])) (if (text.starts_with? /descriptor.array_prefix class_name) (<t>.result /parser.value (|> class_name //name.internal //name.read)) - (#try.Success (/.class class_name (list))))))) + {#try.Success (/.class class_name (list))})))) _) (case (ffi.check java/lang/reflect/GenericArrayType reflection) - (#.Some reflection) + {#.Some reflection} (|> reflection java/lang/reflect/GenericArrayType::getGenericComponentType type @@ -260,13 +260,13 @@ (-> java/lang/reflect/Type (Try (/.Type Return))) (with_expansions [<else> (as_is (..type reflection))] (case (ffi.check java/lang/Class reflection) - (#.Some class) + {#.Some class} (let [class_name (|> reflection (:as (java/lang/Class java/lang/Object)) java/lang/Class::getName)] (if (text\= (/reflection.reflection /reflection.void) class_name) - (#try.Success /.void) + {#try.Success /.void} <else>)) #.None @@ -295,7 +295,7 @@ (def: .public (correspond class type) (-> (java/lang/Class java/lang/Object) Type (Try Mapping)) (case type - (#.Primitive name params) + {#.Primitive name params} (let [class_name (java/lang/Class::getName class) class_params (array.list #.None (java/lang/Class::getTypeParameters class)) num_class_params (list.size class_params) @@ -312,12 +312,12 @@ (exception.except ..type_parameter_mismatch [num_class_params num_type_params class type])) (exception.except ..cannot_correspond [class type]))) - (#.Named name anonymousT) + {#.Named name anonymousT} (correspond class anonymousT) - (#.Apply inputT abstractionT) + {#.Apply inputT abstractionT} (case (type.applied (list inputT) abstractionT) - (#.Some outputT) + {#.Some outputT} (correspond class outputT) #.None @@ -349,13 +349,13 @@ (def: .public (field field target) (-> Text (java/lang/Class java/lang/Object) (Try java/lang/reflect/Field)) (case (java/lang/Class::getDeclaredField field target) - (#try.Success field) + {#try.Success field} (let [owner (java/lang/reflect/Field::getDeclaringClass field)] (if (same? owner target) - (#try.Success field) + {#try.Success field} (exception.except ..mistaken_field_owner [field owner target]))) - (#try.Failure _) + {#try.Failure _} (exception.except ..unknown_field [field target]))) (def: .public deprecated? diff --git a/stdlib/source/library/lux/target/jvm/type/lux.lux b/stdlib/source/library/lux/target/jvm/type/lux.lux index 023d844e8..d144ac6fe 100644 --- a/stdlib/source/library/lux/target/jvm/type/lux.lux +++ b/stdlib/source/library/lux/target/jvm/type/lux.lux @@ -55,7 +55,7 @@ [(def: <name> (Parser (Check Type)) (<>.after <parser> - (<>\in (check\in (#.Primitive (//reflection.reflection <reflection>) #.End)))))] + (<>\in (check\in {#.Primitive (//reflection.reflection <reflection>) #.End}))))] [boolean //parser.boolean //reflection.boolean] [byte //parser.byte //reflection.byte] @@ -71,7 +71,7 @@ [(def: <name> (Parser (Check Type)) (<>.after <parser> - (<>\in (check\in (#.Primitive <box> #.End)))))] + (<>\in (check\in {#.Primitive <box> #.End}))))] [boxed_boolean //parser.boolean //box.boolean] [boxed_byte //parser.byte //box.byte] @@ -123,7 +123,7 @@ #.None (check.except ..unknown_var [var]) - (#.Some type) + {#.Some type} (check\in type))))) (def: (class' parameter) @@ -136,7 +136,7 @@ (<>.else (list)))] (in (do [! check.monad] [parameters (monad.all ! parameters)] - (in (#.Primitive name parameters))))) + (in {#.Primitive name parameters})))) (<>.after (<text>.this //descriptor.class_prefix)) (<>.before (<text>.this //descriptor.class_suffix)))) @@ -173,7 +173,7 @@ (-> (Parser (Check Type)) (Parser (Check Type))) (|>> (<>\each (check\each (function (_ elementT) (case elementT - (#.Primitive name #.End) + {#.Primitive name #.End} (if (`` (or (~~ (template [<reflection>] [(text\= (//reflection.reflection <reflection>) name)] @@ -185,7 +185,7 @@ [//reflection.float] [//reflection.double] [//reflection.char])))) - (#.Primitive (|> name //reflection.class //reflection.array //reflection.reflection) #.End) + {#.Primitive (|> name //reflection.class //reflection.array //reflection.reflection) #.End} (|> elementT array.Array .type)) _ @@ -229,8 +229,8 @@ (def: .public (check operation input) (All (_ a) (-> (Parser (Check a)) Text (Check a))) (case (<text>.result operation input) - (#try.Success check) + {#try.Success check} check - (#try.Failure error) + {#try.Failure error} (check.failure error))) diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index af0514a76..a649fbcf1 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -371,7 +371,7 @@ (format "while " (:representation test) ":" (..nested (:representation body!)) (case else! - (#.Some else!) + {#.Some else!} (format text.new_line "else:" (..nested (:representation else!))) @@ -424,7 +424,7 @@ (def: .public (exec code globals) (-> (Expression Any) (Maybe (Expression Any)) (Statement Any)) (let [extra (case globals - (#.Some globals) + {#.Some globals} (.list globals) #.None diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index acc560f31..85a3c92c3 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -373,7 +373,7 @@ #.None proc - (#.Some name) + {#.Some name} (format (:representation name) " = " proc)) (text.enclosed ["(" ")"]) :abstraction))) diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index 285d934ad..390a43867 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -76,7 +76,7 @@ (def: (arguments [mandatory rest]) (-> Arguments (Code Any)) (case rest - (#.Some rest) + {#.Some rest} (case mandatory #.End rest @@ -159,17 +159,17 @@ (|>> (case> #.End (:abstraction "()") - (#.Item head tail) + {#.Item head tail} (|> tail (list\each (|>> :representation ..nested)) - (#.Item (:representation head)) + {#.Item (:representation head)} (text.interposed nested_new_line) (text.enclosed ["(" ")"]) :abstraction))))) (def: .public (apply/* args func) (-> (List Expression) Expression Computation) - (..form (#.Item func args))) + (..form {#.Item func args})) (template [<name> <function>] [(def: .public (<name> members) @@ -340,7 +340,7 @@ (-> Var Arguments Expression Computation) (..form (list (..var "define") (|> arguments - (revised@ #mandatory (|>> (#.Item name))) + (revised@ #mandatory (|>> {#.Item name})) ..arguments) body))) @@ -350,7 +350,7 @@ (def: .public begin (-> (List Expression) Computation) - (|>> (#.Item (..var "begin")) ..form)) + (|>> {#.Item (..var "begin")} ..form)) (def: .public (set! name value) (-> Var Expression Computation) @@ -371,7 +371,7 @@ #.None (list) - (#.Some else) + {#.Some else} (list (..form (list (..var "else") else)))) (list\composite (list\each (function (_ [when then]) (..form (list when then))) diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index ae72ceb48..6aebcaadc 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -306,7 +306,7 @@ (loop [remaining encoding output (set.of_list name.hash (list))] (case (text.split_by ..coverage_separator remaining) - (#.Some [head tail]) + {#.Some [head tail]} (recur tail (set.has [module head] output)) #.None @@ -353,7 +353,7 @@ .let [coverage (|> definitions (list\mix (function (_ [short [exported? _]] aggregate) (if exported? - (#.Item short aggregate) + {#.Item short aggregate} aggregate)) #.End) ..encoded_coverage)]] @@ -381,10 +381,10 @@ product.right (function (_ _)) "lux try" - (case> (#try.Success output) + (case> {#try.Success output} output - (#try.Failure error) + {#try.Failure error} (..assertion (exception.error ..error_during_execution [error]) false)) io.io async.future diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index de7525d42..f87a8f6f6 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -86,7 +86,7 @@ (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 diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux index a739ff6f5..7053a71e1 100644 --- a/stdlib/source/library/lux/time/date.lux +++ b/stdlib/source/library/lux/time/date.lux @@ -79,11 +79,11 @@ (-> Year Month Nat (Try Date)) (if (..invalid_day? year month day_of_month) (exception.except ..invalid_day [year month day_of_month]) - (#try.Success + {#try.Success (:abstraction [#year year #month month - #day day_of_month])))) + #day day_of_month])})) (def: .public epoch Date diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux index ecdbc79ab..aee0a9f33 100644 --- a/stdlib/source/library/lux/time/day.lux +++ b/stdlib/source/library/lux/time/day.lux @@ -112,7 +112,7 @@ (def: (decoded value) (case value (^template [<tag>] - [(^ (template.text [<tag>])) (#try.Success <tag>)]) + [(^ (template.text [<tag>])) {#try.Success <tag>}]) ([#..Monday] [#..Tuesday] [#..Wednesday] @@ -158,7 +158,7 @@ (-> Nat (Try Day)) (case number (^template [<number> <day>] - [<number> (#try.Success <day>)]) + [<number> {#try.Success <day>}]) (<pairs>) _ (exception.except ..invalid_day [number]))) ) diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux index 2361a23f8..d0c044d39 100644 --- a/stdlib/source/library/lux/time/duration.lux +++ b/stdlib/source/library/lux/time/duration.lux @@ -178,8 +178,8 @@ (..merged (..up seconds ..second)) (..merged (..up millis ..milli_second)))]] (in (case sign - (#.Left _) (..inverse span) - (#.Right _) span))))) + {#.Left _} (..inverse span) + {#.Right _} span))))) (implementation: .public codec (Codec Text Duration) diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux index 57724be44..e2936b80e 100644 --- a/stdlib/source/library/lux/time/month.lux +++ b/stdlib/source/library/lux/time/month.lux @@ -88,7 +88,7 @@ (-> Nat (Try Month)) (case number (^template [<number> <month>] - [<number> (#try.Success <month>)]) + [<number> {#try.Success <month>}]) (<pairs>) _ (exception.except ..invalid_month [number]))) ) @@ -226,7 +226,7 @@ (def: (decoded value) (case value (^template [<tag>] - [(^ (template.text [<tag>])) (#try.Success <tag>)]) + [(^ (template.text [<tag>])) {#try.Success <tag>}]) ([#..January] [#..February] [#..March] diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux index 5a621bac3..9b69e84d6 100644 --- a/stdlib/source/library/lux/time/year.lux +++ b/stdlib/source/library/lux/time/year.lux @@ -42,7 +42,7 @@ (-> 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) @@ -118,8 +118,8 @@ digits (<text>.many <text>.decimal) raw_year (<>.codec i.decimal (in (text\composite "+" digits)))] (<>.lifted (..year (case sign - (#.Left _) (i.* -1 raw_year) - (#.Right _) raw_year))))) + {#.Left _} (i.* -1 raw_year) + {#.Right _} raw_year))))) (implementation: .public codec (Codec Text Year) diff --git a/stdlib/source/library/lux/tool/compiler/default/init.lux b/stdlib/source/library/lux/tool/compiler/default/init.lux index 35759ca87..a43b9a4d9 100644 --- a/stdlib/source/library/lux/tool/compiler/default/init.lux +++ b/stdlib/source/library/lux/tool/compiler/default/init.lux @@ -94,22 +94,22 @@ (def: (reader current_module aliases [location offset source_code]) (-> Module Aliases Source (///analysis.Operation Reader)) (function (_ [bundle state]) - (#try.Success [[bundle state] - (///syntax.parse current_module aliases ("lux text size" source_code))]))) + {#try.Success [[bundle state] + (///syntax.parse current_module aliases ("lux text size" source_code))]})) (def: (read source reader) (-> Source Reader (///analysis.Operation [Source Code])) (function (_ [bundle compiler]) (case (reader source) - (#.Left [source' error]) - (#try.Failure error) + {#.Left [source' error]} + {#try.Failure error} - (#.Right [source' output]) + {#.Right [source' output]} (let [[location _] output] - (#try.Success [[bundle (|> compiler + {#try.Success [[bundle (|> compiler (with@ #.source source') (with@ #.location location))] - [source' output]]))))) + [source' output]]})))) (type: (Operation a) (All (_ anchor expression directive) @@ -209,13 +209,13 @@ (..reader module aliases source))] (function (_ state) (case (///phase.result' state (..iteration' wrapper archive expander reader source pre_payload)) - (#try.Success [state source&requirements&buffer]) - (#try.Success [state (#.Some source&requirements&buffer)]) + {#try.Success [state source&requirements&buffer]} + {#try.Success [state {#.Some source&requirements&buffer}]} - (#try.Failure error) + {#try.Failure error} (if (exception.match? ///syntax.end_of_file error) - (#try.Success [state #.None]) - (exception.with ///.cannot_compile module (#try.Failure error))))))) + {#try.Success [state #.None]} + (exception.with ///.cannot_compile module {#try.Failure error})))))) (def: (default_dependencies prelude input) (-> Module ///.Input (List Module)) @@ -257,16 +257,16 @@ #descriptor.state #.Compiled #descriptor.registry final_registry]]] (in [state - (#.Right [descriptor + {#.Right [descriptor (document.write key analysis_module) (row\each (function (_ [artifact_id custom directive]) [artifact_id custom (write_directive directive)]) - final_buffer)])])) + final_buffer)]}])) - (#.Some [source requirements temporary_payload]) + {#.Some [source requirements temporary_payload]} (let [[temporary_buffer temporary_registry] temporary_payload] (in [state - (#.Left [#///.dependencies (|> requirements + {#.Left [#///.dependencies (|> requirements (value@ #///directive.imports) (list\each product.left)) #///.process (function (_ state archive) @@ -284,5 +284,5 @@ (value@ #///directive.referrals) (monad.each ! (execute! archive))) temporary_payload (..get_current_payload temporary_payload)] - (..iteration wrapper archive expander module source temporary_payload (..module_aliases analysis_module))))))])])) + (..iteration wrapper archive expander module source temporary_payload (..module_aliases analysis_module))))))]}])) )))))])))) diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux index d24ad8f33..f884282eb 100644 --- a/stdlib/source/library/lux/tool/compiler/default/platform.lux +++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux @@ -382,7 +382,7 @@ (exception.except ..cannot_import_circular_dependency [importer importee]) ... else - (#try.Success []))) + {#try.Success []})) (with_expansions [<Context> (as_is [Archive <State+>]) <Result> (as_is (Try <Context>)) @@ -423,20 +423,20 @@ [[_ dependence] (stm.update (..depend importer module) dependence)] (in dependence)))] (case (..verify_dependencies importer module dependence) - (#try.Failure error) - (in [(async.resolved (#try.Failure error)) + {#try.Failure error} + (in [(async.resolved {#try.Failure error}) #.None]) - (#try.Success _) + {#try.Success _} (do ! [[archive state] (stm.read current)] (if (archive.archived? archive module) - (in [(async\in (#try.Success [archive state])) + (in [(async\in {#try.Success [archive state]}) #.None]) (do ! [@pending (stm.read pending)] (case (dictionary.value module @pending) - (#.Some [return signal]) + {#.Some [return signal]} (in [return #.None]) @@ -446,7 +446,7 @@ [module_id (archive.id module archive)] (in [module_id archive])) (archive.reserve module archive)) - (#try.Success [module_id archive]) + {#try.Success [module_id archive]} (do ! [_ (stm.write [archive state] current) .let [[return signal] (:sharing [<type_vars>] @@ -457,31 +457,31 @@ (async.async []))] _ (stm.update (dictionary.has module [return signal]) pending)] (in [return - (#.Some [[archive state] + {#.Some [[archive state] module_id - signal])])) + signal]}])) - (#try.Failure error) - (in [(async\in (#try.Failure error)) + {#try.Failure error} + (in [(async\in {#try.Failure error}) #.None]))))))))))) _ (case signal #.None (in []) - (#.Some [context module_id resolver]) + {#.Some [context module_id resolver]} (do ! [result (compile importer import! module_id context module) result (case result - (#try.Failure error) + {#try.Failure error} (in result) - (#try.Success [resulting_archive resulting_state]) + {#try.Success [resulting_archive resulting_state]} (stm.commit! (do stm.monad [[_ [merged_archive _]] (stm.update (function (_ [archive state]) [(archive.merged resulting_archive archive) state]) current)] - (in (#try.Success [merged_archive resulting_state]))))) + (in {#try.Success [merged_archive resulting_state]})))) _ (async.future (resolver result))] (in [])))] return))))) @@ -579,7 +579,7 @@ #.End (in [archive state]) - (#.Item _) + {#.Item _} (do ! [archive,document+ (|> new_dependencies (list\each (import! module)) @@ -598,27 +598,27 @@ try.trusted product.left) archive) - (#try.Success [state more|done]) + {#try.Success [state more|done]} (case more|done - (#.Left more) + {#.Left more} (continue! [archive state] more all_dependencies) - (#.Right [descriptor document output]) + {#.Right [descriptor document output]} (do ! [.let [_ (debug.log! (..module_compilation_log module state)) descriptor (with@ #descriptor.references all_dependencies descriptor)] _ (..cache_module static platform module_id [descriptor document output])] (case (archive.has module [descriptor document output] archive) - (#try.Success archive) + {#try.Success archive} (in [archive (..with_reset_log state)]) - (#try.Failure error) - (async\in (#try.Failure error))))) + {#try.Failure error} + (async\in {#try.Failure error})))) - (#try.Failure error) + {#try.Failure error} (do ! [_ (ioW.freeze (value@ #&file_system platform) static archive)] - (async\in (#try.Failure error)))))))))] + (async\in {#try.Failure error}))))))))] (compiler archive.runtime_module compilation_module))) ))) 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 35c150116..fb9566948 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -38,12 +38,12 @@ (type: .public Primitive (.Variant #Unit - (#Bit Bit) - (#Nat Nat) - (#Int Int) - (#Rev Rev) - (#Frac Frac) - (#Text Text))) + {#Bit Bit} + {#Nat Nat} + {#Int Int} + {#Rev Rev} + {#Frac Frac} + {#Text Text})) (type: .public Tag Nat) @@ -77,15 +77,15 @@ (type: .public (Composite a) (.Variant - (#Variant (Variant a)) - (#Tuple (Tuple a)))) + {#Variant (Variant a)} + {#Tuple (Tuple a)})) (type: .public Pattern (Rec Pattern (.Variant - (#Simple Primitive) - (#Complex (Composite Pattern)) - (#Bind Register)))) + {#Simple Primitive} + {#Complex (Composite Pattern)} + {#Bind Register}))) (type: .public (Branch' e) (Record @@ -101,13 +101,13 @@ (type: .public Analysis (Rec Analysis (.Variant - (#Primitive Primitive) - (#Structure (Composite Analysis)) - (#Reference Reference) - (#Case Analysis (Match' Analysis)) - (#Function (Environment Analysis) Analysis) - (#Apply Analysis Analysis) - (#Extension (Extension Analysis))))) + {#Primitive Primitive} + {#Structure (Composite Analysis)} + {#Reference Reference} + {#Case Analysis (Match' Analysis)} + {#Function (Environment Analysis) Analysis} + {#Apply Analysis Analysis} + {#Extension (Extension Analysis)}))) (type: .public Branch (Branch' Analysis)) @@ -124,7 +124,7 @@ true (^template [<tag> <=>] - [[(<tag> reference) (<tag> sample)] + [[{<tag> reference} {<tag> sample}] (<=> reference sample)]) ([#Bit bit\=] [#Nat n.=] @@ -141,13 +141,13 @@ (def: (= reference sample) (case [reference sample] - [(#Variant [reference_lefts reference_right? reference_value]) - (#Variant [sample_lefts sample_right? sample_value])] + [{#Variant [reference_lefts reference_right? reference_value]} + {#Variant [sample_lefts sample_right? sample_value]}] (and (n.= reference_lefts sample_lefts) (bit\= reference_right? sample_right?) (/\= reference_value sample_value)) - [(#Tuple reference) (#Tuple sample)] + [{#Tuple reference} {#Tuple sample}] (\ (list.equivalence /\=) = reference sample) _ @@ -161,13 +161,13 @@ (def: (hash value) (case value - (#Variant [lefts right? value]) + {#Variant [lefts right? value]} ($_ n.* 2 (\ n.hash hash lefts) (\ bit.hash hash right?) (\ super hash value)) - (#Tuple members) + {#Tuple members} ($_ n.* 3 (\ (list.hash super) hash members)) ))) @@ -177,13 +177,13 @@ (def: (= reference sample) (case [reference sample] - [(#Simple reference) (#Simple sample)] + [{#Simple reference} {#Simple sample}] (\ primitive_equivalence = reference sample) - [(#Complex reference) (#Complex sample)] + [{#Complex reference} {#Complex sample}] (\ (composite_equivalence =) = reference sample) - [(#Bind reference) (#Bind sample)] + [{#Bind reference} {#Bind sample}] (n.= reference sample) _ @@ -201,31 +201,31 @@ (def: (= reference sample) (case [reference sample] - [(#Primitive reference) (#Primitive sample)] + [{#Primitive reference} {#Primitive sample}] (\ primitive_equivalence = reference sample) - [(#Structure reference) (#Structure sample)] + [{#Structure reference} {#Structure sample}] (\ (composite_equivalence =) = reference sample) - [(#Reference reference) (#Reference sample)] + [{#Reference reference} {#Reference sample}] (\ reference.equivalence = reference sample) - [(#Case [reference_analysis reference_match]) - (#Case [sample_analysis sample_match])] + [{#Case [reference_analysis reference_match]} + {#Case [sample_analysis sample_match]}] (and (= reference_analysis sample_analysis) - (\ (list.equivalence (branch_equivalence =)) = (#.Item reference_match) (#.Item sample_match))) + (\ (list.equivalence (branch_equivalence =)) = {#.Item reference_match} {#.Item sample_match})) - [(#Function [reference_environment reference_analysis]) - (#Function [sample_environment sample_analysis])] + [{#Function [reference_environment reference_analysis]} + {#Function [sample_environment sample_analysis]}] (and (= reference_analysis sample_analysis) (\ (list.equivalence =) = reference_environment sample_environment)) - [(#Apply [reference_input reference_abstraction]) - (#Apply [sample_input sample_abstraction])] + [{#Apply [reference_input reference_abstraction]} + {#Apply [sample_input sample_abstraction]}] (and (= reference_input sample_input) (= reference_abstraction sample_abstraction)) - [(#Extension reference) (#Extension sample)] + [{#Extension reference} {#Extension sample}] (\ (extension.equivalence =) = reference sample) _ @@ -239,11 +239,11 @@ ) (template: .public (unit) - [(#..Primitive #..Unit)]) + [{#..Primitive #..Unit}]) (template [<name> <tag>] [(template: .public (<name> value) - [(#..Primitive (<tag> value))])] + [{#..Primitive {<tag> value}}])] [bit #..Bit] [nat #..Nat] @@ -264,14 +264,17 @@ (n.= (-- size) tag)) (template: .public (no_op value) - [(|> 1 #variable.Local #reference.Variable #..Reference - (#..Function (list)) - (#..Apply value))]) + [(|> 1 + {#variable.Local} + {#reference.Variable} + {#..Reference} + {#..Function (list)} + {#..Apply value})]) (def: .public (apply [abstraction inputs]) (-> (Application Analysis) Analysis) (list\mix (function (_ input abstraction') - (#Apply input abstraction')) + {#Apply input abstraction'}) abstraction inputs)) @@ -280,39 +283,39 @@ (loop [abstraction analysis inputs (list)] (case abstraction - (#Apply input next) - (recur next (#.Item input inputs)) + {#Apply input next} + (recur next {#.Item input inputs}) _ [abstraction inputs]))) (template [<name> <tag>] [(template: .public (<name> content) - [(.<| #..Reference + [(.<| {#..Reference} <tag> content)])] - [variable #reference.Variable] - [constant #reference.Constant] + [variable {#reference.Variable}] + [constant {#reference.Constant}] - [variable/local reference.local] - [variable/foreign reference.foreign] + [variable/local (reference.local)] + [variable/foreign (reference.foreign)] ) (template [<name> <tag>] [(template: .public (<name> content) - [(.<| #..Complex + [(.<| {#..Complex} <tag> content)])] - [pattern/variant #..Variant] - [pattern/tuple #..Tuple] + [pattern/variant {#..Variant}] + [pattern/tuple {#..Tuple}] ) (template [<name> <tag>] [(template: .public (<name> content) - [(.<| #..Structure - <tag> + [(.<| {#..Structure} + {<tag>} content)])] [variant #..Variant] @@ -320,11 +323,11 @@ ) (template: .public (pattern/unit) - [(#..Simple #..Unit)]) + [{#..Simple #..Unit}]) (template [<name> <tag>] [(template: .public (<name> content) - [(#..Simple (<tag> content))])] + [{#..Simple {<tag> content}}])] [pattern/bit #..Bit] [pattern/nat #..Nat] @@ -335,18 +338,18 @@ ) (template: .public (pattern/bind register) - [(#..Bind register)]) + [{#..Bind register}]) (def: .public (%analysis analysis) (Format Analysis) (case analysis - (#Primitive primitive) + {#Primitive primitive} (case primitive #Unit "[]" (^template [<tag> <format>] - [(<tag> value) + [{<tag> value} (<format> value)]) ([#Bit %.bit] [#Nat %.nat] @@ -355,24 +358,24 @@ [#Frac %.frac] [#Text %.text])) - (#Structure structure) + {#Structure structure} (case structure - (#Variant [lefts right? value]) + {#Variant [lefts right? value]} (format "(" (%.nat lefts) " " (%.bit right?) " " (%analysis value) ")") - (#Tuple members) + {#Tuple members} (|> members (list\each %analysis) (text.interposed " ") (text.enclosed ["[" "]"]))) - (#Reference reference) + {#Reference reference} (reference.format reference) - (#Case analysis match) + {#Case analysis match} "{?}" - (#Function environment body) + {#Function environment body} (|> (%analysis body) (format " ") (format (|> environment @@ -381,15 +384,15 @@ (text.enclosed ["[" "]"]))) (text.enclosed ["(" ")"])) - (#Apply _) + {#Apply _} (|> analysis ..application - #.Item + {#.Item} (list\each %analysis) (text.interposed " ") (text.enclosed ["(" ")"])) - (#Extension name parameters) + {#Extension name parameters} (|> parameters (list\each %analysis) (text.interposed " ") @@ -412,12 +415,12 @@ (function (_ [bundle state]) (let [old_source (value@ #.source state)] (case (action [bundle (with@ #.source source state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (with@ #.source old_source state')] - output]) + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' (with@ #.source old_source state')] + output]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (def: fresh_bindings (All (_ k v) (Bindings k v)) @@ -434,18 +437,18 @@ (def: .public (with_scope action) (All (_ a) (-> (Operation a) (Operation [Scope a]))) (function (_ [bundle state]) - (case (action [bundle (revised@ #.scopes (|>> (#.Item fresh_scope)) state)]) - (#try.Success [[bundle' state'] output]) + (case (action [bundle (revised@ #.scopes (|>> {#.Item fresh_scope}) state)]) + {#try.Success [[bundle' state'] output]} (case (value@ #.scopes state') - (#.Item head tail) - (#try.Success [[bundle' (with@ #.scopes tail state')] - [head output]]) + {#.Item head tail} + {#try.Success [[bundle' (with@ #.scopes tail state')] + [head output]]} #.End - (#try.Failure "Impossible error: Drained scopes!")) + {#try.Failure "Impossible error: Drained scopes!"}) - (#try.Failure error) - (#try.Failure error)))) + {#try.Failure error} + {#try.Failure error}))) (def: scope_reset (List Scope) @@ -455,18 +458,18 @@ (All (_ a) (-> (Operation a) (Operation a))) (function (_ [bundle state]) (case (action [bundle (with@ #.scopes ..scope_reset state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (with@ #.scopes (value@ #.scopes state) state')] - output]) + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' (with@ #.scopes (value@ #.scopes state) state')] + output]} - (#try.Failure error) - (#try.Failure error)))) + {#try.Failure error} + {#try.Failure error}))) (def: .public (with_current_module name) (All (_ a) (-> Text (Operation a) (Operation a))) (extension.localized (value@ #.current_module) (with@ #.current_module) - (function.constant (#.Some name)))) + (function.constant {#.Some name}))) (def: .public (with_location location action) (All (_ a) (-> Location (Operation a) (Operation a))) @@ -475,12 +478,12 @@ (function (_ [bundle state]) (let [old_location (value@ #.location state)] (case (action [bundle (with@ #.location location state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (with@ #.location old_location state')] - output]) + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' (with@ #.location old_location state')] + output]} - (#try.Failure error) - (#try.Failure error)))))) + {#try.Failure error} + {#try.Failure error}))))) (def: (locate_error location error) (-> Location Text Text) @@ -490,7 +493,7 @@ (def: .public (failure error) (-> Text Operation) (function (_ [bundle state]) - (#try.Failure (locate_error (value@ #.location state) error)))) + {#try.Failure (locate_error (value@ #.location state) error)})) (def: .public (except exception parameters) (All (_ e) (-> (Exception e) e Operation)) @@ -505,7 +508,7 @@ (def: .public (failure' error) (-> Text (phase.Operation Lux)) (function (_ state) - (#try.Failure (locate_error (value@ #.location state) error)))) + {#try.Failure (locate_error (value@ #.location state) error)})) (def: .public (except' exception parameters) (All (_ e) (-> (Exception e) e (phase.Operation Lux))) @@ -516,18 +519,18 @@ (function (_ bundle,state) (case (exception.with exception message (action bundle,state)) - (#try.Success output) - (#try.Success output) + {#try.Success output} + {#try.Success output} - (#try.Failure error) + {#try.Failure error} (let [[bundle state] bundle,state] - (#try.Failure (locate_error (value@ #.location state) error)))))) + {#try.Failure (locate_error (value@ #.location state) error)})))) (def: .public (install state) (-> .Lux (Operation Any)) (function (_ [bundle _]) - (#try.Success [[bundle state] - []]))) + {#try.Success [[bundle state] + []]})) (template [<name> <type> <field> <value>] [(def: .public (<name> value) @@ -535,7 +538,7 @@ (extension.update (with@ <field> <value>)))] [set_source_code Source #.source value] - [set_current_module Text #.current_module (#.Some value)] + [set_current_module Text #.current_module {#.Some value}] [set_location Location #.location value] ) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux index 0b9e317fe..ed5983d14 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis/macro.lux @@ -38,10 +38,10 @@ (do try.monad [output (expander macro inputs state)] (case output - (#try.Success output) - (#try.Success output) + {#try.Success output} + {#try.Success output} - (#try.Failure error) + {#try.Failure error} ((meta.failure (exception.error ..expansion_failed [name inputs error])) state))))) (def: .public (expand_one expander name macro inputs) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux index dd8d86836..cd74d94f4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/directive.lux @@ -70,7 +70,7 @@ (All (_ anchor expression directive) (Operation anchor expression directive <phase>)) (function (_ [bundle state]) - (#try.Success [[bundle state] (value@ [<component> #..phase] state)])))] + {#try.Success [[bundle state] (value@ [<component> #..phase] state)]}))] [analysis #..analysis analysis.Phase] [synthesis #..synthesis synthesis.Phase] 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 7ed71e658..72a086650 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/generation.lux @@ -115,21 +115,21 @@ (All (_ anchor expression directive output) <with_type>) (function (_ body) (function (_ [bundle state]) - (case (body [bundle (with@ <tag> (#.Some <with_value>) state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (with@ <tag> (value@ <tag> state) state')] - output]) + (case (body [bundle (with@ <tag> {#.Some <with_value>} state)]) + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' (with@ <tag> (value@ <tag> state) state')] + output]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (def: .public <get> (All (_ anchor expression directive) (Operation anchor expression directive <get_type>)) (function (_ (^@ stateE [bundle state])) (case (value@ <tag> state) - (#.Some output) - (#try.Success [stateE output]) + {#.Some output} + {#try.Success [stateE output]} #.None (exception.except <exception> [])))) @@ -138,8 +138,8 @@ (All (_ anchor expression directive) (-> <get_type> (Operation anchor expression directive Any))) (function (_ [bundle state]) - (#try.Success [[bundle (with@ <tag> (#.Some value) state)] - []])))] + {#try.Success [[bundle (with@ <tag> {#.Some value} state)] + []]}))] [#anchor (with_anchor anchor) @@ -160,14 +160,14 @@ (All (_ anchor expression directive) (Operation anchor expression directive artifact.Registry)) (function (_ (^@ stateE [bundle state])) - (#try.Success [stateE (value@ #registry state)]))) + {#try.Success [stateE (value@ #registry state)]})) (def: .public (set_registry value) (All (_ anchor expression directive) (-> artifact.Registry (Operation anchor expression directive Any))) (function (_ [bundle state]) - (#try.Success [[bundle (with@ #registry value state)] - []]))) + {#try.Success [[bundle (with@ #registry value state)] + []]})) (def: .public next (All (_ anchor expression directive) @@ -197,10 +197,10 @@ (-> Context expression (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) (case (\ (value@ #host state) evaluate! label code) - (#try.Success output) - (#try.Success [state+ output]) + {#try.Success output} + {#try.Success [state+ output]} - (#try.Failure error) + {#try.Failure error} (exception.except ..cannot_interpret error)))) (def: .public (execute! code) @@ -208,10 +208,10 @@ (-> directive (Operation anchor expression directive Any))) (function (_ (^@ state+ [bundle state])) (case (\ (value@ #host state) execute! code) - (#try.Success output) - (#try.Success [state+ output]) + {#try.Success output} + {#try.Success [state+ output]} - (#try.Failure error) + {#try.Failure error} (exception.except ..cannot_interpret error)))) (def: .public (define! context custom code) @@ -219,10 +219,10 @@ (-> Context (Maybe Text) expression (Operation anchor expression directive [Text Any directive]))) (function (_ (^@ stateE [bundle state])) (case (\ (value@ #host state) define! context custom code) - (#try.Success output) - (#try.Success [stateE output]) + {#try.Success output} + {#try.Success [stateE output]} - (#try.Failure error) + {#try.Failure error} (exception.except ..cannot_interpret error)))) (def: .public (save! artifact_id custom code) @@ -231,11 +231,11 @@ (do [! phase.monad] [?buffer (extension.read (value@ #buffer))] (case ?buffer - (#.Some buffer) + {#.Some buffer} ... TODO: Optimize by no longer checking for overwrites... (if (row.any? (|>> product.left (n.= artifact_id)) buffer) (phase.except ..cannot_overwrite_output [artifact_id]) - (extension.update (with@ #buffer (#.Some (row.suffix [artifact_id custom code] buffer))))) + (extension.update (with@ #buffer {#.Some (row.suffix [artifact_id custom code] buffer)}))) #.None (phase.except ..no_buffer_for_saving_code [artifact_id])))) @@ -246,8 +246,8 @@ (-> Text (Operation anchor expression directive artifact.ID))) (function (_ (^@ stateE [bundle state])) (let [[id registry'] (<artifact> name (value@ #registry state))] - (#try.Success [[bundle (with@ #registry registry' state)] - id]))))] + {#try.Success [[bundle (with@ #registry registry' state)] + id]})))] [learn artifact.definition] [learn_custom artifact.custom] @@ -272,16 +272,16 @@ (do try.monad [module_id (archive.id _module archive) registry (if (text\= (value@ #module state) _module) - (#try.Success (value@ #registry state)) + {#try.Success (value@ #registry state)} (do try.monad [[descriptor document] (archive.find _module archive)] - (#try.Success (value@ #descriptor.registry descriptor))))] + {#try.Success (value@ #descriptor.registry descriptor)}))] (case (artifact.remember _name registry) #.None (exception.except ..unknown_definition [name (artifact.definitions registry)]) - (#.Some id) - (#try.Success [stateE [module_id id]])))))) + {#.Some id} + {#try.Success [stateE [module_id id]]}))))) (exception: .public no_context) @@ -301,7 +301,7 @@ #.None (exception.except ..no_context []) - (#.Some id) + {#.Some id} (do try.monad [module_id (archive.id (value@ #module state) archive)] (in [stateE [module_id id]]))))) @@ -313,7 +313,7 @@ (Operation anchor expression directive a))) (function (_ [bundle state]) (do try.monad - [[[bundle' state'] output] (body [bundle (with@ #context (#.Some id) state)])] + [[[bundle' state'] output] (body [bundle (with@ #context {#.Some id} state)])] (in [[bundle' (with@ #context (value@ #context state) state')] output])))) @@ -326,7 +326,7 @@ (do try.monad [[[bundle' state'] output] (body [bundle (|> state (with@ #registry registry') - (with@ #context (#.Some id)))]) + (with@ #context {#.Some id}))]) module_id (archive.id (value@ #module state) archive)] (in [[bundle' (with@ #context (value@ #context state) state')] [[module_id id] @@ -336,6 +336,6 @@ (All (_ anchor expression directive a) (-> Text (Operation anchor expression directive Any))) (function (_ [bundle state]) - (#try.Success [[bundle + {#try.Success [[bundle (revised@ #log (row.suffix message) state)] - []]))) + []]})) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux index c8c2b9fd3..53968905c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis.lux @@ -41,7 +41,7 @@ (-> Archive Phase (Fix (-> (Code' (Ann Location)) (Operation Analysis)))) (case code' (^template [<tag> <analyser>] - [(<tag> value) + [{<tag> value} (<analyser> value)]) ([#.Bit /primitive.bit] [#.Nat /primitive.nat] @@ -50,28 +50,28 @@ [#.Frac /primitive.frac] [#.Text /primitive.text]) - (^ (#.Form (list& [_ (#.Tag tag)] - values))) + (^ {#.Form (list& [_ {#.Tag tag}] + values)}) (case values - (#.Item value #.End) + {#.Item value #.End} (/structure.tagged_sum compile tag archive value) _ (/structure.tagged_sum compile tag archive (` [(~+ values)]))) - (^ (#.Form (list& [_ (#.Nat lefts)] [_ (#.Bit right?)] - values))) + (^ {#.Form (list& [_ {#.Nat lefts}] [_ {#.Bit right?}] + values)}) (case values - (#.Item value #.End) + {#.Item value #.End} (/structure.sum compile lefts right? archive value) _ (/structure.sum compile lefts right? archive (` [(~+ values)]))) - (#.Tag tag) + {#.Tag tag} (/structure.tagged_sum compile tag archive (' [])) - (^ (#.Tuple elems)) + (^ {#.Tuple elems}) (/structure.record archive compile elems) _ @@ -80,30 +80,30 @@ (def: (compile|others expander archive compile code') (-> Expander Archive Phase (-> (Code' (Ann Location)) (Operation Analysis))) (case code' - (#.Identifier reference) + {#.Identifier reference} (/reference.reference reference) - (^ (#.Form (list [_ (#.Record branches)] input))) + (^ {#.Form (list [_ {#.Record branches}] input)}) (/case.case compile branches archive input) - (^ (#.Form (list& [_ (#.Text extension_name)] extension_args))) + (^ {#.Form (list& [_ {#.Text extension_name}] extension_args)}) (//extension.apply archive compile [extension_name extension_args]) - (^ (#.Form (list [_ (#.Tuple (list [_ (#.Identifier ["" function_name])] - [_ (#.Identifier ["" arg_name])]))] - body))) + (^ {#.Form (list [_ {#.Tuple (list [_ {#.Identifier ["" function_name]}] + [_ {#.Identifier ["" arg_name]}])}] + body)}) (/function.function compile function_name arg_name archive body) - (^ (#.Form (list& functionC argsC+))) + (^ {#.Form (list& functionC argsC+)}) (do [! //.monad] [[functionT functionA] (/type.with_inference (compile archive functionC))] (case functionA - (#/.Reference (#reference.Constant def_name)) + {#/.Reference {#reference.Constant def_name}} (do ! [?macro (//extension.lifted (meta.macro def_name))] (case ?macro - (#.Some macro) + {#.Some macro} (do ! [expansion (//extension.lifted (/macro.expand_one expander def_name macro argsC+))] (compile archive expansion)) 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 ec8fb396e..d7a7bf6ab 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 @@ -69,8 +69,8 @@ #.End baseT - (#.Item head tail) - (re_quantify tail (#.UnivQ head baseT)))) + {#.Item head tail} + (re_quantify tail {#.UnivQ head baseT}))) ... Type-checking on the input value is done during the analysis of a ... "case" expression, to ensure that the patterns being used make @@ -85,53 +85,53 @@ (list)) caseT caseT] (.case caseT - (#.Var id) + {#.Var id} (do ///.monad [?caseT' (//type.with_env (check.peek id))] (.case ?caseT' - (#.Some caseT') + {#.Some caseT'} (recur envs caseT') _ (/.except ..cannot_simplify_for_pattern_matching caseT))) - (#.Named name unnamedT) + {#.Named name unnamedT} (recur envs unnamedT) - (#.UnivQ env unquantifiedT) - (recur (#.Item env envs) unquantifiedT) + {#.UnivQ env unquantifiedT} + (recur {#.Item env envs} unquantifiedT) - (#.ExQ _) + {#.ExQ _} (do ///.monad [[var_id varT] (//type.with_env check.var)] (recur envs (maybe.trusted (type.applied (list varT) caseT)))) - (#.Apply inputT funcT) + {#.Apply inputT funcT} (.case funcT - (#.Var funcT_id) + {#.Var funcT_id} (do ///.monad [funcT' (//type.with_env (do check.monad [?funct' (check.peek funcT_id)] (.case ?funct' - (#.Some funct') + {#.Some funct'} (in funct') _ (check.except ..cannot_simplify_for_pattern_matching caseT))))] - (recur envs (#.Apply inputT funcT'))) + (recur envs {#.Apply inputT funcT'})) _ (.case (type.applied (list inputT) funcT) - (#.Some outputT) + {#.Some outputT} (recur envs outputT) #.None (/.except ..cannot_simplify_for_pattern_matching caseT))) - (#.Product _) + {#.Product _} (|> caseT type.flat_tuple (list\each (re_quantify envs)) @@ -169,56 +169,56 @@ (def: (analyse_pattern num_tags inputT pattern next) (All (_ a) (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) (.case pattern - [location (#.Identifier ["" name])] + [location {#.Identifier ["" name]}] (/.with_location location (do ///.monad [outputA (//scope.with_local [name inputT] next) idx //scope.next_local] - (in [(#/.Bind idx) outputA]))) + (in [{#/.Bind idx} outputA]))) (^template [<type> <input> <output>] [[location <input>] - (analyse_primitive <type> inputT location (#/.Simple <output>) next)]) - ([Bit (#.Bit pattern_value) (#/.Bit pattern_value)] - [Nat (#.Nat pattern_value) (#/.Nat pattern_value)] - [Int (#.Int pattern_value) (#/.Int pattern_value)] - [Rev (#.Rev pattern_value) (#/.Rev pattern_value)] - [Frac (#.Frac pattern_value) (#/.Frac pattern_value)] - [Text (#.Text pattern_value) (#/.Text pattern_value)] - [Any (#.Tuple #.End) #/.Unit]) + (analyse_primitive <type> inputT location {#/.Simple <output>} next)]) + ([Bit {#.Bit pattern_value} {#/.Bit pattern_value}] + [Nat {#.Nat pattern_value} {#/.Nat pattern_value}] + [Int {#.Int pattern_value} {#/.Int pattern_value}] + [Rev {#.Rev pattern_value} {#/.Rev pattern_value}] + [Frac {#.Frac pattern_value} {#/.Frac pattern_value}] + [Text {#.Text pattern_value} {#/.Text pattern_value}] + [Any {#.Tuple #.End} #/.Unit]) - (^ [location (#.Tuple (list singleton))]) + (^ [location {#.Tuple (list singleton)}]) (analyse_pattern #.None inputT singleton next) - [location (#.Tuple sub_patterns)] + [location {#.Tuple sub_patterns}] (do [! ///.monad] [record (//structure.normal sub_patterns) record_size,members,recordT (: (Operation (Maybe [Nat (List Code) Type])) (.case record - (#.Some record) + {#.Some record} (//structure.order record) #.None (in #.None)))] (.case record_size,members,recordT - (#.Some [record_size members recordT]) + {#.Some [record_size members recordT]} (do ! [_ (.case inputT - (#.Var _id) + {#.Var _id} (//type.with_env (check.check inputT recordT)) _ (in []))] - (analyse_pattern (#.Some record_size) inputT [location (#.Tuple members)] next)) + (analyse_pattern {#.Some record_size} inputT [location {#.Tuple members}] next)) #.None (/.with_location location (do [! ///.monad] [inputT' (simplify_case inputT)] (.case inputT' - (#.Product _) + {#.Product _} (let [matches (loop [types (type.flat_tuple inputT') patterns sub_patterns output (: (List [Type Code]) @@ -227,17 +227,17 @@ [#.End #.End] output - [(#.Item headT #.End) (#.Item headP #.End)] - (#.Item [headT headP] output) + [{#.Item headT #.End} {#.Item headP #.End}] + {#.Item [headT headP] output} - [remainingT (#.Item headP #.End)] - (#.Item [(type.tuple remainingT) headP] output) + [remainingT {#.Item headP #.End}] + {#.Item [(type.tuple remainingT) headP] output} - [(#.Item headT #.End) remainingP] - (#.Item [headT (code.tuple remainingP)] output) + [{#.Item headT #.End} remainingP] + {#.Item [headT (code.tuple remainingP)] output} - [(#.Item headT tailT) (#.Item headP tailP)] - (recur tailT tailP (#.Item [headT headP] output)) + [{#.Item headT tailT} {#.Item headP tailP}] + (recur tailT tailP {#.Item [headT headP] output}) _ (undefined)))] @@ -261,22 +261,22 @@ _ (/.except ..cannot_match_with_pattern [inputT' pattern])))))) - [location (#.Tag tag)] + [location {#.Tag tag}] (/.with_location location (analyse_pattern #.None inputT (` ((~ pattern))) next)) - (^ [location (#.Form (list& [_ (#.Nat lefts)] [_ (#.Bit right?)] values))]) + (^ [location {#.Form (list& [_ {#.Nat lefts}] [_ {#.Bit right?}] values)}]) (/.with_location location (do ///.monad [inputT' (simplify_case inputT)] (.case inputT' - (#.Sum _) + {#.Sum _} (let [flat_sum (type.flat_variant inputT') size_sum (list.size flat_sum) num_cases (maybe.else size_sum num_tags) idx (/.tag lefts right?)] (.case (list.item idx flat_sum) - (^multi (#.Some caseT) + (^multi {#.Some caseT} (n.< num_cases idx)) (do ///.monad [[testP nextA] (if (and (n.> num_cases size_sum) @@ -292,7 +292,7 @@ _ (/.except ..sum_has_no_case [idx inputT]))) - (#.UnivQ _) + {#.UnivQ _} (do ///.monad [[ex_id exT] (//type.with_env check.existential)] @@ -304,7 +304,7 @@ _ (/.except ..cannot_match_with_pattern [inputT' pattern])))) - (^ [location (#.Form (list& [_ (#.Tag tag)] values))]) + (^ [location {#.Form (list& [_ {#.Tag tag}] values)}]) (/.with_location location (do ///.monad [tag (///extension.lifted (meta.normal tag)) @@ -312,7 +312,7 @@ _ (//type.with_env (check.check inputT variantT)) .let [[lefts right?] (/.choice (list.size group) idx)]] - (analyse_pattern (#.Some (list.size group)) inputT (` ((~ (code.nat lefts)) (~ (code.bit right?)) (~+ values))) next))) + (analyse_pattern {#.Some (list.size group)} inputT (` ((~ (code.nat lefts)) (~ (code.bit right?)) (~+ values))) next))) _ (/.except ..not_a_pattern pattern) @@ -321,7 +321,7 @@ (def: .public (case analyse branches archive inputC) (-> Phase (List [Code Code]) Phase) (.case branches - (#.Item [patternH bodyH] branchesT) + {#.Item [patternH bodyH] branchesT} (do [! ///.monad] [[inputT inputA] (//type.with_inference (analyse archive inputC)) @@ -333,13 +333,13 @@ outputHC (|> outputH product.left /coverage.determine) outputTC (monad.each ! (|>> product.left /coverage.determine) outputT) _ (.case (monad.mix try.monad /coverage.merged outputHC outputTC) - (#try.Success coverage) + {#try.Success coverage} (///.assertion non_exhaustive_pattern_matching [inputC branches coverage] (/coverage.exhaustive? coverage)) - (#try.Failure error) + {#try.Failure error} (/.failure error))] - (in (#/.Case inputA [outputH outputT]))) + (in {#/.Case inputA [outputH outputT]})) #.End (/.except ..cannot_have_empty_branches ""))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux index 5dcedd669..70623af8a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux @@ -51,16 +51,16 @@ (Rec Coverage (.Variant #Partial - (#Bit Bit) - (#Variant (Maybe Nat) (Dictionary Nat Coverage)) - (#Seq Coverage Coverage) - (#Alt Coverage Coverage) + {#Bit Bit} + {#Variant (Maybe Nat) (Dictionary Nat Coverage)} + {#Seq Coverage Coverage} + {#Alt Coverage Coverage} #Exhaustive))) (def: .public (exhaustive? coverage) (-> Coverage Bit) (case coverage - (#Exhaustive _) + {#Exhaustive _} #1 _ @@ -72,12 +72,12 @@ #Partial "#Partial" - (#Bit value') + {#Bit value'} (|> value' %.bit - (text.enclosed ["(#Bit " ")"])) + (text.enclosed ["{#Bit " "}"])) - (#Variant ?max_cases cases) + {#Variant ?max_cases cases} (|> cases dictionary.entries (list\each (function (_ [idx coverage]) @@ -85,13 +85,13 @@ (text.interposed " ") (text.enclosed ["{" "}"]) (format (%.nat (..cases ?max_cases)) " ") - (text.enclosed ["(#Variant " ")"])) + (text.enclosed ["{#Variant " "}"])) - (#Seq left right) - (format "(#Seq " (%coverage left) " " (%coverage right) ")") + {#Seq left right} + (format "{#Seq " (%coverage left) " " (%coverage right) "}") - (#Alt left right) - (format "(#Alt " (%coverage left) " " (%coverage right) ")") + {#Alt left right} + (format "{#Alt " (%coverage left) " " (%coverage right) "}") #Exhaustive "#Exhaustive")) @@ -99,14 +99,14 @@ (def: .public (determine pattern) (-> Pattern (Operation Coverage)) (case pattern - (^or (#/.Simple #/.Unit) - (#/.Bind _)) + (^or {#/.Simple #/.Unit} + {#/.Bind _}) (////\in #Exhaustive) ... Primitive patterns always have partial coverage because there ... are too many possibilities as far as values go. (^template [<tag>] - [(#/.Simple (<tag> _)) + [{#/.Simple {<tag> _}} (////\in #Partial)]) ([#/.Nat] [#/.Int] @@ -117,17 +117,17 @@ ... Bits are the exception, since there is only "#1" and ... "#0", which means it is possible for bit ... pattern-matching to become exhaustive if complementary parts meet. - (#/.Simple (#/.Bit value)) - (////\in (#Bit value)) + {#/.Simple {#/.Bit value}} + (////\in {#Bit value}) ... Tuple patterns can be exhaustive if there is exhaustiveness for all of ... their sub-patterns. - (#/.Complex (#/.Tuple membersP+)) + {#/.Complex {#/.Tuple membersP+}} (case (list.reversed membersP+) - (^or #.End (#.Item _ #.End)) + (^or #.End {#.Item _ #.End}) (/.except ..invalid_tuple_pattern []) - (#.Item lastP prevsP+) + {#.Item lastP prevsP+} (do ////.monad [lastC (determine lastP)] (monad.mix ////.monad @@ -139,22 +139,22 @@ (in leftC) _ - (in (#Seq leftC rightC))))) + (in {#Seq leftC rightC})))) lastC prevsP+))) ... Variant patterns can be shown to be exhaustive if all the possible ... cases are handled exhaustively. - (#/.Complex (#/.Variant [lefts right? value])) + {#/.Complex {#/.Variant [lefts right? value]}} (do ////.monad [value_coverage (determine value) .let [idx (if right? (++ lefts) lefts)]] - (in (#Variant (if right? - (#.Some idx) + (in {#Variant (if right? + {#.Some idx} #.None) - (|> (dictionary.empty n.hash) - (dictionary.has idx value_coverage))))))) + (|> (dictionary.empty n.hash) + (dictionary.has idx value_coverage))})))) (def: (xor left right) (-> Bit Bit Bit) @@ -176,7 +176,7 @@ (def: (flat_alt coverage) (-> Coverage (List Coverage)) (case coverage - (#Alt left right) + {#Alt left right} (list& left (flat_alt right)) _ @@ -188,19 +188,19 @@ [#Exhaustive #Exhaustive] #1 - [(#Bit sideR) (#Bit sideS)] + [{#Bit sideR} {#Bit sideS}] (bit\= sideR sideS) - [(#Variant allR casesR) (#Variant allS casesS)] + [{#Variant allR casesR} {#Variant allS casesS}] (and (n.= (cases allR) (cases allS)) (\ (dictionary.equivalence =) = casesR casesS)) - [(#Seq leftR rightR) (#Seq leftS rightS)] + [{#Seq leftR rightR} {#Seq leftS rightS}] (and (= leftR leftS) (= rightR rightS)) - [(#Alt _) (#Alt _)] + [{#Alt _} {#Alt _}] (let [flatR (flat_alt reference) flatS (flat_alt sample)] (and (n.= (list.size flatR) (list.size flatS)) @@ -230,11 +230,11 @@ (try\in #Partial) ... 2 bit coverages are exhaustive if they complement one another. - (^multi [(#Bit sideA) (#Bit sideSF)] + (^multi [{#Bit sideA} {#Bit sideSF}] (xor sideA sideSF)) (try\in #Exhaustive) - [(#Variant allA casesA) (#Variant allSF casesSF)] + [{#Variant allA casesA} {#Variant allSF casesSF}] (let [addition_cases (cases allSF) so_far_cases (cases allA)] (cond (and (known_cases? addition_cases) @@ -250,7 +250,7 @@ [casesM (monad.mix ! (function (_ [tagA coverageA] casesSF') (case (dictionary.value tagA casesSF') - (#.Some coverageSF) + {#.Some coverageSF} (do ! [coverageM (merged coverageA coverageSF)] (in (dictionary.has tagA coverageM casesSF'))) @@ -264,15 +264,15 @@ (dictionary.size casesM)) (list.every? exhaustive? (dictionary.values casesM))) #Exhaustive - (#Variant (case allSF - (#.Some _) + {#Variant (case allSF + {#.Some _} allSF _ allA) - casesM)))))) + casesM}))))) - [(#Seq leftA rightA) (#Seq leftSF rightSF)] + [{#Seq leftA rightA} {#Seq leftSF rightSF}] (case [(coverage/= leftSF leftA) (coverage/= rightSF rightA)] ... Same prefix [#1 #0] @@ -283,17 +283,17 @@ ... (since only the "left" part would influence whether the ... merged coverage is exhaustive or not). (in leftSF) - (in (#Seq leftSF rightM)))) + (in {#Seq leftSF rightM}))) ... Same suffix [#0 #1] (do try.monad [leftM (merged leftA leftSF)] - (in (#Seq leftM rightA))) + (in {#Seq leftM rightA})) ... The 2 sequences cannot possibly be merged. [#0 #0] - (try\in (#Alt so_far addition)) + (try\in {#Alt so_far addition}) ... There is nothing the addition adds to the coverage. [#1 #1] @@ -308,12 +308,12 @@ (try\in #Exhaustive) ... The left part will always match, so the addition is redundant. - (^multi [(#Seq left right) single] + (^multi [{#Seq left right} single] (coverage/= left single)) (exception.except ..redundant_pattern [so_far addition]) ... The right part is not necessary, since it can always match the left. - (^multi [single (#Seq left right)] + (^multi [single {#Seq left right}] (coverage/= left single)) (try\in single) @@ -326,7 +326,7 @@ ... other ones in the original Alt. ... This process must be repeated until no further productive ... merges can be done. - [_ (#Alt leftS rightS)] + [_ {#Alt leftS rightS}] (do [! try.monad] [.let [fuse_once (: (-> Coverage (List Coverage) (Try [(Maybe Coverage) @@ -337,34 +337,34 @@ #.End (in [#.None (list coverageA)]) - (#.Item altSF altsSF') + {#.Item altSF altsSF'} (case (merged coverageA altSF) - (#try.Success altMSF) + {#try.Success altMSF} (case altMSF - (#Alt _) + {#Alt _} (do ! [[success altsSF+] (recur altsSF')] - (in [success (#.Item altSF altsSF+)])) + (in [success {#.Item altSF altsSF+}])) _ - (in [(#.Some altMSF) altsSF'])) + (in [{#.Some altMSF} altsSF'])) - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) ))))] [successA possibilitiesSF] (fuse_once addition (flat_alt so_far))] (loop [successA successA possibilitiesSF possibilitiesSF] (case successA - (#.Some coverageA') + {#.Some coverageA'} (do ! [[successA' possibilitiesSF'] (fuse_once coverageA' possibilitiesSF)] (recur successA' possibilitiesSF')) #.None (case (list.reversed possibilitiesSF) - (#.Item last prevs) - (in (list\mix (function (_ left right) (#Alt left right)) + {#.Item last prevs} + (in (list\mix (function (_ left right) {#Alt left right}) last prevs)) @@ -376,4 +376,4 @@ ... The addition cannot possibly improve the coverage. (exception.except ..redundant_pattern [so_far addition]) ... There are now 2 alternative paths. - (try\in (#Alt so_far addition))))) + (try\in {#Alt so_far addition})))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux index fe0a32584..c0733c07a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -54,31 +54,31 @@ (loop [expectedT functionT] (/.with_stack ..cannot_analyse [expectedT function_name arg_name body] (case expectedT - (#.Named name unnamedT) + {#.Named name unnamedT} (recur unnamedT) - (#.Apply argT funT) + {#.Apply argT funT} (case (type.applied (list argT) funT) - (#.Some value) + {#.Some value} (recur value) #.None (/.failure (ex.error cannot_analyse [expectedT function_name arg_name body]))) (^template [<tag> <instancer>] - [(<tag> _) + [{<tag> _} (do ! [[_ instanceT] (//type.with_env <instancer>)] (recur (maybe.trusted (type.applied (list instanceT) expectedT))))]) ([#.UnivQ check.existential] [#.ExQ check.var]) - (#.Var id) + {#.Var id} (do ! [?expectedT' (//type.with_env (check.peek id))] (case ?expectedT' - (#.Some expectedT') + {#.Some expectedT'} (recur expectedT') ... Inference @@ -86,17 +86,17 @@ (do ! [[input_id inputT] (//type.with_env check.var) [output_id outputT] (//type.with_env check.var) - .let [functionT (#.Function inputT outputT)] + .let [functionT {#.Function inputT outputT}] functionA (recur functionT) _ (//type.with_env (check.check expectedT functionT))] (in functionA)))) - (#.Function inputT outputT) + {#.Function inputT outputT} (<| (\ ! each (.function (_ [scope bodyA]) - (#/.Function (list\each (|>> /.variable) + {#/.Function (list\each (|>> /.variable) (//scope.environment scope)) - bodyA))) + bodyA})) /.with_scope ... Functions have access not only to their argument, but ... also to themselves, through a local variable. diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux index b6d610a7f..47768945d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/inference.lux @@ -66,27 +66,28 @@ (def: (replace parameter_idx replacement type) (-> Nat Type Type Type) (case type - (#.Primitive name params) - (#.Primitive name (list\each (replace parameter_idx replacement) params)) + {#.Primitive name params} + {#.Primitive name (list\each (replace parameter_idx replacement) params)} (^template [<tag>] - [(<tag> left right) - (<tag> (replace parameter_idx replacement left) - (replace parameter_idx replacement right))]) + [{<tag> left right} + {<tag> + (replace parameter_idx replacement left) + (replace parameter_idx replacement right)}]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) - (#.Parameter idx) + {#.Parameter idx} (if (n.= parameter_idx idx) replacement type) (^template [<tag>] - [(<tag> env quantified) - (<tag> (list\each (replace parameter_idx replacement) env) - (replace (n.+ 2 parameter_idx) replacement quantified))]) + [{<tag> env quantified} + {<tag> (list\each (replace parameter_idx replacement) env) + (replace (n.+ 2 parameter_idx) replacement quantified)}]) ([#.UnivQ] [#.ExQ]) @@ -96,7 +97,7 @@ (def: (named_type location id) (-> Location Nat Type) (let [name (format "{New Type " (%.location location) " " (%.nat id) "}")] - (#.Primitive name (list)))) + {#.Primitive name (list)})) (def: new_named_type (Operation Type) @@ -120,17 +121,17 @@ [_ (//type.infer inferT)] (in [inferT (list)])) - (#.Item argC args') + {#.Item argC args'} (case inferT - (#.Named name unnamedT) + {#.Named name unnamedT} (general archive analyse unnamedT args) - (#.UnivQ _) + {#.UnivQ _} (do ///.monad [[var_id varT] (//type.with_env check.var)] (general archive analyse (maybe.trusted (type.applied (list varT) inferT)) args)) - (#.ExQ _) + {#.ExQ _} (do [! ///.monad] [[var_id varT] (//type.with_env check.var) output (general archive analyse @@ -146,9 +147,9 @@ (check.check varT newT))))] (in output)) - (#.Apply inputT transT) + {#.Apply inputT transT} (case (type.applied (list inputT) transT) - (#.Some outputT) + {#.Some outputT} (general archive analyse outputT args) #.None @@ -161,7 +162,7 @@ ... By inferring back-to-front, a lot of type-annotations can be ... avoided in Lux code, since the inference algorithm can piece ... things together more easily. - (#.Function inputT outputT) + {#.Function inputT outputT} (do ///.monad [[outputT' args'A] (general archive analyse outputT args') argA (<| (/.with_stack ..cannot_infer_argument [inputT argC]) @@ -169,12 +170,12 @@ (analyse archive argC))] (in [outputT' (list& argA args'A)])) - (#.Var infer_id) + {#.Var infer_id} (do ///.monad [?inferT' (//type.with_env (check.peek infer_id))] (case ?inferT' - (#.Some inferT') + {#.Some inferT'} (general archive analyse inferT' args) _ @@ -188,22 +189,22 @@ (-> Nat Type Type Type) (function (recur base) (case base - (#.Primitive name parameters) - (#.Primitive name (list\each recur parameters)) + {#.Primitive name parameters} + {#.Primitive name (list\each recur parameters)} (^template [<tag>] - [(<tag> left right) - (<tag> (recur left) (recur right))]) + [{<tag> left right} + {<tag> (recur left) (recur right)}]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) - (#.Parameter index) + {#.Parameter index} (if (n.= target index) sub base) (^template [<tag>] - [(<tag> environment quantified) - (<tag> (list\each recur environment) quantified)]) + [{<tag> environment quantified} + {<tag> (list\each recur environment) quantified}]) ([#.UnivQ] [#.ExQ]) _ @@ -213,26 +214,26 @@ (def: (record' record_size target originalT inferT) (-> Nat Nat Type Type (Operation Type)) (case inferT - (#.Named name unnamedT) + {#.Named name unnamedT} (record' record_size target originalT unnamedT) (^template [<tag>] - [(<tag> env bodyT) + [{<tag> env bodyT} (do ///.monad [bodyT+ (record' record_size (n.+ 2 target) originalT bodyT)] - (in (<tag> env bodyT+)))]) + (in {<tag> env bodyT+}))]) ([#.UnivQ] [#.ExQ]) - (#.Apply inputT funcT) + {#.Apply inputT funcT} (case (type.applied (list inputT) funcT) - (#.Some outputT) + {#.Some outputT} (record' record_size target originalT outputT) #.None (/.except ..invalid_type_application inferT)) - (#.Product _) + {#.Product _} (let [[lefts right] (list.split_at (-- record_size) (type.flat_tuple inferT))] (///\in (|> inferT (type.function (list\composite lefts (list (type.tuple right)))) @@ -251,20 +252,20 @@ (loop [depth 0 currentT inferT] (case currentT - (#.Named name unnamedT) + {#.Named name unnamedT} (do ///.monad [unnamedT+ (recur depth unnamedT)] (in unnamedT+)) (^template [<tag>] - [(<tag> env bodyT) + [{<tag> env bodyT} (do ///.monad [bodyT+ (recur (++ depth) bodyT)] - (in (<tag> env bodyT+)))]) + (in {<tag> env bodyT+}))]) ([#.UnivQ] [#.ExQ]) - (#.Sum _) + {#.Sum _} (let [cases (type.flat_variant currentT) actual_size (list.size cases) boundary (-- expected_size)] @@ -272,7 +273,7 @@ (and (n.> expected_size actual_size) (n.< boundary tag))) (case (list.item tag cases) - (#.Some caseT) + {#.Some caseT} (///\in (if (n.= 0 depth) (type.function (list caseT) currentT) (let [replace' (replace (|> depth -- (n.* 2)) inferT)] @@ -296,9 +297,9 @@ ... else (/.except ..variant_tag_out_of_bounds [expected_size tag inferT]))) - (#.Apply inputT funcT) + {#.Apply inputT funcT} (case (type.applied (list inputT) funcT) - (#.Some outputT) + {#.Some outputT} (variant tag expected_size outputT) #.None diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux index 31ace4429..84124d32f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux @@ -44,19 +44,19 @@ (exception.report ["Definition" (%.name name)] ["Original" (case already_existing - (#.Alias alias) + {#.Alias alias} (format "alias " (%.name alias)) - (#.Definition definition) + {#.Definition definition} (format "definition " (%.name name)) - (#.Type _) + {#.Type _} (format "type " (%.name name)) - (#.Label _) + {#.Label _} (format "tag " (%.name name)) - (#.Slot _) + {#.Slot _} (format "slot " (%.name name)))])) (exception: .public (can_only_change_state_of_active_module [module Text @@ -82,14 +82,14 @@ (do ///.monad [self_name meta.current_module_name] (function (_ state) - (#try.Success [(revised@ #.modules + {#try.Success [(revised@ #.modules (plist.revised self_name (revised@ #.imports (function (_ current) (if (list.any? (text\= module) current) current - (#.Item module current))))) + {#.Item module current})))) state) - []]))))) + []]})))) (def: .public (alias alias module) (-> Text Text (Operation Any)) @@ -97,11 +97,11 @@ (do ///.monad [self_name meta.current_module_name] (function (_ state) - (#try.Success [(revised@ #.modules + {#try.Success [(revised@ #.modules (plist.revised self_name (revised@ #.module_aliases (: (-> (List [Text Text]) (List [Text Text])) - (|>> (#.Item [alias module]))))) + (|>> {#.Item [alias module]})))) state) - []]))))) + []]})))) (def: .public (exists? module) (-> Text (Operation Bit)) @@ -110,8 +110,8 @@ (|> state (value@ #.modules) (plist.value module) - (case> (#.Some _) #1 #.None #0) - [state] #try.Success)))) + (case> {#.Some _} #1 #.None #0) + [state] {#try.Success})))) (def: .public (define name definition) (-> Text Global (Operation Any)) @@ -122,26 +122,26 @@ (function (_ state) (case (plist.value name (value@ #.definitions self)) #.None - (#try.Success [(revised@ #.modules + {#try.Success [(revised@ #.modules (plist.has self_name (revised@ #.definitions (: (-> (List [Text Global]) (List [Text Global])) - (|>> (#.Item [name definition]))) + (|>> {#.Item [name definition]})) self)) state) - []]) + []]} - (#.Some already_existing) + {#.Some already_existing} ((/.except' ..cannot_define_more_than_once [[self_name name] already_existing]) state)))))) (def: .public (create hash name) (-> Nat Text (Operation Any)) (///extension.lifted (function (_ state) - (#try.Success [(revised@ #.modules + {#try.Success [(revised@ #.modules (plist.has name (..empty hash)) state) - []])))) + []]}))) (def: .public (with_module hash name action) (All (_ a) (-> Nat Text (Operation a) (Operation [Module a]))) @@ -158,15 +158,15 @@ (///extension.lifted (function (_ state) (case (|> state (value@ #.modules) (plist.value module_name)) - (#.Some module) + {#.Some module} (let [active? (case (value@ #.module_state module) #.Active #1 _ #0)] (if active? - (#try.Success [(revised@ #.modules + {#try.Success [(revised@ #.modules (plist.has module_name (with@ #.module_state <tag> module)) state) - []]) + []]} ((/.except' can_only_change_state_of_active_module [module_name <tag>]) state))) @@ -178,11 +178,11 @@ (///extension.lifted (function (_ state) (case (|> state (value@ #.modules) (plist.value module_name)) - (#.Some module) - (#try.Success [state + {#.Some module} + {#try.Success [state (case (value@ #.module_state module) <tag> #1 - _ #0)]) + _ #0)]} #.None ((/.except' unknown_module module_name) state)))))] @@ -197,8 +197,8 @@ (///extension.lifted (function (_ state) (case (|> state (value@ #.modules) (plist.value module_name)) - (#.Some module) - (#try.Success [state (value@ #.module_hash module)]) + {#.Some module} + {#try.Success [state (value@ #.module_hash module)]} #.None ((/.except' unknown_module module_name) state))))) @@ -208,7 +208,7 @@ (do [! ///.monad] [self_name (///extension.lifted meta.current_module_name) [type_module type_name] (case type - (#.Named type_name _) + {#.Named type_name _} (in type_name) _ @@ -218,6 +218,6 @@ (monad.each ! (function (_ [index short]) (..define (format "#" short) (if record? - (#.Slot [exported? type tags index]) - (#.Label [exported? type tags index])))) + {#.Slot [exported? type tags index]} + {#.Label [exported? type tags index]}))) (list.enumeration tags)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index 17b41ba71..ad481b931 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -16,7 +16,7 @@ (-> <type> (Operation Analysis)) (do ///.monad [_ (//type.infer <type>)] - (in (#/.Primitive (<tag> value)))))] + (in {#/.Primitive {<tag> value}})))] [bit .Bit #/.Bit] [nat .Nat #/.Nat] @@ -30,4 +30,4 @@ (Operation Analysis) (do ///.monad [_ (//type.infer .Any)] - (in (#/.Primitive #/.Unit)))) + (in {#/.Primitive #/.Unit}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux index f3bc9d282..26946da08 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -40,10 +40,10 @@ (do [! ///.monad] [constant (///extension.lifted (meta.definition def_name))] (case constant - (#.Alias real_def_name) + {#.Alias real_def_name} (definition real_def_name) - (#.Definition [exported? actualT _]) + {#.Definition [exported? actualT _]} (do ! [_ (//type.infer actualT) (^@ def_name [::module ::name]) (///extension.lifted (meta.normal def_name)) @@ -58,7 +58,7 @@ (/.except foreign_module_has_not_been_imported [current ::module]))) (/.except definition_has_not_been_exported def_name)))) - (#.Type [exported? value labels]) + {#.Type [exported? value labels]} (do ! [_ (//type.infer .Type) (^@ def_name [::module ::name]) (///extension.lifted (meta.normal def_name)) @@ -73,10 +73,10 @@ (/.except foreign_module_has_not_been_imported [current ::module]))) (/.except definition_has_not_been_exported def_name)))) - (#.Label _) + {#.Label _} (/.except labels_are_not_definitions [def_name]) - (#.Slot _) + {#.Slot _} (/.except labels_are_not_definitions [def_name]))))) (def: (variable var_name) @@ -84,10 +84,10 @@ (do [! ///.monad] [?var (//scope.find var_name)] (case ?var - (#.Some [actualT ref]) + {#.Some [actualT ref]} (do ! [_ (//type.infer actualT)] - (in (#.Some (|> ref ///reference.variable #/.Reference)))) + (in {#.Some (|> ref ///reference.variable #/.Reference)})) #.None (in #.None)))) @@ -99,7 +99,7 @@ (do [! ///.monad] [?var (variable simple_name)] (case ?var - (#.Some varA) + {#.Some varA} (in varA) #.None diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux index aa452e685..2b3e9f411 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux @@ -41,7 +41,7 @@ (value@ [#.locals #.mappings]) (plist.value name) (maybe\each (function (_ [type value]) - [type (#variable.Local value)])))) + [type {#variable.Local value}])))) (def: (captured? name scope) (-> Text Scope Bit) @@ -54,9 +54,9 @@ (loop [idx 0 mappings (value@ [#.captured #.mappings] scope)] (case mappings - (#.Item [_name [_source_type _source_ref]] mappings') + {#.Item [_name [_source_type _source_ref]] mappings'} (if (text\= name _name) - (#.Some [_source_type (#variable.Foreign idx)]) + {#.Some [_source_type {#variable.Foreign idx}]} (recur (++ idx) mappings')) #.End @@ -70,8 +70,8 @@ (def: (reference name scope) (-> Text Scope (Maybe [Type Variable])) (case (..local name scope) - (#.Some type) - (#.Some type) + {#.Some type} + {#.Some type} _ (..captured name scope))) @@ -85,25 +85,25 @@ (list.split_when (|>> (reference? name))))] (case outer #.End - (#.Right [state #.None]) + {#.Right [state #.None]} - (#.Item top_outer _) + {#.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 (value@ [#.captured #.counter] scope)) - (#.Item (revised@ #.captured + [{#variable.Foreign (value@ [#.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))])) + (product.right ref+inner)}])) [init_ref #.End] (list.reversed inner)) scopes (list\composite inner' outer)] - (#.Right [(with@ #.scopes scopes state) - (#.Some [ref_type ref])])) + {#.Right [(with@ #.scopes scopes state) + {#.Some [ref_type ref]}]}) ))))) (exception: .public cannot_create_local_binding_without_a_scope) @@ -113,7 +113,7 @@ (All (_ a) (-> [Text Type] (Operation a) (Operation a))) (function (_ [bundle state]) (case (value@ #.scopes state) - (#.Item head tail) + {#.Item head tail} (let [old_mappings (value@ [#.locals #.mappings] head) new_var_id (value@ [#.locals #.counter] head) new_head (revised@ #.locals @@ -121,21 +121,21 @@ (|>> (revised@ #.counter ++) (revised@ #.mappings (plist.has name [type new_var_id])))) head)] - (case (///.result' [bundle (with@ #.scopes (#.Item new_head tail) state)] + (case (///.result' [bundle (with@ #.scopes {#.Item new_head tail} state)] action) - (#try.Success [[bundle' state'] output]) + {#try.Success [[bundle' state'] output]} (case (value@ #.scopes state') - (#.Item head' tail') - (let [scopes' (#.Item (with@ #.locals (value@ #.locals head) head') - tail')] - (#try.Success [[bundle' (with@ #.scopes scopes' state')] - output])) + {#.Item head' tail'} + (let [scopes' {#.Item (with@ #.locals (value@ #.locals head) head') + tail'}] + {#try.Success [[bundle' (with@ #.scopes scopes' state')] + output]}) _ (exception.except ..invalid_scope_alteration [])) - (#try.Failure error) - (#try.Failure error))) + {#try.Failure error} + {#try.Failure error})) _ (exception.except ..cannot_create_local_binding_without_a_scope [])) @@ -165,19 +165,19 @@ #.End (list) - (#.Item top _) + {#.Item top _} (value@ #.name top))] (case (action [bundle (revised@ #.scopes - (|>> (#.Item (scope parent_name name))) + (|>> {#.Item (scope parent_name name)}) state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (revised@ #.scopes + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' (revised@ #.scopes (|>> list.tail (maybe.else (list))) state')] - output]) + output]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (exception: .public cannot_get_next_reference_when_there_is_no_scope) @@ -186,8 +186,8 @@ (///extension.lifted (function (_ state) (case (value@ #.scopes state) - (#.Item top _) - (#try.Success [state (value@ [#.locals #.counter] top)]) + {#.Item top _} + {#try.Success [state (value@ [#.locals #.counter] top)]} #.End (exception.except ..cannot_get_next_reference_when_there_is_no_scope []))))) @@ -195,11 +195,11 @@ (def: (ref_variable ref) (-> Ref Variable) (case ref - (#.Local register) - (#variable.Local register) + {#.Local register} + {#variable.Local register} - (#.Captured register) - (#variable.Foreign register))) + {#.Captured register} + {#variable.Foreign register})) (def: .public (environment scope) (-> Scope (List Variable)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux index f6c226e9a..417fe9709 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -113,10 +113,10 @@ (check.clean expectedT))] (/.with_stack ..cannot_analyse_variant [expectedT' tag valueC] (case expectedT - (#.Sum _) + {#.Sum _} (let [flat (type.flat_variant expectedT)] (case (list.item tag flat) - (#.Some variant_type) + {#.Some variant_type} (do ! [valueA (//type.with_type variant_type (analyse archive valueC))] @@ -125,16 +125,16 @@ #.None (/.except //inference.variant_tag_out_of_bounds [(list.size flat) tag expectedT]))) - (#.Named name unnamedT) + {#.Named name unnamedT} (//type.with_type unnamedT (recur valueC)) - (#.Var id) + {#.Var id} (do ! [?expectedT' (//type.with_env (check.peek id))] (case ?expectedT' - (#.Some expectedT') + {#.Some expectedT'} (//type.with_type expectedT' (recur valueC)) @@ -145,7 +145,7 @@ (/.except ..cannot_infer_numeric_tag [expectedT tag valueC]))) (^template [<tag> <instancer>] - [(<tag> _) + [{<tag> _} (do ! [[instance_id instanceT] (//type.with_env <instancer>)] (//type.with_type (maybe.trusted (type.applied (list instanceT) expectedT)) @@ -153,15 +153,15 @@ ([#.UnivQ check.existential] [#.ExQ check.var]) - (#.Apply inputT funT) + {#.Apply inputT funT} (case funT - (#.Var funT_id) + {#.Var funT_id} (do ! [?funT' (//type.with_env (check.peek funT_id))] (case ?funT' - (#.Some funT') - (//type.with_type (#.Apply inputT funT') + {#.Some funT'} + (//type.with_type {#.Apply inputT funT'} (recur valueC)) _ @@ -169,7 +169,7 @@ _ (case (type.applied (list inputT) funT) - (#.Some outputT) + {#.Some outputT} (//type.with_type outputT (recur valueC)) @@ -187,26 +187,26 @@ (loop [membersT+ (type.flat_tuple expectedT) membersC+ members] (case [membersT+ membersC+] - [(#.Item memberT #.End) (#.Item memberC #.End)] + [{#.Item memberT #.End} {#.Item memberC #.End}] (do ! [memberA (//type.with_type memberT (analyse archive memberC))] (in (list memberA))) - [(#.Item memberT #.End) _] + [{#.Item memberT #.End} _] (//type.with_type memberT (\ ! each (|>> list) (analyse archive (code.tuple membersC+)))) - [_ (#.Item memberC #.End)] + [_ {#.Item memberC #.End}] (//type.with_type (type.tuple membersT+) (\ ! each (|>> list) (analyse archive memberC))) - [(#.Item memberT membersT+') (#.Item memberC membersC+')] + [{#.Item memberT membersT+'} {#.Item memberC membersC+'}] (do ! [memberA (//type.with_type memberT (analyse archive memberC)) memberA+ (recur membersT+' membersC+')] - (in (#.Item memberA memberA+))) + (in {#.Item memberA memberA+})) _ (/.except ..cannot_analyse_tuple [expectedT members]))))] @@ -218,19 +218,19 @@ [expectedT (///extension.lifted meta.expected_type)] (/.with_stack ..cannot_analyse_tuple [expectedT membersC] (case expectedT - (#.Product _) + {#.Product _} (..typed_product archive analyse membersC) - (#.Named name unnamedT) + {#.Named name unnamedT} (//type.with_type unnamedT (product archive analyse membersC)) - (#.Var id) + {#.Var id} (do ! [?expectedT' (//type.with_env (check.peek id))] (case ?expectedT' - (#.Some expectedT') + {#.Some expectedT'} (//type.with_type expectedT' (product archive analyse membersC)) @@ -245,7 +245,7 @@ (in (/.tuple (list\each product.right membersTA)))))) (^template [<tag> <instancer>] - [(<tag> _) + [{<tag> _} (do ! [[instance_id instanceT] (//type.with_env <instancer>)] (//type.with_type (maybe.trusted (type.applied (list instanceT) expectedT)) @@ -253,15 +253,15 @@ ([#.UnivQ check.existential] [#.ExQ check.var]) - (#.Apply inputT funT) + {#.Apply inputT funT} (case funT - (#.Var funT_id) + {#.Var funT_id} (do ! [?funT' (//type.with_env (check.peek funT_id))] (case ?funT' - (#.Some funT') - (//type.with_type (#.Apply inputT funT') + {#.Some funT'} + (//type.with_type {#.Apply inputT funT'} (product archive analyse membersC)) _ @@ -269,7 +269,7 @@ _ (case (type.applied (list inputT) funT) - (#.Some outputT) + {#.Some outputT} (//type.with_type outputT (product archive analyse membersC)) @@ -289,7 +289,7 @@ [lefts right?] (/.choice case_size idx)] expectedT (///extension.lifted meta.expected_type)] (case expectedT - (#.Var _) + {#.Var _} (do ! [inferenceT (//inference.variant idx case_size variantT) [inferredT valueA+] (//inference.general archive analyse inferenceT (list valueC))] @@ -308,13 +308,13 @@ output (: (List [Name Code]) #.End)] (case input - (^ (list& [_ (#.Tag slotH)] valueH tail)) + (^ (list& [_ {#.Tag slotH}] valueH tail)) (do ///.monad [slotH (///extension.lifted (meta.normal slotH))] - (recur tail (#.Item [slotH valueH] output))) + (recur tail {#.Item [slotH valueH] output})) #.End - (\ ///.monad in (#.Some output)) + (\ ///.monad in {#.Some output}) _ (\ ///.monad in #.None)))) @@ -327,16 +327,16 @@ (case record ... empty_record = empty_tuple = unit/any = [] #.End - (\ ///.monad in (#.Some [0 (list) Any])) + (\ ///.monad in {#.Some [0 (list) Any]}) - (#.Item [head_k head_v] _) + {#.Item [head_k head_v] _} (do [! ///.monad] [slotH' (///extension.lifted (do meta.monad [head_k (meta.normal head_k)] (meta.try (meta.slot head_k))))] (case slotH' - (#try.Success [_ slot_set recordT]) + {#try.Success [_ slot_set recordT]} (do ! [.let [size_record (list.size record) size_ts (list.size slot_set)] @@ -350,7 +350,7 @@ (do ! [key (///extension.lifted (meta.normal key))] (case (dictionary.value key tag->idx) - (#.Some idx) + {#.Some idx} (if (dictionary.key? idx->val idx) (/.except ..cannot_repeat_tag [key record]) (in (dictionary.has idx val idx->val))) @@ -363,9 +363,9 @@ .let [ordered_tuple (list\each (function (_ idx) (maybe.trusted (dictionary.value idx idx->val))) tuple_range)]] - (in (#.Some [size_ts ordered_tuple recordT]))) + (in {#.Some [size_ts ordered_tuple recordT]})) - (#try.Failure error) + {#try.Failure error} (in #.None))) )) @@ -378,12 +378,12 @@ (^ (list singletonC)) (analyse archive singletonC) - (^ (list [_ (#.Tag pseudo_slot)] singletonC)) + (^ (list [_ {#.Tag pseudo_slot}] singletonC)) (do [! ///.monad] [head_k (///extension.lifted (meta.normal pseudo_slot)) slot (///extension.lifted (meta.try (meta.slot head_k)))] (case slot - (#try.Success [_ slot_set recordT]) + {#try.Success [_ slot_set recordT]} (case (list.size slot_set) 1 (analyse archive singletonC) _ (..product archive analyse members)) @@ -398,18 +398,18 @@ #.None (..product archive analyse members) - (#.Some slots) + {#.Some slots} (do ! [record_size,membersC,recordT (..order slots)] (case record_size,membersC,recordT #.None (..product archive analyse members) - (#.Some [record_size membersC recordT]) + {#.Some [record_size membersC recordT]} (do ! [expectedT (///extension.lifted meta.expected_type)] (case expectedT - (#.Var _) + {#.Var _} (do ! [inferenceT (//inference.record record_size recordT) [inferredT membersA] (//inference.general archive analyse inferenceT membersC)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux index 7a5bde817..33a8715d5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/type.lux @@ -19,17 +19,17 @@ (def: .public (with_type expected) (All (_ a) (-> Type (Operation a) (Operation a))) (///extension.localized (value@ #.expected) (with@ #.expected) - (function.constant (#.Some expected)))) + (function.constant {#.Some expected}))) (def: .public (with_env action) (All (_ a) (-> (Check a) (Operation a))) (function (_ (^@ stateE [bundle state])) (case (action (value@ #.type_context state)) - (#try.Success [context' output]) - (#try.Success [[bundle (with@ #.type_context context' state)] - output]) + {#try.Success [context' output]} + {#try.Success [[bundle (with@ #.type_context context' state)] + output]} - (#try.Failure error) + {#try.Failure error} ((/.failure error) stateE)))) (def: .public with_fresh_env 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 3d3163553..dc47f7039 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 @@ -48,13 +48,13 @@ Eval) (function (_ type code lux) (case (compiler_eval archive type code [bundle lux]) - (#try.Success [[_bundle lux'] value]) - (#try.Success [lux' value]) + {#try.Success [[_bundle lux'] value]} + {#try.Success [lux' value]} - (#try.Failure error) - (#try.Failure error)))) + {#try.Failure error} + {#try.Failure error}))) -(with_expansions [<lux_def_module> (as_is [|form_location| (#.Form (list& [|text_location| (#.Text "lux def module")] annotations))])] +(with_expansions [<lux_def_module> (as_is [|form_location| {#.Form (list& [|text_location| {#.Text "lux def module"}] annotations)}])] (def: .public (phase wrapper expander) (-> //.Wrapper Expander Phase) (let [analysis (//analysis.phase expander)] @@ -70,10 +70,10 @@ extension_eval (:as Eval (wrapper (:expected compiler_eval)))] _ (//.set_state (with@ [#//extension.state #/.analysis #/.state #//extension.state #.eval] extension_eval state))] (case code - (^ [_ (#.Form (list& [_ (#.Text name)] inputs))]) + (^ [_ {#.Form (list& [_ {#.Text name}] inputs)}]) (//extension.apply archive recur [name inputs]) - (^ [_ (#.Form (list& macro inputs))]) + (^ [_ {#.Form (list& macro inputs)}]) (do ! [expansion (/.lifted_analysis (do ! @@ -84,7 +84,7 @@ (do ! [?macro (//extension.lifted (meta.macro macro_name)) macro (case ?macro - (#.Some macro) + {#.Some macro} (in macro) #.None diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux index d54049e4e..2fd695eef 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux @@ -98,8 +98,8 @@ (function (_ [bundle state]) (case (dictionary.value name bundle) #.None - (#try.Success [[(dictionary.has name (extender handler) bundle) state] - []]) + {#try.Success [[(dictionary.has name (extender handler) bundle) state] + []]} _ (exception.except ..cannot_overwrite name)))) @@ -119,7 +119,7 @@ (-> Archive (Phase s i o) (Extension i) (Operation s i o o))) (function (_ (^@ stateE [bundle state])) (case (dictionary.value name bundle) - (#.Some handler) + {#.Some handler} (((handler name phase) archive parameters) stateE) @@ -134,11 +134,11 @@ (function (_ [bundle state]) (let [old (get state)] (case (operation [bundle (set (transform old) state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' (set old state')] output]) + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' (set old state')] output]} - (#try.Failure error) - (#try.Failure error)))))) + {#try.Failure error} + {#try.Failure error}))))) (def: .public (temporary transform) (All (_ s i o v) @@ -147,11 +147,11 @@ (function (_ operation) (function (_ [bundle state]) (case (operation [bundle (transform state)]) - (#try.Success [[bundle' state'] output]) - (#try.Success [[bundle' state] output]) + {#try.Success [[bundle' state'] output]} + {#try.Success [[bundle' state] output]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (def: .public (with_state state) (All (_ s i o v) @@ -162,13 +162,13 @@ (All (_ s i o v) (-> (-> s v) (Operation s i o v))) (function (_ [bundle state]) - (#try.Success [[bundle state] (get state)]))) + {#try.Success [[bundle state] (get state)]})) (def: .public (update transform) (All (_ s i o) (-> (-> s s) (Operation s i o Any))) (function (_ [bundle state]) - (#try.Success [[bundle (transform state)] []]))) + {#try.Success [[bundle (transform state)] []]})) (def: .public (lifted action) (All (_ s i o v) @@ -176,8 +176,8 @@ (//.Operation [(Bundle s i o) s] v))) (function (_ [bundle state]) (case (action state) - (#try.Success [state' output]) - (#try.Success [[bundle state'] output]) + {#try.Success [state' output]} + {#try.Success [[bundle state'] output]} - (#try.Failure error) - (#try.Failure error)))) + {#try.Failure error} + {#try.Failure error}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index 66b58bf74..36578eb15 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list lengthA)))))])) + (in {#analysis.Extension extension (list lengthA)})))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (in (#analysis.Extension extension (list arrayA)))))])) + (in {#analysis.Extension extension (list arrayA)})))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in {#analysis.Extension extension (list indexA valueA arrayA)})))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: bundle::array Bundle @@ -117,7 +117,7 @@ (phase archive constructorC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& constructorA inputsA)))))])) + (in {#analysis.Extension extension (list& constructorA inputsA)})))])) (def: object::get Handler @@ -128,8 +128,8 @@ [objectA (analysis/type.with_type Any (phase archive objectC)) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in {#analysis.Extension extension (list (analysis.text fieldC) + objectA)})))])) (def: object::do Handler @@ -141,9 +141,9 @@ (phase archive objectC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& (analysis.text methodC) + (in {#analysis.Extension extension (list& (analysis.text methodC) objectA - inputsA)))))])) + inputsA)})))])) (def: bundle::object Bundle @@ -165,7 +165,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: js::apply Handler @@ -177,7 +177,7 @@ (phase archive abstractionC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in {#analysis.Extension extension (list& abstractionA inputsA)})))])) (def: js::type_of Handler @@ -188,7 +188,7 @@ [objectA (analysis/type.with_type Any (phase archive objectC)) _ (analysis/type.infer .Text)] - (in (#analysis.Extension extension (list objectA)))))])) + (in {#analysis.Extension extension (list objectA)})))])) (def: js::function Handler @@ -201,8 +201,8 @@ (phase archive abstractionC)) _ (analysis/type.infer (for [@.js ffi.Function] Any))] - (in (#analysis.Extension extension (list (analysis.nat arity) - abstractionA)))))])) + (in {#analysis.Extension extension (list (analysis.nat arity) + abstractionA)})))])) (def: .public bundle Bundle 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 9ea592c20..bc9151306 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 @@ -161,13 +161,13 @@ (def: inheritance_relationship_type_name "_jvm_inheritance") (def: .public (inheritance_relationship_type class super_class super_interfaces) (-> .Type .Type (List .Type) .Type) - (#.Primitive ..inheritance_relationship_type_name - (list& class super_class super_interfaces))) + {#.Primitive ..inheritance_relationship_type_name + (list& class super_class super_interfaces)}) ... TODO: Get rid of this template block and use the definition in ... lux/ffi.jvm.lux ASAP (template [<name> <class>] - [(def: .public <name> .Type (#.Primitive <class> #.End))] + [(def: .public <name> .Type {#.Primitive <class> #.End})] ... Boxes [Boolean box.boolean] @@ -355,23 +355,23 @@ (def: (jvm_type luxT) (-> .Type (Operation (Type Value))) (case luxT - (#.Named name anonymousT) + {#.Named name anonymousT} (jvm_type anonymousT) - (#.Apply inputT abstractionT) + {#.Apply inputT abstractionT} (case (type.applied (list inputT) abstractionT) - (#.Some outputT) + {#.Some outputT} (jvm_type outputT) #.None (/////analysis.except ..non_jvm_type luxT)) - (^ (#.Primitive (static array.type_name) (list elemT))) + (^ {#.Primitive (static array.type_name) (list elemT)}) (phase\each jvm.array (jvm_type elemT)) - (#.Primitive class parametersT) + {#.Primitive class parametersT} (case (dictionary.value class ..boxes) - (#.Some [_ primitive_type]) + {#.Some [_ primitive_type]} (case parametersT #.End (phase\in primitive_type) @@ -387,7 +387,7 @@ (do phase.monad [parameterJT (jvm_type parameterT)] (case (jvm_parser.parameter? parameterJT) - (#.Some parameterJT) + {#.Some parameterJT} (in parameterJT) #.None @@ -395,7 +395,7 @@ parametersT))] (in (jvm.class class parametersJT)))) - (#.Ex _) + {#.Ex _} (phase\in (jvm.class ..object_class (list))) _ @@ -417,11 +417,11 @@ (^ (list arrayC)) (do phase.monad [_ (typeA.infer ..int) - arrayA (typeA.with_type (#.Primitive (|> (jvm.array primitive_type) + arrayA (typeA.with_type {#.Primitive (|> (jvm.array primitive_type) ..reflection) - (list)) + (list)} (analyse archive arrayC))] - (in (#/////analysis.Extension extension_name (list arrayA)))) + (in {#/////analysis.Extension extension_name (list arrayA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -438,8 +438,8 @@ (analyse archive arrayC)) varT (typeA.with_env (check.clean varT)) arrayJT (jvm_array_type (.type (array.Array varT)))] - (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) - arrayA)))) + (in {#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) + arrayA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -452,9 +452,9 @@ (do phase.monad [lengthA (typeA.with_type ..int (analyse archive lengthC)) - _ (typeA.infer (#.Primitive (|> (jvm.array primitive_type) ..reflection) - (list)))] - (in (#/////analysis.Extension extension_name (list lengthA)))) + _ (typeA.infer {#.Primitive (|> (jvm.array primitive_type) ..reflection) + (list)})] + (in {#/////analysis.Extension extension_name (list lengthA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -470,13 +470,13 @@ expectedT (///.lifted meta.expected_type) expectedJT (jvm_array_type expectedT) elementJT (case (jvm_parser.array? expectedJT) - (#.Some elementJT) + {#.Some elementJT} (in elementJT) #.None (/////analysis.except ..non_array expectedT))] - (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature elementJT)) - lengthA)))) + (in {#/////analysis.Extension extension_name (list (/////analysis.text (..signature elementJT)) + lengthA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -484,11 +484,11 @@ (def: (check_parameter objectT) (-> .Type (Operation (Type Parameter))) (case objectT - (^ (#.Primitive (static array.type_name) - (list elementT))) + (^ {#.Primitive (static array.type_name) + (list elementT)}) (/////analysis.except ..non_parameter objectT) - (#.Primitive name parameters) + {#.Primitive name parameters} (`` (cond (or (~~ (template [<type>] [(text\= (..reflection <type>) name)] @@ -506,24 +506,24 @@ ... else (phase\in (jvm.class name (list))))) - (#.Named name anonymous) + {#.Named name anonymous} (check_parameter anonymous) (^template [<tag>] - [(<tag> id) + [{<tag> id} (phase\in (jvm.class ..object_class (list)))]) ([#.Var] [#.Ex]) (^template [<tag>] - [(<tag> env unquantified) + [{<tag> env unquantified} (check_parameter unquantified)]) ([#.UnivQ] [#.ExQ]) - (#.Apply inputT abstractionT) + {#.Apply inputT abstractionT} (case (type.applied (list inputT) abstractionT) - (#.Some outputT) + {#.Some outputT} (check_parameter outputT) #.None @@ -535,7 +535,7 @@ (def: (check_jvm objectT) (-> .Type (Operation (Type Value))) (case objectT - (#.Primitive name #.End) + {#.Primitive name #.End} (`` (cond (~~ (template [<type>] [(text\= (..reflection <type>) name) (phase\in <type>)] @@ -565,34 +565,34 @@ (text.starts_with? descriptor.array_prefix name) (let [[_ unprefixed] (maybe.trusted (text.split_by descriptor.array_prefix name))] (\ phase.monad each jvm.array - (check_jvm (#.Primitive unprefixed (list))))) + (check_jvm {#.Primitive unprefixed (list)}))) ... else (phase\in (jvm.class name (list))))) - (^ (#.Primitive (static array.type_name) - (list elementT))) + (^ {#.Primitive (static array.type_name) + (list elementT)}) (|> elementT check_jvm (phase\each jvm.array)) - (#.Primitive name parameters) + {#.Primitive name parameters} (do [! phase.monad] [parameters (monad.each ! check_parameter parameters)] (phase\in (jvm.class name parameters))) - (#.Named name anonymous) + {#.Named name anonymous} (check_jvm anonymous) (^template [<tag>] - [(<tag> env unquantified) + [{<tag> env unquantified} (check_jvm unquantified)]) ([#.UnivQ] [#.ExQ]) - (#.Apply inputT abstractionT) + {#.Apply inputT abstractionT} (case (type.applied (list inputT) abstractionT) - (#.Some outputT) + {#.Some outputT} (check_jvm outputT) #.None @@ -624,10 +624,10 @@ [_ (typeA.infer lux_type) idxA (typeA.with_type ..int (analyse archive idxC)) - arrayA (typeA.with_type (#.Primitive (|> (jvm.array jvm_type) ..reflection) - (list)) + arrayA (typeA.with_type {#.Primitive (|> (jvm.array jvm_type) ..reflection) + (list)} (analyse archive arrayC))] - (in (#/////analysis.Extension extension_name (list idxA arrayA)))) + (in {#/////analysis.Extension extension_name (list idxA arrayA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) @@ -647,17 +647,17 @@ arrayJT (jvm_array_type (.type (array.Array varT))) idxA (typeA.with_type ..int (analyse archive idxC))] - (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) + (in {#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) idxA - arrayA)))) + arrayA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) (def: (write_primitive_array_handler lux_type jvm_type) (-> .Type (Type Primitive) Handler) - (let [array_type (#.Primitive (|> (jvm.array jvm_type) ..reflection) - (list))] + (let [array_type {#.Primitive (|> (jvm.array jvm_type) ..reflection) + (list)}] (function (_ extension_name analyse archive args) (case args (^ (list idxC valueC arrayC)) @@ -669,9 +669,9 @@ (analyse archive valueC)) arrayA (typeA.with_type array_type (analyse archive arrayC))] - (in (#/////analysis.Extension extension_name (list idxA + (in {#/////analysis.Extension extension_name (list idxA valueA - arrayA)))) + arrayA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 3 (list.size args)]))))) @@ -693,10 +693,10 @@ (analyse archive idxC)) valueA (typeA.with_type varT (analyse archive valueC))] - (in (#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) + (in {#/////analysis.Extension extension_name (list (/////analysis.text (..signature arrayJT)) idxA valueA - arrayA)))) + arrayA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 3 (list.size args)])))) @@ -759,7 +759,7 @@ (do phase.monad [expectedT (///.lifted meta.expected_type) _ (check_object expectedT)] - (in (#/////analysis.Extension extension_name (list)))) + (in {#/////analysis.Extension extension_name (list)})) _ (/////analysis.except ///.incorrect_arity [extension_name 0 (list.size args)])))) @@ -774,7 +774,7 @@ [objectT objectA] (typeA.with_inference (analyse archive objectC)) _ (check_object objectT)] - (in (#/////analysis.Extension extension_name (list objectA)))) + (in {#/////analysis.Extension extension_name (list objectA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -789,7 +789,7 @@ (analyse archive monitorC)) _ (check_object monitorT) exprA (analyse archive exprC)] - (in (#/////analysis.Extension extension_name (list monitorA exprA)))) + (in {#/////analysis.Extension extension_name (list monitorA exprA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 2 (list.size args)])))) @@ -809,7 +809,7 @@ (if ? (in []) (/////analysis.except non_throwable exception_class)))] - (in (#/////analysis.Extension extension_name (list exceptionA)))) + (in {#/////analysis.Extension extension_name (list exceptionA)})) _ (/////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -820,12 +820,12 @@ (case args (^ (list classC)) (case classC - [_ (#.Text class)] + [_ {#.Text class}] (do phase.monad [_ (..ensure_fresh_class! class_loader class) - _ (typeA.infer (#.Primitive "java.lang.Class" (list (#.Primitive class (list))))) + _ (typeA.infer {#.Primitive "java.lang.Class" (list {#.Primitive class (list)})}) _ (phase.lifted (reflection!.load class_loader class))] - (in (#/////analysis.Extension extension_name (list (/////analysis.text class))))) + (in {#/////analysis.Extension extension_name (list (/////analysis.text class))})) _ (/////analysis.except ///.invalid_syntax [extension_name %.code args])) @@ -846,18 +846,18 @@ object_class (check_object objectT) ? (phase.lifted (reflection!.sub? class_loader object_class sub_class))] (if ? - (in (#/////analysis.Extension extension_name (list (/////analysis.text sub_class) objectA))) + (in {#/////analysis.Extension extension_name (list (/////analysis.text sub_class) objectA)}) (/////analysis.except cannot_possibly_be_an_instance (format sub_class " !<= " object_class)))))])) (template [<name> <category> <parser>] [(def: .public (<name> mapping typeJ) (-> Mapping (Type <category>) (Operation .Type)) (case (|> typeJ ..signature (<text>.result (<parser> mapping))) - (#try.Success check) + {#try.Success check} (typeA.with_env check) - (#try.Failure error) + {#try.Failure error} (phase.failure error)))] [boxed_reflection_type Value luxT.boxed_type] @@ -880,19 +880,19 @@ superT (reflection_type mapping superJT)] (in [[super_name superT] (java/lang/Class::isAssignableFrom super_class target_class)]))) (case (java/lang/Class::getGenericSuperclass source_class) - (#.Some super) + {#.Some super} (list& super (array.list #.None (java/lang/Class::getGenericInterfaces source_class))) #.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)) - (array.list #.None (java/lang/Class::getGenericInterfaces source_class))) + {#.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))))))) (def: (inheritance_candidate_parents class_loader fromT target_class toT fromC) (-> java/lang/ClassLoader .Type (java/lang/Class java/lang/Object) .Type Code (Operation (List [[Text .Type] Bit]))) (case fromT - (^ (#.Primitive _ (list& self_classT super_classT super_interfacesT+))) + (^ {#.Primitive _ (list& self_classT super_classT super_interfacesT+)}) (monad.each phase.monad (function (_ superT) (do [! phase.monad] @@ -959,15 +959,15 @@ (case (|> candidate_parents (list.only product.right) (list\each product.left)) - (#.Item [next_name nextT] _) + {#.Item [next_name nextT] _} (recur [next_name nextT]) #.End (in false)))))))))] (if can_cast? - (in (#/////analysis.Extension extension_name (list (/////analysis.text source_name) + (in {#/////analysis.Extension extension_name (list (/////analysis.text source_name) (/////analysis.text target_name) - fromA))) + fromA)}) (/////analysis.except ..cannot_cast [fromT toT fromC]))) _ @@ -1001,7 +1001,7 @@ (not deprecated?)) fieldT (reflection_type luxT.fresh fieldJT) _ (typeA.infer fieldT)] - (in (<| (#/////analysis.Extension extension_name) + (in (<| {#/////analysis.Extension extension_name} (list (/////analysis.text class) (/////analysis.text field) (/////analysis.text (|> fieldJT ..reflection)))))))])) @@ -1025,7 +1025,7 @@ fieldT (reflection_type luxT.fresh fieldJT) valueA (typeA.with_type fieldT (analyse archive valueC))] - (in (<| (#/////analysis.Extension extension_name) + (in (<| {#/////analysis.Extension extension_name} (list (/////analysis.text class) (/////analysis.text field) valueA)))))])) @@ -1049,7 +1049,7 @@ (not deprecated?)) fieldT (reflection_type mapping fieldJT) _ (typeA.infer fieldT)] - (in (<| (#/////analysis.Extension extension_name) + (in (<| {#/////analysis.Extension extension_name} (list (/////analysis.text class) (/////analysis.text field) (/////analysis.text (..reflection fieldJT)) @@ -1078,7 +1078,7 @@ fieldT (reflection_type mapping fieldJT) valueA (typeA.with_type fieldT (analyse archive valueC))] - (in (<| (#/////analysis.Extension extension_name) + (in (<| {#/////analysis.Extension extension_name} (list (/////analysis.text class) (/////analysis.text field) (/////analysis.text (..reflection fieldJT)) @@ -1122,7 +1122,7 @@ (and prev (jvm\= expectedJC (: (Type Value) (case (jvm_parser.var? actualJC) - (#.Some name) + {#.Some name} (|> aliasing (dictionary.value name) (maybe.else name) @@ -1151,7 +1151,7 @@ (list.every? (function (_ [expectedJC actualJC]) (jvm\= expectedJC (: (Type Value) (case (jvm_parser.var? actualJC) - (#.Some name) + {#.Some name} (|> aliasing (dictionary.value name) (maybe.else name) @@ -1217,7 +1217,7 @@ inputsT _ - (list& (#.Primitive (java/lang/Class::getName owner) owner_tvarsT) + (list& {#.Primitive (java/lang/Class::getName owner) owner_tvarsT} inputsT))) outputT)]] (in [methodT @@ -1245,7 +1245,7 @@ (monad.each ! (|>> reflection!.type phase.lifted)) (phase\each (monad.each ! (reflection_type mapping))) phase\conjoint) - .let [objectT (#.Primitive (java/lang/Class::getName owner) owner_tvarsT) + .let [objectT {#.Primitive (java/lang/Class::getName owner) owner_tvarsT} constructorT (<| (type.univ_q (dictionary.size mapping)) (type.function inputsT) objectT)]] @@ -1255,14 +1255,14 @@ (type: Evaluation (Variant - (#Pass Method_Signature) - (#Hint Method_Signature))) + {#Pass Method_Signature} + {#Hint Method_Signature})) (template [<name> <tag>] [(def: <name> (-> Evaluation (Maybe Method_Signature)) - (|>> (case> (<tag> output) - (#.Some output) + (|>> (case> {<tag> output} + {#.Some output} _ #.None)))] @@ -1310,7 +1310,7 @@ (|>> #Hint)) (method_signature method_style method)))))))] (case (list.all pass! candidates) - (#.Item method #.End) + {#.Item method #.End} (in method) #.End @@ -1340,7 +1340,7 @@ (if passes? (|>> #Pass) (|>> #Hint)) (constructor_signature constructor))))))] (case (list.all pass! candidates) - (#.Item constructor #.End) + {#.Item constructor #.End} (in constructor) #.End @@ -1387,10 +1387,10 @@ (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list\each product.right argsTC)) outputJT (check_return outputT)] - (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (in {#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) (/////analysis.text method) (/////analysis.text (..signature outputJT)) - (decorate_inputs argsT argsA))))))])) + (decorate_inputs argsT argsA))})))])) (def: (invoke::virtual class_loader) (-> java/lang/ClassLoader Handler) @@ -1405,17 +1405,17 @@ (not deprecated?)) [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\each product.right argsTC))) .let [[objectA argsA] (case allA - (#.Item objectA argsA) + {#.Item objectA argsA} [objectA argsA] _ (undefined))] outputJT (check_return outputT)] - (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (in {#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) (/////analysis.text method) (/////analysis.text (..signature outputJT)) objectA - (decorate_inputs argsT argsA))))))])) + (decorate_inputs argsT argsA))})))])) (def: (invoke::special class_loader) (-> java/lang/ClassLoader Handler) @@ -1430,10 +1430,10 @@ (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list& objectC (list\each product.right argsTC))) outputJT (check_return outputT)] - (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (in {#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) (/////analysis.text method) (/////analysis.text (..signature outputJT)) - (decorate_inputs argsT argsA))))))])) + (decorate_inputs argsT argsA))})))])) (def: (invoke::interface class_loader) (-> java/lang/ClassLoader Handler) @@ -1451,18 +1451,18 @@ (not deprecated?)) [outputT allA] (inferenceA.general archive analyse methodT (list& objectC (list\each product.right argsTC))) .let [[objectA argsA] (case allA - (#.Item objectA argsA) + {#.Item objectA argsA} [objectA argsA] _ (undefined))] outputJT (check_return outputT)] - (in (#/////analysis.Extension extension_name - (list& (/////analysis.text (..signature (jvm.class class_name (list)))) - (/////analysis.text method) - (/////analysis.text (..signature outputJT)) - objectA - (decorate_inputs argsT argsA))))))])) + (in {#/////analysis.Extension extension_name + (list& (/////analysis.text (..signature (jvm.class class_name (list)))) + (/////analysis.text method) + (/////analysis.text (..signature outputJT)) + objectA + (decorate_inputs argsT argsA))})))])) (def: (invoke::constructor class_loader) (-> java/lang/ClassLoader Handler) @@ -1476,8 +1476,8 @@ _ (phase.assertion ..deprecated_method [class ..constructor_method methodT] (not deprecated?)) [outputT argsA] (inferenceA.general archive analyse methodT (list\each product.right argsTC))] - (in (#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) - (decorate_inputs argsT argsA))))))])) + (in {#/////analysis.Extension extension_name (list& (/////analysis.text (..signature (jvm.class class (list)))) + (decorate_inputs argsT argsA))})))])) (def: (bundle::member class_loader) (-> java/lang/ClassLoader Bundle) @@ -1693,7 +1693,7 @@ (in [name luxT]))) arguments) [scope bodyA] (|> arguments' - (#.Item [self_name selfT]) + {#.Item [self_name selfT]} list.reversed (list\mix scope.with_local (analyse archive body)) (typeA.with_type .Any) @@ -1707,10 +1707,10 @@ (/////analysis.tuple (list\each ..argument_analysis arguments)) (/////analysis.tuple (list\each class_analysis exceptions)) (/////analysis.tuple (list\each typed_analysis super_arguments)) - (#/////analysis.Function + {#/////analysis.Function (list\each (|>> /////analysis.variable) (scope.environment scope)) - (/////analysis.tuple (list bodyA))) + (/////analysis.tuple (list bodyA))} )))))) (type: .public (Virtual_Method a) @@ -1769,7 +1769,7 @@ (in [name luxT]))) arguments) [scope bodyA] (|> arguments' - (#.Item [self_name selfT]) + {#.Item [self_name selfT]} list.reversed (list\mix scope.with_local (analyse archive body)) (typeA.with_type returnT) @@ -1785,10 +1785,10 @@ (/////analysis.tuple (list\each ..argument_analysis arguments)) (return_analysis return) (/////analysis.tuple (list\each class_analysis exceptions)) - (#/////analysis.Function + {#/////analysis.Function (list\each (|>> /////analysis.variable) (scope.environment scope)) - (/////analysis.tuple (list bodyA))) + (/////analysis.tuple (list bodyA))} )))))) (type: .public (Static_Method a) @@ -1857,10 +1857,10 @@ (return_analysis return) (/////analysis.tuple (list\each class_analysis exceptions)) - (#/////analysis.Function + {#/////analysis.Function (list\each (|>> /////analysis.variable) (scope.environment scope)) - (/////analysis.tuple (list bodyA))) + (/////analysis.tuple (list bodyA))} )))))) (type: .public (Overriden_Method a) @@ -1914,10 +1914,10 @@ (case (list.one (function (_ super) (let [[super_name super_parameters] (jvm_parser.read_class super)] (if (text\= parent_name super_name) - (#.Some super_parameters) + {#.Some super_parameters} #.None))) supers) - (#.Some super_parameters) + {#.Some super_parameters} (let [expected_count (list.size parent_parameters) actual_count (list.size super_parameters)] (if (n.= expected_count actual_count) @@ -1966,25 +1966,25 @@ bodyA 2 - (#/////analysis.Case (/////analysis.unit) - [[#/////analysis.when - (#/////analysis.Bind 2) + {#/////analysis.Case (/////analysis.unit) + [[#/////analysis.when + {#/////analysis.Bind 2} - #/////analysis.then - bodyA] - (list)]) + #/////analysis.then + bodyA] + (list)]} _ - (#/////analysis.Case (/////analysis.unit) - [[#/////analysis.when - (#/////analysis.Complex - (#/////analysis.Tuple (|> arity - list.indices - (list\each (|>> (n.+ 2) #/////analysis.Bind))))) + {#/////analysis.Case (/////analysis.unit) + [[#/////analysis.when + {#/////analysis.Complex + {#/////analysis.Tuple (|> arity + list.indices + (list\each (|>> (n.+ 2) #/////analysis.Bind)))}} - #/////analysis.then - bodyA] - (list)])))) + #/////analysis.then + bodyA] + (list)]}))) (def: .public (analyse_overriden_method analyse archive selfT mapping supers method) (-> Phase Archive .Type Mapping (List (Type Class)) (Overriden_Method Code) (Operation Analysis)) @@ -2012,7 +2012,7 @@ arguments) returnT (boxed_reflection_return mapping return) [scope bodyA] (|> arguments' - (#.Item [self_name selfT]) + {#.Item [self_name selfT]} list.reversed (list\mix scope.with_local (analyse archive body)) (typeA.with_type returnT) @@ -2028,15 +2028,15 @@ (return_analysis return) (/////analysis.tuple (list\each class_analysis exceptions)) - (#/////analysis.Function + {#/////analysis.Function (list\each (|>> /////analysis.variable) (scope.environment scope)) - (..hide_method_body (list.size arguments) bodyA)) + (..hide_method_body (list.size arguments) bodyA)} )))))) (type: .public (Method_Definition a) (Variant - (#Overriden_Method (Overriden_Method a)))) + {#Overriden_Method (Overriden_Method a)})) (def: .public parameter_types (-> (List (Type Var)) (Check (List [(Type Var) .Type]))) @@ -2082,7 +2082,7 @@ (in (|> (list.zipped/2 expected_parameters actual_parameters) (list\mix (function (_ [expected actual] mapping) (case (jvm_parser.var? actual) - (#.Some actual) + {#.Some actual} (dictionary.has actual expected mapping) #.None @@ -2154,7 +2154,7 @@ selfT (///.lifted (do meta.monad [where meta.current_module_name id meta.seed] - (in (inheritance_relationship_type (#.Primitive (..anonymous_class_name where id) (list)) + (in (inheritance_relationship_type {#.Primitive (..anonymous_class_name where id) (list)} super_classT super_interfaceT+)))) _ (typeA.infer selfT) @@ -2165,14 +2165,14 @@ (analyse archive term))] (in [type termA]))) constructor_args) - .let [supers (#.Item super_class super_interfaces)] + .let [supers {#.Item super_class super_interfaces}] _ (..require_complete_method_concretion class_loader supers methods) methodsA (monad.each ! (analyse_overriden_method analyse archive selfT mapping supers) methods)] - (in (#/////analysis.Extension extension_name - (list (class_analysis super_class) - (/////analysis.tuple (list\each class_analysis super_interfaces)) - (/////analysis.tuple (list\each typed_analysis constructor_argsA+)) - (/////analysis.tuple methodsA))))))])) + (in {#/////analysis.Extension extension_name + (list (class_analysis super_class) + (/////analysis.tuple (list\each class_analysis super_interfaces)) + (/////analysis.tuple (list\each typed_analysis constructor_argsA+)) + (/////analysis.tuple methodsA))})))])) (def: (bundle::class class_loader) (-> java/lang/ClassLoader Bundle) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index f7ed4ed54..c9c1dfb0b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -50,7 +50,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list lengthA)))))])) + (in {#analysis.Extension extension (list lengthA)})))])) (def: array::length Handler @@ -62,7 +62,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (in (#analysis.Extension extension (list arrayA)))))])) + (in {#analysis.Extension extension (list arrayA)})))])) (def: array::read Handler @@ -76,7 +76,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: array::write Handler @@ -92,7 +92,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in {#analysis.Extension extension (list indexA valueA arrayA)})))])) (def: array::delete Handler @@ -106,7 +106,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: bundle::array Bundle @@ -128,8 +128,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in {#analysis.Extension extension (list (analysis.text fieldC) + objectA)})))])) (def: object::do Handler @@ -141,9 +141,9 @@ (phase archive objectC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& (analysis.text methodC) + (in {#analysis.Extension extension (list& (analysis.text methodC) objectA - inputsA)))))])) + inputsA)})))])) (def: bundle::object Bundle @@ -165,7 +165,7 @@ [inputA (analysis/type.with_type (type <fromT>) (phase archive inputC)) _ (analysis/type.infer (type <toT>))] - (in (#analysis.Extension extension (list inputA)))))]))] + (in {#analysis.Extension extension (list inputA)})))]))] [utf8::encode Text (array.Array (I64 Any))] [utf8::decode (array.Array (I64 Any)) Text] @@ -186,7 +186,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: lua::apply Handler @@ -198,7 +198,7 @@ (phase archive abstractionC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in {#analysis.Extension extension (list& abstractionA inputsA)})))])) (def: lua::power Handler @@ -211,7 +211,7 @@ baseA (analysis/type.with_type Frac (phase archive baseC)) _ (analysis/type.infer Frac)] - (in (#analysis.Extension extension (list powerA baseA)))))])) + (in {#analysis.Extension extension (list powerA baseA)})))])) (def: lua::import Handler @@ -220,7 +220,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer ..Object)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: lua::function Handler @@ -232,8 +232,8 @@ abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) _ (analysis/type.infer ..Function)] - (in (#analysis.Extension extension (list (analysis.nat arity) - abstractionA)))))])) + (in {#analysis.Extension extension (list (analysis.nat arity) + abstractionA)})))])) (def: .public bundle Bundle 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 fb283bf9e..0609bee0a 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 @@ -41,10 +41,10 @@ Handler)) (function (_ extension_name analyse archive args) (case (<code>.result syntax args) - (#try.Success inputs) + {#try.Success inputs} (handler extension_name analyse archive inputs) - (#try.Failure _) + {#try.Failure _} (////analysis.except ///.invalid_syntax [extension_name %.code args])))) (def: (simple inputsT+ outputT) @@ -60,7 +60,7 @@ (typeA.with_type argT (analyse archive argC))) (list.zipped/2 inputsT+ args))] - (in (#////analysis.Extension extension_name argsA))) + (in {#////analysis.Extension extension_name argsA})) (////analysis.except ///.incorrect_arity [extension_name num_expected num_actual])))))) (def: .public (nullary valueT) @@ -119,7 +119,7 @@ (list (////analysis.tuple (list\each (|>> ////analysis.nat) cases)) branch)))) (list& input else) - (#////analysis.Extension extension_name)))))]))) + {#////analysis.Extension extension_name}))))]))) ... "lux is" represents reference/pointer equality. (def: lux::is @@ -142,7 +142,7 @@ _ (typeA.infer (type (Either Text varT))) opA (typeA.with_type (type (-> .Any varT)) (analyse archive opC))] - (in (#////analysis.Extension extension_name (list opA)))) + (in {#////analysis.Extension extension_name (list opA)})) _ (////analysis.except ///.incorrect_arity [extension_name 1 (list.size args)])))) @@ -151,7 +151,7 @@ Handler (function (_ extension_name analyse archive argsC+) (case argsC+ - (^ (list [_ (#.Text module_name)] exprC)) + (^ (list [_ {#.Text module_name}] exprC)) (////analysis.with_current_module module_name (analyse archive exprC)) @@ -214,15 +214,15 @@ (do ! [input_type (///.lifted (meta.definition (name_of .Macro')))] (case input_type - (^or (#.Definition [exported? def_type def_value]) - (#.Type [exported? def_value labels])) + (^or {#.Definition [exported? def_type def_value]} + {#.Type [exported? def_value labels]}) (in (:as Type def_value)) - (^or (#.Label _) - (#.Slot _)) + (^or {#.Label _} + {#.Slot _}) (////.failure (exception.error ..not_a_type [(name_of .Macro')])) - (#.Alias real_name) + {#.Alias real_name} (recur real_name))))] (typeA.with_type input_type (phase archive valueC))))])) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux index a52f8bb53..16717539b 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list lengthA)))))])) + (in {#analysis.Extension extension (list lengthA)})))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (in (#analysis.Extension extension (list arrayA)))))])) + (in {#analysis.Extension extension (list arrayA)})))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in {#analysis.Extension extension (list indexA valueA arrayA)})))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: bundle::array Bundle @@ -127,7 +127,7 @@ (do [! phase.monad] [inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& (analysis.text constructor) inputsA)))))])) + (in {#analysis.Extension extension (list& (analysis.text constructor) inputsA)})))])) (def: object::get Handler @@ -138,8 +138,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in {#analysis.Extension extension (list (analysis.text fieldC) + objectA)})))])) (def: object::do Handler @@ -151,9 +151,9 @@ (phase archive objectC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& (analysis.text methodC) + (in {#analysis.Extension extension (list& (analysis.text methodC) objectA - inputsA)))))])) + inputsA)})))])) (def: bundle::object Bundle @@ -173,7 +173,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: php::apply Handler @@ -185,7 +185,7 @@ (phase archive abstractionC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in {#analysis.Extension extension (list& abstractionA inputsA)})))])) (def: php::pack Handler @@ -198,7 +198,7 @@ dataA (analysis/type.with_type (type (Array (I64 Any))) (phase archive dataC)) _ (analysis/type.infer Text)] - (in (#analysis.Extension extension (list formatA dataA)))))])) + (in {#analysis.Extension extension (list formatA dataA)})))])) (def: .public bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index 700f80163..ec21b45bc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list lengthA)))))])) + (in {#analysis.Extension extension (list lengthA)})))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (in (#analysis.Extension extension (list arrayA)))))])) + (in {#analysis.Extension extension (list arrayA)})))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in {#analysis.Extension extension (list indexA valueA arrayA)})))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: bundle::array Bundle @@ -136,8 +136,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in {#analysis.Extension extension (list (analysis.text fieldC) + objectA)})))])) (def: object::do Handler @@ -149,9 +149,9 @@ (phase archive objectC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& (analysis.text methodC) + (in {#analysis.Extension extension (list& (analysis.text methodC) objectA - inputsA)))))])) + inputsA)})))])) (def: bundle::object Bundle @@ -170,7 +170,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: python::import Handler @@ -179,7 +179,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer ..Object)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: python::apply Handler @@ -191,7 +191,7 @@ (phase archive abstractionC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in {#analysis.Extension extension (list& abstractionA inputsA)})))])) (def: python::function Handler @@ -203,8 +203,8 @@ abstractionA (analysis/type.with_type (-> inputT Any) (phase archive abstractionC)) _ (analysis/type.infer ..Function)] - (in (#analysis.Extension extension (list (analysis.nat arity) - abstractionA)))))])) + (in {#analysis.Extension extension (list (analysis.nat arity) + abstractionA)})))])) (def: python::exec Handler @@ -217,7 +217,7 @@ globalsA (analysis/type.with_type ..Dict (phase archive globalsC)) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list codeA globalsA)))))])) + (in {#analysis.Extension extension (list codeA globalsA)})))])) (def: .public bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index 6bf24f1fa..525458cdd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list lengthA)))))])) + (in {#analysis.Extension extension (list lengthA)})))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (in (#analysis.Extension extension (list arrayA)))))])) + (in {#analysis.Extension extension (list arrayA)})))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in {#analysis.Extension extension (list indexA valueA arrayA)})))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: bundle::array Bundle @@ -128,8 +128,8 @@ [objectA (analysis/type.with_type ..Object (phase archive objectC)) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list (analysis.text fieldC) - objectA)))))])) + (in {#analysis.Extension extension (list (analysis.text fieldC) + objectA)})))])) (def: object::do Handler @@ -141,9 +141,9 @@ (phase archive objectC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer .Any)] - (in (#analysis.Extension extension (list& (analysis.text methodC) + (in {#analysis.Extension extension (list& (analysis.text methodC) objectA - inputsA)))))])) + inputsA)})))])) (def: bundle::object Bundle @@ -162,7 +162,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: ruby::apply Handler @@ -174,7 +174,7 @@ (phase archive abstractionC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in {#analysis.Extension extension (list& abstractionA inputsA)})))])) (def: ruby::import Handler @@ -183,7 +183,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Bit)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: .public bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index 2075522d7..a0df81d93 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -38,7 +38,7 @@ (phase archive lengthC)) [var_id varT] (analysis/type.with_env check.var) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list lengthA)))))])) + (in {#analysis.Extension extension (list lengthA)})))])) (def: array::length Handler @@ -50,7 +50,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer Nat)] - (in (#analysis.Extension extension (list arrayA)))))])) + (in {#analysis.Extension extension (list arrayA)})))])) (def: array::read Handler @@ -64,7 +64,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer varT)] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: array::write Handler @@ -80,7 +80,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA valueA arrayA)))))])) + (in {#analysis.Extension extension (list indexA valueA arrayA)})))])) (def: array::delete Handler @@ -94,7 +94,7 @@ arrayA (analysis/type.with_type (type (Array varT)) (phase archive arrayC)) _ (analysis/type.infer (type (Array varT)))] - (in (#analysis.Extension extension (list indexA arrayA)))))])) + (in {#analysis.Extension extension (list indexA arrayA)})))])) (def: bundle::array Bundle @@ -131,7 +131,7 @@ (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list (analysis.text name))))))])) + (in {#analysis.Extension extension (list (analysis.text name))})))])) (def: scheme::apply Handler @@ -143,7 +143,7 @@ (phase archive abstractionC)) inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) _ (analysis/type.infer Any)] - (in (#analysis.Extension extension (list& abstractionA inputsA)))))])) + (in {#analysis.Extension extension (list& abstractionA inputsA)})))])) (def: .public bundle Bundle 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 6dc2b393d..76c66e37d 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 @@ -144,8 +144,8 @@ ))) (type: Field - (#Constant Constant) - (#Variable Variable)) + {#Constant Constant} + {#Variable Variable}) (def: field (Parser Field) @@ -155,10 +155,10 @@ )) (type: Method_Definition - (#Constructor (jvm.Constructor Code)) - (#Virtual_Method (jvm.Virtual_Method Code)) - (#Static_Method (jvm.Static_Method Code)) - (#Overriden_Method (jvm.Overriden_Method Code))) + {#Constructor (jvm.Constructor Code)} + {#Virtual_Method (jvm.Virtual_Method Code)} + {#Static_Method (jvm.Static_Method Code)} + {#Overriden_Method (jvm.Overriden_Method Code)}) (def: method (Parser Method_Definition) @@ -186,10 +186,10 @@ (-> Field (Resource field.Field)) (case field ... TODO: Handle annotations. - (#Constant [name annotations type value]) + {#Constant [name annotations type value]} (case value (^template [<tag> <type> <constant>] - [[_ (<tag> value)] + [[_ {<tag> value}] (do pool.monad [constant (`` (|> value (~~ (template.spliced <constant>)))) attribute (attribute.constant constant)] @@ -210,7 +210,7 @@ (undefined)) ... TODO: Handle annotations. - (#Variable [name visibility state annotations type]) + {#Variable [name visibility state annotations type]} (field.field (modifier\composite visibility state) name type (row.row)))) @@ -225,16 +225,16 @@ [methodA (: (Operation analysis.Analysis) (directive.lifted_analysis (case methodC - (#Constructor method) + {#Constructor method} (jvm.analyse_constructor_method analyse selfT mapping method) - (#Virtual_Method method) + {#Virtual_Method method} (jvm.analyse_virtual_method analyse selfT mapping method) - (#Static_Method method) + {#Static_Method method} (jvm.analyse_static_method analyse mapping method) - (#Overriden_Method method) + {#Overriden_Method method} (jvm.analyse_overriden_method analyse selfT mapping method))))] (directive.lifted_synthesis (synthesize methodA))))) @@ -275,7 +275,7 @@ (monad.each check.monad (|>> ..signature (luxT.check (luxT.class mapping))) super_interfaces))) - .let [selfT (jvm.inheritance_relationship_type (#.Primitive name (list\each product.right parameters)) + .let [selfT (jvm.inheritance_relationship_type {#.Primitive name (list\each product.right parameters)} super_classT super_interfaceT+)] state (extension.lifted phase.get_state) 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 0ebdde096..4ea0c4e7a 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 @@ -54,10 +54,10 @@ (Handler anchor expression directive))) (function (_ extension_name phase archive inputs) (case (<code>.result syntax inputs) - (#try.Success inputs) + {#try.Success inputs} (handler extension_name phase archive inputs) - (#try.Failure error) + {#try.Failure error} (phase.except ///.invalid_syntax [extension_name %.code inputs])))) (def: (context [module_id artifact_id]) @@ -138,7 +138,7 @@ (check.clean code//type))] (in [code//type codeA])) - (#.Some expected) + {#.Some expected} (do ! [codeA (typeA.with_type expected (analyse archive codeC))] @@ -219,7 +219,7 @@ (-> Expander /////analysis.Bundle Handler) (function (_ extension_name phase archive inputsC+) (case inputsC+ - (^ (list [_ (#.Identifier ["" short_name])] valueC exported?C)) + (^ (list [_ {#.Identifier ["" short_name]}] valueC exported?C)) (do phase.monad [current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) @@ -227,7 +227,7 @@ [type valueT value] (..definition archive full_name #.None valueC) [_ _ exported?] (evaluate! archive Bit exported?C) _ (/////directive.lifted_analysis - (module.define short_name (#.Definition [(:as Bit exported?) type value]))) + (module.define short_name {#.Definition [(:as Bit exported?) type value]})) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] (in /////directive.no_requirements)) @@ -258,23 +258,23 @@ .let [full_name [current_module short_name]] [_ _ exported?] (evaluate! archive Bit exported?C) .let [exported? (:as Bit exported?)] - [type valueT value] (..definition archive full_name (#.Some .Type) valueC) + [type valueT value] (..definition archive full_name {#.Some .Type} valueC) labels (/////directive.lifted_analysis (do phase.monad [.let [[record? labels] (case labels - (#.Left tags) + {#.Left tags} [false tags] - (#.Right slots) + {#.Right slots} [true slots])] _ (case labels #.End - (module.define short_name (#.Definition [exported? type value])) + (module.define short_name {#.Definition [exported? type value]}) - (#.Item labels) - (module.define short_name (#.Type [exported? (:as .Type value) (if record? - (#.Right labels) - (#.Left labels))]))) + {#.Item labels} + (module.define short_name {#.Type [exported? (:as .Type value) (if record? + {#.Right labels} + {#.Left labels})]})) _ (module.declare_tags record? labels exported? (:as .Type value))] (in labels))) _ (..refresh expander host_analysis) @@ -325,15 +325,15 @@ [current_module (///.lifted meta.current_module_name) constant (///.lifted (meta.definition original))] (case constant - (#.Alias de_aliased) + {#.Alias de_aliased} (phase.except ..cannot_alias_an_alias [[current_module alias] original de_aliased]) - (^or (#.Definition _) - (#.Type _)) - (module.define alias (#.Alias original)) + (^or {#.Definition _} + {#.Type _}) + (module.define alias {#.Alias original}) - (^or (#.Label _) - (#.Slot _)) + (^or {#.Label _} + {#.Slot _}) (phase.except ..cannot_alias_a_label [[current_module alias] original])))) (def: def::alias 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 facb40e7e..8c6df79fd 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 @@ -45,10 +45,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) 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 1072bffe4..54b345e36 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 @@ -45,10 +45,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ... [Procedures] @@ -101,7 +101,7 @@ Phase! (case synthesis ... TODO: Get rid of this ASAP - (#synthesis.Extension "lux syntax char case!" parameters) + {#synthesis.Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] (in (:as Statement body))) @@ -115,9 +115,13 @@ [synthesis.text] [synthesis.variant] [synthesis.tuple] - [#synthesis.Reference] [synthesis.branch/get] - [synthesis.function/apply] + [synthesis.function/apply]) + + (^template [<tag>] + [(^ {<tag> value}) + (/////\each _.return (expression archive synthesis))]) + ([#synthesis.Reference] [#synthesis.Extension]) (^ (synthesis.branch/case case)) @@ -162,13 +166,13 @@ ... (in (_.apply/* (_.closure (list) ... (_.switch (_.the //runtime.i64_low_field inputG) ... conditionals! - ... (#.Some (_.return else!)))) + ... {#.Some (_.return else!)})) ... (list))) (in (<| (:as Expression) (: Statement) (_.switch (_.the //runtime.i64_low_field inputG) conditionals! - (#.Some else!))))))])) + {#.Some else!})))))])) ... [Bundles] (def: lux_procs 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 2ff3fd02a..f3efd5f47 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 @@ -49,10 +49,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except /////extension.invalid_syntax [extension_name //////synthesis.%synthesis input])))) (def: $Boolean (type.class "java.lang.Boolean" (list))) 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 e0626e0b6..b070a0a6b 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 @@ -339,9 +339,9 @@ (do <>.monad [arrayJT (<t>.then parser.array <s>.text)] (case (parser.array? arrayJT) - (#.Some elementJT) + {#.Some elementJT} (case (parser.object? elementJT) - (#.Some elementJT) + {#.Some elementJT} (in elementJT) #.None @@ -644,7 +644,7 @@ (do //////.monad [.let [$class (type.class class (list))]] (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (in (_.getstatic $class field primitive)) #.None @@ -661,7 +661,7 @@ [valueG (generate archive valueS) .let [$class (type.class class (list))]] (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (in ($_ _.composite valueG (_.putstatic $class field primitive) @@ -683,7 +683,7 @@ [objectG (generate archive objectS) .let [$class (type.class class (list)) getG (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (_.getfield $class field primitive) #.None @@ -703,7 +703,7 @@ objectG (generate archive objectS) .let [$class (type.class class (list)) putG (case (dictionary.value unboxed ..primitives) - (#.Some primitive) + {#.Some primitive} (_.putfield $class field primitive) #.None @@ -729,10 +729,10 @@ (do //////.monad [valueG (generate archive valueS)] (case (type.primitive? valueT) - (#.Right valueT) + {#.Right valueT} (in [valueT valueG]) - (#.Left valueT) + {#.Left valueT} (in [valueT ($_ _.composite valueG (_.checkcast valueT))])))) @@ -740,10 +740,10 @@ (def: (prepare_output outputT) (-> (Type Return) (Bytecode Any)) (case (type.void? outputT) - (#.Right outputT) + {#.Right outputT} ..unitG - (#.Left outputT) + {#.Left outputT} (\ _.monad in []))) (def: invoke::static @@ -855,13 +855,13 @@ (//////synthesis.path/then (normalize bodyS)) (^template [<tag>] - [(^ (<tag> leftP rightP)) - (<tag> (recur leftP) (recur rightP))]) + [(^ {<tag> leftP rightP}) + {<tag> (recur leftP) (recur rightP)}]) ([#//////synthesis.Alt] [#//////synthesis.Seq]) (^template [<tag>] - [(^ (<tag> value)) + [(^ {<tag> value}) path]) ([#//////synthesis.Pop] [#//////synthesis.Bind] @@ -875,7 +875,7 @@ (function (recur body) (case body (^template [<tag>] - [(^ (<tag> value)) + [(^ {<tag> value}) body]) ([#//////synthesis.Primitive] [//////synthesis.constant]) @@ -928,8 +928,8 @@ (^ (//////synthesis.function/apply [functionS inputsS+])) (//////synthesis.function/apply [(recur functionS) (list\each recur inputsS+)]) - (#//////synthesis.Extension [name inputsS+]) - (#//////synthesis.Extension [name (list\each recur inputsS+)])))) + {#//////synthesis.Extension [name inputsS+]} + {#//////synthesis.Extension [name (list\each recur inputsS+)]}))) (def: $Object (type.class "java.lang.Object" (list))) @@ -952,12 +952,12 @@ (_.putfield class (///reference.foreign_name register) $Object)))))] (method.method method.public "<init>" (anonymous_init_method env) (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite (_.aload 0) (monad.each _.monad product.right inputsTG) (_.invokespecial super_class "<init>" (type.method [(list\each product.left inputsTG) type.void (list)])) store_capturedG - _.return))))) + _.return)}))) (def: (anonymous_instance generate archive class env) (-> Phase Archive (Type category.Class) (Environment Synthesis) (Operation (Bytecode Any))) @@ -972,17 +972,17 @@ (def: (returnG returnT) (-> (Type Return) (Bytecode Any)) (case (type.void? returnT) - (#.Right returnT) + {#.Right returnT} _.return - (#.Left returnT) + {#.Left returnT} (case (type.primitive? returnT) - (#.Left returnT) + {#.Left returnT} ($_ _.composite (_.checkcast returnT) _.areturn) - (#.Right returnT) + {#.Right returnT} (cond (or (\ type.equivalence = type.boolean returnT) (\ type.equivalence = type.byte returnT) (\ type.equivalence = type.short returnT) @@ -1027,7 +1027,7 @@ ... Give them names as "foreign" variables. list.enumeration (list\each (function (_ [id capture]) - [capture (#//////variable.Foreign id)])) + [capture {#//////variable.Foreign id}])) (dictionary.from_list //////variable.hash)) normalized_methods (list\each (function (_ [environment [ownerT name @@ -1037,7 +1037,7 @@ (let [local_mapping (|> environment list.enumeration (list\each (function (_ [foreign_id capture]) - [(#//////variable.Foreign foreign_id) + [{#//////variable.Foreign foreign_id} (|> global_mapping (dictionary.value capture) maybe.trusted)])) @@ -1066,9 +1066,9 @@ returnT exceptionsT]) (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite bodyG - (returnG returnT))))))) + (returnG returnT))})))) normalized_methods) bytecode (<| (\ ! each (format.result class.writer)) //////.lifted 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 1be1bcfa5..3523c19fa 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 @@ -48,10 +48,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) @@ -61,7 +61,7 @@ Phase! (case synthesis ... TODO: Get rid of this ASAP - (#synthesis.Extension "lux syntax char case!" parameters) + {#synthesis.Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] (in (:as Statement body))) @@ -75,9 +75,13 @@ [synthesis.text] [synthesis.variant] [synthesis.tuple] - [#synthesis.Reference] [synthesis.branch/get] - [synthesis.function/apply] + [synthesis.function/apply]) + + (^template [<tag>] + [(^ {<tag> value}) + (/////\each _.return (expression archive synthesis))]) + ([#synthesis.Reference] [#synthesis.Extension]) (^ (synthesis.branch/case case)) 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 d5f740ed4..9a06cd980 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 @@ -45,10 +45,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) 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 03cb557dc..cbb7c557d 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 @@ -47,7 +47,7 @@ Phase! (case synthesis ... TODO: Get rid of this ASAP - (#synthesis.Extension "lux syntax char case!" parameters) + {#synthesis.Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] (in (:as (Statement Any) body))) @@ -61,9 +61,13 @@ [synthesis.text] [synthesis.variant] [synthesis.tuple] - [#synthesis.Reference] [synthesis.branch/get] - [synthesis.function/apply] + [synthesis.function/apply]) + + (^template [<tag>] + [(^ {<tag> value}) + (/////\each _.return (expression archive synthesis))]) + ([#synthesis.Reference] [#synthesis.Extension]) (^ (synthesis.branch/case case)) @@ -88,10 +92,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<synthesis>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ... TODO: Get rid of this ASAP @@ -124,10 +128,10 @@ ... .let [dependencies (//case.dependencies (list\mix (function (_ right left) ... (synthesis.path/seq left right)) ... (synthesis.path/then input) - ... (#.Item (synthesis.path/then else) - ... (list\each (|>> product.right - ... synthesis.path/then) - ... conditionals)))) + ... {#.Item (synthesis.path/then else) + ... (list\each (|>> product.right + ... synthesis.path/then) + ... conditionals)})) ... @closure (_.var (reference.artifact artifact_id)) ... closure (_.def @closure dependencies ... ($_ _.then 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 68725c83a..2e533b5bd 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 @@ -45,10 +45,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) ... (template: (!unary function) 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 a253cb8de..6b6538363 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 @@ -48,17 +48,17 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (def: .public (statement expression archive synthesis) Phase! (case synthesis ... TODO: Get rid of this ASAP - (#synthesis.Extension "lux syntax char case!" parameters) + {#synthesis.Extension "lux syntax char case!" parameters} (do /////.monad [body (expression archive synthesis)] (in (:as Statement @@ -73,9 +73,13 @@ [synthesis.text] [synthesis.variant] [synthesis.tuple] - [#synthesis.Reference] [synthesis.branch/get] - [synthesis.function/apply] + [synthesis.function/apply]) + + (^template [<tag>] + [(^ {<tag> value}) + (/////\each _.return (expression archive synthesis))]) + ([#synthesis.Reference] [#synthesis.Extension]) (^ (synthesis.branch/case case)) 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 bc2ad5cba..7161326e1 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 @@ -45,10 +45,10 @@ Handler)) (function (_ extension_name phase archive input) (case (<s>.result parser input) - (#try.Success input') + {#try.Success input'} (handler extension_name phase archive input') - (#try.Failure error) + {#try.Failure error} (/////.except extension.invalid_syntax [extension_name %synthesis input])))) (template: (!unary function) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux index 1b1f29f46..26a967a45 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp.lux @@ -34,7 +34,7 @@ [////synthesis.f64 /primitive.f64] [////synthesis.text /primitive.text]) - (#////synthesis.Reference value) + {#////synthesis.Reference value} (//reference.reference /reference.system archive value) (^template [<tag> <generator>] @@ -52,6 +52,6 @@ [////synthesis.loop/recur /loop.recur] [////synthesis.function/abstraction /function.function]) - (#////synthesis.Extension extension) + {#////synthesis.Extension extension} (///extension.apply archive generate extension) )) 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 90f67a68a..5442b7268 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 @@ -117,7 +117,7 @@ (_.go @fail) (..push! @temp))) (.case next! - (#.Some next!) + {#.Some next!} (list next!) #.None @@ -150,14 +150,14 @@ #/////synthesis.Pop (///////phase\in ..pop!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.setq (..register register) ..peek)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur [$output @done @fail thenP]) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur [$output @done @fail elseP]) #.None @@ -171,7 +171,7 @@ then!)))) (^template [<tag> <format> <=>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (do ! @@ -179,7 +179,7 @@ (in [(<=> [(|> match <format>) ..peek]) then!]))) - (#.Item item))] + {#.Item item})] (in (list\mix (function (_ [when then] else) (_.if when then else)) (_.go @fail) @@ -195,7 +195,7 @@ (^ (<simple> idx nextP)) (|> nextP [$output @done @fail] recur - (\ ///////phase.monad each (|>> #.Some (<choice> @fail true idx))))]) + (\ ///////phase.monad each (|>> {#.Some} (<choice> @fail true idx))))]) ([/////synthesis.side/left /////synthesis.simple_left_side ..left_choice] [/////synthesis.side/right /////synthesis.simple_right_side ..right_choice]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index 0f7c76ed8..1c7fd4877 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -109,7 +109,7 @@ (let [runtime (code.local_identifier (///reference.artifact [..module_id runtime_id])) runtime_name (` (_.var (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (let [g!name (code.local_identifier name) code_nameC (code.local_identifier (format "@" name))] (in (list (` (def: .public (~ g!name) @@ -120,7 +120,7 @@ (_.Expression Any) (_.defparameter (~ runtime_name) (~ code))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (let [g!name (code.local_identifier name) code_nameC (code.local_identifier (format "@" name)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux index eb78e6402..2a5fa7c1c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/structure.lux @@ -20,7 +20,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux index e6aa9cdce..65b06ce16 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux @@ -49,7 +49,7 @@ (^ (synthesis.tuple members)) (/structure.tuple expression archive members) - (#synthesis.Reference value) + {#synthesis.Reference value} (//reference.reference /reference.system archive value) (^ (synthesis.branch/case case)) @@ -76,7 +76,7 @@ (^ (synthesis.function/apply application)) (/function.apply expression archive application) - (#synthesis.Extension extension) + {#synthesis.Extension extension} (///extension.apply archive expression extension))) (def: .public generate 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 5f634c533..8f98d44ab 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 @@ -171,7 +171,7 @@ [/////synthesis.simple_right_side ..right_choice]) (^ (/////synthesis.member/left 0)) - (///////phase\in (#.Some (push_cursor! (_.at (_.i32 +0) ..peek_cursor)))) + (///////phase\in {#.Some (push_cursor! (_.at (_.i32 +0) ..peek_cursor))}) ... Extra optimization (^ (/////synthesis.path/seq @@ -179,9 +179,9 @@ (/////synthesis.!bind_top register thenP))) (do ///////phase.monad [then! (recur thenP)] - (in (#.Some ($_ _.then + (in {#.Some ($_ _.then (_.define (..register register) (_.at (_.i32 +0) ..peek_cursor)) - then!)))) + then!)})) ... Extra optimization (^template [<pm> <getter>] @@ -190,26 +190,26 @@ (/////synthesis.!bind_top register thenP))) (do ///////phase.monad [then! (recur thenP)] - (in (#.Some ($_ _.then + (in {#.Some ($_ _.then (_.define (..register register) (<getter> (_.i32 (.int lefts)) ..peek_cursor)) - then!))))]) + then!)}))]) ([/////synthesis.member/left //runtime.tuple//left] [/////synthesis.member/right //runtime.tuple//right]) (^ (/////synthesis.!bind_top register thenP)) (do ///////phase.monad [then! (recur thenP)] - (in (#.Some ($_ _.then + (in {#.Some ($_ _.then (_.define (..register register) ..peek_and_pop_cursor) - then!)))) + then!)})) (^ (/////synthesis.!multi_pop nextP)) (.let [[extra_pops nextP'] (////synthesis/case.count_pops nextP)] (do ///////phase.monad [next! (recur nextP')] - (in (#.Some ($_ _.then + (in {#.Some ($_ _.then (multi_pop_cursor! (n.+ 2 extra_pops)) - next!))))) + next!)}))) _ (///////phase\in #.None))) @@ -221,25 +221,25 @@ (do ///////phase.monad [outcome (optimized_pattern_matching recur pathP)] (.case outcome - (#.Some outcome) + {#.Some outcome} (in outcome) #.None (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (statement expression archive bodyS) #/////synthesis.Pop (///////phase\in pop_cursor!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.define (..register register) ..peek_cursor)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None @@ -252,7 +252,7 @@ else! then!)))) - (#/////synthesis.I64_Fork item) + {#/////synthesis.I64_Fork item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (do ! @@ -260,7 +260,7 @@ (in [(//runtime.i64//= (//primitive.i64 (.int match)) ..peek_cursor) then!]))) - (#.Item item))] + {#.Item item})] (in (_.cond clauses ..fail_pm!))) (^template [<tag> <format>] @@ -268,10 +268,10 @@ (do [! ///////phase.monad] [cases (monad.each ! (function (_ [match then]) (\ ! each (|>> [(list (<format> match))]) (recur then))) - (#.Item item))] + {#.Item item})] (in (_.switch ..peek_cursor cases - (#.Some ..fail_pm!))))]) + {#.Some ..fail_pm!})))]) ([#/////synthesis.F64_Fork //primitive.f64] [#/////synthesis.Text_Fork //primitive.text]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 58bf53a29..f2be9fda5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -104,7 +104,7 @@ (macro.with_identifiers [g!_ runtime] (let [runtime_name (` (_.var (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (let [g!name (code.local_identifier name)] (in (list (` (def: .public (~ g!name) Var @@ -116,7 +116,7 @@ (function ((~ g!_) (~ g!name)) (~ code)))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (let [g!name (code.local_identifier name) inputsC (list\each code.local_identifier inputs) inputs_typesC (list\each (function.constant (` _.Expression)) inputs)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux index c4284d345..88072200f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/structure.lux @@ -20,7 +20,7 @@ #.End (///////phase\in //runtime.unit) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux index c2a125d4a..6a1a607cb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm.lux @@ -36,12 +36,12 @@ (^ (synthesis.tuple members)) (/structure.tuple generate archive members) - (#synthesis.Reference reference) + {#synthesis.Reference reference} (case reference - (#reference.Variable variable) + {#reference.Variable variable} (/reference.variable archive variable) - (#reference.Constant constant) + {#reference.Constant constant} (/reference.constant archive constant)) (^ (synthesis.branch/case [valueS pathS])) @@ -68,6 +68,6 @@ (^ (synthesis.function/apply application)) (/function.apply generate archive application) - (#synthesis.Extension extension) + {#synthesis.Extension extension} (///extension.apply archive generate extension) )) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux index 075e8d68a..2da725141 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux @@ -95,12 +95,12 @@ #synthesis.Pop (operation\in ..pop) - (#synthesis.Bind register) + {#synthesis.Bind register} (operation\in ($_ _.composite ..peek (_.astore register))) - (#synthesis.Then bodyS) + {#synthesis.Then bodyS} (do phase.monad [bodyG (phase archive bodyS)] (in ($_ _.composite @@ -171,7 +171,7 @@ ([synthesis.member/left //runtime.left_projection] [synthesis.member/right //runtime.right_projection]) - (#synthesis.Alt leftP rightP) + {#synthesis.Alt leftP rightP} (do phase.monad [@alt_else //runtime.forge_label left! (path' (++ stack_depth) @alt_else @end phase archive leftP) @@ -183,7 +183,7 @@ _.pop right!))) - (#synthesis.Seq leftP rightP) + {#synthesis.Seq leftP rightP} (do phase.monad [left! (path' stack_depth @else @end phase archive leftP) right! (path' stack_depth @else @end phase archive rightP)] @@ -243,10 +243,10 @@ [recordG (phase archive recordS)] (in (list\mix (function (_ step so_far) (.let [next (.case step - (#.Left lefts) + {#.Left lefts} (..left_projection lefts) - (#.Right lefts) + {#.Right lefts} (..right_projection lefts))] (_.composite so_far next))) recordG 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 d1785ac0a..b0833504c 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 @@ -24,8 +24,8 @@ (file.get_file io.monad file.default file_path))] (\ file over_write bytecode))] (in (case outcome - (#try.Success definition) + {#try.Success definition} file_path - (#try.Failure error) + {#try.Failure error} error))))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux index a16c047e7..994a9f33f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/apply.lux @@ -85,7 +85,7 @@ (method.method //.modifier ////runtime.apply::name (////runtime.apply::type apply_arity) (list) - (#.Some (case num_partials + {#.Some (case num_partials 0 ($_ _.composite ////reference.this (..inputs ..this_offset apply_arity) @@ -97,7 +97,7 @@ @labelsT (|> _.new_label (list.repeated (-- num_partials)) (monad.all _.monad)) - .let [cases (|> (list\composite (#.Item [@labelsH @labelsT]) + .let [cases (|> (list\composite {#.Item [@labelsH @labelsT]} (list @default)) list.enumeration (list\each (function (_ [stage @case]) @@ -132,7 +132,7 @@ (apply (n.+ ..this_offset arity_inputs) additional_inputs) _.areturn)) - ... (i.< over_extent (.int stage)) +... (i.< over_extent (.int stage)) (let [current_environment (|> (list.indices (list.size environment)) (list\each (///foreign.get class)) (monad.all _.monad)) @@ -154,4 +154,4 @@ ($_ _.composite ///partial/count.value (_.tableswitch (try.trusted (signed.s4 +0)) @default [@labelsH @labelsT]) - cases))))))) + cases)))}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux index ae02754ae..723ff6ce5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/implementation.lux @@ -31,11 +31,11 @@ (method.method //.modifier name (..type arity) (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite (_.set_label @begin) body _.areturn - )))) + )})) (def: .public method (-> Arity Label (Bytecode Any) (Resource Method)) 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 e39e582db..91df54eca 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 @@ -94,9 +94,9 @@ (method.method //.modifier ..name (..type environment arity) (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite ////reference.this (..super environment_size arity) (store_all environment_size (///foreign.put class) offset_foreign) (store_all (-- arity) (///partial.put class) offset_partial) - _.return))))) + _.return)}))) 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 0e8365945..79926e5b8 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 @@ -69,7 +69,7 @@ (method.method //.modifier //init.name (//init.type environment arity) (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite ////reference.this (//init.super environment_size arity) (monad.each _.monad (function (_ register) @@ -78,4 +78,4 @@ (monad.each _.monad (function (_ register) (///partial.put class register (_.aload (after_arity register)))) (list.indices (n.- ///arity.minimum arity))) - _.areturn))))) + _.areturn)}))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux index f406c2879..b5bdb1e1d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/function/method/reset.lux @@ -43,8 +43,8 @@ (method.method //.modifier ..name (..type class) (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite (if (arity.multiary? arity) (//new.instance' (..current_environment class environment) class environment arity) ////reference.this) - _.areturn)))) + _.areturn)})) 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 6e5030da6..0ffbbceb3 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 @@ -81,20 +81,20 @@ (def: (class_value class_name class) (-> Text (java/lang/Class java/lang/Object) (Try Any)) (case (java/lang/Class::getField ..value::field class) - (#try.Success field) + {#try.Success field} (case (java/lang/reflect/Field::get #.None field) - (#try.Success ?value) + {#try.Success ?value} (case ?value - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (exception.except ..invalid_value [class_name])) - (#try.Failure error) + {#try.Failure error} (exception.except ..cannot_load [class_name error])) - (#try.Failure error) + {#try.Failure error} (exception.except ..invalid_field [class_name ..value::field error]))) (def: class_path_separator @@ -110,11 +110,11 @@ (list (field.field ..value::modifier ..value::field ..value::type (row.row))) (list (method.method ..init::modifier "<clinit>" ..init::type (list) - (#.Some + {#.Some ($_ _.composite valueG (_.putstatic (type.class bytecode_name (list)) ..value::field ..value::type) - _.return)))) + _.return)})) (row.row))] (io.run! (do [! (try.with io.monad)] [bytecode (\ ! each (format.result class.writer) 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 3edc41c03..9ed5eb48e 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 @@ -51,21 +51,21 @@ value (case (signed.s1 value) - (#try.Success value) + {#try.Success value} (do _.monad [_ (_.bipush value) _ _.i2l] ..wrap_i64) - (#try.Failure _) + {#try.Failure _} (case (signed.s2 value) - (#try.Success value) + {#try.Success value} (do _.monad [_ (_.sipush value) _ _.i2l] ..wrap_i64) - (#try.Failure _) + {#try.Failure _} (do _.monad [_ (_.long value)] ..wrap_i64))))) 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 8ba5655a1..4074cf6cc 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 @@ -132,12 +132,12 @@ (let [super_class (|> ..^Object type.reflection reflection.reflection name.internal) main (method.method ..main::modifier "main" ..main::type (list) - (#.Some ($_ _.composite + {#.Some ($_ _.composite program ..input_list ..feed_inputs ..run_io - _.return)))] + _.return)})] [..class (<| (format.result class.writer) try.trusted diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux index 931f8fd72..778b23005 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/reference.lux @@ -53,10 +53,10 @@ (def: .public (variable archive variable) (-> Archive Variable (Operation (Bytecode Any))) (case variable - (#variable.Local variable) + {#variable.Local variable} (operation\in (_.aload variable)) - (#variable.Foreign variable) + {#variable.Foreign variable} (..foreign archive variable))) (def: .public (constant archive name) 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 ad6166d3f..c3c8f518c 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 @@ -151,12 +151,12 @@ (method.method ..modifier ..variant::name ..variant::type (list) - (#.Some ($_ _.composite - new_variant ... A[3] - (..set! ..variant_tag $tag) ... A[3] + {#.Some ($_ _.composite + new_variant ... A[3] + (..set! ..variant_tag $tag) ... A[3] (..set! ..variant_last? $last?) ... A[3] (..set! ..variant_value $value) ... A[3] - _.areturn))))) + _.areturn)}))) (def: .public left_flag _.aconst_null) (def: .public right_flag ..unit) @@ -213,13 +213,13 @@ (method.method ..modifier ..decode_frac::name ..decode_frac::type (list) - (#.Some + {#.Some (..risky ($_ _.composite _.aload_0 (_.invokestatic //type.frac "parseDouble" (type.method [(list) (list //type.text) type.double (list)])) (//value.wrap type.double) - ))))) + ))})) (def: .public log! (Bytecode Any) @@ -250,10 +250,10 @@ (method.method ..modifier name ..failure::type (list) - (#.Some + {#.Some ($_ _.composite (..illegal_state_exception message) - _.athrow)))) + _.athrow)})) (def: pm_failure::name "pm_failure") (def: .public pm_failure (..procedure ..pm_failure::name ..failure::type)) @@ -272,7 +272,7 @@ (method.method ..modifier ..push::name ..push::type (list) - (#.Some + {#.Some (let [new_stack_frame! ($_ _.composite _.iconst_2 (_.anewarray //type.value)) @@ -282,7 +282,7 @@ new_stack_frame! (..set! ..stack_head $head) (..set! ..stack_tail $tail) - _.areturn))))) + _.areturn))})) (def: case::name "case") (def: case::type (type.method [(list) (list //type.variant //type.tag //type.flag) //type.value (list)])) @@ -291,7 +291,7 @@ (def: case::method (method.method ..modifier ..case::name ..case::type (list) - (#.Some + {#.Some (do _.monad [@loop _.new_label @perfect_match! _.new_label @@ -320,7 +320,7 @@ ($_ _.composite ... tag, sumT update_$variant ... tag, sumT - update_$tag ... sub_tag + update_$tag ... sub_tag (_.goto @loop_start)))) super_nested_tag ($_ _.composite @@ -340,15 +340,15 @@ _.dup2 (_.if_icmpeq @tags_match!) _.dup2 (_.if_icmpgt @maybe_nested) $last? (_.ifnull @mismatch!) ... tag, sumT - super_nested ... super_variant + super_nested ... super_variant _.areturn (_.set_label @tags_match!) ... tag, sumT - $last? ... tag, sumT, wants_last? + $last? ... tag, sumT, wants_last? $variant ::last? ... tag, sumT, wants_last?, is_last? (_.if_acmpeq @perfect_match!) ... tag, sumT - (_.set_label @maybe_nested) ... tag, sumT - $variant ::last? ... tag, sumT, last? - (_.ifnull @mismatch!) ... tag, sumT + (_.set_label @maybe_nested) ... tag, sumT + $variant ::last? ... tag, sumT, last? + (_.ifnull @mismatch!) ... tag, sumT (recur @loop) (_.set_label @perfect_match!) ... tag, sumT ... _.pop2 @@ -358,7 +358,7 @@ ... _.pop2 not_found _.areturn - ))))) + ))})) (def: projection_type (type.method [(list) (list //type.tuple //type.offset) //type.value (list)])) @@ -395,7 +395,7 @@ left_projection::method (method.method ..modifier ..left_projection::name ..projection_type (list) - (#.Some + {#.Some (do _.monad [@loop _.new_label @recursive _.new_label @@ -408,12 +408,12 @@ _.areturn (_.set_label @recursive) ... Recursive - (recur @loop))))) + (recur @loop)))}) right_projection::method (method.method ..modifier ..right_projection::name ..projection_type (list) - (#.Some + {#.Some (do _.monad [@loop _.new_label @not_tail _.new_label @@ -443,7 +443,7 @@ (recur @loop) (_.set_label @slice) super_nested - _.areturn))))] + _.areturn))})] [left_projection::method right_projection::method])) @@ -466,7 +466,7 @@ (def: try::method (method.method ..modifier ..try::name ..try::type (list) - (#.Some + {#.Some (do _.monad [@try _.new_label @handler _.new_label @@ -501,7 +501,7 @@ (_.invokevirtual //type.error "printStackTrace" (type.method [(list) (list ^PrintWriter) type.void (list)])) ... W (_.invokevirtual ^StringWriter "toString" (type.method [(list) (list) //type.text (list)])) ... S ..left_injection _.areturn - ))))) + ))})) (def: reflection (All (_ category) @@ -549,7 +549,7 @@ (list\each (function (_ arity) (method.method method.public ..apply::name (..apply::type arity) (list) - (#.Some + {#.Some (let [previous_inputs (|> arity list.indices (monad.each _.monad _.aload))] @@ -559,14 +559,14 @@ (_.checkcast //function.class) (_.aload arity) (_.invokevirtual //function.class ..apply::name (..apply::type //function/arity.minimum)) - _.areturn)))))) + _.areturn))}))) (list& (method.method (modifier\composite method.public method.abstract) ..apply::name (..apply::type //function/arity.minimum) (list) #.None))) <init>::method (method.method method.public "<init>" //function.init (list) - (#.Some + {#.Some (let [$partials _.iload_1] ($_ _.composite ..this @@ -574,7 +574,7 @@ ..this $partials (_.putfield //function.class //function/count.field //function/count.type) - _.return)))) + _.return))}) modifier (: (Modifier Class) ($_ modifier\composite class.public diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux index c3bb19132..6b1a09aea 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/structure.lux @@ -32,7 +32,7 @@ #.End (\ phase.monad in //runtime.unit) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (generate archive singletonS) _ @@ -64,15 +64,15 @@ 4 _.iconst_4 5 _.iconst_5 tag (case (signed.s1 (.int tag)) - (#try.Success value) + {#try.Success value} (_.bipush value) - (#try.Failure _) + {#try.Failure _} (case (signed.s2 (.int tag)) - (#try.Success value) + {#try.Success value} (_.sipush value) - (#try.Failure _) + {#try.Failure _} (_.int (.i64 tag)))))) (def: .public (flag right?) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux index 7cc28fb4d..66472f114 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua.lux @@ -49,7 +49,7 @@ (^ (synthesis.tuple members)) (/structure.tuple expression archive members) - (#synthesis.Reference value) + {#synthesis.Reference value} (//reference.reference /reference.system archive value) (^ (synthesis.branch/case case)) @@ -76,7 +76,7 @@ (^ (synthesis.function/apply application)) (/function.apply expression archive application) - (#synthesis.Extension extension) + {#synthesis.Extension extension} (///extension.apply archive expression extension))) (def: .public generate 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 d21406763..7188a282c 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 @@ -163,20 +163,20 @@ (-> Phase! Phase Archive Path (Operation Statement)) (function (recur pathP) (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (statement expression archive bodyS) #/////synthesis.Pop (///////phase\in ..pop!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.local/1 (..register register) ..peek)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None @@ -190,7 +190,7 @@ then!)))) (^template [<tag> <format>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (do ! @@ -198,7 +198,7 @@ (in [(_.= (|> match <format>) ..peek) then!]))) - (#.Item item))] + {#.Item item})] (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork (<| _.int .int)] [#/////synthesis.F64_Fork _.float] @@ -254,10 +254,10 @@ set.list (list\each (function (_ variable) (.case variable - (#///////variable.Local register) + {#///////variable.Local register} (..register register) - (#///////variable.Foreign register) + {#///////variable.Foreign register} (..capture register)))))) (def: .public (case! statement expression archive [valueS pathP]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index 9ed2c2624..a6e448433 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -127,7 +127,7 @@ (let [runtime (code.local_identifier (///reference.artifact [..module_id runtime_id])) runtime_name (` (_.var (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (macro.with_identifiers [g!_] (let [g!name (code.local_identifier name)] (in (list (` (def: .public (~ g!name) @@ -140,7 +140,7 @@ (function ((~ g!_) (~ g!name)) (_.set (~ g!name) (~ code)))))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (macro.with_identifiers [g!_] (let [g!name (code.local_identifier name) inputsC (list\each code.local_identifier inputs) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux index 10be9ba18..29a909d0e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/structure.lux @@ -20,7 +20,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux index fae8d8d61..9c16f64cb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php.lux @@ -72,7 +72,7 @@ [////synthesis.f64 /primitive.f64] [////synthesis.text /primitive.text]) - (#////synthesis.Reference value) + {#////synthesis.Reference value} (//reference.reference /reference.system archive value) (^template [<tag> <generator>] @@ -95,7 +95,7 @@ (^ (////synthesis.loop/recur _)) (//////phase.except ..cannot_recur_as_an_expression []) - (#////synthesis.Extension extension) + {#////synthesis.Extension extension} (///extension.apply archive expression extension))) (def: .public generate 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 295d24457..a5532afc3 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 @@ -163,20 +163,20 @@ (Generator! Path) (function (recur pathP) (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (statement expression archive bodyS) #/////synthesis.Pop (///////phase\in ..pop!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.set! (..register register) ..peek)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None @@ -190,7 +190,7 @@ then!)))) (^template [<tag> <format>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (do ! @@ -198,7 +198,7 @@ (in [(_.=== (|> match <format>) ..peek) then!]))) - (#.Item item))] + {#.Item item})] (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork //primitive.i64] [#/////synthesis.F64_Fork //primitive.f64] @@ -264,10 +264,10 @@ set.list (list\each (function (_ variable) (.case variable - (#///////variable.Local register) + {#///////variable.Local register} (..register register) - (#///////variable.Foreign register) + {#///////variable.Foreign register} (..capture register)))))) (def: .public (case! statement expression archive [valueS pathP]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index 0fe181b78..d8a418657 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -95,7 +95,7 @@ (let [runtime (code.local_identifier (///reference.artifact [..module_id runtime_id])) runtime_name (` (_.constant (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (macro.with_identifiers [g!_] (let [g!name (code.local_identifier name)] (in (list (` (def: .public (~ g!name) @@ -108,7 +108,7 @@ (function ((~ g!_) (~ g!name)) (_.define (~ g!name) (~ code)))))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (macro.with_identifiers [g!_] (let [g!name (code.local_identifier name) inputsC (list\each code.local_identifier inputs) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux index 69f687713..cb499a364 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/structure.lux @@ -23,7 +23,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux index 86433d927..b691c09d6 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux @@ -49,7 +49,7 @@ (^ (////synthesis.tuple members)) (/structure.tuple expression archive members) - (#////synthesis.Reference value) + {#////synthesis.Reference value} (//reference.reference /reference.system archive value) (^ (////synthesis.branch/case case)) @@ -76,7 +76,7 @@ (^ (////synthesis.function/apply application)) (/function.apply expression archive application) - (#////synthesis.Extension extension) + {#////synthesis.Extension extension} (///extension.apply archive expression extension))) (def: .public generate 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 c4f914d01..6cdabddd0 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 @@ -163,7 +163,7 @@ ($_ _.then (_.set (list g!once) (_.bool false)) body!) - (#.Some _.continue))))) + {#.Some _.continue})))) (def: (alternation in_closure? g!once pre! post!) (-> Bit SVar (Statement Any) (Statement Any) (Statement Any)) @@ -179,34 +179,34 @@ (-> (-> Path (Operation (Statement Any))) (-> Path (Operation (Maybe (Statement Any))))) (.case pathP - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None (in ..fail_pm!))] - (in (#.Some (.if when + (in {#.Some (.if when (_.if ..peek then! else!) (_.if ..peek else! - then!))))) + then!))})) (^template [<tag> <format>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (\ ! each (|>> [(_.= (|> match <format>) ..peek)]) (recur then))) - (#.Item item))] - (in (#.Some (_.cond clauses - ..fail_pm!))))]) + {#.Item item})] + (in {#.Some (_.cond clauses + ..fail_pm!)}))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] [#/////synthesis.F64_Fork (<| //primitive.f64)] [#/////synthesis.Text_Fork (<| //primitive.text)]) @@ -220,18 +220,18 @@ (do [! ///////phase.monad] [?output (primitive_pattern_matching recur pathP)] (.case ?output - (#.Some output) + {#.Some output} (in output) #.None (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (statement expression archive bodyS) #/////synthesis.Pop (///////phase\in ..pop!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.set (list (..register register)) ..peek)) (^template [<complex> <simple> <choice>] @@ -302,10 +302,10 @@ set.list (list\each (function (_ variable) (.case variable - (#///////variable.Local register) + {#///////variable.Local register} (..register register) - (#///////variable.Foreign register) + {#///////variable.Foreign register} (..capture register)))))) (def: .public (case! in_closure? statement expression archive [valueS pathP]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 16283e2e9..c2055e2cc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -126,7 +126,7 @@ (<>.some <code>.local_identifier)))) code <code>.any]) (case declaration - (#.Left name) + {#.Left name} (macro.with_identifiers [g!_] (let [nameC (code.local_identifier name) code_nameC (code.local_identifier (format "@" name)) @@ -138,7 +138,7 @@ (function ((~ g!_) (~ g!_)) (_.set (list (~ g!_)) (~ code)))))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (macro.with_identifiers [g!_] (let [nameC (code.local_identifier name) code_nameC (code.local_identifier (format "@" name)) @@ -174,7 +174,7 @@ (runtime: (lux::exec code globals) ($_ _.then - (_.exec code (#.Some globals)) + (_.exec code {#.Some globals}) (_.return ..unit))) (def: runtime::lux diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux index 3d0903731..5950a81ff 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/structure.lux @@ -20,7 +20,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux index 4a6d95239..4e3e67097 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r.lux @@ -36,7 +36,7 @@ [////synthesis.f64 /primitive.f64] [////synthesis.text /primitive.text]) - (#////synthesis.Reference value) + {#////synthesis.Reference value} (//reference.reference /reference.system archive value) (^template [<tag> <generator>] @@ -54,6 +54,6 @@ [////synthesis.loop/recur /loop.recur] [////synthesis.function/abstraction /function.function]) - (#////synthesis.Extension extension) + {#////synthesis.Extension extension} (///extension.apply archive generate extension) )) 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 83859e8be..15e9c75e5 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 @@ -135,20 +135,20 @@ (Generator Path) (function (recur pathP) (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (expression archive bodyS) #/////synthesis.Pop (///////phase\in ..pop_cursor!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.set! (..register register) ..peek)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None @@ -162,7 +162,7 @@ then!)))) (^template [<tag> <format> <=>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (do ! @@ -170,7 +170,7 @@ (in [(<=> (|> match <format>) ..peek) then!]))) - (#.Item item))] + {#.Item item})] (in (list\mix (function (_ [when then] else) (_.if when then else)) ..fail! @@ -214,9 +214,9 @@ ..save_cursor! leftO) #.None - (#.Some (..catch ($_ _.then + {#.Some (..catch ($_ _.then ..restore_cursor! - rightO))) + rightO))} #.None))) ))) @@ -226,7 +226,7 @@ [pattern_matching! (pattern_matching' expression archive pathP)] (in (_.try pattern_matching! #.None - (#.Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))) + {#.Some (..catch (_.stop (_.string "Invalid expression for pattern-matching.")))} #.None)))) (def: .public (case expression archive [valueS pathP]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux index d240e786b..9d2c878cf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/common.lux @@ -126,10 +126,10 @@ (function (_ proc_name) (function (_ translate inputsS) (case (s.result inputsS ($_ p.and s.nat (s.tuple (p.many s.any)) s.any)) - (#e.Success [offset initsS+ bodyS]) + {#e.Success [offset initsS+ bodyS]} (loopT.translate_loop translate offset initsS+ bodyS) - (#e.Error error) + {#e.Error error} (&.throw Wrong_Syntax (wrong_syntax proc_name inputsS))) ))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux index ea6f59abd..4975c0aec 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/procedure/host.lux @@ -25,7 +25,7 @@ ... (def: (lua//global proc translate inputs) ... (-> Text @.Proc) ... (case inputs -... (^ (list [_ (#.Text name)])) +... (^ (list [_ {#.Text name}])) ... (do macro.Monad<Meta> ... [] ... (in name)) @@ -56,7 +56,7 @@ ... (def: (table//call proc translate inputs) ... (-> Text @.Proc) ... (case inputs -... (^ (list& tableS [_ (#.Text field)] argsS+)) +... (^ (list& tableS [_ {#.Text field}] argsS+)) ... (do [@ macro.Monad<Meta>] ... [tableO (translate tableS) ... argsO+ (monad.each @ translate argsS+)] 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 e7d794d5e..246a010c9 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 @@ -98,7 +98,7 @@ (let [runtime (code.local_identifier (///reference.artifact [..module_id runtime_id])) runtime_name (` (_.var (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (let [g!name (code.local_identifier name)] (in (list (` (def: .public (~ g!name) _.SVar @@ -108,7 +108,7 @@ _.Expression (_.set! (~ runtime_name) (~ code))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (let [g!name (code.local_identifier name) inputsC (list\each code.local_identifier inputs) inputs_typesC (list\each (function.constant (` _.Expression)) @@ -524,9 +524,9 @@ (_.set! value (_.apply (list ..unit) op)) (..right value)) #.None - (#.Some (_.function (list error) + {#.Some (_.function (list error) (..left (_.item (_.string "message") - error)))) + error)))} #.None))) (runtime: (lux::program_args program_args) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux index 4d6562a4f..711366595 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/structure.lux @@ -23,7 +23,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (expression archive singletonS) _ 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 4913559a1..49389b109 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 @@ -73,18 +73,18 @@ (All (_ expression) (-> (System expression) Variable expression)) (case variable - (#variable.Local register) + {#variable.Local register} (..local system register) - (#variable.Foreign register) + {#variable.Foreign register} (..foreign system register))) (def: .public (reference system archive reference) (All (_ anchor expression directive) (-> (System expression) Archive Reference (////generation.Operation anchor expression directive expression))) (case reference - (#reference.Constant value) + {#reference.Constant value} (..constant system archive value) - (#reference.Variable value) + {#reference.Variable value} (phase\in (..variable system value)))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux index 9202b75d3..b9202972d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby.lux @@ -65,10 +65,10 @@ (^ (////synthesis.loop/recur _)) (//////phase.except ..cannot_recur_as_an_expression []) - (#////synthesis.Reference value) + {#////synthesis.Reference value} (//reference.reference /reference.system archive value) - (#////synthesis.Extension extension) + {#////synthesis.Extension extension} (///extension.apply archive expression extension))) (def: .public generate 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 8d19caff8..1e6cb7058 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 @@ -188,34 +188,34 @@ (-> (-> Path (Operation Statement)) (-> Path (Operation (Maybe Statement)))) (.case pathP - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None (in ..fail!))] - (in (#.Some (.if when + (in {#.Some (.if when (_.if ..peek then! else!) (_.if ..peek else! - then!))))) + then!))})) (^template [<tag> <format>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (\ ! each (|>> [(_.= (|> match <format>) ..peek)]) (recur then))) - (#.Item item))] - (in (#.Some (_.cond clauses - ..fail!))))]) + {#.Item item})] + (in {#.Some (_.cond clauses + ..fail!)}))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] [#/////synthesis.F64_Fork (<| //primitive.f64)] [#/////synthesis.Text_Fork (<| //primitive.text)]) @@ -229,25 +229,25 @@ (do ///////phase.monad [?output (primitive_pattern_matching recur pathP)] (.case ?output - (#.Some output) + {#.Some output} (in output) #.None (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (statement expression archive bodyS) #/////synthesis.Pop (///////phase\in ..pop!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.set (list (..register register)) ..peek)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None @@ -261,14 +261,14 @@ then!)))) (^template [<tag> <format>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (\ ! each (|>> [(_.= (|> match <format>) ..peek)]) (recur then))) - (#.Item item))] + {#.Item item})] (in (_.cond clauses ..fail!)))]) ([#/////synthesis.I64_Fork (<| //primitive.i64 .int)] 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 108f98020..091d1fd31 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 @@ -84,7 +84,7 @@ initialize_self! (list.indices arity)) [declaration instatiation] (with_closure closureO+ function_name - (_.lambda (#.Some @self) (list (_.variadic @curried)) + (_.lambda {#.Some @self} (list (_.variadic @curried)) ($_ _.then (_.set (list @num_args) (_.the "length" @curried)) (_.cond (list [(|> @num_args (_.= arityO)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index c5f424373..643bde0b2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -96,7 +96,7 @@ (let [runtime (code.local_identifier (///reference.artifact [..module_id runtime_id])) runtime_name (` (_.local (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (macro.with_identifiers [g!_] (let [g!name (code.local_identifier name)] (in (list (` (def: .public (~ g!name) LVar (~ runtime_name))) @@ -106,7 +106,7 @@ (function ((~ g!_) (~ g!name)) (_.set (list (~ g!name)) (~ code)))))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (macro.with_identifiers [g!_] (let [g!name (code.local_identifier name) inputsC (list\each code.local_identifier inputs) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux index a93fba45e..32ec74e4f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/structure.lux @@ -20,7 +20,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (generate archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux index 079ef448c..20108a0cd 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme.lux @@ -36,7 +36,7 @@ [////synthesis.f64 /primitive.f64] [////synthesis.text /primitive.text]) - (#////synthesis.Reference value) + {#////synthesis.Reference value} (//reference.reference /reference.system archive value) (^template [<tag> <generator>] @@ -54,6 +54,6 @@ [////synthesis.loop/recur /loop.recur] [////synthesis.function/abstraction /function.function]) - (#////synthesis.Extension extension) + {#////synthesis.Extension extension} (///extension.apply archive generate extension) )) 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 16a00e907..bfdb9bf93 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 @@ -129,20 +129,20 @@ (Generator Path) (function (recur pathP) (.case pathP - (#/////synthesis.Then bodyS) + {#/////synthesis.Then bodyS} (expression archive bodyS) #/////synthesis.Pop (///////phase\in pop_cursor!) - (#/////synthesis.Bind register) + {#/////synthesis.Bind register} (///////phase\in (_.define_constant (..register register) ..peek)) - (#/////synthesis.Bit_Fork when thenP elseP) + {#/////synthesis.Bit_Fork when thenP elseP} (do [! ///////phase.monad] [then! (recur thenP) else! (.case elseP - (#.Some elseP) + {#.Some elseP} (recur elseP) #.None @@ -156,7 +156,7 @@ then!)))) (^template [<tag> <format> <=>] - [(<tag> item) + [{<tag> item} (do [! ///////phase.monad] [clauses (monad.each ! (function (_ [match then]) (do ! @@ -164,7 +164,7 @@ (in [(<=> (|> match <format>) ..peek) then!]))) - (#.Item item))] + {#.Item item})] (in (list\mix (function (_ [when then] else) (_.if when then else)) ..fail! 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 d18881c4d..f0d2751f3 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 @@ -76,7 +76,7 @@ @num_args (_.var "num_args") @self (_.var (///reference.artifact function_name))]] (with_closure closureO+ - (_.letrec (list [@self (_.lambda [(list) (#.Some @curried)] + (_.letrec (list [@self (_.lambda [(list) {#.Some @curried}] (_.let (list [@num_args (_.length/1 @curried)]) (<| (_.if (|> @num_args (_.=/2 arityO)) (<| (_.let (list [(//case.register 0) @self])) @@ -94,7 +94,7 @@ (apply_poly arity_args) (apply_poly output_func_args)))))) ... (|> @num_args (_.</2 arityO)) - (_.lambda [(list) (#.Some @missing)] + (_.lambda [(list) {#.Some @missing}] (|> @self (apply_poly (_.append/2 @curried @missing))))) ))]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index 996f552b1..0f8ae8b9a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -80,7 +80,7 @@ (let [runtime (code.local_identifier (///reference.artifact [..module_id runtime_id])) runtime_name (` (_.var (~ (code.text (%.code runtime)))))] (case declaration - (#.Left name) + {#.Left name} (let [g!name (code.local_identifier name)] (in (list (` (def: .public (~ g!name) Var @@ -90,7 +90,7 @@ _.Computation (_.define_constant (~ runtime_name) (~ code))))))) - (#.Right [name inputs]) + {#.Right [name inputs]} (let [g!name (code.local_identifier name) inputsC (list\each code.local_identifier inputs) inputs_typesC (list\each (function.constant (` _.Expression)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux index ad071de02..cc84cf77c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/structure.lux @@ -23,7 +23,7 @@ #.End (///////phase\in (//primitive.text /////synthesis.unit)) - (#.Item singletonS #.End) + {#.Item singletonS #.End} (expression archive singletonS) _ diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux index 5b5403a37..faa6739cb 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis.lux @@ -28,18 +28,18 @@ (-> ///analysis.Primitive /.Primitive) (case analysis #///analysis.Unit - (#/.Text /.unit) + {#/.Text /.unit} (^template [<analysis> <synthesis>] - [(<analysis> value) - (<synthesis> value)]) + [{<analysis> value} + {<synthesis> value}]) ([#///analysis.Bit #/.Bit] [#///analysis.Frac #/.F64] [#///analysis.Text #/.Text]) (^template [<analysis> <synthesis>] - [(<analysis> value) - (<synthesis> (.i64 value))]) + [{<analysis> value} + {<synthesis> (.i64 value)}]) ([#///analysis.Nat #/.I64] [#///analysis.Int #/.I64] [#///analysis.Rev #/.I64]))) @@ -48,48 +48,48 @@ Phase (function (optimization' analysis) (case analysis - (#///analysis.Primitive analysis') - (phase\in (#/.Primitive (..primitive analysis'))) + {#///analysis.Primitive analysis'} + (phase\in {#/.Primitive (..primitive analysis')}) - (#///analysis.Reference reference) - (phase\in (#/.Reference reference)) + {#///analysis.Reference reference} + (phase\in {#/.Reference reference}) - (#///analysis.Structure structure) + {#///analysis.Structure structure} (/.with_currying? false (case structure - (#///analysis.Variant variant) + {#///analysis.Variant variant} (do phase.monad [valueS (optimization' (value@ #///analysis.value variant))] (in (/.variant (with@ #///analysis.value valueS variant)))) - (#///analysis.Tuple tuple) + {#///analysis.Tuple tuple} (|> tuple (monad.each phase.monad optimization') (phase\each (|>> /.tuple))))) - (#///analysis.Case inputA branchesAB+) + {#///analysis.Case inputA branchesAB+} (/.with_currying? false (/case.synthesize optimization branchesAB+ archive inputA)) (^ (///analysis.no_op value)) (optimization' value) - (#///analysis.Apply _) + {#///analysis.Apply _} (/.with_currying? false (/function.apply optimization archive analysis)) - (#///analysis.Function environmentA bodyA) + {#///analysis.Function environmentA bodyA} (/function.abstraction optimization environmentA archive bodyA) - (#///analysis.Extension name args) + {#///analysis.Extension name args} (/.with_currying? false (function (_ state) (|> (//extension.apply archive optimization [name args]) (phase.result' state) - (case> (#try.Success output) - (#try.Success output) + (case> {#try.Success output} + {#try.Success output} - (#try.Failure _) + {#try.Failure _} (|> args (monad.each phase.monad optimization') (phase\each (|>> [name] #/.Extension)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux index d42f0da7e..50b89c2e2 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -31,25 +31,25 @@ (def: clean_up (-> Path Path) - (|>> (#/.Seq #/.Pop))) + (|>> {#/.Seq #/.Pop})) (def: (path' pattern end? thenC) (-> Pattern Bit (Operation Path) (Operation Path)) (case pattern - (#///analysis.Simple simple) + {#///analysis.Simple simple} (case simple #///analysis.Unit thenC - (#///analysis.Bit when) + {#///analysis.Bit when} (///\each (function (_ then) - (#/.Bit_Fork when then #.None)) + {#/.Bit_Fork when then #.None}) thenC) (^template [<from> <to> <conversion>] - [(<from> test) + [{<from> test} (///\each (function (_ then) - (<to> [(<conversion> test) then] (list))) + {<to> [(<conversion> test) then] (list)}) thenC)]) ([#///analysis.Nat #/.I64_Fork .i64] [#///analysis.Int #/.I64_Fork .i64] @@ -57,32 +57,32 @@ [#///analysis.Frac #/.F64_Fork |>] [#///analysis.Text #/.Text_Fork |>])) - (#///analysis.Bind register) - (<| (\ ///.monad each (|>> (#/.Seq (#/.Bind register)))) + {#///analysis.Bind register} + (<| (\ ///.monad each (|>> {#/.Seq {#/.Bind register}})) /.with_new_local thenC) - (#///analysis.Complex (#///analysis.Variant [lefts right? value_pattern])) - (<| (///\each (|>> (#/.Seq (#/.Access (#/.Side (if right? - (#.Right lefts) - (#.Left lefts))))))) + {#///analysis.Complex {#///analysis.Variant [lefts right? value_pattern]}} + (<| (///\each (|>> {#/.Seq {#/.Access {#/.Side (if right? + {#.Right lefts} + {#.Left lefts})}}})) (path' value_pattern end?) (when> [(new> (not end?) [])] [(///\each ..clean_up)]) thenC) - (#///analysis.Complex (#///analysis.Tuple tuple)) + {#///analysis.Complex {#///analysis.Tuple tuple}} (let [tuple::last (-- (list.size tuple))] (list\mix (function (_ [tuple::lefts tuple::member] nextC) (.case tuple::member - (#///analysis.Simple #///analysis.Unit) + {#///analysis.Simple #///analysis.Unit} nextC _ (let [right? (n.= tuple::last tuple::lefts) end?' (and end? right?)] - (<| (///\each (|>> (#/.Seq (#/.Access (#/.Member (if right? - (#.Right (-- tuple::lefts)) - (#.Left tuple::lefts))))))) + (<| (///\each (|>> {#/.Seq {#/.Access {#/.Member (if right? + {#.Right (-- tuple::lefts)} + {#.Left tuple::lefts})}}})) (path' tuple::member end?') (when> [(new> (not end?') [])] [(///\each ..clean_up)]) nextC)))) @@ -104,74 +104,74 @@ #.End (list [new_test new_then]) - (#.Item old_item) - (#.Item (weave_branch weave equivalence [new_test new_then] old_item)))])) + {#.Item old_item} + {#.Item (weave_branch weave equivalence [new_test new_then] old_item)})])) (def: (weave_fork weave equivalence new_fork old_fork) (All (_ a) (-> (-> Path Path Path) (Equivalence a) (/.Fork a Path) (/.Fork a Path) (/.Fork a Path))) - (list\mix (..weave_branch weave equivalence) old_fork (#.Item new_fork))) + (list\mix (..weave_branch weave equivalence) old_fork {#.Item new_fork})) (def: (weave new old) (-> Path Path Path) - (with_expansions [<default> (as_is (#/.Alt old new))] + (with_expansions [<default> (as_is {#/.Alt old new})] (case [new old] [_ - (#/.Alt old_left old_right)] - (#/.Alt old_left - (weave new old_right)) + {#/.Alt old_left old_right}] + {#/.Alt old_left + (weave new old_right)} - [(#/.Seq preN postN) - (#/.Seq preO postO)] + [{#/.Seq preN postN} + {#/.Seq preO postO}] (case (weave preN preO) - (#/.Alt _) + {#/.Alt _} <default> woven - (#/.Seq woven (weave postN postO))) + {#/.Seq woven (weave postN postO)}) [#/.Pop #/.Pop] old - [(#/.Bit_Fork new_when new_then new_else) - (#/.Bit_Fork old_when old_then old_else)] + [{#/.Bit_Fork new_when new_then new_else} + {#/.Bit_Fork old_when old_then old_else}] (if (bit\= new_when old_when) - (#/.Bit_Fork old_when - (weave new_then old_then) - (case [new_else old_else] - [#.None #.None] - #.None - - (^or [(#.Some woven_then) #.None] - [#.None (#.Some woven_then)]) - (#.Some woven_then) - - [(#.Some new_else) (#.Some old_else)] - (#.Some (weave new_else old_else)))) - (#/.Bit_Fork old_when - (case new_else - #.None - old_then - - (#.Some new_else) - (weave new_else old_then)) - (#.Some (case old_else - #.None - new_then - - (#.Some old_else) - (weave new_then old_else))))) + {#/.Bit_Fork old_when + (weave new_then old_then) + (case [new_else old_else] + [#.None #.None] + #.None + + (^or [{#.Some woven_then} #.None] + [#.None {#.Some woven_then}]) + {#.Some woven_then} + + [{#.Some new_else} {#.Some old_else}] + {#.Some (weave new_else old_else)})} + {#/.Bit_Fork old_when + (case new_else + #.None + old_then + + {#.Some new_else} + (weave new_else old_then)) + {#.Some (case old_else + #.None + new_then + + {#.Some old_else} + (weave new_then old_else))}}) (^template [<tag> <equivalence>] - [[(<tag> new_fork) (<tag> old_fork)] - (<tag> (..weave_fork weave <equivalence> new_fork old_fork))]) + [[{<tag> new_fork} {<tag> old_fork}] + {<tag> (..weave_fork weave <equivalence> new_fork old_fork)}]) ([#/.I64_Fork i64.equivalence] [#/.F64_Fork frac.equivalence] [#/.Text_Fork text.equivalence]) (^template [<access> <side>] - [[(#/.Access (<access> (<side> newL))) - (#/.Access (<access> (<side> oldL)))] + [[{#/.Access {<access> {<side> newL}}} + {#/.Access {<access> {<side> oldL}}}] (if (n.= newL oldL) old <default>)]) @@ -180,7 +180,7 @@ [#/.Member #.Left] [#/.Member #.Right]) - [(#/.Bind newR) (#/.Bind oldR)] + [{#/.Bind newR} {#/.Bind oldR}] (if (n.= newR oldR) old <default>) @@ -196,23 +196,23 @@ <continue> (as_is (recur (++ lefts) tail)) <member> (as_is (if (list.empty? tail) - (#.Right (-- lefts)) - (#.Left lefts)))] + {#.Right (-- lefts)} + {#.Left lefts}))] (case patterns #.End <failure> - (#.Item head tail) + {#.Item head tail} (case head - (#///analysis.Simple #///analysis.Unit) + {#///analysis.Simple #///analysis.Unit} <continue> - (#///analysis.Bind register) + {#///analysis.Bind register} (if (n.= @selection register) (list <member>) <continue>) - (#///analysis.Complex (#///analysis.Tuple sub_patterns)) + {#///analysis.Complex {#///analysis.Tuple sub_patterns}} (case (get sub_patterns @selection) #.End <continue> @@ -231,8 +231,8 @@ (in (/.branch/case [input (list\mix weave headSP tailSP+)])))) (template: (!masking <variable> <output>) - [[[(#///analysis.Bind <variable>) - (#///analysis.Reference (///reference.local <output>))] + [[[{#///analysis.Bind <variable>} + {#///analysis.Reference (///reference.local <output>)}] (list)]]) (def: .public (synthesize_let synthesize archive input @variable body) @@ -246,7 +246,7 @@ (-> Phase Archive Synthesis Register Register (Operation Synthesis)) (if (n.= @variable @output) (///\in input) - (..synthesize_let synthesize archive input @variable (#///analysis.Reference (///reference.local @output))))) + (..synthesize_let synthesize archive input @variable {#///analysis.Reference (///reference.local @output)}))) (def: .public (synthesize_if synthesize archive test then else) (-> Phase Archive Synthesis Analysis Analysis (Operation Synthesis)) @@ -257,7 +257,7 @@ (template: (!get <patterns> <output>) [[[(///analysis.pattern/tuple <patterns>) - (#///analysis.Reference (///reference.local <output>))] + {#///analysis.Reference (///reference.local <output>)}] (.list)]]) (def: .public (synthesize_get synthesize archive input patterns @member) @@ -282,7 +282,7 @@ (^ (!masking @variable @output)) (..synthesize_masking synthesize^ archive inputS @variable @output) - [[(#///analysis.Bind @variable) body] + [[{#///analysis.Bind @variable} body] #.End] (..synthesize_let synthesize^ archive inputS @variable body) @@ -338,26 +338,26 @@ [path path path_storage ..empty] (case path - (^or #/.Pop (#/.Access Access)) + (^or #/.Pop {#/.Access Access}) path_storage (^ (/.path/bind register)) (revised@ #bindings (set.has register) path_storage) - (#/.Bit_Fork _ default otherwise) + {#/.Bit_Fork _ default otherwise} (|> (case otherwise #.None path_storage - (#.Some otherwise) + {#.Some otherwise} (for_path otherwise path_storage)) (for_path default)) - (^or (#/.I64_Fork forks) - (#/.F64_Fork forks) - (#/.Text_Fork forks)) - (|> (#.Item forks) + (^or {#/.I64_Fork forks} + {#/.F64_Fork forks} + {#/.Text_Fork forks}) + (|> {#.Item forks} (list\each product.right) (list\mix for_path path_storage)) @@ -376,16 +376,16 @@ (^ (/.tuple members)) (list\mix for_synthesis synthesis_storage members) - (#/.Reference (#///reference.Variable (#///reference/variable.Local register))) + {#/.Reference {#///reference.Variable {#///reference/variable.Local register}}} (if (set.member? (value@ #bindings synthesis_storage) register) synthesis_storage - (revised@ #dependencies (set.has (#///reference/variable.Local register)) synthesis_storage)) + (revised@ #dependencies (set.has {#///reference/variable.Local register}) synthesis_storage)) - (#/.Reference (#///reference.Variable var)) + {#/.Reference {#///reference.Variable var}} (revised@ #dependencies (set.has var) synthesis_storage) (^ (/.function/apply [functionS argsS])) - (list\mix for_synthesis synthesis_storage (#.Item functionS argsS)) + (list\mix for_synthesis synthesis_storage {#.Item functionS argsS}) (^ (/.function/abstraction [environment arity bodyS])) (list\mix for_synthesis synthesis_storage environment) @@ -423,7 +423,7 @@ (^ (/.loop/recur replacementsS+)) (list\mix for_synthesis synthesis_storage replacementsS+) - (#/.Extension [extension argsS]) + {#/.Extension [extension argsS]} (list\mix for_synthesis synthesis_storage argsS) _ 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 96139976a..278b6343e 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 @@ -85,7 +85,7 @@ (def: (find_foreign environment register) (-> (Environment Synthesis) Register (Operation Synthesis)) (case (list.item register environment) - (#.Some aliased) + {#.Some aliased} (phase\in aliased) #.None @@ -94,30 +94,30 @@ (def: (grow_path grow path) (-> (-> Synthesis (Operation Synthesis)) Path (Operation Path)) (case path - (#/.Bind register) - (phase\in (#/.Bind (++ register))) + {#/.Bind register} + (phase\in {#/.Bind (++ register)}) (^template [<tag>] - [(<tag> left right) + [{<tag> left right} (do phase.monad [left' (grow_path grow left) right' (grow_path grow right)] - (in (<tag> left' right')))]) + (in {<tag> left' right'}))]) ([#/.Alt] [#/.Seq]) - (#/.Bit_Fork when then else) + {#/.Bit_Fork when then else} (do [! phase.monad] [then (grow_path grow then) else (case else - (#.Some else) - (\ ! each (|>> #.Some) (grow_path grow else)) + {#.Some else} + (\ ! each (|>> {#.Some}) (grow_path grow else)) #.None (in #.None))] - (in (#/.Bit_Fork when then else))) + (in {#/.Bit_Fork when then else})) (^template [<tag>] - [(<tag> [[test then] elses]) + [{<tag> [[test then] elses]} (do [! phase.monad] [then (grow_path grow then) elses (monad.each ! (function (_ [else_test else_then]) @@ -125,15 +125,15 @@ [else_then (grow_path grow else_then)] (in [else_test else_then]))) elses)] - (in (<tag> [[test then] elses])))]) + (in {<tag> [[test then] elses]}))]) ([#/.I64_Fork] [#/.F64_Fork] [#/.Text_Fork]) - (#/.Then thenS) + {#/.Then thenS} (|> thenS grow - (phase\each (|>> #/.Then))) + (phase\each (|>> {#/.Then}))) _ (phase\in path))) @@ -141,14 +141,14 @@ (def: (grow environment expression) (-> (Environment Synthesis) Synthesis (Operation Synthesis)) (case expression - (#/.Structure structure) + {#/.Structure structure} (case structure - (#////analysis.Variant [lefts right? subS]) + {#////analysis.Variant [lefts right? subS]} (|> subS (grow environment) (phase\each (|>> [lefts right?] /.variant))) - (#////analysis.Tuple membersS+) + {#////analysis.Tuple membersS+} (|> membersS+ (monad.each phase.monad (grow environment)) (phase\each (|>> /.tuple)))) @@ -156,66 +156,66 @@ (^ (..self_reference)) (phase\in (/.function/apply [expression (list (/.variable/local 1))])) - (#/.Reference reference) + {#/.Reference reference} (case reference - (#////reference.Variable variable) + {#////reference.Variable variable} (case variable - (#////reference/variable.Local register) + {#////reference/variable.Local register} (phase\in (/.variable/local (++ register))) - (#////reference/variable.Foreign register) + {#////reference/variable.Foreign register} (..find_foreign environment register)) - (#////reference.Constant constant) + {#////reference.Constant constant} (phase\in expression)) - (#/.Control control) + {#/.Control control} (case control - (#/.Branch branch) + {#/.Branch branch} (case branch - (#/.Let [inputS register bodyS]) + {#/.Let [inputS register bodyS]} (do phase.monad [inputS' (grow environment inputS) bodyS' (grow environment bodyS)] (in (/.branch/let [inputS' (++ register) bodyS']))) - (#/.If [testS thenS elseS]) + {#/.If [testS thenS elseS]} (do phase.monad [testS' (grow environment testS) thenS' (grow environment thenS) elseS' (grow environment elseS)] (in (/.branch/if [testS' thenS' elseS']))) - (#/.Get members inputS) + {#/.Get members inputS} (do phase.monad [inputS' (grow environment inputS)] (in (/.branch/get [members inputS']))) - (#/.Case [inputS pathS]) + {#/.Case [inputS pathS]} (do phase.monad [inputS' (grow environment inputS) pathS' (grow_path (grow environment) pathS)] (in (/.branch/case [inputS' pathS'])))) - (#/.Loop loop) + {#/.Loop loop} (case loop - (#/.Scope [start initsS+ iterationS]) + {#/.Scope [start initsS+ iterationS]} (do [! phase.monad] [initsS+' (monad.each ! (grow environment) initsS+) iterationS' (grow environment iterationS)] (in (/.loop/scope [(++ start) initsS+' iterationS']))) - (#/.Recur argumentsS+) + {#/.Recur argumentsS+} (|> argumentsS+ (monad.each phase.monad (grow environment)) (phase\each (|>> /.loop/recur)))) - (#/.Function function) + {#/.Function function} (case function - (#/.Abstraction [_env _arity _body]) + {#/.Abstraction [_env _arity _body]} (do [! phase.monad] [_env' (monad.each ! - (|>> (case> (#/.Reference (#////reference.Variable (#////reference/variable.Foreign register))) + (|>> (case> {#/.Reference {#////reference.Variable {#////reference/variable.Foreign register}}} (..find_foreign environment register) captured @@ -223,7 +223,7 @@ _env)] (in (/.function/abstraction [_env' _arity _body]))) - (#/.Apply funcS argsS+) + {#/.Apply funcS argsS+} (do [! phase.monad] [funcS (grow environment funcS) argsS+ (monad.each ! (grow environment) argsS+)] @@ -236,12 +236,12 @@ [funcS argsS+])))))) - (#/.Extension name argumentsS+) + {#/.Extension name argumentsS+} (|> argumentsS+ (monad.each phase.monad (grow environment)) - (phase\each (|>> (#/.Extension name)))) + (phase\each (|>> {#/.Extension name}))) - (#/.Primitive _) + {#/.Primitive _} (phase\in expression))) (def: .public (abstraction phase environment archive bodyA) @@ -269,7 +269,7 @@ (in (if currying? (/.function/abstraction abstraction) (case (//loop.optimization false 1 (list) abstraction) - (#.Some [startL initsL bodyL]) + {#.Some [startL initsL bodyL]} (/.function/abstraction [#/.environment environment #/.arity (value@ #/.arity abstraction) #/.body (/.loop/scope [startL initsL bodyL])]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 3b9d37fdd..c65c261e8 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux @@ -30,30 +30,30 @@ (-> (Transform Synthesis) Register (Transform Path)) (function (recur path) (case path - (#/.Bind register) - (#.Some (#/.Bind (register_optimization offset register))) + {#/.Bind register} + {#.Some {#/.Bind (register_optimization offset register)}} (^template [<tag>] - [(<tag> left right) + [{<tag> left right} (do maybe.monad [left' (recur left) right' (recur right)] - (in (<tag> left' right')))]) + (in {<tag> left' right'}))]) ([#/.Alt] [#/.Seq]) - (#/.Bit_Fork when then else) + {#/.Bit_Fork when then else} (do [! maybe.monad] [then (recur then) else (case else - (#.Some else) + {#.Some else} (\ ! each (|>> #.Some) (recur else)) #.None (in #.None))] - (in (#/.Bit_Fork when then else))) + (in {#/.Bit_Fork when then else})) (^template [<tag>] - [(<tag> [[test then] elses]) + [{<tag> [[test then] elses]} (do [! maybe.monad] [then (recur then) elses (monad.each ! (function (_ [else_test else_then]) @@ -61,58 +61,58 @@ [else_then (recur else_then)] (in [else_test else_then]))) elses)] - (in (<tag> [[test then] elses])))]) + (in {<tag> [[test then] elses]}))]) ([#/.I64_Fork] [#/.F64_Fork] [#/.Text_Fork]) - (#/.Then body) + {#/.Then body} (|> body body_optimization - (maybe\each (|>> #/.Then))) + (maybe\each (|>> {#/.Then}))) _ - (#.Some path)))) + {#.Some path}))) (def: (body_optimization true_loop? offset scope_environment arity expr) (-> Bit Register (Environment Synthesis) Arity (Transform Synthesis)) (loop [return? true expr expr] (case expr - (#/.Primitive _) - (#.Some expr) + {#/.Primitive _} + {#.Some expr} - (#/.Structure structure) + {#/.Structure structure} (case structure - (#analysis.Variant variant) + {#analysis.Variant variant} (do maybe.monad [value' (|> variant (value@ #analysis.value) (recur false))] (in (|> variant (with@ #analysis.value value') /.variant))) - (#analysis.Tuple tuple) + {#analysis.Tuple tuple} (|> tuple (monad.each maybe.monad (recur false)) (maybe\each (|>> /.tuple)))) - (#/.Reference reference) + {#/.Reference reference} (case reference - (^ (#reference.Variable (variable.self))) + (^ {#reference.Variable (variable.self)}) (if true_loop? #.None - (#.Some expr)) + {#.Some expr}) (^ (reference.constant constant)) - (#.Some expr) + {#.Some expr} (^ (reference.local register)) - (#.Some (#/.Reference (reference.local (register_optimization offset register)))) + {#.Some {#/.Reference (reference.local (register_optimization offset register))}} (^ (reference.foreign register)) (if true_loop? (list.item register scope_environment) - (#.Some expr))) + {#.Some expr})) (^ (/.branch/case [input path])) (do maybe.monad @@ -165,7 +165,7 @@ [abstraction' (recur false abstraction)] (in (/.function/apply [abstraction' arguments']))))] (case abstraction - (^ (#/.Reference (#reference.Variable (variable.self)))) + (^ {#/.Reference {#reference.Variable (variable.self)}}) (if (and return? (n.= arity (list.size arguments))) (in (/.loop/recur arguments')) @@ -177,30 +177,30 @@ <application>))) ... TODO: Stop relying on this custom code. - (^ (#/.Extension ["lux syntax char case!" (list& input else matches)])) + (^ {#/.Extension ["lux syntax char case!" (list& input else matches)]}) (if return? (do [! maybe.monad] [input (recur false input) matches (monad.each ! (function (_ match) (case match - (^ (#/.Structure (#analysis.Tuple (list when then)))) + (^ {#/.Structure {#analysis.Tuple (list when then)}}) (do ! [when (recur false when) then (recur return? then)] - (in (#/.Structure (#analysis.Tuple (list when then))))) + (in {#/.Structure {#analysis.Tuple (list when then)}})) _ (recur false match))) matches) else (recur return? else)] - (in (#/.Extension ["lux syntax char case!" (list& input else matches)]))) + (in {#/.Extension ["lux syntax char case!" (list& input else matches)]})) #.None) - (#/.Extension [name args]) + {#/.Extension [name args]} (|> args (monad.each maybe.monad (recur false)) - (maybe\each (|>> [name] #/.Extension)))))) + (maybe\each (|>> [name] {#/.Extension})))))) (def: .public (optimization true_loop? offset inits functionS) (-> Bit Register (List Synthesis) Abstraction (Maybe [Register (List Synthesis) Synthesis])) 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 91e229d1a..757bdb4c3 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 @@ -39,133 +39,133 @@ (-> (Remover Synthesis) (Remover Path)) (function (recur path) (case path - (#/.Seq (#/.Bind register) - post) + {#/.Seq {#/.Bind register} + post} (if (n.= redundant register) (recur post) - (#/.Seq (#/.Bind (if (n.> redundant register) + {#/.Seq {#/.Bind (if (n.> redundant register) (-- register) - register)) - (recur post))) + register)} + (recur post)}) - (^or (#/.Seq (#/.Access (#/.Member member)) - (#/.Seq (#/.Bind register) - post)) + (^or {#/.Seq {#/.Access {#/.Member member}} + {#/.Seq {#/.Bind register} + post}} ... This alternative form should never occur in practice. ... Yet, it is "technically" possible to construct it. - (#/.Seq (#/.Seq (#/.Access (#/.Member member)) - (#/.Bind register)) - post)) + {#/.Seq {#/.Seq {#/.Access {#/.Member member}} + {#/.Bind register}} + post}) (if (n.= redundant register) (recur post) - (#/.Seq (#/.Access (#/.Member member)) - (#/.Seq (#/.Bind (if (n.> redundant register) - (-- register) - register)) - (recur post)))) + {#/.Seq {#/.Access {#/.Member member}} + {#/.Seq {#/.Bind (if (n.> redundant register) + (-- register) + register)} + (recur post)}}) (^template [<tag>] - [(<tag> left right) - (<tag> (recur left) (recur right))]) + [{<tag> left right} + {<tag> (recur left) (recur right)}]) ([#/.Seq] [#/.Alt]) - (#/.Bit_Fork when then else) - (#/.Bit_Fork when (recur then) (maybe\each recur else)) + {#/.Bit_Fork when then else} + {#/.Bit_Fork when (recur then) (maybe\each recur else)} (^template [<tag>] - [(<tag> [[test then] tail]) - (<tag> [[test (recur then)] + [{<tag> [[test then] tail]} + {<tag> [[test (recur then)] (list\each (function (_ [test' then']) [test' (recur then')]) - tail)])]) + tail)]}]) ([#/.I64_Fork] [#/.F64_Fork] [#/.Text_Fork]) (^or #/.Pop - (#/.Access _)) + {#/.Access _}) path - (#/.Bind register) + {#/.Bind register} (undefined) - (#/.Then then) - (#/.Then (remove_local redundant then)) + {#/.Then then} + {#/.Then (remove_local redundant then)} ))) (def: (remove_local_from_variable redundant variable) (Remover Variable) (case variable - (#variable.Local register) - (#variable.Local (..prune redundant register)) + {#variable.Local register} + {#variable.Local (..prune redundant register)} - (#variable.Foreign register) + {#variable.Foreign register} variable)) (def: (remove_local redundant) (Remover Synthesis) (function (recur synthesis) (case synthesis - (#/.Primitive _) + {#/.Primitive _} synthesis - (#/.Structure structure) - (#/.Structure (case structure - (#analysis.Variant [lefts right value]) - (#analysis.Variant [lefts right (recur value)]) + {#/.Structure structure} + {#/.Structure (case structure + {#analysis.Variant [lefts right value]} + {#analysis.Variant [lefts right (recur value)]} - (#analysis.Tuple tuple) - (#analysis.Tuple (list\each recur tuple)))) + {#analysis.Tuple tuple} + {#analysis.Tuple (list\each recur tuple)})} - (#/.Reference reference) + {#/.Reference reference} (case reference - (#reference.Variable variable) + {#reference.Variable variable} (/.variable (..remove_local_from_variable redundant variable)) - (#reference.Constant constant) + {#reference.Constant constant} synthesis) - (#/.Control control) - (#/.Control (case control - (#/.Branch branch) - (#/.Branch (case branch - (#/.Let input register output) - (#/.Let (recur input) - (..prune redundant register) - (recur output)) + {#/.Control control} + {#/.Control (case control + {#/.Branch branch} + {#/.Branch (case branch + {#/.Let input register output} + {#/.Let (recur input) + (..prune redundant register) + (recur output)} - (#/.If test then else) - (#/.If (recur test) (recur then) (recur else)) + {#/.If test then else} + {#/.If (recur test) (recur then) (recur else)} - (#/.Get path record) - (#/.Get path (recur record)) + {#/.Get path record} + {#/.Get path (recur record)} - (#/.Case input path) - (#/.Case (recur input) (remove_local_from_path remove_local redundant path)))) + {#/.Case input path} + {#/.Case (recur input) (remove_local_from_path remove_local redundant path)})} - (#/.Loop loop) - (#/.Loop (case loop - (#/.Scope [start inits iteration]) - (#/.Scope [(..prune redundant start) + {#/.Loop loop} + {#/.Loop (case loop + {#/.Scope [start inits iteration]} + {#/.Scope [(..prune redundant start) (list\each recur inits) - (recur iteration)]) + (recur iteration)]} - (#/.Recur resets) - (#/.Recur (list\each recur resets)))) + {#/.Recur resets} + {#/.Recur (list\each recur resets)})} - (#/.Function function) - (#/.Function (case function - (#/.Abstraction [environment arity body]) - (#/.Abstraction [(list\each recur environment) + {#/.Function function} + {#/.Function (case function + {#/.Abstraction [environment arity body]} + {#/.Abstraction [(list\each recur environment) arity - body]) + body]} - (#/.Apply abstraction inputs) - (#/.Apply (recur abstraction) (list\each recur inputs)))))) + {#/.Apply abstraction inputs} + {#/.Apply (recur abstraction) (list\each recur inputs)})})} - (#/.Extension name inputs) - (#/.Extension name (list\each recur inputs))))) + {#/.Extension name inputs} + {#/.Extension name (list\each recur inputs)}))) (type: Redundancy (Dictionary Register Bit)) @@ -198,15 +198,15 @@ (function (recur [redundancy values]) (case values #.End - (#try.Success [redundancy - values]) + {#try.Success [redundancy + values]} - (#.Item head tail) + {#.Item head tail} (do try.monad [[redundancy head] (optimization [redundancy head]) [redundancy tail] (recur [redundancy tail])] (in [redundancy - (#.Item head tail)]))))) + {#.Item head tail}]))))) (template [<name>] [(exception: .public (<name> [register Register]) @@ -221,9 +221,9 @@ (-> Register Redundancy (Try Redundancy)) (case (dictionary.value register redundancy) #.None - (#try.Success (dictionary.has register ..redundant! redundancy)) + {#try.Success (dictionary.has register ..redundant! redundancy)} - (#.Some _) + {#.Some _} (exception.except ..redundant_declaration [register]))) (def: (observe register redundancy) @@ -232,8 +232,8 @@ #.None (exception.except ..unknown_register [register]) - (#.Some _) - (#try.Success (dictionary.has register ..necessary! redundancy)))) + {#.Some _} + {#try.Success (dictionary.has register ..necessary! redundancy)})) (def: (format redundancy) (%.Format Redundancy) @@ -248,26 +248,26 @@ (function (recur [redundancy path]) (case path (^or #/.Pop - (#/.Access _)) - (#try.Success [redundancy - path]) + {#/.Access _}) + {#try.Success [redundancy + path]} - (#/.Bit_Fork when then else) + {#/.Bit_Fork when then else} (do [! try.monad] [[redundancy then] (recur [redundancy then]) [redundancy else] (case else - (#.Some else) + {#.Some else} (\ ! each (function (_ [redundancy else]) - [redundancy (#.Some else)]) + [redundancy {#.Some else}]) (recur [redundancy else])) #.None (in [redundancy #.None]))] - (in [redundancy (#/.Bit_Fork when then else)])) + (in [redundancy {#/.Bit_Fork when then else}])) (^template [<tag> <type>] - [(<tag> [[test then] elses]) + [{<tag> [[test then] elses]} (do [! try.monad] [[redundancy then] (recur [redundancy then]) [redundancy elses] (..list_optimization (: (Optimization [<type> Path]) @@ -276,24 +276,24 @@ [[redundancy else_then] (recur [redundancy else_then])] (in [redundancy [else_test else_then]])))) [redundancy elses])] - (in [redundancy (<tag> [[test then] elses])]))]) + (in [redundancy {<tag> [[test then] elses]}]))]) ([#/.I64_Fork (I64 Any)] [#/.F64_Fork Frac] [#/.Text_Fork Text]) - (#/.Bind register) + {#/.Bind register} (do try.monad [redundancy (..declare register redundancy)] (in [redundancy path])) - (#/.Alt left right) + {#/.Alt left right} (do try.monad [[redundancy left] (recur [redundancy left]) [redundancy right] (recur [redundancy right])] - (in [redundancy (#/.Alt left right)])) + (in [redundancy {#/.Alt left right}])) - (#/.Seq pre post) + {#/.Seq pre post} (do try.monad [.let [baseline (|> redundancy dictionary.keys @@ -313,56 +313,56 @@ (in [(list\mix dictionary.lacks redundancy (set.list bindings)) (|> redundants (list.sorted n.>) - (list\mix (..remove_local_from_path ..remove_local) (#/.Seq pre post)))])) + (list\mix (..remove_local_from_path ..remove_local) {#/.Seq pre post}))])) - (#/.Then then) + {#/.Then then} (do try.monad [[redundancy then] (optimization [redundancy then])] - (in [redundancy (#/.Then then)])) + (in [redundancy {#/.Then then}])) ))) (def: (optimization' [redundancy synthesis]) (Optimization Synthesis) - (with_expansions [<no_op> (as_is (#try.Success [redundancy - synthesis]))] + (with_expansions [<no_op> (as_is {#try.Success [redundancy + synthesis]})] (case synthesis - (#/.Primitive _) + {#/.Primitive _} <no_op> - (#/.Structure structure) + {#/.Structure structure} (case structure - (#analysis.Variant [lefts right value]) + {#analysis.Variant [lefts right value]} (do try.monad [[redundancy value] (optimization' [redundancy value])] (in [redundancy - (#/.Structure (#analysis.Variant [lefts right value]))])) + {#/.Structure {#analysis.Variant [lefts right value]}}])) - (#analysis.Tuple tuple) + {#analysis.Tuple tuple} (do try.monad [[redundancy tuple] (..list_optimization optimization' [redundancy tuple])] (in [redundancy - (#/.Structure (#analysis.Tuple tuple))]))) + {#/.Structure {#analysis.Tuple tuple}}]))) - (#/.Reference reference) + {#/.Reference reference} (case reference - (#reference.Variable variable) + {#reference.Variable variable} (case variable - (#variable.Local register) + {#variable.Local register} (do try.monad [redundancy (..observe register redundancy)] <no_op>) - (#variable.Foreign register) + {#variable.Foreign register} <no_op>) - (#reference.Constant constant) + {#reference.Constant constant} <no_op>) - (#/.Control control) + {#/.Control control} (case control - (#/.Branch branch) + {#/.Branch branch} (case branch - (#/.Let input register output) + {#/.Let input register output} (do try.monad [[redundancy input] (optimization' [redundancy input]) redundancy (..declare register redundancy) @@ -371,70 +371,70 @@ (dictionary.value register) (maybe.else ..necessary!))]] (in [(dictionary.lacks register redundancy) - (#/.Control (if redundant? - (#/.Branch (#/.Case input - (#/.Seq #/.Pop - (#/.Then (..remove_local register output))))) - (#/.Branch (#/.Let input register output))))])) + {#/.Control (if redundant? + {#/.Branch {#/.Case input + {#/.Seq #/.Pop + {#/.Then (..remove_local register output)}}}} + {#/.Branch {#/.Let input register output}})}])) - (#/.If test then else) + {#/.If test then else} (do try.monad [[redundancy test] (optimization' [redundancy test]) [redundancy then] (optimization' [redundancy then]) [redundancy else] (optimization' [redundancy else])] (in [redundancy - (#/.Control (#/.Branch (#/.If test then else)))])) + {#/.Control {#/.Branch {#/.If test then else}}}])) - (#/.Get path record) + {#/.Get path record} (do try.monad [[redundancy record] (optimization' [redundancy record])] (in [redundancy - (#/.Control (#/.Branch (#/.Get path record)))])) + {#/.Control {#/.Branch {#/.Get path record}}}])) - (#/.Case input path) + {#/.Case input path} (do try.monad [[redundancy input] (optimization' [redundancy input]) [redundancy path] (..path_optimization optimization' [redundancy path])] (in [redundancy - (#/.Control (#/.Branch (#/.Case input path)))]))) + {#/.Control {#/.Branch {#/.Case input path}}}]))) - (#/.Loop loop) + {#/.Loop loop} (case loop - (#/.Scope [start inits iteration]) + {#/.Scope [start inits iteration]} (do try.monad [[redundancy inits] (..list_optimization optimization' [redundancy inits]) .let [[extension redundancy] (..extended start (list.size inits) redundancy)] [redundancy iteration] (optimization' [redundancy iteration])] (in [(list\mix dictionary.lacks redundancy extension) - (#/.Control (#/.Loop (#/.Scope [start inits iteration])))])) + {#/.Control {#/.Loop {#/.Scope [start inits iteration]}}}])) - (#/.Recur resets) + {#/.Recur resets} (do try.monad [[redundancy resets] (..list_optimization optimization' [redundancy resets])] (in [redundancy - (#/.Control (#/.Loop (#/.Recur resets)))]))) + {#/.Control {#/.Loop {#/.Recur resets}}}]))) - (#/.Function function) + {#/.Function function} (case function - (#/.Abstraction [environment arity body]) + {#/.Abstraction [environment arity body]} (do [! try.monad] [[redundancy environment] (..list_optimization optimization' [redundancy environment]) [_ body] (optimization' [(..default arity) body])] (in [redundancy - (#/.Control (#/.Function (#/.Abstraction [environment arity body])))])) + {#/.Control {#/.Function {#/.Abstraction [environment arity body]}}}])) - (#/.Apply abstraction inputs) + {#/.Apply abstraction inputs} (do try.monad [[redundancy abstraction] (optimization' [redundancy abstraction]) [redundancy inputs] (..list_optimization optimization' [redundancy inputs])] (in [redundancy - (#/.Control (#/.Function (#/.Apply abstraction inputs)))])))) + {#/.Control {#/.Function {#/.Apply abstraction inputs}}}])))) - (#/.Extension name inputs) + {#/.Extension name inputs} (do try.monad [[redundancy inputs] (..list_optimization optimization' [redundancy inputs])] (in [redundancy - (#/.Extension name inputs)]))))) + {#/.Extension name inputs}]))))) (def: .public optimization (-> Synthesis (Try Synthesis)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux index f085683fc..6b9fbfd09 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux @@ -48,7 +48,7 @@ [program_id (artifact.remember ..name registry)] (in [module_id program_id]))) registries) - (#.Some program_context) + {#.Some program_context} (in program_context) #.None 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 ec444b003..b855ced2f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -171,12 +171,12 @@ ["Text" (%.text text)])) (template: (!failure parser where offset source_code) - [(#.Left [[where offset source_code] - (exception.error ..unrecognized_input [where (%.name (name_of parser)) source_code offset])])]) + [{#.Left [[where offset source_code] + (exception.error ..unrecognized_input [where (%.name (name_of parser)) source_code offset])]}]) (template: (!end_of_file where offset source_code current_module) - [(#.Left [[where offset source_code] - (exception.error ..end_of_file current_module)])]) + [{#.Left [[where offset source_code] + (exception.error ..end_of_file current_module)]}]) (type: (Parser a) (-> Source (Either [Source Text] [Source a]))) @@ -193,10 +193,10 @@ (template: (!letE <binding> <computation> <body>) [(case <computation> - (#.Right <binding>) + {#.Right <binding>} <body> - ... (#.Left error) + ... {#.Left error} <<otherwise>> (:expected <<otherwise>>))]) @@ -227,14 +227,14 @@ (loop [source (: Source [(!forward 1 where) offset source_code]) stack (: (List Code) #.End)] (case (parse source) - (#.Right [source' top]) - (recur source' (#.Item top stack)) + {#.Right [source' top]} + (recur source' {#.Item top stack}) - (#.Left [source' error]) + {#.Left [source' error]} (if (same? <close> error) - (#.Right [source' - [where (<tag> (list.reversed stack))]]) - (#.Left [source' error])))))] + {#.Right [source' + [where {<tag> (list.reversed stack)}]]} + {#.Left [source' error]}))))] ... Form and tuple syntax is mostly the same, differing only in the ... delimiters involved. @@ -250,15 +250,15 @@ (loop [source (: Source [(!forward 1 where) offset source_code]) stack (: (List [Code Code]) #.End)] (case (parse source) - (#.Right [sourceF field]) + {#.Right [sourceF field]} (!letE [sourceFV value] (parse sourceF) - (recur sourceFV (#.Item [field value] stack))) + (recur sourceFV {#.Item [field value] stack})) - (#.Left [source' error]) + {#.Left [source' error]} (if (same? ..close_variant error) - (#.Right [source' - [where (#.Record (list.reversed stack))]]) - (#.Left [source' error]))))) + {#.Right [source' + [where {#.Record (list.reversed stack)}]]} + {#.Left [source' error]})))) (template: (!guarantee_no_new_lines where offset source_code content body) [(case ("lux text index" 0 (static text.new_line) content) @@ -266,21 +266,21 @@ body g!_ - (#.Left [[where offset source_code] - (exception.error ..text_cannot_contain_new_lines content)]))]) + {#.Left [[where offset source_code] + (exception.error ..text_cannot_contain_new_lines content)]})]) (def: (text_parser where offset source_code) (-> Location Offset Text (Either [Source Text] [Source Code])) (case ("lux text index" offset (static ..text_delimiter) source_code) - (#.Some g!end) + {#.Some g!end} (<| (let [g!content (!clip offset g!end source_code)]) (!guarantee_no_new_lines where offset source_code g!content) - (#.Right [[(let [size (!n/- offset g!end)] + {#.Right [[(let [size (!n/- offset g!end)] (revised@ #.column (|>> (!n/+ size) (!n/+ 2)) where)) (!++ g!end) source_code] [where - (#.Text g!content)]])) + {#.Text g!content}]]}) _ (!failure ..text_parser where offset source_code))) @@ -338,16 +338,16 @@ (!clip <start> <end>) (text.replaced ..digit_separator "") (\ <codec> decoded)) - (#.Right output) - (#.Right [[(let [[where::file where::line where::column] where] + {#.Right output} + {#.Right [[(let [[where::file where::line where::column] where] [where::file where::line (!n/+ (!n/- <start> <end>) where::column)]) <end> <source_code>] - [where (<tag> output)]]) + [where {<tag> output}]]} - (#.Left error) - (#.Left [[where <start> <source_code>] - error]))]) + {#.Left error} + {#.Left [[where <start> <source_code>] + error]})]) (def: no_exponent Offset @@ -423,10 +423,10 @@ (signed_parser source_code//size offset where (!++/2 offset) source_code) (!full_name_parser offset [where (!++ offset) source_code] where @aliases #.Identifier)))]) -(with_expansions [<output> (#.Right [[(revised@ #.column (|>> (!n/+ (!n/- start end))) where) +(with_expansions [<output> {#.Right [[(revised@ #.column (|>> (!n/+ (!n/- start end))) where) end source_code] - (!clip start end source_code)])] + (!clip start end source_code)]}] (inline: (name_part_parser start where offset source_code) (-> Nat Location Offset Text (Either [Source Text] [Source Text])) @@ -440,7 +440,7 @@ (template: (!half_name_parser @offset @char @module) [(!if_name_char?|head @char (!letE [source' name] (..name_part_parser @offset (!forward 1 where) (!++ @offset) source_code) - (#.Right [source' [@module name]])) + {#.Right [source' [@module name]]}) (!failure ..!half_name_parser where @offset source_code))]) (`` (def: (short_name_parser source_code//size current_module [where offset/0 source_code]) @@ -456,9 +456,9 @@ (template: (!short_name_parser source_code//size @current_module @source @where @tag) [(!letE [source' name] (..short_name_parser source_code//size @current_module @source) - (#.Right [source' [@where (@tag name)]]))]) + {#.Right [source' [@where {@tag name}]]})]) -(with_expansions [<simple> (as_is (#.Right [source' ["" simple]]))] +(with_expansions [<simple> (as_is {#.Right [source' ["" simple]]})] (`` (def: (full_name_parser aliases start source) (-> Aliases Offset (Parser Name)) (<| (!letE [source' simple] (let [[where offset source_code] source] @@ -471,15 +471,15 @@ (if ("lux text =" "" complex) (let [[where offset source_code] source] (!failure ..full_name_parser where offset source_code)) - (#.Right [source'' [(|> aliases + {#.Right [source'' [(|> aliases (dictionary.value simple) (maybe.else simple)) - complex]]))) + complex]]})) <simple>))))) (template: (!full_name_parser @offset @source @where @aliases @tag) [(!letE [source' full_name] (..full_name_parser @aliases @offset @source) - (#.Right [source' [@where (@tag full_name)]]))]) + {#.Right [source' [@where {@tag full_name}]]})]) ... TODO: Grammar macro for specifying syntax. ... (grammar: lux_grammar @@ -492,14 +492,14 @@ <recur> (as_is (parse current_module aliases source_code//size))] (template: (!close closer) - [(#.Left [<move_1> closer])]) + [{#.Left [<move_1> closer]}]) (def: (bit_syntax value [where offset/0 source_code]) (-> Bit (Parser Code)) - (#.Right [[(revised@ #.column (|>> !++/2) where) + {#.Right [[(revised@ #.column (|>> !++/2) where) (!++/2 offset/0) source_code] - [where (#.Bit value)]])) + [where {#.Bit value}]]}) (def: .public (parse current_module aliases source_code//size) (-> Text Aliases Nat (Parser Code)) @@ -566,7 +566,7 @@ (with_expansions [<rev_parser> (rev_parser source_code//size offset/0 where (!++ offset/1) source_code) <short_name_parser> (!short_name_parser source_code//size current_module [where offset/1 source_code] where #.Identifier) <comment_parser> (case ("lux text index" (!++ offset/1) (static text.new_line) source_code) - (#.Some end) + {#.Some end} (recur (!vertical where end source_code)) _ 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 2209cdcce..e718a2469 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux @@ -54,10 +54,10 @@ (type: .public Primitive (Variant - (#Bit Bit) - (#I64 (I64 Any)) - (#F64 Frac) - (#Text Text))) + {#Bit Bit} + {#I64 (I64 Any)} + {#F64 Frac} + {#Text Text})) (type: .public Side (Either Nat Nat)) @@ -67,8 +67,8 @@ (type: .public Access (Variant - (#Side Side) - (#Member Member))) + {#Side Side} + {#Member Member})) (type: .public (Fork value next) [[value next] (List [value next])]) @@ -76,15 +76,15 @@ (type: .public (Path' s) (Variant #Pop - (#Access Access) - (#Bind Register) - (#Bit_Fork Bit (Path' s) (Maybe (Path' s))) - (#I64_Fork (Fork (I64 Any) (Path' s))) - (#F64_Fork (Fork Frac (Path' s))) - (#Text_Fork (Fork Text (Path' s))) - (#Alt (Path' s) (Path' s)) - (#Seq (Path' s) (Path' s)) - (#Then s))) + {#Access Access} + {#Bind Register} + {#Bit_Fork Bit (Path' s) (Maybe (Path' s))} + {#I64_Fork (Fork (I64 Any) (Path' s))} + {#F64_Fork (Fork Frac (Path' s))} + {#Text_Fork (Fork Text (Path' s))} + {#Alt (Path' s) (Path' s)} + {#Seq (Path' s) (Path' s)} + {#Then s})) (type: .public (Abstraction' s) (Record @@ -99,10 +99,10 @@ (type: .public (Branch s) (Variant - (#Let s Register s) - (#If s s s) - (#Get (List Member) s) - (#Case s (Path' s)))) + {#Let s Register s} + {#If s s s} + {#Get (List Member) s} + {#Case s (Path' s)})) (type: .public (Scope s) (Record @@ -112,28 +112,28 @@ (type: .public (Loop s) (Variant - (#Scope (Scope s)) - (#Recur (List s)))) + {#Scope (Scope s)} + {#Recur (List s)})) (type: .public (Function s) (Variant - (#Abstraction (Abstraction' s)) - (#Apply s (List s)))) + {#Abstraction (Abstraction' s)} + {#Apply s (List s)})) (type: .public (Control s) (Variant - (#Branch (Branch s)) - (#Loop (Loop s)) - (#Function (Function s)))) + {#Branch (Branch s)} + {#Loop (Loop s)} + {#Function (Function s)})) (type: .public Synthesis (Rec Synthesis (Variant - (#Primitive Primitive) - (#Structure (Composite Synthesis)) - (#Reference Reference) - (#Control (Control Synthesis)) - (#Extension (Extension Synthesis))))) + {#Primitive Primitive} + {#Structure (Composite Synthesis)} + {#Reference Reference} + {#Control (Control Synthesis)} + {#Extension (Extension Synthesis)}))) (template [<special> <general>] [(type: .public <special> @@ -165,9 +165,9 @@ (template [<name> <kind> <side>] [(template: .public (<name> content) - [(.<| #..Access - <kind> - <side> + [(.<| {#..Access} + {<kind>} + {<side>} content)])] [side/left #..Side #.Left] @@ -178,7 +178,7 @@ (template [<name> <tag>] [(template: .public (<name> content) - [(<tag> content)])] + [{<tag> content}])] [path/bind #..Bind] [path/then #..Then] @@ -186,7 +186,7 @@ (template [<name> <tag>] [(template: .public (<name> left right) - [(<tag> [left right])])] + [{<tag> left right}])] [path/alt #..Alt] [path/seq #..Seq] @@ -223,7 +223,7 @@ (template [<name> <tag>] [(template: .public (<name> content) - [(#..Primitive (<tag> content))])] + [{#..Primitive {<tag> content}}])] [bit #..Bit] [i64 #..I64] @@ -233,8 +233,8 @@ (template [<name> <tag>] [(template: .public (<name> content) - [(<| #..Structure - <tag> + [(<| {#..Structure} + {<tag>} content)])] [variant #analysis.Variant] @@ -243,7 +243,7 @@ (template [<name> <tag>] [(template: .public (<name> content) - [(.<| #..Reference + [(.<| {#..Reference} <tag> content)])] @@ -255,9 +255,9 @@ (template [<name> <family> <tag>] [(template: .public (<name> content) - [(.<| #..Control - <family> - <tag> + [(.<| {#..Control} + {<family>} + {<tag>} content)])] [branch/case #..Branch #..Case] @@ -278,11 +278,11 @@ #Pop "_" - (#Bit_Fork when then else) + {#Bit_Fork when then else} (format "(?" " " (%.bit when) " " (%path' %then then) (case else - (#.Some else) + {#.Some else} (format " " (%.bit (not when)) " " (%path' %then else)) #.None @@ -290,8 +290,8 @@ ")") (^template [<tag> <format>] - [(<tag> item) - (|> (#.Item item) + [{<tag> item} + (|> {#.Item item} (list\each (function (_ [test then]) (format (<format> test) " " (%path' %then then)))) (text.interposed " ") @@ -300,125 +300,125 @@ [#F64_Fork %.frac] [#Text_Fork %.text]) - (#Access access) + {#Access access} (case access - (#Side side) + {#Side side} (case side - (#.Left lefts) + {#.Left lefts} (format "(" (%.nat lefts) " #0" ")") - (#.Right lefts) + {#.Right lefts} (format "(" (%.nat lefts) " #1" ")")) - (#Member member) + {#Member member} (case member - (#.Left lefts) + {#.Left lefts} (format "[" (%.nat lefts) " #0" "]") - (#.Right lefts) + {#.Right lefts} (format "[" (%.nat lefts) " #1" "]"))) - (#Bind register) + {#Bind register} (format "(@ " (%.nat register) ")") - (#Alt left right) + {#Alt left right} (format "(Variant " (%path' %then left) " " (%path' %then right) ")") - (#Seq left right) + {#Seq left right} (format "(Tuple " (%path' %then left) " " (%path' %then right) ")") - (#Then then) + {#Then then} (|> (%then then) (text.enclosed ["(! " ")"])))) (def: .public (%synthesis value) (Format Synthesis) (case value - (#Primitive primitive) + {#Primitive primitive} (case primitive (^template [<pattern> <format>] - [(<pattern> value) + [{<pattern> value} (<format> value)]) ([#Bit %.bit] [#F64 %.frac] [#Text %.text]) - (#I64 value) + {#I64 value} (%.int (.int value))) - (#Structure structure) + {#Structure structure} (case structure - (#analysis.Variant [lefts right? content]) + {#analysis.Variant [lefts right? content]} (|> (%synthesis content) (format (%.nat lefts) " " (%.bit right?) " ") - (text.enclosed ["(" ")"])) + (text.enclosed ["{" "}"])) - (#analysis.Tuple members) + {#analysis.Tuple members} (|> members (list\each %synthesis) (text.interposed " ") (text.enclosed ["[" "]"]))) - (#Reference reference) + {#Reference reference} (reference.format reference) - (#Control control) + {#Control control} (case control - (#Function function) + {#Function function} (case function - (#Abstraction [environment arity body]) + {#Abstraction [environment arity body]} (let [environment' (|> environment (list\each %synthesis) (text.interposed " ") (text.enclosed ["[" "]"]))] (|> (format environment' " " (%.nat arity) " " (%synthesis body)) - (text.enclosed ["(#function " ")"]))) + (text.enclosed ["{#function " "}"]))) - (#Apply func args) + {#Apply func args} (|> args (list\each %synthesis) (text.interposed " ") (format (%synthesis func) " ") (text.enclosed ["(" ")"]))) - (#Branch branch) + {#Branch branch} (case branch - (#Let input register body) + {#Let input register body} (|> (format (%.nat register) " " (%synthesis input) " " (%synthesis body)) - (text.enclosed ["(#let " ")"])) + (text.enclosed ["{#let " "}"])) - (#If test then else) + {#If test then else} (|> (format (%synthesis test) " " (%synthesis then) " " (%synthesis else)) - (text.enclosed ["(#if " ")"])) + (text.enclosed ["{#if " "}"])) - (#Get members record) + {#Get members record} (|> (format (%.list (%path' %synthesis) (list\each (|>> #Member #Access) members)) " " (%synthesis record)) - (text.enclosed ["(#get " ")"])) + (text.enclosed ["{#get " "}"])) - (#Case input path) + {#Case input path} (|> (format (%synthesis input) " " (%path' %synthesis path)) - (text.enclosed ["(#case " ")"]))) + (text.enclosed ["{#case " "}"]))) - (#Loop loop) + {#Loop loop} (case loop - (#Scope scope) + {#Scope scope} (|> (format (%.nat (value@ #start scope)) " " (|> (value@ #inits scope) (list\each %synthesis) (text.interposed " ") (text.enclosed ["[" "]"])) " " (%synthesis (value@ #iteration scope))) - (text.enclosed ["(#loop " ")"])) + (text.enclosed ["{#loop " "}"])) - (#Recur args) + {#Recur args} (|> args (list\each %synthesis) (text.interposed " ") - (text.enclosed ["(#recur " ")"])))) + (text.enclosed ["{#recur " "}"])))) - (#Extension [name args]) + {#Extension [name args]} (|> (list\each %synthesis args) (text.interposed " ") (format (%.text name) " ") @@ -434,13 +434,13 @@ (def: (= reference sample) (case [reference sample] (^template [<tag> <eq> <format>] - [[(<tag> reference') (<tag> sample')] + [[{<tag> reference'} {<tag> sample'}] (<eq> reference' sample')]) ([#Bit bit\= %.bit] [#F64 f.= %.frac] [#Text text\= %.text]) - [(#I64 reference') (#I64 sample')] + [{#I64 reference'} {#I64 sample'}] (i.= (.int reference') (.int sample')) _ @@ -453,7 +453,7 @@ (def: hash (|>> (case> (^template [<tag> <hash>] - [(<tag> value') + [{<tag> value'} (\ <hash> hash value')]) ([#Bit bit.hash] [#F64 f.hash] @@ -478,7 +478,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag> <equivalence>] - [[(<tag> reference) (<tag> sample)] + [[{<tag> reference} {<tag> sample}] (\ <equivalence> = reference sample)]) ([#Side ..side_equivalence] [#Member ..member_equivalence]) @@ -495,7 +495,7 @@ (let [sub_hash (sum.hash n.hash n.hash)] (case value (^template [<tag>] - [(<tag> value) + [{<tag> value} (\ sub_hash hash value)]) ([#Side] [#Member]))))) @@ -508,33 +508,33 @@ [#Pop #Pop] true - [(#Bit_Fork reference_when reference_then reference_else) - (#Bit_Fork sample_when sample_then sample_else)] + [{#Bit_Fork reference_when reference_then reference_else} + {#Bit_Fork sample_when sample_then sample_else}] (and (bit\= reference_when sample_when) (= reference_then sample_then) (\ (maybe.equivalence =) = reference_else sample_else)) (^template [<tag> <equivalence>] - [[(<tag> reference_item) - (<tag> sample_item)] + [[{<tag> reference_item} + {<tag> sample_item}] (\ (list.equivalence (product.equivalence <equivalence> =)) = - (#.Item reference_item) - (#.Item sample_item))]) + {#.Item reference_item} + {#.Item sample_item})]) ([#I64_Fork i64.equivalence] [#F64_Fork f.equivalence] [#Text_Fork text.equivalence]) (^template [<tag> <equivalence>] - [[(<tag> reference') (<tag> sample')] + [[{<tag> reference'} {<tag> sample'}] (\ <equivalence> = reference' sample')]) ([#Access ..access_equivalence] [#Then equivalence]) - [(#Bind reference') (#Bind sample')] + [{#Bind reference'} {#Bind sample'}] (n.= reference' sample') (^template [<tag>] - [[(<tag> leftR rightR) (<tag> leftS rightS)] + [[{<tag> leftR rightR} {<tag> leftS rightS}] (and (= leftR leftS) (= rightR rightS))]) ([#Alt] @@ -554,20 +554,20 @@ #Pop 2 - (#Access access) + {#Access access} (n.* 3 (\ ..access_hash hash access)) - (#Bind register) + {#Bind register} (n.* 5 (\ n.hash hash register)) - (#Bit_Fork when then else) + {#Bit_Fork when then else} ($_ n.* 7 (\ bit.hash hash when) (hash then) (\ (maybe.hash (path'_hash super)) hash else)) (^template [<factor> <tag> <hash>] - [(<tag> item) + [{<tag> item} (let [case_hash (product.hash <hash> (path'_hash super)) item_hash (product.hash case_hash (list.hash case_hash))] @@ -577,14 +577,14 @@ [17 #Text_Fork text.hash]) (^template [<factor> <tag>] - [(<tag> fork) + [{<tag> fork} (let [recur_hash (path'_hash super) fork_hash (product.hash recur_hash recur_hash)] (n.* <factor> (\ fork_hash hash fork)))]) ([19 #Alt] [23 #Seq]) - (#Then body) + {#Then body} (n.* 29 (\ super hash body)) ))) @@ -593,25 +593,25 @@ (def: (= reference sample) (case [reference sample] - [(#Let [reference_input reference_register reference_body]) - (#Let [sample_input sample_register sample_body])] + [{#Let [reference_input reference_register reference_body]} + {#Let [sample_input sample_register sample_body]}] (and (\= reference_input sample_input) (n.= reference_register sample_register) (\= reference_body sample_body)) - [(#If [reference_test reference_then reference_else]) - (#If [sample_test sample_then sample_else])] + [{#If [reference_test reference_then reference_else]} + {#If [sample_test sample_then sample_else]}] (and (\= reference_test sample_test) (\= reference_then sample_then) (\= reference_else sample_else)) - [(#Get [reference_path reference_record]) - (#Get [sample_path sample_record])] + [{#Get [reference_path reference_record]} + {#Get [sample_path sample_record]}] (and (\ (list.equivalence ..member_equivalence) = reference_path sample_path) (\= reference_record sample_record)) - [(#Case [reference_input reference_path]) - (#Case [sample_input sample_path])] + [{#Case [reference_input reference_path]} + {#Case [sample_input sample_path]}] (and (\= reference_input sample_input) (\ (path'_equivalence \=) = reference_path sample_path)) @@ -626,24 +626,24 @@ (def: (hash value) (case value - (#Let [input register body]) + {#Let [input register body]} ($_ n.* 2 (\ super hash input) (\ n.hash hash register) (\ super hash body)) - (#If [test then else]) + {#If [test then else]} ($_ n.* 3 (\ super hash test) (\ super hash then) (\ super hash else)) - (#Get [path record]) + {#Get [path record]} ($_ n.* 5 (\ (list.hash ..member_hash) hash path) (\ super hash record)) - (#Case [input path]) + {#Case [input path]} ($_ n.* 7 (\ super hash input) (\ (..path'_hash super) hash path)) @@ -654,13 +654,13 @@ (def: (= reference sample) (case [reference sample] - [(#Scope [reference_start reference_inits reference_iteration]) - (#Scope [sample_start sample_inits sample_iteration])] + [{#Scope [reference_start reference_inits reference_iteration]} + {#Scope [sample_start sample_inits sample_iteration]}] (and (n.= reference_start sample_start) (\ (list.equivalence \=) = reference_inits sample_inits) (\= reference_iteration sample_iteration)) - [(#Recur reference) (#Recur sample)] + [{#Recur reference} {#Recur sample}] (\ (list.equivalence \=) = reference sample) _ @@ -674,13 +674,13 @@ (def: (hash value) (case value - (#Scope [start inits iteration]) + {#Scope [start inits iteration]} ($_ n.* 2 (\ n.hash hash start) (\ (list.hash super) hash inits) (\ super hash iteration)) - (#Recur resets) + {#Recur resets} ($_ n.* 3 (\ (list.hash super) hash resets)) ))) @@ -690,14 +690,14 @@ (def: (= reference sample) (case [reference sample] - [(#Abstraction [reference_environment reference_arity reference_body]) - (#Abstraction [sample_environment sample_arity sample_body])] + [{#Abstraction [reference_environment reference_arity reference_body]} + {#Abstraction [sample_environment sample_arity sample_body]}] (and (\ (list.equivalence \=) = reference_environment sample_environment) (n.= reference_arity sample_arity) (\= reference_body sample_body)) - [(#Apply [reference_abstraction reference_arguments]) - (#Apply [sample_abstraction sample_arguments])] + [{#Apply [reference_abstraction reference_arguments]} + {#Apply [sample_abstraction sample_arguments]}] (and (\= reference_abstraction sample_abstraction) (\ (list.equivalence \=) = reference_arguments sample_arguments)) @@ -712,13 +712,13 @@ (def: (hash value) (case value - (#Abstraction [environment arity body]) + {#Abstraction [environment arity body]} ($_ n.* 2 (\ (list.hash super) hash environment) (\ n.hash hash arity) (\ super hash body)) - (#Apply [abstraction arguments]) + {#Apply [abstraction arguments]} ($_ n.* 3 (\ super hash abstraction) (\ (list.hash super) hash arguments)) @@ -730,7 +730,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag> <equivalence>] - [[(<tag> reference) (<tag> sample)] + [[{<tag> reference} {<tag> sample}] (\ (<equivalence> \=) = reference sample)]) ([#Branch ..branch_equivalence] [#Loop ..loop_equivalence] @@ -748,7 +748,7 @@ (def: (hash value) (case value (^template [<factor> <tag> <hash>] - [(<tag> value) + [{<tag> value} (n.* <factor> (\ (<hash> super) hash value))]) ([2 #Branch ..branch_hash] [3 #Loop ..loop_hash] @@ -761,7 +761,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag> <equivalence>] - [[(<tag> reference') (<tag> sample')] + [[{<tag> reference'} {<tag> sample'}] (\ <equivalence> = reference' sample')]) ([#Primitive ..primitive_equivalence] [#Structure (analysis.composite_equivalence =)] @@ -785,7 +785,7 @@ (let [recur_hash [..equivalence hash]] (case value (^template [<tag> <hash>] - [(<tag> value) + [{<tag> value} (\ <hash> hash value)]) ([#Primitive ..primitive_hash] [#Structure (analysis.composite_hash recur_hash)] @@ -795,14 +795,14 @@ (template: .public (!bind_top register thenP) [($_ ..path/seq - (#..Bind register) - #..Pop + {#..Bind register} + {#..Pop} thenP)]) (template: .public (!multi_pop nextP) [($_ ..path/seq - #..Pop - #..Pop + {#..Pop} + {#..Pop} nextP)]) ... TODO: There are sister patterns to the simple side checks for tuples. diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux index d7d2fe237..83bbc51e9 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux @@ -92,8 +92,8 @@ (-> Module Archive (Try ID)) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.value module resolver) - (#.Some [id _]) - (#try.Success id) + {#.Some [id _]} + {#try.Success id} #.None (exception.except ..unknown_document [module @@ -103,31 +103,31 @@ (-> Module Archive (Try [ID Archive])) (let [(^slots [#..next #..resolver]) (:representation archive)] (case (dictionary.value module resolver) - (#.Some _) + {#.Some _} (exception.except ..module_has_already_been_reserved [module]) #.None - (#try.Success [next + {#try.Success [next (|> archive :representation (revised@ #..resolver (dictionary.has module [next #.None])) (revised@ #..next ++) - :abstraction)])))) + :abstraction)]}))) (def: .public (has module [descriptor document output] archive) (-> Module [Descriptor (Document Any) Output] Archive (Try Archive)) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.value module resolver) - (#.Some [id #.None]) - (#try.Success (|> archive + {#.Some [id #.None]} + {#try.Success (|> archive :representation - (revised@ #..resolver (dictionary.has module [id (#.Some [descriptor document output])])) - :abstraction)) + (revised@ #..resolver (dictionary.has module [id {#.Some [descriptor document output]}])) + :abstraction)} - (#.Some [id (#.Some [existing_descriptor existing_document existing_output])]) + {#.Some [id {#.Some [existing_descriptor existing_document existing_output]}]} (if (same? document existing_document) ... TODO: Find out why this code allows for the same module to be added more than once. It looks fishy... - (#try.Success archive) + {#try.Success archive} (exception.except ..cannot_replace_document [module existing_document document])) #.None @@ -137,10 +137,10 @@ (-> Module Archive (Try [Descriptor (Document Any) Output])) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.value module resolver) - (#.Some [id (#.Some entry)]) - (#try.Success entry) + {#.Some [id {#.Some entry}]} + {#try.Success entry} - (#.Some [id #.None]) + {#.Some [id #.None]} (exception.except ..module_is_only_reserved [module]) #.None @@ -150,10 +150,10 @@ (def: .public (archived? archive module) (-> Archive Module Bit) (case (..find module archive) - (#try.Success _) + {#try.Success _} bit.yes - (#try.Failure _) + {#try.Failure _} bit.no)) (def: .public archived @@ -163,14 +163,14 @@ dictionary.entries (list.all (function (_ [module [id descriptor+document]]) (case descriptor+document - (#.Some _) (#.Some module) + {#.Some _} {#.Some module} #.None #.None))))) (def: .public (reserved? archive module) (-> Archive Module Bit) (let [(^slots [#..resolver]) (:representation archive)] (case (dictionary.value module resolver) - (#.Some [id _]) + {#.Some [id _]} bit.yes #.None @@ -199,7 +199,7 @@ (revised@ #resolver (function (_ resolver) (list\mix (function (_ [module [id entry]] resolver) (case entry - (#.Some _) + {#.Some _} (dictionary.has module [id entry] resolver) #.None @@ -235,7 +235,7 @@ dictionary.entries (list.all (function (_ [module [id descriptor+document]]) (case descriptor+document - (#.Some _) (#.Some [module id]) + {#.Some _} {#.Some [module id]} #.None #.None))) [version next] (binary.result ..writer)))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux index a9851c301..6c2662602 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux @@ -27,12 +27,12 @@ (type: .public Category (Variant #Anonymous - (#Definition Text) - (#Analyser Text) - (#Synthesizer Text) - (#Generator Text) - (#Directive Text) - (#Custom Text))) + {#Definition Text} + {#Analyser Text} + {#Synthesizer Text} + {#Generator Text} + {#Directive Text} + {#Custom Text})) (type: .public Artifact (Record @@ -75,7 +75,7 @@ (|> registry :representation (revised@ #artifacts (row.suffix [#id id - #category (<tag> name)])) + #category {<tag> name}])) (revised@ #resolver (dictionary.has name id)) :abstraction)])) @@ -86,7 +86,7 @@ (value@ #artifacts) row.list (list.all (|>> (value@ #category) - (case> (<tag> name) (#.Some name) + (case> {<tag> name} {#.Some name} _ #.None)))))] [#Definition definition definitions] @@ -109,7 +109,7 @@ (function (_ value) (case value (^template [<nat> <tag> <writer>] - [(<tag> value) ((binary.and binary.nat <writer>) [<nat> value])]) + [{<tag> value} ((binary.and binary.nat <writer>) [<nat> value])]) ([0 #Anonymous binary.any] [1 #Definition binary.text] [2 #Analyser binary.text] @@ -135,7 +135,7 @@ [tag <binary>.nat] (case tag (^template [<nat> <tag> <parser>] - [<nat> (\ ! each (|>> <tag>) <parser>)]) + [<nat> (\ ! each (|>> {<tag>}) <parser>)]) ([0 #Anonymous <binary>.any] [1 #Definition <binary>.text] [2 #Analyser <binary>.text] @@ -153,7 +153,7 @@ (..resource registry) (^template [<tag> <create>] - [(<tag> name) + [{<tag> name} (<create> name registry)]) ([#Definition ..definition] [#Analyser ..analyser] diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux index 3fcf381d3..96d5a9922 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/archive/document.lux @@ -37,12 +37,12 @@ (if (\ signature.equivalence = (key.signature key) document//signature) - (#try.Success (:sharing [e] + {#try.Success (:sharing [e] (Key e) key e - (:expected document//content))) + (:expected document//content))} (exception.except ..invalid_signature [(key.signature key) document//signature])))) diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux index e839651e4..f586c398a 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux @@ -57,10 +57,10 @@ (function (_ recur module) (do [! state.monad] [.let [parents (case (archive.find module archive) - (#try.Success [descriptor document]) + {#try.Success [descriptor document]} (value@ #descriptor.references descriptor) - (#try.Failure error) + {#try.Failure error} ..fresh)] ancestors (monad.each ! recur (set.list parents))] (in (list\mix set.union parents ancestors))))) 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 1d7baccbd..fe1e8d223 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -95,7 +95,7 @@ (do async.monad [? (\ fs directory? path)] (if ? - (in (#try.Success [])) + (in {#try.Success []}) (\ fs make_directory path)))) (def: .public (prepare fs static module_id) @@ -104,16 +104,16 @@ [.let [module (..module fs static module_id)] module_exists? (\ fs directory? module)] (if module_exists? - (in (#try.Success [])) + (in {#try.Success []}) (do (try.with !) [_ (ensure_directory fs (..unversioned_lux_archive fs static)) _ (ensure_directory fs (..versioned_lux_archive fs static))] (|> module (\ fs make_directory) - (\ ! each (|>> (case> (#try.Success output) - (#try.Success []) + (\ ! each (|>> (case> {#try.Success output} + {#try.Success []} - (#try.Failure error) + {#try.Failure error} (exception.except ..cannot_prepare [(..archive fs static) module_id error]))))))))) @@ -223,7 +223,7 @@ output (: Output row.empty)] (let [[analysers synthesizers generators directives] bundles] (case input - (#.Item [[artifact_id artifact_category] input']) + {#.Item [[artifact_id artifact_category] input']} (case (do ! [data (try.of_maybe (dictionary.value (format (%.nat artifact_id) extension) actual)) .let [context [module_id artifact_id] @@ -240,7 +240,7 @@ directives] output])) - (#artifact.Definition name) + {#artifact.Definition name} (let [output (row.suffix [artifact_id #.None data] output)] (if (text\= $/program.name name) (in [definitions @@ -258,7 +258,7 @@ directives] output])))) - (#artifact.Analyser extension) + {#artifact.Analyser extension} (do ! [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] @@ -269,7 +269,7 @@ directives] output])) - (#artifact.Synthesizer extension) + {#artifact.Synthesizer extension} (do ! [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] @@ -280,7 +280,7 @@ directives] output])) - (#artifact.Generator extension) + {#artifact.Generator extension} (do ! [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] @@ -291,7 +291,7 @@ directives] output])) - (#artifact.Directive extension) + {#artifact.Directive extension} (do ! [.let [output (row.suffix [artifact_id #.None data] output)] value (\ host re_load context #.None directive)] @@ -302,48 +302,48 @@ (dictionary.has extension (:as directive.Handler value) directives)] output])) - (#artifact.Custom name) + {#artifact.Custom name} (do ! - [.let [output (row.suffix [artifact_id (#.Some name) data] output)] - _ (\ host re_learn context (#.Some name) directive)] + [.let [output (row.suffix [artifact_id {#.Some name} data] output)] + _ (\ host re_learn context {#.Some name} directive)] (in [definitions [analysers synthesizers generators directives] output])))) - (#try.Success [definitions' bundles' output']) + {#try.Success [definitions' bundles' output']} (recur input' definitions' bundles' output') failure failure) #.End - (#try.Success [definitions bundles output]))))) + {#try.Success [definitions bundles output]})))) content (document.read $.key document) definitions (monad.each ! (function (_ [def_name def_global]) (case def_global (^template [<tag>] - [(<tag> payload) - (in [def_name (<tag> payload)])]) + [{<tag> payload} + (in [def_name {<tag> payload}])]) ([#.Alias] [#.Label] [#.Slot]) - (#.Definition [exported? type _]) + {#.Definition [exported? type _]} (|> definitions (dictionary.value def_name) try.of_maybe (\ ! each (|>> [exported? type] - #.Definition + {#.Definition} [def_name]))) - (#.Type [exported? _ labels]) + {#.Type [exported? _ labels]} (|> definitions (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]}]))))) (value@ #.definitions content))] (in [(document.write $.key (with@ #.definitions definitions content)) bundles]))) @@ -388,7 +388,7 @@ (|>> (list.all (function (_ [valid_cache? [module_name [module_id _]]]) (if valid_cache? #.None - (#.Some [module_name module_id])))) + {#.Some [module_name module_id]}))) (dictionary.of_list text.hash))) (def: (full_purge caches load_order) @@ -477,12 +477,12 @@ (do async.monad [binary (\ fs read (..general_descriptor fs static))] (case binary - (#try.Success binary) + {#try.Success binary} (do (try.with async.monad) [archive (async\in (archive.import ///.version binary))] (..load_every_reserved_module host_environment fs static import contexts archive)) - (#try.Failure error) - (in (#try.Success [archive.empty + {#try.Failure error} + (in {#try.Success [archive.empty (fresh_analysis_state (value@ #static.host static)) - ..empty_bundles]))))) + ..empty_bundles]})))) 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 af43ef991..69a0858e6 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux @@ -61,12 +61,12 @@ #.End (async\in (exception.except ..cannot_find_module [importer module])) - (#.Item context contexts') + {#.Item context contexts'} (let [path (format (..path fs context module) extension)] (do async.monad [? (\ fs file? path)] (if ? - (in (#try.Success path)) + (in {#try.Success path}) (find_source_file fs importer contexts' module extension)))))) (def: (full_host_extension partial_host_extension) @@ -81,12 +81,12 @@ (do [! async.monad] [outcome (..find_source_file fs importer contexts module (..full_host_extension partial_host_extension))] (case outcome - (#try.Success path) + {#try.Success path} (|> path (\ fs read) (\ (try.with !) each (|>> [path]))) - (#try.Failure _) + {#try.Failure _} (do [! (try.with !)] [path (..find_source_file fs importer contexts module ..lux_extension)] (|> path @@ -97,14 +97,14 @@ (-> Module Import Extension Module (Try [file.Path Binary])) (let [path (format module (..full_host_extension partial_host_extension))] (case (dictionary.value path import) - (#.Some data) - (#try.Success [path data]) + {#.Some data} + {#try.Success [path data]} #.None (let [path (format module ..lux_extension)] (case (dictionary.value path import) - (#.Some data) - (#try.Success [path data]) + {#.Some data} + {#try.Success [path data]} #.None (exception.except ..cannot_find_module [importer module])))))) @@ -117,10 +117,10 @@ (do [! async.monad] [outcome (find_local_source_file fs importer import contexts partial_host_extension module)] (case outcome - (#try.Success [path data]) + {#try.Success [path data]} (in outcome) - (#try.Failure _) + {#try.Failure _} (in (..find_library_source_file importer import partial_host_extension module))))) (def: .public (read fs importer import contexts partial_host_extension module) @@ -129,13 +129,13 @@ (do (try.with async.monad) [[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)] (case (\ utf8.codec decoded binary) - (#try.Success code) + {#try.Success code} (in [#////.module module #////.file path #////.hash (text\hash code) #////.code code]) - (#try.Failure _) + {#try.Failure _} (async\in (exception.except ..cannot_read_module [module]))))) (type: .public Enumeration diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index f8bb67b70..75eca1c30 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -208,29 +208,29 @@ duplicates duplicates sink sink] (case (java/util/jar/JarInputStream::getNextJarEntry input) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success ?entry) + {#try.Success ?entry} (case ?entry #.None (exec (java/io/Closeable::close input) - (#try.Success [entries duplicates sink])) + {#try.Success [entries duplicates sink]}) - (#.Some entry) + {#.Some entry} (let [entry_path (java/util/zip/ZipEntry::getName entry) entry_size (java/util/zip/ZipEntry::getSize entry)] (if (not (or (java/util/zip/ZipEntry::isDirectory entry) (text.starts_with? "META-INF/maven/" entry_path) (text.starts_with? "META-INF/leiningen/" entry_path))) (case (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new entry_path) sink) - (#try.Failure error) + {#try.Failure error} (recur entries (set.has entry_path duplicates) sink) - (#try.Success _) + {#try.Success _} (let [[entry_size entry_data] (read_jar_entry entry input)] (recur (set.has entry_path entries) duplicates 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 b471a30f5..c78d07b6f 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux @@ -114,7 +114,7 @@ (\ encoding.utf8 encoded) tar.content)) module_file (tar.path (..module_file module_id))] - (in (#tar.Normal [module_file now ..mode ..ownership entry_content])))) + (in {#tar.Normal [module_file now ..mode ..ownership entry_content]}))) (def: .public (package now) (-> Instant Packager) diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index 3f6caddbf..4809e8ed9 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -53,13 +53,13 @@ (All (_ s o) (Operation s s)) (function (_ state) - (#try.Success [state state]))) + {#try.Success [state state]})) (def: .public (set_state state) (All (_ s o) (-> s (Operation s Any))) (function (_ _) - (#try.Success [state []]))) + {#try.Success [state []]})) (def: .public (sub [get set] operation) (All (_ s s' o) @@ -94,7 +94,7 @@ (def: .public identity (All (_ s a) (Phase s a a)) (function (_ archive input state) - (#try.Success [state input]))) + {#try.Success [state input]})) (def: .public (composite pre post) (All (_ s0 s1 i t o) diff --git a/stdlib/source/library/lux/tool/compiler/reference.lux b/stdlib/source/library/lux/tool/compiler/reference.lux index 4e48f1db9..0f345a12f 100644 --- a/stdlib/source/library/lux/tool/compiler/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/reference.lux @@ -21,8 +21,8 @@ (type: .public Reference (Variant - (#Variable Variable) - (#Constant Constant))) + {#Variable Variable} + {#Constant Constant})) (implementation: .public equivalence (Equivalence Reference) @@ -30,7 +30,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag> <equivalence>] - [[(<tag> reference) (<tag> sample)] + [[{<tag> reference} {<tag> sample}] (\ <equivalence> = reference sample)]) ([#Variable /variable.equivalence] [#Constant name.equivalence]) @@ -47,7 +47,7 @@ (def: (hash value) (case value (^template [<factor> <tag> <hash>] - [(<tag> value) + [{<tag> value} ($_ n.* <factor> (\ <hash> hash value))]) ([2 #Variable /variable.hash] @@ -57,7 +57,7 @@ (template [<name> <family> <tag>] [(template: .public (<name> content) [(<| <family> - <tag> + {<tag>} content)])] [local #..Variable #/variable.Local] @@ -66,7 +66,7 @@ (template [<name> <tag>] [(template: .public (<name> content) - [(<| <tag> + [(<| {<tag>} content)])] [variable #..Variable] @@ -79,8 +79,8 @@ (def: .public format (Format Reference) - (|>> (case> (#Variable variable) + (|>> (case> {#Variable variable} (/variable.format variable) - (#Constant constant) + {#Constant constant} (%.name constant)))) diff --git a/stdlib/source/library/lux/tool/compiler/reference/variable.lux b/stdlib/source/library/lux/tool/compiler/reference/variable.lux index eea52b976..bde1de15b 100644 --- a/stdlib/source/library/lux/tool/compiler/reference/variable.lux +++ b/stdlib/source/library/lux/tool/compiler/reference/variable.lux @@ -19,8 +19,8 @@ (type: .public Variable (Variant - (#Local Register) - (#Foreign Register))) + {#Local Register} + {#Foreign Register})) (implementation: .public equivalence (Equivalence Variable) @@ -28,7 +28,7 @@ (def: (= reference sample) (case [reference sample] (^template [<tag>] - [[(<tag> reference') (<tag> sample')] + [[{<tag> reference'} {<tag> sample'}] (n.= reference' sample')]) ([#Local] [#Foreign]) @@ -43,14 +43,14 @@ (def: hash (|>> (case> (^template [<factor> <tag>] - [(<tag> register) + [{<tag> register} ($_ n.* <factor> (\ n.hash hash register))]) ([2 #Local] [3 #Foreign]))))) (template: .public (self) - [(#..Local 0)]) + [{#..Local 0}]) (def: .public self? (-> Variable Bit) @@ -62,8 +62,8 @@ (def: .public format (Format Variable) - (|>> (case> (#Local local) + (|>> (case> {#Local local} (%.format "+" (%.nat local)) - (#Foreign foreign) + {#Foreign foreign} (%.format "-" (%.nat foreign))))) diff --git a/stdlib/source/library/lux/tool/interpreter.lux b/stdlib/source/library/lux/tool/interpreter.lux index 79c8073f3..85020815f 100644 --- a/stdlib/source/library/lux/tool/interpreter.lux +++ b/stdlib/source/library/lux/tool/interpreter.lux @@ -135,10 +135,10 @@ <Interpretation> (interpret_directive code))) - (#try.Success [state' output]) - (#try.Success [state' output]) + {#try.Success [state' output]} + {#try.Success [state' output]} - (#try.Failure error) + {#try.Failure error} (if (ex.match? total.not_a_directive error) (<| (phase.result' state) (:sharing [anchor expression directive] @@ -147,7 +147,7 @@ <Interpretation> (interpret_expression code))) - (#try.Failure error))))) + {#try.Failure error})))) ) (def: (execute configuration code) @@ -218,12 +218,12 @@ (text\= ..exit_command line)) (\ Console<!> write ..farewell_message) (case (read_eval_print (revised@ #source (add_line line) context)) - (#try.Success [context' representation]) + {#try.Success [context' representation]} (do ! [_ (\ Console<!> write representation)] (recur context' #0)) - (#try.Failure error) + {#try.Failure error} (if (ex.match? syntax.end_of_file error) (recur context #1) (exec (log! (ex.error ..error error)) diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index 7c347bd0e..c99823da1 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -33,7 +33,7 @@ (loop [num_args 0 type type] (case type - (<tag> env sub_type) + {<tag> env sub_type} (recur (++ num_args) sub_type) _ @@ -46,7 +46,7 @@ (def: .public (flat_function type) (-> Type [(List Type) Type]) (case type - (#.Function in out') + {#.Function in out'} (let [[ins out] (flat_function out')] [(list& in ins) out]) @@ -56,7 +56,7 @@ (def: .public (flat_application type) (-> Type [Type (List Type)]) (case type - (#.Apply arg func') + {#.Apply arg func'} (let [[func args] (flat_application func')] [func (list\composite args (list arg))]) @@ -67,7 +67,7 @@ [(def: .public (<name> type) (-> Type (List Type)) (case type - (<tag> left right) + {<tag> left right} (list& left (<name> right)) _ @@ -80,7 +80,7 @@ (def: .public (format type) (-> Type Text) (case type - (#.Primitive name params) + {#.Primitive name params} ($_ text\composite "(primitive " (text.enclosed' text.double_quote name) @@ -90,7 +90,7 @@ ")") (^template [<tag> <open> <close> <flat>] - [(<tag> _) + [{<tag> _} ($_ text\composite <open> (|> (<flat> type) (list\each format) @@ -101,7 +101,7 @@ ([#.Sum "(Or " ")" flat_variant] [#.Product "[" "]" flat_tuple]) - (#.Function input output) + {#.Function input output} (let [[ins out] (flat_function type)] ($_ text\composite "(-> " (|> ins @@ -111,26 +111,26 @@ (list\mix text\composite "")) " " (format out) ")")) - (#.Parameter idx) + {#.Parameter idx} (n\encoded idx) - (#.Var id) + {#.Var id} ($_ text\composite "⌈v:" (n\encoded id) "⌋") - (#.Ex id) + {#.Ex id} ($_ text\composite "⟨e:" (n\encoded id) "⟩") - (#.Apply param fun) + {#.Apply param fun} (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>] - [(<tag> env body) + [{<tag> env body} ($_ text\composite "(" <desc> " {" (|> env (list\each format) (text.interposed " ")) "} " (format body) ")")]) ([#.UnivQ "All"] [#.ExQ "Ex"]) - (#.Named [module name] type) + {#.Named [module name] type} ($_ text\composite module "." name) )) @@ -138,27 +138,27 @@ (def: (reduced env type) (-> (List Type) Type Type) (case type - (#.Primitive name params) - (#.Primitive name (list\each (reduced env) params)) + {#.Primitive name params} + {#.Primitive name (list\each (reduced env) params)} (^template [<tag>] - [(<tag> left right) - (<tag> (reduced env left) (reduced env right))]) + [{<tag> left right} + {<tag> (reduced env left) (reduced env right)}]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) (^template [<tag>] - [(<tag> old_env def) + [{<tag> old_env def} (case old_env #.End - (<tag> env def) + {<tag> env def} _ - (<tag> (list\each (reduced env) old_env) def))]) + {<tag> (list\each (reduced env) old_env) def})]) ([#.UnivQ] [#.ExQ]) - (#.Parameter idx) + {#.Parameter idx} (maybe.else (panic! ($_ text\composite "Unknown type parameter" text.new_line " Index: " (n\encoded idx) text.new_line @@ -183,7 +183,7 @@ @.php false] (same? x y)) (case [x y] - [(#.Primitive xname xparams) (#.Primitive yname yparams)] + [{#.Primitive xname xparams} {#.Primitive yname yparams}] (and (text\= xname yname) (n.= (list.size yparams) (list.size xparams)) (list\mix (.function (_ [x y] prev) (and prev (= x y))) @@ -191,26 +191,26 @@ (list.zipped/2 xparams yparams))) (^template [<tag>] - [[(<tag> xid) (<tag> yid)] + [[{<tag> xid} {<tag> yid}] (n.= yid xid)]) ([#.Var] [#.Ex] [#.Parameter]) - (^or [(#.Function xleft xright) (#.Function yleft yright)] - [(#.Apply xleft xright) (#.Apply yleft yright)]) + (^or [{#.Function xleft xright} {#.Function yleft yright}] + [{#.Apply xleft xright} {#.Apply yleft yright}]) (and (= xleft yleft) (= xright yright)) - [(#.Named xname xtype) (#.Named yname ytype)] + [{#.Named xname xtype} {#.Named yname ytype}] (and (name\= xname yname) (= xtype ytype)) (^template [<tag>] - [[(<tag> xL xR) (<tag> yL yR)] + [[{<tag> xL xR} {<tag> yL yR}] (and (= xL yL) (= xR yR))]) ([#.Sum] [#.Product]) - (^or [(#.UnivQ xenv xbody) (#.UnivQ yenv ybody)] - [(#.ExQ xenv xbody) (#.ExQ yenv ybody)]) + (^or [{#.UnivQ xenv xbody} {#.UnivQ yenv ybody}] + [{#.ExQ xenv xbody} {#.ExQ yenv ybody}]) (and (n.= (list.size yenv) (list.size xenv)) (= xbody ybody) (list\mix (.function (_ [x y] prev) (and prev (= x y))) @@ -225,21 +225,21 @@ (-> (List Type) Type (Maybe Type)) (case params #.End - (#.Some func) + {#.Some func} - (#.Item param params') + {#.Item param params'} (case func (^template [<tag>] - [(<tag> env body) + [{<tag> env body} (|> body (reduced (list& func param env)) (applied params'))]) ([#.UnivQ] [#.ExQ]) - (#.Apply A F) + {#.Apply A F} (applied (list& A params) F) - (#.Named name unnamed) + {#.Named name unnamed} (applied params unnamed) _ @@ -248,36 +248,36 @@ (def: .public (code type) (-> Type Code) (case type - (#.Primitive name params) - (` (#.Primitive (~ (code.text name)) - (.list (~+ (list\each code params))))) + {#.Primitive name params} + (` {#.Primitive (~ (code.text name)) + (.list (~+ (list\each code params)))}) (^template [<tag>] - [(<tag> idx) - (` (<tag> (~ (code.nat idx))))]) + [{<tag> idx} + (` {<tag> (~ (code.nat idx))})]) ([#.Var] [#.Ex] [#.Parameter]) (^template [<tag>] - [(<tag> left right) - (` (<tag> (~ (code left)) - (~ (code right))))]) + [{<tag> left right} + (` {<tag> (~ (code left)) + (~ (code right))})]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) - (#.Named name sub_type) + {#.Named name sub_type} (code.identifier name) (^template [<tag>] - [(<tag> env body) - (` (<tag> (.list (~+ (list\each code env))) - (~ (code body))))]) + [{<tag> env body} + (` {<tag> (.list (~+ (list\each code env))) + (~ (code body))})]) ([#.UnivQ] [#.ExQ]) )) (def: .public (de_aliased type) (-> Type Type) (case type - (#.Named _ (#.Named name type')) - (de_aliased (#.Named name type')) + {#.Named _ {#.Named name type'}} + (de_aliased {#.Named name type'}) _ type)) @@ -285,7 +285,7 @@ (def: .public (anonymous type) (-> Type Type) (case type - (#.Named name type') + {#.Named name type'} (anonymous type') _ @@ -298,11 +298,11 @@ #.End <base> - (#.Item type #.End) + {#.Item type #.End} type - (#.Item type types') - (<ctor> type (<name> types'))))] + {#.Item type types'} + {<ctor> type (<name> types')}))] [variant Nothing #.Sum] [tuple Any #.Product] @@ -314,8 +314,8 @@ #.End output - (#.Item input inputs') - (#.Function input (function inputs' output)))) + {#.Item input inputs'} + {#.Function input (function inputs' output)})) (def: .public (application params quant) (-> (List Type) Type Type) @@ -323,15 +323,15 @@ #.End quant - (#.Item param params') - (application params' (#.Apply param quant)))) + {#.Item param params'} + (application params' {#.Apply param quant}))) (template [<name> <tag>] [(def: .public (<name> size body) (-> Nat Type Type) (case size 0 body - _ (|> body (<name> (-- size)) (<tag> (list)))))] + _ (|> body (<name> (-- size)) {<tag> (list)})))] [univ_q #.UnivQ] [ex_q #.ExQ] @@ -340,15 +340,15 @@ (def: .public (quantified? type) (-> Type Bit) (case type - (#.Named [module name] _type) + {#.Named [module name] _type} (quantified? _type) - (#.Apply A F) + {#.Apply A F} (|> (..applied (list A) F) (\ maybe.monad each quantified?) (maybe.else #0)) - (^or (#.UnivQ _) (#.ExQ _)) + (^or {#.UnivQ _} {#.ExQ _}) #1 _ @@ -361,12 +361,12 @@ _ (|> element_type (array (-- depth)) (list) - (#.Primitive array.type_name)))) + {#.Primitive array.type_name}))) (def: .public (flat_array type) (-> Type [Nat Type]) (case type - (^multi (^ (#.Primitive name (list element_type))) + (^multi (^ {#.Primitive name (list element_type)}) (text\= array.type_name name)) (let [[depth element_type] (flat_array element_type)] [(++ depth) element_type]) @@ -391,7 +391,7 @@ (<>.maybe (<>.after (<code>.identifier! ..secret_marker) <code>.any))) <code>.any)]) (case input - (#.Left [valueN valueC]) + {#.Left [valueN valueC]} (do meta.monad [location meta.location valueT (meta.type valueN) @@ -399,7 +399,7 @@ ($_ text\composite (name\encoded (name_of ..:log!)) " " (location.format location) text.new_line "Expression: " (case valueC - (#.Some valueC) + {#.Some valueC} (code.format valueC) #.None @@ -408,7 +408,7 @@ " Type: " (..format valueT)))]] (in (list (code.identifier valueN)))) - (#.Right valueC) + {#.Right valueC} (macro.with_identifiers [g!value] (in (list (` (.let [(~ g!value) (~ valueC)] (..:log! (~ valueC) (~ (code.identifier ..secret_marker)) (~ g!value))))))))) @@ -429,7 +429,7 @@ #.None (in (list casterC)) - (#.Some value) + {#.Some value} (in (list (` ((~ casterC) (~ value))))))))) (type: Typed diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index 9a9e1d473..d3a6b5c35 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -28,7 +28,7 @@ (def: (push value stack) (All (_ a) (-> a (Stack a) (Stack a))) - (#.Item value stack)) + {#.Item value stack}) (def: pop (All (_ a) (-> (Stack a) (Maybe (Stack a)))) @@ -48,7 +48,7 @@ (template: (!peek <source> <reference> <then>) [(loop [entries <source>] (case entries - (#.Item [head_name head] tail) + {#.Item [head_name head] tail} (if (text\= <reference> head_name) <then> (recur tail)) @@ -60,13 +60,13 @@ (-> Text (List [Text Global]) (Stack Frame)) (!peek source reference (case head - (#.Definition [exported? frame_type frame_value]) + {#.Definition [exported? frame_type frame_value]} (:as (Stack Frame) frame_value) - (^or (#.Type _) - (#.Alias _) - (#.Label _) - (#.Slot _)) + (^or {#.Type _} + {#.Alias _} + {#.Label _} + {#.Slot _}) (undefined)))) (def: (peek_frames reference definition_reference source) @@ -82,15 +82,15 @@ (let [[reference definition_reference] (name_of ..frames) current_frames (peek_frames reference definition_reference (value@ #.modules compiler))] (case (case frame - (#.Some frame) + {#.Some frame} (list.example (function (_ [actual _]) (text\= frame actual)) current_frames) #.None (..peek current_frames)) - (#.Some frame) - (#.Right [compiler frame]) + {#.Some frame} + {#.Right [compiler frame]} #.None (exception.except ..no_active_frames []))))) @@ -101,17 +101,17 @@ (def: .public (specific name) (-> Text (Meta Frame)) - (..peek! (#.Some name))) + (..peek! {#.Some name})) (template: (!push <source> <reference> <then>) [(loop [entries <source>] (case entries - (#.Item [head_name head] tail) + {#.Item [head_name head] tail} (if (text\= <reference> head_name) - (#.Item [head_name <then>] - tail) - (#.Item [head_name head] - (recur tail))) + {#.Item [head_name <then>] + tail} + {#.Item [head_name head] + (recur tail)}) #.End (undefined)))]) @@ -120,15 +120,15 @@ (-> Text Frame (List [Text Global]) (List [Text Global])) (!push source reference (case head - (#.Definition [exported? frames_type frames_value]) - (#.Definition [exported? + {#.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 _) - (#.Label _) - (#.Slot _)) + (^or {#.Type _} + {#.Alias _} + {#.Label _} + {#.Slot _}) (undefined)))) (def: (push_frame [module_reference definition_reference] frame source) @@ -139,30 +139,30 @@ (def: (push! frame) (-> Frame (Meta Any)) (function (_ compiler) - (#.Right [(revised@ #.modules + {#.Right [(revised@ #.modules (..push_frame (name_of ..frames) frame) compiler) - []]))) + []]})) (def: (pop_frame_definition reference source) (-> Text (List [Text Global]) (List [Text Global])) (!push source reference (case head - (#.Definition [exported? frames_type frames_value]) - (#.Definition [exported? + {#.Definition [exported? frames_type frames_value]} + {#.Definition [exported? frames_type (let [current_frames (:as (Stack Frame) frames_value)] (case (..pop current_frames) - (#.Some current_frames') + {#.Some current_frames'} current_frames' #.None - current_frames))]) + current_frames))]} - (^or (#.Type _) - (#.Alias _) - (#.Label _) - (#.Slot _)) + (^or {#.Type _} + {#.Alias _} + {#.Label _} + {#.Slot _}) (undefined)))) (def: (pop_frame [module_reference definition_reference] source) @@ -172,10 +172,10 @@ (syntax: (pop! []) (function (_ compiler) - (#.Right [(revised@ #.modules + {#.Right [(revised@ #.modules (..pop_frame (name_of ..frames)) compiler) - (list)]))) + (list)]})) (def: cast (Parser [(Maybe Text) Code]) @@ -242,8 +242,8 @@ (type: (Selection a) (Variant - (#Specific Code a) - (#Current a))) + {#Specific Code a} + {#Current a})) (def: (selection parser) (All (_ a) (-> (Parser a) (Parser (Selection a)))) @@ -252,26 +252,26 @@ (syntax: .public (:transmutation [selection (..selection <code>.any)]) (case selection - (#Specific specific value) + {#Specific specific value} (in (list (` (.|> (~ value) (..:representation (~ specific)) (..:abstraction (~ specific)))))) - (#Current value) + {#Current value} (in (list (` (.|> (~ value) ..:representation ..:abstraction)))))) (syntax: .public (^:representation [selection (<code>.form (..selection <code>.local_identifier)) body <code>.any branches (<>.some <code>.any)]) (case selection - (#Specific specific name) + {#Specific specific name} (let [g!var (code.local_identifier name)] (in (list& g!var (` (.let [(~ g!var) (..:representation (~ specific) (~ g!var))] (~ body))) branches))) - (#Current name) + {#Current name} (let [g!var (code.local_identifier name)] (in (list& g!var (` (.let [(~ g!var) (..:representation (~ g!var))] diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux index bf8210953..c7001e71f 100644 --- a/stdlib/source/library/lux/type/check.lux +++ b/stdlib/source/library/lux/type/check.lux @@ -76,11 +76,11 @@ (def: (each f fa) (function (_ context) (case (fa context) - (#try.Success [context' output]) - (#try.Success [context' (f output)]) + {#try.Success [context' output]} + {#try.Success [context' (f output)]} - (#try.Failure error) - (#try.Failure error))))) + {#try.Failure error} + {#try.Failure error})))) (implementation: .public apply (Apply Check) @@ -90,16 +90,16 @@ (def: (on fa ff) (function (_ context) (case (ff context) - (#try.Success [context' f]) + {#try.Success [context' f]} (case (fa context') - (#try.Success [context'' a]) - (#try.Success [context'' (f a)]) + {#try.Success [context'' a]} + {#try.Success [context'' (f a)]} - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} ))) ) @@ -110,21 +110,21 @@ (def: (in x) (function (_ context) - (#try.Success [context x]))) + {#try.Success [context x]})) (def: (conjoint ffa) (function (_ context) (case (ffa context) - (#try.Success [context' fa]) + {#try.Success [context' fa]} (case (fa context') - (#try.Success [context'' a]) - (#try.Success [context'' a]) + {#try.Success [context'' a]} + {#try.Success [context'' a]} - (#try.Failure error) - (#try.Failure error)) + {#try.Failure error} + {#try.Failure error}) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} ))) ) @@ -132,15 +132,15 @@ (def: (var::new id plist) (-> Var Type_Vars Type_Vars) - (#.Item [id #.None] plist)) + {#.Item [id #.None] plist}) (def: (var::get id plist) (-> Var Type_Vars (Maybe (Maybe Type))) (case plist - (#.Item [var_id var_type] - plist') + {#.Item [var_id var_type] + plist'} (if (!n\= id var_id) - (#.Some var_type) + {#.Some var_type} (var::get id plist')) #.End @@ -152,34 +152,34 @@ #.End (list [id value]) - (#.Item [var_id var_type] - plist') + {#.Item [var_id var_type] + plist'} (if (!n\= id var_id) - (#.Item [var_id value] - plist') - (#.Item [var_id var_type] - (var::put id value plist'))))) + {#.Item [var_id value] + plist'} + {#.Item [var_id var_type] + (var::put id value plist')}))) (def: .public (result context proc) (All (_ a) (-> Type_Context (Check a) (Try a))) (case (proc context) - (#try.Success [context' output]) - (#try.Success output) + {#try.Success [context' output]} + {#try.Success output} - (#try.Failure error) - (#try.Failure error))) + {#try.Failure error} + {#try.Failure error})) (def: .public (failure message) (All (_ a) (-> Text (Check a))) (function (_ context) - (#try.Failure message))) + {#try.Failure message})) (def: .public (assertion message test) (-> Text Bit (Check Any)) (function (_ context) (if test - (#try.Success [context []]) - (#try.Failure message)))) + {#try.Success [context []]} + {#try.Failure message}))) (def: .public (except exception message) (All (_ e a) (-> (Exception e) e (Check a))) @@ -189,26 +189,26 @@ (Check [Nat Type]) (function (_ context) (let [id (value@ #.ex_counter context)] - (#try.Success [(revised@ #.ex_counter ++ context) - [id (#.Ex id)]])))) + {#try.Success [(revised@ #.ex_counter ++ context) + [id {#.Ex id}]]}))) (template [<name> <outputT> <fail> <succeed>] [(def: .public (<name> id) (-> Var (Check <outputT>)) (function (_ context) (case (|> context (value@ #.var_bindings) (var::get id)) - (^or (#.Some (#.Some (#.Var _))) - (#.Some #.None)) - (#try.Success [context <fail>]) + (^or {#.Some {#.Some {#.Var _}}} + {#.Some #.None}) + {#try.Success [context <fail>]} - (#.Some (#.Some bound)) - (#try.Success [context <succeed>]) + {#.Some {#.Some bound}} + {#try.Success [context <succeed>]} #.None (exception.except ..unknown_type_var id))))] [bound? Bit false true] - [peek (Maybe Type) #.None (#.Some bound)] + [peek (Maybe Type) #.None {#.Some bound}] ) (def: .public (read id) @@ -216,7 +216,7 @@ (do ..monad [?type (peek id)] (case ?type - (#.Some type) + {#.Some type} (in type) #.None @@ -226,10 +226,10 @@ (-> Var (Check Type)) (function (_ context) (case (|> context (value@ #.var_bindings) (var::get id)) - (#.Some (#.Some bound)) - (#try.Success [context bound]) + {#.Some {#.Some bound}} + {#try.Success [context bound]} - (#.Some _) + {#.Some _} (exception.except ..unbound_type_var id) _ @@ -239,11 +239,11 @@ (-> Type Var (Check Any)) (function (_ context) (case (|> context (value@ #.var_bindings) (var::get id)) - (#.Some #.None) - (#try.Success [(revised@ #.var_bindings (var::put id (#.Some type)) context) - []]) + {#.Some #.None} + {#try.Success [(revised@ #.var_bindings (var::put id {#.Some type}) context) + []]} - (#.Some (#.Some bound)) + {#.Some {#.Some bound}} (exception.except ..cannot_rebind_var [id type bound]) _ @@ -253,9 +253,9 @@ (-> Type Var (Check Any)) (function (_ context) (case (|> context (value@ #.var_bindings) (var::get id)) - (#.Some _) - (#try.Success [(revised@ #.var_bindings (var::put id (#.Some type)) context) - []]) + {#.Some _} + {#try.Success [(revised@ #.var_bindings (var::put id {#.Some type}) context) + []]} _ (exception.except ..unknown_type_var id)))) @@ -264,32 +264,32 @@ (Check [Var Type]) (function (_ context) (let [id (value@ #.var_counter context)] - (#try.Success [(|> context + {#try.Success [(|> context (revised@ #.var_counter ++) (revised@ #.var_bindings (var::new id))) - [id (#.Var id)]])))) + [id {#.Var id}]]}))) (def: (on argT funcT) (-> Type Type (Check Type)) (case funcT - (#.Var func_id) + {#.Var func_id} (do ..monad [?funcT' (peek func_id)] (case ?funcT' - (#.Some funcT') + {#.Some funcT'} (on argT funcT') _ (except ..invalid_type_application [funcT argT]))) - (#.Apply argT' funcT') + {#.Apply argT' funcT'} (do ..monad [funcT'' (on argT' funcT')] (on argT funcT'')) _ (case (//.applied (list argT) funcT) - (#.Some output) + {#.Some output} (check\in output) _ @@ -309,18 +309,18 @@ (loop [current start output (set.has start empty_ring)] (case (|> context (value@ #.var_bindings) (var::get current)) - (#.Some (#.Some type)) + {#.Some {#.Some type}} (case type - (#.Var post) + {#.Var post} (if (!n\= start post) - (#try.Success [context output]) + {#try.Success [context output]} (recur post (set.has post output))) _ - (#try.Success [context empty_ring])) + {#try.Success [context empty_ring]}) - (#.Some #.None) - (#try.Success [context output]) + {#.Some #.None} + {#try.Success [context output]} #.None (exception.except ..unknown_type_var current))))) @@ -335,17 +335,17 @@ (All (_ a) (-> (Check a) (Check (Maybe a)))) (function (_ context) (case (op context) - (#try.Success [context' output]) - (#try.Success [context' (#.Some output)]) + {#try.Success [context' output]} + {#try.Success [context' {#.Some output}]} - (#try.Failure _) - (#try.Success [context #.None])))) + {#try.Failure _} + {#try.Success [context #.None]}))) (def: (either left right) (All (_ a) (-> (Check a) (Check a) (Check a))) (function (_ context) (case (left context) - (#try.Failure _) + {#try.Failure _} (right context) output @@ -374,21 +374,21 @@ then) (do ..monad [?bound (peek id)] - (else (maybe.else (#.Var id) ?bound))))) + (else (maybe.else {#.Var id} ?bound))))) ... TODO: "link/2" can be optimized... (def: (link/2 left right) (-> Var Var (Check Any)) (do ..monad - [_ (..bind (#.Var right) left)] - (..bind (#.Var left) right))) + [_ (..bind {#.Var right} left)] + (..bind {#.Var left} right))) ... TODO: "link/3" can be optimized... (def: (link/3 interpose to from) (-> Var Var Var (Check Any)) (do ..monad - [_ (re_bind (#.Var interpose) from)] - (re_bind (#.Var to) interpose))) + [_ (re_bind {#.Var interpose} from)] + (re_bind {#.Var to} interpose))) ... TODO: "check_vars" can be optimized... (def: (check_vars check' assumptions idE idA) @@ -406,30 +406,30 @@ (in assumptions)) ... Interpose new variable between 2 existing links - [(#.Some etype) #.None] + [{#.Some etype} #.None] (case etype - (#.Var targetE) + {#.Var targetE} (do ! [_ (link/3 idA targetE idE)] (in assumptions)) _ - (check' assumptions etype (#.Var idA))) + (check' assumptions etype {#.Var idA})) ... Interpose new variable between 2 existing links - [#.None (#.Some atype)] + [#.None {#.Some atype}] (case atype - (#.Var targetA) + {#.Var targetA} (do ! [_ (link/3 idE targetA idA)] (in assumptions)) _ - (check' assumptions (#.Var idE) atype)) + (check' assumptions {#.Var idE} atype)) - [(#.Some etype) (#.Some atype)] + [{#.Some etype} {#.Some atype}] (case [etype atype] - [(#.Var targetE) (#.Var targetA)] + [{#.Var targetE} {#.Var targetA}] (do ! [ringE (..ring idE) ringA (..ring idA)] @@ -451,8 +451,8 @@ [ring (..ring <id>) _ (monad.each ! (re_bind <type>) (set.list ring))] (in assumptions))]) - ([[(#.Var _) _] idE atype] - [[_ (#.Var _)] idA etype]) + ([[{#.Var _} _] idE atype] + [[_ {#.Var _}] idA etype]) _ (check' assumptions etype atype)))))) @@ -467,54 +467,54 @@ (let [[expected_input expected_function] expected [actual_input actual_function] actual] (case [expected_function actual_function] - [(#.Ex exE) (#.Ex exA)] + [{#.Ex exE} {#.Ex exA}] (if (!n\= exE exA) (check' assumptions expected_input actual_input) ..silent_failure!) - [(#.UnivQ _ _) (#.Ex _)] + [{#.UnivQ _ _} {#.Ex _}] (do ..monad [expected' (..on expected_input expected_function)] - (check' assumptions expected' (#.Apply actual))) + (check' assumptions expected' {#.Apply actual})) - [(#.Ex _) (#.UnivQ _ _)] + [{#.Ex _} {#.UnivQ _ _}] (do ..monad [actual' (..on actual_input actual_function)] - (check' assumptions (#.Apply expected) actual')) + (check' assumptions {#.Apply expected} actual')) - [(#.Apply [expected_input' expected_function']) (#.Ex _)] + [{#.Apply [expected_input' expected_function']} {#.Ex _}] (do ..monad [expected_function'' (..on expected_input' expected_function')] - (check' assumptions (#.Apply [expected_input expected_function'']) (#.Apply actual))) + (check' assumptions {#.Apply [expected_input expected_function'']} {#.Apply actual})) - [(#.Ex _) (#.Apply [actual_input' actual_function'])] + [{#.Ex _} {#.Apply [actual_input' actual_function']}] (do ..monad [actual_function'' (..on actual_input' actual_function')] - (check' assumptions (#.Apply expected) (#.Apply [actual_input actual_function'']))) + (check' assumptions {#.Apply expected} {#.Apply [actual_input actual_function'']})) - (^or [(#.Ex _) _] [_ (#.Ex _)]) + (^or [{#.Ex _} _] [_ {#.Ex _}]) (do ..monad [assumptions (check' assumptions expected_function actual_function)] (check' assumptions expected_input actual_input)) - [(#.Var id) _] + [{#.Var id} _] (function (_ context) (case ((do ..monad [expected_function' (..read id)] - (check' assumptions (#.Apply expected_input expected_function') (#.Apply actual))) + (check' assumptions {#.Apply expected_input expected_function'} {#.Apply actual})) context) - (#try.Success output) - (#try.Success output) + {#try.Success output} + {#try.Success output} - (#try.Failure _) + {#try.Failure _} (case actual_function - (#.UnivQ _ _) + {#.UnivQ _ _} ((do ..monad [actual' (..on actual_input actual_function)] - (check' assumptions (#.Apply expected) actual')) + (check' assumptions {#.Apply expected} actual')) context) - (#.Ex exA) + {#.Ex exA} ((do ..monad [assumptions (check' assumptions expected_function actual_function)] (check' assumptions expected_input actual_input)) @@ -528,14 +528,14 @@ (check' assumptions expected' actual')) context)))) - [_ (#.Var id)] + [_ {#.Var id}] (function (_ context) (case ((do ..monad [actual_function' (read id)] - (check' assumptions (#.Apply expected) (#.Apply actual_input actual_function'))) + (check' assumptions {#.Apply expected} {#.Apply actual_input actual_function'})) context) - (#try.Success output) - (#try.Success output) + {#try.Success output} + {#try.Success output} _ ((do ..monad @@ -563,45 +563,45 @@ (check\in assumptions) (with ..type_check_failed [expected actual] (case [expected actual] - [(#.Var idE) (#.Var idA)] + [{#.Var idE} {#.Var idA}] (check_vars check' assumptions idE idA) - [(#.Var id) _] + [{#.Var id} _] (if_can_bind id actual (check\in assumptions) (function (_ bound) (check' assumptions bound actual))) - [_ (#.Var id)] + [_ {#.Var id}] (if_can_bind id expected (check\in assumptions) (function (_ bound) (check' assumptions expected bound))) (^template [<fE> <fA>] - [[(#.Apply aE <fE>) (#.Apply aA <fA>)] + [[{#.Apply aE <fE>} {#.Apply aA <fA>}] (check_apply check' assumptions [aE <fE>] [aA <fA>])]) - ([F1 (#.Ex ex)] - [(#.Ex exE) fA] - [fE (#.Var idA)] - [(#.Var idE) fA]) + ([F1 {#.Ex ex}] + [{#.Ex exE} fA] + [fE {#.Var idA}] + [{#.Var idE} fA]) - [(#.Apply A F) _] + [{#.Apply A F} _] (let [new_assumption [expected actual]] (if (assumed? new_assumption assumptions) (check\in assumptions) (do ..monad [expected' (..on A F)] - (check' (#.Item new_assumption assumptions) expected' actual)))) + (check' {#.Item new_assumption assumptions} expected' actual)))) - [_ (#.Apply A F)] + [_ {#.Apply A F}] (do ..monad [actual' (..on A F)] (check' assumptions expected actual')) ... TODO: Refactor-away as cold-code (^template [<tag> <instancer>] - [[(<tag> _) _] + [[{<tag> _} _] (do ..monad [[_ paramT] <instancer> expected' (..on paramT expected)] @@ -611,7 +611,7 @@ ... TODO: Refactor-away as cold-code (^template [<tag> <instancer>] - [[_ (<tag> _)] + [[_ {<tag> _}] (do ..monad [[_ paramT] <instancer> actual' (..on paramT actual)] @@ -619,7 +619,7 @@ ([#.UnivQ ..var] [#.ExQ ..existential]) - [(#.Primitive e_name e_params) (#.Primitive a_name a_params)] + [{#.Primitive e_name e_params} {#.Primitive a_name a_params}] (if (!text\= e_name a_name) (loop [assumptions assumptions e_params e_params @@ -628,7 +628,7 @@ [#.End #.End] (check\in assumptions) - [(#.Item e_head e_tail) (#.Item a_head a_tail)] + [{#.Item e_head e_tail} {#.Item a_head a_tail}] (do ..monad [assumptions' (check' assumptions e_head a_head)] (recur assumptions' e_tail a_tail)) @@ -638,27 +638,27 @@ ..silent_failure!) (^template [<composite>] - [[(<composite> eL eR) (<composite> aL aR)] + [[{<composite> eL eR} {<composite> aL aR}] (do ..monad [assumptions (check' assumptions eL aL)] (check' assumptions eR aR))]) ([#.Sum] [#.Product]) - [(#.Function eI eO) (#.Function aI aO)] + [{#.Function eI eO} {#.Function aI aO}] (do ..monad [assumptions (check' assumptions aI eI)] (check' assumptions eO aO)) - [(#.Ex e!id) (#.Ex a!id)] + [{#.Ex e!id} {#.Ex a!id}] (if (!n\= e!id a!id) (check\in assumptions) ..silent_failure!) - [(#.Named _ ?etype) _] + [{#.Named _ ?etype} _] (check' assumptions ?etype actual) - [_ (#.Named _ ?atype)] + [_ {#.Named _ ?atype}] (check' assumptions expected ?atype) _ @@ -672,50 +672,50 @@ (-> Type Type Bit) (case (..result ..fresh_context (..check expected actual)) - (#try.Failure _) + {#try.Failure _} false - (#try.Success _) + {#try.Success _} true)) (def: .public context (Check Type_Context) (function (_ context) - (#try.Success [context context]))) + {#try.Success [context context]})) (def: .public (clean inputT) (-> Type (Check Type)) (case inputT - (#.Primitive name paramsT+) + {#.Primitive name paramsT+} (|> paramsT+ (monad.each ..monad clean) - (check\each (|>> (#.Primitive name)))) + (check\each (|>> {#.Primitive name}))) - (^or (#.Parameter _) (#.Ex _) (#.Named _)) + (^or {#.Parameter _} {#.Ex _} {#.Named _}) (check\in inputT) (^template [<tag>] - [(<tag> leftT rightT) + [{<tag> leftT rightT} (do ..monad [leftT' (clean leftT)] (|> (clean rightT) - (check\each (|>> (<tag> leftT')))))]) + (check\each (|>> {<tag> leftT'}))))]) ([#.Sum] [#.Product] [#.Function] [#.Apply]) - (#.Var id) + {#.Var id} (do ..monad [?actualT (peek id)] (case ?actualT - (#.Some actualT) + {#.Some actualT} (clean actualT) _ (in inputT))) (^template [<tag>] - [(<tag> envT+ unquantifiedT) + [{<tag> envT+ unquantifiedT} (do [! ..monad] [envT+' (monad.each ! clean envT+)] - (in (<tag> envT+' unquantifiedT)))]) + (in {<tag> envT+' unquantifiedT}))]) ([#.UnivQ] [#.ExQ]) )) diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index 0709b67e2..d766c77a0 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/type/dynamic.lux @@ -44,7 +44,7 @@ (: ((~! try.Try) (~ type)) (if (\ (~! type.equivalence) (~' =) (.type (~ type)) (~ g!type)) - (#try.Success (:as (~ type) (~ g!value))) + {#try.Success (:as (~ type) (~ g!value))} ((~! exception.except) ..wrong_type [(.type (~ type)) (~ g!type)]))))))))) (def: .public (format value) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index dc460e41d..03379a14e 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -30,15 +30,15 @@ (-> Nat Type_Context (Meta Type)) (case (list.example (|>> product.left (n.= id)) (value@ #.var_bindings env)) - (#.Some [_ (#.Some type)]) + {#.Some [_ {#.Some type}]} (case type - (#.Var id') + {#.Var id'} (type_var id' env) _ (\ meta.monad in type)) - (#.Some [_ #.None]) + {#.Some [_ #.None]} (meta.failure (format "Unbound type-var " (%.nat id))) #.None @@ -51,7 +51,7 @@ [raw_type (meta.type var_name) compiler meta.compiler_state] (case raw_type - (#.Var id) + {#.Var id} (type_var id (value@ #.type_context compiler)) _ @@ -60,18 +60,18 @@ (def: (member_type idx sig_type) (-> Nat Type (Check Type)) (case sig_type - (#.Named _ sig_type') + {#.Named _ sig_type'} (member_type idx sig_type') - (#.Apply arg func) + {#.Apply arg func} (case (type.applied (list arg) func) #.None (check.failure (format "Cannot apply type " (%.type func) " to type " (%.type arg))) - (#.Some sig_type') + {#.Some sig_type'} (member_type idx sig_type')) - (#.Product left right) + {#.Product left right} (if (n.= 0 idx) (\ check.monad in left) (member_type (-- idx) right)) @@ -100,7 +100,7 @@ #.End (meta.failure (format "Unknown tag: " (%.name member))) - (#.Item winner #.End) + {#.Item winner #.End} (in winner) _ @@ -139,7 +139,7 @@ (if (and (or (text\= target_module source_module) exported?) (compatible_type? sig_type def_type)) - (#.Item [[source_module name] def_type] aggregate) + {#.Item [[source_module name] def_type] aggregate} aggregate)) aggregate constants)) @@ -157,7 +157,7 @@ dictionary.entries (list.all (function (_ [name type]) (if (compatible_type? sig_type type) - (#.Some [["" name] type]) + {#.Some [["" name] type]} #.None))))))) (def: (local_structs sig_type) @@ -181,10 +181,10 @@ (def: (on_argument arg func) (-> Type Type (Check Type)) (case func - (#.Named _ func') + {#.Named _ func'} (on_argument arg func') - (#.UnivQ _) + {#.UnivQ _} (do check.monad [[id var] check.var] (|> func @@ -192,7 +192,7 @@ maybe.trusted (on_argument arg))) - (#.Function input output) + {#.Function input output} (do check.monad [_ (check.check input arg)] (in output)) @@ -203,11 +203,11 @@ (def: (concrete_type type) (-> Type (Check [(List Nat) Type])) (case type - (#.UnivQ _) + {#.UnivQ _} (do check.monad [[id var] check.var [ids final_output] (concrete_type (maybe.trusted (type.applied (list var) type)))] - (in [(#.Item id ids) + (in [{#.Item id ids} final_output])) _ @@ -241,10 +241,10 @@ context' check.context =deps (monad.each ! (provision compiler context') deps)] (in =deps))) - (#.Left error) + {#.Left error} (list) - (#.Right =deps) + {#.Right =deps} (list [alt_name =deps])))) list\conjoint) #.End @@ -260,15 +260,15 @@ (do meta.monad [alts (..local_env sig_type)] (..candidate_provision (provision sig_type) context dep alts)) (do meta.monad [alts (..local_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)) (do meta.monad [alts (..imported_structs sig_type)] (..candidate_provision (provision sig_type) context dep alts)))) - (#.Left error) + {#.Left error} (check.failure error) - (#.Right candidates) + {#.Right candidates} (case candidates #.End (check.failure (format "No candidates for provisioning: " (%.type dep))) - (#.Item winner #.End) + {#.Item winner #.End} (\ check.monad in winner) _ @@ -292,10 +292,10 @@ context' check.context =deps (monad.each ! (provision sig_type compiler context') deps)] (in =deps))) - (#.Left error) + {#.Left error} (list) - (#.Right =deps) + {#.Right =deps} (list [alt_name =deps])))) list\conjoint) #.End @@ -315,7 +315,7 @@ (def: (var? input) (-> Code Bit) (case input - [_ (#.Identifier _)] + [_ {#.Identifier _}] #1 _ @@ -338,7 +338,7 @@ args (<>.or (<>.and (<>.some <code>.identifier) <code>.end!) (<>.and (<>.some <code>.any) <code>.end!))]) (case args - (#.Left [args _]) + {#.Left [args _]} (do [! meta.monad] [[member_idx sig_type] (..implicit_member member) input_types (monad.each ! ..implicit_type args) @@ -348,7 +348,7 @@ #.End (meta.failure (format "No implementation could be found for member: " (%.name member))) - (#.Item chosen #.End) + {#.Item chosen #.End} (in (list (` (\ (~ (instance$ chosen)) (~ (code.local_identifier (product.right member))) (~+ (list\each code.identifier args)))))) @@ -360,7 +360,7 @@ (text.interposed ", ")) " --- for type: " (%.type sig_type))))) - (#.Right [args _]) + {#.Right [args _]} (do [! meta.monad] [labels (|> (macro.identifier "") (list.repeated (list.size args)) (monad.all !))] (in (list (` (let [(~+ (|> args (list.zipped/2 labels) (list\each ..pair_list) list\conjoint))] diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux index 4f7a32f1c..64c5abe51 100644 --- a/stdlib/source/library/lux/type/poly.lux +++ b/stdlib/source/library/lux/type/poly.lux @@ -42,54 +42,54 @@ (function ((~ g!_) (~ g!name)) (~ body))) (.:as .Type (~ g!type)))) - (#.Left (~ g!output)) + {#.Left (~ g!output)} ((~! meta.failure) (~ g!output)) - (#.Right (~ g!output)) + {#.Right (~ g!output)} ((~' in) (.list (~ g!output)))))))))))) (def: .public (code env type) (-> Env Type Code) (`` (case type - (#.Primitive name params) - (` (#.Primitive (~ (code.text name)) - (.list (~+ (list\each (code env) params))))) + {#.Primitive name params} + (` {#.Primitive (~ (code.text name)) + (.list (~+ (list\each (code env) params)))}) (^template [<tag>] - [(<tag> idx) - (` (<tag> (~ (code.nat idx))))]) + [{<tag> idx} + (` {<tag> (~ (code.nat idx))})]) ([#.Var] [#.Ex]) - (#.Parameter idx) + {#.Parameter idx} (let [idx (<type>.adjusted_idx env idx)] (if (n.= 0 idx) (|> (dictionary.value idx env) maybe.trusted product.left (code env)) (` (.$ (~ (code.nat (-- idx))))))) - (#.Apply (#.Primitive "" #.End) - (#.Parameter idx)) + {#.Apply {#.Primitive "" #.End} + {#.Parameter idx}} (case (<type>.adjusted_idx env idx) 0 (|> env (dictionary.value 0) maybe.trusted product.left (code env)) idx (undefined)) (^template [<tag>] - [(<tag> left right) - (` (<tag> (~ (code env left)) - (~ (code env right))))]) + [{<tag> left right} + (` {<tag> (~ (code env left)) + (~ (code env right))})]) ([#.Function] [#.Apply]) (^template [<macro> <tag> <flattener>] - [(<tag> left right) + [{<tag> left right} (` (<macro> (~+ (list\each (code env) (<flattener> type)))))]) ([.Union #.Sum type.flat_variant] [.Tuple #.Product type.flat_tuple]) - (#.Named name sub_type) + {#.Named name sub_type} (code.identifier name) (^template [<tag>] - [(<tag> scope body) - (` (<tag> (.list (~+ (list\each (code env) scope))) - (~ (code env body))))]) + [{<tag> scope body} + (` {<tag> (.list (~+ (list\each (code env) scope))) + (~ (code env body))})]) ([#.UnivQ] [#.ExQ]) ))) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index 3bbe82935..bfa951ede 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -25,8 +25,8 @@ (-> (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>] @@ -46,8 +46,8 @@ (let [(^slots [#value #predicate]) (:representation refined) value' (transform value)] (if (predicate value') - (#.Some (:abstraction [#value value' - #predicate predicate])) + {#.Some (:abstraction [#value value' + #predicate predicate])} #.None))))] ) @@ -58,10 +58,10 @@ #.End #.End - (#.Item head tail) + {#.Item head tail} (case (refiner head) - (#.Some refined) - (#.Item refined (only refiner tail)) + {#.Some refined} + {#.Item refined (only refiner tail)} #.None (only refiner tail)))) @@ -73,16 +73,16 @@ #.End [#.End #.End] - (#.Item head tail) + {#.Item head tail} (let [[yes no] (partition refiner tail)] (case (refiner head) - (#.Some refined) - [(#.Item refined yes) + {#.Some refined} + [{#.Item refined yes} no] #.None [yes - (#.Item head no)])))) + {#.Item head no}])))) (syntax: .public (type [refiner <code>.any]) (macro.with_identifiers [g!t g!%] diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index 244644d57..d5c209cd7 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -132,7 +132,7 @@ #.End (in (list (` (~! no_op)))) - (#.Item head tail) + {#.Item head tail} (do [! meta.monad] [.let [max_idx (list\mix n.max head tail)] g!inputs (<| (monad.all !) (list.repeated (++ max_idx)) (macro.identifier "input")) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index e3d156adf..7c974630f 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -74,7 +74,7 @@ #.None (in (exception.except ..cannot_open [])) - (#.Some jvm_console) + {#.Some jvm_console} (let [jvm_input (java/lang/System::in) jvm_output (java/lang/System::out)] (<| in @@ -122,13 +122,13 @@ (do [! io.monad] [|state| (atom.read! state)] (case (\ mock <mock> |state|) - (#try.Success [|state| output]) + {#try.Success [|state| output]} (do ! [_ (atom.write! |state| state)] - (in (#try.Success output))) + (in {#try.Success output})) - (#try.Failure error) - (in (#try.Failure error)))))] + {#try.Failure error} + (in {#try.Failure error}))))] [read on_read] [read_line on_read_line] @@ -138,23 +138,23 @@ (do [! io.monad] [|state| (atom.read! state)] (case (\ mock on_write input |state|) - (#try.Success |state|) + {#try.Success |state|} (do ! [_ (atom.write! |state| state)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error))))) + {#try.Failure error} + (in {#try.Failure error})))) (def: (close _) (do [! io.monad] [|state| (atom.read! state)] (case (\ mock on_close |state|) - (#try.Success |state|) + {#try.Success |state|} (do ! [_ (atom.write! |state| state)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error))))) + {#try.Failure error} + (in {#try.Failure error})))) )))) diff --git a/stdlib/source/library/lux/world/db/jdbc/input.lux b/stdlib/source/library/lux/world/db/jdbc/input.lux index 1819241b3..aa8a168af 100644 --- a/stdlib/source/library/lux/world/db/jdbc/input.lux +++ b/stdlib/source/library/lux/world/db/jdbc/input.lux @@ -64,12 +64,12 @@ (def: .public (fail error) (All (_ a) (-> Text (Input a))) (function (_ value [idx context]) - (#try.Failure error))) + {#try.Failure error})) (def: .public empty (Input Any) (function (_ value context) - (#try.Success context))) + {#try.Success context})) (template [<function> <type> <setter>] [(def: .public <function> diff --git a/stdlib/source/library/lux/world/db/jdbc/output.lux b/stdlib/source/library/lux/world/db/jdbc/output.lux index 25b4b0668..3772ff0e1 100644 --- a/stdlib/source/library/lux/world/db/jdbc/output.lux +++ b/stdlib/source/library/lux/world/db/jdbc/output.lux @@ -56,11 +56,11 @@ (def: (each f fa) (function (_ idx+rs) (case (fa idx+rs) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [idx' value]) - (#try.Success [idx' (f value)]))))) + {#try.Success [idx' value]} + {#try.Success [idx' (f value)]})))) (implementation: .public apply (Apply Output) @@ -70,16 +70,16 @@ (def: (apply ff fa) (function (_ [idx rs]) (case (ff [idx rs]) - (#try.Success [idx' f]) + {#try.Success [idx' f]} (case (fa [idx' rs]) - (#try.Success [idx'' a]) - (#try.Success [idx'' (f a)]) + {#try.Success [idx'' a]} + {#try.Success [idx'' (f a)]} - (#try.Failure msg) - (#try.Failure msg)) + {#try.Failure msg} + {#try.Failure msg}) - (#try.Failure msg) - (#try.Failure msg))))) + {#try.Failure msg} + {#try.Failure msg})))) (implementation: .public monad (Monad Output) @@ -88,21 +88,21 @@ (def: (in a) (function (_ [idx rs]) - (#.Some [idx a]))) + {#.Some [idx a]})) (def: (conjoint mma) (function (_ [idx rs]) (case (mma [idx rs]) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success [idx' ma]) + {#try.Success [idx' ma]} (ma [idx' rs]))))) (def: .public (fail error) (All (_ a) (-> Text (Output a))) (function (_ [idx result_set]) - (#try.Failure error))) + {#try.Failure error})) (def: .public (and left right) (All (_ a b) @@ -117,11 +117,11 @@ (Output <type>) (function (_ [idx result_set]) (case (<method_name> [(.int idx)] result_set) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success value) - (#try.Success [(++ idx) value]))))] + {#try.Success value} + {#try.Success [(++ idx) value]})))] [boolean java/sql/ResultSet::getBoolean Bit] @@ -142,12 +142,12 @@ (Output Instant) (function (_ [idx result_set]) (case (<method_name> [(.int idx)] result_set) - (#try.Failure error) - (#try.Failure error) + {#try.Failure error} + {#try.Failure error} - (#try.Success value) - (#try.Success [(++ idx) - (instant.from_millis (java/util/Date::getTime value))]))))] + {#try.Success value} + {#try.Success [(++ idx) + (instant.from_millis (java/util/Date::getTime value))]})))] [date java/sql/ResultSet::getDate] [time java/sql/ResultSet::getTime] @@ -157,24 +157,24 @@ (def: .public (rows output results) (All (_ a) (-> (Output a) java/sql/ResultSet (IO (Try (List a))))) (case (java/sql/ResultSet::next results) - (#try.Success has_next?) + {#try.Success has_next?} (if has_next? (case (output [1 results]) - (#.Some [_ head]) + {#.Some [_ head]} (do io.monad [?tail (rows output results)] (case ?tail - (#try.Success tail) - (in (#try.Success (#.Item head tail))) + {#try.Success tail} + (in {#try.Success {#.Item head tail}}) - (#try.Failure error) + {#try.Failure error} (do io.monad [temp (java/sql/ResultSet::close results)] (in (do try.monad [_ temp] (try.failure error)))))) - (#try.Failure error) + {#try.Failure error} (do io.monad [temp (java/sql/ResultSet::close results)] (in (do try.monad @@ -186,7 +186,7 @@ [_ temp] (in (list)))))) - (#try.Failure error) + {#try.Failure error} (do io.monad [temp (java/sql/ResultSet::close results)] (in (do try.monad diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index 66c125a34..82796463c 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -84,7 +84,7 @@ #.None #.None - (#.Some last_separator) + {#.Some last_separator} (do maybe.monad [[parent temp] (text.split_at last_separator path) [_ child] (text.split_at (text.size /) temp)] @@ -230,7 +230,7 @@ (do [! (try.with io.monad)] [?children (java/io/File::listFiles (java/io/File::new path))] (case ?children - (#.Some children) + {#.Some children} (|> children (array.list #.None) (monad.only ! (|>> <method>)) @@ -354,8 +354,8 @@ io.run! write! (if (ffi.null? error) - (#try.Success []) - (#try.Failure (Error::toString [] (:as Error error)))))) + {#try.Success []} + {#try.Failure (Error::toString [] (:as Error error))}))) (def: (value_callback write!) (All (_ a) (-> (async.Resolver (Try a)) ffi.Function)) @@ -363,8 +363,8 @@ io.run! write! (if (ffi.null? error) - (#try.Success (:expected datum)) - (#try.Failure (Error::toString [] (:as Error error)))))) + {#try.Success (:expected datum)} + {#try.Failure (Error::toString [] (:as Error error))}))) (ffi.import: JsPath ["[1]::[0]" @@ -383,9 +383,9 @@ (def: (require _) (-> [] (-> ffi.String Any)) (case [(normal_require []) (global_require []) (process_load [])] - (^or [(#.Some require) _ _] - [_ (#.Some require) _] - [_ _ (#.Some require)]) + (^or [{#.Some require} _ _] + [_ {#.Some require} _] + [_ _ {#.Some require}]) require _ @@ -418,10 +418,10 @@ (Fs::stat [path (..value_callback write!)] (..node_fs [])))] (in (case ?stats - (#try.Success stats) + {#try.Success stats} (<method> [] stats) - (#try.Failure _) + {#try.Failure _} false))))] [file? Stats::isFile] @@ -437,10 +437,10 @@ (..any_callback write!)] node_fs))] (case outcome - (#try.Success _) + {#try.Success _} (in (exception.except ..cannot_make_directory [path])) - (#try.Failure _) + {#try.Failure _} (with_async write! (Try Any) (Fs::mkdir [path (..any_callback write!)] node_fs))))) @@ -487,10 +487,10 @@ (def: (can_execute? path) (let [node_fs (..node_fs [])] (\ async.monad each - (|>> (case> (#try.Success _) + (|>> (case> {#try.Success _} true - (#try.Failure _) + {#try.Failure _} false) #try.Success) (with_async write! (Try Any) @@ -733,11 +733,11 @@ #.End (in output) - (#.Item head tail) + {#.Item head tail} (do ! [verdict (<test> head)] (recur tail (if verdict - (#.Item head output) + {#.Item head output} output))))) _ (RubyDir::close [] self)] (in output)))] @@ -928,11 +928,11 @@ ... #.End ... (in output) - ... (#.Item head tail) + ... {#.Item head tail} ... (do ! ... [verdict (<test> head)] ... (if verdict - ... (recur tail (#.Item (<constructor> head) output)) + ... (recur tail {#.Item (<constructor> head) output}) ... (recur tail output)))))))] ... [files ..is_file ..file File] @@ -956,7 +956,7 @@ ... [verdict (<test> path)] ... (\ io.monad in ... (if verdict - ... (#try.Success (<constructor> path)) + ... {#try.Success (<constructor> path)} ... (exception.except <exception> [path])))))] ... [file ..is_file ..file ..cannot_find_file] @@ -968,7 +968,7 @@ ... [verdict (..touch [path (|> instant.now io.run! instant.relative duration.millis (i./ +1,000))])] ... (\ io.monad in ... (if verdict - ... (#try.Success (..file path)) + ... {#try.Success (..file path)} ... (exception.except ..cannot_make_file [path]))))) ... (def: (make_directory path) @@ -976,7 +976,7 @@ ... [verdict (..mkdir path)] ... (\ io.monad in ... (if verdict - ... (#try.Success (..directory path)) + ... {#try.Success (..directory path)} ... (exception.except ..cannot_make_directory [path]))))) ... (def: separator @@ -1013,17 +1013,17 @@ (loop [directory mock trail (text.all_split_by separator path)] (case trail - (#.Item head tail) + {#.Item head tail} (case (dictionary.value head directory) #.None (exception.except ..cannot_find_file [path]) - (#.Some node) + {#.Some node} (case [node tail] - [(#.Left file) #.End] - (#try.Success [head file]) + [{#.Left file} #.End] + {#try.Success [head file]} - [(#.Right sub_directory) (#.Item _)] + [{#.Right sub_directory} {#.Item _}] (recur sub_directory tail) _ @@ -1037,33 +1037,33 @@ (loop [directory mock trail (text.all_split_by / path)] (case trail - (#.Item head tail) + {#.Item head tail} (case (dictionary.value head directory) #.None (case tail #.End - (#try.Success (dictionary.has head - (#.Left [#mock_last_modified now + {#try.Success (dictionary.has head + {#.Left [#mock_last_modified now #mock_can_execute false - #mock_content content]) - directory)) + #mock_content content]} + directory)} - (#.Item _) + {#.Item _} (exception.except ..cannot_find_file [path])) - (#.Some node) + {#.Some node} (case [node tail] - [(#.Left file) #.End] - (#try.Success (dictionary.has head - (#.Left (|> file + [{#.Left file} #.End] + {#try.Success (dictionary.has head + {#.Left (|> file (with@ #mock_last_modified now) - (with@ #mock_content content))) - directory)) + (with@ #mock_content content))} + directory)} - [(#.Right sub_directory) (#.Item _)] + [{#.Right sub_directory} {#.Item _}] (do try.monad [sub_directory (recur sub_directory tail)] - (in (dictionary.has head (#.Right sub_directory) directory))) + (in (dictionary.has head {#.Right sub_directory} directory))) _ (exception.except ..cannot_find_file [path]))) @@ -1076,32 +1076,32 @@ (loop [directory mock trail (text.all_split_by / path)] (case trail - (#.Item head tail) + {#.Item head tail} (case (dictionary.value head directory) #.None (exception.except ..cannot_delete [path]) - (#.Some node) + {#.Some node} (case tail #.End (case node - (#.Left file) - (#try.Success (dictionary.lacks head directory)) + {#.Left file} + {#try.Success (dictionary.lacks head directory)} - (#.Right sub_directory) + {#.Right sub_directory} (if (dictionary.empty? sub_directory) - (#try.Success (dictionary.lacks head directory)) + {#try.Success (dictionary.lacks head directory)} (exception.except ..cannot_delete [path]))) - (#.Item _) + {#.Item _} (case node - (#.Left file) + {#.Left file} (exception.except ..cannot_delete [path]) - (#.Right sub_directory) + {#.Right sub_directory} (do try.monad [sub_directory' (recur sub_directory tail)] - (in (dictionary.has head (#.Right sub_directory') directory)))))) + (in (dictionary.has head {#.Right sub_directory'} directory)))))) #.End (exception.except ..cannot_delete [path])))) @@ -1111,35 +1111,35 @@ (do [! stm.monad] [|var| (stm.read var)] (case (transform |var|) - (#try.Success |var|) + {#try.Success |var|} (do ! [_ (stm.write |var| var)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error))))) + {#try.Failure error} + (in {#try.Failure error})))) (def: (make_mock_directory! / path mock) (-> Text Path Mock (Try Mock)) (loop [directory mock trail (text.all_split_by / path)] (case trail - (#.Item head tail) + {#.Item head tail} (case (dictionary.value head directory) #.None (case tail #.End - (#try.Success (dictionary.has head (#.Right ..empty_mock) directory)) + {#try.Success (dictionary.has head {#.Right ..empty_mock} directory)} - (#.Item _) + {#.Item _} (exception.except ..cannot_make_directory [path])) - (#.Some node) + {#.Some node} (case [node tail] - [(#.Right sub_directory) (#.Item _)] + [{#.Right sub_directory} {#.Item _}] (do try.monad [sub_directory (recur sub_directory tail)] - (in (dictionary.has head (#.Right sub_directory) directory))) + (in (dictionary.has head {#.Right sub_directory} directory))) _ (exception.except ..cannot_make_directory [path]))) @@ -1153,24 +1153,24 @@ trail (text.all_split_by / path)] (case trail #.End - (#try.Success directory) + {#try.Success directory} - (#.Item head tail) + {#.Item head tail} (case (dictionary.value head directory) #.None (exception.except ..cannot_find_directory [path]) - (#.Some node) + {#.Some node} (case node - (#.Left _) + {#.Left _} (exception.except ..cannot_find_directory [path]) - (#.Right sub_directory) + {#.Right sub_directory} (case tail #.End - (#try.Success sub_directory) + {#try.Success sub_directory} - (#.Item _) + {#.Item _} (recur sub_directory tail))))))) (def: .public (mock separator) @@ -1198,13 +1198,13 @@ (do [! stm.monad] [|store| (stm.read store)] (case (..make_mock_directory! separator path |store|) - (#try.Success |store|) + {#try.Success |store|} (do ! [_ (stm.write |store| store)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error)))))) + {#try.Failure error} + (in {#try.Failure error}))))) (~~ (template [<method> <tag>] [(def: (<method> path) @@ -1217,8 +1217,8 @@ dictionary.entries (list.all (function (_ [node_name node]) (case node - (<tag> _) - (#.Some (format path separator node_name)) + {<tag> _} + {#.Some (format path separator node_name)} _ #.None))))))))))] @@ -1304,13 +1304,13 @@ [[name file] (..retrieve_mock_file! separator origin |store|) |store| (..delete_mock_node! separator origin |store|)] (..update_mock_file! separator destination (value@ #mock_last_modified file) (value@ #mock_content file) |store|)) - (#try.Success |store|) + {#try.Success |store|} (do ! [_ (stm.write |store| store)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error)))))) + {#try.Failure error} + (in {#try.Failure error}))))) )))) (def: (check_or_make_directory monad fs path) @@ -1318,7 +1318,7 @@ (do monad [? (\ fs directory? path)] (if ? - (in (#try.Success [])) + (in {#try.Success []}) (\ fs make_directory path)))) (def: .public (make_directories monad fs path) @@ -1331,7 +1331,7 @@ #.End (\ monad in (exception.except ..cannot_make_directory [path])) - (#.Item head tail) + {#.Item head tail} (case head "" (\ monad in (exception.except ..cannot_make_directory [path])) _ (loop [current (if rooted? @@ -1341,17 +1341,17 @@ (do monad [? (..check_or_make_directory monad fs current)] (case ? - (#try.Success _) + {#try.Success _} (case next #.End - (in (#try.Success [])) + (in {#try.Success []}) - (#.Item head tail) + {#.Item head tail} (recur (format current (\ fs separator) head) tail)) - (#try.Failure error) - (in (#try.Failure error))))))))) + {#try.Failure error} + (in {#try.Failure error})))))))) (def: .public (make_file monad fs content path) (All (_ !) (-> (Monad !) (System !) Binary Path (! (Try Any)))) diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux index 3af235af1..46308d6e3 100644 --- a/stdlib/source/library/lux/world/file/watch.lux +++ b/stdlib/source/library/lux/world/file/watch.lux @@ -112,7 +112,7 @@ (do [! stm.monad] [@tracker (stm.read tracker)] (case (dictionary.value path @tracker) - (#.Some [old_concern last_modified]) + {#.Some [old_concern last_modified]} (do ! [_ (stm.update (dictionary.has path [new_concern last_modified]) tracker)] (in true)) @@ -196,20 +196,20 @@ (do ! [updated? (stm.commit! (..update_watch! new_concern path tracker))] (if updated? - (in (#try.Success [])) + (in {#try.Success []}) (do (try.with !) [file_tracker (..file_tracker fs path)] (do ! [_ (stm.commit! (stm.update (dictionary.has path [new_concern file_tracker]) tracker))] - (in (#try.Success [])))))) + (in {#try.Success []}))))) (in (exception.except ..cannot_poll_a_non_existent_directory [path]))))) (def: (concern path) (stm.commit! (do stm.monad [@tracker (stm.read tracker)] (in (case (dictionary.value path @tracker) - (#.Some [concern file_tracker]) - (#try.Success concern) + {#.Some [concern file_tracker]} + {#try.Success concern} #.None (exception.except ..not_being_watched [path])))))) @@ -218,10 +218,10 @@ (do [! stm.monad] [@tracker (stm.read tracker)] (case (dictionary.value path @tracker) - (#.Some [concern file_tracker]) + {#.Some [concern file_tracker]} (do ! [_ (stm.update (dictionary.lacks path) tracker)] - (in (#try.Success concern))) + (in {#try.Success concern})) #.None (in (exception.except ..not_being_watched [path])))))) @@ -237,7 +237,7 @@ (list\each product.left) (dictionary.of_list text.hash)) tracker))] - (in (#try.Success []))) + (in {#try.Success []})) .let [[creations modifications deletions] (list\mix (function (_ [_ [creations modifications deletions]] [all_creations all_modifications all_deletions]) @@ -278,8 +278,8 @@ output #.End] (if (n.< size idx) (recur (++ idx) - (#.Item (java/util/List::get (.int idx) list) - output)) + {#.Item (java/util/List::get (.int idx) list) + output}) output)))) (import: (java/nio/file/WatchEvent$Kind a)) @@ -375,7 +375,7 @@ (do (try.with io.monad) [?key (java/nio/file/WatchService::poll watcher)] (case ?key - (#.Some key) + {#.Some key} (do [! io.monad] [valid? (java/nio/file/WatchKey::reset key)] (if valid? @@ -386,8 +386,8 @@ java/nio/file/Path::toString (:as //.Path))] concern (..default_key_concern key)] - (recur (#.Item [concern path] - output))) + (recur {#.Item [concern path] + output})) (recur output))) #.None @@ -420,12 +420,12 @@ (do [! async.monad] [@tracker (stm.commit! (stm.read tracker))] (case (dictionary.value path @tracker) - (#.Some [concern key]) + {#.Some [concern key]} (do ! [_ (async.future (java/nio/file/WatchKey::cancel key)) _ (stm.commit! (stm.update (dictionary.lacks path) tracker))] - (in (#try.Success concern))) + (in {#try.Success concern})) #.None (in (exception.except ..not_being_watched [path]))))))]] @@ -441,13 +441,13 @@ path)] (do async.monad [_ (stm.commit! (stm.update (dictionary.has path [concern key]) tracker))] - (in (#try.Success [])))))) + (in {#try.Success []}))))) (def: (concern path) (do async.monad [@tracker (stm.commit! (stm.read tracker))] (case (dictionary.value path @tracker) - (#.Some [concern key]) - (in (#try.Success concern)) + {#.Some [concern key]} + (in {#try.Success concern}) #.None (in (exception.except ..not_being_watched [path]))))) diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index c5af6d11f..472c49a52 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -172,7 +172,7 @@ (do [! (try.with io.monad)] [?name (java/net/URLConnection::getHeaderFieldKey index connection)] (case ?name - (#.Some name) + {#.Some name} (do ! [?value (java/net/URLConnection::getHeaderField index connection)] (recur (++ index) @@ -194,7 +194,7 @@ (java/net/URLConnection::setRequestProperty name value connection)) (dictionary.entries headers)) _ (case data - (#.Some data) + {#.Some data} (do ! [_ (java/net/URLConnection::setDoOutput true connection) stream (java/net/URLConnection::getOutputStream connection) @@ -224,14 +224,14 @@ (|> (\ client request method url headers data) async.future (\ async.monad each - (|>> (case> (#try.Success [status message]) - (#try.Success [status (revised@ #//.body (: (-> (//.Body IO) (//.Body Async)) + (|>> (case> {#try.Success [status message]} + {#try.Success [status (revised@ #//.body (: (-> (//.Body IO) (//.Body Async)) (function (_ body) (|>> body async.future))) - message)]) + message)]} - (#try.Failure error) - (#try.Failure error))))))) + {#try.Failure error} + {#try.Failure error})))))) (def: .public headers (-> (List [Text Text]) //.Headers) diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux index 9ab4b1d32..c6185bc09 100644 --- a/stdlib/source/library/lux/world/net/http/request.lux +++ b/stdlib/source/library/lux/world/net/http/request.lux @@ -61,10 +61,10 @@ [raw ?raw content (\ json.codec decoded raw)] (json.result content reader)) - (#try.Success input) + {#try.Success input} (server input request) - (#try.Failure error) + {#try.Failure error} (async.resolved ..failure))))) (def: .public (text server) @@ -73,10 +73,10 @@ (do async.monad [?raw (read_text_body (value@ #//.body message))] (case ?raw - (#try.Success content) + {#try.Success content} (server content request) - (#try.Failure error) + {#try.Failure error} (async.resolved ..failure))))) (def: .public (query property server) @@ -91,10 +91,10 @@ input (context.result query property)] (in [[identification protocol (with@ #//.uri uri resource) message] input])) - (#try.Success [request input]) + {#try.Success [request input]} (server input request) - (#try.Failure error) + {#try.Failure error} (async.resolved ..failure))))) (def: .public (form property server) @@ -106,10 +106,10 @@ [body ?body form (//query.parameters body)] (context.result form property)) - (#try.Success input) + {#try.Success input} (server input request) - (#try.Failure error) + {#try.Failure error} (async.resolved ..failure))))) (def: .public (cookies property server) @@ -121,8 +121,8 @@ (maybe.else "") //cookie.get)] (context.result cookies property)) - (#try.Success input) + {#try.Success input} (server input request) - (#try.Failure error) + {#try.Failure error} (async.resolved ..failure)))) diff --git a/stdlib/source/library/lux/world/program.lux b/stdlib/source/library/lux/world/program.lux index feb95fff9..eb0fe35cf 100644 --- a/stdlib/source/library/lux/world/program.lux +++ b/stdlib/source/library/lux/world/program.lux @@ -62,10 +62,10 @@ (in (|> entries (list.all (function (_ [name value]) (case value - (#try.Success value) - (#.Some [name value]) + {#try.Success value} + {#.Some [name value]} - (#try.Failure _) + {#try.Failure _} #.None))) (dictionary.of_list text.hash))))) @@ -97,8 +97,8 @@ (function.constant (io.io (dictionary.keys environment)))) (def: (variable name) (io.io (case (dictionary.value name environment) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (exception.except ..unknown_environment_variable [name])))) @@ -137,8 +137,8 @@ (def: (jvm\\consume iterator) (All (_ a) (-> (java/util/Iterator a) (List a))) (if (java/util/Iterator::hasNext iterator) - (#.Item (java/util/Iterator::next iterator) - (jvm\\consume iterator)) + {#.Item (java/util/Iterator::next iterator) + (jvm\\consume iterator)} #.End)) )] (for [@.old (as_is <jvm>) @@ -155,7 +155,7 @@ (def: (exit_node_js! code) (-> Exit (IO Nothing)) (case (ffi.constant ..NodeJs_Process [process]) - (#.Some process) + {#.Some process} (NodeJs_Process::exit (i.frac code) process) #.None @@ -173,18 +173,18 @@ (-> Exit (IO Nothing)) (case [(ffi.constant ..Browser_Window [window]) (ffi.constant ..Browser_Location [location])] - [(#.Some window) (#.Some location)] + [{#.Some window} {#.Some location}] (exec (Browser_Window::close [] window) (Browser_Location::reload [] location) (..default_exit! code)) - [(#.Some window) #.None] + [{#.Some window} #.None] (exec (Browser_Window::close [] window) (..default_exit! code)) - [#.None (#.Some location)] + [#.None {#.Some location}] (exec (Browser_Location::reload [] location) (..default_exit! code)) @@ -213,9 +213,9 @@ (def: (require _) (-> [] (-> ffi.String Any)) (case [(normal_require []) (global_require []) (process_load [])] - (^or [(#.Some require) _ _] - [_ (#.Some require) _] - [_ _ (#.Some require)]) + (^or [{#.Some require} _ _] + [_ {#.Some require} _] + [_ _ {#.Some require}]) require _ @@ -247,9 +247,9 @@ (do [! io.monad] [outcome (io/popen [command])] (case outcome - (#try.Success outcome) + {#try.Success outcome} (case outcome - (#.Some file) + {#.Some file} (do ! [?output (LuaFile::read ["*l"] file) _ (LuaFile::close [] file)] @@ -258,7 +258,7 @@ #.None (in default)) - (#try.Failure _) + {#try.Failure _} (in default))))) @.ruby (as_is (ffi.import: Env "as" RubyEnv ["[1]::[0]" @@ -314,7 +314,7 @@ @.jvm <jvm> @.js (io.io (if ffi.on_node_js? (case (ffi.constant Object [process env]) - (#.Some process/env) + {#.Some process/env} (|> (Object::entries [process/env]) (array.list #.None) (list\each (|>> (array.read! 0) maybe.trusted))) @@ -352,8 +352,8 @@ [(do io.monad [value (<method> name)] (in (case value - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (exception.except ..unknown_environment_variable [name]))))]] @@ -365,8 +365,8 @@ [process/env (ffi.constant Object [process env])] (array.read! (:as Nat name) (:as (Array Text) process/env))) - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.None (exception.except ..unknown_environment_variable [name])) @@ -407,7 +407,7 @@ @.jvm <jvm> @.js (if ffi.on_node_js? (case (ffi.constant ..NodeJs_Process [process]) - (#.Some process) + {#.Some process} (NodeJs_Process::cwd [] process) #.None diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux index 5c0fdfbc7..3fd76261b 100644 --- a/stdlib/source/library/lux/world/shell.lux +++ b/stdlib/source/library/lux/world/shell.lux @@ -249,7 +249,7 @@ (do ! [output (java/io/BufferedReader::readLine <stream>)] (case output - (#.Some output) + {#.Some output} (in output) #.None @@ -331,13 +331,13 @@ (do [! io.monad] [|state| (atom.read! state)] (case (\ mock <mock> |state|) - (#try.Success [|state| output]) + {#try.Success [|state| output]} (do ! [_ (atom.write! |state| state)] - (in (#try.Success output))) + (in {#try.Success output})) - (#try.Failure error) - (in (#try.Failure error)))))] + {#try.Failure error} + (in {#try.Failure error}))))] [read on_read] [error on_error] @@ -347,24 +347,24 @@ (do [! io.monad] [|state| (atom.read! state)] (case (\ mock on_write message |state|) - (#try.Success |state|) + {#try.Success |state|} (do ! [_ (atom.write! |state| state)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error))))) + {#try.Failure error} + (in {#try.Failure error})))) (def: (destroy _) (do [! io.monad] [|state| (atom.read! state)] (case (\ mock on_destroy |state|) - (#try.Success |state|) + {#try.Success |state|} (do ! [_ (atom.write! |state| state)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error))))))) + {#try.Failure error} + (in {#try.Failure error})))))) (implementation: .public (mock mock init) (All (_ s) diff --git a/stdlib/source/poly/lux/data/format/json.lux b/stdlib/source/poly/lux/data/format/json.lux index 5fed388e2..e556c2ac6 100644 --- a/stdlib/source/poly/lux/data/format/json.lux +++ b/stdlib/source/poly/lux/data/format/json.lux @@ -59,8 +59,8 @@ (def: (encoded input) (let [high (|> input (i64.and high_mask) (i64.right_shifted 32)) low (i64.and low_mask input)] - (#/.Array (row (|> high .int int.frac #/.Number) - (|> low .int int.frac #/.Number))))) + {#/.Array (row (|> high .int int.frac #/.Number) + (|> low .int int.frac #/.Number))})) (def: decoded (</>.result (</>.array (do <>.monad @@ -83,7 +83,7 @@ (function (_ elem) (case elem #.None #/.Null - (#.Some value) (writer value)))) + {#.Some value} (writer value)))) (implementation: qty_codec (All (_ unit) diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 682c30099..758397321 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -90,7 +90,7 @@ _ (do async.monad [_ (\ program exit exit_code)] - (in (#try.Failure ""))))] + (in {#try.Failure ""})))] (in output))) (exception: (cannot_find_repository [repository Text @@ -117,10 +117,10 @@ [outcome action] (async.future (case outcome - (#try.Success _) + {#try.Success _} ..succeed! - (#try.Failure error) + {#try.Failure error} (..fail! error)))) (\ io.monad in []))) @@ -128,10 +128,10 @@ (do [! io.monad] [?console console.default] (case (try\each console.async ?console) - (#try.Failure error) + {#try.Failure error} (..fail! error) - (#try.Success console) + {#try.Success console} (case operation #/cli.Version (..command @@ -141,10 +141,10 @@ (do ! [?profile (/input.read io.monad file.default profiles)] (case ?profile - (#try.Failure error) + {#try.Failure error} (..fail! error) - (#try.Success profile) + {#try.Success profile} (let [program (program.async program.default)] (case operation #/cli.Version @@ -163,14 +163,14 @@ (let [fs (file.async file.default)] (/command/install.do! console fs (/repository/local.repository program fs) profile))) - (#/cli.Deploy repository identity) + {#/cli.Deploy repository identity} (..command (case (value@ #/.identity profile) - (#.Some artifact) + {#.Some artifact} (case (dictionary.value repository (value@ #/.deploy_repositories profile)) - (#.Some repository) + {#.Some repository} (/command/deploy.do! console - (/repository.async (/repository/remote.repository http.default (#.Some identity) repository)) + (/repository.async (/repository/remote.repository http.default {#.Some identity} repository)) (file.async file.default) artifact profile) @@ -190,21 +190,21 @@ /repository.async) profile)) - (#/cli.Compilation compilation) + {#/cli.Compilation compilation} (case compilation #/cli.Build (..command (..with_dependencies program console /command/build.do! profile)) #/cli.Test (..command (..with_dependencies program console /command/test.do! profile))) - (#/cli.Auto auto) + {#/cli.Auto auto} (do ! [?watcher watch.default] (case ?watcher - (#try.Failure error) + {#try.Failure error} (..fail! error) - (#try.Success watcher) + {#try.Success watcher} (..command (case auto #/cli.Build (..with_dependencies program console (/command/auto.do! /command/auto.delay watcher /command/build.do!) profile) diff --git a/stdlib/source/program/aedifex/artifact/snapshot.lux b/stdlib/source/program/aedifex/artifact/snapshot.lux index 0a0d5cd94..64ff5d7b7 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot.lux @@ -18,7 +18,7 @@ (type: .public Snapshot (Variant #Local - (#Remote Stamp))) + {#Remote Stamp})) (implementation: any_equivalence (Equivalence Any) @@ -45,9 +45,9 @@ (def: local_copy_format XML - (#xml.Node <local_copy> - xml.attributes - (list (#xml.Text ..local_copy_value)))) + {#xml.Node <local_copy> + xml.attributes + (list {#xml.Text ..local_copy_value})}) (def: local_copy_parser (Parser Any) @@ -57,12 +57,12 @@ (def: .public (format snapshot) (-> Snapshot XML) - (<| (#xml.Node ..<snapshot> xml.attributes) + (<| {#xml.Node ..<snapshot> xml.attributes} (case snapshot #Local (list ..local_copy_format) - (#Remote stamp) + {#Remote stamp} (/stamp.format stamp)))) (def: .public parser diff --git a/stdlib/source/program/aedifex/artifact/snapshot/build.lux b/stdlib/source/program/aedifex/artifact/snapshot/build.lux index a7e9e2fc8..4960f5862 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/build.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/build.lux @@ -33,7 +33,7 @@ (|>> %.nat #xml.Text list - (#xml.Node ..tag xml.attributes))) + {#xml.Node ..tag xml.attributes})) (def: .public parser (Parser Build) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux index 0a951c097..a840bd3c0 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/stamp.lux @@ -35,9 +35,9 @@ (def: time_format (-> Time XML) (|>> //time.format - #xml.Text + {#xml.Text} list - (#xml.Node ..<timestamp> xml.attributes))) + {#xml.Node ..<timestamp> xml.attributes})) (def: .public (format (^slots [#time #build])) (-> Stamp (List XML)) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version.lux b/stdlib/source/program/aedifex/artifact/snapshot/version.lux index 33238b990..2dac99df9 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version.lux @@ -43,11 +43,11 @@ (def: (text_format tag value) (-> xml.Tag Text XML) - (|> value #xml.Text list (#xml.Node tag xml.attributes))) + (|> value #xml.Text list {#xml.Node tag xml.attributes})) (def: .public (format (^slots [#extension #value #updated])) (-> Version XML) - (<| (#xml.Node ..<snapshot_version> xml.attributes) + (<| {#xml.Node ..<snapshot_version> xml.attributes} (list (..text_format ..<extension> extension) (..text_format ..<value> value) (..text_format ..<updated> (///time.format updated))))) diff --git a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux index dc3744f4f..5f1816b3e 100644 --- a/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/program/aedifex/artifact/snapshot/version/value.lux @@ -35,7 +35,7 @@ #///.Local version - (#///.Remote stamp) + {#///.Remote stamp} (let [(^slots [#///stamp.time #///stamp.build]) stamp] (%.format (text.replaced ..snapshot (///time.format time) diff --git a/stdlib/source/program/aedifex/artifact/time/date.lux b/stdlib/source/program/aedifex/artifact/time/date.lux index 3da3c1b86..167d0d2a2 100644 --- a/stdlib/source/program/aedifex/artifact/time/date.lux +++ b/stdlib/source/program/aedifex/artifact/time/date.lux @@ -51,7 +51,7 @@ (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) diff --git a/stdlib/source/program/aedifex/artifact/versioning.lux b/stdlib/source/program/aedifex/artifact/versioning.lux index 644af3fa1..cf30987d2 100644 --- a/stdlib/source/program/aedifex/artifact/versioning.lux +++ b/stdlib/source/program/aedifex/artifact/versioning.lux @@ -59,16 +59,16 @@ (def: last_updated_format (-> //time.Time XML) - (|>> //time.format #xml.Text list (#xml.Node ..<last_updated> xml.attributes))) + (|>> //time.format #xml.Text list {#xml.Node ..<last_updated> xml.attributes})) (def: .public (format (^slots [#snapshot #last_updated #versions])) (-> Versioning XML) - (<| (#xml.Node ..<versioning> xml.attributes) + (<| {#xml.Node ..<versioning> xml.attributes} (list (//snapshot.format snapshot) (..last_updated_format last_updated) (|> versions (list\each //snapshot/version.format) - (#xml.Node ..<snapshot_versions> xml.attributes))))) + {#xml.Node ..<snapshot_versions> xml.attributes})))) (def: (text tag) (-> xml.Tag (Parser Text)) diff --git a/stdlib/source/program/aedifex/cli.lux b/stdlib/source/program/aedifex/cli.lux index 04706756f..fc4cf5440 100644 --- a/stdlib/source/program/aedifex/cli.lux +++ b/stdlib/source/program/aedifex/cli.lux @@ -44,9 +44,9 @@ #POM #Dependencies #Install - (#Deploy Text Identity) - (#Compilation Compilation) - (#Auto Compilation))) + {#Deploy Text Identity} + {#Compilation Compilation} + {#Auto Compilation})) (def: .public equivalence (Equivalence Command) @@ -97,7 +97,7 @@ (do <>.monad [head cli.any [tail command] command] - (in [(#.Item head tail) command]))) + (in [{#.Item head tail} command]))) (\ <>.monad each (|>> [(list /.default)]) ..command') )))) diff --git a/stdlib/source/program/aedifex/command/auto.lux b/stdlib/source/program/aedifex/command/auto.lux index dc065c399..0b82f4d81 100644 --- a/stdlib/source/program/aedifex/command/auto.lux +++ b/stdlib/source/program/aedifex/command/auto.lux @@ -41,7 +41,7 @@ (def: (pause delay) (-> Nat (Async (Try Any))) - (async.after delay (#try.Success []))) + (async.after delay {#try.Success []})) (def: .public (do! delay watcher command) (All (_ a) @@ -65,7 +65,7 @@ [_ (..pause delay) events (\ watcher poll [])] (case events - (#.Item _) + {#.Item _} (do ! [_ <call>] (recur [])) diff --git a/stdlib/source/program/aedifex/command/build.lux b/stdlib/source/program/aedifex/command/build.lux index 7d4592179..63d2affb7 100644 --- a/stdlib/source/program/aedifex/command/build.lux +++ b/stdlib/source/program/aedifex/command/build.lux @@ -51,7 +51,7 @@ (list.one (function (_ [dependency package]) (if (and (text\= group (value@ [#///dependency.artifact #///artifact.group] dependency)) (text\= name (value@ [#///dependency.artifact #///artifact.name] dependency))) - (#.Some dependency) + {#.Some dependency} #.None))))) (def: .public lux_group @@ -75,11 +75,11 @@ (type: .public Compiler (Variant - (#JVM Dependency) - (#JS Dependency) - (#Python Dependency) - (#Lua Dependency) - (#Ruby Dependency))) + {#JVM Dependency} + {#JS Dependency} + {#Python Dependency} + {#Lua Dependency} + {#Ruby Dependency})) (def: (remove_dependency dependency) (-> Dependency (-> Resolution Resolution)) @@ -91,12 +91,12 @@ (-> Resolution Dependency (Try [Resolution Compiler])) (let [[[compiler_group compiler_name compiler_version] compiler_type] compiler_dependency] (case (..dependency_finder compiler_group compiler_name resolution) - (#.Some dependency) + {#.Some dependency} (case compiler_name (^template [<tag> <name>] [(^ (static <name>)) - (#try.Success [(..remove_dependency dependency resolution) - (<tag> dependency)])]) + {#try.Success [(..remove_dependency dependency resolution) + {<tag> dependency}]}]) ([#JVM ..jvm_compiler_name] [#JS ..js_compiler_name] [#Python ..python_compiler_name] @@ -139,16 +139,16 @@ (loop [left (text.all_split_by ..version_separator left) right (text.all_split_by ..version_separator right)] (case [left right] - [(#.Item leftH leftT) (#.Item rightH rightT)] + [{#.Item leftH leftT} {#.Item rightH rightT}] (if (text\= leftH rightH) (recur leftT rightT) (or (n.< (text.size leftH) (text.size rightH)) (text\< leftH rightH))) - [(#.Item leftH leftT) #.End] + [{#.Item leftH leftT} #.End] false - [#.End (#.Item rightH rightT)] + [#.End {#.Item rightH rightT}] true [#.End #.End] @@ -166,7 +166,7 @@ (value@ #///artifact.name artifact)] version (value@ #///artifact.version artifact)] (case (dictionary.value identity uniques) - (#.Some [current_version current_path]) + {#.Some [current_version current_path]} (if (\ version_order < version current_version) (dictionary.has identity [version dependency] uniques) uniques) @@ -203,18 +203,18 @@ _ (|> (\ process <capability> []) (async.upon! (function (recur ?line) (case ?line - (#try.Failure error) + {#try.Failure error} (if (exception.match? shell.no_more_output error) - (write! (#try.Success [])) + (write! {#try.Success []}) (async.upon! write! (console.write_line error console))) - (#try.Success line) + {#try.Success line} (async.upon! (function (_ outcome) (case outcome - (#try.Failure error) - (write! (#try.Failure error)) + {#try.Failure error} + (write! {#try.Failure error}) - (#try.Success _) + {#try.Success _} (async.upon! recur (\ process <capability> [])))) (console.write_line line console))))) @@ -245,7 +245,7 @@ (def: (jvm_class_path host_dependencies) (-> (List Path) Text) (|> host_dependencies - (#.Item ".") + {#.Item "."} (text.interposed ..jvm_class_path_separator))) (def: .public (with_jvm_class_path host_dependencies runtime) @@ -267,7 +267,7 @@ #.None (async\in (exception.except ..no_specified_program [])) - (#.Some program_module) + {#.Some program_module} (do async.monad [environment (program.environment async.monad program) .let [home (\ program home) @@ -276,14 +276,14 @@ [[resolution compiler] (async\in (..compiler resolution (value@ #///.compiler profile))) .let [host_dependencies (..host_dependencies fs home resolution) [[command compiler_params] output] (case compiler - (#JVM dependency) + {#JVM dependency} [(|> (value@ #///.java profile) (with@ #///runtime.parameters (list "program._")) - (with_jvm_class_path (#.Item (..path fs home dependency) host_dependencies))) + (with_jvm_class_path {#.Item (..path fs home dependency) host_dependencies})) "program.jar"] (^template [<tag> <runtime> <program>] - [(<tag> dependency) + [{<tag> dependency} [(|> dependency (..path fs home) (///runtime.for (value@ <runtime> profile))) diff --git a/stdlib/source/program/aedifex/command/deploy.lux b/stdlib/source/program/aedifex/command/deploy.lux index ee2cc3c71..4d18f1b18 100644 --- a/stdlib/source/program/aedifex/command/deploy.lux +++ b/stdlib/source/program/aedifex/command/deploy.lux @@ -71,7 +71,7 @@ (let [pom_data (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] - [#///package.origin (#///repository/origin.Remote "") + [#///package.origin {#///repository/origin.Remote ""} #///package.library [library (///dependency/status.verified library)] #///package.pom [pom diff --git a/stdlib/source/program/aedifex/command/deps.lux b/stdlib/source/program/aedifex/command/deps.lux index 0cce84d7c..f26a76211 100644 --- a/stdlib/source/program/aedifex/command/deps.lux +++ b/stdlib/source/program/aedifex/command/deps.lux @@ -42,7 +42,7 @@ (do async.monad [.let [dependencies (|> (value@ #///.dependencies profile) set.list - (#.Item (value@ #///.compiler profile)))] + {#.Item (value@ #///.compiler profile)})] [local_successes local_failures cache] (///dependency/resolution.all console (list local) new_repository diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux index 660d82477..65575f63f 100644 --- a/stdlib/source/program/aedifex/command/install.lux +++ b/stdlib/source/program/aedifex/command/install.lux @@ -52,7 +52,7 @@ (def: .public (do! console fs repository profile) (-> (Console Async) (file.System Async) (Repository Async) (Command Any)) (case (value@ #/.identity profile) - (#.Some identity) + {#.Some identity} (do ///action.monad [package (|> profile (value@ #/.sources) @@ -66,7 +66,7 @@ (let [pom_data (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] - [#///package.origin (#///origin.Local "") + [#///package.origin {#///origin.Local ""} #///package.library (let [library (binary.result tar.writer package)] [library (///dependency/status.verified library)]) #///package.pom [pom diff --git a/stdlib/source/program/aedifex/command/test.lux b/stdlib/source/program/aedifex/command/test.lux index 35c805645..3e5cad3c6 100644 --- a/stdlib/source/program/aedifex/command/test.lux +++ b/stdlib/source/program/aedifex/command/test.lux @@ -42,13 +42,13 @@ [_ (console.write_line ..start console) .let [host_dependencies (//build.host_dependencies fs home resolution) [test_command test_parameters] (case compiler - (#//build.JVM dependency) + {#//build.JVM dependency} (|> program (///runtime.for (value@ #///.java profile)) (//build.with_jvm_class_path host_dependencies)) (^template [<tag> <runtime>] - [(<tag> artifact) + [{<tag> artifact} (///runtime.for (value@ <runtime> profile) program)]) ([#//build.JS #///.js] diff --git a/stdlib/source/program/aedifex/dependency/deployment.lux b/stdlib/source/program/aedifex/dependency/deployment.lux index fa6da0bc0..84170965c 100644 --- a/stdlib/source/program/aedifex/dependency/deployment.lux +++ b/stdlib/source/program/aedifex/dependency/deployment.lux @@ -56,15 +56,15 @@ #///dependency/status.Unverified (in []) - (#///dependency/status.Partial partial) + {#///dependency/status.Partial partial} (case partial - (#.Left sha-1) + {#.Left sha-1} (deploy_hash ///hash.sha-1_codec ///artifact/extension.sha-1 sha-1) - (#.Right md5) + {#.Right md5} (deploy_hash ///hash.md5_codec ///artifact/extension.md5 md5)) - (#///dependency/status.Verified sha-1 md5) + {#///dependency/status.Verified sha-1 md5} (do ! [_ (deploy_hash ///hash.sha-1_codec ///artifact/extension.sha-1 sha-1)] (deploy_hash ///hash.md5_codec ///artifact/extension.md5 md5)))))) @@ -78,12 +78,12 @@ #///dependency/status.Unverified (list) - (#///dependency/status.Partial partial) + {#///dependency/status.Partial partial} (list (case partial - (#.Left _) <sha-1> - (#.Right _) <md5>)) + {#.Left _} <sha-1> + {#.Right _} <md5>)) - (#///dependency/status.Verified _) + {#///dependency/status.Verified _} (list <sha-1> <md5>))))) (def: (update_snapshot [artifact type] now snapshot) @@ -99,8 +99,8 @@ #///artifact/snapshot.Local #///artifact/snapshot.Local - (#///artifact/snapshot.Remote [_ build]) - (#///artifact/snapshot.Remote [now (++ build)])))) + {#///artifact/snapshot.Remote [_ build]} + {#///artifact/snapshot.Remote [now (++ build)]}))) (with@ [#///metadata/snapshot.versioning #///artifact/versioning.last_updated] now)) versioning_snapshot (value@ [#///metadata/snapshot.versioning #///artifact/versioning.snapshot] snapshot)]] (in (|> snapshot diff --git a/stdlib/source/program/aedifex/dependency/resolution.lux b/stdlib/source/program/aedifex/dependency/resolution.lux index ce54d9d9a..3c8241595 100644 --- a/stdlib/source/program/aedifex/dependency/resolution.lux +++ b/stdlib/source/program/aedifex/dependency/resolution.lux @@ -85,7 +85,7 @@ (do async.monad [?actual (\ repository download (///repository/remote.uri version_template artifact extension))] (case ?actual - (#try.Success actual) + {#try.Success actual} (in (do [! try.monad] [output (\ ! each (for [@.old (|>> (:as java/lang/String) java/lang/String::trim @@ -99,10 +99,10 @@ (\ codec decoded)) _ (exception.assertion exception [artifact extension output] (\ ///hash.equivalence = (hash library) actual))] - (in (#.Some actual)))) + (in {#.Some actual}))) - (#try.Failure error) - (in (#try.Success #.None))))) + {#try.Failure error} + (in {#try.Success #.None})))) (def: (hashed repository version_template artifact extension) (-> (Repository Async) Version Artifact Extension (Async (Try [Binary Status]))) @@ -115,14 +115,14 @@ repository version_template artifact (format extension ///artifact/extension.md5) ///hash.md5 ///hash.md5_codec ..md5_does_not_match)] (in [data (case [?sha-1 ?md5] - [(#.Some sha-1) (#.Some md5)] - (#//status.Verified sha-1 md5) + [{#.Some sha-1} {#.Some md5}] + {#//status.Verified sha-1 md5} - [(#.Some sha-1) #.None] - (#//status.Partial (#.Left sha-1)) + [{#.Some sha-1} #.None] + {#//status.Partial {#.Left sha-1}} - [#.None (#.Some md5)] - (#//status.Partial (#.Right md5)) + [#.None {#.Some md5}] + {#//status.Partial {#.Right md5}} [#.None #.None] #//status.Unverified)]))) @@ -144,7 +144,7 @@ [pom (\ utf8.codec decoded pom_data) pom (\ xml.codec decoded pom) profile (<xml>.result ///pom.parser (list pom))] - (in [#///package.origin (#///repository/origin.Remote "") + (in [#///package.origin {#///repository/origin.Remote ""} #///package.library library_&_status #///package.pom [pom pom_data pom_status]])))))) @@ -187,17 +187,17 @@ (exception.except ..cannot_resolve) (\ async.monad in)) - (#.Item repository alternatives) + {#.Item repository alternatives} (do [! async.monad] [_ (..announce_fetching console repository (value@ #//.artifact dependency)) outcome (..one repository dependency)] (case outcome - (#try.Success package) + {#try.Success package} (do ! [_ (..announce_success console repository (value@ #//.artifact dependency))] (in outcome)) - (#try.Failure error) + {#try.Failure error} (do ! [_ (..announce_failure console repository (value@ #//.artifact dependency))] (any console alternatives dependency)))))) @@ -217,7 +217,7 @@ (\ async.monad in [successes failures resolution]) - (#.Item head tail) + {#.Item head tail} (case (value@ [#//.artifact #///artifact.version] head) ... Skip if there is no version "" (recur repositories @@ -227,13 +227,13 @@ resolution) _ (do [! async.monad] [?package (case (dictionary.value head resolution) - (#.Some package) - (in (#try.Success package)) + {#.Some package} + (in {#try.Success package}) #.None (..any console repositories head))] (case ?package - (#try.Success package) + {#try.Success package} (do ! [.let [redundant? (: (Predicate Dependency) (predicate.or (\ //.equivalence = head) @@ -252,15 +252,15 @@ ... sub_repositories (list\composite repositories package_repositories) ]] (recur repositories - (#.Item head successes) + {#.Item head successes} failures (set.list (set.union (set.of_list //.hash tail) (set.of_list //.hash sub_dependencies))) (dictionary.has head package resolution))) - (#try.Failure error) + {#try.Failure error} (recur repositories successes - (#.Item head failures) + {#.Item head failures} tail resolution))))))) diff --git a/stdlib/source/program/aedifex/dependency/status.lux b/stdlib/source/program/aedifex/dependency/status.lux index f5439114e..150d3120b 100644 --- a/stdlib/source/program/aedifex/dependency/status.lux +++ b/stdlib/source/program/aedifex/dependency/status.lux @@ -13,9 +13,9 @@ (type: .public Status (Variant #Unverified - (#Partial (Either (Hash SHA-1) - (Hash MD5))) - (#Verified (Hash SHA-1) (Hash MD5)))) + {#Partial (Either (Hash SHA-1) + (Hash MD5))} + {#Verified (Hash SHA-1) (Hash MD5)})) (implementation: any_equivalence (Equivalence Any) @@ -37,6 +37,6 @@ (def: .public (verified payload) (-> Binary Status) - (#Verified + {#Verified (///hash.sha-1 payload) - (///hash.md5 payload))) + (///hash.md5 payload)}) diff --git a/stdlib/source/program/aedifex/format.lux b/stdlib/source/program/aedifex/format.lux index 3f626f0e2..5f7669366 100644 --- a/stdlib/source/program/aedifex/format.lux +++ b/stdlib/source/program/aedifex/format.lux @@ -44,7 +44,7 @@ (`' [#name (~ (code.text name)) #url (~ (code.text url))]) - (#.Some value) + {#.Some value} (`' [#name (~ (code.text name)) #url (~ (code.text url)) #organization (~ (..organization value))]))) @@ -75,7 +75,7 @@ #.None aggregate - (#.Some value) + {#.Some value} (dictionary.has field (format value) aggregate))) (def: (on_list field value format aggregate) diff --git a/stdlib/source/program/aedifex/hash.lux b/stdlib/source/program/aedifex/hash.lux index 74e54679f..b25dedbb3 100644 --- a/stdlib/source/program/aedifex/hash.lux +++ b/stdlib/source/program/aedifex/hash.lux @@ -99,7 +99,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] @@ -125,7 +125,7 @@ output (binary.empty hash_size)] (let [index (n.* chunk i64.bytes_per_i64)] (case (text.split_at ..hex_per_chunk input) - (#.Some [head tail]) + {#.Some [head tail]} (do try.monad [head (\ n.hex decoded head) output (binary.write/64! index head output)] diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 02e212744..aa76979a8 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -36,11 +36,11 @@ syntax.no_aliases (text.size source_code))] (case (parse [location.dummy 0 source_code]) - (#.Left [_ error]) - (#try.Failure error) + {#.Left [_ error]} + {#try.Failure error} - (#.Right [_ lux_code]) - (#try.Success lux_code)))) + {#.Right [_ lux_code]} + {#try.Success lux_code}))) (def: project_parser (-> Binary (Try Project)) diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 571d9bff1..b56c66104 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -84,7 +84,7 @@ (template [<name> <type> <tag> <pre>] [(def: <name> (-> <type> XML) - (|>> <pre> #xml.Text list (#xml.Node <tag> xml.attributes)))] + (|>> <pre> {#xml.Text} list {#xml.Node <tag> xml.attributes}))] [group_format Group ..<group> (|>)] [name_format Name ..<name> (|>)] @@ -94,18 +94,18 @@ (def: versions_format (-> (List Version) XML) - (|>> (list\each ..version_format) (#xml.Node ..<versions> xml.attributes))) + (|>> (list\each ..version_format) {#xml.Node ..<versions> xml.attributes})) (def: .public (format value) (-> Metadata XML) - (#xml.Node ..<metadata> - xml.attributes - (list (..group_format (value@ #group value)) - (..name_format (value@ #name value)) - (#xml.Node ..<versioning> - xml.attributes - (list (..versions_format (value@ #versions value)) - (..last_updated_format (value@ #last_updated value))))))) + {#xml.Node ..<metadata> + xml.attributes + (list (..group_format (value@ #group value)) + (..name_format (value@ #name value)) + {#xml.Node ..<versioning> + xml.attributes + (list (..versions_format (value@ #versions value)) + (..last_updated_format (value@ #last_updated value)))})}) (def: (text tag) (-> xml.Tag (Parser Text)) @@ -178,20 +178,20 @@ (do async.monad [project (\ repository download (..uri artifact))] (case project - (#try.Success project) + {#try.Success project} (in (|> project (do> try.monad [(\ utf8.codec decoded)] [(\ xml.codec decoded)] [list (<xml>.result ..parser)]))) - (#try.Failure error) - (in (#try.Success + {#try.Failure error} + (in {#try.Success (let [(^slots [#///artifact.group #///artifact.name]) artifact] [#group group #name name #versions (list) - #last_updated ..epoch])))))) + #last_updated ..epoch])})))) (def: .public (write repository artifact metadata) (-> (Repository Async) Artifact Metadata (Async (Try Any))) diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index 53f5faee0..58792b042 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -62,7 +62,7 @@ (template [<name> <type> <tag> <pre>] [(def: <name> (-> <type> XML) - (|>> <pre> #xml.Text list (#xml.Node <tag> xml.attributes)))] + (|>> <pre> #xml.Text list {#xml.Node <tag> xml.attributes}))] [group_format Group ..<group> (|>)] [name_format Name ..<name> (|>)] @@ -72,12 +72,12 @@ (def: .public (format (^slots [#artifact #versioning])) (-> Metadata XML) (let [(^slots [#///artifact.group #///artifact.name #///artifact.version]) artifact] - (#xml.Node ..<metadata> - xml.attributes - (list (..group_format group) - (..name_format name) - (..version_format version) - (///artifact/versioning.format versioning))))) + {#xml.Node ..<metadata> + xml.attributes + (list (..group_format group) + (..name_format name) + (..version_format version) + (///artifact/versioning.format versioning))})) (def: (text tag) (-> xml.Tag (Parser Text)) @@ -128,17 +128,17 @@ (do async.monad [project (\ repository download (..uri artifact))] (case project - (#try.Success project) + {#try.Success project} (in (|> project (do> try.monad [(\ utf8.codec decoded)] [(\ xml.codec decoded)] [list (<xml>.result ..parser)]))) - (#try.Failure error) - (in (#try.Success + {#try.Failure error} + (in {#try.Success [#artifact artifact - #versioning ///artifact/versioning.init]))))) + #versioning ///artifact/versioning.init]})))) (def: .public (write repository artifact metadata) (-> (Repository Async) Artifact Metadata (Async (Try Any))) diff --git a/stdlib/source/program/aedifex/package.lux b/stdlib/source/program/aedifex/package.lux index bd149b0d9..62757c9b0 100644 --- a/stdlib/source/program/aedifex/package.lux +++ b/stdlib/source/program/aedifex/package.lux @@ -38,7 +38,7 @@ [(def: .public (<name> package) (-> Package Bit) (case (value@ #origin package) - (<tag> _) + {<tag> _} true _ @@ -50,15 +50,15 @@ (def: .public (local pom library) (-> XML Binary Package) - [#origin (#//origin.Local "") + [#origin {#//origin.Local ""} #library [library - (#//status.Verified (//hash.sha-1 library) - (//hash.md5 library))] + {#//status.Verified (//hash.sha-1 library) + (//hash.md5 library)}] #pom (let [binary_pom (|> pom (\ xml.codec encoded) (\ utf8.codec encoded))] [pom binary_pom - (#//status.Verified (//hash.sha-1 binary_pom) - (//hash.md5 binary_pom))])]) + {#//status.Verified (//hash.sha-1 binary_pom) + (//hash.md5 binary_pom)}])]) (def: .public dependencies (-> Package (Try (Set Dependency))) diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 02840c2ec..b3239d4e2 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -31,7 +31,7 @@ (def: (as_input input) (-> (Maybe Code) (List Code)) (case input - (#.Some input) + {#.Some input} (list input) #.None diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index 7cf6f961e..49e3793fe 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -47,14 +47,14 @@ (def: version XML - (#_.Node ["" "modelVersion"] _.attributes - (list (#_.Text "4.0.0")))) + {#_.Node ["" "modelVersion"] _.attributes + (list {#_.Text "4.0.0"})}) (def: (property tag value) (-> Text Text XML) - (#_.Node ["" tag] - _.attributes - (list (#_.Text value)))) + {#_.Node ["" tag] + _.attributes + (list {#_.Text value})}) (def: (artifact value) (-> Artifact (List XML)) @@ -73,37 +73,37 @@ (|> (list (..property "name" name) (..property ..url_tag url) (..distribution distribution)) - (#_.Node ["" "license"] _.attributes))) + {#_.Node ["" "license"] _.attributes})) (def: repository (-> Address XML) (|>> (..property ..url_tag) list - (#_.Node ["" ..repository_tag] _.attributes))) + {#_.Node ["" ..repository_tag] _.attributes})) (def: (dependency value) (-> Dependency XML) - (#_.Node ["" ..dependency_tag] - _.attributes - (list\composite (..artifact (value@ #//dependency.artifact value)) - (list (..property "type" (value@ #//dependency.type value)))))) + {#_.Node ["" ..dependency_tag] + _.attributes + (list\composite (..artifact (value@ #//dependency.artifact value)) + (list (..property "type" (value@ #//dependency.type value))))}) (def: (group tag) (-> Text (-> (List XML) XML)) - (|>> (#_.Node ["" tag] _.attributes))) + (|>> {#_.Node ["" tag] _.attributes})) (comment (def: scm (-> /.SCM XML) (|>> (..property ..url_tag) list - (#_.Node ["" "scm"] _.attributes))) + {#_.Node ["" "scm"] _.attributes})) (def: (organization [name url]) (-> /.Organization XML) (|> (list (..property "name" name) (..property ..url_tag url)) - (#_.Node ["" "organization"] _.attributes))) + {#_.Node ["" "organization"] _.attributes})) (def: (developer_organization [name url]) (-> /.Organization (List XML)) @@ -119,7 +119,7 @@ (template [<name> <type> <tag>] [(def: <name> (-> <type> XML) - (|>> ..developer' (#_.Node ["" <tag>] _.attributes)))] + (|>> ..developer' {#_.Node ["" <tag>] _.attributes}))] [developer /.Developer "developer"] [contributor /.Contributor "contributor"] @@ -141,15 +141,15 @@ (def: .public (write value) (-> /.Profile (Try XML)) (case (value@ #/.identity value) - (#.Some identity) - (#try.Success - (#_.Node ["" ..project_tag] _.attributes - ($_ list\composite - (list ..version) - (..artifact identity) - (|> value (value@ #/.repositories) set.list (list\each ..repository) (..group "repositories") list) - (|> value (value@ #/.dependencies) set.list (list\each ..dependency) (..group ..dependencies_tag) list) - ))) + {#.Some identity} + {#try.Success + {#_.Node ["" ..project_tag] _.attributes + ($_ list\composite + (list ..version) + (..artifact identity) + (|> value (value@ #/.repositories) set.list (list\each ..repository) (..group "repositories") list) + (|> value (value@ #/.dependencies) set.list (list\each ..dependency) (..group ..dependencies_tag) list) + )}} _ (exception.except /.no_identity []))) diff --git a/stdlib/source/program/aedifex/project.lux b/stdlib/source/program/aedifex/project.lux index 1d1d55998..acf3c3819 100644 --- a/stdlib/source/program/aedifex/project.lux +++ b/stdlib/source/program/aedifex/project.lux @@ -54,10 +54,10 @@ (def: (profile' lineage project name) (-> (Set Name) Project Name (Try Profile)) (case (dictionary.value name project) - (#.Some profile) + {#.Some profile} (case (list.example (set.member? lineage) (value@ #//.parents profile)) - (#.Some ouroboros) + {#.Some ouroboros} (exception.except ..circular_dependency [ouroboros name]) #.None diff --git a/stdlib/source/program/aedifex/repository.lux b/stdlib/source/program/aedifex/repository.lux index 5cca8174b..b836cfa54 100644 --- a/stdlib/source/program/aedifex/repository.lux +++ b/stdlib/source/program/aedifex/repository.lux @@ -57,24 +57,24 @@ (do [! stm.monad] [|state| (stm.read state)] (case (\ mock on_download uri |state|) - (#try.Success [|state| output]) + {#try.Success [|state| output]} (do ! [_ (stm.write |state| state)] - (in (#try.Success output))) + (in {#try.Success output})) - (#try.Failure error) - (in (#try.Failure error)))))) + {#try.Failure error} + (in {#try.Failure error}))))) (def: (upload uri content) (stm.commit! (do [! stm.monad] [|state| (stm.read state)] (case (\ mock on_upload uri content |state|) - (#try.Success |state|) + {#try.Success |state|} (do ! [_ (stm.write |state| state)] - (in (#try.Success []))) + (in {#try.Success []})) - (#try.Failure error) - (in (#try.Failure error)))))) + {#try.Failure error} + (in {#try.Failure error}))))) ))) diff --git a/stdlib/source/program/aedifex/repository/local.lux b/stdlib/source/program/aedifex/repository/local.lux index 2c528a520..508fcba28 100644 --- a/stdlib/source/program/aedifex/repository/local.lux +++ b/stdlib/source/program/aedifex/repository/local.lux @@ -53,7 +53,7 @@ _ (if ? (in []) (case (file.parent fs absolute_path) - (#.Some parent) + {#.Some parent} (file.make_directories async.monad fs parent) _ diff --git a/stdlib/source/program/aedifex/repository/origin.lux b/stdlib/source/program/aedifex/repository/origin.lux index 72163f641..a5a613a1a 100644 --- a/stdlib/source/program/aedifex/repository/origin.lux +++ b/stdlib/source/program/aedifex/repository/origin.lux @@ -12,8 +12,8 @@ (type: .public Origin (Variant - (#Local Path) - (#Remote URL))) + {#Local Path} + {#Remote URL})) (def: .public equivalence (Equivalence Origin) diff --git a/stdlib/source/program/aedifex/repository/remote.lux b/stdlib/source/program/aedifex/repository/remote.lux index 4f852c2b7..269ff15a9 100644 --- a/stdlib/source/program/aedifex/repository/remote.lux +++ b/stdlib/source/program/aedifex/repository/remote.lux @@ -73,7 +73,7 @@ _ (do ! - [_ ((value@ #@http.body message) (#.Some 0))] + [_ ((value@ #@http.body message) {#.Some 0})] (\ io.monad in (exception.except ..download_failure [(format address uri) status])))))) (def: (upload uri content) @@ -84,12 +84,12 @@ #.None ..base_headers - (#.Some [user password]) + {#.Some [user password]} (list& ["Authorization" (//identity.basic_auth user password)] ..base_headers))) - (#.Some content) + {#.Some content} http)) - _ ((value@ #@http.body message) (#.Some 0))] + _ ((value@ #@http.body message) {#.Some 0})] (case status (^ (static http/status.created)) (in []) diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux index b36d73070..f18f45e54 100644 --- a/stdlib/source/program/compositor.lux +++ b/stdlib/source/program/compositor.lux @@ -63,13 +63,13 @@ (do async.monad [?output action] (case ?output - (#try.Failure error) + {#try.Failure error} (exec (debug.log! (format text.new_line failure_description text.new_line error text.new_line)) (io.run! (\ world/program.default exit +1))) - (#try.Success output) + {#try.Success output} (in output)))) (def: (timed process) @@ -87,11 +87,11 @@ (def: (package! fs host_dependencies [packager package] static archive context) (-> (file.System Async) (Dictionary file.Path Binary) [Packager file.Path] Static Archive Context (Async (Try Any))) (case (packager host_dependencies archive context) - (#try.Success content) + {#try.Success content} (\ fs write content package) - (#try.Failure error) - (\ async.monad in (#try.Failure error)))) + {#try.Failure error} + (\ async.monad in {#try.Failure error}))) (def: (load_host_dependencies fs host_dependencies) (-> (file.System Async) (List file.Path) (Async (Try (Dictionary file.Path Binary)))) @@ -104,7 +104,7 @@ #.End (in output) - (#.Item head tail) + {#.Item head tail} (do ! [content (\ fs read head)] (recur tail @@ -131,7 +131,7 @@ (do [! async.monad] [platform (async.future platform)] (case service - (#/cli.Compilation compilation) + {#/cli.Compilation compilation} (<| (or_crash! "Compilation failed:") ..timed (do (try.with async.monad) @@ -165,14 +165,14 @@ program_context)] (in (debug.log! "Compilation complete!")))) - (#/cli.Export export) + {#/cli.Export export} (<| (or_crash! "Export failed:") (do (try.with async.monad) [_ (/export.export (value@ #platform.&file_system platform) export)] (in (debug.log! "Export complete!")))) - (#/cli.Interpretation interpretation) + {#/cli.Interpretation interpretation} ... TODO: Fix the interpreter... (undefined) ... (<| (or_crash! "Interpretation failed:") diff --git a/stdlib/source/program/compositor/cli.lux b/stdlib/source/program/compositor/cli.lux index 487c3976f..e678f2c6e 100644 --- a/stdlib/source/program/compositor/cli.lux +++ b/stdlib/source/program/compositor/cli.lux @@ -33,9 +33,9 @@ (type: .public Service (Variant - (#Compilation Compilation) - (#Interpretation Compilation) - (#Export Export))) + {#Compilation Compilation} + {#Interpretation Compilation} + {#Export Export})) (template [<name> <long> <type>] [(def: <name> @@ -74,7 +74,7 @@ (def: .public target (-> Service Target) - (|>> (case> (^or (#Compilation [sources host_dependencies libraries target module]) - (#Interpretation [sources host_dependencies libraries target module]) - (#Export [sources target])) + (|>> (case> (^or {#Compilation [sources host_dependencies libraries target module]} + {#Interpretation [sources host_dependencies libraries target module]} + {#Export [sources target]}) target))) diff --git a/stdlib/source/program/compositor/export.lux b/stdlib/source/program/compositor/export.lux index 2fe3171e0..3588e1dde 100644 --- a/stdlib/source/program/compositor/export.lux +++ b/stdlib/source/program/compositor/export.lux @@ -51,14 +51,14 @@ (text.replaced (\ fs separator) .module_separator) tar.path) source_code (tar.content source_code)] - (in (#tar.Normal [path + (in {#tar.Normal [path (instant.of_millis +0) ($_ tar.and tar.read_by_owner tar.write_by_owner tar.read_by_group tar.write_by_group tar.read_by_other) ..no_ownership - source_code]))))) + source_code]})))) (\ try.monad each row.of_list) (\ async.monad in)))) diff --git a/stdlib/source/program/compositor/import.lux b/stdlib/source/program/compositor/import.lux index 6b092e546..278e992fb 100644 --- a/stdlib/source/program/compositor/import.lux +++ b/stdlib/source/program/compositor/import.lux @@ -54,10 +54,10 @@ (\ ! each (|>> row.list (monad.mix ! (function (_ entry import) (case entry - (#tar.Normal [path instant mode ownership content]) + {#tar.Normal [path instant mode ownership content]} (let [path (tar.from_path path)] (case (dictionary.has' path (tar.data content) import) - (#try.Failure error) + {#try.Failure error} (exception.except ..duplicate [library path]) import' diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux index bf430a368..293b7f1e0 100644 --- a/stdlib/source/specification/aedifex/repository.lux +++ b/stdlib/source/specification/aedifex/repository.lux @@ -39,7 +39,7 @@ (_.cover' [/.Repository] (let [successfull_flow! (case [good_upload! good_download!] - [(#try.Success _) (#try.Success actual)] + [{#try.Success _} {#try.Success actual}] (\ binary.equivalence = expected actual) _ @@ -47,7 +47,7 @@ failed_flow! (case [bad_upload! bad_download!] - [(#try.Failure _) (#try.Failure _)] + [{#try.Failure _} {#try.Failure _}] true _ diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux index a2569f334..2668d36ca 100644 --- a/stdlib/source/specification/compositor.lux +++ b/stdlib/source/specification/compositor.lux @@ -58,10 +58,10 @@ expander program))]] (case ?state,runner,definer - (#try.Success [[directive_bundle directive_state] runner definer]) + {#try.Success [[directive_bundle directive_state] runner definer]} (..test runner definer (value@ [#directive.analysis #directive.state] directive_state) expander) - (#try.Failure error) + {#try.Failure error} (_.failure error)))) diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux index be7677848..f0856eb1f 100644 --- a/stdlib/source/specification/compositor/analysis/type.lux +++ b/stdlib/source/specification/compositor/analysis/type.lux @@ -26,10 +26,10 @@ (analysis/type.with_type output_type (analysis.phase expander (` ((~ (code.text extension)) (~+ params)))))) (phase.result state) - (case> (#try.Success _) + (case> {#try.Success _} true - (#try.Failure _) + {#try.Failure _} false))) (def: check @@ -42,12 +42,12 @@ <type> (<code> value)]))] - [r.bit (0 #0 "#Bit" (0 #0)) code.bit] - [r.nat (0 #0 "#I64" (0 #1 (0 #0 "#Nat" (0 #0)) (0 #0))) code.nat] - [r.int (0 #0 "#I64" (0 #1 (0 #0 "#Int" (0 #0)) (0 #0))) code.int] - [r.rev (0 #0 "#I64" (0 #1 (0 #0 "#Rev" (0 #0)) (0 #0))) code.rev] - [r.safe_frac (0 #0 "#Frac" (0 #0)) code.frac] - [(r.ascii/upper_alpha 5) (0 #0 "#Text" (0 #0)) code.text] + [r.bit {0 #0 "#Bit" {0 #0}} code.bit] + [r.nat {0 #0 "#I64" {0 #1 {0 #0 "#Nat" {0 #0}} {0 #0}}} code.nat] + [r.int {0 #0 "#I64" {0 #1 {0 #0 "#Int" {0 #0}} {0 #0}}} code.int] + [r.rev {0 #0 "#I64" {0 #1 {0 #0 "#Rev" {0 #0}} {0 #0}}} code.rev] + [r.safe_frac {0 #0 "#Frac" {0 #0}} code.frac] + [(r.ascii/upper_alpha 5) {0 #0 "#Text" {0 #0}} code.text] ))))) (def: .public (spec expander state) diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux index d699aa74b..eb27aea29 100644 --- a/stdlib/source/specification/compositor/generation/case.lux +++ b/stdlib/source/specification/compositor/generation/case.lux @@ -40,10 +40,10 @@ (def: .public (verify expected) (-> Frac (Try Any) Bit) - (|>> (case> (#try.Success actual) + (|>> (case> {#try.Success actual} (f.= expected (:as Frac actual)) - (#try.Failure _) + {#try.Failure _} false))) (def: case @@ -187,11 +187,11 @@ (def: special_path Path - (let [_end_ (synthesis.path/side (#.Left 0)) - _item_ (synthesis.path/side (#.Right 0)) - _head_ (synthesis.path/member (#.Left 0)) - _tail_ (synthesis.path/member (#.Right 0)) - _tuple_ (synthesis.path/side (#.Left 9))] + (let [_end_ (synthesis.path/side {#.Left 0}) + _item_ (synthesis.path/side {#.Right 0}) + _head_ (synthesis.path/member {#.Left 0}) + _tail_ (synthesis.path/member {#.Right 0}) + _tuple_ (synthesis.path/side {#.Left 9})] ($_ synthesis.path/alt ($_ synthesis.path/seq _item_ @@ -213,18 +213,18 @@ (def: special_pattern analysis.Pattern - (let [... [_ (#Tuple (#Item arg args'))] + (let [... [_ {#Tuple {#Item arg args'}}] head (<| analysis.pattern/tuple (list (analysis.pattern/bind 2)) analysis.pattern/variant [9 #0] analysis.pattern/variant [0 #1] analysis.pattern/tuple (list (analysis.pattern/bind 3) (analysis.pattern/bind 4))) - ... (#Item body #End) + ... {#Item body #End} tail (<| analysis.pattern/variant [0 #1] analysis.pattern/tuple (list (analysis.pattern/bind 5)) analysis.pattern/variant [0 #0] (analysis.pattern/unit))] - ... (#Item <head> <tail>) + ... {#Item <head> <tail>} (<| analysis.pattern/variant [0 #1] (analysis.pattern/tuple (list head tail))))) @@ -253,28 +253,28 @@ (_.test "CODE" (|> special_input (run "special_input") - (case> (#try.Success output) + (case> {#try.Success output} true - (#try.Failure _) + {#try.Failure _} false))) (_.test "PATTERN_MATCHING 0" (|> (synthesis.branch/case [special_input special_path]) (run "special_path") - (case> (#try.Success output) + (case> {#try.Success output} true - (#try.Failure _) + {#try.Failure _} false))) (_.test "PATTERN_MATCHING 1" (|> (synthesis.branch/case [special_input special_pattern_path]) (run "special_pattern_path") - (case> (#try.Success output) + (case> {#try.Success output} true - (#try.Failure _) + {#try.Failure _} false))) )) diff --git a/stdlib/source/specification/compositor/generation/common.lux b/stdlib/source/specification/compositor/generation/common.lux index 2db239415..9c03349f4 100644 --- a/stdlib/source/specification/compositor/generation/common.lux +++ b/stdlib/source/specification/compositor/generation/common.lux @@ -39,13 +39,13 @@ subject r.i64] (with_expansions [<binary> (template [<extension> <reference> <param_expr>] [(_.test <extension> - (|> (#synthesis.Extension <extension> (list (synthesis.i64 param) - (synthesis.i64 subject))) + (|> {#synthesis.Extension <extension> (list (synthesis.i64 param) + (synthesis.i64 subject))} (run (..safe <extension>)) - (case> (#try.Success valueT) + (case> {#try.Success valueT} (n.= (<reference> param subject) (:as Nat valueT)) - (#try.Failure _) + {#try.Failure _} false) (let [param <param_expr>])))] @@ -58,16 +58,16 @@ ($_ _.and <binary> (_.test "lux i64 arithmetic-right-shift" - (|> (#synthesis.Extension "lux i64 arithmetic-right-shift" - (list (synthesis.i64 subject) - (synthesis.i64 param))) + (|> {#synthesis.Extension "lux i64 arithmetic-right-shift" + (list (synthesis.i64 subject) + (synthesis.i64 param))} (run (..safe "lux i64 arithmetic-right-shift")) - (case> (#try.Success valueT) + (case> {#try.Success valueT} ("lux i64 =" (i64.arithmetic_right_shifted param subject) (:as I64 valueT)) - (#try.Failure _) + {#try.Failure _} false) (let [param (n.% 64 param)]))) )))) @@ -80,12 +80,12 @@ (`` ($_ _.and (~~ (template [<extension> <type> <prepare> <comp> <subject_expr>] [(_.test <extension> - (|> (#synthesis.Extension <extension> (list (synthesis.i64 subject))) + (|> {#synthesis.Extension <extension> (list (synthesis.i64 subject))} (run (..safe <extension>)) - (case> (#try.Success valueT) + (case> {#try.Success valueT} (<comp> (<prepare> subject) (:as <type> valueT)) - (#try.Failure _) + {#try.Failure _} false) (let [subject <subject_expr>])))] @@ -97,13 +97,13 @@ )) (~~ (template [<extension> <reference> <outputT> <comp>] [(_.test <extension> - (|> (#synthesis.Extension <extension> (list (synthesis.i64 param) - (synthesis.i64 subject))) + (|> {#synthesis.Extension <extension> (list (synthesis.i64 param) + (synthesis.i64 subject))} (run (..safe <extension>)) - (case> (#try.Success valueT) + (case> {#try.Success valueT} (<comp> (<reference> param subject) (:as <outputT> valueT)) - (#try.Failure _) + {#try.Failure _} false)))] ["lux i64 +" i.+ Int i.=] @@ -128,8 +128,8 @@ (`` ($_ _.and (~~ (template [<extension> <reference> <comp>] [(_.test <extension> - (|> (#synthesis.Extension <extension> (list (synthesis.f64 param) - (synthesis.f64 subject))) + (|> {#synthesis.Extension <extension> (list (synthesis.f64 param) + (synthesis.f64 subject))} (run (..safe <extension>)) (//case.verify (<reference> param subject))))] @@ -141,10 +141,10 @@ )) (~~ (template [<extension> <text>] [(_.test <extension> - (|> (#synthesis.Extension <extension> (list (synthesis.f64 param) - (synthesis.f64 subject))) + (|> {#synthesis.Extension <extension> (list (synthesis.f64 param) + (synthesis.f64 subject))} (run (..safe <extension>)) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (bit\= (<text> param subject) (:as Bit valueV)) @@ -156,7 +156,7 @@ )) (~~ (template [<extension> <reference>] [(_.test <extension> - (|> (#synthesis.Extension <extension> (list)) + (|> {#synthesis.Extension <extension> (list)} (run (..safe <extension>)) (//case.verify <reference>)))] @@ -167,8 +167,8 @@ (_.test "'lux f64 i64 && 'lux i64 f64'" (|> (run (..safe "lux f64 i64") (|> subject synthesis.f64 - (list) (#synthesis.Extension "lux f64 i64") - (list) (#synthesis.Extension "lux i64 f64"))) + (list) {#synthesis.Extension "lux f64 i64"} + (list) {#synthesis.Extension "lux i64 f64"})) (//case.verify subject))) )))) @@ -184,84 +184,84 @@ .let [sample_lowerS (synthesis.text sample_lower) sample_upperS (synthesis.text sample_upper) sample_alphaS (synthesis.text sample_alpha) - concatenatedS (#synthesis.Extension "lux text concat" (list sample_lowerS sample_upperS)) + concatenatedS {#synthesis.Extension "lux text concat" (list sample_lowerS sample_upperS)} pre_rep_once (format sample_lower sample_upper) post_rep_once (format sample_lower sample_alpha) pre_rep_all (|> sample_lower (list.repeated sample_size) (text.interposed sample_upper)) post_rep_all (|> sample_lower (list.repeated sample_size) (text.interposed sample_alpha))]] ($_ _.and (_.test "Can compare texts for equality." - (and (|> (#synthesis.Extension "lux text =" (list sample_lowerS sample_lowerS)) + (and (|> {#synthesis.Extension "lux text =" (list sample_lowerS sample_lowerS)} (run (..safe "lux text =")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (:as Bit valueV) _ false)) - (|> (#synthesis.Extension "lux text =" (list sample_upperS sample_lowerS)) + (|> {#synthesis.Extension "lux text =" (list sample_upperS sample_lowerS)} (run (..safe "lux text =")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (not (:as Bit valueV)) _ false)))) (_.test "Can compare texts for order." - (|> (#synthesis.Extension "lux text <" (list sample_lowerS sample_upperS)) + (|> {#synthesis.Extension "lux text <" (list sample_lowerS sample_upperS)} (run (..safe "lux text <")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (:as Bit valueV) - (#try.Failure _) + {#try.Failure _} false))) (_.test "Can get length of text." - (|> (#synthesis.Extension "lux text size" (list sample_lowerS)) + (|> {#synthesis.Extension "lux text size" (list sample_lowerS)} (run (..safe "lux text size")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (n.= sample_size (:as Nat valueV)) _ false))) (_.test "Can concatenate text." - (|> (#synthesis.Extension "lux text size" (list concatenatedS)) + (|> {#synthesis.Extension "lux text size" (list concatenatedS)} (run (..safe "lux text size")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (n.= (n.* 2 sample_size) (:as Nat valueV)) _ false))) (_.test "Can find index of sub-text." - (and (|> (#synthesis.Extension "lux text index" - (list concatenatedS sample_lowerS - (synthesis.i64 +0))) + (and (|> {#synthesis.Extension "lux text index" + (list concatenatedS sample_lowerS + (synthesis.i64 +0))} (run (..safe "lux text index")) - (case> (^multi (#try.Success valueV) + (case> (^multi {#try.Success valueV} [(:as (Maybe Nat) valueV) - (#.Some valueV)]) + {#.Some valueV}]) (n.= 0 valueV) _ false)) - (|> (#synthesis.Extension "lux text index" - (list concatenatedS sample_upperS - (synthesis.i64 +0))) + (|> {#synthesis.Extension "lux text index" + (list concatenatedS sample_upperS + (synthesis.i64 +0))} (run (..safe "lux text index")) - (case> (^multi (#try.Success valueV) + (case> (^multi {#try.Success valueV} [(:as (Maybe Nat) valueV) - (#.Some 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))) + (|> {#synthesis.Extension "lux text clip" + (list concatenatedS + (synthesis.i64 offset) + (synthesis.i64 length))} (run (..safe "lux text clip")) - (case> (^multi (#try.Success valueV) + (case> (^multi {#try.Success valueV} [(:as (Maybe Text) valueV) - (#.Some valueV)]) + {#.Some valueV}]) (text\= expected valueV) _ @@ -270,13 +270,13 @@ (and (test_clip 0 sample_size sample_lower) (test_clip sample_size sample_size sample_upper)))) (_.test "Can extract individual characters from text." - (|> (#synthesis.Extension "lux text char" - (list sample_lowerS - (synthesis.i64 char_idx))) + (|> {#synthesis.Extension "lux text char" + (list sample_lowerS + (synthesis.i64 char_idx))} (run (..safe "lux text char")) - (case> (^multi (#try.Success valueV) + (case> (^multi {#try.Success valueV} [(:as (Maybe Int) valueV) - (#.Some valueV)]) + {#.Some valueV}]) (text.contains? ("lux i64 char" valueV) sample_lower) @@ -290,51 +290,51 @@ [message (r.ascii/alpha 5)] ($_ _.and (_.test "Can log messages." - (|> (#synthesis.Extension "lux io log" - (list (synthesis.text (format "LOG: " message)))) + (|> {#synthesis.Extension "lux io log" + (list (synthesis.text (format "LOG: " message)))} (run (..safe "lux io log")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} true - (#try.Failure _) + {#try.Failure _} false))) (_.test "Can throw runtime errors." - (and (|> (#synthesis.Extension "lux try" - (list (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity 1 - #synthesis.body (#synthesis.Extension "lux io error" - (list (synthesis.text message)))]))) + (and (|> {#synthesis.Extension "lux try" + (list (synthesis.function/abstraction + [#synthesis.environment (list) + #synthesis.arity 1 + #synthesis.body {#synthesis.Extension "lux io error" + (list (synthesis.text message))}]))} (run (..safe "lux try")) - (case> (^multi (#try.Success valueV) + (case> (^multi {#try.Success valueV} [(:as (Try Text) valueV) - (#try.Failure error)]) + {#try.Failure error}]) (text.contains? message error) _ false)) - (|> (#synthesis.Extension "lux try" - (list (synthesis.function/abstraction - [#synthesis.environment (list) - #synthesis.arity 1 - #synthesis.body (synthesis.text message)]))) + (|> {#synthesis.Extension "lux try" + (list (synthesis.function/abstraction + [#synthesis.environment (list) + #synthesis.arity 1 + #synthesis.body (synthesis.text message)]))} (run (..safe "lux try")) - (case> (^multi (#try.Success valueV) + (case> (^multi {#try.Success valueV} [(:as (Try Text) valueV) - (#try.Success valueV)]) + {#try.Success valueV}]) (text\= message valueV) _ false)))) (_.test "Can obtain current time in milli-seconds." - (|> (synthesis.tuple (list (#synthesis.Extension "lux io current-time" (list)) - (#synthesis.Extension "lux io current-time" (list)))) + (|> (synthesis.tuple (list {#synthesis.Extension "lux io current-time" (list)} + {#synthesis.Extension "lux io current-time" (list)})) (run (..safe "lux io current-time")) - (case> (#try.Success valueV) + (case> {#try.Success valueV} (let [[pre post] (:as [Nat Nat] valueV)] (n.>= pre post)) - (#try.Failure _) + {#try.Failure _} false))) ))) diff --git a/stdlib/source/specification/compositor/generation/primitive.lux b/stdlib/source/specification/compositor/generation/primitive.lux index ba20601a3..670b30d30 100644 --- a/stdlib/source/specification/compositor/generation/primitive.lux +++ b/stdlib/source/specification/compositor/generation/primitive.lux @@ -34,10 +34,10 @@ [expected <gen>] (_.test (%.name (name_of <synthesis>)) (|> (run <evaluation_name> (<synthesis> expected)) - (case> (#try.Success actual) + (case> {#try.Success actual} (<test> expected (:expected actual)) - (#try.Failure _) + {#try.Failure _} false))))] ["bit" synthesis.bit r.bit bit\=] diff --git a/stdlib/source/specification/compositor/generation/reference.lux b/stdlib/source/specification/compositor/generation/reference.lux index ce3c7332a..d98e660e0 100644 --- a/stdlib/source/specification/compositor/generation/reference.lux +++ b/stdlib/source/specification/compositor/generation/reference.lux @@ -31,10 +31,10 @@ expected r.safe_frac] (_.test "Definitions." (|> (define name (synthesis.f64 expected)) - (case> (#try.Success actual) + (case> {#try.Success actual} (f.= expected (:as Frac actual)) - (#try.Failure _) + {#try.Failure _} false))))) (def: (variable run) @@ -47,10 +47,10 @@ register (synthesis.variable/local register)]) (run "variable") - (case> (#try.Success actual) + (case> {#try.Success actual} (f.= expected (:as Frac actual)) - (#try.Failure _) + {#try.Failure _} false))))) (def: .public (spec runner definer) diff --git a/stdlib/source/specification/compositor/generation/structure.lux b/stdlib/source/specification/compositor/generation/structure.lux index a70e61531..c98013875 100644 --- a/stdlib/source/specification/compositor/generation/structure.lux +++ b/stdlib/source/specification/compositor/generation/structure.lux @@ -42,7 +42,7 @@ #analysis.right? last?_in #analysis.value (synthesis.i64 value_in)]) (run "variant") - (case> (#try.Success valueT) + (case> {#try.Success valueT} (let [valueT (:as (Array Any) valueT)] (and (n.= 3 (array.size valueT)) (let [tag_out (:as java/lang/Integer (maybe.trusted (array.read! 0 valueT))) @@ -50,7 +50,7 @@ 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') + {#.Some last?_out'} (and last?_in (text\= "" (:as Text last?_out'))) #.None @@ -60,7 +60,7 @@ same_flag? same_value?)))) - (#try.Failure _) + {#try.Failure _} false))))) (def: (tuple run) @@ -71,14 +71,14 @@ (_.test (%.name (name_of synthesis.tuple)) (|> (synthesis.tuple (list\each (|>> synthesis.i64) tuple_in)) (run "tuple") - (case> (#try.Success tuple_out) + (case> {#try.Success tuple_out} (let [tuple_out (:as (Array Any) tuple_out)] (and (n.= size (array.size tuple_out)) (list.every? (function (_ [left right]) (i.= left (:as Int right))) (list.zipped/2 tuple_in (array.list tuple_out))))) - (#try.Failure _) + {#try.Failure _} false))))) (def: .public (spec runner) diff --git a/stdlib/source/specification/lux/abstract/codec.lux b/stdlib/source/specification/lux/abstract/codec.lux index 5cbdb2aa1..f30d9c94c 100644 --- a/stdlib/source/specification/lux/abstract/codec.lux +++ b/stdlib/source/specification/lux/abstract/codec.lux @@ -20,8 +20,8 @@ (_.for [/.Codec] (_.test "Isomorphism." (case (|> expected @//encoded @//decoded) - (#try.Success actual) + {#try.Success actual} (@//= expected actual) - (#try.Failure _) + {#try.Failure _} false))))) diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux index 15305d236..e2f73db67 100644 --- a/stdlib/source/specification/lux/world/console.lux +++ b/stdlib/source/specification/lux/world/console.lux @@ -31,7 +31,7 @@ .let [can_write! (case ?write - (#try.Success _) + {#try.Success _} true _ @@ -39,7 +39,7 @@ can_read! (case [?read ?read_line] - [(#try.Success _) (#try.Success _)] + [{#try.Success _} {#try.Success _}] true _ @@ -47,7 +47,7 @@ can_close! (case [?close/good ?close/bad] - [(#try.Success _) (#try.Failure _)] + [{#try.Success _} {#try.Failure _}] true _ diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux index f7c056624..3c6679dd7 100644 --- a/stdlib/source/specification/lux/world/file.lux +++ b/stdlib/source/specification/lux/world/file.lux @@ -64,8 +64,8 @@ directory_post! (\ fs directory? parent)] (in (and (not directory_pre!) (case made? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) directory_post!)))) (def: (file?&write fs content path) @@ -76,8 +76,8 @@ file_post! (\ fs file? path)] (in (and (not file_pre!) (case made? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) file_post!)))) (def: (file_size&read&append fs expected_file_size content appendix path) @@ -233,23 +233,23 @@ (not pre_dir/1) (not pre_dir/2) (case made? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) post_dir/0 post_dir/1 post_dir/2)) (_.cover' [/.cannot_make_directory] (and (case cannot_make_directory!/0 - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_make_directory error)) (case cannot_make_directory!/1 - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_make_directory error)))) ))) @@ -265,14 +265,14 @@ ($_ _.and' (_.cover' [/.make_file] (case make_file!/0 - (#try.Success _) true - (#try.Failure error) false)) + {#try.Success _} true + {#try.Failure error} false)) (_.cover' [/.cannot_make_file] (case make_file!/1 - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_make_file error))) ))) @@ -312,11 +312,11 @@ (not pre_dir/1) (case made_file? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) (case made_dir? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) post_file/0 post_file/1 diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux index 2d844ce9a..5fa846019 100644 --- a/stdlib/source/specification/lux/world/shell.lux +++ b/stdlib/source/specification/lux/world/shell.lux @@ -53,16 +53,16 @@ [?destroy (\ process destroy []) ?await (\ process await [])] (in (and (case ?destroy - (#try.Success _) + {#try.Success _} true - (#try.Failure error) + {#try.Failure error} false) (case ?await - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} true))))) (with_expansions [<shell_coverage> (as_is [/.Command /.Argument])] @@ -76,7 +76,7 @@ [?echo (\ shell execute (..echo! message)) ?sleep (\ shell execute (..sleep! seconds))] (case [?echo ?sleep] - [(#try.Success echo) (#try.Success sleep)] + [{#try.Success echo} {#try.Success sleep}] (do ! [can_read! (..can_read! message echo) can_destroy! (..can_destroy! sleep)] diff --git a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux index bccd76fac..8daf8635c 100644 --- a/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux +++ b/stdlib/source/test/aedifex/artifact/snapshot/version/value.lux @@ -54,7 +54,7 @@ (/.format (with@ #/.snapshot #///.Local sample))) remote_format (/.format [#/.version (format version /.snapshot) - #/.snapshot (#///.Remote stamp)]) + #/.snapshot {#///.Remote stamp}]) remote! (and (text.starts_with? (format version (///time.format (value@ #///stamp.time stamp))) remote_format) diff --git a/stdlib/source/test/aedifex/artifact/time/date.lux b/stdlib/source/test/aedifex/artifact/time/date.lux index e76cf4259..77c312380 100644 --- a/stdlib/source/test/aedifex/artifact/time/date.lux +++ b/stdlib/source/test/aedifex/artifact/time/date.lux @@ -59,10 +59,10 @@ (try.else false))) (_.cover [/.year_is_out_of_range] (case (/.date candidate) - (#try.Success date) + {#try.Success date} (same? candidate (/.value date)) - (#try.Failure error) + {#try.Failure error} (exception.match? /.year_is_out_of_range error))) (_.cover [/.epoch] (date\= date.epoch (/.value /.epoch))) diff --git a/stdlib/source/test/aedifex/cache.lux b/stdlib/source/test/aedifex/cache.lux index fc5efcf8f..338feb5fa 100644 --- a/stdlib/source/test/aedifex/cache.lux +++ b/stdlib/source/test/aedifex/cache.lux @@ -75,7 +75,7 @@ content ..content] (in [[#//dependency.artifact identity #//dependency.type type] - (with@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))]))) + (with@ #//package.origin {#//repository/origin.Remote ""} (//package.local pom content))]))) (def: resolution (Random Resolution) @@ -89,13 +89,13 @@ [pom (random.one (function (_ [identity profile pom]) (|> profile (with@ #//.dependencies (set.empty //dependency.hash)) - (with@ #//.identity (#.Some (value@ #//dependency.artifact dependency))) + (with@ #//.identity {#.Some (value@ #//dependency.artifact dependency)}) //pom.write try.maybe)) ..profile) content ..content] (in [dependency - (with@ #//package.origin (#//repository/origin.Remote "") (//package.local pom content))])))))] + (with@ #//package.origin {#//repository/origin.Remote ""} (//package.local pom content))])))))] (in (dictionary.of_list //dependency.hash (list& [main_dependency main_package] dependencies))))) (def: singular @@ -116,7 +116,7 @@ [_ wrote! actual_package read!] (in (\ //package.equivalence = - (with@ #//package.origin (#//repository/origin.Local "") expected_package) + (with@ #//package.origin {#//repository/origin.Local ""} expected_package) actual_package))))))))) (def: plural @@ -138,7 +138,7 @@ actual read!] (in (\ //dependency/resolution.equivalence = (\ dictionary.functor each - (with@ #//package.origin (#//repository/origin.Local "")) + (with@ #//package.origin {#//repository/origin.Local ""}) expected) actual))))))))) diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index 9cc55fd2c..e41f3e44c 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -64,9 +64,9 @@ #/.POM (list "pom") #/.Dependencies (list "deps") #/.Install (list "install") - (#/.Deploy repository [user password]) (list "deploy" repository user password) - (#/.Compilation compilation) (..compilation_format compilation) - (#/.Auto compilation) (list& "auto" (..compilation_format compilation)))) + {#/.Deploy repository [user password]} (list "deploy" repository user password) + {#/.Compilation compilation} (..compilation_format compilation) + {#/.Auto compilation} (list& "auto" (..compilation_format compilation)))) (def: without_profile Test @@ -76,11 +76,11 @@ (|> expected ..format (cli.result /.command) - (case> (#try.Success [names actual]) + (case> {#try.Success [names actual]} (and (\ (list.equivalence text.equivalence) = (list //.default) names) (\ /.equivalence = expected actual)) - (#try.Failure error) + {#try.Failure error} false))))) (def: with_profile @@ -93,11 +93,11 @@ ..format (list& "with" expected_profile) (cli.result /.command) - (case> (#try.Success [actual_profile actual_command]) + (case> {#try.Success [actual_profile actual_command]} (and (\ (list.equivalence text.equivalence) = (list expected_profile //.default) actual_profile) (\ /.equivalence = expected_command actual_command)) - (#try.Failure error) + {#try.Failure error} false))))) (def: .public test diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 4511d8a03..57aca92d2 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -55,7 +55,7 @@ (do [! async.monad] [[_ actual_runs] (async.future (atom.update! ++ @runs))] (if (n.= expected_runs actual_runs) - (in (#try.Failure end_signal)) + (in {#try.Failure end_signal}) (do (try.with !) [_ (\ fs write (\ utf8.codec encoded (%.nat actual_runs)) dummy_file) _ (\ fs modify @@ -79,7 +79,7 @@ with_target (: (-> Profile Profile) (with@ #///.target target)) with_program (: (-> Profile Profile) - (with@ #///.program (#.Some program))) + (with@ #///.program {#.Some program})) profile (|> empty_profile with_program @@ -110,17 +110,17 @@ fs (shell.async ($build.good_shell [])) resolution) - (\ ! each (|>> (case> (#try.Failure error) + (\ ! each (|>> (case> {#try.Failure error} (same? end_signal error) - (#try.Success _) + {#try.Success _} false)))) correct_number_of_runs! (|> @runs atom.read! async.future (\ ! each (n.= expected_runs)))] - (in (#try.Success (and correct_number_of_runs! - no_dangling_process!)))))] + (in {#try.Success (and correct_number_of_runs! + no_dangling_process!)})))] (_.cover' [/.do!] (try.else false verdict)))) )))) diff --git a/stdlib/source/test/aedifex/command/build.lux b/stdlib/source/test/aedifex/command/build.lux index c856b11f5..1376d440a 100644 --- a/stdlib/source/test/aedifex/command/build.lux +++ b/stdlib/source/test/aedifex/command/build.lux @@ -41,7 +41,7 @@ (-> Any (Shell IO)) (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) - (#try.Success + {#try.Success (: (shell.Mock []) (implementation (def: (on_read state) @@ -49,17 +49,17 @@ (def: (on_error state) (exception.except shell.no_more_output [])) (def: (on_write input state) - (#try.Failure "on_write")) + {#try.Failure "on_write"}) (def: (on_destroy state) - (#try.Failure "on_destroy")) + {#try.Failure "on_destroy"}) (def: (on_await state) - (#try.Success [state shell.normal])))))))) + {#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 + {#try.Success (: (shell.Mock []) (implementation (def: (on_read state) @@ -67,43 +67,43 @@ (def: (on_error state) (exception.except shell.no_more_output [])) (def: (on_write input state) - (#try.Failure "on_write")) + {#try.Failure "on_write"}) (def: (on_destroy state) - (#try.Failure "on_destroy")) + {#try.Failure "on_destroy"}) (def: (on_await state) - (#try.Success [state shell.error])))))))) + {#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 + {#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]) + {#.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]) + {#.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")) + {#try.Failure "on_write"}) (def: (on_destroy state) - (#try.Failure "on_destroy")) + {#try.Failure "on_destroy"}) (def: (on_await state) - (#try.Success [state shell.error])))))))) + {#try.Success [state shell.error]})))}))) (def: compiler (Random Dependency) @@ -153,7 +153,7 @@ with_target (: (-> Profile Profile) (with@ #///.target target)) with_program (: (-> Profile Profile) - (with@ #///.program (#.Some program))) + (with@ #///.program {#.Some program})) profile (|> empty_profile with_program @@ -164,19 +164,19 @@ (with_target empty_profile))] (_.cover' [/.no_specified_program] (case outcome - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.no_specified_program error))))) (in (do async.monad [outcome (/.do! (@version.echo "") (program.async (program.mock environment.empty home working_directory)) fs shell ///dependency/resolution.empty profile)] (_.cover' [/.Compiler /.no_available_compiler] (case outcome - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.no_available_compiler error))))) (do ! [.let [console (@version.echo "")] @@ -232,10 +232,10 @@ actual/1 (\ console read_line []) actual/2 (\ console read_line []) end! (|> (\ console read_line []) - (\ ! each (|>> (case> (#try.Failure error) + (\ ! each (|>> (case> {#try.Failure error} true - (#try.Success _) + {#try.Success _} false) #try.Success)))] (in (and (text\= expected/0 actual/0) diff --git a/stdlib/source/test/aedifex/command/deps.lux b/stdlib/source/test/aedifex/command/deps.lux index 3d563f540..8cf0ea05c 100644 --- a/stdlib/source/test/aedifex/command/deps.lux +++ b/stdlib/source/test/aedifex/command/deps.lux @@ -73,22 +73,22 @@ #///dependency.type ///artifact/type.lux_library] dependee_pom (|> (\ ///.monoid identity) - (with@ #///.identity (#.Some dependee_artifact)) + (with@ #///.identity {#.Some dependee_artifact}) ///pom.write try.trusted) depender_pom (|> (\ ///.monoid identity) - (with@ #///.identity (#.Some depender_artifact)) + (with@ #///.identity {#.Some depender_artifact}) (with@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) ///pom.write try.trusted) dependee_package (|> dependee_package - (with@ #///package.origin (#///repository/origin.Remote "")) + (with@ #///package.origin {#///repository/origin.Remote ""}) (with@ #///package.pom [dependee_pom (|> dependee_pom (\ xml.codec encoded) (\ utf8.codec encoded)) #///dependency/status.Unverified])) depender_package (|> depender_package - (with@ #///package.origin (#///repository/origin.Remote "")) + (with@ #///package.origin {#///repository/origin.Remote ""}) (with@ #///package.pom [depender_pom (|> depender_pom (\ xml.codec encoded) (\ utf8.codec encoded)) #///dependency/status.Unverified])) diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 8ef29ec92..ac1a87be1 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -65,7 +65,7 @@ (<| (_.covering /._) (do [! random.monad] [identity $artifact.random - sample (\ ! each (with@ #///.identity (#.Some identity)) + sample (\ ! each (with@ #///.identity {#.Some identity}) $profile.random) home (random.ascii/alpha 5) working_directory (random.ascii/alpha 5) diff --git a/stdlib/source/test/aedifex/command/pom.lux b/stdlib/source/test/aedifex/command/pom.lux index 80676974b..ac080c966 100644 --- a/stdlib/source/test/aedifex/command/pom.lux +++ b/stdlib/source/test/aedifex/command/pom.lux @@ -40,7 +40,7 @@ [.let [console (@version.echo "")] outcome (/.do! console fs sample)] (case outcome - (#try.Success _) + {#try.Success _} (do ! [verdict (do ///action.monad [expected (|> (///pom.write sample) @@ -60,10 +60,10 @@ (_.cover' [/.do! /.success] (try.else false verdict))) - (#try.Failure error) + {#try.Failure error} (_.cover' [/.do!] (case (value@ #///.identity sample) - (#.Some _) + {#.Some _} false #.None diff --git a/stdlib/source/test/aedifex/command/test.lux b/stdlib/source/test/aedifex/command/test.lux index bbcb582b1..19ae5cd70 100644 --- a/stdlib/source/test/aedifex/command/test.lux +++ b/stdlib/source/test/aedifex/command/test.lux @@ -52,7 +52,7 @@ with_target (: (-> Profile Profile) (with@ #///.target target)) with_test (: (-> Profile Profile) - (with@ #///.test (#.Some test))) + (with@ #///.test {#.Some test})) profile (|> empty_profile with_test @@ -83,7 +83,7 @@ [verdict (do ///action.monad [.let [bad_shell (shell.mock (function (_ [actual_environment actual_working_directory actual_command actual_arguments]) - (#try.Success + {#try.Success (: (shell.Mock []) (implementation (def: (on_read state) @@ -91,13 +91,13 @@ (def: (on_error state) (exception.except shell.no_more_output [])) (def: (on_write input state) - (#try.Failure "on_write")) + {#try.Failure "on_write"}) (def: (on_destroy state) - (#try.Failure "on_destroy")) + {#try.Failure "on_destroy"}) (def: (on_await state) - (#try.Success [state (if (list.any? (text\= "build") actual_arguments) + {#try.Success [state (if (list.any? (text\= "build") actual_arguments) shell.normal - shell.error)])))))) + 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/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 1b2b0aa53..6cd59b3a5 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -50,11 +50,11 @@ (exception.except ..console_is_closed! []))) (def: (on_write input [open? state]) (if open? - (#try.Success [open? (format state input)]) + {#try.Success [open? (format state input)]} (exception.except ..console_is_closed! []))) (def: (on_close [open? buffer]) (if open? - (#try.Success [false buffer]) + {#try.Success [false buffer]} (exception.except ..console_is_closed! [])))) (def: .public echo diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 5b7869eab..7e137443b 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -68,12 +68,12 @@ (do io.monad [_ (: (IO Any) (case [method input] - [#@http.Put (#.Some input)] + [#@http.Put {#.Some input}] (atom.update! (dictionary.has url input) cache) _ (in [])))] - (in (#try.Success ..good_upload)))))) + (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) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 2fe39286d..69867d5f8 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -92,9 +92,9 @@ (def: the_description "[0]") (def: (on_download uri state) - (#try.Failure "NOPE")) + {#try.Failure "NOPE"}) (def: (on_upload uri binary state) - (#try.Failure "NOPE")))) + {#try.Failure "NOPE"}))) (def: .public (single artifact package) (-> Artifact Package (Mock Any)) @@ -115,28 +115,28 @@ (\ xml.codec encoded) (\ utf8.codec encoded)))] (cond (text.ends_with? ///artifact/extension.lux_library uri) - (#try.Success [state library]) + {#try.Success [state library]} (text.ends_with? ..lux_sha-1 uri) - (#try.Success [state (..sha-1 library)]) + {#try.Success [state (..sha-1 library)]} (text.ends_with? ..lux_md5 uri) - (#try.Success [state (..md5 library)]) + {#try.Success [state (..md5 library)]} (text.ends_with? ///artifact/extension.pom uri) - (#try.Success [state pom]) + {#try.Success [state pom]} (text.ends_with? ..pom_sha-1 uri) - (#try.Success [state (..sha-1 pom)]) + {#try.Success [state (..sha-1 pom)]} (text.ends_with? ..pom_md5 uri) - (#try.Success [state (..md5 pom)]) + {#try.Success [state (..md5 pom)]} ... else - (#try.Failure "NOPE"))) - (#try.Failure "NOPE"))) + {#try.Failure "NOPE"})) + {#try.Failure "NOPE"})) (def: (on_upload uri binary state) - (#try.Failure "NOPE"))))) + {#try.Failure "NOPE"})))) (def: (bad_sha-1 expected_artifact expected_package dummy_package) (-> Artifact Package Package (Mock Any)) @@ -146,50 +146,50 @@ (def: (on_download uri state) (if (text.contains? (///artifact.uri (value@ #///artifact.version expected_artifact) expected_artifact) uri) (cond (text.ends_with? ///artifact/extension.lux_library uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.library) - product.left)]) + product.left)]} (text.ends_with? ..lux_sha-1 uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.library) product.left - ..sha-1)]) + ..sha-1)]} (text.ends_with? ..lux_md5 uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.library) product.left - ..md5)]) + ..md5)]} (text.ends_with? ///artifact/extension.pom uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.pom) product.left (\ xml.codec encoded) - (\ utf8.codec encoded))]) + (\ utf8.codec encoded))]} (text.ends_with? ..pom_sha-1 uri) - (#try.Success [state (|> dummy_package + {#try.Success [state (|> dummy_package (value@ #///package.pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) - ..sha-1)]) + ..sha-1)]} (text.ends_with? ..pom_md5 uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) - ..md5)]) + ..md5)]} ... else - (#try.Failure "NOPE")) - (#try.Failure "NOPE"))) + {#try.Failure "NOPE"}) + {#try.Failure "NOPE"})) (def: (on_upload uri binary state) - (#try.Failure "NOPE")))) + {#try.Failure "NOPE"}))) (def: (bad_md5 expected_artifact expected_package dummy_package) (-> Artifact Package Package (Mock Any)) @@ -199,50 +199,50 @@ (def: (on_download uri state) (if (text.contains? (///artifact.uri (value@ #///artifact.version expected_artifact) expected_artifact) uri) (cond (text.ends_with? ///artifact/extension.lux_library uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.library) - product.left)]) + product.left)]} (text.ends_with? ..lux_sha-1 uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.library) product.left - ..sha-1)]) + ..sha-1)]} (text.ends_with? ..lux_md5 uri) - (#try.Success [state (|> dummy_package + {#try.Success [state (|> dummy_package (value@ #///package.library) product.left - ..md5)]) + ..md5)]} (text.ends_with? ///artifact/extension.pom uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.pom) product.left (\ xml.codec encoded) - (\ utf8.codec encoded))]) + (\ utf8.codec encoded))]} (text.ends_with? ..pom_sha-1 uri) - (#try.Success [state (|> expected_package + {#try.Success [state (|> expected_package (value@ #///package.pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) - ..sha-1)]) + ..sha-1)]} (text.ends_with? ..pom_md5 uri) - (#try.Success [state (|> dummy_package + {#try.Success [state (|> dummy_package (value@ #///package.pom) product.left (\ xml.codec encoded) (\ utf8.codec encoded) - ..md5)]) + ..md5)]} ... else - (#try.Failure "NOPE")) - (#try.Failure "NOPE"))) + {#try.Failure "NOPE"}) + {#try.Failure "NOPE"})) (def: (on_upload uri binary state) - (#try.Failure "NOPE")))) + {#try.Failure "NOPE"}))) (def: one Test @@ -264,12 +264,12 @@ #///dependency.type ///artifact/type.lux_library])] (_.cover' [/.one] (case actual_package - (#try.Success actual_package) + {#try.Success actual_package} (\ ///package.equivalence = - (with@ #///package.origin (#///repository/origin.Remote "") expected_package) + (with@ #///package.origin {#///repository/origin.Remote ""} expected_package) actual_package) - (#try.Failure _) + {#try.Failure _} false)))) (~~ (template [<exception> <bad>] [(in (do async.monad @@ -278,10 +278,10 @@ #///dependency.type ///artifact/type.lux_library])] (_.cover' [<exception>] (case actual_package - (#try.Failure error) + {#try.Failure error} (exception.match? <exception> error) - (#try.Success _) + {#try.Success _} false))))] [/.sha-1_does_not_match bad_sha-1] @@ -313,12 +313,12 @@ #///dependency.type ///artifact/type.lux_library])] (_.cover' [/.any] (case actual_package - (#try.Success actual_package) + {#try.Success actual_package} (\ ///package.equivalence = - (with@ #///package.origin (#///repository/origin.Remote "") expected_package) + (with@ #///package.origin {#///repository/origin.Remote ""} expected_package) actual_package) - (#try.Failure _) + {#try.Failure _} false)))) (in (do async.monad [.let [console ($///version.echo "")] @@ -329,10 +329,10 @@ #///dependency.type ///artifact/type.lux_library])] (_.cover' [/.cannot_resolve] (case actual_package - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_resolve error) - (#try.Success _) + {#try.Success _} false)))) ))) @@ -366,16 +366,16 @@ #///dependency.type ///artifact/type.lux_library] dependee_pom (|> (\ ///.monoid identity) - (with@ #///.identity (#.Some dependee_artifact)) + (with@ #///.identity {#.Some dependee_artifact}) ///pom.write try.trusted) depender_pom (|> (\ ///.monoid identity) - (with@ #///.identity (#.Some depender_artifact)) + (with@ #///.identity {#.Some depender_artifact}) (with@ #///.dependencies (set.of_list ///dependency.hash (list dependee))) ///pom.write try.trusted) ignored_pom (|> (\ ///.monoid identity) - (with@ #///.identity (#.Some ignored_artifact)) + (with@ #///.identity {#.Some ignored_artifact}) ///pom.write try.trusted) diff --git a/stdlib/source/test/aedifex/dependency/status.lux b/stdlib/source/test/aedifex/dependency/status.lux index 981f18b0e..79e59460f 100644 --- a/stdlib/source/test/aedifex/dependency/status.lux +++ b/stdlib/source/test/aedifex/dependency/status.lux @@ -40,7 +40,7 @@ [payload (binaryT.random 1)] (_.cover [/.verified] (case (/.verified payload) - (#/.Verified sha1 md5) + {#/.Verified sha1 md5} true _ diff --git a/stdlib/source/test/aedifex/hash.lux b/stdlib/source/test/aedifex/hash.lux index a3220b756..049023718 100644 --- a/stdlib/source/test/aedifex/hash.lux +++ b/stdlib/source/test/aedifex/hash.lux @@ -50,18 +50,18 @@ [expected (..random <hash>)] (_.cover [<hash> <constructor> <exception>] (and (case (<constructor> (/.data expected)) - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = expected actual) - (#try.Failure error) + {#try.Failure error} false) (case (<constructor> (\ binary.monoid composite (/.data expected) (/.data expected))) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? <exception> error)))))] [/.sha-1 /.as_sha-1 /.not_a_sha-1] @@ -83,10 +83,10 @@ (case (\ <codec> decoded (format (\ <codec> encoded expected) "AABBCC")) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_a_hash error))))] [/.sha-1_codec /.sha-1] diff --git a/stdlib/source/test/aedifex/metadata/artifact.lux b/stdlib/source/test/aedifex/metadata/artifact.lux index 0f0188ea3..a1d3133c5 100644 --- a/stdlib/source/test/aedifex/metadata/artifact.lux +++ b/stdlib/source/test/aedifex/metadata/artifact.lux @@ -105,12 +105,12 @@ actual (/.read repository artifact)] (_.cover' [/.write /.read] (and (case wrote? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) (case actual - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = expected actual) - (#try.Failure _) + {#try.Failure _} false)))))) )))) diff --git a/stdlib/source/test/aedifex/metadata/snapshot.lux b/stdlib/source/test/aedifex/metadata/snapshot.lux index 39d16bd27..52f7a1562 100644 --- a/stdlib/source/test/aedifex/metadata/snapshot.lux +++ b/stdlib/source/test/aedifex/metadata/snapshot.lux @@ -117,12 +117,12 @@ actual (/.read repository artifact)] (_.cover' [/.write /.read] (and (case wrote? - (#try.Success _) true - (#try.Failure _) false) + {#try.Success _} true + {#try.Failure _} false) (case actual - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = expected actual) - (#try.Failure _) + {#try.Failure _} false)))))) )))) diff --git a/stdlib/source/test/aedifex/package.lux b/stdlib/source/test/aedifex/package.lux index 61153b8ad..69d31ddcc 100644 --- a/stdlib/source/test/aedifex/package.lux +++ b/stdlib/source/test/aedifex/package.lux @@ -64,9 +64,9 @@ ($equivalence.spec /.equivalence (\ ! each product.right ..random))) (_.cover [/.local?] - (/.local? (with@ #/.origin (#//origin.Local "~/yolo") package))) + (/.local? (with@ #/.origin {#//origin.Local "~/yolo"} package))) (_.cover [/.remote?] - (/.remote? (with@ #/.origin (#//origin.Remote "https://example.com") package))) + (/.remote? (with@ #/.origin {#//origin.Remote "https://example.com"} package))) (_.cover [/.local] (let [expected_pom (|> package (value@ #/.pom) product.left) expected_library (|> package (value@ #/.library) product.left) @@ -76,13 +76,13 @@ [actual_pom binary_pom pom_status] (value@ #/.pom local) [actual_library library_status] (value@ #/.library local)] (and (case (value@ #/.origin local) - (#//origin.Local "") true + {#//origin.Local ""} true _ false) (let [expected_sha1 (//hash.sha-1 expected_library) expected_md5 (//hash.md5 expected_library)] (and (same? expected_library actual_library) (case library_status - (#//status.Verified actual_sha1 expected_md5) + {#//status.Verified actual_sha1 expected_md5} (and (//hash\= expected_sha1 actual_sha1) (//hash\= expected_md5 expected_md5)) @@ -97,7 +97,7 @@ (in (\ xml.equivalence = actual_pom decoded_pom))) (try.else false)) (case pom_status - (#//status.Verified actual_sha1 expected_md5) + {#//status.Verified actual_sha1 expected_md5} (and (//hash\= expected_sha1 actual_sha1) (//hash\= expected_md5 expected_md5)) @@ -106,17 +106,17 @@ (_.cover [/.dependencies] (let [expected (value@ #//.dependencies profile)] (case (/.dependencies package) - (#try.Success actual) + {#try.Success actual} (\ set.equivalence = expected actual) - (#try.Failure error) + {#try.Failure error} false))) (_.cover [/.repositories] (let [expected (value@ #//.repositories profile)] (case (/.repositories package) - (#try.Success actual) + {#try.Success actual} (\ set.equivalence = expected actual) - (#try.Failure error) + {#try.Failure error} false))) )))) diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index 1152a1dba..3dc073f0d 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -84,7 +84,7 @@ //format.project list (<code>.result /.project) - (case> (#try.Success actual) + (case> {#try.Success actual} (|> expected ..with_empty_profile dictionary.entries @@ -95,5 +95,5 @@ (dictionary.of_list text.hash) (\ //project.equivalence = actual)) - (#try.Failure error) + {#try.Failure error} false)))))) diff --git a/stdlib/source/test/aedifex/pom.lux b/stdlib/source/test/aedifex/pom.lux index 92f13bd4f..4913df25d 100644 --- a/stdlib/source/test/aedifex/pom.lux +++ b/stdlib/source/test/aedifex/pom.lux @@ -35,20 +35,20 @@ (_.cover [/.write /.parser] (case [(/.write expected) (value@ #//.identity expected)] - [(#try.Success pom) - (#.Some _)] + [{#try.Success pom} + {#.Some _}] (case (<xml>.result /.parser (list pom)) - (#try.Success actual) + {#try.Success actual} (\ //.equivalence = (|> (\ //.monoid identity) (with@ #//.dependencies (value@ #//.dependencies expected)) (with@ #//.repositories (value@ #//.repositories expected))) actual) - (#try.Failure error) + {#try.Failure error} false) - [(#try.Failure error) + [{#try.Failure error} #.None] (exception.match? //.no_identity error) diff --git a/stdlib/source/test/aedifex/project.lux b/stdlib/source/test/aedifex/project.lux index 94e61bd7c..767f8cdb3 100644 --- a/stdlib/source/test/aedifex/project.lux +++ b/stdlib/source/test/aedifex/project.lux @@ -84,17 +84,17 @@ (try.else false)))) (_.cover [/.unknown_profile] (case (/.profile project fake_name) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.unknown_profile error))) (_.cover [/.circular_dependency] (case (/.profile circular sub_name) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.circular_dependency error))) )) )))) diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 0cbea2733..e65503ee9 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -72,17 +72,17 @@ "@") (def: (on_download uri state) (case (dictionary.value uri state) - (#.Some content) + {#.Some content} (case (binary.size content) 0 (exception.except ..not_found [uri]) - _ (#try.Success [state content])) + _ {#try.Success [state content]}) #.None (exception.except ..not_found [uri]))) (def: (on_upload uri content state) (if (dictionary.key? state uri) (exception.except ..cannot_upload [uri]) - (#try.Success (dictionary.has uri content state))))) + {#try.Success (dictionary.has uri content state)}))) (def: .public test Test diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux index 03c64b69a..b6d647bb9 100644 --- a/stdlib/source/test/aedifex/repository/local.lux +++ b/stdlib/source/test/aedifex/repository/local.lux @@ -44,8 +44,8 @@ actual (\ repo download uri)] (_.cover' [/.repository] (and (case before_upload - (#try.Success _) false - (#try.Failure _) true) + {#try.Success _} false + {#try.Failure _} true) (|> actual (try\each (binary\= expected)) (try.else false)))))) diff --git a/stdlib/source/test/aedifex/repository/remote.lux b/stdlib/source/test/aedifex/repository/remote.lux index 9e405ddc5..443ab884e 100644 --- a/stdlib/source/test/aedifex/repository/remote.lux +++ b/stdlib/source/test/aedifex/repository/remote.lux @@ -35,7 +35,7 @@ (-> URL (@http.Body IO)) (let [url (\ utf8.codec encoded url)] (function (_ _) - (io.io (#try.Success [(binary.size url) url]))))) + (io.io {#try.Success [(binary.size url) url]})))) (def: (good_http user password) (-> //identity.User //identity.Password (http.Client IO)) @@ -56,7 +56,7 @@ [#@http.headers (http.headers (list)) #@http.body (..url_body url)]] - [#@http.Put (#.Some input)] + [#@http.Put {#.Some input}] (if (|> headers (dictionary.value "Authorization") (maybe\each (text\= (//identity.basic_auth user password))) @@ -95,8 +95,8 @@ ($_ _.and (_.cover [/.repository /.user_agent /.Address] (let [repo (/.repository (..good_http user password) - (#.Some [#//identity.user user - #//identity.password password]) + {#.Some [#//identity.user user + #//identity.password password]} address)] (and (|> (\ repo download uri) io.run! @@ -113,19 +113,19 @@ #.None address)] (case (io.run! (\ repo upload uri content)) - (#try.Failure error) + {#try.Failure error} (exception.match? /.upload_failure error) - (#try.Success _) + {#try.Success _} false))) (_.cover [/.download_failure] (let [repo (/.repository ..bad_http #.None address)] (case (io.run! (\ repo download uri)) - (#try.Failure error) + {#try.Failure error} (exception.match? /.download_failure error) - (#try.Success _) + {#try.Success _} false))) )))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index fefe5270e..6a6ef3fac 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -176,24 +176,24 @@ ($_ _.and (_.cover [/.try] (case (/.try expected) - (#.Left _) + {#.Left _} false - (#.Right actual) + {#.Right actual} (n.= expected actual))) (_.cover [/.undefined] (case (/.try (/.undefined)) - (#.Left _) + {#.Left _} true - (#.Right _) + {#.Right _} false)) (_.cover [/.panic!] (case (/.try (/.panic! expected_error)) - (#.Left actual_error) + {#.Left actual_error} (text.contains? expected_error actual_error) - (#.Right _) + {#.Right _} false)) ))) @@ -437,13 +437,13 @@ (/.macro: (found_crosshair? tokens lux) (let [[_ _ source_code] (value@ #.source lux)] - (#.Right [lux (list (code.bit (text.contains? ..crosshair source_code)))]))) + {#.Right [lux (list (code.bit (text.contains? ..crosshair source_code)))]})) (def: for_macro Test (let [macro (: /.Macro' (function (_ tokens lux) - (#.Right [lux (list)])))] + {#.Right [lux (list)]}))] (do random.monad [expected random.nat] (with_expansions [<found_crosshair?> (for [@.old (~~ (as_is))] @@ -468,8 +468,8 @@ (/.type: for_type/variant (Variant #Case/0 - (#Case/1 Nat) - (#Case/2 Int Text))) + {#Case/1 Nat} + {#Case/2 Int Text})) (/.type: for_type/record (Record @@ -518,7 +518,7 @@ (same? /.Nat (/.:of expected))) (_.cover [/.primitive] (case (/.primitive "foo" [expected/0 expected/1]) - (^ (#.Primitive "foo" (list actual/0 actual/1))) + (^ {#.Primitive "foo" (list actual/0 actual/1)}) (and (same? expected/0 actual/0) (same? expected/1 actual/1)) @@ -526,28 +526,28 @@ false)) (_.cover [/.type] (and (case (/.type [expected/0 expected/1]) - (#.Product actual/0 actual/1) + {#.Product actual/0 actual/1} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) _ false) (case (/.type (/.Or expected/0 expected/1)) - (#.Sum actual/0 actual/1) + {#.Sum actual/0 actual/1} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) _ false) (case (/.type (-> expected/0 expected/1)) - (#.Function actual/0 actual/1) + {#.Function actual/0 actual/1} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) _ false) (case (/.type (expected/0 expected/1)) - (#.Apply actual/1 actual/0) + {#.Apply actual/1 actual/0} (and (same? expected/0 actual/0) (same? expected/1 actual/1)) @@ -562,7 +562,7 @@ (_.cover [/.Variant] (exec (: for_type/variant - (#Case/1 expected_left)) + {#Case/1 expected_left}) true)) (_.cover [/.Record] (exec @@ -836,11 +836,11 @@ (_.cover [/.Either] (and (exec (: (/.Either Nat Text) - (#.Left left)) + {#.Left left}) true) (exec (: (/.Either Nat Text) - (#.Right right)) + {#.Right right}) true))) (_.cover [/.Any] (and (exec @@ -890,12 +890,12 @@ (_.cover [/.Rec] (let [list (: (/.Rec NList (Maybe [Nat NList])) - (#.Some [item/0 - (#.Some [item/1 - (#.Some [item/2 - #.None])])]))] + {#.Some [item/0 + {#.Some [item/1 + {#.Some [item/2 + #.None]}]}]})] (case list - (#.Some [actual/0 (#.Some [actual/1 (#.Some [actual/2 #.None])])]) + {#.Some [actual/0 {#.Some [actual/1 {#.Some [actual/2 #.None]}]}]} (and (same? item/0 actual/0) (same? item/1 actual/1) (same? item/2 actual/2)) @@ -950,11 +950,11 @@ (/.case [#left expected_nat #right expected_int] [#left 0 #right +0] true _ false) - (/.case (: (Either Nat Int) (#.Left expected_nat)) - (#.Left 0) true + (/.case (: (Either Nat Int) {#.Left expected_nat}) + {#.Left 0} true _ false) - (/.case (: (Either Nat Int) (#.Right expected_int)) - (#.Right +0) true + (/.case (: (Either Nat Int) {#.Right expected_int}) + {#.Right +0} true _ false) )) (_.cover [/.^or] @@ -1083,8 +1083,8 @@ (case (value@ #.mode info) #.Build true _ false)] - (#.Right [lux (list (code.bit (and conforming_target! - compiling!)))])))) + {#.Right [lux (list (code.bit (and conforming_target! + compiling!)))]}))) (syntax: (for_meta|Module_State []) (do meta.monad @@ -1146,8 +1146,8 @@ local? (: (-> Ref Bit) (function (_ ref) (case ref - (#.Local _) true - (#.Captured _) false))) + {#.Local _} true + {#.Captured _} false))) captured? (: (-> Ref Bit) (|>> local? not)) binding? (: (-> (-> Ref Bit) Text Bit) diff --git a/stdlib/source/test/lux/abstract/apply.lux b/stdlib/source/test/lux/abstract/apply.lux index d5a1cd060..d7c6495c3 100644 --- a/stdlib/source/test/lux/abstract/apply.lux +++ b/stdlib/source/test/lux/abstract/apply.lux @@ -26,9 +26,9 @@ (_.cover [/.composite] (let [expected (n.+ left right)] (case (\ (/.composite maybe.monad maybe.apply list.apply) on - (#.Some (list right)) - (#.Some (list (n.+ left)))) - (^ (#.Some (list actual))) + {#.Some (list right)} + {#.Some (list (n.+ left))}) + (^ {#.Some (list actual)}) (n.= expected actual) _ diff --git a/stdlib/source/test/lux/abstract/codec.lux b/stdlib/source/test/lux/abstract/codec.lux index fdaff8185..aadf0d0e2 100644 --- a/stdlib/source/test/lux/abstract/codec.lux +++ b/stdlib/source/test/lux/abstract/codec.lux @@ -40,8 +40,8 @@ (<| (_.covering /._) (_.cover [/.composite] (case (|> expected (\ ..codec encoded) (\ ..codec decoded)) - (#try.Success actual) + {#try.Success actual} (bit\= expected actual) - (#try.Failure error) + {#try.Failure error} false))))) diff --git a/stdlib/source/test/lux/abstract/enum.lux b/stdlib/source/test/lux/abstract/enum.lux index 83505a5be..5e2807e53 100644 --- a/stdlib/source/test/lux/abstract/enum.lux +++ b/stdlib/source/test/lux/abstract/enum.lux @@ -38,7 +38,7 @@ (/.range n.enum start end) (list.reversed (/.range n.enum end start))) every_element_is_a_successor? (case range - (#.Item head tail) + {#.Item head tail} (|> (list\mix (function (_ next [verdict prev]) [(and verdict (n.= next (\ n.enum succ prev))) diff --git a/stdlib/source/test/lux/abstract/equivalence.lux b/stdlib/source/test/lux/abstract/equivalence.lux index 206150921..799a657cb 100644 --- a/stdlib/source/test/lux/abstract/equivalence.lux +++ b/stdlib/source/test/lux/abstract/equivalence.lux @@ -48,7 +48,7 @@ [#.End #.End] true - [(#.Item leftH lefT) (#.Item rightH rightT)] + [{#.Item leftH lefT} {#.Item rightH rightT}] (and (n.= leftH rightH) (\ equivalence = lefT rightT)) diff --git a/stdlib/source/test/lux/abstract/functor.lux b/stdlib/source/test/lux/abstract/functor.lux index dff57b393..97540f00e 100644 --- a/stdlib/source/test/lux/abstract/functor.lux +++ b/stdlib/source/test/lux/abstract/functor.lux @@ -27,16 +27,16 @@ (_.cover [/.Or /.sum] (and (case (\ (/.sum maybe.functor list.functor) each (n.+ shift) - (#.Left (#.Some left))) - (#.Left (#.Some actual)) + {#.Left {#.Some left}}) + {#.Left {#.Some actual}} (n.= (n.+ shift left) actual) _ false) (case (\ (/.sum maybe.functor list.functor) each (n.+ shift) - (#.Right (list right))) - (^ (#.Right (list actual))) + {#.Right (list right)}) + (^ {#.Right (list actual)}) (n.= (n.+ shift right) actual) _ @@ -44,8 +44,8 @@ (_.cover [/.And /.product] (case (\ (/.product maybe.functor list.functor) each (n.+ shift) - [(#.Some left) (list right)]) - (^ [(#.Some actualL) (list actualR)]) + [{#.Some left} (list right)]) + (^ [{#.Some actualL} (list actualR)]) (and (n.= (n.+ shift left) actualL) (n.= (n.+ shift right) actualR)) @@ -54,8 +54,8 @@ (_.cover [/.Then /.composite] (case (\ (/.composite maybe.functor list.functor) each (n.+ shift) - (#.Some (list left))) - (^ (#.Some (list actual))) + {#.Some (list left)}) + (^ {#.Some (list actual)}) (n.= (n.+ shift left) actual) _ diff --git a/stdlib/source/test/lux/abstract/monad/free.lux b/stdlib/source/test/lux/abstract/monad/free.lux index 39f91dc05..8fc9c96a8 100644 --- a/stdlib/source/test/lux/abstract/monad/free.lux +++ b/stdlib/source/test/lux/abstract/monad/free.lux @@ -20,15 +20,15 @@ (def: injection (Injection (/.Free List)) - (|>> #/.Pure)) + (|>> {#/.Pure})) (def: (interpret free) (All (_ a) (-> (/.Free List a) (List a))) (case free - (#/.Pure value) + {#/.Pure value} (list value) - (#/.Effect effect) + {#/.Effect effect} (|> effect (list\each interpret) list.together))) diff --git a/stdlib/source/test/lux/abstract/predicate.lux b/stdlib/source/test/lux/abstract/predicate.lux index 8799e27a9..3cc54444b 100644 --- a/stdlib/source/test/lux/abstract/predicate.lux +++ b/stdlib/source/test/lux/abstract/predicate.lux @@ -83,7 +83,7 @@ #.End false - (#.Item head tail) + {#.Item head tail} (or (even? head) (recur tail)))))))] (bit\= (list.any? even? samples) diff --git a/stdlib/source/test/lux/control/concatenative.lux b/stdlib/source/test/lux/control/concatenative.lux index 4cc158fd5..d1bb1d315 100644 --- a/stdlib/source/test/lux/control/concatenative.lux +++ b/stdlib/source/test/lux/control/concatenative.lux @@ -69,7 +69,7 @@ (~~ (template [<function> <tag>] [(_.cover [<function>] ((sum.equivalence n.= n.=) - (<tag> sample) + {<tag> sample} (||> (/.push sample) <function>)))] diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 27b13bba4..c36e1b074 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -36,14 +36,14 @@ (message: (count! [increment Nat] state self) Nat (let [state' (n.+ increment state)] - (async\in (#try.Success [state' state']))))] + (async\in {#try.Success [state' state']})))] ) (def: (mailed? outcome) (-> (Try Any) Bit) (case outcome - (#try.Success _) true - (#try.Failure _) false)) + {#try.Success _} true + {#try.Failure _} false)) (def: .public test Test @@ -92,12 +92,12 @@ (do [! async.monad] [outcome (message state self)] (case outcome - (#try.Failure cause) + {#try.Failure cause} (do ! [_ (async.future (write cause))] (in outcome)) - (#try.Success _) + {#try.Success _} (in outcome))))]) [])] (/.poison! actor))) @@ -105,7 +105,7 @@ result (async.future (async.value read))] (_.cover' [/.poisoned] (case result - (#.Some error) + {#.Some error} (exception.match? /.poisoned error) #.None @@ -127,10 +127,10 @@ (/.mail! ++! counter)))] (_.cover' [/.dead] (case result - (#try.Success outcome) + {#try.Success outcome} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.dead error))))) (let [die! (: (/.Mail Nat) @@ -142,10 +142,10 @@ sent? (/.mail! die! actor) alive? (/.alive? actor) obituary (/.obituary' actor)] - (in (#try.Success [actor sent? alive? obituary]))))] + (in {#try.Success [actor sent? alive? obituary]})))] (_.cover' [/.Obituary /.obituary'] (case result - (^ (#try.Success [actor sent? alive? (#.Some [error state (list single_pending_message)])])) + (^ {#try.Success [actor sent? alive? {#.Some [error state (list single_pending_message)]}]}) (and (..mailed? sent?) (not alive?) (exception.match? ..got_wrecked error) @@ -166,10 +166,10 @@ (n.= 3 output_3))))] (_.cover' [/.Message /.actor: /.message: /.tell!] (case result - (#try.Success outcome) + {#try.Success outcome} outcome - (#try.Failure error) + {#try.Failure error} false)))) (in (do async.monad @@ -187,7 +187,7 @@ (..mailed? sent/--?) (..mailed? poisoned?) (case obituary - (^ (#.Some [error final_state (list poison_pill)])) + (^ {#.Some [error final_state (list poison_pill)]}) (and (exception.match? /.poisoned error) (n.= (++ (++ initial_state)) final_state)) @@ -214,10 +214,10 @@ (if (n.< num_observations events_seen) (do ! [_ (atom.update! (row.suffix event) sink)] - (in (#try.Success (++ events_seen)))) + (in {#try.Success (++ events_seen)})) (do ! [_ stop] - (in (#try.Failure "YOLO"))))))) + (in {#try.Failure "YOLO"})))))) (frp.sequential 0 events) agent)] (in agent))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index 2194854b5..f117f57f5 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -38,8 +38,8 @@ [?left (/.value left) ?right (/.value right)] (in (case [?left ?right] - [(#.Some left) - (#.Some right)] + [{#.Some left} + {#.Some right}] (== left right) _ @@ -120,7 +120,7 @@ (in rightE))] (_.cover' [/.or] (case [?left ?right] - [(#.Left leftA) (#.Right rightA)] + [{#.Left leftA} {#.Right rightA}] (n.= (n.+ leftE rightE) (n.+ leftA rightA)) @@ -141,7 +141,7 @@ ?never (/.future (/.value async))] (_.cover' [/.value] (case [?actual ?never] - [(#.Some actual) #.None] + [{#.Some actual} #.None] (n.= expected actual) _ @@ -159,7 +159,7 @@ ?actual (/.within waiting_time (in expected))] (_.cover' [/.within] (case [?none ?actual] - [#.None (#.Some actual)] + [#.None {#.Some actual}] (n.= expected actual) _ diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index d4615020b..c46d0da92 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -39,8 +39,8 @@ [?left (async.value left) ?right (async.value right)] (in (case [?left ?right] - [(#.Some (#.Some [left _])) - (#.Some (#.Some [right _]))] + [{#.Some {#.Some [left _]}} + {#.Some {#.Some [right _]}}] (== left right) _ @@ -58,8 +58,8 @@ #.None (in #.End) - (#.Some [head tail]) - (\ ! each (|>> (#.Item head)) + {#.Some [head tail]} + (\ ! each (|>> {#.Item head}) (take_amount (-- amount_of_polls) [channel sink])))))) (def: .public test @@ -90,18 +90,18 @@ _ (\ sink feed sample) _ (\ sink close)] (in channel))) - (#try.Success channel) + {#try.Success channel} (io.run! (do io.monad [?actual (async.value channel)] (in (case ?actual - (#.Some (#.Some [actual _])) + {#.Some {#.Some [actual _]}} (n.= sample actual) _ false)))) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.channel_is_already_closed] (case (io.run! @@ -109,10 +109,10 @@ [.let [[channel sink] (/.channel [])] _ (\ sink close)] (\ sink feed sample))) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.channel_is_already_closed error))) (in (do async.monad [output (|> sample @@ -148,7 +148,7 @@ _ (atom.update! (row.suffix value) sink)] (if (n.< (list.size inputs) (++ (row.size current))) - (in (#.Some [])) + (in {#.Some []}) (do ! [_ (!signal [])] (in #.None))))) @@ -212,8 +212,8 @@ (/.iterations (function (_ [iterations current]) (async.resolved (if (n.< max_iterations iterations) - (#.Some [[(++ iterations) (n.+ shift current)] - current]) + {#.Some [[(++ iterations) (n.+ shift current)] + current]} #.None)))) /.list)] (_.cover' [/.iterations] diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 6f87f0889..44b2241f3 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -45,7 +45,7 @@ [result (async.within ..delay (/.wait! semaphore))] (_.cover' [/.semaphore] (case result - (#.Some _) + {#.Some _} true #.None @@ -58,7 +58,7 @@ result (async.within ..delay (/.wait! semaphore))] (_.cover' [/.wait!] (case result - (#.Some _) + {#.Some _} false #.None @@ -74,7 +74,7 @@ result/1 (async.within ..delay block)] (_.cover' [/.signal!] (case [result/0 result/1 open_positions] - [#.None (#.Some _) (#try.Success +0)] + [#.None {#.Some _} {#try.Success +0}] true _ @@ -86,7 +86,7 @@ [outcome (/.signal! semaphore)] (_.cover' [/.semaphore_is_maxed_out] (case outcome - (#try.Failure error) + {#try.Failure error} (exception.match? /.semaphore_is_maxed_out error) _ @@ -148,7 +148,7 @@ [0 #.None] true - [_ (#.Some limit)] + [_ {#.Some limit}] (and (n.> 0 raw) (n.= raw (refinement.value limit))) diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index ecb4ee77d..9fcea56e8 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -75,12 +75,12 @@ #.End (_\in #.End) - (#.Item x xs') + {#.Item x xs'} (do [! /.monad] [output (/.shift (function (_ k) (do ! [tail (k xs')] - (in (#.Item x tail)))))] + (in {#.Item x tail}))))] (visit output)))))] (list\= elems (/.result (/.reset (visit elems)))))) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index faeac513e..1a0d26c86 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -39,24 +39,24 @@ ($_ _.and (_.cover [/.except] (case (/.except ..an_exception []) - (#try.Success _) false - (#try.Failure _) true)) + {#try.Success _} false + {#try.Failure _} true)) (_.cover [/.error] (case (/.except ..an_exception []) - (#try.Success _) + {#try.Success _} false - (#try.Failure message) + {#try.Failure message} (text\= message (/.error ..an_exception [])))) (_.cover [/.match?] (/.match? ..an_exception (/.error ..an_exception []))) (_.cover [/.assertion] (case (/.assertion ..an_exception [] assertion_succeeded?) - (#try.Success _) + {#try.Success _} assertion_succeeded? - (#try.Failure message) + {#try.Failure message} (and (not assertion_succeeded?) (text\= message (/.error ..an_exception []))))) (_.cover [/.when] @@ -88,27 +88,27 @@ (text.contains? field1 enumeration) (text.contains? value1 enumeration)))) (_.cover [/.with] - (and (case (/.with ..an_exception [] (#try.Success expected)) - (#try.Success actual) (n.= expected actual) - (#try.Failure _) false) - (case (/.with ..an_exception [] (#try.Failure "")) - (#try.Success _) false - (#try.Failure message) (text\= message (/.error ..an_exception []))) + (and (case (/.with ..an_exception [] {#try.Success expected}) + {#try.Success actual} (n.= expected actual) + {#try.Failure _} false) + (case (/.with ..an_exception [] {#try.Failure ""}) + {#try.Success _} false + {#try.Failure message} (text\= message (/.error ..an_exception []))) (case (/.with ..an_exception [] (: (Try Nat) (/.except ..another_exception []))) - (#try.Success _) + {#try.Success _} false - (#try.Failure message) + {#try.Failure message} (and (text.contains? (/.error ..an_exception []) message) (text.contains? (/.error ..another_exception []) message))))) (_.cover [/.exception:] (case (/.except ..custom_exception [expected]) - (#try.Success _) + {#try.Success _} false - (#try.Failure message) + {#try.Failure message} (and (text.contains? ..label message) (text.contains? (%.nat expected) message)))) )))) diff --git a/stdlib/source/test/lux/control/function/contract.lux b/stdlib/source/test/lux/control/function/contract.lux index 2ea5d8e3e..3e50834a7 100644 --- a/stdlib/source/test/lux/control/function/contract.lux +++ b/stdlib/source/test/lux/control/function/contract.lux @@ -25,20 +25,20 @@ (_.cover [/.pre /.pre_condition_failed] (case (try (/.pre (n.even? expected) true)) - (#try.Success output) + {#try.Success output} output - (#try.Failure error) + {#try.Failure error} (and (text.contains? (value@ #exception.label /.pre_condition_failed) error) (not (n.even? expected))))) (_.cover [/.post /.post_condition_failed] (case (try (/.post n.odd? expected)) - (#try.Success actual) + {#try.Success actual} (same? expected actual) - (#try.Failure error) + {#try.Failure error} (and (text.contains? (value@ #exception.label /.post_condition_failed) error) (not (n.odd? expected))))) diff --git a/stdlib/source/test/lux/control/maybe.lux b/stdlib/source/test/lux/control/maybe.lux index 1c3e270a5..2cdce3830 100644 --- a/stdlib/source/test/lux/control/maybe.lux +++ b/stdlib/source/test/lux/control/maybe.lux @@ -55,7 +55,7 @@ [a (lifted (io\in left)) b (in right)] (in (n.+ a b)))) - (case> (#.Some actual) + (case> {#.Some actual} (n.= expected actual) _ @@ -68,21 +68,21 @@ #.None)) (same? value (/.else default - (#.Some value)))))) + {#.Some value}))))) (do random.monad [value random.nat] (_.cover [/.trusted] - (same? value (/.trusted (#.Some value))))) + (same? value (/.trusted {#.Some value})))) (do random.monad [value random.nat] (_.cover [/.list] (\ (list.equivalence n.equivalence) = (list value) - (/.list (#.Some value))))) + (/.list {#.Some value})))) (do random.monad [expected random.nat .let [(^open "/\[0]") (/.equivalence n.equivalence)]] (_.cover [/.when] - (and (/\= (#.Some expected) (/.when true (#.Some expected))) - (/\= #.None (/.when false (#.Some expected)))))) + (and (/\= {#.Some expected} (/.when true {#.Some expected})) + (/\= #.None (/.when false {#.Some expected}))))) ))) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index fa3e828dc..119bfebb6 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -43,7 +43,7 @@ (def: (should_fail expected input) (All (_ a) (-> Text (Try a) Bit)) (case input - (#try.Failure actual) + {#try.Failure actual} (text\= expected actual) _ @@ -52,7 +52,7 @@ (def: (enforced? parser input) (All (_ s) (-> (Parser s Any) s Bit)) (case (/.result parser input) - (#try.Success [_ []]) + {#try.Success [_ []]} #1 _ @@ -61,7 +61,7 @@ (def: (found? parser input) (All (_ s) (-> (Parser s Bit) s Bit)) (case (/.result parser input) - (#try.Success [_ #1]) + {#try.Success [_ #1]} #1 _ @@ -70,7 +70,7 @@ (def: (fails? input) (All (_ a) (-> (Try a) Bit)) (case input - (#try.Failure _) + {#try.Failure _} #1 _ @@ -80,7 +80,7 @@ then <code>.any input <code>.any]) (in (list (` (case (~ input) - (^ (#try.Success [(~' _) (~ pattern)])) + (^ {#try.Success [(~' _) (~ pattern)]}) (~ then) (~' _) @@ -99,7 +99,7 @@ (_.cover [/.maybe] (and (|> (list (code.nat expected0)) (/.result (/.maybe <code>.nat)) - (match (#.Some actual) + (match {#.Some actual} (n.= expected0 actual))) (|> (list (code.int (.int expected0))) (/.result (/.maybe <code>.nat)) @@ -149,10 +149,10 @@ odd (/.only n.odd? <code>.nat)] (and (|> (list (code.nat even0)) (/.result (/.or even odd)) - (match (#.Left actual) (n.= even0 actual))) + (match {#.Left actual} (n.= even0 actual))) (|> (list (code.nat odd0)) (/.result (/.or even odd)) - (match (#.Right actual) (n.= odd0 actual))) + (match {#.Right actual} (n.= odd0 actual))) (|> (list (code.bit not0)) (/.result (/.or even odd)) fails?)))) @@ -339,7 +339,7 @@ (Comparison (All (_ a i) (Parser i a))) (function (_ == left right) (case [(/.result left []) (/.result right [])] - [(#try.Success [_ left]) (#try.Success [_ right])] + [{#try.Success [_ left]} {#try.Success [_ right]}] (== left right) _ @@ -370,10 +370,10 @@ (should_fail failure))) (_.cover [/.lifted] (and (|> (list) - (/.result (/.lifted (#try.Success expected))) + (/.result (/.lifted {#try.Success expected})) (match actual (n.= expected actual))) (|> (list) - (/.result (/.lifted (#try.Failure failure))) + (/.result (/.lifted {#try.Failure failure})) (should_fail failure)))) (_.cover [/.assertion] (and (|> (list (code.bit #1) (code.int +123)) diff --git a/stdlib/source/test/lux/control/parser/analysis.lux b/stdlib/source/test/lux/control/parser/analysis.lux index c1babf741..392e66382 100644 --- a/stdlib/source/test/lux/control/parser/analysis.lux +++ b/stdlib/source/test/lux/control/parser/analysis.lux @@ -57,10 +57,10 @@ (_.cover [/.result /.any] (|> (list expected) (/.result /.any) - (case> (#try.Success actual) + (case> {#try.Success actual} (\ analysis.equivalence = expected actual) - (#try.Failure _) + {#try.Failure _} false)))) (~~ (template [<query> <check> <random> <analysis> <=>] [(do [! random.monad] @@ -68,17 +68,17 @@ (_.cover [<query>] (|> (list (<analysis> expected)) (/.result <query>) - (case> (#try.Success actual) + (case> {#try.Success actual} (<=> expected actual) - (#try.Failure _) + {#try.Failure _} false)))) (do [! random.monad] [expected <random>] (_.cover [<check>] (|> (list (<analysis> expected)) (/.result (<check> expected)) - (!expect (#try.Success _)))))] + (!expect {#try.Success _}))))] [/.bit /.bit! random.bit analysis.bit bit\=] [/.nat /.nat! random.nat analysis.nat n.=] @@ -95,54 +95,54 @@ (_.cover [/.tuple] (|> (list (analysis.tuple (list (analysis.bit expected)))) (/.result (/.tuple /.bit)) - (case> (#try.Success actual) + (case> {#try.Success actual} (bit\= expected actual) - (#try.Failure _) + {#try.Failure _} false)))) (do [! random.monad] [dummy random.bit] (_.cover [/.end?] (and (|> (/.result /.end? (list)) - (!expect (#try.Success #1))) + (!expect {#try.Success #1})) (|> (/.result (do <>.monad [verdict /.end? _ /.bit] (in verdict)) (list (analysis.bit dummy))) - (!expect (#try.Success #0)))))) + (!expect {#try.Success #0}))))) (do [! random.monad] [dummy random.bit] (_.cover [/.end!] (and (|> (/.result /.end! (list)) - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result /.end! (list (analysis.bit dummy))) - (!expect (#try.Failure _)))))) + (!expect {#try.Failure _}))))) (do [! random.monad] [expected random.bit] (_.cover [/.cannot_parse] (and (|> (list (analysis.bit expected)) (/.result /.nat) - (case> (#try.Success _) + (case> {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_parse error))) (|> (list) (/.result /.bit) - (case> (#try.Success _) + (case> {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_parse error)))))) (do [! random.monad] [expected random.bit] (_.cover [/.unconsumed_input] (|> (list (analysis.bit expected) (analysis.bit expected)) (/.result /.bit) - (case> (#try.Success _) + (case> {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.unconsumed_input error))))) ))))) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index 7e8ddd47c..40e2fa301 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -56,10 +56,10 @@ (|> value (\ utf8.codec encoded) (\ utf8.codec decoded) - (case> (#try.Success converted) + (case> {#try.Success converted} (text\= value converted) - (#try.Failure error) + {#try.Failure error} false))) (def: random_text @@ -131,7 +131,7 @@ (_.cover [<size> <parser> <format>] (|> (format.result <format> expected) (/.result <parser>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= (.nat expected) (.nat actual)))))))] @@ -150,7 +150,7 @@ (_.cover [<parser> <format>] (|> (format.result <format> expected) (/.result <parser>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ binary.equivalence = expected actual))))))] [/.binary/8 format.binary/8] @@ -168,7 +168,7 @@ (_.cover [<parser> <format>] (|> (format.result <format> expected) (/.result <parser>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ text.equivalence = expected actual))))))] [/.utf8/8 format.utf8/8] @@ -188,7 +188,7 @@ (|> expected (format.result (<format> format.nat)) (/.result (<parser> /.nat)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ (row.equivalence n.equivalence) = expected actual))))))] [/.row/8 format.row/8] @@ -207,7 +207,7 @@ (|> expected (format.result <format>) (/.result <parser>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ <equivalence> = expected actual))))))] [/.bit format.bit random.bit bit.equivalence] @@ -220,7 +220,7 @@ (|> expected (format.result format.frac) (/.result /.frac) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (or (\ frac.equivalence = expected actual) (and (frac.not_a_number? expected) (frac.not_a_number? actual)))))))) @@ -232,7 +232,7 @@ (|> expected (format.result format.bits/8) (/.result /.bit) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.not_a_bit error)))))) ))) @@ -246,7 +246,7 @@ (|> expected (format.result <format>) (/.result <parser>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ <equivalence> = expected actual))))))] [/.location format.location random_location location_equivalence] @@ -260,7 +260,7 @@ (|> expected (format.result <format>) (/.result <parser>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ <equivalence> = expected actual))))))] [/.maybe (/.maybe /.nat) format.maybe (format.maybe format.nat) (random.maybe random.nat) (maybe.equivalence n.equivalence)] @@ -273,7 +273,7 @@ (|> expected (format.result (format.list format.nat)) (/.result (/.set n.hash /.nat)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.set_elements_are_not_unique error)))))) (do [! random.monad] [expected (random.or random.bit random.nat)] @@ -282,7 +282,7 @@ (format.result (format.or format.bit format.nat)) (/.result (: (/.Parser (Either Bit Nat)) (/.or /.bit /.nat))) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ (sum.equivalence bit.equivalence n.equivalence) = expected actual)))))) @@ -296,7 +296,7 @@ (format.result (format.and format.bits/8 format.bit)) (/.result (: (/.Parser (Either Bit Nat)) (/.or /.bit /.nat))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.invalid_tag error)))))) (do [! random.monad] [expected (random.list ..segment_size random.nat)] @@ -310,7 +310,7 @@ (/.or /.any (<>.and /.nat recur)))))) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ (list.equivalence n.equivalence) = expected actual)))))) @@ -325,13 +325,13 @@ format.no_op format.instance] (|> (format.instance format.no_op) (/.result /.any) - (!expect (#try.Success _)))) + (!expect {#try.Success _}))) (do [! random.monad] [data (\ ! each (\ utf8.codec encoded) (random.ascii ..segment_size))] (_.cover [/.binary_was_not_fully_read] (|> data (/.result /.any) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.binary_was_not_fully_read error)))))) (do [! random.monad] [expected (\ ! each (\ utf8.codec encoded) (random.ascii ..segment_size))] @@ -339,7 +339,7 @@ (|> expected (format.result (format.segment ..segment_size)) (/.result (/.segment ..segment_size)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ binary.equivalence = expected actual)))))) (do [! random.monad] [data (\ ! each (\ utf8.codec encoded) (random.ascii ..segment_size))] @@ -351,7 +351,7 @@ post /.end?] (in (and (not pre) post)))) - (!expect (#try.Success #1))))) + (!expect {#try.Success #1})))) (do [! random.monad] [to_read (\ ! each (n.% (++ ..segment_size)) random.nat) data (\ ! each (\ utf8.codec encoded) (random.ascii ..segment_size))] @@ -366,7 +366,7 @@ (in (and (n.= 0 start) (n.= to_read offset) (n.= ..segment_size nothing_left))))) - (!expect (#try.Success #1))))) + (!expect {#try.Success #1})))) (do [! random.monad] [to_read (\ ! each (n.% (++ ..segment_size)) random.nat) data (\ ! each (\ utf8.codec encoded) (random.ascii ..segment_size))] @@ -380,7 +380,7 @@ (in (and (n.= ..segment_size (n.+ to_read remaining)) (n.= 0 nothing_left))))) - (!expect (#try.Success #1))))) + (!expect {#try.Success #1})))) ..size ..binary ..utf8 diff --git a/stdlib/source/test/lux/control/parser/cli.lux b/stdlib/source/test/lux/control/parser/cli.lux index 69f8cfe3e..fe10e5ccd 100644 --- a/stdlib/source/test/lux/control/parser/cli.lux +++ b/stdlib/source/test/lux/control/parser/cli.lux @@ -42,42 +42,42 @@ ($_ _.and (_.cover [/.result /.any] (|> (/.result /.any (list expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (text\= expected actual))))) (_.cover [/.parse] (|> (/.result (/.parse n\decoded) (list expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (text\= expected (n\encoded actual)))))) (_.cover [/.this] (and (|> (/.result (/.this expected) (list expected)) - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result (/.this expected) (list dummy)) - (!expect (#try.Failure _))))) + (!expect {#try.Failure _})))) (_.cover [/.somewhere] (|> (/.result (|> (/.somewhere (/.this expected)) (<>.before (<>.some /.any))) (list.together (list pre_ignore (list expected) post_ignore))) - (!expect (#try.Success _)))) + (!expect {#try.Success _}))) (_.cover [/.end] (and (|> (/.result /.end (list)) - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result (<>.not /.end) (list expected)) - (!expect (#try.Failure _))))) + (!expect {#try.Failure _})))) (_.cover [/.named] (|> (/.result (/.named dummy /.any) (list dummy expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (text\= expected actual))))) (_.cover [/.parameter] (and (|> (/.result (/.parameter [short long] /.any) (list short expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (text\= expected actual)))) (|> (/.result (/.parameter [short long] /.any) (list long expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (text\= expected actual)))) (|> (/.result (/.parameter [short long] /.any) (list dummy expected)) - (!expect (#try.Failure _))))) + (!expect {#try.Failure _})))) )))) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux index 8ee19b7e4..400aea243 100644 --- a/stdlib/source/test/lux/control/parser/code.lux +++ b/stdlib/source/test/lux/control/parser/code.lux @@ -48,9 +48,9 @@ [expected (\ ! each code.bit random.bit)] (_.cover [/.result] (and (|> (/.result /.any (list expected)) - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result /.any (list)) - (!expect (#try.Failure _)))))) + (!expect {#try.Failure _}))))) (~~ (template [<query> <check> <random> <code> <equivalence>] [(do [! random.monad] [expected <random> @@ -58,13 +58,13 @@ ($_ _.and (_.cover [<query>] (|> (/.result <query> (list (<code> expected))) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ <equivalence> = expected actual))))) (_.cover [<check>] (and (|> (/.result (<check> expected) (list (<code> expected))) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (<check> expected) (list (<code> dummy))) - (!expect (#try.Failure _))))) + (!expect {#try.Failure _})))) ))] [/.any /.this! (\ ! each code.bit random.bit) function.identity code.equivalence] @@ -87,7 +87,7 @@ (|> (/.result (<query> (<>.and /.nat /.int)) (list (<code> (list (code.nat expected_left) (code.int expected_right))))) - (!expect (^multi (#try.Success [actual_left actual_right]) + (!expect (^multi {#try.Success [actual_left actual_right]} (and (\ nat.equivalence = expected_left actual_left) (\ int.equivalence = expected_right actual_right)))))))] @@ -102,7 +102,7 @@ (|> (/.result (<>.and (/.local (list (code.nat expected_local)) /.nat) /.int) (list (code.int expected_global))) - (!expect (^multi (#try.Success [actual_local actual_global]) + (!expect (^multi {#try.Success [actual_local actual_global]} (and (\ nat.equivalence = expected_local actual_local) (\ int.equivalence = expected_global actual_global))))))) (do [! random.monad] @@ -115,15 +115,15 @@ (in (and (not pre) post))) (list dummy)) - (!expect (^multi (#try.Success verdict) + (!expect (^multi {#try.Success verdict} verdict))))) (do [! random.monad] [dummy (\ ! each code.bit random.bit)] (_.cover [/.end!] (and (|> (/.result /.end! (list)) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result /.end! (list dummy)) - (!expect (#try.Failure _)))))) + (!expect {#try.Failure _}))))) (do [! random.monad] [expected (\ ! each code.bit random.bit)] (_.cover [/.next] @@ -133,13 +133,13 @@ (in (and (same? expected pre) (same? pre post)))) (list expected)) - (!expect (#try.Success _))))) + (!expect {#try.Success _})))) (do [! random.monad] [expected (\ ! each code.bit random.bit)] (_.cover [/.not] (and (|> (/.result (/.not /.nat) (list expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (same? expected actual)))) (|> (/.result (/.not /.bit) (list expected)) - (!expect (#try.Failure _)))))) + (!expect {#try.Failure _}))))) )))) diff --git a/stdlib/source/test/lux/control/parser/environment.lux b/stdlib/source/test/lux/control/parser/environment.lux index 42c09df66..dbef40a52 100644 --- a/stdlib/source/test/lux/control/parser/environment.lux +++ b/stdlib/source/test/lux/control/parser/environment.lux @@ -45,9 +45,9 @@ [property (random.ascii/alpha 1)] (_.cover [/.unknown_property] (case (/.result (/.property property) /.empty) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.unknown_property error)))) ))) diff --git a/stdlib/source/test/lux/control/parser/json.lux b/stdlib/source/test/lux/control/parser/json.lux index 1e440036e..ad35703ab 100644 --- a/stdlib/source/test/lux/control/parser/json.lux +++ b/stdlib/source/test/lux/control/parser/json.lux @@ -49,30 +49,30 @@ [expected (\ ! each (|>> #json.String) (random.unicode 1))] (_.cover [/.result /.any] (|> (/.result /.any expected) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ json.equivalence = expected actual)))))) (_.cover [/.null] (|> (/.result /.null #json.Null) - (!expect (#try.Success _)))) + (!expect {#try.Success _}))) (~~ (template [<query> <test> <check> <random> <json> <equivalence>] [(do [! random.monad] [expected <random> dummy (|> <random> (random.only (|>> (\ <equivalence> = expected) not)))] ($_ _.and (_.cover [<query>] - (|> (/.result <query> (<json> expected)) - (!expect (^multi (#try.Success actual) + (|> (/.result <query> {<json> expected}) + (!expect (^multi {#try.Success actual} (\ <equivalence> = expected actual))))) (_.cover [<test>] - (and (|> (/.result (<test> expected) (<json> expected)) - (!expect (#try.Success #1))) - (|> (/.result (<test> expected) (<json> dummy)) - (!expect (#try.Success #0))))) + (and (|> (/.result (<test> expected) {<json> expected}) + (!expect {#try.Success #1})) + (|> (/.result (<test> expected) {<json> dummy}) + (!expect {#try.Success #0})))) (_.cover [<check>] - (and (|> (/.result (<check> expected) (<json> expected)) - (!expect (#try.Success _))) - (|> (/.result (<check> expected) (<json> dummy)) - (!expect (#try.Failure _)))))))] + (and (|> (/.result (<check> expected) {<json> expected}) + (!expect {#try.Success _})) + (|> (/.result (<check> expected) {<json> dummy}) + (!expect {#try.Failure _}))))))] [/.boolean /.boolean? /.boolean! random.bit #json.Boolean bit.equivalence] [/.number /.number? /.number! ..safe_frac #json.Number frac.equivalence] @@ -82,25 +82,25 @@ [expected (random.unicode 1) dummy random.bit] (_.cover [/.unexpected_value] - (|> (/.result /.string (#json.Boolean dummy)) - (!expect (^multi (#try.Failure error) + (|> (/.result /.string {#json.Boolean dummy}) + (!expect (^multi {#try.Failure error} (exception.match? /.unexpected_value error)))))) (do [! random.monad] [expected (random.unicode 1) dummy (|> (random.unicode 1) (random.only (|>> (\ text.equivalence = expected) not)))] (_.cover [/.value_mismatch] - (|> (/.result (/.string! expected) (#json.String dummy)) - (!expect (^multi (#try.Failure error) + (|> (/.result (/.string! expected) {#json.String dummy}) + (!expect (^multi {#try.Failure error} (exception.match? /.value_mismatch error)))))) (do [! random.monad] [expected (random.unicode 1)] (_.cover [/.nullable] (and (|> (/.result (/.nullable /.string) #json.Null) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ (maybe.equivalence text.equivalence) = #.None actual)))) - (|> (/.result (/.nullable /.string) (#json.String expected)) - (!expect (^multi (#try.Success actual) - (\ (maybe.equivalence text.equivalence) = (#.Some expected) actual))))))) + (|> (/.result (/.nullable /.string) {#json.String expected}) + (!expect (^multi {#try.Success actual} + (\ (maybe.equivalence text.equivalence) = {#.Some expected} actual))))))) (do [! random.monad] [size (\ ! each (n.% 10) random.nat) expected (|> (random.unicode 1) @@ -108,18 +108,18 @@ (\ ! each row.of_list))] (_.cover [/.array] (|> (/.result (/.array (<>.some /.string)) - (#json.Array (row\each (|>> #json.String) expected))) - (!expect (^multi (#try.Success actual) + {#json.Array (row\each (|>> #json.String) expected)}) + (!expect (^multi {#try.Success actual} (\ (row.equivalence text.equivalence) = expected (row.of_list actual))))))) (do [! random.monad] [expected (\ ! each (|>> #json.String) (random.unicode 1))] (_.cover [/.unconsumed_input] - (|> (/.result (/.array /.any) (#json.Array (row expected expected))) - (!expect (^multi (#try.Failure error) + (|> (/.result (/.array /.any) {#json.Array (row expected expected)}) + (!expect (^multi {#try.Failure error} (exception.match? /.unconsumed_input error)))))) (_.cover [/.empty_input] - (|> (/.result (/.array /.any) (#json.Array (row))) - (!expect (^multi (#try.Failure error) + (|> (/.result (/.array /.any) {#json.Array (row)}) + (!expect (^multi {#try.Failure error} (exception.match? /.empty_input error))))) (do [! random.monad] [expected_boolean random.bit @@ -137,12 +137,12 @@ (/.field boolean_field /.boolean) (/.field number_field /.number) (/.field string_field /.string))) - (#json.Object + {#json.Object (dictionary.of_list text.hash - (list [boolean_field (#json.Boolean expected_boolean)] - [number_field (#json.Number expected_number)] - [string_field (#json.String expected_string)])))) - (!expect (^multi (#try.Success [actual_boolean actual_number actual_string]) + (list [boolean_field {#json.Boolean expected_boolean}] + [number_field {#json.Number expected_number}] + [string_field {#json.String expected_string}]))}) + (!expect (^multi {#try.Success [actual_boolean actual_number actual_string]} (and (\ bit.equivalence = expected_boolean actual_boolean) (\ frac.equivalence = expected_number actual_number) (\ text.equivalence = expected_string actual_string))))))) @@ -153,11 +153,11 @@ .let [expected (dictionary.of_list text.hash (list.zipped/2 keys values))]] (_.cover [/.dictionary] (|> (/.result (/.dictionary /.string) - (#json.Object + {#json.Object (|> values (list\each (|>> #json.String)) (list.zipped/2 keys) - (dictionary.of_list text.hash)))) - (!expect (^multi (#try.Success actual) + (dictionary.of_list text.hash))}) + (!expect (^multi {#try.Success actual} (\ (dictionary.equivalence text.equivalence) = expected actual)))))) )))) diff --git a/stdlib/source/test/lux/control/parser/synthesis.lux b/stdlib/source/test/lux/control/parser/synthesis.lux index 9068cad62..67906c0a1 100644 --- a/stdlib/source/test/lux/control/parser/synthesis.lux +++ b/stdlib/source/test/lux/control/parser/synthesis.lux @@ -68,13 +68,13 @@ ($_ _.and (_.cover [<query>] (|> (/.result <query> (list (<synthesis> expected))) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ <equivalence> = expected actual))))) (_.cover [<check>] (and (|> (/.result (<check> expected) (list (<synthesis> expected))) - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result (<check> expected) (list (<synthesis> dummy))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_parse error)))))) ))] @@ -102,14 +102,14 @@ (synthesis.i64 expected_i64) (synthesis.f64 expected_f64) (synthesis.text expected_text))))) - (!expect (^multi (#try.Success [actual_bit actual_i64 actual_f64 actual_text]) + (!expect (^multi {#try.Success [actual_bit actual_i64 actual_f64 actual_text]} (and (\ bit.equivalence = expected_bit actual_bit) (\ i64.equivalence = expected_i64 actual_i64) (\ frac.equivalence = expected_f64 actual_f64) (\ text.equivalence = expected_text actual_text))))) (|> (/.result (/.tuple ($_ <>.and /.bit /.i64 /.f64 /.text)) (list (synthesis.text expected_text))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_parse error))))))) (do [! random.monad] [arity random.nat @@ -118,14 +118,14 @@ (_.cover [/.function] (and (|> (/.result (/.function arity /.text) (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) - (!expect (^multi (#try.Success [actual_environment actual_body]) + (!expect (^multi {#try.Success [actual_environment actual_body]} (and (\ (list.equivalence synthesis.equivalence) = expected_environment actual_environment) (\ text.equivalence = expected_body actual_body))))) (|> (/.result (/.function arity /.text) (list (synthesis.text expected_body))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_parse error))))))) (do [! random.monad] [arity random.nat @@ -134,7 +134,7 @@ (_.cover [/.wrong_arity] (|> (/.result (/.function (++ arity) /.text) (list (synthesis.function/abstraction [expected_environment arity (synthesis.text expected_body)]))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.wrong_arity error)))))) (do [! random.monad] [arity (\ ! each (|>> (n.% 10) ++) random.nat) @@ -146,7 +146,7 @@ (list (synthesis.loop/scope [expected_offset (list\each (|>> synthesis.bit) expected_inits) (synthesis.text expected_body)]))) - (!expect (^multi (#try.Success [actual_offset actual_inits actual_body]) + (!expect (^multi {#try.Success [actual_offset actual_inits actual_body]} (and (\ n.equivalence = expected_offset actual_offset) (\ (list.equivalence bit.equivalence) = expected_inits @@ -154,7 +154,7 @@ (\ text.equivalence = expected_body actual_body))))) (|> (/.result (/.loop (<>.many /.bit) /.text) (list (synthesis.text expected_body))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_parse error))))))) )) @@ -167,33 +167,33 @@ [expected (\ ! each (|>> synthesis.i64) random.nat)] (_.cover [/.result /.any] (|> (/.result /.any (list expected)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ synthesis.equivalence = expected actual)))))) (_.cover [/.empty_input] (|> (/.result /.any (list)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.empty_input error))))) (do [! random.monad] [expected (\ ! each (|>> synthesis.i64) random.nat)] (_.cover [/.unconsumed_input] (|> (/.result /.any (list expected expected)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.unconsumed_input error)))))) (do [! random.monad] [dummy (\ ! each (|>> synthesis.i64) random.nat)] (_.cover [/.end! /.expected_empty_input] (and (|> (/.result /.end! (list)) - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result /.end! (list dummy)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.expected_empty_input error))))))) (do [! random.monad] [dummy (\ ! each (|>> synthesis.i64) random.nat)] (_.cover [/.end?] (and (|> (/.result /.end? (list)) - (!expect (#try.Success #1))) + (!expect {#try.Success #1})) (|> (/.result (<>.before /.any /.end?) (list dummy)) - (!expect (#try.Success #0)))))) + (!expect {#try.Success #0}))))) (_.for [/.cannot_parse] ($_ _.and ..simple diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index 05a28b1ff..8377f6b4b 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -42,7 +42,7 @@ (def: (should_fail' sample parser exception) (All (_ a e) (-> Text (/.Parser a) (Exception e) Bit)) (case (/.result parser sample) - (#try.Failure error) + {#try.Failure error} (exception.match? exception error) _ @@ -51,7 +51,7 @@ (def: (should_fail sample parser) (All (_ a) (-> Text (/.Parser a) Bit)) (case (/.result parser sample) - (#try.Failure _) + {#try.Failure _} true _ @@ -301,10 +301,10 @@ (_.cover [/.result /.end!] (and (|> (/.result /.end! "") - (!expect (#try.Success _))) + (!expect {#try.Success _})) (|> (/.result /.end! sample) - (!expect (#try.Failure _)))))) + (!expect {#try.Failure _}))))) (do [! random.monad] [.let [size 10] expected (random.unicode size) @@ -313,15 +313,15 @@ (_.cover [/.this /.cannot_match] (and (|> (/.result (/.this expected) expected) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.this expected) dummy) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_match error))))))) (_.cover [/.Slice /.slice /.cannot_slice] (|> "" (/.result (/.slice /.any!)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_slice error))))) (do [! random.monad] [expected (random.unicode 1)] @@ -337,14 +337,14 @@ (and (..should_pass expected (<>.before /.any /.next)) (|> "" (/.result (<>.before /.any /.next)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_parse error))))))) (do [! random.monad] [dummy (random.unicode 1)] (_.cover [/.unconsumed_input] (|> (format dummy dummy) (/.result /.any) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.unconsumed_input error)))))) (do [! random.monad] [sample (random.unicode 1)] @@ -355,7 +355,7 @@ _ /.any post /.offset] (in [pre post]))) - (!expect (#try.Success [0 1]))))) + (!expect {#try.Success [0 1]})))) (do [! random.monad] [left (random.unicode 1) right (random.unicode 1) @@ -369,7 +369,7 @@ _ /.any] (in (and (text\= input pre) (text\= right post))))) - (!expect (#try.Success #1))))) + (!expect {#try.Success #1})))) (do [! random.monad] [left (random.unicode 1) right (random.unicode 1) @@ -378,7 +378,7 @@ (_.cover [/.enclosed] (|> (format left expected right) (/.result (/.enclosed [left right] (/.this expected))) - (!expect (#try.Success _))))) + (!expect {#try.Success _})))) (do [! random.monad] [input (random.unicode 1) output (random.unicode 1)] @@ -387,13 +387,13 @@ (/.result (do <>.monad [_ (/.local input (/.this input))] (/.this output))) - (!expect (#try.Success _))))) + (!expect {#try.Success _})))) (do [! random.monad] [expected (\ ! each (|>> (n.% 8) (\ n.octal encoded)) random.nat)] (_.cover [/.then] (|> (list (code.text expected)) (<c>.result (/.then /.octal <c>.text)) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (text\= expected actual)))))) (do [! random.monad] [invalid (random.ascii/upper 1) @@ -405,13 +405,13 @@ (and (..should_pass (text.of_char expected) (/.not /.upper)) (|> invalid (/.result (/.not /.upper)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.expected_to_fail error)))) (..should_pass! (text.of_char expected) (/.not! upper!)) (|> invalid (/.result (/.not! upper!)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.expected_to_fail error))))))) (do [! random.monad] [upper (random.ascii/upper 1) diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux index 30fc3f5d1..d99273be5 100644 --- a/stdlib/source/test/lux/control/parser/tree.lux +++ b/stdlib/source/test/lux/control/parser/tree.lux @@ -34,7 +34,7 @@ (_.cover <coverage> (|> (/.result <parser> <sample>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual))))))]) (template: (!cover/2 <coverage> <parser> <sample0> <sample1>) @@ -43,10 +43,10 @@ expected (|> random.nat (random.only (|>> (n.= dummy) not)))] (_.cover <coverage> (and (|> (/.result <parser> <sample0>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual)))) (|> (/.result <parser> <sample1>) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual)))))))]) (def: .public test @@ -62,7 +62,7 @@ (_.cover [/.result'] (|> (/.result' /.value (zipper.zipper (tree.leaf expected))) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual)))))) (!cover [/.down] (do //.monad @@ -163,7 +163,7 @@ (`` (and (~~ (template [<parser>] [(|> (/.result <parser> (tree.leaf dummy)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.cannot_move_further error))))] [/.down] [/.up] diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux index 8b843dcdb..3d27819bd 100644 --- a/stdlib/source/test/lux/control/parser/type.lux +++ b/stdlib/source/test/lux/control/parser/type.lux @@ -32,7 +32,7 @@ (Random Type) (|> (random.ascii/alpha_num 1) (\ random.monad each (function (_ name) - (#.Primitive name (list)))))) + {#.Primitive name (list)})))) (def: matches Test @@ -44,29 +44,29 @@ ($_ _.and (_.cover [/.exactly] (and (|> (/.result (/.exactly expected) expected) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.exactly expected) dummy) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.types_do_not_match error)))))) (_.cover [/.sub] (and (|> (/.result (/.sub expected) expected) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.sub Any) expected) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.sub expected) Nothing) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.sub expected) dummy) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.types_do_not_match error)))))) (_.cover [/.super] (and (|> (/.result (/.super expected) expected) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.super expected) Any) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.super Nothing) expected) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.result (/.super expected) dummy) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.types_do_not_match error)))))) ))) @@ -81,13 +81,13 @@ [(_.cover [<parser> <exception>] (and (|> (/.result (<parser> ($_ //.and /.any /.any /.any)) (<good_constructor> (list expected_left expected_middle expected_right))) - (!expect (^multi (#try.Success [actual_left actual_middle actual_right]) + (!expect (^multi {#try.Success [actual_left actual_middle actual_right]} (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) (|> (/.result (<parser> ($_ //.and /.any /.any /.any)) (<bad_constructor> (list expected_left expected_middle expected_right))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? <exception> error))))))] [/.variant /.not_variant type.variant type.tuple] @@ -97,24 +97,24 @@ (_.cover [/.function /.not_function] (and (|> (/.result (/.function ($_ //.and /.any /.any) /.any) (type.function (list expected_left expected_middle) expected_right)) - (!expect (^multi (#try.Success [[actual_left actual_middle] actual_right]) + (!expect (^multi {#try.Success [[actual_left actual_middle] actual_right]} (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) (|> (/.result (/.function ($_ //.and /.any /.any) /.any) (type.variant (list expected_left expected_middle expected_right))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.not_function error)))))) (_.cover [/.applied /.not_application] (and (|> (/.result (/.applied ($_ //.and /.any /.any /.any)) (type.application (list expected_middle expected_right) expected_left)) - (!expect (^multi (#try.Success [actual_left actual_middle actual_right]) + (!expect (^multi {#try.Success [actual_left actual_middle actual_right]} (and (type\= expected_left actual_left) (type\= expected_middle actual_middle) (type\= expected_right actual_right))))) (|> (/.result (/.applied ($_ //.and /.any /.any /.any)) (type.variant (list expected_left expected_middle expected_right))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.not_application error)))))) )))) @@ -128,38 +128,38 @@ ($_ _.and (_.cover [/.not_parameter] (|> (/.result /.parameter not_parameter) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.not_parameter error))))) (_.cover [/.unknown_parameter] - (|> (/.result /.parameter (#.Parameter parameter)) - (!expect (^multi (#try.Failure error) + (|> (/.result /.parameter {#.Parameter parameter}) + (!expect (^multi {#try.Failure error} (exception.match? /.unknown_parameter error))))) (_.cover [/.with_extension] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) /.any) not_parameter) - (!expect (^multi (#try.Success [quantification\\binding argument\\binding actual]) + (!expect (^multi {#try.Success [quantification\\binding argument\\binding actual]} (same? not_parameter actual))))) (_.cover [/.parameter] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) /.parameter) - (#.Parameter 0)) - (!expect (#try.Success [quantification\\binding argument\\binding _])))) + {#.Parameter 0}) + (!expect {#try.Success [quantification\\binding argument\\binding _]}))) (_.cover [/.wrong_parameter] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) (/.parameter! 1)) - (#.Parameter 0)) - (!expect (^multi (#try.Failure error) + {#.Parameter 0}) + (!expect (^multi {#try.Failure error} (exception.match? /.wrong_parameter error))))) (_.cover [/.parameter!] (|> (/.result (<| (/.with_extension quantification) (/.with_extension argument) (/.parameter! 0)) - (#.Parameter 0)) - (!expect (#try.Success [quantification\\binding argument\\binding _])))) + {#.Parameter 0}) + (!expect {#try.Success [quantification\\binding argument\\binding _]}))) ))) (def: polymorphic @@ -171,16 +171,16 @@ (_.cover [/.not_polymorphic] (and (|> (/.result (/.polymorphic /.any) not_polymorphic) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.not_polymorphic error)))) (|> (/.result (/.polymorphic /.any) (type.univ_q 0 not_polymorphic)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.not_polymorphic error)))))) (_.cover [/.polymorphic] (|> (/.result (/.polymorphic /.any) (type.univ_q expected_inputs not_polymorphic)) - (!expect (^multi (#try.Success [g!poly actual_inputs bodyT]) + (!expect (^multi {#try.Success [g!poly actual_inputs bodyT]} (and (n.= expected_inputs (list.size actual_inputs)) (same? not_polymorphic bodyT)))))) ))) @@ -194,7 +194,7 @@ [expected ..primitive] (_.cover [/.result /.any] (|> (/.result /.any expected) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (type\= expected actual)))))) (do [! random.monad] [expected ..primitive] @@ -204,10 +204,10 @@ _ /.any] (in actual)) expected) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (type\= expected actual)))) (|> (/.result /.next expected) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.unconsumed_input error))))))) (do [! random.monad] [expected ..primitive] @@ -217,7 +217,7 @@ [_ /.any] <parser>) expected) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.empty_input error))))] [/.any] @@ -231,7 +231,7 @@ _ /.any] (in env)) expected) - (!expect (^multi (#try.Success environment) + (!expect (^multi {#try.Success environment} (same? /.fresh environment)))))) (do [! random.monad] [expected ..primitive @@ -243,14 +243,14 @@ (/.local (list expected) /.any)) dummy) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (type\= expected actual)))))) (do [! random.monad] [expected random.nat] (_.cover [/.existential /.not_existential] (|> (/.result /.existential - (#.Ex expected)) - (!expect (^multi (#try.Success actual) + {#.Ex expected}) + (!expect (^multi {#try.Success actual} (n.= expected actual)))))) (do [! random.monad] [expected_name (random.and (random.ascii/alpha_num 1) @@ -258,8 +258,8 @@ expected_type ..primitive] (_.cover [/.named /.not_named] (|> (/.result /.named - (#.Named expected_name expected_type)) - (!expect (^multi (#try.Success [actual_name actual_type]) + {#.Named expected_name expected_type}) + (!expect (^multi {#try.Success [actual_name actual_type]} (and (name\= expected_name actual_name) (type\= expected_type actual_type))))))) ..aggregate diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index b61b993a2..15c1fdd88 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -41,7 +41,7 @@ (_.cover [<exception>] (`` (and (~~ (template [<parser> <input>] [(|> (/.result <parser> (list <input>)) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? <exception> error))))] <<cases>>)))))))]) @@ -62,12 +62,12 @@ (do [! random.monad] [expected (random.ascii/alpha 1)] (_.cover [/.result /.text] - (|> (/.result /.text (list (#xml.Text expected))) - (!expect (^multi (#try.Success actual) + (|> (/.result /.text (list {#xml.Text expected})) + (!expect (^multi {#try.Success actual} (text\= expected actual)))))) (!failure /.unconsumed_inputs [[(//\in expected) - (#xml.Text expected)]]) + {#xml.Text expected}]]) (do [! random.monad] [expected (\ ! each (|>> #xml.Text) (random.ascii/alpha 1))] (_.cover [/.any] @@ -81,17 +81,17 @@ [actual /.tag _ /.any] (in (name\= expected actual))) - (list (#xml.Node expected (dictionary.empty name.hash) (list)))) - (!expect (#try.Success #1))))) + (list {#xml.Node expected (dictionary.empty name.hash) (list)})) + (!expect {#try.Success #1})))) (do [! random.monad] [expected ..random_tag] (_.cover [/.node] (|> (/.result (/.node expected (//\in [])) - (list (#xml.Node expected (dictionary.empty name.hash) (list)))) - (!expect (#try.Success []))))) + (list {#xml.Node expected (dictionary.empty name.hash) (list)})) + (!expect {#try.Success []})))) (!failure /.wrong_tag [[(/.node ["" expected] (//\in [])) - (#xml.Node [expected ""] (dictionary.empty name.hash) (list))]]) + {#xml.Node [expected ""] (dictionary.empty name.hash) (list)}]]) (do [! random.monad] [expected_tag ..random_tag expected_attribute ..random_attribute @@ -100,54 +100,54 @@ (|> (/.result (<| (/.node expected_tag) (//.after (/.attribute expected_attribute)) (//\in [])) - (list (#xml.Node expected_tag - (|> (dictionary.empty name.hash) - (dictionary.has expected_attribute expected_value)) - (list)))) - (!expect (#try.Success []))))) + (list {#xml.Node expected_tag + (|> (dictionary.empty name.hash) + (dictionary.has expected_attribute expected_value)) + (list)})) + (!expect {#try.Success []})))) (!failure /.unknown_attribute [[(/.attribute ["" expected]) - (#xml.Node [expected expected] - (|> (dictionary.empty name.hash) - (dictionary.has [expected ""] expected)) - (list))]]) + {#xml.Node [expected expected] + (|> (dictionary.empty name.hash) + (dictionary.has [expected ""] expected)) + (list)}]]) (!failure /.empty_input [[(do //.monad [_ /.any] /.any) - (#xml.Text expected)] + {#xml.Text expected}] [(do //.monad [_ /.any] /.text) - (#xml.Text expected)] + {#xml.Text expected}] [(do //.monad [_ /.any] (/.node [expected expected] (//\in []))) - (#xml.Node [expected expected] - (dictionary.empty name.hash) - (list))] + {#xml.Node [expected expected] + (dictionary.empty name.hash) + (list)}] [(do //.monad [_ /.any] (/.node [expected expected] (/.attribute [expected expected]))) - (#xml.Node [expected expected] - (|> (dictionary.empty name.hash) - (dictionary.has [expected expected] expected)) - (list))]]) + {#xml.Node [expected expected] + (|> (dictionary.empty name.hash) + (dictionary.has [expected expected] expected)) + (list)}]]) (!failure /.unexpected_input [[/.text - (#xml.Node [expected expected] (dictionary.empty name.hash) (list))] + {#xml.Node [expected expected] (dictionary.empty name.hash) (list)}] [(/.node [expected expected] (//\in [])) - (#xml.Text expected)] + {#xml.Text expected}] [(/.node [expected expected] (/.attribute [expected expected])) - (#xml.Text expected)]]) + {#xml.Text expected}]]) (do [! random.monad] [.let [node (: (-> xml.Tag (List xml.XML) xml.XML) (function (_ tag children) - (#xml.Node tag (dictionary.empty name.hash) children)))] + {#xml.Node tag (dictionary.empty name.hash) children}))] parent ..random_tag right ..random_tag wrong (random.only (|>> (name\= right) not) @@ -167,12 +167,12 @@ (list.together (list (list.repeated repetitions (node wrong (list))) (list (node right (list))) (list.repeated repetitions (node wrong (list)))))))) - (!expect (#try.Success [])))) + (!expect {#try.Success []}))) (_.cover [/.nowhere] (|> (/.result parser (list (node parent (list.repeated repetitions (node wrong (list)))))) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (exception.match? /.nowhere error))))) )) ))) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 6b4f5b55c..da88cb31e 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -33,19 +33,19 @@ (def: (success? result) (All (_ a) (-> (Try a) Bit)) (case result - (#try.Success _) + {#try.Success _} true - (#try.Failure _) + {#try.Failure _} false)) (def: (throws? exception result) (All (_ e a) (-> (Exception e) (Try a) Bit)) (case result - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? exception error))) (def: (injection value) @@ -53,7 +53,7 @@ (function (_ [region scope]) (function (_ !) [scope - (#try.Success value)]))) + {#try.Success value}]))) (def: comparison (Comparison (All (_ a) (All (_ ! r) (Region r (Thread !) a)))) @@ -70,7 +70,7 @@ (Try a) (thread.result (:expected (/.run! thread.monad right))))] - [(#try.Success left) (#try.Success right)] + [{#try.Success left} {#try.Success right}] (== left right) _ @@ -104,7 +104,7 @@ count_clean_up (function (_ value) (do ! [_ (thread.update! ++ clean_up_counter)] - (in (#try.Success []))))] + (in {#try.Success []})))] outcome (/.run! ! (do [! (/.monad !)] [_ (monad.each ! (/.acquire! //@ count_clean_up) @@ -122,7 +122,7 @@ count_clean_up (function (_ value) (do ! [_ (thread.update! ++ clean_up_counter)] - (in (#try.Success []))))] + (in {#try.Success []})))] outcome (/.run! ! (do [! (/.monad !)] [_ (monad.each ! (/.acquire! //@ count_clean_up) @@ -141,7 +141,7 @@ count_clean_up (function (_ value) (do ! [_ (thread.update! ++ clean_up_counter)] - (in (#try.Success []))))] + (in {#try.Success []})))] outcome (/.run! ! (do [! (/.monad !)] [_ (monad.each ! (/.acquire! //@ count_clean_up) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 680238ff9..3b210813d 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -39,17 +39,17 @@ (~ (code.text message)) (~+ (case focus #.None (list) - (#.Some focus) (list focus)))))) + {#.Some focus} (list focus)))))) (def: (attempt computation) (All (_ a) (-> (Meta a) (Meta (Try a)))) (function (_ compiler) (case (computation compiler) - (#try.Success [compiler output]) - (#try.Success [compiler (#try.Success output)]) + {#try.Success [compiler output]} + {#try.Success [compiler {#try.Success output}]} - (#try.Failure error) - (#try.Success [compiler (#try.Failure error)])))) + {#try.Failure error} + {#try.Success [compiler {#try.Failure error}]}))) (def: (test_failure deadline message focus failure) (-> Date Text (Maybe Code) Text Bit) @@ -59,7 +59,7 @@ #.None true - (#.Some focus) + {#.Some focus} (text.contains? (%.code focus) failure)))) (syntax: (test_macro [macro <code>.identifier @@ -74,31 +74,31 @@ expected (product.right (random.result prng ..focus))] (do meta.monad [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message #.None))) - should_fail1 (..attempt (macro.expansion (..memory macro yesterday message (#.Some expected)))) + should_fail1 (..attempt (macro.expansion (..memory macro yesterday message {#.Some expected}))) should_succeed0 (..attempt (macro.expansion (..memory macro tomorrow message #.None))) - should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message (#.Some expected))))] + should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message {#.Some expected})))] (in (list (code.bit (and (case should_fail0 - (#try.Failure error) + {#try.Failure error} (and (test_failure yesterday message #.None error) (text.contains? extra error)) _ false) (case should_fail1 - (#try.Failure error) - (and (test_failure yesterday message (#.Some expected) error) + {#try.Failure error} + (and (test_failure yesterday message {#.Some expected} error) (text.contains? extra error)) _ false) (case should_succeed0 - (^ (#try.Success (list))) + (^ {#try.Success (list)}) true _ false) (case should_succeed1 - (^ (#try.Success (list actual))) + (^ {#try.Success (list actual)}) (same? expected actual) _ @@ -116,8 +116,8 @@ (_.cover [/.must_remember] (and (test_failure deadline message #.None (exception.error /.must_remember [deadline deadline message #.None])) - (test_failure deadline message (#.Some focus) - (exception.error /.must_remember [deadline deadline message (#.Some focus)])))) + (test_failure deadline message {#.Some focus} + (exception.error /.must_remember [deadline deadline message {#.Some focus}])))) (_.cover [/.remember] (..test_macro /.remember "")) (_.cover [/.to_do] diff --git a/stdlib/source/test/lux/control/try.lux b/stdlib/source/test/lux/control/try.lux index 80b68423f..3e38574b2 100644 --- a/stdlib/source/test/lux/control/try.lux +++ b/stdlib/source/test/lux/control/try.lux @@ -57,28 +57,28 @@ (_.cover [/.trusted] (n.= expected - (/.trusted (#/.Success expected)))) + (/.trusted {#/.Success expected}))) (_.cover [/.of_maybe] - (case [(/.of_maybe (#.Some expected)) + (case [(/.of_maybe {#.Some expected}) (/.of_maybe #.None)] - [(#/.Success actual) (#/.Failure _)] + [{#/.Success actual} {#/.Failure _}] (n.= expected actual) _ false)) (_.cover [/.maybe] - (case [(/.maybe (#/.Success expected)) - (/.maybe (: (/.Try Nat) (#/.Failure error)))] - [(#.Some actual) #.None] + (case [(/.maybe {#/.Success expected}) + (/.maybe (: (/.Try Nat) {#/.Failure error}))] + [{#.Some actual} #.None] (n.= expected actual) _ false)) (_.cover [/.else] (and (n.= expected - (/.else alternative (#/.Success expected))) + (/.else alternative {#/.Success expected})) (n.= alternative - (/.else alternative (: (Try Nat) (#/.Failure error)))))) + (/.else alternative (: (Try Nat) {#/.Failure error}))))) (_.cover [/.with /.lifted] (let [lifted (/.lifted io.monad)] (|> (do (/.with io.monad) @@ -86,7 +86,7 @@ b (in alternative)] (in (n.+ a b))) io.run! - (case> (#/.Success result) + (case> {#/.Success result} (n.= (n.+ expected alternative) result) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 1fb97272c..d301efd1c 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -25,10 +25,10 @@ (def: (succeed result) (-> (Try Bit) Bit) (case result - (#try.Failure _) + {#try.Failure _} false - (#try.Success output) + {#try.Success output} output)) (def: .public (random size) @@ -45,10 +45,10 @@ (def: (throws? exception try) (All (_ e a) (-> (Exception e) (Try a) Bit)) (case try - (#try.Failure error) + {#try.Failure error} (exception.match? exception error) - (#try.Success _) + {#try.Success _} false)) (def: (binary_io power read write value) @@ -72,7 +72,7 @@ (def: as_list (-> /.Binary (List Nat)) (/.aggregate (function (_ head tail) - (#.Item head tail)) + {#.Item head tail}) (list))) (def: .public test @@ -123,7 +123,7 @@ (and (n.= length (/.size random_slice)) (case [(monad.each try.monad (|>> (n.+ offset) (reader sample)) idxs) (monad.each try.monad (reader random_slice) idxs)] - [(#try.Success binary_vals) (#try.Success slice_vals)] + [{#try.Success binary_vals} {#try.Success slice_vals}] (\ (list.equivalence n.equivalence) = binary_vals slice_vals) _ @@ -141,16 +141,16 @@ #.End false - (#.Item head tail) + {#.Item head tail} (n.= (list.mix n.+ 0 tail) (/.aggregate n.+ 0 (/.after 1 sample)))))) (_.cover [/.copy] (and (case (/.copy size 0 sample 0 (/.empty size)) - (#try.Success output) + {#try.Success output} (and (not (same? sample output)) (\ /.equivalence = sample output)) - (#try.Failure _) + {#try.Failure _} false) (succeed (do try.monad diff --git a/stdlib/source/test/lux/data/collection/array.lux b/stdlib/source/test/lux/data/collection/array.lux index 46783bc56..243d77203 100644 --- a/stdlib/source/test/lux/data/collection/array.lux +++ b/stdlib/source/test/lux/data/collection/array.lux @@ -65,9 +65,9 @@ (/.example+ (function (_ idx member) (n.even? member)) the_array)] - [(#.Some expected) (#.Some [idx actual])] + [{#.Some expected} {#.Some [idx actual]}] (case (/.read! idx the_array) - (#.Some again) + {#.Some again} (and (n.= expected actual) (n.= actual again)) @@ -109,7 +109,7 @@ (/.empty size))))) (_.cover [/.type_name] (case /.Array - (^ (#.Named _ (#.UnivQ _ (#.Primitive nominal_type (list (#.Parameter 1)))))) + (^ {#.Named _ {#.UnivQ _ {#.Primitive nominal_type (list {#.Parameter 1})}}}) (same? /.type_name nominal_type) _ @@ -120,7 +120,7 @@ (/.write! 0 expected))] (case [(/.read! 0 the_array) (/.read! 1 the_array)] - [(#.Some actual) #.None] + [{#.Some actual} #.None] (n.= expected actual) _ @@ -131,7 +131,7 @@ (/.write! 0 expected))] (case [(/.read! 0 the_array) (/.read! 0 (/.delete! 0 the_array))] - [(#.Some actual) #.None] + [{#.Some actual} #.None] (n.= expected actual) _ @@ -149,7 +149,7 @@ (/.write! 0 base) (/.update! 0 (n.+ shift)))] (case (/.read! 0 the_array) - (#.Some actual) + {#.Some actual} (n.= expected actual) _ @@ -162,7 +162,7 @@ (/.upsert! 1 base (n.+ shift)))] (case [(/.read! 0 the_array) (/.read! 1 the_array)] - [(#.Some actual/0) (#.Some actual/1)] + [{#.Some actual/0} {#.Some actual/1}] (and (n.= expected actual/0) (n.= expected actual/1)) @@ -199,7 +199,7 @@ (list.every? (function (_ value) (or (n.even? value) (same? default value))) - (/.list (#.Some default) the_array)))))) + (/.list {#.Some default} the_array)))))) (do ! [amount (\ ! each (n.% (++ size)) random.nat)] (_.cover [/.copy!] diff --git a/stdlib/source/test/lux/data/collection/dictionary.lux b/stdlib/source/test/lux/data/collection/dictionary.lux index 788f6c3eb..2f8a58bfc 100644 --- a/stdlib/source/test/lux/data/collection/dictionary.lux +++ b/stdlib/source/test/lux/data/collection/dictionary.lux @@ -147,39 +147,39 @@ (_.cover [/.value] (and (list.every? (function (_ key) (case (/.value key dict) - (#.Some _) true + {#.Some _} true _ false)) (/.keys dict)) (case (/.value non_key dict) - (#.Some _) false + {#.Some _} false _ true))) (_.cover [/.has] (and (n.= (++ (/.size dict)) (/.size (/.has non_key test_val dict))) (case (/.value non_key (/.has non_key test_val dict)) - (#.Some v) (n.= test_val v) + {#.Some v} (n.= test_val v) _ true))) (_.cover [/.has' /.key_already_exists] (let [can_put_new_keys! (case (/.has' non_key test_val dict) - (#try.Success dict) + {#try.Success dict} (case (/.value non_key dict) - (#.Some v) (n.= test_val v) + {#.Some v} (n.= test_val v) _ true) - (#try.Failure _) + {#try.Failure _} false) cannot_put_old_keys! (or (n.= 0 size) (let [first_key (|> dict /.keys list.head maybe.trusted)] (case (/.has' first_key test_val dict) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.key_already_exists error))))] (and can_put_new_keys! cannot_put_old_keys!))) @@ -192,7 +192,7 @@ #.None true - (#.Some known_key) + {#.Some known_key} (n.= (-- (/.size dict)) (/.size (/.lacks known_key dict)))))) @@ -200,7 +200,7 @@ (let [base (/.has non_key test_val dict) updt (/.revised non_key ++ base)] (case [(/.value non_key base) (/.value non_key updt)] - [(#.Some x) (#.Some y)] + [{#.Some x} {#.Some y}] (n.= (++ x) y) _ @@ -209,7 +209,7 @@ (_.cover [/.revised'] (let [can_upsert_new_key! (case (/.value non_key (/.revised' non_key test_val ++ dict)) - (#.Some inserted) + {#.Some inserted} (n.= (++ test_val) inserted) #.None @@ -220,9 +220,9 @@ #.None true - (#.Some [known_key known_value]) + {#.Some [known_key known_value]} (case (/.value known_key (/.revised' known_key test_val ++ dict)) - (#.Some updated) + {#.Some updated} (n.= (++ known_value) updated) #.None diff --git a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux index 65bb6226d..94dd0e61d 100644 --- a/stdlib/source/test/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/test/lux/data/collection/dictionary/ordered.lux @@ -78,7 +78,7 @@ [#.None #.None] #1 - [(#.Some reference) (#.Some sample)] + [{#.Some reference} {#.Some sample}] (n.= reference sample) _ @@ -88,7 +88,7 @@ [#.None #.None] #1 - [(#.Some reference) (#.Some sample)] + [{#.Some reference} {#.Some sample}] (n.= reference sample) _ @@ -117,7 +117,7 @@ (let [sample+ (/.has extra_key extra_value sample)] (case [(/.value extra_key sample) (/.value extra_key sample+)] - [#.None (#.Some actual)] + [#.None {#.Some actual}] (n.= extra_value actual) _ diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index e4776e1ab..b2411ce74 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -168,7 +168,7 @@ (_.cover [/.item] (/.every? (function (_ [index expected]) (case (/.item index sample) - (#.Some actual) + {#.Some actual} (n.= expected actual) #.None @@ -238,7 +238,7 @@ [($_ _.and (_.cover [<head>] (case [(<pre> sample) (<head> sample)] - [(#.Item expected _) (#.Some actual)] + [{#.Item expected _} {#.Some actual}] (n.= expected actual) [#.End #.None] @@ -248,7 +248,7 @@ false)) (_.cover [<tail>] (case [(<pre> sample) (<tail> sample)] - [(#.Item _ expected) (#.Some actual)] + [{#.Item _ expected} {#.Some actual}] (/\= (<pre> expected) actual) [#.End #.None] @@ -355,7 +355,7 @@ choose (: (-> Nat (Maybe Text)) (function (_ value) (if (n.even? value) - (#.Some (\ n.decimal encoded value)) + {#.Some (\ n.decimal encoded value)} #.None)))] (do [! random.monad] [sample ..random] @@ -366,7 +366,7 @@ (/\each (\ n.decimal encoded)) /.head) (/.one choose sample)] - [(#.Some expected) (#.Some actual)] + [{#.Some expected} {#.Some actual}] (text\= expected actual) [#.None #.None] @@ -382,7 +382,7 @@ (/.all choose sample))) (_.cover [/.example] (case (/.example n.even? sample) - (#.Some found) + {#.Some found} (n.even? found) #.None @@ -419,7 +419,7 @@ (/\= (/.indices size) (/.iterations (function (_ index) (if (n.< size index) - (#.Some (++ index)) + {#.Some (++ index)} #.None)) 0))))) (_.cover [/.mixes] diff --git a/stdlib/source/test/lux/data/collection/queue.lux b/stdlib/source/test/lux/data/collection/queue.lux index 117617468..795806329 100644 --- a/stdlib/source/test/lux/data/collection/queue.lux +++ b/stdlib/source/test/lux/data/collection/queue.lux @@ -60,7 +60,7 @@ all_empty_queues_look_the_same!))) (_.cover [/.front] (case [members (/.front sample)] - [(#.Item head tail) (#.Some first)] + [{#.Item head tail} {#.Some first}] (n.= head first) [#.End #.None] @@ -95,7 +95,7 @@ has_expected_order!))) (_.cover [/.next] (case members - (#.Item target expected) + {#.Item target expected} (let [popped (/.next sample) size_decreases! diff --git a/stdlib/source/test/lux/data/collection/queue/priority.lux b/stdlib/source/test/lux/data/collection/queue/priority.lux index 0ce7111f6..6ec5cb958 100644 --- a/stdlib/source/test/lux/data/collection/queue/priority.lux +++ b/stdlib/source/test/lux/data/collection/queue/priority.lux @@ -49,14 +49,14 @@ (/.empty? /.empty)) (_.cover [/.front] (case (/.front sample) - (#.Some first) + {#.Some first} (n.> 0 (/.size sample)) #.None (/.empty? sample))) (_.cover [/.member?] (case (/.front sample) - (#.Some first) + {#.Some first} (/.member? n.equivalence sample first) #.None diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index fa4f7271f..684619006 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -93,10 +93,10 @@ ($_ _.and (_.cover [/.item] (case (/.item good_index sample) - (#try.Success member) + {#try.Success member} (/.member? n.equivalence sample member) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.has] (<| (try.else false) @@ -118,10 +118,10 @@ (let [fails! (: (All (_ a) (-> (Try a) Bit)) (function (_ situation) (case situation - (#try.Success member) + {#try.Success member} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.index_out_of_bounds error))))] (and (fails! (/.item bad_index sample)) (fails! (/.has bad_index non_member sample)) diff --git a/stdlib/source/test/lux/data/collection/set/ordered.lux b/stdlib/source/test/lux/data/collection/set/ordered.lux index b89bad1bb..89ad780c7 100644 --- a/stdlib/source/test/lux/data/collection/set/ordered.lux +++ b/stdlib/source/test/lux/data/collection/set/ordered.lux @@ -74,7 +74,7 @@ (~~ (template [<coverage> <comparison>] [(_.cover [<coverage>] (case (<coverage> setL) - (#.Some value) + {#.Some value} (|> setL /.list (list.every? (<comparison> value))) #.None diff --git a/stdlib/source/test/lux/data/collection/stack.lux b/stdlib/source/test/lux/data/collection/stack.lux index eb05c1e67..928dc475a 100644 --- a/stdlib/source/test/lux/data/collection/stack.lux +++ b/stdlib/source/test/lux/data/collection/stack.lux @@ -48,20 +48,20 @@ #.None (/.empty? sample) - (#.Some _) + {#.Some _} (not (/.empty? sample)))) (_.cover [/.next] (case (/.next sample) #.None (/.empty? sample) - (#.Some [top remaining]) + {#.Some [top remaining]} (\ (/.equivalence n.equivalence) = sample (/.top top remaining)))) (_.cover [/.top] (case (/.next (/.top expected_top sample)) - (#.Some [actual_top actual_sample]) + {#.Some [actual_top actual_sample]} (and (same? expected_top actual_top) (same? sample actual_sample)) diff --git a/stdlib/source/test/lux/data/collection/tree/finger.lux b/stdlib/source/test/lux/data/collection/tree/finger.lux index a929dbaa5..c067ba36c 100644 --- a/stdlib/source/test/lux/data/collection/tree/finger.lux +++ b/stdlib/source/test/lux/data/collection/tree/finger.lux @@ -51,21 +51,21 @@ (\ ..builder leaf tag_right expected_right)))))) (_.cover [/.root] (and (case (/.root (\ ..builder leaf tag_left expected_left)) - (#.Left actual) + {#.Left actual} (n.= expected_left actual) - (#.Right _) + {#.Right _} false) (case (/.root (\ ..builder branch (\ ..builder leaf tag_left expected_left) (\ ..builder leaf tag_right expected_right))) - (#.Left _) + {#.Left _} false - (#.Right [left right]) + {#.Right [left right]} (case [(/.root left) (/.root right)] - [(#.Left actual_left) (#.Left actual_right)] + [{#.Left actual_left} {#.Left actual_right}] (and (n.= expected_left actual_left) (n.= expected_right actual_right)) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 82faaba7f..1e5015f46 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -96,12 +96,12 @@ ($_ _.and (_.cover [/.object /.fields] (case (/.fields object) - (#try.Success actual) + {#try.Success actual} (\ (list.equivalence text.equivalence) = (list\each product.left expected) actual) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.field] (list.every? (function (_ [key expected]) @@ -118,19 +118,19 @@ (_.cover [/.has] (<| (try.else false) (do try.monad - [object (/.has key (#/.Number expected) (/.object (list))) + [object (/.has key {#/.Number expected} (/.object (list))) .let [can_find_known_key! (|> object (/.field key) - (try\each (\= (#/.Number expected))) + (try\each (\= {#/.Number expected})) (try.else false)) cannot_find_unknown_key! (case (/.field unknown object) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} true)]] (in (and can_find_known_key! cannot_find_unknown_key!)))))) @@ -139,7 +139,7 @@ [key (random.ascii/alpha 1) value <random>] (_.cover [<type> <field>] - (|> (/.object (list [key (<tag> value)])) + (|> (/.object (list [key {<tag> value}])) (<field> key) (try\each (\ <equivalence> = value)) (try.else false))))] @@ -154,9 +154,9 @@ <number> (number) <string> (string) <array_row> (row.row #/.Null - (#/.Boolean <boolean>) - (#/.Number <number>) - (#/.String <string>)) + {#/.Boolean <boolean>} + {#/.Number <number>} + {#/.String <string>}) <key0> (string) <key1> (string) <key2> (string) @@ -167,13 +167,13 @@ (_.cover [/.json] (and (\= #/.Null (/.json #null)) (~~ (template [<tag> <value>] - [(\= (<tag> <value>) (/.json <value>))] + [(\= {<tag> <value>} (/.json <value>))] [#/.Boolean <boolean>] [#/.Number <number>] [#/.String <string>] )) - (\= (#/.Array <array_row>) (/.json [#null <boolean> <number> <string>])) + (\= {#/.Array <array_row>} (/.json [#null <boolean> <number> <string>])) (let [object (/.json {<key0> #null <key1> <boolean> <key2> <number> @@ -190,10 +190,10 @@ value5 (/.field <key5> object) value6 (/.field <key6> value5)] (in (and (\= #/.Null value0) - (\= (#/.Boolean <boolean>) value1) - (\= (#/.Number <number>) value2) - (\= (#/.String <string>) value3) - (\= (#/.Array <array_row>) value4) - (\= (#/.Number <number>) value6)))))) + (\= {#/.Boolean <boolean>} value1) + (\= {#/.Number <number>} value2) + (\= {#/.String <string>} value3) + (\= {#/.Array <array_row>} value4) + (\= {#/.Number <number>} value6)))))) ))) )))) diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index d595955b1..835ce822e 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -47,27 +47,27 @@ (`` ($_ _.and (_.cover [/.path /.from_path] (case (/.path expected) - (#try.Success actual) + {#try.Success actual} (text\= expected (/.from_path actual)) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.no_path] (text\= "" (/.from_path /.no_path))) (_.cover [/.path_size /.path_is_too_long] (case (/.path invalid) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.path_is_too_long error))) (_.cover [/.not_ascii] (case (/.path not_ascii) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_ascii error))) ))))) @@ -82,25 +82,25 @@ (`` ($_ _.and (_.cover [/.name /.from_name] (case (/.name expected) - (#try.Success actual) + {#try.Success actual} (text\= expected (/.from_name actual)) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.name_size /.name_is_too_long] (case (/.name invalid) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.name_is_too_long error))) (_.cover [/.not_ascii] (case (/.name not_ascii) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_ascii error))) ))))) @@ -113,18 +113,18 @@ (`` ($_ _.and (_.cover [/.small /.from_small] (case (/.small expected) - (#try.Success actual) + {#try.Success actual} (n.= expected (/.from_small actual)) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.small_limit /.not_a_small_number] (case (/.small invalid) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_a_small_number error))) ))))) @@ -137,18 +137,18 @@ (`` ($_ _.and (_.cover [/.big /.from_big] (case (/.big expected) - (#try.Success actual) + {#try.Success actual} (n.= expected (/.from_big actual)) - (#try.Failure error) + {#try.Failure error} false)) (_.cover [/.big_limit /.not_a_big_number] (case (/.big invalid) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_a_big_number error))) ))))) @@ -171,11 +171,11 @@ [(_.cover [<type>] (|> (do try.monad [expected_path (/.path expected_path) - tar (|> (row.row (<tag> expected_path)) + tar (|> (row.row {<tag> expected_path}) (format.result /.writer) (<b>.result /.parser))] (in (case (row.list tar) - (^ (list (<tag> actual_path))) + (^ (list {<tag> actual_path})) (text\= (/.from_path expected_path) (/.from_path actual_path)) @@ -193,18 +193,18 @@ (|> (do try.monad [expected_path (/.path expected_path) expected_content (/.content content) - tar (|> (row.row (<tag> [expected_path + tar (|> (row.row {<tag> [expected_path expected_moment /.none [#/.user [#/.name /.anonymous #/.id /.no_id] #/.group [#/.name /.anonymous #/.id /.no_id]] - expected_content])) + expected_content]}) (format.result /.writer) (<b>.result /.parser))] (in (case (row.list tar) - (^ (list (<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]))) + (^ (list {<tag> [actual_path actual_moment actual_mode actual_ownership actual_content]})) (let [seconds (: (-> Instant Int) (|>> instant.relative (duration.ticks duration.second)))] (and (text\= (/.from_path expected_path) @@ -251,18 +251,18 @@ (|> (do try.monad [path (/.path path) content (/.content (binary.empty 0)) - tar (|> (row.row (#/.Normal [path + tar (|> (row.row {#/.Normal [path (instant.of_millis +0) expected_mode [#/.user [#/.name /.anonymous #/.id /.no_id] #/.group [#/.name /.anonymous #/.id /.no_id]] - content])) + content]}) (format.result /.writer) (<b>.result /.parser))] (in (case (row.list tar) - (^ (list (#/.Normal [_ _ actual_mode _ _]))) + (^ (list {#/.Normal [_ _ actual_mode _ _]})) (n.= (/.mode expected_mode) (/.mode actual_mode)) @@ -274,18 +274,18 @@ (|> (do try.monad [path (/.path path) content (/.content (binary.empty 0)) - tar (|> (row.row (#/.Normal [path + tar (|> (row.row {#/.Normal [path (instant.of_millis +0) <expected_mode> [#/.user [#/.name /.anonymous #/.id /.no_id] #/.group [#/.name /.anonymous #/.id /.no_id]] - content])) + content]}) (format.result /.writer) (<b>.result /.parser))] (in (case (row.list tar) - (^ (list (#/.Normal [_ _ actual_mode _ _]))) + (^ (list {#/.Normal [_ _ actual_mode _ _]})) (n.= (/.mode <expected_mode>) (/.mode actual_mode)) @@ -324,35 +324,35 @@ ($_ _.and (_.cover [/.name_size /.name_is_too_long] (case (/.name invalid) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.name_is_too_long error))) (_.cover [/.not_ascii] (case (/.name not_ascii) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_ascii error))) (_.cover [/.Name /.name /.from_name] (|> (do try.monad [path (/.path path) content (/.content (binary.empty 0)) expected (/.name expected) - tar (|> (row.row (#/.Normal [path + tar (|> (row.row {#/.Normal [path (instant.of_millis +0) /.none [#/.user [#/.name expected #/.id /.no_id] #/.group [#/.name /.anonymous #/.id /.no_id]] - content])) + content]}) (format.result /.writer) (<b>.result /.parser))] (in (case (row.list tar) - (^ (list (#/.Normal [_ _ _ actual_ownership _]))) + (^ (list {#/.Normal [_ _ _ actual_ownership _]})) (and (text\= (/.from_name expected) (/.from_name (value@ [#/.user #/.name] actual_ownership))) (text\= (/.from_name /.anonymous) @@ -365,18 +365,18 @@ (|> (do try.monad [path (/.path path) content (/.content (binary.empty 0)) - tar (|> (row.row (#/.Normal [path + tar (|> (row.row {#/.Normal [path (instant.of_millis +0) /.none [#/.user [#/.name /.anonymous #/.id /.no_id] #/.group [#/.name /.anonymous #/.id /.no_id]] - content])) + content]}) (format.result /.writer) (<b>.result /.parser))] (in (case (row.list tar) - (^ (list (#/.Normal [_ _ _ actual_ownership _]))) + (^ (list {#/.Normal [_ _ _ actual_ownership _]})) (and (text\= (/.from_name /.anonymous) (/.from_name (value@ [#/.user #/.name] actual_ownership))) (n.= (/.from_small /.no_id) @@ -407,10 +407,10 @@ (_.cover [/.invalid_end_of_archive] (let [dump (format.result /.writer row.empty)] (case (<b>.result /.parser (binary\composite dump dump)) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_end_of_archive error)))) ..path diff --git a/stdlib/source/test/lux/data/sum.lux b/stdlib/source/test/lux/data/sum.lux index c0fae2333..bc1d9c70c 100644 --- a/stdlib/source/test/lux/data/sum.lux +++ b/stdlib/source/test/lux/data/sum.lux @@ -37,19 +37,19 @@ (_.cover [/.hash] (let [hash (/.hash i.hash n.hash)] (and (n.= (\ i.hash hash left) - (\ hash hash (#.Left left))) + (\ hash hash {#.Left left})) (n.= (\ n.hash hash right) - (\ hash hash (#.Right right))))))) + (\ hash hash {#.Right right})))))) (_.cover [/.left] (|> (/.left expected) (: (Or Nat Nat)) - (case> (0 #0 actual) (n.= expected actual) + (case> {0 #0 actual} (n.= expected actual) _ false))) (_.cover [/.right] (|> (/.right expected) (: (Or Nat Nat)) - (case> (0 #1 actual) (n.= expected actual) + (case> {0 #1 actual} (n.= expected actual) _ false))) (_.cover [/.either] (and (|> (/.left expected) @@ -64,11 +64,11 @@ (and (|> (/.left expected) (: (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) - (case> (0 #0 actual) (n.= (n.+ shift expected) actual) _ false)) + (case> {0 #0 actual} (n.= (n.+ shift expected) actual) _ false)) (|> (/.right expected) (: (Or Nat Nat)) (/.then (n.+ shift) (n.- shift)) - (case> (0 #1 actual) (n.= (n.- shift expected) actual) _ false)))) + (case> {0 #1 actual} (n.= (n.- shift expected) actual) _ false)))) (do ! [size (\ ! each (n.% 5) random.nat) expected (random.list size random.nat)] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index ea5bfce13..305268a0b 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -152,9 +152,9 @@ expected (\ ! each (n.% size) random.nat)] (_.cover [/.char] (case (/.char expected sample) - (#.Some char) + {#.Some char} (case (/.index (/.of_char char) sample) - (#.Some actual) + {#.Some actual} (n.= expected actual) _ @@ -210,7 +210,7 @@ (/.replaced/1 pre post (\ /.monoid composite pre static)))) (_.cover [/.split_by] (case (/.split_by static ($_ (\ /.monoid composite) pre static post)) - (#.Some [left right]) + {#.Some [left right]} (and (\ /.equivalence = pre left) (\ /.equivalence = post right)) @@ -290,7 +290,7 @@ ($_ _.and (_.cover [/.split_at] (|> (/.split_at sizeL sample) - (case> (#.Right [_l _r]) + (case> {#.Right [_l _r]} (and (/\= sampleL _l) (/\= sampleR _r) (/\= sample (/.together (list _l _r)))) @@ -302,7 +302,7 @@ (/.clip sizeL (n.- sizeL (/.size sample)) sample) (/.clip_since sizeL sample) (/.clip_since 0 sample)] - (case> [(#.Right _l) (#.Right _r) (#.Right _r') (#.Right _f)] + (case> [{#.Right _l} {#.Right _r} {#.Right _r'} {#.Right _f}] (and (/\= sampleL _l) (/\= sampleR _r) (/\= _r _r') diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 43242b1cf..6a658d960 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -105,11 +105,11 @@ (/.escapable? right)) (let [escaped (/.escaped expected)] (case (/.un_escaped escaped) - (#try.Success un_escaped) + {#try.Success un_escaped} (and (not (text\= escaped expected)) (text\= un_escaped expected)) - (#try.Failure error) + {#try.Failure error} false)) (text\= expected (/.escaped expected)))))) (do [! random.monad] @@ -117,10 +117,10 @@ (\ ! each text.of_char))] (_.cover [/.dangling_escape] (case (/.un_escaped (format (/.escaped dummy) "\")) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.dangling_escape error)))) (do [! random.monad] [dummy (|> (random.char unicode.character) @@ -128,10 +128,10 @@ (\ ! each text.of_char))] (_.cover [/.invalid_escape] (case (/.un_escaped (format "\" dummy)) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_escape error)))) (do [! random.monad] [too_short (|> (random.char unicode.character) @@ -139,15 +139,15 @@ code (|> (random.unicode 4) (random.only (function (_ code) (case (\ n.hex decoded code) - (#try.Failure error) true - (#try.Success _) false))))] + {#try.Failure error} true + {#try.Success _} false))))] (_.cover [/.invalid_unicode_escape] (template.let [(!invalid <code>) [(case (/.un_escaped (format "\u" <code>)) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_unicode_escape error))]] (and (!invalid (\ n.hex encoded too_short)) (!invalid code))))) diff --git a/stdlib/source/test/lux/data/text/format.lux b/stdlib/source/test/lux/data/text/format.lux index 141705e33..ddd4d0afb 100644 --- a/stdlib/source/test/lux/data/text/format.lux +++ b/stdlib/source/test/lux/data/text/format.lux @@ -170,7 +170,7 @@ #.None true - (#.Some value) + {#.Some value} (text.contains? (/.nat value) (/.maybe /.nat sample))))) (do [! random.monad] diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index b77909f5a..554a47eff 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -26,7 +26,7 @@ (-> (Parser Text) Text Bit) (|> input (<text>.result regex) - (case> (#try.Success parsed) + (case> {#try.Success parsed} (text\= parsed input) _ @@ -36,7 +36,7 @@ (-> Text (Parser Text) Text Bit) (|> input (<text>.result regex) - (case> (#try.Success parsed) + (case> {#try.Success parsed} (text\= test parsed) _ @@ -46,7 +46,7 @@ (All (_ a) (-> (Parser a) Text Bit)) (|> input (<text>.result regex) - (case> (#try.Failure _) + (case> {#try.Failure _} true _ @@ -58,7 +58,7 @@ (macro.with_identifiers [g!message g!_] (in (list (` (|> (~ input) (<text>.result (~ regex)) - (case> (^ (#try.Success (~ pattern))) + (case> (^ {#try.Success (~ pattern)}) true (~ g!_) @@ -259,27 +259,27 @@ Test ($_ _.and (_.test "Can specify alternative patterns." - (and (should_check ["a" (0 #0 [])] (/.regex "a|b") "a") - (should_check ["b" (0 #1 [])] (/.regex "a|b") "b") + (and (should_check ["a" {0 #0 []}] (/.regex "a|b") "a") + (should_check ["b" {0 #1 []}] (/.regex "a|b") "b") (should_fail (/.regex "a|b") "c"))) (_.test "Can have groups within alternations." - (and (should_check ["abc" (0 #0 ["b" "c"])] (/.regex "a(.)(.)|b(.)(.)") "abc") - (should_check ["bcd" (0 #1 ["c" "d"])] (/.regex "a(.)(.)|b(.)(.)") "bcd") + (and (should_check ["abc" {0 #0 ["b" "c"]}] (/.regex "a(.)(.)|b(.)(.)") "abc") + (should_check ["bcd" {0 #1 ["c" "d"]}] (/.regex "a(.)(.)|b(.)(.)") "bcd") (should_fail (/.regex "a(.)(.)|b(.)(.)") "cde") - (should_check ["123-456-7890" (0 #0 ["123" "456-7890" "456" "7890"])] + (should_check ["123-456-7890" {0 #0 ["123" "456-7890" "456" "7890"]}] (/.regex "(\d{3})-((\d{3})-(\d{4}))|b(.)d") "123-456-7890"))) )) (syntax: (expands? [form <code>.any]) (function (_ lux) - (#try.Success [lux (list (code.bit (case (macro.single_expansion form lux) - (#try.Success _) + {#try.Success [lux (list (code.bit (case (macro.single_expansion form lux) + {#try.Success _} true - (#try.Failure error) - false)))]))) + {#try.Failure error} + false)))]})) (def: .public test Test diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index fbd5a9b12..80f78b281 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -78,14 +78,14 @@ sample_frac random.frac] (in (`` (and (case (/.representation (type [Bit Int Frac]) [sample_bit sample_int sample_frac]) - (#try.Success actual) + {#try.Success actual} (text\= (format "[" (%.bit sample_bit) " " (%.int sample_int) " " (%.frac sample_frac) "]") actual) - (#try.Failure error) + {#try.Failure error} false) ... TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants ... (~~ (template [<lefts> <right?> <value> <format>] @@ -179,16 +179,16 @@ (try\each (text\= (%.maybe %.nat <sample>))) (try.else false))] - [(#.Some sample_nat)] + [{#.Some sample_nat}] [#.None] )) ))) (_.cover [/.cannot_represent_value] (case (/.representation (-> Nat Nat) (|>>)) - (#try.Success representation) + {#try.Success representation} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_represent_value error))) ))) @@ -219,11 +219,11 @@ (syntax: (macro_error [macro <code>.any]) (function (_ compiler) (case ((macro.expansion macro) compiler) - (#try.Failure error) - (#try.Success [compiler (list (code.text error))]) + {#try.Failure error} + {#try.Success [compiler (list (code.text error))]} - (#try.Success _) - (#try.Failure "OOPS!")))) + {#try.Success _} + {#try.Failure "OOPS!"}))) (type: My_Text Text) diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 0fd8ffff1..d4979d44e 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -22,12 +22,12 @@ (syntax: (macro_error [macro <code>.any]) (function (_ compiler) - (#try.Success [compiler (list (code.bit (case ((macro.expansion macro) compiler) - (#try.Failure error) + {#try.Success [compiler (list (code.bit (case ((macro.expansion macro) compiler) + {#try.Failure error} true - (#try.Success _) - false)))]))) + {#try.Success _} + false)))]})) (syntax: (description []) (\ meta.monad each diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 52994d6a1..6076ca6ee 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -64,7 +64,7 @@ (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (\ ! each (|>> (#analysis.Extension self)))))) + (\ ! each (|>> {#analysis.Extension self}))))) (synthesis: (..my_synthesis self phase archive [pass_through <analysis>.any]) (phase archive pass_through)) @@ -74,13 +74,13 @@ (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (\ ! each (|>> (#analysis.Extension self)))))) + (\ ! each (|>> {#analysis.Extension self}))))) (synthesis: (..my_generation self phase archive [parameters (<>.some <analysis>.any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) - (\ ! each (|>> (#synthesis.Extension self)))))) + (\ ! each (|>> {#synthesis.Extension self}))))) (generation: (..my_generation self phase archive [pass_through <synthesis>.any]) (for [@.jvm @@ -89,15 +89,15 @@ (phase archive pass_through))) (analysis: (..dummy_generation self phase archive []) - (\ phase.monad in (#analysis.Extension self (list)))) + (\ phase.monad in {#analysis.Extension self (list)})) (synthesis: (..dummy_generation self phase archive []) - (\ phase.monad in (#synthesis.Extension self (list)))) + (\ phase.monad in {#synthesis.Extension self (list)})) (generation: (..dummy_generation self phase archive []) (\ phase.monad in (for [@.jvm - (row.row (#jvm.Constant (#jvm.LDC (#jvm.String self)))) + (row.row {#jvm.Constant {#jvm.LDC {#jvm.String self}}}) @.js (js.string self) @.python (python.unicode self) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 431e72641..0e5933bbb 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -62,11 +62,11 @@ (function (_ lux) (|> (macro.single_expansion expression) (meta.result lux) - (case> (#try.Success expansion) - (#try.Failure "OOPS!") + (case> {#try.Success expansion} + {#try.Failure "OOPS!"} - (#try.Failure error) - (#try.Success [lux (list (code.text error))]))))) + {#try.Failure error} + {#try.Success [lux (list (code.text error))]})))) (def: for_conversions Test @@ -150,10 +150,10 @@ (random.ascii 1))] ($_ _.and (_.cover [/.check] - (and (case (/.check java/lang/String sample) (#.Some _) true #.None false) - (case (/.check java/lang/Long sample) (#.Some _) false #.None true) - (case (/.check java/lang/Object sample) (#.Some _) true #.None false) - (case (/.check java/lang/Object (/.null)) (#.Some _) false #.None true))) + (and (case (/.check java/lang/String sample) {#.Some _} true #.None false) + (case (/.check java/lang/Long sample) {#.Some _} false #.None true) + (case (/.check java/lang/Object sample) {#.Some _} true #.None false) + (case (/.check java/lang/Object (/.null)) {#.Some _} false #.None true))) (_.cover [/.synchronized] (/.synchronized sample #1)) (_.cover [/.class_for] @@ -165,10 +165,10 @@ (and (|> (/.??? (/.null)) (: (Maybe java/lang/Object)) (case> #.None #1 - (#.Some _) #0)) + {#.Some _} #0)) (|> (/.??? sample) (: (Maybe java/lang/Object)) - (case> (#.Some _) #1 + (case> {#.Some _} #1 #.None #0)))) (_.cover [/.!!!] (and (|> (/.??? (/.null)) @@ -287,17 +287,17 @@ expected)))) example/1! (and (case (test/TestInterface1::actual1 false object/1) - (#try.Success actual) + {#try.Success actual} (same? (: Any expected) (: Any actual)) - (#try.Failure error) + {#try.Failure error} false) (case (test/TestInterface1::actual1 true object/1) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} true)) object/2 (/.object [] [test/TestInterface2] @@ -508,17 +508,17 @@ object/1 (test/TestClass1::new (.int expected)) example/1! (and (case (test/TestInterface1::actual1 false object/1) - (#try.Success actual) + {#try.Success actual} (n.= expected (:as Nat actual)) - (#try.Failure error) + {#try.Failure error} false) (case (test/TestInterface1::actual1 true object/1) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} true)) object/2 (test/TestClass2::new) @@ -586,10 +586,10 @@ (function (_ lux) (|> (macro.single_expansion expression) (meta.result lux) - (case> (#try.Success expansion) + (case> {#try.Success expansion} true - (#try.Failure error) + {#try.Failure error} false) code.bit list diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 96e4b7ec8..1e20f80ca 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -54,6 +54,6 @@ true)) (_.cover [/.import:] (case (io.run! (..os/getenv string)) - (#.Some _) true + {#.Some _} true #.None true)) ))))) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index df05fdf29..7f53f7da4 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -182,7 +182,7 @@ (case> #.None #1 _ #0)) (|> (: (Maybe java/lang/Object) (/.??? sample)) - (case> (#.Some _) #1 + (case> {#.Some _} #1 _ #0)))) (_.cover [/.!!!] (and (/.null? (/.!!! (/.??? (/.null)))) @@ -197,10 +197,10 @@ increase random.int] ($_ _.and (_.cover [/.check] - (and (case (/.check java/lang/String sample) (#.Some _) true #.None false) - (case (/.check java/lang/Long sample) (#.Some _) false #.None true) - (case (/.check java/lang/Object sample) (#.Some _) true #.None false) - (case (/.check java/lang/Object (/.null)) (#.Some _) false #.None true))) + (and (case (/.check java/lang/String sample) {#.Some _} true #.None false) + (case (/.check java/lang/Long sample) {#.Some _} false #.None true) + (case (/.check java/lang/Object sample) {#.Some _} true #.None false) + (case (/.check java/lang/Object (/.null)) {#.Some _} false #.None true))) (_.cover [/.synchronized] (/.synchronized sample #1)) (_.cover [/.class_for /.import:] diff --git a/stdlib/source/test/lux/locale.lux b/stdlib/source/test/lux/locale.lux index ed9bb4970..f8856abca 100644 --- a/stdlib/source/test/lux/locale.lux +++ b/stdlib/source/test/lux/locale.lux @@ -43,7 +43,7 @@ [language ..random_language territory ..random_territory encoding ..random_encoding] - (in (/.locale language (#.Some territory) (#.Some encoding))))) + (in (/.locale language {#.Some territory} {#.Some encoding})))) (def: .public test Test @@ -60,15 +60,15 @@ ($_ _.and (|> ..random_language (\ ! each (function (_ language) - (/.locale language (#.Some fixed_territory) (#.Some fixed_encoding)))) + (/.locale language {#.Some fixed_territory} {#.Some fixed_encoding}))) ($hash.spec /.hash)) (|> ..random_territory (\ ! each (function (_ territory) - (/.locale fixed_language (#.Some territory) (#.Some fixed_encoding)))) + (/.locale fixed_language {#.Some territory} {#.Some fixed_encoding}))) ($hash.spec /.hash)) (|> ..random_encoding (\ ! each (function (_ encoding) - (/.locale fixed_language (#.Some fixed_territory) (#.Some encoding)))) + (/.locale fixed_language {#.Some fixed_territory} {#.Some encoding}))) ($hash.spec /.hash)) ))) @@ -77,9 +77,9 @@ territory ..random_territory encoding ..random_encoding .let [l_locale (/.locale language #.None #.None) - lt_locale (/.locale language (#.Some territory) #.None) - le_locale (/.locale language #.None (#.Some encoding)) - lte_locale (/.locale language (#.Some territory) (#.Some encoding))] + lt_locale (/.locale language {#.Some territory} #.None) + le_locale (/.locale language #.None {#.Some encoding}) + lte_locale (/.locale language {#.Some territory} {#.Some encoding})] .let [language_check (and (text\= (language.code language) (/.code l_locale)) (list.every? (|>> /.code (text.starts_with? (language.code language))) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 694a10f7d..2266d973a 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -39,7 +39,7 @@ (template: (!global <definition>) [(: [Text .Global] - [(template.text [<definition>]) (#.Definition [true .Macro <definition>])])]) + [(template.text [<definition>]) {#.Definition [true .Macro <definition>]}])]) (syntax: (pow/2 [number <code>.any]) (in (list (` (nat.* (~ number) (~ number)))))) @@ -70,7 +70,7 @@ #.mode #.Build] #.source [location.dummy 0 ""] #.location location.dummy - #.current_module (#.Some current_module) + #.current_module {#.Some current_module} #.modules (list [macro_module [#.module_hash 0 #.module_aliases (list) @@ -140,7 +140,7 @@ (bit\= (not (nat.= 1 repetitions)) (|> (/.one_expansion (` (..repeated (~ (code.nat repetitions)) (~ pow/1)))) (meta.result lux) - (!expect (#try.Failure _))))) + (!expect {#try.Failure _})))) )))) (def: .public test @@ -154,13 +154,13 @@ (|> (/.identifier identifier_prefix) (\ meta.monad each %.code) (meta.result lux) - (!expect (^multi (#try.Success actual_identifier) + (!expect (^multi {#try.Success actual_identifier} (and (text.contains? identifier_prefix actual_identifier) (text.contains? (%.nat seed) actual_identifier)))))) (_.cover [/.wrong_syntax_error] (|> (/.single_expansion (` (/.log_single_expansion!))) (meta.result lux) - (!expect (^multi (#try.Failure error) + (!expect (^multi {#try.Failure error} (text.contains? (/.wrong_syntax_error (name_of /.log_single_expansion!)) error))))) (_.cover [/.with_identifiers] @@ -168,7 +168,7 @@ (|> (/.with_identifiers [<expected>] (\ meta.monad in <expected>)) (meta.result lux) - (!expect (^multi (#try.Success [_ (#.Identifier ["" actual])]) + (!expect (^multi {#try.Success [_ {#.Identifier ["" actual]}]} (text.contains? (template.text [<expected>]) actual)))))) )) diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 1e694ada1..f14970009 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -67,11 +67,11 @@ start (: Source [location.dummy 0 source_code])] (case (parse start) - (#.Left [end error]) - (#try.Failure error) + {#.Left [end error]} + {#try.Failure error} - (#.Right [end lux_code]) - (#try.Success lux_code)))) + {#.Right [end lux_code]} + {#try.Success lux_code}))) (def: (replacement_simulation [original substitute]) (-> [Code Code] (Random [Code Code])) @@ -110,15 +110,15 @@ [expected <random>] (_.cover [<coverage>] (and (case (..read (/.format (<coverage> expected))) - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = actual (<coverage> expected)) - (#try.Failure error) + {#try.Failure error} false) (\ /.equivalence = - [location.dummy (<tag> expected)] + [location.dummy {<tag> expected}] (<coverage> expected)))))] [/.bit random.bit #.Bit] @@ -137,15 +137,15 @@ [expected <random>] (_.cover [<coverage>] (and (case (..read (/.format (<coverage> expected))) - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = actual (<coverage> expected)) - (#try.Failure error) + {#try.Failure error} false) (\ /.equivalence = - [location.dummy (<tag> ["" expected])] + [location.dummy {<tag> ["" expected]}] (<coverage> expected))) ))] diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index 1016ccdef..b36094399 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -30,17 +30,17 @@ (syntax: (macro_error [macro <code>.any]) (function (_ compiler) (case ((macro.expansion macro) compiler) - (#try.Failure error) - (#try.Success [compiler (list (code.text error))]) + {#try.Failure error} + {#try.Success [compiler (list (code.text error))]} - (#try.Success _) - (#try.Failure "OOPS!")))) + {#try.Success _} + {#try.Failure "OOPS!"}))) (def: (constant output) (-> Code Macro) ("lux macro" (function (_ inputs lux) - (#try.Success [lux (list output)])))) + {#try.Success [lux (list output)]}))) (syntax: (with [name (<code>.tuple (<>.and <code>.text <code>.text)) constant <code>.any @@ -54,8 +54,8 @@ (let [remove_macro! (: (-> .Module .Module) (revised@ #.definitions (plist.lacks short)))] (function (_ lux) - (#try.Success [(revised@ #.modules (plist.revised module remove_macro!) lux) - []]))) + {#try.Success [(revised@ #.modules (plist.revised module remove_macro!) lux) + []]})) (in []))] (let [pre_expansion (` (let [(~ g!output) (~ body)] (exec (~ pop!) diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux index 8ea3f25e5..de1e3fe56 100644 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ b/stdlib/source/test/lux/macro/syntax/check.lux @@ -40,9 +40,9 @@ (case (<code>.result /.parser (list (/.format [#/.type type #/.value value]))) - (#try.Failure _) + {#try.Failure _} false - (#try.Success check) + {#try.Success check} (and (code\= type (value@ #/.type check)) (code\= value (value@ #/.value check))))))))) diff --git a/stdlib/source/test/lux/macro/syntax/declaration.lux b/stdlib/source/test/lux/macro/syntax/declaration.lux index e87028628..f14762ad6 100644 --- a/stdlib/source/test/lux/macro/syntax/declaration.lux +++ b/stdlib/source/test/lux/macro/syntax/declaration.lux @@ -40,8 +40,8 @@ (_.cover [/.format /.parser] (case (<code>.result /.parser (list (/.format expected))) - (#try.Failure _) + {#try.Failure _} false - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = expected actual))))))) diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux index cb5867a2a..b76f75cdb 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -69,28 +69,28 @@ (_.cover [/.format /.parser] (case (<code>.result (/.parser compiler) (list (/.format expected))) - (#try.Failure error) + {#try.Failure error} false - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = expected actual))) (_.cover [/.typed] - (let [expected (with@ #/.value (#.Left [type untyped_value]) expected)] + (let [expected (with@ #/.value {#.Left [type untyped_value]} expected)] (case (<code>.result (/.typed compiler) (list (/.format expected))) - (#try.Failure error) + {#try.Failure error} false - (#try.Success actual) + {#try.Success actual} (\ /.equivalence = expected actual)))) (_.cover [/.lacks_type] - (let [expected (with@ #/.value (#.Right untyped_value) expected)] + (let [expected (with@ #/.value {#.Right untyped_value} expected)] (case (<code>.result (/.typed compiler) (list (/.format expected))) - (#try.Failure error) + {#try.Failure error} (exception.match? /.lacks_type error) - (#try.Success actual) + {#try.Success actual} false))) ))) )) diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux index 17396ad9c..ac95210a2 100644 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ b/stdlib/source/test/lux/macro/syntax/export.lux @@ -33,7 +33,7 @@ [[expected_export_policy expected_un_exported] ..export] (_.cover [/.parser /.default_policy] (|> (case expected_export_policy - (#.Some expected_export_policy) + {#.Some expected_export_policy} (list expected_export_policy (code.nat expected_un_exported)) #.None diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux index bed8f2768..b822f1b94 100644 --- a/stdlib/source/test/lux/macro/syntax/input.lux +++ b/stdlib/source/test/lux/macro/syntax/input.lux @@ -41,8 +41,8 @@ [expected ..random] (_.cover [/.format /.parser] (case (<code>.result /.parser (list (/.format (list expected)))) - (#try.Failure _) + {#try.Failure _} false - (#try.Success actual) + {#try.Success actual} (\ (list.equivalence /.equivalence) = (list expected) actual))))))) diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux index 8a79d62a5..74263e302 100644 --- a/stdlib/source/test/lux/macro/template.lux +++ b/stdlib/source/test/lux/macro/template.lux @@ -31,11 +31,11 @@ (syntax: (macro_error [macro <code>.any]) (function (_ compiler) (case ((macro.expansion macro) compiler) - (#try.Failure error) - (#try.Success [compiler (list (code.text error))]) + {#try.Failure error} + {#try.Success [compiler (list (code.text error))]} - (#try.Success _) - (#try.Failure "OOPS!")))) + {#try.Success _} + {#try.Failure "OOPS!"}))) (def: .public test Test diff --git a/stdlib/source/test/lux/math/logic/fuzzy.lux b/stdlib/source/test/lux/math/logic/fuzzy.lux index d7e6d1000..d4887967e 100644 --- a/stdlib/source/test/lux/math/logic/fuzzy.lux +++ b/stdlib/source/test/lux/math/logic/fuzzy.lux @@ -93,7 +93,7 @@ (random.one (function (_ thresholds) (case thresholds (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) - (#.Some [threshold_0 threshold_1 threshold_2 threshold_3]) + {#.Some [threshold_0 threshold_1 threshold_2 threshold_3]} _ #.None)))) @@ -177,7 +177,7 @@ (random.one (function (_ thresholds) (case thresholds (^ (list threshold_0 threshold_1 threshold_2 threshold_3)) - (#.Some [threshold_0 threshold_1 threshold_2 threshold_3]) + {#.Some [threshold_0 threshold_1 threshold_2 threshold_3]} _ #.None))))] diff --git a/stdlib/source/test/lux/math/modular.lux b/stdlib/source/test/lux/math/modular.lux index 0cb8a6456..bee6e09a5 100644 --- a/stdlib/source/test/lux/math/modular.lux +++ b/stdlib/source/test/lux/math/modular.lux @@ -66,10 +66,10 @@ (case (|> param (\ (/.codec param\\%) encoded) (\ (/.codec subject\\%) decoded)) - (#try.Failure error) + {#try.Failure error} (exception.match? /.incorrect_modulus error) - (#try.Success _) + {#try.Success _} false)) (_.cover [/.modulus] (and (type\= (:of (/.modulus subject)) @@ -96,7 +96,7 @@ co_prime? (i.co_prime? (//.divisor (/.modulus subject)) (/.value subject))] (case (/.inverse subject) - (#.Some subject^-1) + {#.Some subject^-1} (and co_prime? (|> subject (/.* subject^-1) @@ -116,9 +116,9 @@ (/.= subject)))))) (_.cover [/.moduli_are_not_equal] (case (/.adapter subject\\% param\\%) - (#try.Failure error) + {#try.Failure error} (exception.match? /.moduli_are_not_equal error) - (#try.Success _) + {#try.Success _} false)) ))))) diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 74a61ff8c..d13cb6817 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -42,17 +42,17 @@ ($_ _.and (_.cover [/.modulus /.divisor] (case (/.modulus divisor) - (#try.Success modulus) + {#try.Success modulus} (i.= divisor (/.divisor modulus)) - (#try.Failure error) + {#try.Failure error} (i.= +0 divisor))) (_.cover [/.zero_cannot_be_a_modulus] (case (/.modulus +0) - (#try.Failure error) + {#try.Failure error} (exception.match? /.zero_cannot_be_a_modulus error) - (#try.Success modulus) + {#try.Success modulus} false)) (_.cover [/.literal] (with_expansions [<divisor> (|divisor|)] diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux index 861a8bfdb..6614235b4 100644 --- a/stdlib/source/test/lux/math/number.lux +++ b/stdlib/source/test/lux/math/number.lux @@ -35,10 +35,10 @@ (_.cover [/.bin] (`` (and (~~ (template [<=> <codec> <number>] [(case (\ <codec> decoded (..clean_commas <number>)) - (#try.Success actual) + {#try.Success actual} (<=> (/.bin <number>) actual) - (#try.Failure error) + {#try.Failure error} false)] [n.= n.binary "11001001"] @@ -56,10 +56,10 @@ (_.cover [/.oct] (`` (and (~~ (template [<=> <codec> <number>] [(case (\ <codec> decoded (..clean_commas <number>)) - (#try.Success actual) + {#try.Success actual} (<=> (/.oct <number>) actual) - (#try.Failure error) + {#try.Failure error} false)] [n.= n.octal "615243"] @@ -77,10 +77,10 @@ (_.cover [/.hex] (`` (and (~~ (template [<=> <codec> <number>] [(case (\ <codec> decoded (..clean_commas <number>)) - (#try.Success actual) + {#try.Success actual} (<=> (/.hex <number>) actual) - (#try.Failure error) + {#try.Failure error} false)] [n.= n.hex "deadBEEF"] diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index fd8d55789..a9bde8474 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -128,7 +128,7 @@ (_.cover [/.sub] (n.= 0 size)) - (#.Some sub) + {#.Some sub} (do [! random.monad] [.let [limit (|> (-- (\ sub width)) /.mask diff --git a/stdlib/source/test/lux/math/number/ratio.lux b/stdlib/source/test/lux/math/number/ratio.lux index 332345387..2bced4d50 100644 --- a/stdlib/source/test/lux/math/number/ratio.lux +++ b/stdlib/source/test/lux/math/number/ratio.lux @@ -79,7 +79,7 @@ with_denominator! (case (/.nat (/.ratio numerator denominator)) - (#.Some factor) + {#.Some factor} (and (n.= 0 (n.% denominator numerator)) (n.= numerator (n.* factor denominator))) @@ -111,7 +111,7 @@ (and (/.= right (|> div (/.* left) (/.+ rem))) (case (/.nat div) - (#.Some _) true + {#.Some _} true #.None false))))) (do random.monad [left ..random diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index fa5e55c24..86af8bc90 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -54,13 +54,13 @@ #.mode #.Build] #.source [location.dummy 0 source_code] #.location location.dummy - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules (list) #.scopes (list) #.type_context [#.ex_counter 0 #.var_counter 0 #.var_bindings (list)] - #.expected (#.Some (#.Primitive primitive_type (list))) + #.expected {#.Some {#.Primitive primitive_type (list)}} #.seed expected_seed #.scope_type_vars (list) #.extensions [] @@ -70,18 +70,18 @@ (_.cover [/.result] (|> (\ /.monad in expected) (/.result expected_lux) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual))))) (_.cover [/.result'] (|> (\ /.monad in expected) (/.result' expected_lux) - (!expect (^multi (#try.Success [actual_lux actual]) + (!expect (^multi {#try.Success [actual_lux actual]} (and (same? expected_lux actual_lux) (n.= expected actual)))))) (_.cover [/.compiler_state] (|> /.compiler_state (/.result expected_lux) - (!expect (^multi (#try.Success actual_lux) + (!expect (^multi {#try.Success actual_lux} (same? expected_lux actual_lux))))) ))) @@ -102,13 +102,13 @@ #.mode #.Build] #.source [location.dummy 0 source_code] #.location location.dummy - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules (list) #.scopes (list) #.type_context [#.ex_counter 0 #.var_counter 0 #.var_bindings (list)] - #.expected (#.Some (#.Primitive primitive_type (list))) + #.expected {#.Some {#.Primitive primitive_type (list)}} #.seed expected_seed #.scope_type_vars (list) #.extensions [] @@ -119,43 +119,43 @@ (|> (/.failure expected_error) (: (Meta Any)) (/.result expected_lux) - (!expect (^multi (#try.Failure actual_error) + (!expect (^multi {#try.Failure actual_error} (text\= (location.with location.dummy expected_error) actual_error))))) (_.cover [/.assertion] (and (|> (/.assertion expected_error true) (: (Meta Any)) (/.result expected_lux) - (!expect (#try.Success []))) + (!expect {#try.Success []})) (|> (/.assertion expected_error false) (/.result expected_lux) - (!expect (^multi (#try.Failure actual_error) + (!expect (^multi {#try.Failure actual_error} (text\= expected_error actual_error)))))) (_.cover [/.either] (and (|> (/.either (\ /.monad in expected) (: (Meta Nat) (/.failure expected_error))) (/.result expected_lux) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) (\ /.monad in expected)) (/.result expected_lux) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual)))) (|> (/.either (: (Meta Nat) (/.failure expected_error)) (: (Meta Nat) (/.failure expected_error))) (/.result expected_lux) - (!expect (^multi (#try.Failure actual_error) + (!expect (^multi {#try.Failure actual_error} (text\= (location.with location.dummy expected_error) actual_error)))) (|> (/.either (\ /.monad in expected) (\ /.monad in dummy)) (/.result expected_lux) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (n.= expected actual)))) )) ))) @@ -197,13 +197,13 @@ #.mode #.Build] #.source [location.dummy 0 source_code] #.location location.dummy - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules expected_modules #.scopes (list) #.type_context [#.ex_counter 0 #.var_counter 0 #.var_bindings (list)] - #.expected (#.Some (#.Primitive primitive_type (list))) + #.expected {#.Some {#.Primitive primitive_type (list)}} #.seed expected_seed #.scope_type_vars (list) #.extensions [] @@ -214,29 +214,29 @@ (_.cover [/.current_module_name] (|> /.current_module_name (/.result expected_lux) - (!expect (^multi (#try.Success actual_current_module) + (!expect (^multi {#try.Success actual_current_module} (text\= expected_current_module actual_current_module))))) (_.cover [/.current_module] (|> /.current_module (/.result expected_lux) - (!expect (^multi (#try.Success actual_module) + (!expect (^multi {#try.Success actual_module} (same? expected_module actual_module))))) (_.cover [/.module] (|> (/.module expected_current_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_module) + (!expect (^multi {#try.Success actual_module} (same? expected_module actual_module))))) (_.cover [/.module_exists?] (and (|> (/.module_exists? expected_current_module) (/.result expected_lux) - (!expect (#try.Success #1))) + (!expect {#try.Success #1})) (|> (/.module_exists? dummy_module) (/.result expected_lux) - (!expect (#try.Success #0))))) + (!expect {#try.Success #0})))) (_.cover [/.modules] (|> /.modules (/.result expected_lux) - (!expect (^multi (#try.Success actual_modules) + (!expect (^multi {#try.Success actual_modules} (same? expected_modules actual_modules))))) (_.cover [/.imported_modules] (and (|> (/.imported_modules expected_current_module) @@ -260,12 +260,12 @@ (_.cover [/.normal] (and (|> (/.normal ["" expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success [actual_module actual_short]) + (!expect (^multi {#try.Success [actual_module actual_short]} (and (text\= expected_current_module actual_module) (same? expected_short actual_short))))) (|> (/.normal [dummy_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success [actual_module actual_short]) + (!expect (^multi {#try.Success [actual_module actual_short]} (and (text\= dummy_module actual_module) (same? expected_short actual_short))))))) )))) @@ -284,7 +284,7 @@ source_code (random.ascii/upper 1) expected_current_module (random.ascii/upper 1) expected_type (\ ! each (function (_ name) - (#.Primitive name (list))) + {#.Primitive name (list)}) (random.ascii/upper 1)) expected_seed random.nat expected random.nat @@ -298,11 +298,11 @@ #.mode #.Build] #.source [location.dummy 0 source_code] #.location expected_location - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules (list) #.scopes (list) #.type_context type_context - #.expected (#.Some expected_type) + #.expected {#.Some expected_type} #.seed expected_seed #.scope_type_vars (list) #.extensions [] @@ -315,18 +315,18 @@ post /.seed] (in [pre post])) (/.result expected_lux) - (!expect (^multi (#try.Success [actual_pre actual_post]) + (!expect (^multi {#try.Success [actual_pre actual_post]} (and (n.= expected_seed actual_pre) (n.= (++ expected_seed) actual_post)))))) (_.cover [/.location] (|> /.location (/.result expected_lux) - (!expect (^multi (#try.Success actual_location) + (!expect (^multi {#try.Success actual_location} (same? expected_location actual_location))))) (_.cover [/.expected_type] (|> /.expected_type (/.result expected_lux) - (!expect (^multi (#try.Success actual_type) + (!expect (^multi {#try.Success actual_type} (same? expected_type actual_type))))) (_.cover [.Type_Context /.type_context] (|> /.type_context @@ -343,7 +343,7 @@ (random.ascii/upper 1)) expected_short (random.ascii/upper 1) expected_type (\ ! each (function (_ name) - (#.Primitive name (list))) + {#.Primitive name (list)}) (random.ascii/upper 1)) expected_value (random.either (in .def:) (in .macro:)) @@ -355,12 +355,12 @@ (function (_ exported? def_type) (let [current_globals (: (List [Text .Global]) (list [expected_short - (#.Alias [expected_macro_module expected_short])])) + {#.Alias [expected_macro_module expected_short]}])) macro_globals (: (List [Text .Global]) (case def_type - (#.Some def_type) + {#.Some def_type} (list [expected_short - (#.Definition [exported? def_type expected_value])]) + {#.Definition [exported? def_type expected_value]}]) #.None (list)))] @@ -371,7 +371,7 @@ #.mode #.Build] #.source [location.dummy 0 ""] #.location location.dummy - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules (list [expected_current_module [#.module_hash 0 #.module_aliases (list) @@ -397,54 +397,54 @@ ($_ _.and (_.cover [.Global .Alias /.globals] (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some .Macro)) + (expected_lux true {#.Some .Macro}) current_globals! (|> (/.globals expected_current_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_globals) + (!expect (^multi {#try.Success actual_globals} (same? current_globals actual_globals)))) macro_globals! (|> (/.globals expected_macro_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_globals) + (!expect (^multi {#try.Success actual_globals} (same? macro_globals actual_globals))))] (and current_globals! macro_globals!))) (_.cover [.Definition /.definitions] (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some .Macro))] + (expected_lux true {#.Some .Macro})] (and (|> (/.definitions expected_current_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_definitions) + (!expect (^multi {#try.Success actual_definitions} (n.= 0 (list.size actual_definitions))))) (|> (/.definitions expected_macro_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_definitions) + (!expect (^multi {#try.Success actual_definitions} (n.= 1 (list.size actual_definitions))))) ))) (_.cover [/.exports] (and (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some .Macro))] + (expected_lux true {#.Some .Macro})] (and (|> (/.exports expected_current_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_definitions) + (!expect (^multi {#try.Success actual_definitions} (n.= 0 (list.size actual_definitions))))) (|> (/.exports expected_macro_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_definitions) + (!expect (^multi {#try.Success actual_definitions} (n.= 1 (list.size actual_definitions))))) )) (let [[current_globals macro_globals expected_lux] - (expected_lux false (#.Some .Macro))] + (expected_lux false {#.Some .Macro})] (and (|> (/.exports expected_current_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_definitions) + (!expect (^multi {#try.Success actual_definitions} (n.= 0 (list.size actual_definitions))))) (|> (/.exports expected_macro_module) (/.result expected_lux) - (!expect (^multi (#try.Success actual_definitions) + (!expect (^multi {#try.Success actual_definitions} (n.= 0 (list.size actual_definitions))))) )))) ))) @@ -458,7 +458,7 @@ (random.ascii/upper 1)) expected_short (random.ascii/upper 1) expected_type (\ ! each (function (_ name) - (#.Primitive name (list))) + {#.Primitive name (list)}) (random.ascii/upper 1)) expected_value (random.either (in .def:) (in .macro:)) @@ -470,12 +470,12 @@ (function (_ exported? def_type) (let [current_globals (: (List [Text .Global]) (list [expected_short - (#.Alias [expected_macro_module expected_short])])) + {#.Alias [expected_macro_module expected_short]}])) macro_globals (: (List [Text .Global]) (case def_type - (#.Some def_type) + {#.Some def_type} (list [expected_short - (#.Definition [exported? def_type expected_value])]) + {#.Definition [exported? def_type expected_value]}]) #.None (list)))] @@ -486,7 +486,7 @@ #.mode #.Build] #.source [location.dummy 0 ""] #.location location.dummy - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules (list [expected_current_module [#.module_hash 0 #.module_aliases (list) @@ -512,44 +512,44 @@ ($_ _.and (_.cover [/.export] (and (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some expected_type))] + (expected_lux true {#.Some expected_type})] (|> (/.export [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (#try.Success _)))) + (!expect {#try.Success _}))) (let [[current_globals macro_globals expected_lux] - (expected_lux false (#.Some expected_type))] + (expected_lux false {#.Some expected_type})] (|> (/.export [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (#try.Failure _)))))) + (!expect {#try.Failure _}))))) (_.cover [/.macro] (let [same_module! (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some .Macro))] + (expected_lux true {#.Some .Macro})] (|> (/.macro [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success (#.Some actual_value)) + (!expect (^multi {#try.Success {#.Some actual_value}} (same? expected_value actual_value))))) not_macro! (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some expected_type))] + (expected_lux true {#.Some expected_type})] (|> (/.macro [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (#try.Success #.None)))) + (!expect {#try.Success #.None}))) not_found! (let [[current_globals macro_globals expected_lux] (expected_lux true #.None)] (|> (/.macro [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (#try.Success #.None)))) + (!expect {#try.Success #.None}))) aliasing! (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some .Macro))] + (expected_lux true {#.Some .Macro})] (|> (/.macro [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success (#.Some actual_value)) + (!expect (^multi {#try.Success {#.Some actual_value}} (same? expected_value actual_value)))))] (and same_module! not_macro! @@ -557,7 +557,7 @@ aliasing!))) (_.cover [/.de_aliased] (let [[current_globals macro_globals expected_lux] - (expected_lux true (#.Some .Macro))] + (expected_lux true {#.Some .Macro})] (and (|> (/.de_aliased [expected_macro_module expected_short]) (/.result expected_lux) (try\each (name\= [expected_macro_module expected_short])) @@ -568,12 +568,12 @@ (try.else false))))) (_.cover [/.definition] (let [[current_globals macro_globals expected_lux] - (expected_lux expected_exported? (#.Some expected_type)) + (expected_lux expected_exported? {#.Some expected_type}) definition! (|> (/.definition [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success (#.Definition [actual_exported? actual_type actual_value])) + (!expect (^multi {#try.Success {#.Definition [actual_exported? actual_type actual_value]}} (and (bit\= expected_exported? actual_exported?) (same? expected_type actual_type) (same? (:as Any expected_value) actual_value))))) @@ -581,42 +581,42 @@ alias! (|> (/.definition [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success (#.Alias [actual_module actual_short])) + (!expect (^multi {#try.Success {#.Alias [actual_module actual_short]}} (and (same? expected_macro_module actual_module) (same? expected_short actual_short)))))] (and definition! alias!))) (_.cover [/.definition_type] (let [[current_globals macro_globals expected_lux] - (expected_lux expected_exported? (#.Some expected_type)) + (expected_lux expected_exported? {#.Some expected_type}) definition! (|> (/.definition_type [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success actual_type) + (!expect (^multi {#try.Success actual_type} (same? expected_type actual_type)))) alias! (|> (/.definition_type [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success actual_type) + (!expect (^multi {#try.Success actual_type} (same? expected_type actual_type))))] (and definition! alias!))) (_.cover [/.type_definition] (let [[current_globals macro_globals expected_lux] - (expected_lux expected_exported? (#.Some .Type)) + (expected_lux expected_exported? {#.Some .Type}) definition! (|> (/.type_definition [expected_macro_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success actual_value) + (!expect (^multi {#try.Success actual_value} (same? (:as .Type expected_value) actual_value)))) alias! (|> (/.type_definition [expected_current_module expected_short]) (/.result expected_lux) - (!expect (^multi (#try.Success actual_value) + (!expect (^multi {#try.Success actual_value} (same? (:as .Type expected_value) actual_value))))] (and definition! alias!))) @@ -644,11 +644,11 @@ (\ ! each set.list) (random.and (in head)))))] tags_0 random_labels - tags_1 (let [set/0 (set.of_list text.hash (#.Item tags_0))] + tags_1 (let [set/0 (set.of_list text.hash {#.Item tags_0})] (random.only (|>> #.Item (list.any? (set.member? set/0))not) random_labels)) - .let [type_0 (#.Primitive name_0 (list)) - type_1 (#.Primitive name_1 (list)) + .let [type_0 {#.Primitive name_0 (list)} + type_1 {#.Primitive name_1 (list)} expected_lux (: Lux @@ -657,7 +657,7 @@ #.mode #.Build] #.source [location.dummy 0 ""] #.location location.dummy - #.current_module (#.Some current_module) + #.current_module {#.Some current_module} #.modules (list [current_module [#.module_hash 0 #.module_aliases (list) @@ -667,17 +667,17 @@ [tag_module [#.module_hash 0 #.module_aliases (list) - #.definitions (list& [name_0 (#.Type [false type_0 (#.Left tags_0)])] - [name_1 (#.Type [true type_1 (#.Right tags_1)])] + #.definitions (list& [name_0 {#.Type [false type_0 {#.Left tags_0}]}] + [name_1 {#.Type [true type_1 {#.Right tags_1}]}] ($_ list\composite - (|> (#.Item tags_0) + (|> {#.Item tags_0} list.enumeration (list\each (function (_ [index short]) - [(format "#" short) (#.Label [false type_0 (#.Item tags_0) index])]))) - (|> (#.Item tags_1) + [(format "#" short) {#.Label [false type_0 {#.Item tags_0} index]}]))) + (|> {#.Item tags_1} list.enumeration (list\each (function (_ [index short]) - [(format "#" short) (#.Slot [true type_1 (#.Item tags_1) index])]))))) + [(format "#" short) {#.Slot [true type_1 {#.Item tags_1} index]}]))))) #.imports (list) #.module_state #.Active]]) #.scopes (list) @@ -698,29 +698,29 @@ type.equivalence))] (|> (/.tag_lists tag_module) (/.result expected_lux) - (try\each (\ equivalence = (list [(list\each (|>> [tag_module]) (#.Item tags_1)) + (try\each (\ equivalence = (list [(list\each (|>> [tag_module]) {#.Item tags_1}) type_1]))) (try.else false)))) (_.cover [/.tags_of] (|> (/.tags_of [tag_module name_1]) (/.result expected_lux) - (try\each (\ (maybe.equivalence (list.equivalence name.equivalence)) = (#.Some (list\each (|>> [tag_module]) (#.Item tags_1))))) + (try\each (\ (maybe.equivalence (list.equivalence name.equivalence)) = {#.Some (list\each (|>> [tag_module]) {#.Item tags_1})})) (try.else false))) (_.cover [/.slot] - (|> (#.Item tags_1) + (|> {#.Item tags_1} list.enumeration (list.every? (function (_ [expected_index tag]) (|> [tag_module tag] /.slot (/.result expected_lux) - (!expect (^multi (#try.Success [actual_index actual_tags actual_type]) + (!expect (^multi {#try.Success [actual_index actual_tags actual_type]} (let [correct_index! (n.= expected_index actual_index) correct_tags! (\ (list.equivalence name.equivalence) = - (list\each (|>> [tag_module]) (#.Item tags_1)) + (list\each (|>> [tag_module]) {#.Item tags_1}) actual_tags) correct_type! @@ -742,19 +742,19 @@ (random.one (function (_ values) (case values (^ (list name_0 name_1 name_2 name_3 name_4)) - (#.Some [name_0 name_1 name_2 name_3 name_4]) + {#.Some [name_0 name_1 name_2 name_3 name_4]} _ #.None)))) - .let [type_0 (#.Primitive name_0 (list)) - type_1 (#.Primitive name_1 (list)) - type_2 (#.Primitive name_2 (list)) - type_3 (#.Primitive name_3 (list)) - type_4 (#.Primitive name_4 (list)) + .let [type_0 {#.Primitive name_0 (list)} + type_1 {#.Primitive name_1 (list)} + type_2 {#.Primitive name_2 (list)} + type_3 {#.Primitive name_3 (list)} + type_4 {#.Primitive name_4 (list)} globals (: (List [Text .Global]) (list [name_4 - (#.Definition [false type_4 []])])) + {#.Definition [false type_4 []]}])) scopes (list [#.name (list) #.inner 0 @@ -782,7 +782,7 @@ #.mode #.Build] #.source [location.dummy 0 ""] #.location location.dummy - #.current_module (#.Some current_module) + #.current_module {#.Some current_module} #.modules (list [current_module [#.module_hash 0 #.module_aliases (list) @@ -866,7 +866,7 @@ (function (_ == left right) (case [(/.result init left) (/.result init right)] - [(#try.Success left) (#try.Success right)] + [{#try.Success left} {#try.Success right}] (== left right) _ @@ -883,7 +883,7 @@ source_code (random.ascii/upper 1) expected_current_module (random.ascii/upper 1) expected_type (\ ! each (function (_ name) - (#.Primitive name (list))) + {#.Primitive name (list)}) (random.ascii/upper 1)) expected_seed random.nat expected random.nat @@ -894,13 +894,13 @@ #.mode #.Build] #.source [expected_location 0 source_code] #.location expected_location - #.current_module (#.Some expected_current_module) + #.current_module {#.Some expected_current_module} #.modules (list) #.scopes (list) #.type_context [#.ex_counter 0 #.var_counter 0 #.var_bindings (list)] - #.expected (#.Some expected_type) + #.expected {#.Some expected_type} #.seed expected_seed #.scope_type_vars (list) #.extensions [] @@ -923,7 +923,7 @@ (: (Try Nat)) /.lifted (/.result expected_lux) - (!expect (^multi (#try.Failure actual) + (!expect (^multi {#try.Failure actual} (text\= (location.with expected_location expected_error) actual)))) (|> expected_value @@ -931,7 +931,7 @@ (: (Try Nat)) /.lifted (/.result expected_lux) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (same? expected_value actual))))))) ..compiler_related diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index 6dc3667c2..18bc932e8 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -66,8 +66,8 @@ (case (try ((: (-> (List Text) (io.IO Any)) (..actual_program <program>)) inputs)) - (#try.Success _) + {#try.Success _} false - (#try.Failure _) + {#try.Failure _} true)))))))) diff --git a/stdlib/source/test/lux/static.lux b/stdlib/source/test/lux/static.lux index 048d0511b..d603b4d85 100644 --- a/stdlib/source/test/lux/static.lux +++ b/stdlib/source/test/lux/static.lux @@ -31,7 +31,7 @@ <right> (<random>) <l+r> (<static> (<+> <left> <right>))] (case (' <l+r>) - [_ (<tag> l+r)] + [_ {<tag> l+r}] (<=> l+r (<+> <left> <right>)) _ @@ -46,7 +46,7 @@ <right> (/.random_frac) <l+r> (/.frac (f.+ <left> <right>))] (case (' <l+r>) - [_ (#.Frac l+r)] + [_ {#.Frac l+r}] (or (f.= l+r (f.+ <left> <right>)) (and (f.not_a_number? l+r) (f.not_a_number? (f.+ <left> <right>)) @@ -60,7 +60,7 @@ <right> (/.random code.text (random.ascii/alpha_num 1)) <l+r> (/.text (format <left> <right>))] (case (' <l+r>) - [_ (#.Text l+r)] + [_ {#.Text l+r}] (text\= l+r (format <left> <right>)) _ @@ -70,7 +70,7 @@ <right> (/.random code.text (random.ascii/alpha_num 1)) <l+r> (/.literal code.text (format <left> <right>))] (case (' <l+r>) - [_ (#.Text l+r)] + [_ {#.Text l+r}] (text\= l+r (format <left> <right>)) _ diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 9fa008544..0d17df0ff 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -117,9 +117,9 @@ method_name (/type.method [(list) (list) ..$Object (list)]) (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ bytecode] - /.areturn)))) + /.areturn)})) (row.row)) .let [bytecode (format.result /class.writer class) loader (/loader.memory (/loader.new_library []))] @@ -127,10 +127,10 @@ class (io.run! (/loader.load class_name loader)) method (try (get_method method_name class))] (java/lang/reflect/Method::invoke (ffi.null) (ffi.array java/lang/Object 0) method)) - (#try.Success actual) + {#try.Success actual} (test actual) - (#try.Failure error) + {#try.Failure error} false)))) (type: (Primitive a) @@ -861,7 +861,7 @@ constructor constructor::type (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ /.aload_0 _ (/.invokespecial ..$Object constructor (/type.method [(list) (list) /type.void (list)])) _ (..$Long::literal part0) @@ -869,14 +869,14 @@ _ /.aload_0 _ /.lload_1 _ (/.putfield $Self object_field /type.long)] - /.return))) + /.return)}) (/method.method ($_ /modifier\composite /method.public /method.static) static_method (/type.method [(list) (list) ..$Long (list)]) (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ (/.new $Self) _ /.dup _ (..$Long::literal part1) @@ -885,7 +885,7 @@ _ (/.getstatic $Self class_field /type.long) _ /.ladd _ ..$Long::wrap] - /.areturn)))) + /.areturn)})) (row.row)) try.trusted (format.result /class.writer)) @@ -897,10 +897,10 @@ 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))) - (#try.Success actual) + {#try.Success actual} (i.= (:as Int expected) (:as Int actual)) - (#try.Failure error) + {#try.Failure error} false)))) (def: array @@ -1031,7 +1031,7 @@ (..bytecode (|>> (:as Nat) (n.= sizesH))) (do [! /.monad] [_ (monad.each ! (|>> (:as java/lang/Long) ffi.long_to_int ..$Integer::literal) - (#.Item sizesH sizesT)) + {#.Item sizesH sizesT}) _ (/.multianewarray type (|> dimensions /unsigned.u1 try.trusted)) _ ?length] $Long::wrap)))) @@ -1337,23 +1337,23 @@ primitive_method_name primitive_method_type (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ ((value@ #literal primitive) expected)] - return))) + return)}) (/method.method ..method_modifier object_method_name (/type.method [(list) (list) (value@ #boxed primitive) (list)]) (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ (/.invokestatic $Self primitive_method_name primitive_method_type) _ (case substitute #.None (in []) - (#.Some substitute) + {#.Some substitute} (substitute expected)) _ (value@ #wrap primitive)] - /.areturn)))) + /.areturn)})) (row.row)) .let [bytecode (format.result /class.writer class) loader (/loader.memory (/loader.new_library []))] @@ -1361,10 +1361,10 @@ 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) + {#try.Success actual} (test expected actual) - (#try.Failure error) + {#try.Failure error} false) ))))] ($_ _.and @@ -1380,7 +1380,7 @@ #random ..$String::random #literal (function.constant /.nop)]) /.return - (#.Some ..$String::literal) + {#.Some ..$String::literal} (function (_ expected actual) (text\= (:as Text expected) (:as Text actual))))) ))) @@ -1623,9 +1623,9 @@ name method::type (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ (..$Long::literal value)] - /.lreturn))))) + /.lreturn)}))) interface_bytecode (|> (/class.class /version.v6_0 ($_ /modifier\composite /class.public /class.abstract /class.interface) (/name.internal interface_class) @@ -1646,10 +1646,10 @@ "<init>" constructor::type (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ /.aload_0 _ (/.invokespecial ..$Object "<init>" constructor::type)] - /.return))) + /.return)}) (method inherited_method part0) (method overriden_method fake_part2) (/method.method ($_ /modifier\composite /method.public /method.abstract) @@ -1671,10 +1671,10 @@ "<init>" constructor::type (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ /.aload_0 _ (/.invokespecial $Abstract "<init>" constructor::type)] - /.return))) + /.return)}) (method virtual_method part1) (method overriden_method part2) (method abstract_method part3) @@ -1685,7 +1685,7 @@ static_method (/type.method [(list) (list) ..$Long (list)]) (list) - (#.Some (do /.monad + {#.Some (do /.monad [_ (/.new $Concrete) _ /.dup _ (/.invokespecial $Concrete "<init>" constructor::type) @@ -1700,7 +1700,7 @@ _ (invoke $Abstract abstract_method) _ /.ladd _ ..$Long::wrap] - /.areturn)))) + /.areturn)})) (row.row)) try.trusted (format.result /class.writer)) @@ -1714,10 +1714,10 @@ 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))) - (#try.Success actual) + {#try.Success actual} (i.= (:as Int expected) (:as Int actual)) - (#try.Failure error) + {#try.Failure error} false)))) (def: .public test diff --git a/stdlib/source/test/lux/time.lux b/stdlib/source/test/lux/time.lux index 178818c3e..32bb9d67c 100644 --- a/stdlib/source/test/lux/time.lux +++ b/stdlib/source/test/lux/time.lux @@ -76,8 +76,8 @@ (text.prefix <prefix>) (text.suffix <suffix>) (\ /.codec decoded) - (case> (#try.Success _) true - (#try.Failure error) false)) + (case> {#try.Success _} true + {#try.Failure error} false)) invalid! (|> <invalid> @@ -85,10 +85,10 @@ (text.prefix <prefix>) (text.suffix <suffix>) (\ /.codec decoded) - (case> (#try.Success _) + (case> {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? <exception> error)))] (and valid! invalid!)))] @@ -102,8 +102,8 @@ %.nat (format "00:00:00.") (\ /.codec decoded) - (case> (#try.Success _) true - (#try.Failure error) false))) + (case> {#try.Success _} true + {#try.Failure error} false))) )))) (def: .public test @@ -127,10 +127,10 @@ (try.else false))) (_.cover [/.time_exceeds_a_day] (case (/.of_millis out_of_bounds) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.time_exceeds_a_day error))) (_.cover [/.midnight] (|> /.midnight diff --git a/stdlib/source/test/lux/time/date.lux b/stdlib/source/test/lux/time/date.lux index 5862b2ea5..24d18c5b9 100644 --- a/stdlib/source/test/lux/time/date.lux +++ b/stdlib/source/test/lux/time/date.lux @@ -53,10 +53,10 @@ (case (/.date (/.year expected) (/.month expected) (n.+ 31 (/.day_of_month expected))) - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_day error) - (#try.Success _) + {#try.Success _} false))) (do random.monad [expected random.date] @@ -88,9 +88,9 @@ "-" (%.nat day))]] (_.cover [/.invalid_month] (case (<text>.result /.parser input) - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_month error) - (#try.Success _) + {#try.Success _} false))) ))) diff --git a/stdlib/source/test/lux/time/day.lux b/stdlib/source/test/lux/time/day.lux index f1bcc932d..04d267d79 100644 --- a/stdlib/source/test/lux/time/day.lux +++ b/stdlib/source/test/lux/time/day.lux @@ -60,10 +60,10 @@ [not_a_day (random.ascii/upper 1)] (_.cover [/.not_a_day_of_the_week] (case (\ /.codec decoded not_a_day) - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_a_day_of_the_week error) - (#try.Success _) + {#try.Success _} false))) (_.cover [/.number /.by_number] (|> expected @@ -73,10 +73,10 @@ (try.else false))) (_.cover [/.invalid_day] (case (/.by_number invalid) - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_day error) - (#try.Success _) + {#try.Success _} false)) (_.cover [/.week] (let [all (list.size /.week) diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index f25348f9a..57050174e 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -98,9 +98,9 @@ (apply duration.inverse day\pred 7))))) (_.cover [/.now] (case (try (io.run! /.now)) - (#try.Success _) + {#try.Success _} true - (#try.Failure _) + {#try.Failure _} false)) ))) diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index 7e4ad8433..4db1303b3 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -64,10 +64,10 @@ (try.else false))) (_.cover [/.invalid_month] (case (/.by_number invalid) - (#try.Failure error) + {#try.Failure error} (exception.match? /.invalid_month error) - (#try.Success _) + {#try.Success _} false)) (_.cover [/.year] (let [all (list.size /.year) @@ -92,9 +92,9 @@ [not_a_month (random.ascii/upper 1)] (_.cover [/.not_a_month_of_the_year] (case (\ /.codec decoded not_a_month) - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_a_month_of_the_year error) - (#try.Success _) + {#try.Success _} false))) ))))) diff --git a/stdlib/source/test/lux/time/year.lux b/stdlib/source/test/lux/time/year.lux index 121d74822..1d949bf44 100644 --- a/stdlib/source/test/lux/time/year.lux +++ b/stdlib/source/test/lux/time/year.lux @@ -49,25 +49,25 @@ (_.cover [/.year] (bit\= (i.= +0 expected) (case (/.year expected) - (#try.Success _) + {#try.Success _} false - (#try.Failure _) + {#try.Failure _} true))) (_.cover [/.value] (case (/.year expected) - (#try.Success year) + {#try.Success year} (i.= expected (/.value year)) - (#try.Failure _) + {#try.Failure _} (i.= +0 expected))) )) (_.cover [/.there_is_no_year_0] (case (/.year +0) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.there_is_no_year_0 error))) (_.cover [/.days] (n.= (.nat (//duration.ticks //duration.day //duration.normal_year)) 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 4f87450ba..c152bb5c2 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 @@ -44,28 +44,28 @@ #.End #.End - (#.Item head+ #.End) + {#.Item head+ #.End} (list\each (|>> list) head+) - (#.Item head+ tail++) + {#.Item head+ tail++} (do list.monad [tail+ (exhaustive_weaving tail++) head head+] - (in (#.Item head tail+))))) + (in {#.Item head tail+})))) (def: .public (exhaustive_branches allow_literals? variantTC inputC) (-> Bit (List [Code Code]) Code (Random (List Code))) (case inputC - [_ (#.Bit _)] + [_ {#.Bit _}] (r\in (list (' #0) (' #1))) (^template [<tag> <gen> <wrapper>] - [[_ (<tag> _)] + [[_ {<tag> _}] (if allow_literals? (do [! r.monad] [?sample (r.maybe <gen>)] (case ?sample - (#.Some sample) + {#.Some sample} (do ! [else (exhaustive_branches allow_literals? variantTC inputC)] (in (list& (<wrapper> sample) else))) @@ -79,20 +79,20 @@ [#.Frac r.frac code.frac] [#.Text (r.unicode 5) code.text]) - (^ [_ (#.Tuple (list))]) + (^ [_ {#.Tuple (list)}]) (r\in (list (' []))) - [_ (#.Tuple members)] + [_ {#.Tuple members}] (do [! r.monad] [member_wise_patterns (monad.each ! (exhaustive_branches allow_literals? variantTC) members)] (in (|> member_wise_patterns exhaustive_weaving (list\each code.tuple)))) - (^ [_ (#.Record (list))]) + (^ [_ {#.Record (list)}]) (r\in (list (' {}))) - [_ (#.Record kvs)] + [_ {#.Record kvs}] (do [! r.monad] [.let [ks (list\each product.left kvs) vs (list\each product.right kvs)] @@ -101,7 +101,7 @@ exhaustive_weaving (list\each (|>> (list.zipped/2 ks) code.record))))) - (^ [_ (#.Form (list [_ (#.Tag _)] _))]) + (^ [_ {#.Form (list [_ {#.Tag _}] _)}]) (do [! r.monad] [bundles (monad.each ! (function (_ [_tag _code]) @@ -163,11 +163,11 @@ ////analysis.with_scope (do phase.monad [_ (//module.declare_tags variant_tags false - (#.Named [module_name variant_name] - (type.variant primitivesT))) + {#.Named [module_name variant_name] + (type.variant primitivesT)}) _ (//module.declare_tags record_tags false - (#.Named [module_name record_name] - (type.tuple primitivesT)))]) + {#.Named [module_name record_name] + (type.tuple primitivesT)})]) (//module.with_module 0 module_name)))] exhaustive_patterns (exhaustive_branches true variantTC inputC) .let [exhaustive_branchesC (list\each (branch outputC) 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 afd5276d4..73ef650e6 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 @@ -43,11 +43,11 @@ (|> analysis (//type.with_type expectedT) (phase.result _primitive.state) - (case> (#try.Success applyA) + (case> {#try.Success applyA} (let [[funcA argsA] (////analysis.application applyA)] (n.= num_args (list.size argsA))) - (#try.Failure _) + {#try.Failure _} false))) (def: abstraction @@ -90,7 +90,7 @@ [outputT outputC] _primitive.primitive .let [funcT (type.function inputsT outputT) partialT (type.function (list.after partial_args inputsT) outputT) - varT (#.Parameter 1) + varT {#.Parameter 1} polyT (<| (type.univ_q 1) (type.function (list.together (list (list.first var_idx inputsT) (list varT) @@ -101,9 +101,9 @@ partial_polyT1 (<| (type.function partial_poly_inputsT) poly_inputT) partial_polyT2 (<| (type.univ_q 1) - (type.function (#.Item varT partial_poly_inputsT)) + (type.function {#.Item varT partial_poly_inputsT}) varT) - dummy_function (#////analysis.Function (list) (#////analysis.Reference (////reference.local 1)))]] + dummy_function {#////analysis.Function (list) {#////analysis.Reference (////reference.local 1)}}]] (<| (_.context (%.name (name_of /.apply))) ($_ _.and (_.test "Can analyse monomorphic type application." diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux index d3ef99670..1ca30c317 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/primitive.lux @@ -34,12 +34,12 @@ (def: .public (expander macro inputs state) Expander - (#try.Failure "NOPE")) + {#try.Failure "NOPE"}) (def: .public (eval archive count type expression) Eval (function (_ state) - (#try.Failure "NO!"))) + {#try.Failure "NO!"})) (def: .public phase ////analysis.Phase @@ -76,20 +76,20 @@ (|> analysis //type.with_inference (phase.result ..state) - (case> (#try.Success [inferred_type output]) + (case> {#try.Success [inferred_type output]} (if (same? expected_type inferred_type) - (#try.Success output) + {#try.Success output} (exception.except wrong_inference [expected_type inferred_type])) - (#try.Failure error) - (#try.Failure error)))) + {#try.Failure error} + {#try.Failure error}))) (def: .public test (<| (_.context (name.module (name_of /._))) (`` ($_ _.and (_.test (%.name (name_of #////analysis.Unit)) (|> (infer Any (..phase archive.empty (' []))) - (case> (^ (#try.Success (#////analysis.Primitive (#////analysis.Unit output)))) + (case> (^ {#try.Success {#////analysis.Primitive {#////analysis.Unit output}}}) (same? [] output) _ @@ -99,7 +99,7 @@ [sample <random>] (_.test (%.name (name_of <tag>)) (|> (infer <type> (..phase archive.empty (<constructor> sample))) - (case> (#try.Success (#////analysis.Primitive (<tag> output))) + (case> {#try.Success {#////analysis.Primitive {<tag> output}}} (same? sample output) _ 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 1db1336ea..981b2604f 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 @@ -38,10 +38,10 @@ (template [<name> <on_success> <on_failure>] [(def: <name> Check - (|>> (case> (#try.Success _) + (|>> (case> {#try.Success _} <on_success> - (#try.Failure _) + {#try.Failure _} <on_failure>)))] [success? true false] @@ -52,7 +52,7 @@ (-> Text [Bit Text] [Bit Text] Check Bit) (|> (do [! phase.monad] [_ (//module.with_module 0 def_module - (//module.define var_name (#.Right [export? Any []])))] + (//module.define var_name {#.Right [export? Any []]}))] (//module.with_module 0 dependent_module (do ! [_ (if import? @@ -79,7 +79,7 @@ (//type.with_inference (_primitive.phase archive.empty (code.local_identifier var_name))))) (phase.result _primitive.state) - (case> (^ (#try.Success [inferredT (#////analysis.Reference (////reference.local var))])) + (case> (^ {#try.Success [inferredT {#////analysis.Reference (////reference.local var)}]}) (and (type\= expectedT inferredT) (n.= 0 var)) @@ -88,12 +88,12 @@ (_.test "Can analyse definition (in the same module)." (let [def_name [def_module var_name]] (|> (do phase.monad - [_ (//module.define var_name (#.Right [false expectedT []]))] + [_ (//module.define var_name {#.Right [false expectedT []]})] (//type.with_inference (_primitive.phase archive.empty (code.identifier def_name)))) (//module.with_module 0 def_module) (phase.result _primitive.state) - (case> (^ (#try.Success [_ inferredT (#////analysis.Reference (////reference.constant constant_name))])) + (case> (^ {#try.Success [_ inferredT {#////analysis.Reference (////reference.constant constant_name)}]}) (and (type\= expectedT inferredT) (name\= def_name constant_name)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index 4ad22a9fe..9d276e070 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -43,7 +43,7 @@ [(def: .public <name> (All (_ a) (-> (Operation a) Bit)) (|>> (phase.result _primitive.state) - (case> (#try.Success _) + (case> {#try.Success _} <on_success> _ @@ -71,7 +71,7 @@ (|> analysis (//type.with_type type) (phase.result _primitive.state) - (case> (^ (#try.Success (////analysis.variant variant))) + (case> (^ {#try.Success (////analysis.variant variant)}) (check_sum' tag size variant) _ @@ -89,7 +89,7 @@ (with_tags module tags variantT) (//type.with_type expectedT) (phase.result _primitive.state) - (case> (^ (#try.Success [_ (////analysis.variant variant)])) + (case> (^ {#try.Success [_ (////analysis.variant variant)]}) (check_sum' tag (list.size tags) variant) _ @@ -111,7 +111,7 @@ (with_tags module tags recordT) (//type.with_type expectedT) (phase.result _primitive.state) - (case> (#try.Success [_ productA]) + (case> {#try.Success [_ productA]} (correct_size? size productA) _ @@ -128,7 +128,7 @@ [valueT valueC] (maybe.trusted (list.item choice primitives)) +size (++ size) +primitives (list.together (list (list.first choice primitives) - (list [(#.Parameter 1) +valueC]) + (list [{#.Parameter 1} +valueC]) (list.after choice primitives))) [+valueT +valueC] (maybe.trusted (list.item +choice +primitives)) +variantT (type.variant (list\each product.left +primitives))]] @@ -145,7 +145,7 @@ (//type.with_type varT (/.sum _primitive.phase choice archive.empty valueC))) (phase.result _primitive.state) - (case> (^ (#try.Success (////analysis.variant variant))) + (case> (^ {#try.Success (////analysis.variant variant)}) (check_sum' choice size variant) _ @@ -178,7 +178,7 @@ .let [tupleT (type.tuple (list\each product.left primitives)) [singletonT singletonC] (|> primitives (list.item choice) maybe.trusted) +primitives (list.together (list (list.first choice primitives) - (list [(#.Parameter 1) +valueC]) + (list [{#.Parameter 1} +valueC]) (list.after choice primitives))) +tupleT (type.tuple (list\each product.left +primitives))]] (<| (_.context (%.name (name_of /.product))) @@ -187,7 +187,7 @@ (|> (//type.with_type tupleT (/.product archive.empty _primitive.phase (list\each product.right primitives))) (phase.result _primitive.state) - (case> (#try.Success tupleA) + (case> {#try.Success tupleA} (correct_size? size tupleA) _ @@ -196,7 +196,7 @@ (|> (//type.with_inference (/.product archive.empty _primitive.phase (list\each product.right primitives))) (phase.result _primitive.state) - (case> (#try.Success [_type tupleA]) + (case> {#try.Success [_type tupleA]} (and (check.subsumes? tupleT _type) (correct_size? size tupleA)) @@ -214,7 +214,7 @@ (//type.with_type varT (/.product archive.empty _primitive.phase (list\each product.right primitives)))) (phase.result _primitive.state) - (case> (#try.Success tupleA) + (case> {#try.Success tupleA} (correct_size? size tupleA) _ @@ -238,8 +238,8 @@ primitives (r.list size _primitive.primitive) module_name (r.unicode 5) type_name (r.unicode 5) - .let [with_name (|>> (#.Named [module_name type_name])) - varT (#.Parameter 1) + .let [with_name (|>> {#.Named [module_name type_name]}) + varT {#.Parameter 1} primitivesT (list\each product.left primitives) [choiceT choiceC] (maybe.trusted (list.item choice primitives)) [other_choiceT other_choiceC] (maybe.trusted (list.item other_choice primitives)) @@ -283,17 +283,17 @@ module_name (r.unicode 5) type_name (r.unicode 5) choice (|> r.nat (\ ! each (n.% size))) - .let [varT (#.Parameter 1) + .let [varT {#.Parameter 1} tagsC (list\each (|>> [module_name] code.tag) tags) primitivesT (list\each product.left primitives) primitivesC (list\each product.right primitives) - monoT (#.Named [module_name type_name] (type.tuple primitivesT)) + monoT {#.Named [module_name type_name] (type.tuple primitivesT)} recordC (list.zipped/2 tagsC primitivesC) polyT (|> (type.tuple (list.together (list (list.first choice primitivesT) (list varT) (list.after (++ choice) primitivesT)))) (type.univ_q 1) - (#.Named [module_name type_name]))]] + {#.Named [module_name type_name]})]] (<| (_.context (%.name (name_of /.record))) (_.test "Can infer." (|> (/.record archive.empty _primitive.phase recordC) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 2528ff9c1..aaf4f1ae6 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -39,10 +39,10 @@ (////type.with_type output_type (_primitive.phase archive.empty (` ((~ (code.text procedure)) (~+ params)))))) (phase.result _primitive.state) - (case> (#try.Success _) + (case> {#try.Success _} <success> - (#try.Failure _) + {#try.Failure _} <failure>)))] [check_success+ true 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 af22d952d..881c2f678 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 @@ -46,8 +46,8 @@ temp (|> random.nat (\ ! each (n.% 100))) .let [maskA (analysis.control/case [maskedA - [[(#analysis.Bind temp) - (#analysis.Reference (////reference.local temp))] + [[{#analysis.Bind temp} + {#analysis.Reference (////reference.local temp)}] (list)]])]] (_.cover [/.synthesize_masking] (|> maskA @@ -64,14 +64,14 @@ outputA //primitive.primitive .let [letA (analysis.control/case [inputA - [[(#analysis.Bind registerA) + [[{#analysis.Bind registerA} outputA] (list)]])]] (_.cover [/.synthesize_let] (|> letA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (case> (^ (#try.Success (synthesis.branch/let [inputS registerS outputS]))) + (case> (^ {#try.Success (synthesis.branch/let [inputS registerS outputS])}) (and (n.= registerA registerS) (//primitive.corresponds? inputA inputS) (//primitive.corresponds? outputA outputS)) @@ -87,10 +87,10 @@ thenA //primitive.primitive elseA //primitive.primitive .let [thenB (: Branch - [(#analysis.Simple (#analysis.Bit true)) + [{#analysis.Simple {#analysis.Bit true}} thenA]) elseB (: Branch - [(#analysis.Simple (#analysis.Bit false)) + [{#analysis.Simple {#analysis.Bit false}} elseA]) ifA (if then|else (analysis.control/case [inputA [thenB (list elseB)]]) @@ -99,7 +99,7 @@ (|> ifA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (case> (^ (#try.Success (synthesis.branch/if [inputS thenS elseS]))) + (case> (^ {#try.Success (synthesis.branch/if [inputS thenS elseS])}) (and (//primitive.corresponds? inputA inputS) (//primitive.corresponds? thenA thenS) (//primitive.corresponds? elseA elseS)) @@ -113,8 +113,8 @@ [lefts (|> random.nat (\ ! each (n.% 10))) right? random.bit] (in (if right? - (#.Right lefts) - (#.Left lefts))))) + {#.Right lefts} + {#.Left lefts})))) (def: random_path (Random (analysis.Tuple synthesis.Member)) @@ -129,16 +129,16 @@ [@member random.nat] (in [(list\mix (function (_ member inner) (case member - (#.Left lefts) + {#.Left lefts} (analysis.pattern/tuple (list\composite (list.repeated lefts (analysis.pattern/unit)) (list inner (analysis.pattern/unit)))) - (#.Right lefts) + {#.Right lefts} (analysis.pattern/tuple (list\composite (list.repeated (++ lefts) (analysis.pattern/unit)) (list inner))))) - (#analysis.Bind @member) + {#analysis.Bind @member} (list.reversed path)) @member]))) @@ -152,13 +152,13 @@ pathA ..random_path [pattern @member] (get_pattern pathA) .let [getA (analysis.control/case [recordA [[pattern - (#analysis.Reference (////reference.local @member))] + {#analysis.Reference (////reference.local @member)}] (list)]])]] (_.cover [/.synthesize_get] (|> getA (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (case> (^ (#try.Success (synthesis.branch/get [pathS recordS]))) + (case> (^ {#try.Success (synthesis.branch/get [pathS recordS])}) (and (\ (list.equivalence (sum.equivalence n.= n.=)) = pathA pathS) (//primitive.corresponds? recordA recordS)) @@ -171,10 +171,10 @@ [test random.bit then random.nat else random.nat] - (in [(#synthesis.Alt (#synthesis.Seq (synthesis.path/bit test) - (#synthesis.Then (synthesis.i64 (.i64 then)))) - (#synthesis.Seq (synthesis.path/bit (not test)) - (#synthesis.Then (synthesis.i64 (.i64 else))))) + (in [{#synthesis.Alt {#synthesis.Seq (synthesis.path/bit test) + {#synthesis.Then (synthesis.i64 (.i64 then))}} + {#synthesis.Seq (synthesis.path/bit (not test)) + {#synthesis.Then (synthesis.i64 (.i64 else))}}} [[#analysis.when (analysis.pattern/bit test) #analysis.then (analysis.nat then)] (list [#analysis.when (analysis.pattern/bit (not test)) @@ -198,11 +198,11 @@ [[test/0 test/1 test/2 test/3 test/4] (random_five <hash> <random>) [body/0 body/1 body/2 body/3 body/4] (random_five <hash> <random>)] (in [($_ #synthesis.Alt - (#synthesis.Seq (<path> test/0) (#synthesis.Then (<synthesis> body/0))) - (#synthesis.Seq (<path> test/1) (#synthesis.Then (<synthesis> body/1))) - (#synthesis.Seq (<path> test/2) (#synthesis.Then (<synthesis> body/2))) - (#synthesis.Seq (<path> test/3) (#synthesis.Then (<synthesis> body/3))) - (#synthesis.Seq (<path> test/4) (#synthesis.Then (<synthesis> body/4)))) + {#synthesis.Seq (<path> test/0) {#synthesis.Then (<synthesis> body/0)}} + {#synthesis.Seq (<path> test/1) {#synthesis.Then (<synthesis> body/1)}} + {#synthesis.Seq (<path> test/2) {#synthesis.Then (<synthesis> body/2)}} + {#synthesis.Seq (<path> test/3) {#synthesis.Then (<synthesis> body/3)}} + {#synthesis.Seq (<path> test/4) {#synthesis.Then (<synthesis> body/4)}}) [[#analysis.when (<pattern> test/0) #analysis.then (<analysis> body/0)] (list [#analysis.when (<pattern> test/1) #analysis.then (<analysis> body/1)] [#analysis.when (<pattern> test/2) #analysis.then (<analysis> body/2)] @@ -237,10 +237,10 @@ (function (_ lefts right? value body) ($_ #synthesis.Seq (synthesis.path/side (if right? - (#.Right lefts) - (#.Left lefts))) + {#.Right lefts} + {#.Left lefts})) (synthesis.path/text value) - (#synthesis.Then (synthesis.f64 body))))) + {#synthesis.Then (synthesis.f64 body)}))) branch (: (-> Nat Bit Text Frac Branch) (function (_ lefts right? value body) [#analysis.when (analysis.pattern/variant [#analysis.lefts lefts @@ -276,17 +276,17 @@ (if right? ($_ #synthesis.Seq (synthesis.path/member (if right? - (#.Right lefts) - (#.Left lefts))) + {#.Right lefts} + {#.Left lefts})) (synthesis.path/text value) - (#synthesis.Then (synthesis.f64 body))) + {#synthesis.Then (synthesis.f64 body)}) ($_ #synthesis.Seq (synthesis.path/member (if right? - (#.Right lefts) - (#.Left lefts))) + {#.Right lefts} + {#.Left lefts})) (synthesis.path/text value) #synthesis.Pop - (#synthesis.Then (synthesis.f64 body)))))) + {#synthesis.Then (synthesis.f64 body)})))) branch (: (-> Nat Bit Text Frac Branch) (function (_ lefts right? value body) [#analysis.when (if right? @@ -298,10 +298,10 @@ (analysis.pattern/unit))))) #analysis.then (analysis.frac body)]))]] (in [(list\mix (function (_ left right) - (#synthesis.Alt left right)) + {#synthesis.Alt left right}) (path (++ mid_size) true value/last body/last) (|> (list.zipped/2 value/mid body/mid) - (#.Item [value/first body/first]) + {#.Item [value/first body/first]} list.enumeration (list\each (function (_ [lefts' [value body]]) (path lefts' false value body))) @@ -333,7 +333,7 @@ (_.cover [/.synthesize_case] (|> (/.synthesize_case //.phase archive.empty expected_input match) (phase.result [///bundle.empty synthesis.init]) - (case> (^ (#try.Success (synthesis.branch/case [actual_input actual_path]))) + (case> (^ {#try.Success (synthesis.branch/case [actual_input actual_path])}) (and (\ synthesis.equivalence = expected_input actual_input) (\ synthesis.path_equivalence = expected_path actual_path)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 8c8b6c4a5..5396c5b9c 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -52,12 +52,12 @@ (-> Arity Analysis Analysis) (list\mix (function (_ arity_1 body) (case arity_1 - 0 (#analysis.Function (list) body) - _ (#analysis.Function ($_ list\composite + 0 {#analysis.Function (list) body} + _ {#analysis.Function ($_ list\composite (list\each (|>> #variable.Foreign) (list.indices arity_1)) - (list (#variable.Local 1))) - body))) + (list {#variable.Local 1})) + body})) body (list.reversed (list.indices arity)))) @@ -151,8 +151,8 @@ (in [(not (n.= 0 register)) (synthesis.variable/local register) (if (n.= arity register) - (#analysis.Reference (reference.local 1)) - (#analysis.Reference (reference.foreign register)))]))) + {#analysis.Reference (reference.local 1)} + {#analysis.Reference (reference.foreign register)})]))) (def: (random_constant output?) Scenario @@ -161,7 +161,7 @@ short (random.unicode 1)] (in [true (synthesis.constant [module short]) - (#analysis.Reference (reference.constant [module short]))]))) + {#analysis.Reference (reference.constant [module short])}]))) (def: (random_reference arity output?) (-> Arity Scenario) @@ -180,8 +180,8 @@ lefts (|> random.nat (\ ! each (n.% 10))) right? random.bit .let [side|member (if right? - (#.Right lefts) - (#.Left lefts))]] + {#.Right lefts} + {#.Left lefts})]] (in [(and loop?_input loop?_output) (synthesis.branch/case [expected_input @@ -211,30 +211,30 @@ (synthesis.path/bind (++ arity)) synthesis.path/pop (synthesis.path/then expected_output))))]) - (#analysis.Case actual_input - [[#analysis.when (analysis.pattern/unit) - #analysis.then actual_output] - (list [#analysis.when (analysis.pattern/bit bit_test) - #analysis.then actual_output] - [#analysis.when (analysis.pattern/nat (.nat i64_test)) - #analysis.then actual_output] - [#analysis.when (analysis.pattern/frac f64_test) - #analysis.then actual_output] - [#analysis.when (analysis.pattern/text text_test) - #analysis.then actual_output] - [#analysis.when (#analysis.Bind 2) - #analysis.then actual_output] - [#analysis.when (analysis.pattern/variant - [#analysis.lefts lefts - #analysis.right? right? - #analysis.value (#analysis.Bind 2)]) - #analysis.then actual_output] - [#analysis.when (analysis.pattern/tuple - (list\composite (list.repeated lefts (analysis.pattern/unit)) - (if right? - (list (analysis.pattern/unit) (#analysis.Bind 2)) - (list (#analysis.Bind 2) (analysis.pattern/unit))))) - #analysis.then actual_output])])]))) + {#analysis.Case actual_input + [[#analysis.when (analysis.pattern/unit) + #analysis.then actual_output] + (list [#analysis.when (analysis.pattern/bit bit_test) + #analysis.then actual_output] + [#analysis.when (analysis.pattern/nat (.nat i64_test)) + #analysis.then actual_output] + [#analysis.when (analysis.pattern/frac f64_test) + #analysis.then actual_output] + [#analysis.when (analysis.pattern/text text_test) + #analysis.then actual_output] + [#analysis.when {#analysis.Bind 2} + #analysis.then actual_output] + [#analysis.when (analysis.pattern/variant + [#analysis.lefts lefts + #analysis.right? right? + #analysis.value {#analysis.Bind 2}]) + #analysis.then actual_output] + [#analysis.when (analysis.pattern/tuple + (list\composite (list.repeated lefts (analysis.pattern/unit)) + (if right? + (list (analysis.pattern/unit) {#analysis.Bind 2}) + (list {#analysis.Bind 2} (analysis.pattern/unit))))) + #analysis.then actual_output])]}]))) (def: (random_let arity random_value output?) (-> Arity Scenario Scenario) @@ -246,10 +246,10 @@ (synthesis.branch/let [expected_input (++ arity) expected_output]) - (#analysis.Case actual_input - [[#analysis.when (#analysis.Bind 2) - #analysis.then actual_output] - (list)])]))) + {#analysis.Case actual_input + [[#analysis.when {#analysis.Bind 2} + #analysis.then actual_output] + (list)]}]))) (def: (random_if random_value output?) (-> Scenario Scenario) @@ -265,16 +265,16 @@ expected_then expected_else]) (if flip? - (#analysis.Case actual_test - [[#analysis.when (analysis.pattern/bit false) - #analysis.then actual_else] - (list [#analysis.when (analysis.pattern/bit true) - #analysis.then actual_then])]) - (#analysis.Case actual_test - [[#analysis.when (analysis.pattern/bit true) - #analysis.then actual_then] - (list [#analysis.when (analysis.pattern/bit false) - #analysis.then actual_else])]))]))) + {#analysis.Case actual_test + [[#analysis.when (analysis.pattern/bit false) + #analysis.then actual_else] + (list [#analysis.when (analysis.pattern/bit true) + #analysis.then actual_then])]} + {#analysis.Case actual_test + [[#analysis.when (analysis.pattern/bit true) + #analysis.then actual_then] + (list [#analysis.when (analysis.pattern/bit false) + #analysis.then actual_else])]})]))) (def: (random_get random_value output?) (-> Scenario Scenario) @@ -284,17 +284,17 @@ [loop?_record expected_record actual_record] (random_value false)] (in [loop?_record (synthesis.branch/get [(list (if right? - (#.Right lefts) - (#.Left lefts))) + {#.Right lefts} + {#.Left lefts})) expected_record]) - (#analysis.Case actual_record - [[#analysis.when (analysis.pattern/tuple - (list\composite (list.repeated lefts (analysis.pattern/unit)) - (if right? - (list (analysis.pattern/unit) (#analysis.Bind 2)) - (list (#analysis.Bind 2) (analysis.pattern/unit))))) - #analysis.then (#analysis.Reference (reference.local 2))] - (list)])]))) + {#analysis.Case actual_record + [[#analysis.when (analysis.pattern/tuple + (list\composite (list.repeated lefts (analysis.pattern/unit)) + (if right? + (list (analysis.pattern/unit) {#analysis.Bind 2}) + (list {#analysis.Bind 2} (analysis.pattern/unit))))) + #analysis.then {#analysis.Reference (reference.local 2)}] + (list)]}]))) (def: (random_branch arity random_value output?) (-> Arity Scenario Scenario) @@ -309,9 +309,9 @@ [resets (random.list arity (random_value false))] (in [true (synthesis.loop/recur (list\each (|>> product.right product.left) resets)) - (analysis.apply [(#analysis.Reference (case arity + (analysis.apply [{#analysis.Reference (case arity 1 (reference.local 0) - _ (reference.foreign 0))) + _ (reference.foreign 0))} (list\each (|>> product.right product.right) resets)])]))) (def: (random_scope arity output?) @@ -347,7 +347,7 @@ .let [environment ($_ list\composite (list\each (|>> #variable.Foreign) (list.indices arity)) - (list (#variable.Local 1)))]] + (list {#variable.Local 1}))]] (in [true (synthesis.function/abstraction [#synthesis.environment environment @@ -356,8 +356,8 @@ [#synthesis.start 1 #synthesis.inits (list) #synthesis.iteration expected_output])]) - (#analysis.Function environment - actual_output)]))) + {#analysis.Function environment + actual_output}]))) (def: (random_apply random_value output?) (-> Scenario Scenario) @@ -401,8 +401,8 @@ (in [(and loop?_first loop?_second loop?_third) - (#synthesis.Extension name (list expected_first expected_second expected_third)) - (#analysis.Extension name (list actual_first actual_second actual_third))]))) + {#synthesis.Extension name (list expected_first expected_second expected_third)} + {#analysis.Extension name (list actual_first actual_second actual_third)}]))) (def: (random_body arity) (-> Arity Scenario) @@ -432,7 +432,7 @@ (|> input (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ synthesis.equivalence = expected actual))))))) (def: application @@ -445,14 +445,14 @@ (and (|> (analysis.apply [funcA argsA]) (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (!expect (^multi (^ (#try.Success (synthesis.function/apply [funcS argsS]))) + (!expect (^multi (^ {#try.Success (synthesis.function/apply [funcS argsS])}) (and (//primitive.corresponds? funcA funcS) (list.every? (product.uncurried //primitive.corresponds?) (list.zipped/2 argsA argsS)))))) (|> (analysis.apply [funcA (list)]) (//.phase archive.empty) (phase.result [///bundle.empty synthesis.init]) - (!expect (^multi (#try.Success funcS) + (!expect (^multi {#try.Success funcS} (//primitive.corresponds? funcA funcS)))))))) (def: .public test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/loop.lux index 63a6f2546..c27d08c14 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 @@ -57,8 +57,8 @@ (let [local (do [! random.monad] [register (\ ! each (|>> (n.% arity) ++) random.nat)] (in [next - [(#variable.Local (/.register_optimization offset register)) - (#variable.Local register)]]))] + [{#variable.Local (/.register_optimization offset register)} + {#variable.Local register}]]))] (case offset 0 local _ ($_ random.either @@ -66,8 +66,8 @@ (do [! random.monad] [foreign (\ ! each (n.% offset) random.nat)] (in [next - [(#variable.Local foreign) - (#variable.Foreign foreign)]])))))) + [{#variable.Local foreign} + {#variable.Foreign foreign}]])))))) (def: (reference offset arity next) (Scenario Synthesis) @@ -248,8 +248,8 @@ [next [secondE secondA]] (..reference offset arity next) [next [thirdE thirdA]] (..reference offset arity next)] (in [next - [(#//.Extension name (list firstE secondE thirdE)) - (#//.Extension name (list firstA secondA thirdA))]]))) + [{#//.Extension name (list firstE secondE thirdE)} + {#//.Extension name (list firstA secondA thirdA)}]]))) (def: (scenario offset arity next) (Scenario Synthesis) @@ -279,8 +279,8 @@ (list\each (|>> #variable.Local))) #//.arity arity #//.body iteration]) - (^ (#.Some (//.loop/scope [actual_offset actual_inits - actual]))) + (^ {#.Some (//.loop/scope [actual_offset actual_inits + actual])}) (and (n.= expected_offset actual_offset) (\ (list.equivalence //.equivalence) = diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/primitive.lux index 4b37cbb5a..79e26221b 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 @@ -39,14 +39,14 @@ r.rev r.frac (r.unicode 5)))] - (in (#////analysis.Primitive primitive)))) + (in {#////analysis.Primitive primitive}))) (def: .public (corresponds? analysis synthesis) (-> Analysis Synthesis Bit) (`` (case [analysis synthesis] (~~ (template [<analysis> <post_analysis> <synthesis> <post_synthesis>] - [[(#////analysis.Primitive (<analysis> expected)) - (#////synthesis.Primitive (<synthesis> actual))] + [[{#////analysis.Primitive (<analysis> expected)} + {#////synthesis.Primitive (<synthesis> actual)}] (same? (|> expected <post_analysis>) (|> actual <post_synthesis>))] @@ -78,10 +78,10 @@ [(do r.monad [expected <generator>] (_.test (%.name (name_of <synthesis>)) - (|> (#////analysis.Primitive (<analysis> expected)) + (|> {#////analysis.Primitive (<analysis> expected)} (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (case> (#try.Success (#////synthesis.Primitive (<synthesis> actual))) + (case> {#try.Success {#////synthesis.Primitive (<synthesis> actual)}} (same? expected actual) _ diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux index 60a4bdeec..c9334a880 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/structure.lux @@ -47,7 +47,7 @@ (|> (////analysis.variant [lefts right? memberA]) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (case> (^ (#try.Success (////synthesis.variant [leftsS right?S valueS]))) + (case> (^ {#try.Success (////synthesis.variant [leftsS right?S valueS])}) (let [tagS (if right?S (++ leftsS) leftsS)] (and (n.= tagA tagS) (|> tagS (n.= (-- size)) (bit\= right?S)) @@ -65,7 +65,7 @@ (|> (////analysis.tuple membersA) (//.phase archive.empty) (phase.result [///bundle.empty ////synthesis.init]) - (case> (^ (#try.Success (////synthesis.tuple membersS))) + (case> (^ {#try.Success (////synthesis.tuple membersS)}) (and (n.= size (list.size membersS)) (list.every? (product.uncurried //primitive.corresponds?) (list.zipped/2 membersA membersS))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux index 7ba708602..b7713c5bd 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/variable.lux @@ -74,14 +74,14 @@ (dictionary.size (value@ #necessary context)))] [expected_output actual_output] (scenario (revised@ #redundants ++ context))] (in [(synthesis.branch/case [expected_input - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then expected_output))]) + {#synthesis.Seq #synthesis.Pop + {#synthesis.Then expected_output}}]) (if let? (synthesis.branch/let [actual_input fake_register actual_output]) (synthesis.branch/case [actual_input - (#synthesis.Seq (#synthesis.Bind fake_register) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then actual_output)))]))])) + {#synthesis.Seq {#synthesis.Bind fake_register} + {#synthesis.Seq #synthesis.Pop + {#synthesis.Then actual_output}}}]))])) (scenario context)))) (def: (variant_scenario scenario context) @@ -137,8 +137,8 @@ [lefts random.nat right? random.bit] (in (if right? - (#.Right lefts) - (#.Left lefts))))) + {#.Right lefts} + {#.Left lefts})))) (def: (get_scenario scenario context) (-> (Scenario Synthesis) (Scenario Synthesis)) @@ -160,31 +160,31 @@ (do [! random.monad] [_ (in []) [expected_then actual_then] (scenario context)] - (in [(#synthesis.Seq #synthesis.Pop - (#synthesis.Then expected_then)) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then actual_then))])) + (in [{#synthesis.Seq #synthesis.Pop + {#synthesis.Then expected_then}} + {#synthesis.Seq #synthesis.Pop + {#synthesis.Then actual_then}}])) (do [! random.monad] [_ (in []) .let [real_register (dictionary.size (value@ #necessary context)) fake_register (n.+ (value@ #redundants context) (dictionary.size (value@ #necessary context)))] [expected_then actual_then] (scenario (revised@ #necessary (dictionary.has real_register fake_register) context))] - (in [(#synthesis.Seq (#synthesis.Bind real_register) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then expected_then))) - (#synthesis.Seq (#synthesis.Bind fake_register) - (#synthesis.Seq #synthesis.Pop - (#synthesis.Then actual_then)))]))) + (in [{#synthesis.Seq {#synthesis.Bind real_register} + {#synthesis.Seq #synthesis.Pop + {#synthesis.Then expected_then}}} + {#synthesis.Seq {#synthesis.Bind fake_register} + {#synthesis.Seq #synthesis.Pop + {#synthesis.Then actual_then}}}]))) ($_ random.either (~~ (template [<tag> <random>] [(do [! random.monad] [test <random> [expected_then actual_then] (scenario context)] - (in [(#synthesis.Seq (#synthesis.Test (<tag> test)) - (#synthesis.Then expected_then)) - (#synthesis.Seq (#synthesis.Test (<tag> test)) - (#synthesis.Then actual_then))]))] + (in [{#synthesis.Seq {#synthesis.Test {<tag> test}} + {#synthesis.Then expected_then}} + {#synthesis.Seq {#synthesis.Test {<tag> test}} + {#synthesis.Then actual_then}}]))] [#synthesis.Bit random.bit] [#synthesis.I64 (\ ! each .i64 random.nat)] @@ -195,23 +195,23 @@ (do [! random.monad] [side ..random_side [expected_next actual_next] (path_scenario scenario context)] - (in [(#synthesis.Seq (#synthesis.Access (#synthesis.Side side)) - expected_next) - (#synthesis.Seq (#synthesis.Access (#synthesis.Side side)) - actual_next)])) + (in [{#synthesis.Seq {#synthesis.Access {#synthesis.Side side}} + expected_next} + {#synthesis.Seq {#synthesis.Access {#synthesis.Side side}} + actual_next}])) (do [! random.monad] [member ..random_member [expected_next actual_next] (path_scenario scenario context)] - (in [(#synthesis.Seq (#synthesis.Access (#synthesis.Member member)) - expected_next) - (#synthesis.Seq (#synthesis.Access (#synthesis.Member member)) - actual_next)]))) + (in [{#synthesis.Seq {#synthesis.Access {#synthesis.Member member}} + expected_next} + {#synthesis.Seq {#synthesis.Access {#synthesis.Member member}} + actual_next}]))) (do [! random.monad] [_ (in []) [expected_left actual_left] (path_scenario scenario context) [expected_right actual_right] (path_scenario scenario context)] - (in [(#synthesis.Alt expected_left expected_right) - (#synthesis.Alt actual_left actual_right)])) + (in [{#synthesis.Alt expected_left expected_right} + {#synthesis.Alt actual_left actual_right}])) ))) (def: (case_scenario scenario context) @@ -330,6 +330,6 @@ [[expected input] (..scenario ..default)] (_.cover [/.optimization] (|> (/.optimization input) - (!expect (^multi (#try.Success actual) + (!expect (^multi {#try.Success actual} (\ synthesis.equivalence = expected actual)))))) ))) 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 32dcae9de..e9daa8e53 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -80,10 +80,10 @@ (case (let [source_code (%.code sample)] (/.parse "" (dictionary.empty text.hash) (text.size source_code) [location.dummy 0 source_code])) - (#.Left error) + {#.Left error} false - (#.Right [_ parsed]) + {#.Right [_ parsed]} (\ code.equivalence = parsed sample))) (do ! [other code^] @@ -92,16 +92,16 @@ source_code//size (text.size source_code)] (case (/.parse "" (dictionary.empty text.hash) source_code//size [location.dummy 0 source_code]) - (#.Left error) + {#.Left error} false - (#.Right [remaining =sample]) + {#.Right [remaining =sample]} (case (/.parse "" (dictionary.empty text.hash) source_code//size remaining) - (#.Left error) + {#.Left error} false - (#.Right [_ =other]) + {#.Right [_ =other]} (and (\ code.equivalence = sample =sample) (\ code.equivalence = other =other))))))) ))) @@ -130,10 +130,10 @@ source_code//size (text.size source_code)] (/.parse "" (dictionary.empty text.hash) source_code//size [location.dummy 0 source_code])) - (#.Left error) + {#.Left error} false - (#.Right [_ parsed]) + {#.Right [_ parsed]} (\ code.equivalence = parsed sample))) ))) diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 94f7b92fd..65bcf2d81 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -80,13 +80,13 @@ ($equivalence.spec /.equivalence (..random 0))) (do [! random.monad] - [anonymousT (random.only (|>> (case> (#.Named _ _) false + [anonymousT (random.only (|>> (case> {#.Named _ _} false _ true)) (..random 0)) name/0 ..name name/1 ..name - .let [namedT (#.Named name/0 anonymousT) - aliasedT (#.Named name/1 namedT)]] + .let [namedT {#.Named name/0 anonymousT} + aliasedT {#.Named name/1 namedT}]] ($_ _.and (_.cover [/.de_aliased] (\ /.equivalence = namedT (/.de_aliased aliasedT))) @@ -97,7 +97,7 @@ members (|> (..random 0) (random.only (function (_ type) (case type - (^or (#.Sum _) (#.Product _)) + (^or {#.Sum _} {#.Product _}) #0 _ @@ -123,7 +123,7 @@ (do maybe.monad [partial (/.applied (list Bit) Ann) full (/.applied (list Int) partial)] - (in (\ /.equivalence = full (#.Product Bit Int))))) + (in (\ /.equivalence = full {#.Product Bit Int})))) (|> (/.applied (list Bit) Text) (case> #.None #1 _ #0)))) (do [! random.monad] @@ -132,7 +132,7 @@ extra (|> (..random 0) (random.only (function (_ type) (case type - (^or (#.Function _) (#.Apply _)) + (^or {#.Function _} {#.Apply _}) #0 _ @@ -153,7 +153,7 @@ body_type (|> (..random 0) (random.only (function (_ type) (case type - (^or (#.UnivQ _) (#.ExQ _)) + (^or {#.UnivQ _} {#.ExQ _}) #0 _ @@ -179,7 +179,7 @@ element_type (|> (..random 0) (random.only (function (_ type) (case type - (^ (#.Primitive name (list element_type))) + (^ {#.Primitive name (list element_type)}) (not (text\= array.type_name name)) _ diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux index 9004d7fbe..826569dae 100644 --- a/stdlib/source/test/lux/type/abstract.lux +++ b/stdlib/source/test/lux/type/abstract.lux @@ -37,12 +37,12 @@ (syntax: (with_no_active_frames [macro <code>.any]) (function (_ compiler) (let [verdict (case ((macro.expansion macro) compiler) - (#try.Failure error) + {#try.Failure error} (exception.match? /.no_active_frames error) - (#try.Success _) + {#try.Success _} false)] - (#try.Success [compiler (list (code.bit verdict))])))) + {#try.Success [compiler (list (code.bit verdict))]}))) (with_expansions [no_current! (..with_no_active_frames (..current)) no_specific! (..with_no_active_frames (..specific))] diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index d3825ef80..1f5c396e6 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -71,18 +71,19 @@ (def: (valid_type? type) (-> Type Bit) (case type - (#.Primitive name params) + {#.Primitive name params} (list.every? valid_type? params) - (#.Ex id) + {#.Ex id} #1 (^template [<tag>] - [(<tag> left right) - (and (valid_type? left) (valid_type? right))]) + [{<tag> left right} + (and (valid_type? left) + (valid_type? right))]) ([#.Sum] [#.Product] [#.Function]) - (#.Named name type') + {#.Named name type'} (valid_type? type') _ @@ -96,7 +97,7 @@ (Comparison (All (_ a) (/.Check a))) (function (_ == left right) (case [(/.result /.fresh_context left) (/.result /.fresh_context right)] - [(#try.Success left) (#try.Success right)] + [{#try.Success left} {#try.Success right}] (== left right) _ @@ -124,25 +125,25 @@ (case (/.result /.fresh_context (: (/.Check Any) (/.failure expected))) - (#try.Success _) false - (#try.Failure actual) (same? expected actual)))) + {#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))) - (#try.Success _) true - (#try.Failure actual) false) + {#try.Success _} true + {#try.Failure actual} false) (case (/.result /.fresh_context (/.assertion expected false)) - (#try.Success _) false - (#try.Failure actual) (same? expected actual))))) + {#try.Success _} false + {#try.Failure actual} (same? expected actual))))) (_.cover [/.except] (case (/.result /.fresh_context (: (/.Check Any) (/.except ..yolo []))) - (#try.Success _) false - (#try.Failure error) (exception.match? ..yolo error))) + {#try.Success _} false + {#try.Failure error} (exception.match? ..yolo error))) )) (def: var @@ -153,27 +154,27 @@ (case (/.result /.fresh_context (do /.monad [[var_id var_type] /.var] - (in (type\= var_type (#.Var var_id))))) - (#try.Success verdict) verdict - (#try.Failure error) false)) + (in (type\= var_type {#.Var var_id})))) + {#try.Success verdict} verdict + {#try.Failure error} false)) (do random.monad [nominal (random.ascii/upper 10)] (_.cover [/.bind] (case (/.result /.fresh_context (do /.monad [[var_id var_type] /.var - _ (/.bind (#.Primitive nominal (list)) + _ (/.bind {#.Primitive nominal (list)} var_id)] (in true))) - (#try.Success _) true - (#try.Failure error) false))) + {#try.Success _} true + {#try.Failure error} false))) (do random.monad [nominal (random.ascii/upper 10)] (_.cover [/.bound?] (and (|> (do /.monad [[var_id var_type] /.var pre (/.bound? var_id) - _ (/.bind (#.Primitive nominal (list)) + _ (/.bind {#.Primitive nominal (list)} var_id) post (/.bound? var_id)] (in (and (not pre) @@ -196,36 +197,36 @@ (case (/.result /.fresh_context (do /.monad [[var_id var_type] /.var - _ (/.bind (#.Primitive nominal (list)) + _ (/.bind {#.Primitive nominal (list)} var_id)] - (/.bind (#.Primitive nominal (list)) + (/.bind {#.Primitive nominal (list)} var_id))) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_rebind_var error)))) (do random.monad [nominal (random.ascii/upper 10) var_id random.nat] (_.cover [/.unknown_type_var] (case (/.result /.fresh_context - (/.bind (#.Primitive nominal (list)) + (/.bind {#.Primitive nominal (list)} var_id)) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.unknown_type_var error)))) (do random.monad [nominal (random.ascii/upper 10) - .let [expected (#.Primitive nominal (list))]] + .let [expected {#.Primitive nominal (list)}]] (_.cover [/.peek] (and (|> (do /.monad [[var_id var_type] /.var] (/.peek var_id)) (/.result /.fresh_context) - (case> (#try.Success #.None) true + (case> {#try.Success #.None} true _ false)) (|> (do /.monad [[var_id var/0] /.var @@ -233,41 +234,41 @@ _ (/.check var/0 var/1)] (/.peek var_id)) (/.result /.fresh_context) - (case> (#try.Success #.None) true + (case> {#try.Success #.None} true _ false)) (|> (do /.monad [[var_id var_type] /.var _ (/.bind expected var_id)] (/.peek var_id)) (/.result /.fresh_context) - (case> (#try.Success (#.Some actual)) + (case> {#try.Success {#.Some actual}} (same? expected actual) _ false))))) (do random.monad [nominal (random.ascii/upper 10) - .let [expected (#.Primitive nominal (list))]] + .let [expected {#.Primitive nominal (list)}]] (_.cover [/.read] (case (/.result /.fresh_context (do /.monad [[var_id var_type] /.var _ (/.bind expected var_id)] (/.read var_id))) - (#try.Success actual) + {#try.Success actual} (same? expected actual) _ false))) (do random.monad [nominal (random.ascii/upper 10) - .let [expected (#.Primitive nominal (list))]] + .let [expected {#.Primitive nominal (list)}]] (_.cover [/.unbound_type_var] (case (/.result /.fresh_context (do /.monad [[var_id var_type] /.var] (/.read var_id))) - (#try.Failure error) + {#try.Failure error} (exception.match? /.unbound_type_var error) _ @@ -283,43 +284,43 @@ (list.empty? (value@ #.var_bindings /.fresh_context)))) (_.cover [/.context] (and (case (/.result /.fresh_context /.context) - (#try.Success actual) + {#try.Success actual} (same? /.fresh_context actual) - (#try.Failure error) + {#try.Failure error} false) (case (/.result /.fresh_context (do /.monad [_ /.var] /.context)) - (#try.Success actual) + {#try.Success actual} (and (n.= 1 (value@ #.var_counter actual)) (n.= 0 (value@ #.ex_counter actual)) (n.= 1 (list.size (value@ #.var_bindings actual)))) - (#try.Failure error) + {#try.Failure error} false))) (_.cover [/.existential] (case (/.result /.fresh_context (do /.monad [_ /.existential] /.context)) - (#try.Success actual) + {#try.Success actual} (and (n.= 0 (value@ #.var_counter actual)) (n.= 1 (value@ #.ex_counter actual)) (n.= 0 (list.size (value@ #.var_bindings actual)))) - (#try.Failure error) + {#try.Failure error} false)) )) (def: succeeds? (All (_ a) (-> (/.Check a) Bit)) (|>> (/.result /.fresh_context) - (case> (#try.Success _) + (case> {#try.Success _} true - (#try.Failure error) + {#try.Failure error} false))) (def: fails? @@ -331,7 +332,7 @@ (Random Type) (do random.monad [name (random.ascii/upper 10)] - (in (#.Primitive name (list))))) + (in {#.Primitive name (list)}))) (def: (non_twins = random) (All (_ a) (-> (-> a a Bit) (Random a) (Random [a a]))) @@ -349,22 +350,22 @@ (def: (handles_nominal_types! name/0 name/1 parameter/0 parameter/1) (-> Text Text Type Type Bit) (let [names_matter! - (and (..succeeds? (/.check (#.Primitive name/0 (list)) - (#.Primitive name/0 (list)))) - (..fails? (/.check (#.Primitive name/0 (list)) - (#.Primitive name/1 (list))))) + (and (..succeeds? (/.check {#.Primitive name/0 (list)} + {#.Primitive name/0 (list)})) + (..fails? (/.check {#.Primitive name/0 (list)} + {#.Primitive name/1 (list)}))) parameters_matter! - (and (..succeeds? (/.check (#.Primitive name/0 (list parameter/0)) - (#.Primitive name/0 (list parameter/0)))) - (..fails? (/.check (#.Primitive name/0 (list parameter/0)) - (#.Primitive name/0 (list parameter/1))))) + (and (..succeeds? (/.check {#.Primitive name/0 (list parameter/0)} + {#.Primitive name/0 (list parameter/0)})) + (..fails? (/.check {#.Primitive name/0 (list parameter/0)} + {#.Primitive name/0 (list parameter/1)}))) covariant_parameters! - (and (..succeeds? (/.check (#.Primitive name/0 (list Super)) - (#.Primitive name/0 (list Sub)))) - (..fails? (/.check (#.Primitive name/0 (list Sub)) - (#.Primitive name/0 (list Super)))))] + (and (..succeeds? (/.check {#.Primitive name/0 (list Super)} + {#.Primitive name/0 (list Sub)})) + (..fails? (/.check {#.Primitive name/0 (list Sub)} + {#.Primitive name/0 (list Super)})))] (and names_matter! parameters_matter! covariant_parameters!))) @@ -372,15 +373,15 @@ (template [<assertion> <combinator>] [(def: (<assertion> name/0 name/1) (-> Text Text Bit) - (let [pair/0 (<combinator> (#.Primitive name/0 (list)) (#.Primitive name/0 (list))) - pair/1 (<combinator> (#.Primitive name/1 (list)) (#.Primitive name/1 (list))) + (let [pair/0 {<combinator> {#.Primitive name/0 (list)} {#.Primitive name/0 (list)}} + pair/1 {<combinator> {#.Primitive name/1 (list)} {#.Primitive name/1 (list)}} invariant! (and (..succeeds? (/.check pair/0 pair/0)) (..fails? (/.check pair/0 pair/1))) - super_pair (<combinator> Super Super) - sub_pair (<combinator> Sub Sub) + super_pair {<combinator> Super Super} + sub_pair {<combinator> Sub Sub} covariant! (and (..succeeds? (/.check super_pair sub_pair)) @@ -395,22 +396,22 @@ (def: (handles_function_variance! nominal) (-> Type Bit) (let [functions_have_contravariant_inputs! - (..succeeds? (/.check (#.Function Sub nominal) (#.Function Super nominal))) + (..succeeds? (/.check {#.Function Sub nominal} {#.Function Super nominal})) functions_have_covariant_outputs! - (..succeeds? (/.check (#.Function nominal Super) (#.Function nominal Sub)))] + (..succeeds? (/.check {#.Function nominal Super} {#.Function nominal Sub}))] (and functions_have_contravariant_inputs! functions_have_covariant_outputs!))) (def: (verdict check) (All (_ _) (-> (/.Check _) (/.Check Bit))) (function (_ context) - (#try.Success [context (case (check context) - (#try.Success _) + {#try.Success [context (case (check context) + {#try.Success _} true - (#try.Failure _) - false)]))) + {#try.Failure _} + false)]})) (def: (build_ring tail_size) (-> Nat (/.Check [Type (List Type) Type])) @@ -577,9 +578,9 @@ (def: (names_do_not_affect_types! left_name right_name nominal) (-> Name Name Type Bit) - (and (..succeeds? (/.check (#.Named left_name Any) nominal)) - (..succeeds? (/.check Any (#.Named right_name nominal))) - (..succeeds? (/.check (#.Named left_name Any) (#.Named right_name nominal))))) + (and (..succeeds? (/.check {#.Named left_name Any} nominal)) + (..succeeds? (/.check Any {#.Named right_name nominal})) + (..succeeds? (/.check {#.Named left_name Any} {#.Named right_name nominal})))) ... TODO: Test all the crazy corner cases from /.check_apply (def: (handles_application! nominal/0 nominal/1) @@ -637,20 +638,20 @@ (function (_ dirty_type) (`` ($_ random.either (random\each (function (_ id) - (function.constant (#.Ex id))) + (function.constant {#.Ex id})) random.nat) (do random.monad [module (random.ascii/upper 10) short (random.ascii/upper 10) anonymousT dirty_type] (in (function (_ holeT) - (#.Named [module short] (anonymousT holeT))))) + {#.Named [module short] (anonymousT holeT)}))) (~~ (template [<tag>] [(do random.monad [leftT dirty_type rightT dirty_type] (in (function (_ holeT) - (<tag> (leftT holeT) (rightT holeT)))))] + {<tag> (leftT holeT) (rightT holeT)})))] [#.Sum] [#.Product] @@ -661,15 +662,15 @@ [name (random.ascii/upper 10) parameterT dirty_type] (in (function (_ holeT) - (#.Primitive name (list (parameterT holeT)))))) + {#.Primitive name (list (parameterT holeT))}))) (~~ (template [<tag>] [(do [! random.monad] [funcT dirty_type argT dirty_type body random.nat] (in (function (_ holeT) - (<tag> (list (funcT holeT) (argT holeT)) - (#.Parameter body)))))] + {<tag> (list (funcT holeT) (argT holeT)) + {#.Parameter body}})))] [#.UnivQ] [#.ExQ] @@ -704,7 +705,7 @@ (do random.monad [primitive (random.ascii/upper 3) parameters (random.list parameters (primitive_type (-- parameters)))] - (in (#.Primitive primitive parameters)))) + (in {#.Primitive primitive parameters}))) (def: clean_type (Random Type) @@ -726,16 +727,16 @@ (do random.monad [primitive (random.ascii/upper 10) example ..clean_type] - (in (and (/.subsumes? (#.Primitive primitive (list)) - (#.Primitive primitive (list))) - (/.subsumes? (#.Primitive primitive (list .Any)) - (#.Primitive primitive (list example))) - (not (/.subsumes? (#.Primitive primitive (list example)) - (#.Primitive primitive (list .Any)))) - (/.subsumes? (#.Primitive primitive (list example)) - (#.Primitive primitive (list .Nothing))) - (not (/.subsumes? (#.Primitive primitive (list .Nothing)) - (#.Primitive primitive (list example)))) + (in (and (/.subsumes? {#.Primitive primitive (list)} + {#.Primitive primitive (list)}) + (/.subsumes? {#.Primitive primitive (list .Any)} + {#.Primitive primitive (list example)}) + (not (/.subsumes? {#.Primitive primitive (list example)} + {#.Primitive primitive (list .Any)})) + (/.subsumes? {#.Primitive primitive (list example)} + {#.Primitive primitive (list .Nothing)}) + (not (/.subsumes? {#.Primitive primitive (list .Nothing)} + {#.Primitive primitive (list example)})) )))) (def: for_subsumption|sum @@ -743,14 +744,14 @@ (do random.monad [left ..clean_type right ..clean_type] - (in (and (/.subsumes? (#.Sum .Any .Any) - (#.Sum left right)) - (not (/.subsumes? (#.Sum left right) - (#.Sum .Any .Any))) - (/.subsumes? (#.Sum left right) - (#.Sum .Nothing .Nothing)) - (not (/.subsumes? (#.Sum .Nothing .Nothing) - (#.Sum left right))) + (in (and (/.subsumes? {#.Sum .Any .Any} + {#.Sum left right}) + (not (/.subsumes? {#.Sum left right} + {#.Sum .Any .Any})) + (/.subsumes? {#.Sum left right} + {#.Sum .Nothing .Nothing}) + (not (/.subsumes? {#.Sum .Nothing .Nothing} + {#.Sum left right})) )))) (def: for_subsumption|product @@ -758,14 +759,14 @@ (do random.monad [left ..clean_type right ..clean_type] - (in (and (/.subsumes? (#.Product .Any .Any) - (#.Product left right)) - (not (/.subsumes? (#.Product left right) - (#.Product .Any .Any))) - (/.subsumes? (#.Product left right) - (#.Product .Nothing .Nothing)) - (not (/.subsumes? (#.Product .Nothing .Nothing) - (#.Product left right))) + (in (and (/.subsumes? {#.Product .Any .Any} + {#.Product left right}) + (not (/.subsumes? {#.Product left right} + {#.Product .Any .Any})) + (/.subsumes? {#.Product left right} + {#.Product .Nothing .Nothing}) + (not (/.subsumes? {#.Product .Nothing .Nothing} + {#.Product left right})) )))) (def: for_subsumption|function @@ -773,12 +774,12 @@ (do random.monad [left ..clean_type right ..clean_type] - (in (and (/.subsumes? (#.Function .Nothing .Any) - (#.Function left right)) - (not (/.subsumes? (#.Function left right) - (#.Function .Nothing .Any))) - (not (/.subsumes? (#.Function .Any .Nothing) - (#.Function left right))) + (in (and (/.subsumes? {#.Function .Nothing .Any} + {#.Function left right}) + (not (/.subsumes? {#.Function left right} + {#.Function .Nothing .Any})) + (not (/.subsumes? {#.Function .Any .Nothing} + {#.Function left right})) )))) (template [<tag> <name>] @@ -787,8 +788,8 @@ (do random.monad [id random.nat example ..clean_type] - (in (not (or (/.subsumes? (<tag> id) example) - (/.subsumes? example (<tag> id)))))))] + (in (not (or (/.subsumes? {<tag> id} example) + (/.subsumes? example {<tag> id}))))))] [#.Var for_subsumption|variable] [#.Ex for_subsumption|existential] @@ -809,10 +810,10 @@ [module (random.ascii/upper 10) short (random.ascii/upper 10) example ..clean_type] - (in (and (/.subsumes? (#.Named [module short] example) + (in (and (/.subsumes? {#.Named [module short] example} example) (/.subsumes? example - (#.Named [module short] example)) + {#.Named [module short] example}) )))) (def: for_subsumption @@ -850,8 +851,8 @@ (_.cover [/.result] (case (/.result /.fresh_context (\ /.monad in expected)) - (#try.Success actual) (same? expected actual) - (#try.Failure error) false))) + {#try.Success actual} (same? expected actual) + {#try.Failure error} false))) ..error_handling ..var ..context diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux index b9787f8bf..695caa566 100644 --- a/stdlib/source/test/lux/type/dynamic.lux +++ b/stdlib/source/test/lux/type/dynamic.lux @@ -26,23 +26,23 @@ ($_ _.and (_.cover [/.:dynamic /.:static] (case (/.:static Nat (/.:dynamic expected)) - (#try.Success actual) + {#try.Success actual} (n.= expected actual) - (#try.Failure _) + {#try.Failure _} false)) (_.cover [/.wrong_type] (case (/.:static Text (/.:dynamic expected)) - (#try.Success actual) + {#try.Success actual} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.wrong_type error))) (_.cover [/.format] (case (/.format (/.:dynamic expected)) - (#try.Success actual) + {#try.Success actual} (text\= (%.nat expected) actual) - (#try.Failure _) + {#try.Failure _} false)) )))) diff --git a/stdlib/source/test/lux/type/poly/equivalence.lux b/stdlib/source/test/lux/type/poly/equivalence.lux index 63854e535..738578386 100644 --- a/stdlib/source/test/lux/type/poly/equivalence.lux +++ b/stdlib/source/test/lux/type/poly/equivalence.lux @@ -25,15 +25,15 @@ (type: Variant (.Variant - (#Case0 Bit) - (#Case1 Int) - (#Case2 Frac))) + {#Case0 Bit} + {#Case1 Int} + {#Case2 Frac})) (type: Recursive (Rec Recursive (.Variant - (#Number Frac) - (#Addition Frac Recursive)))) + {#Number Frac} + {#Addition Frac Recursive}))) (type: Record (.Record diff --git a/stdlib/source/test/lux/type/poly/json.lux b/stdlib/source/test/lux/type/poly/json.lux index 0f78aa976..0332e7d00 100644 --- a/stdlib/source/test/lux/type/poly/json.lux +++ b/stdlib/source/test/lux/type/poly/json.lux @@ -50,15 +50,15 @@ (type: Variant (.Variant - (#Bit Bit) - (#Text Text) - (#Frac Frac))) + {#Bit Bit} + {#Text Text} + {#Frac Frac})) (type: Recursive (Rec Recursive (.Variant - (#Number Frac) - (#Addition Frac Recursive)))) + {#Number Frac} + {#Addition Frac Recursive}))) (type: Record (.Record diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index 1b2c17e36..bebde21e2 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -39,7 +39,7 @@ ($_ _.and (_.cover [/.refiner] (case (/.refiner predicate raw) - (#.Some refined) + {#.Some refined} (predicate raw) #.None diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index e8c4b0fba..f78fb8473 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -160,13 +160,13 @@ (monad.do meta.monad [[_ _ exception] (meta.export exception)] (function (_ compiler) - (#.Right [compiler + {#.Right [compiler (list (code.bit (case ((macro.single_expansion to_expand) compiler) - (#try.Success _) + {#try.Success _} false - (#try.Failure error) - true)))])))) + {#try.Failure error} + true)))]}))) (def: .public test Test diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index 3f54d54a7..eaf882016 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -41,12 +41,12 @@ (def: (on_write message [dead? content]) (if dead? (exception.except ..dead []) - (#try.Success [dead? (format content message)]))) + {#try.Success [dead? (format content message)]})) (def: (on_close [dead? content]) (if dead? (exception.except ..dead []) - (#try.Success [true content]))))) + {#try.Success [true content]})))) (def: .public test Test diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index aee4f4922..5ad722723 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -76,16 +76,16 @@ ?stop (\ watcher stop directory)] (_.cover' [/.not_being_watched] (and (case ?concern - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_being_watched error) - (#try.Success _) + {#try.Success _} false) (case ?stop - (#try.Failure error) + {#try.Failure error} (exception.match? /.not_being_watched error) - (#try.Success _) + {#try.Success _} false))))) ))) @@ -118,7 +118,7 @@ (def: (after_modification! fs watcher data expected_path) (-> (//.System Async) (/.Watcher Async) Binary //.Path (Async (Try Bit))) (do (try.with async.monad) - [_ (async.after 1 (#try.Success "Delay to make sure the over_write time-stamp always changes.")) + [_ (async.after 1 {#try.Success "Delay to make sure the over_write time-stamp always changes."}) _ (\ fs write data expected_path) poll/2 (\ watcher poll []) poll/2' (\ watcher poll [])] @@ -191,9 +191,9 @@ [started? ( \ watcher start /.all directory)] (_.cover' [/.cannot_poll_a_non_existent_directory] (case started? - (#try.Success _) + {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.cannot_poll_a_non_existent_directory error)))))) ))) diff --git a/stdlib/source/test/lux/world/net/http/client.lux b/stdlib/source/test/lux/world/net/http/client.lux index 1f80ba26b..9a789fd70 100644 --- a/stdlib/source/test/lux/world/net/http/client.lux +++ b/stdlib/source/test/lux/world/net/http/client.lux @@ -59,11 +59,11 @@ data (|> value (\ nat.decimal encoded) (\ utf8.codec encoded))] - (#try.Success [//status.ok + {#try.Success [//status.ok [#//.headers headers #//.body (function (_ ?wanted_bytes) - (io.io (#try.Success [(binary.size data) - data])))]]))))))]] + (io.io {#try.Success [(binary.size data) + data]}))]]})))))]] (`` ($_ _.and (~~ (template [<definition> <expected>] [(_.cover [<definition>] diff --git a/stdlib/source/test/lux/world/program.lux b/stdlib/source/test/lux/world/program.lux index eafafecaa..c498a939b 100644 --- a/stdlib/source/test/lux/world/program.lux +++ b/stdlib/source/test/lux/world/program.lux @@ -70,9 +70,9 @@ (|> unknown (\ program variable) io.run! - (case> (#try.Success _) + (case> {#try.Success _} false - (#try.Failure error) + {#try.Failure error} (exception.match? /.unknown_environment_variable error))))) )))) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 8d98b5f1f..daa0a5e11 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -44,22 +44,22 @@ (def: (on_error dead?) (if dead? (exception.except ..dead []) - (#try.Success [dead? ""]))) + {#try.Success [dead? ""]})) (def: (on_write message dead?) (if dead? (exception.except ..dead []) - (#try.Success dead?))) + {#try.Success dead?})) (def: (on_destroy dead?) (if dead? (exception.except ..dead []) - (#try.Success true))) + {#try.Success true})) (def: (on_await dead?) (if dead? (exception.except ..dead []) - (#try.Success [true /.normal]))))) + {#try.Success [true /.normal]})))) (def: (io_shell command oops input destruction exit) (-> /.Command Text Text Text /.Exit (/.Shell IO)) @@ -70,15 +70,15 @@ (: (/.Process IO)) (implementation (def: (read _) - (io.io (#try.Success command))) + (io.io {#try.Success command})) (def: (error _) - (io.io (#try.Success oops))) + (io.io {#try.Success oops})) (def: (write message) - (io.io (#try.Failure message))) + (io.io {#try.Failure message})) (def: (destroy _) - (io.io (#try.Failure destruction))) + (io.io {#try.Failure destruction})) (def: (await _) - (io.io (#try.Success exit)))))))) + (io.io {#try.Success exit}))))))) (def: .public test Test @@ -103,20 +103,20 @@ error (\ process error []) wrote! (do ! [write (\ process write input)] - (in (#try.Success (case write - (#try.Success _) + (in {#try.Success (case write + {#try.Success _} false - (#try.Failure write) - (text\= input write))))) + {#try.Failure write} + (text\= input write))})) destroyed! (do ! [destroy (\ process destroy [])] - (in (#try.Success (case destroy - (#try.Success _) + (in {#try.Success (case destroy + {#try.Success _} false - (#try.Failure destroy) - (text\= destruction destroy))))) + {#try.Failure destroy} + (text\= destruction destroy))})) await (\ process await [])] (in (and (text\= command read) (text\= oops error) |